diff options
Diffstat (limited to 'target/linux')
18 files changed, 650 insertions, 129 deletions
diff --git a/target/linux/archs38/generic/profiles/00-default.mk b/target/linux/archs38/generic/profiles/00-default.mk index 10edb88ff9..b0971080da 100644 --- a/target/linux/archs38/generic/profiles/00-default.mk +++ b/target/linux/archs38/generic/profiles/00-default.mk @@ -7,7 +7,7 @@ define Profile/Default NAME:=Default Profile (all drivers) - PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci + PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-mmc kmod-sdhci kmod-ath9k-htc wpad-mini endef define Profile/Default/Description diff --git a/target/linux/archs38/generic/profiles/02-axs103.mk b/target/linux/archs38/generic/profiles/02-axs103.mk index 4a8ea3a1db..156bef7d0a 100644 --- a/target/linux/archs38/generic/profiles/02-axs103.mk +++ b/target/linux/archs38/generic/profiles/02-axs103.mk @@ -7,7 +7,7 @@ define Profile/axs103 NAME:=Synopsys DesignWare AXS103 - PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci + PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-mmc kmod-sdhci kmod-ath9k-htc wpad-mini endef define Profile/axs103/Description diff --git a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc index 7056017107..16793ffa6b 100644 --- a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc @@ -3,5 +3,5 @@ kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) mtd ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 -mtd fixseama firmware && exit 0 +mtd ${kernel_size:+-c 0x$kernel_size} fixseama firmware && exit 0 exit 1 diff --git a/target/linux/bcm53xx/config-4.4 b/target/linux/bcm53xx/config-4.4 index 5611cfe0d4..b1580319e3 100644 --- a/target/linux/bcm53xx/config-4.4 +++ b/target/linux/bcm53xx/config-4.4 @@ -54,10 +54,6 @@ CONFIG_ARM_THUMB=y CONFIG_ARM_VIRT_EXT=y CONFIG_ATAGS=y CONFIG_AUTO_ZRELADDR=y -CONFIG_SWCONFIG_B53=y -# CONFIG_SWCONFIG_B53_MMAP_DRIVER is not set -# CONFIG_SWCONFIG_B53_PHY_DRIVER is not set -CONFIG_SWCONFIG_B53_SRAB_DRIVER=y CONFIG_BCM47XX_NVRAM=y CONFIG_BCM47XX_SPROM=y CONFIG_BCM47XX_WDT=y @@ -200,8 +196,6 @@ CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y -CONFIG_KERNEL_CAT=y -# CONFIG_KERNEL_XZ is not set CONFIG_LIBFDT=y CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_LZO_COMPRESS=y @@ -259,6 +253,7 @@ CONFIG_PCI_DOMAINS_GENERIC=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +# CONFIG_PHY_BCM_NS_USB2 is not set CONFIG_PINCTRL=y # CONFIG_PL310_ERRATA_588369 is not set # CONFIG_PL310_ERRATA_727915 is not set @@ -287,6 +282,10 @@ CONFIG_SPI_GPIO=y CONFIG_SPI_MASTER=y CONFIG_SRCU=y CONFIG_SWCONFIG=y +CONFIG_SWCONFIG_B53=y +# CONFIG_SWCONFIG_B53_MMAP_DRIVER is not set +# CONFIG_SWCONFIG_B53_PHY_DRIVER is not set +CONFIG_SWCONFIG_B53_SRAB_DRIVER=y CONFIG_SWIOTLB=y CONFIG_SWP_EMULATE=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 04e418d1e9..e067d4da5c 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -27,19 +27,16 @@ endef define Build/lzma-d16 $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new - @mv $@.new $@ -endef - -define Build/mkfs/squashfs - ( cd $(KDIR); $(STAGING_DIR_HOST)/bin/ubinize -p 128KiB -m 2048 -o $(KDIR)/root-block-0x20000-min-0x800.ubi ubinize.cfg ) + mv $@.new $@ endef define Build/trx-serial $(STAGING_DIR_HOST)/bin/trx \ - -o $@ \ + -o $@.new \ -m 33554432 \ -f $(word 1,$^) -a 1024 \ - -f $(KDIR)/root.squashfs -a 0x10000 -A $(KDIR)/fs_mark + -f $@ -a 0x10000 -A $(KDIR)/fs_mark + mv $@.new $@ endef define Build/trx-nand @@ -48,11 +45,12 @@ define Build/trx-nand # root: UBI with one extra block containing UBI mark to trigger erasing # rest of partition $(STAGING_DIR_HOST)/bin/trx \ - -o $@ \ + -o $@.new \ -m 33554432 \ -f $(word 1,$^) -a 0x20000 -b 0x400000 \ - -f $(KDIR)/root-block-0x20000-min-0x800.ubi \ + -f $@ \ -A $(KDIR)/ubi_mark -a 0x20000 + mv $@.new $@ endef define Build/asus-trx @@ -69,7 +67,7 @@ define Build/seama-nand -m "type=firmware" \ -f $(word 1,$^) \ -b 0x400000 \ - -f $(KDIR)/root-block-0x20000-min-0x800.ubi \ + -f $@ \ -f $(KDIR)/ubi_mark # Seama container $(STAGING_DIR_HOST)/bin/seama \ @@ -90,12 +88,15 @@ define Device/Default KERNEL_NAME := zImage IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2) IMAGES := trx - IMAGE/trx := trx-nand + BLOCKSIZE := 128KiB + PAGESIZE := 2048 + UBINIZE_OPTS := + IMAGE/trx := append-ubi | trx-nand endef define Device/asus IMAGES := trx - IMAGE/trx := trx-nand | asus-trx + IMAGE/trx := append-ubi | trx-nand | asus-trx endef define AsusDevice @@ -106,21 +107,13 @@ define AsusDevice TARGET_DEVICES += asus-$(1) endef -define Device/linksys - IMAGES := trx - IMAGE/trx := trx-nand -endef - define LinksysDevice - define Device/linksys-$(1) - $$(Device/linksys) - endef TARGET_DEVICES += linksys-$(1) endef define Device/dlink IMAGES := bin - IMAGE/bin := seama-nand + IMAGE/bin := append-ubi | seama-nand endef define DLinkDevice @@ -133,7 +126,7 @@ endef define Device/netgear IMAGES := chk - IMAGE/chk := trx-nand | netgear-chk + IMAGE/chk := append-ubi | trx-nand | netgear-chk NETGEAR_REGION := 1 endef @@ -162,7 +155,7 @@ endef define Device/smartrg-sr400ac IMAGES := trx - IMAGE/trx := trx-serial + IMAGE/trx := append-rootfs | trx-serial endef TARGET_DEVICES += \ diff --git a/target/linux/bcm53xx/image/ubinize.cfg b/target/linux/bcm53xx/image/ubinize.cfg deleted file mode 100644 index a4f2f09d9e..0000000000 --- a/target/linux/bcm53xx/image/ubinize.cfg +++ /dev/null @@ -1,24 +0,0 @@ -[rootfs] -# Volume mode (other option is static) -mode=ubi -# Source image -image=root.squashfs -# Volume ID in UBI image -vol_id=0 -# Allow for dynamic resize -vol_type=dynamic -# Volume name -vol_name=rootfs - -[rootfs_data] -# Volume mode (other option is static) -mode=ubi -# Volume ID in UBI image -vol_id=1 -# Allow for dynamic resize -vol_type=dynamic -# Volume name -vol_name=rootfs_data -# Autoresize volume at first mount -vol_flags=autoresize -vol_size=1MiB diff --git a/target/linux/bcm53xx/patches-4.4/039-ARM-dts-BCM5301x-Add-RNG-Device-Tree-node.patch b/target/linux/bcm53xx/patches-4.4/039-ARM-dts-BCM5301x-Add-RNG-Device-Tree-node.patch new file mode 100644 index 0000000000..9b18ac6886 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/039-ARM-dts-BCM5301x-Add-RNG-Device-Tree-node.patch @@ -0,0 +1,27 @@ +From 36e55669ebdef9eaf3f4ab4e82a07bb4b95a4813 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli <f.fainelli@gmail.com> +Date: Wed, 22 Jun 2016 17:27:03 -0700 +Subject: [PATCH] ARM: dts: BCM5301x: Add RNG Device Tree node + +Add the DT node for the random number generator peripheral. + +Acked-by: Scott Branden <scott.branden@broadcom.com> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/bcm5301x.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -302,6 +302,11 @@ + /* ports are defined in board DTS */ + }; + ++ rng: rng@18004000 { ++ compatible = "brcm,bcm5301x-rng"; ++ reg = <0x18004000 0x14>; ++ }; ++ + nand: nand@18028000 { + compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1", "brcm,brcmnand"; + reg = <0x18028000 0x600>, <0x1811a408 0x600>, <0x18028f00 0x20>; diff --git a/target/linux/bcm53xx/patches-4.4/040-ARM-dts-BCM5301x-Add-BCM953012ER-board.patch b/target/linux/bcm53xx/patches-4.4/040-ARM-dts-BCM5301x-Add-BCM953012ER-board.patch new file mode 100644 index 0000000000..dd24e2624d --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/040-ARM-dts-BCM5301x-Add-BCM953012ER-board.patch @@ -0,0 +1,139 @@ +From f8c331bda6a90b239f600020eec1b0defe7249b5 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli <f.fainelli@gmail.com> +Date: Wed, 22 Jun 2016 17:00:35 -0700 +Subject: [PATCH] ARM: dts: BCM5301x: Add BCM953012ER board + +Add support for the Broadcom BCM953012 Enterprise Router reference +board, enable the following peripherals: + +- UART0 (UART1 is not populated) +- WPS and restart GPIO buttons +- Ethernet switch w/ only two facing ports +- NAND flash +- SPI-NOR flash + +Acked-by: Jon Mason <jon.mason@broadcom.com> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm953012er.dts | 104 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 105 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm953012er.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -79,6 +79,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm47094-dlink-dir-885l.dtb \ + bcm94708.dtb \ + bcm94709.dtb \ ++ bcm953012er.dtb \ + bcm953012k.dtb + dtb-$(CONFIG_ARCH_BCM_63XX) += \ + bcm963138dvt.dtb +--- /dev/null ++++ b/arch/arm/boot/dts/bcm953012er.dts +@@ -0,0 +1,104 @@ ++/* ++ * BSD LICENSE ++ * ++ * Copyright(c) 2016 Broadcom. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * * Neither the name of Broadcom Corporation nor the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ model = "NorthStar Enterprise Router (BCM953012ER)"; ++ compatible = "brcm,bcm953012er", "brcm,brcm53012", "brcm,bcm4708"; ++ ++ aliases { ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x8000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ wps { ++ label = "WPS"; ++ linux,code = <KEY_WPS_BUTTON>; ++ gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; ++ }; ++ ++ restart { ++ label = "Reset"; ++ linux,code = <KEY_RESTART>; ++ gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&spi_nor { ++ status = "okay"; ++}; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "port0"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "port1"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-4.4/041-0001-ARM-BCM5301X-Specify-NAND-chip-select-and-ECC-in-sep.patch b/target/linux/bcm53xx/patches-4.4/041-0001-ARM-BCM5301X-Specify-NAND-chip-select-and-ECC-in-sep.patch new file mode 100644 index 0000000000..36e96fc700 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/041-0001-ARM-BCM5301X-Specify-NAND-chip-select-and-ECC-in-sep.patch @@ -0,0 +1,65 @@ +From 8ab5f1fbd39c29125403678a0caf0a71046da361 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Mon, 6 Jun 2016 09:43:49 +0200 +Subject: [PATCH 1/2] ARM: BCM5301X: Specify NAND chip select and ECC in + separated files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Using separated file with common chip select parameters will allow us +adding other ECC setups without code duplication. + +Signed-off-by: RafaÅ MiÅecki <zajec5@gmail.com> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/bcm5301x-nand-cs0-bch8.dtsi | 16 +++++----------- + arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi | 18 ++++++++++++++++++ + 2 files changed, 23 insertions(+), 11 deletions(-) + create mode 100644 arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi + +--- a/arch/arm/boot/dts/bcm5301x-nand-cs0-bch8.dtsi ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0-bch8.dtsi +@@ -9,16 +9,10 @@ + * Licensed under the GNU/GPL. See COPYING for details. + */ + +-/ { +- nand@18028000 { +- nandcs@0 { +- compatible = "brcm,nandcs"; +- reg = <0>; +- #address-cells = <1>; +- #size-cells = <1>; ++#include "bcm5301x-nand-cs0.dtsi" + +- nand-ecc-strength = <8>; +- nand-ecc-step-size = <512>; +- }; +- }; ++&nandcs { ++ nand-ecc-algo = "bch"; ++ nand-ecc-strength = <8>; ++ nand-ecc-step-size = <512>; + }; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi +@@ -0,0 +1,18 @@ ++/* ++ * Broadcom Northstar NAND. ++ * ++ * Copyright (C) 2015 Hauke Mehrtens <hauke@hauke-m.de> ++ * ++ * Licensed under the GNU/GPL. See COPYING for details. ++ */ ++ ++/ { ++ nand@18028000 { ++ nandcs: nandcs@0 { ++ compatible = "brcm,nandcs"; ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-4.4/041-0002-ARM-BCM5301X-Fix-NAND-ECC-parameters-for-D-Link-DIR-.patch b/target/linux/bcm53xx/patches-4.4/041-0002-ARM-BCM5301X-Fix-NAND-ECC-parameters-for-D-Link-DIR-.patch new file mode 100644 index 0000000000..07f0d4450f --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/041-0002-ARM-BCM5301X-Fix-NAND-ECC-parameters-for-D-Link-DIR-.patch @@ -0,0 +1,49 @@ +From 70a0ae1c33572f012b734d4b574f38136c57f1a0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Mon, 6 Jun 2016 09:43:50 +0200 +Subject: [PATCH 2/2] ARM: BCM5301X: Fix NAND ECC parameters for D-Link + DIR-885L +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device uses BCH-1 instead of BCH-8. This fixes ECC errors and makes +NAND usable with brcmnand. + +Signed-off-by: RafaÅ MiÅecki <zajec5@gmail.com> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 2 +- + arch/arm/boot/dts/bcm5301x-nand-cs0-bch1.dtsi | 15 +++++++++++++++ + 2 files changed, 16 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/bcm5301x-nand-cs0-bch1.dtsi + +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -10,7 +10,7 @@ + /dts-v1/; + + #include "bcm4708.dtsi" +-#include "bcm5301x-nand-cs0-bch8.dtsi" ++#include "bcm5301x-nand-cs0-bch1.dtsi" + + / { + compatible = "dlink,dir-885l", "brcm,bcm47094", "brcm,bcm4708"; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0-bch1.dtsi +@@ -0,0 +1,15 @@ ++/* ++ * Broadcom Northstar NAND. ++ * ++ * Copyright (C) 2016 RafaÅ MiÅecki <rafal.milecki@gmail.com> ++ * ++ * Licensed under the ISC license. ++ */ ++ ++#include "bcm5301x-nand-cs0.dtsi" ++ ++&nandcs { ++ nand-ecc-algo = "bch"; ++ nand-ecc-strength = <1>; ++ nand-ecc-step-size = <512>; ++}; diff --git a/target/linux/bcm53xx/patches-4.4/081-0003-USB-bcma-use-simpler-devm-helper-for-getting-vcc-GPI.patch b/target/linux/bcm53xx/patches-4.4/081-0003-USB-bcma-use-simpler-devm-helper-for-getting-vcc-GPI.patch new file mode 100644 index 0000000000..c5074101cf --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/081-0003-USB-bcma-use-simpler-devm-helper-for-getting-vcc-GPI.patch @@ -0,0 +1,34 @@ +From 1507372b97a098fd51b92c4dbdbbcd65cba26939 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Wed, 23 Mar 2016 12:37:11 +0100 +Subject: [PATCH] USB: bcma: use simpler devm helper for getting vcc GPIO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Thanks to switching to devm_gpiod_get: +1) We don't have to pass fwnode pointer +2) We can request initial GPIO value at getting call +This was successfully tested on Netgear R6250 (BCM4708). + +Signed-off-by: RafaÅ MiÅecki <zajec5@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/bcma-hcd.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -352,10 +352,8 @@ static int bcma_hcd_probe(struct bcma_de + usb_dev->core = core; + + if (core->dev.of_node) +- usb_dev->gpio_desc = devm_get_gpiod_from_child(&core->dev, "vcc", +- &core->dev.of_node->fwnode); +- if (!IS_ERR_OR_NULL(usb_dev->gpio_desc)) +- gpiod_direction_output(usb_dev->gpio_desc, 1); ++ usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", ++ GPIOD_OUT_HIGH); + + switch (core->id.id) { + case BCMA_CORE_USB20_HOST: diff --git a/target/linux/bcm53xx/patches-4.4/089-0001-phy-bcm-ns-usb2-new-driver-for-USB-2.0-PHY-on-Norths.patch b/target/linux/bcm53xx/patches-4.4/089-0001-phy-bcm-ns-usb2-new-driver-for-USB-2.0-PHY-on-Norths.patch new file mode 100644 index 0000000000..36044c5a59 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/089-0001-phy-bcm-ns-usb2-new-driver-for-USB-2.0-PHY-on-Norths.patch @@ -0,0 +1,270 @@ +From d3feb406733544dbf0e239ef945a09decdceac88 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Thu, 14 Apr 2016 11:37:43 +0200 +Subject: [PATCH] phy: bcm-ns-usb2: new driver for USB 2.0 PHY on Northstar +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Northstar is a family of SoCs used in home routers. They have USB 2.0 +and 3.0 controllers with PHYs that need to be properly initialized. +This driver provides PHY init support in a generic way and can be bound +with an EHCI controller driver. +There are (just a few) registers being defined in bcma header. It's +because DMU/CRU registers will be also needed in other drivers. We will +need them e.g. in PCIe controller/PHY driver and at some point probably +in clock driver for BCM53573 chipset. By using include/linux/bcma/ we +avoid code duplication. + +Signed-off-by: RafaÅ MiÅecki <zajec5@gmail.com> +Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> +--- + .../devicetree/bindings/phy/bcm-ns-usb2-phy.txt | 21 ++++ + drivers/phy/Kconfig | 9 ++ + drivers/phy/Makefile | 1 + + drivers/phy/phy-bcm-ns-usb2.c | 137 +++++++++++++++++++++ + include/linux/bcma/bcma.h | 1 + + include/linux/bcma/bcma_driver_arm_c9.h | 15 +++ + 6 files changed, 184 insertions(+) + create mode 100644 Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt + create mode 100644 drivers/phy/phy-bcm-ns-usb2.c + create mode 100644 include/linux/bcma/bcma_driver_arm_c9.h + +diff --git a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt +new file mode 100644 +index 0000000..a7aee9e +--- /dev/null ++++ b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt +@@ -0,0 +1,21 @@ ++Driver for Broadcom Northstar USB 2.0 PHY ++ ++Required properties: ++- compatible: brcm,ns-usb2-phy ++- reg: iomem address range of DMU (Device Management Unit) ++- reg-names: "dmu", the only needed & supported reg right now ++- clocks: USB PHY reference clock ++- clock-names: "phy-ref-clk", the only needed & supported clock right now ++ ++To initialize USB 2.0 PHY driver needs to setup PLL correctly. To do this it ++requires passing phandle to the USB PHY reference clock. ++ ++Example: ++ usb2-phy { ++ compatible = "brcm,ns-usb2-phy"; ++ reg = <0x1800c000 0x1000>; ++ reg-names = "dmu"; ++ #phy-cells = <0>; ++ clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; ++ clock-names = "phy-ref-clk"; ++ }; +diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig +index f6ff76e..f2b458f 100644 +--- a/drivers/phy/Kconfig ++++ b/drivers/phy/Kconfig +@@ -15,6 +15,15 @@ config GENERIC_PHY + phy users can obtain reference to the PHY. All the users of this + framework should select this config. + ++config PHY_BCM_NS_USB2 ++ tristate "Broadcom Northstar USB 2.0 PHY Driver" ++ depends on ARCH_BCM_IPROC || COMPILE_TEST ++ depends on HAS_IOMEM && OF ++ select GENERIC_PHY ++ help ++ Enable this to support Broadcom USB 2.0 PHY connected to the USB ++ controller on Northstar family. ++ + config PHY_BERLIN_USB + tristate "Marvell Berlin USB PHY Driver" + depends on ARCH_BERLIN && RESET_CONTROLLER && HAS_IOMEM && OF +diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile +index f03fa1f..0de09e1 100644 +--- a/drivers/phy/Makefile ++++ b/drivers/phy/Makefile +@@ -3,6 +3,7 @@ + # + + obj-$(CONFIG_GENERIC_PHY) += phy-core.o ++obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o + obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o + obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o + obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o +diff --git a/drivers/phy/phy-bcm-ns-usb2.c b/drivers/phy/phy-bcm-ns-usb2.c +new file mode 100644 +index 0000000..95ab6b2 +--- /dev/null ++++ b/drivers/phy/phy-bcm-ns-usb2.c +@@ -0,0 +1,137 @@ ++/* ++ * Broadcom Northstar USB 2.0 PHY Driver ++ * ++ * Copyright (C) 2016 RafaÅ MiÅecki <zajec5@gmail.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include <linux/bcma/bcma.h> ++#include <linux/clk.h> ++#include <linux/delay.h> ++#include <linux/err.h> ++#include <linux/module.h> ++#include <linux/of_address.h> ++#include <linux/of_platform.h> ++#include <linux/phy/phy.h> ++#include <linux/platform_device.h> ++#include <linux/slab.h> ++ ++struct bcm_ns_usb2 { ++ struct device *dev; ++ struct clk *ref_clk; ++ struct phy *phy; ++ void __iomem *dmu; ++}; ++ ++static int bcm_ns_usb2_phy_init(struct phy *phy) ++{ ++ struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy); ++ struct device *dev = usb2->dev; ++ void __iomem *dmu = usb2->dmu; ++ u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv; ++ int err = 0; ++ ++ err = clk_prepare_enable(usb2->ref_clk); ++ if (err < 0) { ++ dev_err(dev, "Failed to prepare ref clock: %d\n", err); ++ goto err_out; ++ } ++ ++ ref_clk_rate = clk_get_rate(usb2->ref_clk); ++ if (!ref_clk_rate) { ++ dev_err(dev, "Failed to get ref clock rate\n"); ++ err = -EINVAL; ++ goto err_clk_off; ++ } ++ ++ usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL); ++ ++ if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) { ++ usb_pll_pdiv = usb2ctl; ++ usb_pll_pdiv &= BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK; ++ usb_pll_pdiv >>= BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_SHIFT; ++ } else { ++ usb_pll_pdiv = 1 << 3; ++ } ++ ++ /* Calculate ndiv based on a solid 1920 MHz that is for USB2 PHY */ ++ usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate; ++ ++ /* Unlock DMU PLL settings with some magic value */ ++ writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY); ++ ++ /* Write USB 2.0 PLL control setting */ ++ usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK; ++ usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT; ++ writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL); ++ ++ /* Lock DMU PLL settings */ ++ writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY); ++ ++err_clk_off: ++ clk_disable_unprepare(usb2->ref_clk); ++err_out: ++ return err; ++} ++ ++static const struct phy_ops ops = { ++ .init = bcm_ns_usb2_phy_init, ++ .owner = THIS_MODULE, ++}; ++ ++static int bcm_ns_usb2_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct bcm_ns_usb2 *usb2; ++ struct resource *res; ++ struct phy_provider *phy_provider; ++ ++ usb2 = devm_kzalloc(&pdev->dev, sizeof(*usb2), GFP_KERNEL); ++ if (!usb2) ++ return -ENOMEM; ++ usb2->dev = dev; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmu"); ++ usb2->dmu = devm_ioremap_resource(dev, res); ++ if (IS_ERR(usb2->dmu)) { ++ dev_err(dev, "Failed to map DMU regs\n"); ++ return PTR_ERR(usb2->dmu); ++ } ++ ++ usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk"); ++ if (IS_ERR(usb2->ref_clk)) { ++ dev_err(dev, "Clock not defined\n"); ++ return PTR_ERR(usb2->ref_clk); ++ } ++ ++ usb2->phy = devm_phy_create(dev, NULL, &ops); ++ if (IS_ERR(dev)) ++ return PTR_ERR(dev); ++ ++ phy_set_drvdata(usb2->phy, usb2); ++ platform_set_drvdata(pdev, usb2); ++ ++ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); ++ return PTR_ERR_OR_ZERO(phy_provider); ++} ++ ++static const struct of_device_id bcm_ns_usb2_id_table[] = { ++ { .compatible = "brcm,ns-usb2-phy", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm_ns_usb2_id_table); ++ ++static struct platform_driver bcm_ns_usb2_driver = { ++ .probe = bcm_ns_usb2_probe, ++ .driver = { ++ .name = "bcm_ns_usb2", ++ .of_match_table = bcm_ns_usb2_id_table, ++ }, ++}; ++module_platform_driver(bcm_ns_usb2_driver); ++ ++MODULE_LICENSE("GPL v2"); +diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h +index 0367c63..e6b41f4 100644 +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -4,6 +4,7 @@ + #include <linux/pci.h> + #include <linux/mod_devicetable.h> + ++#include <linux/bcma/bcma_driver_arm_c9.h> + #include <linux/bcma/bcma_driver_chipcommon.h> + #include <linux/bcma/bcma_driver_pci.h> + #include <linux/bcma/bcma_driver_pcie2.h> +diff --git a/include/linux/bcma/bcma_driver_arm_c9.h b/include/linux/bcma/bcma_driver_arm_c9.h +new file mode 100644 +index 0000000..93bd73d +--- /dev/null ++++ b/include/linux/bcma/bcma_driver_arm_c9.h +@@ -0,0 +1,15 @@ ++#ifndef LINUX_BCMA_DRIVER_ARM_C9_H_ ++#define LINUX_BCMA_DRIVER_ARM_C9_H_ ++ ++/* DMU (Device Management Unit) */ ++#define BCMA_DMU_CRU_USB2_CONTROL 0x0164 ++#define BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK 0x00000FFC ++#define BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT 2 ++#define BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK 0x00007000 ++#define BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_SHIFT 12 ++#define BCMA_DMU_CRU_CLKSET_KEY 0x0180 ++#define BCMA_DMU_CRU_STRAPS_CTRL 0x02A0 ++#define BCMA_DMU_CRU_STRAPS_CTRL_USB3 0x00000010 ++#define BCMA_DMU_CRU_STRAPS_CTRL_4BYTE 0x00008000 ++ ++#endif /* LINUX_BCMA_DRIVER_ARM_C9_H_ */ +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-4.4/089-0002-phy-bcm-ns-usb2-checking-the-wrong-variable.patch b/target/linux/bcm53xx/patches-4.4/089-0002-phy-bcm-ns-usb2-checking-the-wrong-variable.patch new file mode 100644 index 0000000000..81144dc2b3 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/089-0002-phy-bcm-ns-usb2-checking-the-wrong-variable.patch @@ -0,0 +1,32 @@ +From 6c081ff6fd5abd621797570be43d5e3c6acfcd58 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter <dan.carpenter@oracle.com> +Date: Tue, 10 May 2016 11:01:33 +0300 +Subject: [PATCH] phy: bcm-ns-usb2: checking the wrong variable + +We intended to test "usb2->phy" here instead of "dev". + +Fixes: d3feb4067335 ('phy: bcm-ns-usb2: new driver for USB 2.0 PHY on Northstar') +Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> +Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> +--- + drivers/phy/phy-bcm-ns-usb2.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/phy/phy-bcm-ns-usb2.c b/drivers/phy/phy-bcm-ns-usb2.c +index 95ab6b2..58dff80 100644 +--- a/drivers/phy/phy-bcm-ns-usb2.c ++++ b/drivers/phy/phy-bcm-ns-usb2.c +@@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) + } + + usb2->phy = devm_phy_create(dev, NULL, &ops); +- if (IS_ERR(dev)) +- return PTR_ERR(dev); ++ if (IS_ERR(usb2->phy)) ++ return PTR_ERR(usb2->phy); + + phy_set_drvdata(usb2->phy, usb2); + platform_set_drvdata(pdev, usb2); +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-4.4/101-use-part-parser.patch b/target/linux/bcm53xx/patches-4.4/101-use-part-parser.patch index 8d48673c6d..4ecb8dc693 100644 --- a/target/linux/bcm53xx/patches-4.4/101-use-part-parser.patch +++ b/target/linux/bcm53xx/patches-4.4/101-use-part-parser.patch @@ -1,9 +1,9 @@ ---- a/arch/arm/boot/dts/bcm5301x-nand-cs0-bch8.dtsi -+++ b/arch/arm/boot/dts/bcm5301x-nand-cs0-bch8.dtsi -@@ -19,6 +19,8 @@ - - nand-ecc-strength = <8>; - nand-ecc-step-size = <512>; +--- a/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi +@@ -13,6 +13,8 @@ + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + linux,part-probe = "ofpart", "bcm47xxpart"; }; diff --git a/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch b/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch index a906892a5c..946b8e5efc 100644 --- a/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch +++ b/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch @@ -209,7 +209,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> static int bcma_hcd_probe(struct bcma_device *core) { int err; -@@ -364,6 +531,11 @@ static int bcma_hcd_probe(struct bcma_de +@@ -362,6 +529,11 @@ static int bcma_hcd_probe(struct bcma_de if (err) return err; break; @@ -221,7 +221,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> default: return -ENODEV; } -@@ -377,11 +549,14 @@ static void bcma_hcd_remove(struct bcma_ +@@ -375,11 +547,14 @@ static void bcma_hcd_remove(struct bcma_ struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); struct platform_device *ohci_dev = usb_dev->ohci_dev; struct platform_device *ehci_dev = usb_dev->ehci_dev; @@ -236,7 +236,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> bcma_core_disable(dev, 0); } -@@ -418,6 +593,7 @@ static int bcma_hcd_resume(struct bcma_d +@@ -416,6 +591,7 @@ static int bcma_hcd_resume(struct bcma_d static const struct bcma_device_id bcma_hcd_table[] = { BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS), BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS), diff --git a/target/linux/bcm53xx/patches-4.4/306-ARM-BCM5301X-Add-DT-for-Netgear-R8500.patch b/target/linux/bcm53xx/patches-4.4/306-ARM-BCM5301X-Add-DT-for-Netgear-R8500.patch index 98a670c463..8db50e0116 100644 --- a/target/linux/bcm53xx/patches-4.4/306-ARM-BCM5301X-Add-DT-for-Netgear-R8500.patch +++ b/target/linux/bcm53xx/patches-4.4/306-ARM-BCM5301X-Add-DT-for-Netgear-R8500.patch @@ -20,7 +20,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com> + bcm47094-netgear-r8500.dtb \ bcm94708.dtb \ bcm94709.dtb \ - bcm953012k.dtb + bcm953012er.dtb \ --- /dev/null +++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts @@ -0,0 +1,107 @@ diff --git a/target/linux/bcm53xx/patches-4.4/360-ARM-BCM5301X-Fix-NAND-flash-parameters-for-D-Link-DI.patch b/target/linux/bcm53xx/patches-4.4/360-ARM-BCM5301X-Fix-NAND-flash-parameters-for-D-Link-DI.patch deleted file mode 100644 index e114df68d6..0000000000 --- a/target/linux/bcm53xx/patches-4.4/360-ARM-BCM5301X-Fix-NAND-flash-parameters-for-D-Link-DI.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 842f2d4df49fccc31424f9bc6bcc45d1e1d2fda7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> -Date: Mon, 1 Feb 2016 12:37:00 +0100 -Subject: [PATCH] ARM: BCM5301X: Fix NAND flash parameters for D-Link DIR-885L -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It doesn't use 8-bit ECC strength. - -Signed-off-by: Rafał Miłecki <zajec5@gmail.com> ---- - arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - ---- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts -+++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts -@@ -10,7 +10,6 @@ - /dts-v1/; - - #include "bcm4708.dtsi" --#include "bcm5301x-nand-cs0-bch8.dtsi" - - / { - compatible = "dlink,dir-885l", "brcm,bcm47094", "brcm,bcm4708"; -@@ -27,6 +26,13 @@ - - nand: nand@18028000 { - nandcs@0 { -+ compatible = "brcm,nandcs"; -+ reg = <0>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ linux,part-probe = "ofpart", "bcm47xxpart"; -+ - partition@0 { - label = "firmware"; - reg = <0x00000000 0x08000000>; diff --git a/target/linux/bcm53xx/patches-4.4/810-USB-bcma-use-simpler-devm_gpiod_get.patch b/target/linux/bcm53xx/patches-4.4/810-USB-bcma-use-simpler-devm_gpiod_get.patch deleted file mode 100644 index 3779fabea2..0000000000 --- a/target/linux/bcm53xx/patches-4.4/810-USB-bcma-use-simpler-devm_gpiod_get.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> -Date: Sat, 2 Jan 2016 11:26:28 +0100 -Subject: [PATCH] USB: bcma: use simpler devm_gpiod_get -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki <zajec5@gmail.com> ---- - drivers/usb/host/bcma-hcd.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -519,8 +519,7 @@ static int bcma_hcd_probe(struct bcma_de - usb_dev->core = core; - - if (core->dev.of_node) -- usb_dev->gpio_desc = devm_get_gpiod_from_child(&core->dev, "vcc", -- &core->dev.of_node->fwnode); -+ usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", 0); - if (!IS_ERR_OR_NULL(usb_dev->gpio_desc)) - gpiod_direction_output(usb_dev->gpio_desc, 1); - |