From a07730472c49c1f7bb56afa3eb8be23e6e87b4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 28 Jul 2018 21:46:40 +0200 Subject: [PATCH] bcm53xx: backport BCM5301X/BCM53573 dts commits from 4.19+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes Linksys EA9500 support, BCM53573 timer fix and upstream-ready partitions patch that replaces two downstream hacks. Signed-off-by: Rafał Miłecki --- .../base-files/lib/upgrade/platform.sh | 2 +- ...M-dts-BCM53573-Add-architected-timer.patch | 34 +++ ...5301X-Add-support-for-Linksys-EA9500.patch | 269 ++++++++++++++++++ ...ts-BCM5301X-Specify-flash-partitions.patch | 166 +++++++++++ ...x-cfe-partitions-binding-for-Broadco.patch | 34 --- ...part-add-device-specific-workarounds.patch | 56 ---- .../905-BCM53573-minor-hacks.patch | 18 +- 7 files changed, 475 insertions(+), 104 deletions(-) create mode 100644 target/linux/bcm53xx/patches-4.14/038-v4.19-0002-ARM-dts-BCM53573-Add-architected-timer.patch create mode 100644 target/linux/bcm53xx/patches-4.14/038-v4.19-0003-ARM-dts-BCM5301X-Add-support-for-Linksys-EA9500.patch create mode 100644 target/linux/bcm53xx/patches-4.14/130-ARM-dts-BCM5301X-Specify-flash-partitions.patch delete mode 100644 target/linux/bcm53xx/patches-4.14/410-Use-brcm-bcm947xx-cfe-partitions-binding-for-Broadco.patch delete mode 100644 target/linux/bcm53xx/patches-4.14/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh index fbd1036eb1..5a42a36ae4 100644 --- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh @@ -327,7 +327,7 @@ platform_do_upgrade() { case "$file_type" in "chk") cmd=$(platform_trx_from_chk_cmd "$trx");; "cybertan") cmd=$(platform_trx_from_cybertan_cmd "$trx");; - "safeloader") trx=$(platform_img_from_safeloader "$trx");; + "safeloader") trx=$(platform_img_from_safeloader "$trx"); PART_NAME=os-image;; "seama") trx=$(platform_img_from_seama "$trx");; esac diff --git a/target/linux/bcm53xx/patches-4.14/038-v4.19-0002-ARM-dts-BCM53573-Add-architected-timer.patch b/target/linux/bcm53xx/patches-4.14/038-v4.19-0002-ARM-dts-BCM53573-Add-architected-timer.patch new file mode 100644 index 0000000000..f1b301ca27 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/038-v4.19-0002-ARM-dts-BCM53573-Add-architected-timer.patch @@ -0,0 +1,34 @@ +From a21e7548438f3a8f59f9b9f3a8bc973613d3726a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 14 Jun 2018 18:41:47 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Add architected timer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's a standard ARM architected timer that was simply missed when +initially adding this .dtsi file. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53573.dtsi | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -48,6 +48,14 @@ + }; + }; + ++ timer { ++ compatible = "arm,armv7-timer"; ++ interrupts = , ++ , ++ , ++ ; ++ }; ++ + clocks { + #address-cells = <1>; + #size-cells = <1>; diff --git a/target/linux/bcm53xx/patches-4.14/038-v4.19-0003-ARM-dts-BCM5301X-Add-support-for-Linksys-EA9500.patch b/target/linux/bcm53xx/patches-4.14/038-v4.19-0003-ARM-dts-BCM5301X-Add-support-for-Linksys-EA9500.patch new file mode 100644 index 0000000000..701605a973 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/038-v4.19-0003-ARM-dts-BCM5301X-Add-support-for-Linksys-EA9500.patch @@ -0,0 +1,269 @@ +From 2bebdfcdcd0feb58d5df419532a2cedc78a336d7 Mon Sep 17 00:00:00 2001 +From: Vivek Unune +Date: Mon, 18 Jun 2018 13:41:59 -0400 +Subject: [PATCH] ARM: dts: BCM5301X: Add support for Linksys EA9500 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Hardware Info +------------- + +Processor - Broadcom BCM4709C0KFEBG dual-core @ 1.4 GHz +Switch - BCM53012 in BCM4709C0KFEBG & external BCM53125 +DDR3 RAM - 256 MB +Flash - 128 MB (Toshiba TC58BVG0S3HTA00) +2.4GHz - BCM4366 4×4 2.4/5G single chip 802.11ac SoC +Power Amp - Skyworks SE2623L 2.4 GHz power amp (x4) +5GHz x 2 - BCM4366 4×4 2.4/5G single chip 802.11ac SoC +Power Amp - PLX Technology PEX8603 3-lane, 3-port PCIe switch +Ports - 8 Ports, 1 WAN Ports +Antennas - 8 Antennas +Serial Port - @J6 [GND,TX,RX] (VCC NC) 115200 8n1 + +Tested with OpenWrt built with DSA driver and Kernel v4.14 + +Signed-off-by: Vivek Unune +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 229 ++++++++++++++++++++++++ + 1 file changed, 229 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -31,6 +31,235 @@ + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; ++ ++ rfkill { ++ label = "WiFi"; ++ linux,code = ; ++ gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; ++ }; ++ ++ reset { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ wps { ++ label = "bcm53xx:white:wps"; ++ gpios = <&chipcommon 22 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb2 { ++ label = "bcm53xx:green:usb2"; ++ gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ohci_port2>, <&ehci_port2>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ usb3 { ++ label = "bcm53xx:green:usb3"; ++ gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ohci_port1>, <&ehci_port1>, ++ <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ power { ++ label = "bcm53xx:white:power"; ++ gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wifi-disabled { ++ label = "bcm53xx:amber:wifi-disabled"; ++ gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wifi-enabled { ++ label = "bcm53xx:white:wifi-enabled"; ++ gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar1 { ++ label = "bcm53xx:white:bluebar1"; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar2 { ++ label = "bcm53xx:white:bluebar2"; ++ gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar3 { ++ label = "bcm53xx:white:bluebar3"; ++ gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; ++ }; ++ ++ bluebar4 { ++ label = "bcm53xx:white:bluebar4"; ++ gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar5 { ++ label = "bcm53xx:white:bluebar5"; ++ gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar6 { ++ label = "bcm53xx:white:bluebar6"; ++ gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar7 { ++ label = "bcm53xx:white:bluebar7"; ++ gpios = <&chipcommon 21 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluebar8 { ++ label = "bcm53xx:white:bluebar8"; ++ gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ mdio-bus-mux { ++ /* BIT(9) = 1 => external mdio */ ++ mdio_ext: mdio@200 { ++ reg = <0x200>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ ++ mdio-mii-mux { ++ compatible = "mdio-mux-mmioreg"; ++ mdio-parent-bus = <&mdio_ext>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x1800c1c0 0x4>; ++ ++ /* BIT(6) = mdc, BIT(7) = mdio */ ++ mux-mask = <0xc0>; ++ ++ mdio-mii@0 { ++ /* Enable MII function */ ++ reg = <0x0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ switch@0 { ++ compatible = "brcm,bcm53125"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; ++ reset-names = "robo_reset"; ++ reg = <0>; ++ dsa,member = <1 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan1"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan5"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan6"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan3"; ++ }; ++ ++ sw1_p8: port@8 { ++ reg = <8>; ++ ethernet = <&sw0_p0>; ++ label = "cpu"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&usb2 { ++ vcc-gpio = <&chipcommon 13 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3 { ++ vcc-gpio = <&chipcommon 14 GPIO_ACTIVE_HIGH>; ++}; ++ ++&srab { ++ compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; ++ status = "okay"; ++ dsa,member = <0 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan7"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan4"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan8"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ ethernet = <&gmac2>; ++ label = "cpu"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ sw0_p0: port@0 { ++ reg = <0>; ++ label = "extsw"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; + }; + }; + diff --git a/target/linux/bcm53xx/patches-4.14/130-ARM-dts-BCM5301X-Specify-flash-partitions.patch b/target/linux/bcm53xx/patches-4.14/130-ARM-dts-BCM5301X-Specify-flash-partitions.patch new file mode 100644 index 0000000000..5f343eb772 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/130-ARM-dts-BCM5301X-Specify-flash-partitions.patch @@ -0,0 +1,166 @@ +From ed4728d9fa0b19687caa964cf5c2082b80208167 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 28 Jul 2018 13:25:48 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Specify flash partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Most devices use Broadcom standard partitions which allows them to be +described with the "brcm,bcm947xx-cfe-partitions". Exceptions are: +1) TP-LINK devices which use "os-image" partition with TRX containing + kernel only + separated rootfs partition. +2) Asus RT-AC87U with custom "asus" partition. + +This commit also removes undocumented and unsupported linux,part-probe +binding which got accidentally upstreamed while describing SPI +controller. + +Signed-off-by: Rafał Miłecki +--- + arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts | 28 +++++++++++++++++++ + arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts | 31 ++++++++++++++++++++++ + arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts | 28 +++++++++++++++++++ + arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi | 4 +++ + arch/arm/boot/dts/bcm5301x.dtsi | 5 +++- + 5 files changed, 95 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -94,6 +94,34 @@ + + &spi_nor { + status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ boot@0 { ++ label = "boot"; ++ reg = <0x000000 0x040000>; ++ read-only; ++ }; ++ ++ os-image@100000 { ++ label = "os-image"; ++ reg = <0x040000 0x200000>; ++ compatible = "brcm,trx"; ++ }; ++ ++ rootfs@240000 { ++ label = "rootfs"; ++ reg = <0x240000 0xc00000>; ++ }; ++ ++ nvram@ff0000 { ++ label = "nvram"; ++ reg = <0xff0000 0x010000>; ++ }; ++ }; + }; + + &usb2 { +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -66,3 +66,34 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&nandcs { ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ boot@0 { ++ label = "boot"; ++ reg = <0x00000000 0x00080000>; ++ read-only; ++ }; ++ ++ nvram@80000 { ++ label = "nvram"; ++ reg = <0x00080000 0x00180000>; ++ }; ++ ++ firmware@200000 { ++ label = "firmware"; ++ reg = <0x00200000 0x07cc0000>; ++ compatible = "brcm,trx"; ++ }; ++ ++ asus@7ec0000 { ++ label = "asus"; ++ reg = <0x07ec0000 0x00140000>; ++ read-only; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -103,6 +103,34 @@ + + &spi_nor { + status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ boot@0 { ++ label = "boot"; ++ reg = <0x000000 0x040000>; ++ read-only; ++ }; ++ ++ os-image@100000 { ++ label = "os-image"; ++ reg = <0x040000 0x200000>; ++ compatible = "brcm,trx"; ++ }; ++ ++ rootfs@240000 { ++ label = "rootfs"; ++ reg = <0x240000 0xc00000>; ++ }; ++ ++ nvram@ff0000 { ++ label = "nvram"; ++ reg = <0xff0000 0x010000>; ++ }; ++ }; + }; + + &usb3_phy { +--- a/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi +@@ -12,6 +12,10 @@ + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; ++ ++ partitions { ++ compatible = "brcm,bcm947xx-cfe-partitions"; ++ }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -475,8 +475,11 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; +- linux,part-probe = "ofpart", "bcm47xxpart"; + status = "disabled"; ++ ++ partitions { ++ compatible = "brcm,bcm947xx-cfe-partitions"; ++ }; + }; + }; + diff --git a/target/linux/bcm53xx/patches-4.14/410-Use-brcm-bcm947xx-cfe-partitions-binding-for-Broadco.patch b/target/linux/bcm53xx/patches-4.14/410-Use-brcm-bcm947xx-cfe-partitions-binding-for-Broadco.patch deleted file mode 100644 index dd8ce3d303..0000000000 --- a/target/linux/bcm53xx/patches-4.14/410-Use-brcm-bcm947xx-cfe-partitions-binding-for-Broadco.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] Use "brcm,bcm947xx-cfe-partitions" binding for Broadcom - partitions - ---- - ---- a/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi -+++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi -@@ -12,6 +12,10 @@ - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; -+ -+ partitions { -+ compatible = "brcm,bcm947xx-cfe-partitions"; -+ }; - }; - }; - }; ---- a/arch/arm/boot/dts/bcm5301x.dtsi -+++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -456,8 +456,11 @@ - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <20000000>; -- linux,part-probe = "ofpart", "bcm47xxpart"; - status = "disabled"; -+ -+ partitions { -+ compatible = "brcm,bcm947xx-cfe-partitions"; -+ }; - }; - }; - diff --git a/target/linux/bcm53xx/patches-4.14/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch b/target/linux/bcm53xx/patches-4.14/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch deleted file mode 100644 index b4a25a39d0..0000000000 --- a/target/linux/bcm53xx/patches-4.14/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch +++ /dev/null @@ -1,56 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] mtd: bcm47xxpart: add device specific workarounds -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include - -@@ -134,6 +135,36 @@ static int bcm47xxpart_parse(struct mtd_ - break; - } - -+ /* -+ * Device specific workarounds (hacks). We should use DT to -+ * define partitions but we need a working TRX firmware splitter -+ * first. -+ */ -+ if (of_machine_is_compatible("asus,rt-ac87u") && offset == 0x7ec0000) { -+ /* -+ * "asus" partition uses JFFS2 which we don't detect and -+ * we don't want to as this could affect other devices. -+ */ -+ bcm47xxpart_add_part(&parts[curr_part++], "asus", offset, MTD_WRITEABLE); -+ continue; -+ } else if (of_machine_is_compatible("tplink,archer-c5-v2") && offset == 0xe40000) { -+ /* -+ * There is a whole set of partitions (not even listed -+ * by original firmware): "default-mac", "pin", -+ * "partition-table", etc. -+ */ -+ bcm47xxpart_add_part(&parts[curr_part++], "tplink", offset, MTD_WRITEABLE); -+ continue; -+ } else if (of_machine_is_compatible("tplink,archer-c9-v1") && offset == 0xe40000) { -+ /* -+ * There is a whole set of partitions (not even listed -+ * by original firmware): "default-mac", "pin", -+ * "partition-table", etc. -+ */ -+ bcm47xxpart_add_part(&parts[curr_part++], "tplink", offset, MTD_WRITEABLE); -+ continue; -+ } -+ - /* Read beginning of the block */ - err = mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, - &bytes_read, (uint8_t *)buf); diff --git a/target/linux/bcm53xx/patches-4.14/905-BCM53573-minor-hacks.patch b/target/linux/bcm53xx/patches-4.14/905-BCM53573-minor-hacks.patch index 4e0a752d66..e3ee0f7356 100644 --- a/target/linux/bcm53xx/patches-4.14/905-BCM53573-minor-hacks.patch +++ b/target/linux/bcm53xx/patches-4.14/905-BCM53573-minor-hacks.patch @@ -11,22 +11,14 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm53573.dtsi +++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -48,6 +48,15 @@ - }; +@@ -54,6 +54,7 @@ + , + , + ; ++ clocks = <&ilp>; }; -+ timer { -+ compatible = "arm,armv7-timer"; -+ interrupts = , -+ , -+ , -+ ; -+ clocks = <&ilp>; -+ }; -+ clocks { - #address-cells = <1>; - #size-cells = <1>; --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -348,14 +348,6 @@ static int bcma_register_devices(struct