diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2017-12-29 23:09:32 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2017-12-29 23:15:32 +0100 |
commit | fea884ff51cc2ed1016b4e13a9fcc728bd4f357e (patch) | |
tree | 9c5020c0f6caba74d85f2a558da725f5dbc19ee3 /target/linux/bcm53xx/patches-4.14 | |
parent | 4dd51788dd2fad52dc328ea08ff118a42f6dfa54 (diff) | |
download | upstream-fea884ff51cc2ed1016b4e13a9fcc728bd4f357e.tar.gz upstream-fea884ff51cc2ed1016b4e13a9fcc728bd4f357e.tar.bz2 upstream-fea884ff51cc2ed1016b4e13a9fcc728bd4f357e.zip |
bcm53xx: add early support for kernel 4.14
Don't switch to it by default yet as it requires more testing.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/bcm53xx/patches-4.14')
19 files changed, 1363 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/patches-4.14/035-v4.15-0001-ARM-dts-BCM5301X-Specify-USB-ports-for-USB-LED-of-Lu.patch b/target/linux/bcm53xx/patches-4.14/035-v4.15-0001-ARM-dts-BCM5301X-Specify-USB-ports-for-USB-LED-of-Lu.patch new file mode 100644 index 0000000000..3148f6c32d --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/035-v4.15-0001-ARM-dts-BCM5301X-Specify-USB-ports-for-USB-LED-of-Lu.patch @@ -0,0 +1,30 @@ +From 2460266f21f140936e627f28f28d1a4f30887ae9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Fri, 6 Oct 2017 10:52:35 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Specify USB ports for USB LED of Luxul + XWR-1200 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This info can be used by operating system to setup LED behavior. + +Reported-by: Dan Haab <dhaab@luxul.com> +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -57,7 +57,8 @@ + usb { + label = "bcm53xx:green:usb"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; +- linux,default-trigger = "none"; ++ trigger-sources = <&ohci_port2>, <&ehci_port2>; ++ linux,default-trigger = "usbport"; + }; + + status { diff --git a/target/linux/bcm53xx/patches-4.14/035-v4.15-0002-ARM-dts-BCM5301X-Add-DT-for-Luxul-XBR-4500.patch b/target/linux/bcm53xx/patches-4.14/035-v4.15-0002-ARM-dts-BCM5301X-Add-DT-for-Luxul-XBR-4500.patch new file mode 100644 index 0000000000..b0dd01d4e5 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/035-v4.15-0002-ARM-dts-BCM5301X-Add-DT-for-Luxul-XBR-4500.patch @@ -0,0 +1,96 @@ +From 1f4b0d5596d2e3ea8e953d578ab8444ce860d35d Mon Sep 17 00:00:00 2001 +From: Dan Haab <dhaab@luxul.com> +Date: Mon, 9 Oct 2017 09:46:22 -0600 +Subject: [PATCH] ARM: dts: BCM5301X: Add DT for Luxul XBR-4500 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is BCM47094 (AKA BCM4709C0) based router with ports-on-the-front +board design. + +Signed-off-by: Dan Haab <dhaab@luxul.com> +Acked-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 63 +++++++++++++++++++++++++++ + 2 files changed, 64 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-tplink-archer-c9-v1.dtb \ + bcm47094-dlink-dir-885l.dtb \ + bcm47094-linksys-panamera.dtb \ ++ bcm47094-luxul-xbr-4500.dtb \ + bcm47094-luxul-xwr-3100.dtb \ + bcm47094-netgear-r8500.dtb \ + bcm94708.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -0,0 +1,63 @@ ++/* ++ * Copyright (C) 2017 Luxul Inc. ++ * ++ * Licensed under the ISC license. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ compatible = "luxul,xbr-4500-v1", "brcm,bcm47094", "brcm,bcm4708"; ++ model = "Luxul XBR-4500 V1"; ++ ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x08000000 ++ 0x88000000 0x18000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status { ++ label = "bcm53xx:green:status"; ++ gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "timer"; ++ }; ++ ++ usb3 { ++ label = "bcm53xx:green:usb3"; ++ gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>; ++ trigger-sources = <&ohci_port1>, <&ehci_port1>, ++ <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ restart { ++ label = "Reset"; ++ linux,code = <KEY_RESTART>; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&usb3 { ++ vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; ++}; ++ ++&spi_nor { ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-4.14/035-v4.15-0003-ARM-dts-BCM5301X-Add-DT-for-Luxul-ABR-4500.patch b/target/linux/bcm53xx/patches-4.14/035-v4.15-0003-ARM-dts-BCM5301X-Add-DT-for-Luxul-ABR-4500.patch new file mode 100644 index 0000000000..76bc739dde --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/035-v4.15-0003-ARM-dts-BCM5301X-Add-DT-for-Luxul-ABR-4500.patch @@ -0,0 +1,96 @@ +From 65f78c4c41a9b9a7637e1dda2d5e41cf26ea971c Mon Sep 17 00:00:00 2001 +From: Dan Haab <dhaab@luxul.com> +Date: Mon, 9 Oct 2017 09:46:23 -0600 +Subject: [PATCH] ARM: dts: BCM5301X: Add DT for Luxul ABR-4500 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is BCM47094 (AKA BCM4709C0) based router with rear-facing ports +board design. + +Signed-off-by: Dan Haab <dhaab@luxul.com> +Acked-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 63 +++++++++++++++++++++++++++ + 2 files changed, 64 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-tplink-archer-c9-v1.dtb \ + bcm47094-dlink-dir-885l.dtb \ + bcm47094-linksys-panamera.dtb \ ++ bcm47094-luxul-abr-4500.dtb \ + bcm47094-luxul-xbr-4500.dtb \ + bcm47094-luxul-xwr-3100.dtb \ + bcm47094-netgear-r8500.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -0,0 +1,63 @@ ++/* ++ * Copyright (C) 2017 Luxul Inc. ++ * ++ * Licensed under the ISC license. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ compatible = "luxul,abr-4500-v1", "brcm,bcm47094", "brcm,bcm4708"; ++ model = "Luxul ABR-4500 V1"; ++ ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x08000000 ++ 0x88000000 0x18000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status { ++ label = "bcm53xx:green:status"; ++ gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "timer"; ++ }; ++ ++ usb3 { ++ label = "bcm53xx:green:usb3"; ++ gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ohci_port1>, <&ehci_port1>, ++ <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ restart { ++ label = "Reset"; ++ linux,code = <KEY_RESTART>; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&usb3 { ++ vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; ++}; ++ ++&spi_nor { ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-4.14/035-v4.15-0004-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-810.patch b/target/linux/bcm53xx/patches-4.14/035-v4.15-0004-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-810.patch new file mode 100644 index 0000000000..5cb894c361 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/035-v4.15-0004-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-810.patch @@ -0,0 +1,120 @@ +From 0aa052ce1c3340850a7e5980b6d24b3ea5779591 Mon Sep 17 00:00:00 2001 +From: Dan Haab <dhaab@luxul.com> +Date: Mon, 9 Oct 2017 09:46:59 -0600 +Subject: [PATCH] ARM: dts: BCM53573: Add DT for Luxul XAP-810 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is BCM53573 WiSoC based access point with an extra BCM43217 chipset +used for 2.4 GHz. + +Signed-off-by: Dan Haab <dhaab@luxul.com> +Acked-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47189-luxul-xap-810.dts | 87 ++++++++++++++++++++++++++++ + 2 files changed, 88 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47189-luxul-xap-810.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -111,6 +111,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm953012hr.dtb \ + bcm953012k.dtb + dtb-$(CONFIG_ARCH_BCM_53573) += \ ++ bcm47189-luxul-xap-810.dtb \ + bcm47189-tenda-ac9.dtb \ + bcm947189acdbmr.dtb + dtb-$(CONFIG_ARCH_BCM_63XX) += \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -0,0 +1,87 @@ ++/* ++ * Copyright 2017 Luxul Inc. ++ * ++ * Licensed under the ISC license. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm53573.dtsi" ++ ++/ { ++ compatible = "luxul,xap-810-v1", "brcm,bcm47189", "brcm,bcm53573"; ++ model = "Luxul XAP-810 V1"; ++ ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x08000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ 5ghz { ++ label = "bcm53xx:blue:5ghz"; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-off"; ++ }; ++ ++ system { ++ label = "bcm53xx:green:system"; ++ gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "timer"; ++ }; ++ }; ++ ++ pcie0_leds { ++ compatible = "gpio-leds"; ++ ++ 2ghz { ++ label = "bcm53xx:blue:2ghz"; ++ gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-off"; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ restart { ++ label = "Reset"; ++ linux,code = <KEY_RESTART>; ++ gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&pcie0 { ++ ranges = <0x00000000 0 0 0 0 0x00100000>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ bridge@0,0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ranges = <0x00000000 0 0 0 0 0 0 0x00100000>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,1,0 { ++ reg = <0x0000 0 0 0 0>; ++ ranges = <0x00000000 0 0 0 0x00100000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ pcie0_chipcommon: chipcommon@0 { ++ reg = <0 0x1000>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-4.14/035-v4.15-0005-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-1440.patch b/target/linux/bcm53xx/patches-4.14/035-v4.15-0005-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-1440.patch new file mode 100644 index 0000000000..9d43dd58d0 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/035-v4.15-0005-ARM-dts-BCM53573-Add-DT-for-Luxul-XAP-1440.patch @@ -0,0 +1,83 @@ +From 7030ea600d560026b91726f2eb79c856b813afa9 Mon Sep 17 00:00:00 2001 +From: Dan Haab <dhaab@luxul.com> +Date: Mon, 9 Oct 2017 09:47:00 -0600 +Subject: [PATCH] ARM: dts: BCM53573: Add DT for Luxul XAP-1440 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is BCM53573 WiSoC based outdoor access point with an extra BCM43217 +chipset used for 2.4 GHz. + +Signed-off-by: Dan Haab <dhaab@luxul.com> +Acked-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts | 50 +++++++++++++++++++++++++++ + 2 files changed, 51 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -111,6 +111,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm953012hr.dtb \ + bcm953012k.dtb + dtb-$(CONFIG_ARCH_BCM_53573) += \ ++ bcm47189-luxul-xap-1440.dtb \ + bcm47189-luxul-xap-810.dtb \ + bcm47189-tenda-ac9.dtb \ + bcm947189acdbmr.dtb +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -0,0 +1,50 @@ ++/* ++ * Copyright 2017 Luxul Inc. ++ * ++ * Licensed under the ISC license. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm53573.dtsi" ++ ++/ { ++ compatible = "luxul,xap-1440-v1", "brcm,bcm47189", "brcm,bcm53573"; ++ model = "Luxul XAP-1440 V1"; ++ ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x08000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ wlan { ++ label = "bcm53xx:blue:wlan"; ++ gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-off"; ++ }; ++ ++ system { ++ label = "bcm53xx:green:system"; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "timer"; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ restart { ++ label = "Reset"; ++ linux,code = <KEY_RESTART>; ++ gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-4.14/101-use-part-parser.patch b/target/linux/bcm53xx/patches-4.14/101-use-part-parser.patch new file mode 100644 index 0000000000..4ecb8dc693 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/101-use-part-parser.patch @@ -0,0 +1,11 @@ +--- 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.14/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-4.14/180-usb-xhci-add-support-for-performing-fake-doorbell.patch new file mode 100644 index 0000000000..ec2df9125f --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -0,0 +1,137 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Sat, 1 Oct 2016 22:54:48 +0200 +Subject: [PATCH] usb: xhci: add support for performing fake doorbell + +Broadcom's Northstar XHCI controllers seem to need a special start +procedure to work correctly. There isn't any official documentation of +this, the problem is that controller doesn't detect any connected +devices with default setup. Moreover connecting USB device to controller +that doesn't run properly can cause SoC's watchdog issues. + +A workaround that was successfully tested on multiple devices is to +perform a fake doorbell. This patch adds code for doing this and enables +it on BCM4708 family. +--- + drivers/usb/host/xhci-plat.c | 6 +++++ + drivers/usb/host/xhci.c | 63 +++++++++++++++++++++++++++++++++++++++++--- + drivers/usb/host/xhci.h | 1 + + 3 files changed, 67 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/xhci-plat.c ++++ b/drivers/usb/host/xhci-plat.c +@@ -67,12 +67,18 @@ static int xhci_priv_resume_quirk(struct + + static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) + { ++ struct platform_device *pdev = to_platform_device(dev); ++ struct device_node *node = pdev->dev.of_node; ++ + /* + * As of now platform drivers don't provide MSI support so we ensure + * here that the generic code does not try to make a pci_dev from our + * dev struct in order to setup MSI + */ + xhci->quirks |= XHCI_PLAT; ++ ++ if (node && of_machine_is_compatible("brcm,bcm4708")) ++ xhci->quirks |= XHCI_FAKE_DOORBELL; + } + + /* called during probe() after chip reset completes */ +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -153,6 +153,49 @@ int xhci_start(struct xhci_hcd *xhci) + return ret; + } + ++/** ++ * xhci_fake_doorbell - Perform a fake doorbell on a specified slot ++ * ++ * Some controllers require a fake doorbell to start correctly. Without that ++ * they simply don't detect any devices. ++ */ ++static int xhci_fake_doorbell(struct xhci_hcd *xhci, int slot_id) ++{ ++ u32 temp; ++ ++ /* Alloc a virt device for that slot */ ++ if (!xhci_alloc_virt_device(xhci, slot_id, NULL, GFP_NOIO)) { ++ xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); ++ return -ENOMEM; ++ } ++ ++ /* Ring fake doorbell for slot_id ep 0 */ ++ xhci_ring_ep_doorbell(xhci, slot_id, 0, 0); ++ usleep_range(1000, 1500); ++ ++ /* Read the status to check if HSE is set or not */ ++ temp = readl(&xhci->op_regs->status); ++ ++ /* Clear HSE if set */ ++ if (temp & STS_FATAL) { ++ xhci_dbg(xhci, "HSE problem detected, status: 0x%08x\n", temp); ++ temp &= ~0x1fff; ++ temp |= STS_FATAL; ++ writel(temp, &xhci->op_regs->status); ++ usleep_range(1000, 1500); ++ readl(&xhci->op_regs->status); ++ } ++ ++ /* Free virt device */ ++ xhci_free_virt_device(xhci, slot_id); ++ ++ /* We're done if controller is already running */ ++ if (readl(&xhci->op_regs->command) & CMD_RUN) ++ return 0; ++ ++ return xhci_start(xhci); ++} ++ + /* + * Reset a halted HC. + * +@@ -536,10 +579,20 @@ static int xhci_init(struct usb_hcd *hcd + + static int xhci_run_finished(struct xhci_hcd *xhci) + { +- if (xhci_start(xhci)) { +- xhci_halt(xhci); +- return -ENODEV; ++ int err; ++ ++ err = xhci_start(xhci); ++ if (err) { ++ err = -ENODEV; ++ goto err_halt; + } ++ ++ if (xhci->quirks & XHCI_FAKE_DOORBELL) { ++ err = xhci_fake_doorbell(xhci, 1); ++ if (err) ++ goto err_halt; ++ } ++ + xhci->shared_hcd->state = HC_STATE_RUNNING; + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; + +@@ -549,6 +602,10 @@ static int xhci_run_finished(struct xhci + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "Finished xhci_run for USB3 roothub"); + return 0; ++ ++err_halt: ++ xhci_halt(xhci); ++ return err; + } + + /* +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -1830,6 +1830,7 @@ struct xhci_hcd { + #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) + /* Reserved. It was XHCI_U2_DISABLE_WAKE */ + #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28) ++#define XHCI_FAKE_DOORBELL (1 << 29) + + unsigned int num_active_eps; + unsigned int limit_active_eps; diff --git a/target/linux/bcm53xx/patches-4.14/182-spi-bcm53xx-simplify-reading-SPI-data.patch b/target/linux/bcm53xx/patches-4.14/182-spi-bcm53xx-simplify-reading-SPI-data.patch new file mode 100644 index 0000000000..ee377c491f --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/182-spi-bcm53xx-simplify-reading-SPI-data.patch @@ -0,0 +1,107 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Fri, 29 Dec 2017 14:44:09 +0100 +Subject: [PATCH] spi: bcm53xx: simplify reading SPI data +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This commit makes transfer function use spi_transfer_is_last to +determine if currently processed transfer is the last one. Thanks to +that we finally set hardware registers properly and it makes controller +behave the way it's expected to. + +This allows simplifying read function which can now simply start reading +from the slot 0 instead of the last saved offset. It has been +successfully tested using spi_write_then_read. + +Moreover this change fixes handling messages with two writing transfers. +It's important for SPI flash devices as their drivers commonly use one +transfer for a command and another one for data. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + drivers/spi/spi-bcm53xx.c | 26 ++++++++++---------------- + 1 file changed, 10 insertions(+), 16 deletions(-) + +--- a/drivers/spi/spi-bcm53xx.c ++++ b/drivers/spi/spi-bcm53xx.c +@@ -27,8 +27,6 @@ struct bcm53xxspi { + struct bcma_device *core; + struct spi_master *master; + void __iomem *mmio_base; +- +- size_t read_offset; + bool bspi; /* Boot SPI mode with memory mapping */ + }; + +@@ -172,8 +170,6 @@ static void bcm53xxspi_buf_write(struct + + if (!cont) + bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 0); +- +- b53spi->read_offset = len; + } + + static void bcm53xxspi_buf_read(struct bcm53xxspi *b53spi, u8 *r_buf, +@@ -182,10 +178,10 @@ static void bcm53xxspi_buf_read(struct b + u32 tmp; + int i; + +- for (i = 0; i < b53spi->read_offset + len; i++) { ++ for (i = 0; i < len; i++) { + tmp = B53SPI_CDRAM_CONT | B53SPI_CDRAM_PCS_DISABLE_ALL | + B53SPI_CDRAM_PCS_DSCK; +- if (!cont && i == b53spi->read_offset + len - 1) ++ if (!cont && i == len - 1) + tmp &= ~B53SPI_CDRAM_CONT; + tmp &= ~0x1; + /* Command Register File */ +@@ -194,8 +190,7 @@ static void bcm53xxspi_buf_read(struct b + + /* Set queue pointers */ + bcm53xxspi_write(b53spi, B53SPI_MSPI_NEWQP, 0); +- bcm53xxspi_write(b53spi, B53SPI_MSPI_ENDQP, +- b53spi->read_offset + len - 1); ++ bcm53xxspi_write(b53spi, B53SPI_MSPI_ENDQP, len - 1); + + if (cont) + bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 1); +@@ -214,13 +209,11 @@ static void bcm53xxspi_buf_read(struct b + bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 0); + + for (i = 0; i < len; ++i) { +- int offset = b53spi->read_offset + i; ++ u16 reg = B53SPI_MSPI_RXRAM + 4 * (1 + i * 2); + + /* Data stored in the transmit register file LSB */ +- r_buf[i] = (u8)bcm53xxspi_read(b53spi, B53SPI_MSPI_RXRAM + 4 * (1 + offset * 2)); ++ r_buf[i] = (u8)bcm53xxspi_read(b53spi, reg); + } +- +- b53spi->read_offset = 0; + } + + static int bcm53xxspi_transfer_one(struct spi_master *master, +@@ -238,7 +231,8 @@ static int bcm53xxspi_transfer_one(struc + left = t->len; + while (left) { + size_t to_write = min_t(size_t, 16, left); +- bool cont = left - to_write > 0; ++ bool cont = !spi_transfer_is_last(master, t) || ++ left - to_write > 0; + + bcm53xxspi_buf_write(b53spi, buf, to_write, cont); + left -= to_write; +@@ -250,9 +244,9 @@ static int bcm53xxspi_transfer_one(struc + buf = (u8 *)t->rx_buf; + left = t->len; + while (left) { +- size_t to_read = min_t(size_t, 16 - b53spi->read_offset, +- left); +- bool cont = left - to_read > 0; ++ size_t to_read = min_t(size_t, 16, left); ++ bool cont = !spi_transfer_is_last(master, t) || ++ left - to_read > 0; + + bcm53xxspi_buf_read(b53spi, buf, to_read, cont); + left -= to_read; diff --git a/target/linux/bcm53xx/patches-4.14/300-ARM-BCM5301X-Disable-MMU-and-Dcache-during-decompres.patch b/target/linux/bcm53xx/patches-4.14/300-ARM-BCM5301X-Disable-MMU-and-Dcache-during-decompres.patch new file mode 100644 index 0000000000..ef91db9014 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/300-ARM-BCM5301X-Disable-MMU-and-Dcache-during-decompres.patch @@ -0,0 +1,101 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Wed, 24 Sep 2014 22:14:07 +0200 +Subject: [PATCH] ARM: BCM5301X: Disable MMU and Dcache during decompression +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Broadcom devices have broken CFE (bootloader) that leaves hardware in an +invalid state. It causes problems with booting Linux. On Northstar +devices kernel was randomly hanging in ~25% of tries during early init. +Hangs used to happen at random places in the start_kernel. On BCM53573 +kernel doesn't even seem to start booting. + +To workaround this problem we need to do following very early: +1) Clear 2 following bits in the SCTLR register: +#define CR_M (1 << 0) /* MMU enable */ +#define CR_C (1 << 2) /* Dcache enable */ +2) Flush the whole D-cache +3) Disable L2 cache + +Unfortunately this patch is not upstreamable as it does above things +unconditionally. We can't check if we are running on Broadcom platform +in any safe way and doing such hacks with ARCH_MULTI_V7 is unacceptable +as it could break other devices support. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -32,6 +32,11 @@ ifeq ($(CONFIG_ARCH_ACORN),y) + OBJS += ll_char_wr.o font.o + endif + ++ifeq ($(CONFIG_ARCH_BCM_5301X),y) ++OBJS += head-bcm_5301x-mpcore.o ++OBJS += cache-v7-min.o ++endif ++ + ifeq ($(CONFIG_ARCH_SA1100),y) + OBJS += head-sa1100.o + endif +--- /dev/null ++++ b/arch/arm/boot/compressed/head-bcm_5301x-mpcore.S +@@ -0,0 +1,37 @@ ++/* ++ * ++ * Platform specific tweaks. This is merged into head.S by the linker. ++ * ++ */ ++ ++#include <linux/linkage.h> ++#include <asm/assembler.h> ++#include <asm/cp15.h> ++ ++ .section ".start", "ax" ++ ++/* ++ * This code section is spliced into the head code by the linker ++ */ ++ ++__plat_uncompress_start: ++ ++ @ Preserve r8/r7 i.e. kernel entry values ++ mov r12, r8 ++ ++ @ Clear MMU enable and Dcache enable bits ++ mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR ++ bic r0, #CR_C|CR_M ++ mcr p15, 0, r0, c1, c0, 0 @ Write SCTLR ++ nop ++ ++ @ Call the cache invalidation routine ++ bl v7_flush_dcache_all ++ nop ++ mov r0,#0 ++ ldr r3, =0x19022000 @ L2 cache controller, control reg ++ str r0, [r3, #0x100] @ Disable L2 cache ++ nop ++ ++ @ Restore ++ mov r8, r12 +--- a/arch/arm/boot/compressed/cache-v7-min.S ++++ b/arch/arm/boot/compressed/cache-v7-min.S +@@ -12,6 +12,7 @@ + + #include <linux/linkage.h> + #include <linux/init.h> ++#include <asm/assembler.h> + + __INIT + +@@ -63,7 +64,7 @@ loop2: + ARM( orr r11, r11, r9, lsl r2 ) @ factor index number into r11 + THUMB( lsl r6, r9, r2 ) + THUMB( orr r11, r11, r6 ) @ factor index number into r11 +- mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way ++ mcr p15, 0, r11, c7, c6, 2 @ clean & invalidate by set/way + subs r9, r9, #1 @ decrement the index + bge loop2 + subs r4, r4, #1 @ decrement the way diff --git a/target/linux/bcm53xx/patches-4.14/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch b/target/linux/bcm53xx/patches-4.14/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch new file mode 100644 index 0000000000..5092817f07 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch @@ -0,0 +1,64 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Subject: [PATCH] ARM: BCM5301X: Add DT for Netgear R7900 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +--- + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -97,6 +97,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-buffalo-wxr-1900dhp.dtb \ + bcm4709-linksys-ea9200.dtb \ + bcm4709-netgear-r7000.dtb \ ++ bcm4709-netgear-r7900.dtb \ + bcm4709-netgear-r8000.dtb \ + bcm4709-tplink-archer-c9-v1.dtb \ + bcm47094-dlink-dir-885l.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7900.dts +@@ -0,0 +1,42 @@ ++/* ++ * Broadcom BCM470X / BCM5301X ARM platform code. ++ * DTS for Netgear R7900 ++ * ++ * Copyright (C) 2016 Rafał Miłecki <zajec5@gmail.com> ++ * ++ * Licensed under the GNU/GPL. See COPYING for details. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4709.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ compatible = "netgear,r7900", "brcm,bcm4709", "brcm,bcm4708"; ++ model = "Netgear R7900"; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ }; ++ ++ memory { ++ reg = <0x00000000 0x08000000 ++ 0x88000000 0x08000000>; ++ }; ++ ++ axi@18000000 { ++ usb3@23000 { ++ reg = <0x00023000 0x1000>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-4.14/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch b/target/linux/bcm53xx/patches-4.14/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch new file mode 100644 index 0000000000..39034997fc --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch @@ -0,0 +1,20 @@ +From: Felix Fietkau <nbd@nbd.name> +Subject: [PATCH] ARM: BCM5301X: Add power button for Buffalo WZR-1750DHP + +Signed-off-by: Felix Fietkau <nbd@nbd.name> +--- +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -102,6 +102,12 @@ + #address-cells = <1>; + #size-cells = <0>; + ++ power { ++ label = "Power"; ++ linux,code = <KEY_POWER>; ++ gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; ++ }; ++ + restart { + label = "Reset"; + linux,code = <KEY_RESTART>; diff --git a/target/linux/bcm53xx/patches-4.14/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch b/target/linux/bcm53xx/patches-4.14/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch new file mode 100644 index 0000000000..710d94f6bc --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch @@ -0,0 +1,70 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Subject: [PATCH] ARM: dts: BCM5301X: Add serial= to the bootargs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's enough to have proper stdout-path for getting serial working but +for some reason LEDE doesn't offer "Please press Enter to activate this +console." unless ttyS0 is specified. + +This is a workaround to get serial working in LEDE. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -13,7 +13,7 @@ + model = "TP-LINK Archer C5 V2"; + + chosen { +- bootargs = "earlycon"; ++ bootargs = "console=ttyS0,115200 earlycon"; + }; + + memory { +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -14,7 +14,7 @@ + model = "Luxul ABR-4500 V1"; + + chosen { +- bootargs = "earlycon"; ++ bootargs = "console=ttyS0,115200 earlycon"; + }; + + memory { +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -14,7 +14,7 @@ + model = "Luxul XBR-4500 V1"; + + chosen { +- bootargs = "earlycon"; ++ bootargs = "console=ttyS0,115200 earlycon"; + }; + + memory { +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -13,7 +13,7 @@ + model = "Luxul XAP-1440 V1"; + + chosen { +- bootargs = "earlycon"; ++ bootargs = "console=ttyS0,115200 earlycon"; + }; + + memory { +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -13,7 +13,7 @@ + model = "Luxul XAP-810 V1"; + + chosen { +- bootargs = "earlycon"; ++ bootargs = "console=ttyS0,115200 earlycon"; + }; + + memory { diff --git a/target/linux/bcm53xx/patches-4.14/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch b/target/linux/bcm53xx/patches-4.14/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch new file mode 100644 index 0000000000..75105261ac --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch @@ -0,0 +1,34 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Subject: [PATCH] mtd: spi-nor: detect JEDEC incompatible w25q128 using 0x90 + command +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some w25q128 chipsets don't support RDID (0x9f) command, they reply with +0xff-s only. To suppose such flashes fallback to the 0x90 command. + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +--- + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1205,6 +1205,18 @@ static const struct flash_info *spi_nor_ + } + dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n", + id[0], id[1], id[2]); ++ ++ tmp = nor->read_reg(nor, 0x90, id, SPI_NOR_MAX_ID_LEN); ++ if (tmp < 0) { ++ dev_dbg(nor->dev, " error %d reading JEDEC ID\n", tmp); ++ return ERR_PTR(tmp); ++ } ++ dev_info(nor->dev, "using Read Manufacturer / Device ID command (0x%02x) returned %02x %02x\n", ++ 0x90, id[0x03], id[0x04]); ++ if (id[0x03] == 0xef && id[0x04] == 0x17) { ++ return spi_nor_match_id("w25q128"); ++ } ++ + return ERR_PTR(-ENODEV); + } + diff --git a/target/linux/bcm53xx/patches-4.14/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch b/target/linux/bcm53xx/patches-4.14/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch new file mode 100644 index 0000000000..271d98cc8c --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch @@ -0,0 +1,59 @@ +From 2a2af518266a29323cf30c3f9ba9ef2ceb1dd84b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Thu, 16 Oct 2014 20:52:16 +0200 +Subject: [PATCH] UBI: Detect EOF mark and erase all remaining blocks +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/mtd/ubi/attach.c | 5 +++++ + drivers/mtd/ubi/io.c | 4 ++++ + drivers/mtd/ubi/ubi.h | 1 + + 3 files changed, 10 insertions(+) + +--- a/drivers/mtd/ubi/attach.c ++++ b/drivers/mtd/ubi/attach.c +@@ -95,6 +95,9 @@ static int self_check_ai(struct ubi_devi + #define AV_ADD BIT(1) + #define AV_FIND_OR_ADD (AV_FIND | AV_ADD) + ++/* Set on finding block with 0xdeadc0de, indicates erasing all blocks behind */ ++bool erase_all_next; ++ + /** + * find_or_add_av - internal function to find a volume, add a volume or do + * both (find and add if missing). +@@ -1592,6 +1595,8 @@ int ubi_attach(struct ubi_device *ubi, i + if (!ai) + return -ENOMEM; + ++ erase_all_next = false; ++ + #ifdef CONFIG_MTD_UBI_FASTMAP + /* On small flash devices we disable fastmap in any case. */ + if ((int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) <= UBI_FM_MAX_START) { +--- a/drivers/mtd/ubi/io.c ++++ b/drivers/mtd/ubi/io.c +@@ -759,6 +759,10 @@ int ubi_io_read_ec_hdr(struct ubi_device + } + + magic = be32_to_cpu(ec_hdr->magic); ++ if (magic == 0xdeadc0de) ++ erase_all_next = true; ++ if (erase_all_next) ++ return read_err ? UBI_IO_FF_BITFLIPS : UBI_IO_FF; + if (magic != UBI_EC_HDR_MAGIC) { + if (mtd_is_eccerr(read_err)) + return UBI_IO_BAD_HDR_EBADMSG; +--- a/drivers/mtd/ubi/ubi.h ++++ b/drivers/mtd/ubi/ubi.h +@@ -822,6 +822,7 @@ extern struct mutex ubi_devices_mutex; + extern struct blocking_notifier_head ubi_notifiers; + + /* attach.c */ ++extern bool erase_all_next; + struct ubi_ainf_peb *ubi_alloc_aeb(struct ubi_attach_info *ai, int pnum, + int ec); + void ubi_free_aeb(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb); diff --git a/target/linux/bcm53xx/patches-4.14/700-b53-add-hacky-CPU-port-fixes-for-devices-not-using-p.patch b/target/linux/bcm53xx/patches-4.14/700-b53-add-hacky-CPU-port-fixes-for-devices-not-using-p.patch new file mode 100644 index 0000000000..91bb4fae11 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/700-b53-add-hacky-CPU-port-fixes-for-devices-not-using-p.patch @@ -0,0 +1,52 @@ +From 4abdde3ad6bc0b3b157c4bf6ec0bf139d11d07e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Wed, 13 May 2015 14:13:28 +0200 +Subject: [PATCH] b53: add hacky CPU port fixes for devices not using port 5 +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/net/phy/b53/b53_common.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/phy/b53/b53_common.c ++++ b/drivers/net/phy/b53/b53_common.c +@@ -28,6 +28,7 @@ + #include <linux/of.h> + #include <linux/of_net.h> + #include <linux/platform_data/b53.h> ++#include <linux/of.h> + + #include "b53_regs.h" + #include "b53_priv.h" +@@ -1579,6 +1580,28 @@ static int b53_switch_init(struct b53_de + return ret; + } + ++ /* Set correct CPU port */ ++ if (of_machine_is_compatible("asus,rt-ac87u")) ++ sw_dev->cpu_port = 7; ++ else if (of_machine_is_compatible("netgear,r7900")) ++ sw_dev->cpu_port = 8; ++ else if (of_machine_is_compatible("netgear,r8000")) ++ sw_dev->cpu_port = 8; ++ else if (of_machine_is_compatible("netgear,r8500")) ++ sw_dev->cpu_port = 8; ++ ++ /* Enable extra ports */ ++ if (of_machine_is_compatible("tenda,ac9")) ++ dev->enabled_ports |= BIT(5); ++ ++ /* ++ * Workaround for devices using port 8 (connected to the 3rd iface). ++ * For some reason it doesn't work (no packets on eth2). ++ */ ++ if (of_machine_is_compatible("netgear,r7900") || ++ of_machine_is_compatible("netgear,r8000")) ++ sw_dev->cpu_port = 5; ++ + dev->enabled_ports |= BIT(sw_dev->cpu_port); + sw_dev->ports = fls(dev->enabled_ports); + 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 new file mode 100644 index 0000000000..b4a25a39d0 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch @@ -0,0 +1,56 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +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 <rafal@milecki.pl> +--- + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -15,6 +15,7 @@ + #include <linux/slab.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/of.h> + + #include <uapi/linux/magic.h> + +@@ -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 new file mode 100644 index 0000000000..4e0a752d66 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/905-BCM53573-minor-hacks.patch @@ -0,0 +1,88 @@ +From 6f1c62440eb6846cb8045d7a5480ec7bbe47c96f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Mon, 15 Aug 2016 10:30:41 +0200 +Subject: [PATCH] BCM53573 minor hacks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -48,6 +48,15 @@ + }; + }; + ++ timer { ++ compatible = "arm,armv7-timer"; ++ interrupts = <GIC_PPI 13 0>, ++ <GIC_PPI 14 0>, ++ <GIC_PPI 11 0>, ++ <GIC_PPI 10 0>; ++ 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 + } + #endif + +-#ifdef CONFIG_BCMA_SFLASH +- if (bus->drv_cc.sflash.present) { +- err = platform_device_register(&bcma_sflash_dev); +- if (err) +- bcma_err(bus, "Error registering serial flash\n"); +- } +-#endif +- + #ifdef CONFIG_BCMA_NFLASH + if (bus->drv_cc.nflash.present) { + err = platform_device_register(&bcma_nflash_dev); +@@ -436,6 +428,14 @@ int bcma_bus_register(struct bcma_bus *b + bcma_register_core(bus, core); + } + ++#ifdef CONFIG_BCMA_SFLASH ++ if (bus->drv_cc.sflash.present) { ++ err = platform_device_register(&bcma_sflash_dev); ++ if (err) ++ bcma_err(bus, "Error registering serial flash\n"); ++ } ++#endif ++ + /* Try to get SPROM */ + err = bcma_sprom_get(bus); + if (err == -ENOENT) { +--- a/drivers/clocksource/arm_arch_timer.c ++++ b/drivers/clocksource/arm_arch_timer.c +@@ -17,6 +17,7 @@ + #include <linux/smp.h> + #include <linux/cpu.h> + #include <linux/cpu_pm.h> ++#include <linux/clk.h> + #include <linux/clockchips.h> + #include <linux/clocksource.h> + #include <linux/interrupt.h> +@@ -836,6 +837,16 @@ static void arch_timer_of_configure_rate + if (of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) + arch_timer_rate = rate; + ++ /* Get clk rate through clk driver if present */ ++ if (!arch_timer_rate) { ++ struct clk *clk = of_clk_get(np, 0); ++ ++ if (!IS_ERR(clk)) { ++ if (!clk_prepare_enable(clk)) ++ arch_timer_rate = clk_get_rate(clk); ++ } ++ } ++ + /* Check the timer frequency. */ + if (arch_timer_rate == 0) + pr_warn("frequency not available\n"); diff --git a/target/linux/bcm53xx/patches-4.14/980-Revert-ARM-dts-BCM5301X-convert-to-iProc-QSPI.patch b/target/linux/bcm53xx/patches-4.14/980-Revert-ARM-dts-BCM5301X-convert-to-iProc-QSPI.patch new file mode 100644 index 0000000000..6180c88e5e --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/980-Revert-ARM-dts-BCM5301X-convert-to-iProc-QSPI.patch @@ -0,0 +1,110 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Fri, 29 Dec 2017 20:26:51 +0100 +Subject: [PATCH] Revert "ARM: dts: BCM5301X: convert to iProc QSPI" + +This reverts commit 1c8f4065072387d3b6ee7adcf0dbe3c7ba80c268. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -337,6 +337,20 @@ + }; + }; + ++ spi@29000 { ++ reg = <0x00029000 0x1000>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ spi_nor: spi-nor@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <20000000>; ++ linux,part-probe = "ofpart", "bcm47xxpart"; ++ status = "disabled"; ++ }; ++ }; ++ + gmac0: ethernet@24000 { + reg = <0x24000 0x800>; + }; +@@ -425,42 +439,6 @@ + brcm,nand-has-wp; + }; + +- spi@18029200 { +- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; +- reg = <0x18029200 0x184>, +- <0x18029000 0x124>, +- <0x1811b408 0x004>, +- <0x180293a0 0x01c>; +- reg-names = "mspi", "bspi", "intr_regs", "intr_status_reg"; +- interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>, +- <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; +- interrupt-names = "spi_lr_fullness_reached", +- "spi_lr_session_aborted", +- "spi_lr_impatient", +- "spi_lr_session_done", +- "spi_lr_overhead", +- "mspi_done", +- "mspi_halted"; +- clocks = <&iprocmed>; +- clock-names = "iprocmed"; +- num-cs = <2>; +- #address-cells = <1>; +- #size-cells = <0>; +- +- spi_nor: spi-nor@0 { +- compatible = "jedec,spi-nor"; +- reg = <0>; +- spi-max-frequency = <20000000>; +- linux,part-probe = "ofpart", "bcm47xxpart"; +- status = "disabled"; +- }; +- }; +- + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <0>; +--- a/arch/arm/boot/dts/bcm953012k.dts ++++ b/arch/arm/boot/dts/bcm953012k.dts +@@ -80,32 +80,6 @@ + }; + }; + +-&spi_nor { +- status = "okay"; +- spi-max-frequency = <62500000>; +- m25p,default-addr-width = <3>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- +- partition@0 { +- label = "boot"; +- reg = <0x00000000 0x000d0000>; +- }; +- partition@d000 { +- label = "env"; +- reg = <0x000d0000 0x00030000>; +- }; +- partition@100000 { +- label = "system"; +- reg = <0x00100000 0x00600000>; +- }; +- partition@700000 { +- label = "rootfs"; +- reg = <0x00700000 0x00900000>; +- }; +-}; +- + &uart0 { + status = "okay"; + }; diff --git a/target/linux/bcm53xx/patches-4.14/982-PCI-iproc-Disable-DMA-mapping-support.patch b/target/linux/bcm53xx/patches-4.14/982-PCI-iproc-Disable-DMA-mapping-support.patch new file mode 100644 index 0000000000..8196afb015 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.14/982-PCI-iproc-Disable-DMA-mapping-support.patch @@ -0,0 +1,29 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Fri, 29 Dec 2017 22:39:45 +0100 +Subject: [PATCH] PCI: iproc: Disable DMA mapping support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This has been added in commit dd9d4e7498de3 ("PCI: iproc: Add inbound +DMA mapping support") which causes a crash for bcma case. Function +pci_dma_range_parser_init calls of_n_addr_cells with a NULL argument +which causes a NULL pointer dereference. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +--- + +--- a/drivers/pci/host/pcie-iproc.c ++++ b/drivers/pci/host/pcie-iproc.c +@@ -1396,9 +1396,11 @@ int iproc_pcie_setup(struct iproc_pcie * + } + } + ++if (0) { + ret = iproc_pcie_map_dma_ranges(pcie); + if (ret && ret != -ENOENT) + goto err_power_off_phy; ++} + + #ifdef CONFIG_ARM + pcie->sysdata.private_data = pcie; |