From 08bbe361e02043ef85ed42d294f93f7e6d962d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 16 Feb 2021 00:21:28 +0100 Subject: [PATCH 01/19] bcm4908: add bcm_sf2 fixes for the 5th GPHY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows using the last integrated PHY (and so e.g. WAN port on the ASUS GT-AC5300). Signed-off-by: Rafał Miłecki (cherry picked from commit ad8b759fd17bd31fdb7a026f247fd6ec81b372d3) --- ...m_sf2-enable-GPHY-for-switch-probing.patch | 46 +++++++++++++++++++ ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 30 ++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch create mode 100644 target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch new file mode 100644 index 0000000000..26f6216061 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -0,0 +1,46 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 Feb 2021 23:59:26 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: enable GPHY for switch probing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GPHY needs to be enabled to succesfully probe & setup switch port +connected to it. Otherwise hardcoding PHY OUI would be required. + +Before: +brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch wan (uninitialized): error -5 setting up PHY for tree 0, switch 0, port 7 + +After: +brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL) +brcm-sf2 80080000.switch wan (uninitialized): PHY [800c05c0.mdio--1:0c] driver [Generic PHY] (irq=POLL) + +Signed-off-by: Rafał Miłecki +--- + drivers/net/dsa/bcm_sf2.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -1234,10 +1234,14 @@ static int bcm_sf2_sw_probe(struct platf + rev = reg_readl(priv, REG_PHY_REVISION); + priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; + ++ bcm_sf2_gphy_enable_set(priv->dev->ds, true); ++ + ret = b53_switch_register(dev); + if (ret) + goto out_mdio; + ++ bcm_sf2_gphy_enable_set(priv->dev->ds, false); ++ + dev_info(&pdev->dev, + "Starfighter 2 top: %x.%02x, core: %x.%02x, IRQs: %d, %d\n", + priv->hw_params.top_rev >> 8, priv->hw_params.top_rev & 0xff, diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch new file mode 100644 index 0000000000..559430a3a7 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -0,0 +1,30 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 16 Feb 2021 00:06:35 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: keep GPHY enabled on the BCM4908 + +Trying to access disabled PHY results in MDIO_READ_FAIL and: +[ 11.962886] brcm-sf2 80080000.switch wan: configuring for phy/internal link mode +[ 11.972500] 8021q: adding VLAN 0 to HW filter on device wan +[ 11.980205] ------------[ cut here ]------------ +[ 11.984885] WARNING: CPU: 0 PID: 7 at phy_error+0x10/0x58 + +Signed-off-by: Rafał Miłecki +--- + drivers/net/dsa/bcm_sf2.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -1248,6 +1248,12 @@ static int bcm_sf2_sw_probe(struct platf + priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, + priv->irq0, priv->irq1); + ++ /* BCM4908 has 5 GPHYs which means bcm_sf2_port_setup() will not enable ++ * GPHY when needed. Leave it enabled here. ++ */ ++ if (priv->type == BCM4908_DEVICE_ID) ++ bcm_sf2_gphy_enable_set(priv->dev->ds, true); ++ + return 0; + + out_mdio: From 67df3a829b33dfaa8068209d31246296985e9888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 1 Mar 2021 08:14:49 +0100 Subject: [PATCH 02/19] bcm4908: backport Ethernet driver fixes from the 5.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The most noticeable one is fix for RX stopping on high traffic. Signed-off-by: Rafał Miłecki (cherry picked from commit acbea54bc29a22d8fb171bc9da0f1b16fb0ec233) --- ...908_enet-set-MTU-on-open-on-request.patch} | 10 ++++-- ...4908_enet-fix-RX-path-possible-mem-l.patch | 30 ++++++++++++++++ ...4908_enet-fix-NAPI-poll-returned-val.patch | 31 +++++++++++++++++ ...4908_enet-enable-RX-after-processing.patch | 34 +++++++++++++++++++ 4 files changed, 103 insertions(+), 2 deletions(-) rename target/linux/bcm4908/patches-5.4/{170-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch => 073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch} (92%) create mode 100644 target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch create mode 100644 target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch create mode 100644 target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch diff --git a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch similarity index 92% rename from target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch rename to target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch index 87cb851034..0201bfeda3 100644 --- a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch +++ b/target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch @@ -1,7 +1,10 @@ -From d7dfbcba0437955ccbe4c6db736526d528f27720 Mon Sep 17 00:00:00 2001 +From 14b3b46a67f78ade99eafcbf320105615e948569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 12 Feb 2021 16:06:00 +0100 +Date: Fri, 12 Feb 2021 16:21:35 +0100 Subject: [PATCH] net: broadcom: bcm4908_enet: set MTU on open & on request +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Hardware comes up with default max frame size set to 1518. When using it with switch it results in actual Ethernet MTU 1492: @@ -13,6 +16,9 @@ traffic (MTU 1500). Define maximum possible Ethernet overhead and always set MAC max frame length accordingly. This change fixes handling Ethernet frames of length 1506 - 1514. + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller --- drivers/net/ethernet/broadcom/bcm4908_enet.c | 31 ++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch new file mode 100644 index 0000000000..8a24324122 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch @@ -0,0 +1,30 @@ +From 4dc7f09b8becfa35a55430a49d95acf19f996e6b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 24 Feb 2021 16:18:41 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: fix RX path possible mem leak +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +After filling RX ring slot with new skb it's required to free old skb. +Immediately on error or later in the net subsystem. + +Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210224151842.2419-1-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -570,6 +570,7 @@ static int bcm4908_enet_poll(struct napi + + if (len < ETH_ZLEN || + (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { ++ kfree_skb(slot.skb); + enet->netdev->stats.rx_dropped++; + break; + } diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch new file mode 100644 index 0000000000..d4cf84e4b6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch @@ -0,0 +1,31 @@ +From 4d9274cee40b6a20dd6148c6c81c6733c2678cbc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 24 Feb 2021 16:18:42 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: fix NAPI poll returned value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Missing increment was resulting in poll function always returning 0 +instead of amount of processed packets. + +Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210224151842.2419-2-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -583,6 +583,8 @@ static int bcm4908_enet_poll(struct napi + + enet->netdev->stats.rx_packets++; + enet->netdev->stats.rx_bytes += len; ++ ++ handled++; + } + + if (handled < weight) { diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch new file mode 100644 index 0000000000..ad1bebf3ec --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch @@ -0,0 +1,34 @@ +From d313d16bbaea0f11a2e98f04a6c678b43c208915 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 26 Feb 2021 14:20:38 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: enable RX after processing + packets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When receiving a lot of packets hardware may run out of free +descriptiors and stop RX ring. Enable it every time after handling +received packets. + +Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210226132038.29849-1-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -592,6 +592,9 @@ static int bcm4908_enet_poll(struct napi + bcm4908_enet_intrs_on(enet); + } + ++ /* Hardware could disable ring if it run out of descriptors */ ++ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); ++ + return handled; + } + From 543007917aaa191f1908974caa95d97b1f55a72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 1 Mar 2021 18:12:48 +0100 Subject: [PATCH 03/19] kernel: add the latest mtd patch extending ofpart parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds the latest version of ofpart commit. It hopefully 1. Doesn't break compilation 2. Doesn't break partitioning (this time). It's required to implement fixed partitioning with some quirks. It's required by bcm53xx, bcm4908, kirkwood, lantiq and mvebu. Signed-off-by: Rafał Miłecki (cherry picked from commit 7a7b2fd809809fbd7045bd3dad4fc896a6fef06f) --- .../404-mtd-cybertan-trx-parser.patch | 12 +++++------ ...rt-support-BCM4908-fixed-partitions.patch} | 16 +++++++-------- ...30-mtd-add-myloader-partition-parser.patch | 4 ++-- ...mtd-add-routerbootpart-parser-config.patch | 4 ++-- ...d-add-SMEM-parser-for-QCOM-platforms.patch | 4 ++-- .../202-linksys-find-active-root.patch | 12 +++++------ .../patches-5.4/0101-find_active_root.patch | 20 +++++++++---------- .../patches-5.4/400-find_active_root.patch | 12 +++++------ 8 files changed, 41 insertions(+), 43 deletions(-) rename target/linux/{bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch => generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch} (97%) diff --git a/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch index 1ebf87c610..59ee57d277 100644 --- a/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch +++ b/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch @@ -1,18 +1,18 @@ --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6 - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o +@@ -7,6 +7,7 @@ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myl obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + ofpart-y += ofpart_core.o + ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o +obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -83,6 +83,14 @@ config MTD_OF_PARTS - flash memory node, as described in - Documentation/devicetree/bindings/mtd/partition.txt. +@@ -92,6 +92,14 @@ config MTD_OF_PARTS_BCM4908 + that can have multiple "firmware" partitions. It takes care of + finding currently used one and backup ones. +config MTD_PARSER_CYBERTAN + tristate "Parser for Cybertan format partitions" diff --git a/target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch similarity index 97% rename from target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch rename to target/linux/generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch index ace0c77c09..8f292bd177 100644 --- a/target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch +++ b/target/linux/generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch @@ -1,4 +1,4 @@ -From 3924b0384a0cd20245e2ffb55c45c2ace737a061 Mon Sep 17 00:00:00 2001 +From afbef8efb591792579c633a7c545f914c6165f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 11 Feb 2021 23:04:27 +0100 Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions @@ -22,17 +22,17 @@ Signed-off-by: Rafał Miłecki --- drivers/mtd/parsers/Kconfig | 9 +++ drivers/mtd/parsers/Makefile | 2 + - drivers/mtd/parsers/ofpart_bcm4908.c | 66 +++++++++++++++++++ + drivers/mtd/parsers/ofpart_bcm4908.c | 64 +++++++++++++++++++ drivers/mtd/parsers/ofpart_bcm4908.h | 15 +++++ .../mtd/parsers/{ofpart.c => ofpart_core.c} | 28 +++++++- - 5 files changed, 118 insertions(+), 2 deletions(-) + 5 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.c create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.h rename drivers/mtd/parsers/{ofpart.c => ofpart_core.c} (88%) --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -83,6 +83,15 @@ config MTD_OF_PARTS +@@ -67,6 +67,15 @@ config MTD_OF_PARTS flash memory node, as described in Documentation/devicetree/bindings/mtd/partition.txt. @@ -50,9 +50,9 @@ Signed-off-by: Rafał Miłecki depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -5,6 +5,8 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6 +@@ -4,6 +4,8 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +ofpart-y += ofpart_core.o +ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o @@ -61,7 +61,7 @@ Signed-off-by: Rafał Miłecki obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o --- /dev/null +++ b/drivers/mtd/parsers/ofpart_bcm4908.c -@@ -0,0 +1,66 @@ +@@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Rafał Miłecki @@ -126,8 +126,6 @@ Signed-off-by: Rafał Miłecki + + return 0; +} -+ -+MODULE_LICENSE("GPL"); --- /dev/null +++ b/drivers/mtd/parsers/ofpart_bcm4908.h @@ -0,0 +1,15 @@ diff --git a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch index 9600dfc67a..3319ed94c2 100644 --- a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch @@ -41,8 +41,8 @@ Signed-off-by: Adrian Schmutzler obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o +obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + ofpart-y += ofpart_core.o + ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o --- /dev/null +++ b/drivers/mtd/parsers/myloader.c @@ -0,0 +1,181 @@ diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch index 1523e757c7..7853cae325 100644 --- a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -16,7 +16,7 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -176,3 +176,12 @@ config MTD_REDBOOT_PARTS_READONLY +@@ -185,3 +185,12 @@ config MTD_REDBOOT_PARTS_READONLY 'FIS directory' images, enable this option. endif # MTD_REDBOOT_PARTS @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -10,3 +10,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o +@@ -12,3 +12,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o diff --git a/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch b/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch index 6aa404c8c5..0b54e0772e 100644 --- a/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch +++ b/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch @@ -18,7 +18,7 @@ Signed-off-by: Ram Chandra Jangir --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -119,6 +119,13 @@ config MTD_PARSER_TRX +@@ -128,6 +128,13 @@ config MTD_PARSER_TRX This driver will parse TRX header and report at least two partitions: kernel and rootfs. @@ -34,7 +34,7 @@ Signed-off-by: Ram Chandra Jangir depends on MTD_NAND_SHARPSL || MTD_NAND_TMIO || COMPILE_TEST --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +@@ -10,6 +10,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o diff --git a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch index b7e7f50271..cc35583b98 100644 --- a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch +++ b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch @@ -3,9 +3,9 @@ Dynamically rename the active partition to "ubi". Signed-off-by: Imre Kaloz --- ---- a/drivers/mtd/parsers/ofpart.c -+++ b/drivers/mtd/parsers/ofpart.c -@@ -21,6 +21,8 @@ static bool node_has_compatible(struct d +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -28,6 +30,7 @@ static int parse_fixed_partitions(struct +@@ -42,6 +44,7 @@ static int parse_fixed_partitions(struct struct mtd_partition *parts; struct device_node *mtd_node; struct device_node *ofpart_node; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz const char *partname; struct device_node *pp; int nr_parts, i, ret = 0; -@@ -106,9 +109,15 @@ static int parse_fixed_partitions(struct +@@ -124,9 +127,15 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -41,7 +41,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -215,6 +224,18 @@ static int __init ofpart_parser_init(voi +@@ -239,6 +248,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch index b6b4ab7409..d541cc247c 100644 --- a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch +++ b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch @@ -1,6 +1,6 @@ ---- a/drivers/mtd/parsers/ofpart.c -+++ b/drivers/mtd/parsers/ofpart.c -@@ -21,6 +21,38 @@ static bool node_has_compatible(struct d +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -33,6 +33,38 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -39,17 +39,16 @@ static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -32,7 +64,8 @@ static int parse_fixed_partitions(struct +@@ -46,6 +78,8 @@ static int parse_fixed_partitions(struct struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; -- + uint8_t *proot_id = NULL; + struct device_node **part_nodes; /* Pull of_node from the master device node */ mtd_node = mtd_get_of_node(master); -@@ -68,7 +101,9 @@ static int parse_fixed_partitions(struct +@@ -86,7 +120,9 @@ static int parse_fixed_partitions(struct return 0; parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); @@ -60,7 +59,7 @@ return -ENOMEM; i = 0; -@@ -117,12 +152,22 @@ static int parse_fixed_partitions(struct +@@ -135,6 +171,11 @@ static int parse_fixed_partitions(struct if (of_get_property(pp, "lock", &len)) parts[i].mask_flags |= MTD_POWERUP_LOCK; @@ -72,8 +71,9 @@ i++; } - if (!nr_parts) - goto ofpart_none; +@@ -144,6 +185,11 @@ static int parse_fixed_partitions(struct + if (quirks && quirks->post_parse) + quirks->post_parse(master, parts, nr_parts); + if (proot_id) + brnboot_set_active_root_part(parts, part_nodes, nr_parts, proot_id); @@ -83,7 +83,7 @@ *pparts = parts; return nr_parts; -@@ -133,6 +178,7 @@ ofpart_fail: +@@ -154,6 +200,7 @@ ofpart_fail: ofpart_none: of_node_put(pp); kfree(parts); diff --git a/target/linux/mvebu/patches-5.4/400-find_active_root.patch b/target/linux/mvebu/patches-5.4/400-find_active_root.patch index 854031b0d5..8475bec925 100644 --- a/target/linux/mvebu/patches-5.4/400-find_active_root.patch +++ b/target/linux/mvebu/patches-5.4/400-find_active_root.patch @@ -3,9 +3,9 @@ Dynamically rename the active partition to "ubi". Signed-off-by: Imre Kaloz ---- a/drivers/mtd/parsers/ofpart.c -+++ b/drivers/mtd/parsers/ofpart.c -@@ -21,6 +21,8 @@ static bool node_has_compatible(struct d +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -29,6 +31,7 @@ static int parse_fixed_partitions(struct +@@ -43,6 +45,7 @@ static int parse_fixed_partitions(struct struct device_node *mtd_node; struct device_node *ofpart_node; const char *partname; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; -@@ -106,9 +109,13 @@ static int parse_fixed_partitions(struct +@@ -124,9 +127,13 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -39,7 +39,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -215,6 +222,18 @@ static int __init ofpart_parser_init(voi +@@ -239,6 +246,18 @@ static int __init ofpart_parser_init(voi return 0; } From 217687c7ec3a05f8410dcd907a077c2c809b6ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 5 Mar 2021 10:14:28 +0100 Subject: [PATCH 04/19] bcm63xx-cfe: update to the latest master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3fb6f1c tp-link: c2300-v1: add cferam file 79f9578 sercomm: vox-2.5: add cferam file Signed-off-by: Rafał Miłecki (cherry picked from commit ac39c4bd6000aa435905f4e97a241f582a50c0f8) --- package/kernel/bcm63xx-cfe/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/bcm63xx-cfe/Makefile b/package/kernel/bcm63xx-cfe/Makefile index 3eada4bab2..a760bffee3 100644 --- a/package/kernel/bcm63xx-cfe/Makefile +++ b/package/kernel/bcm63xx-cfe/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/openwrt/bcm63xx-cfe.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-12-27 -PKG_SOURCE_VERSION:=c0b36917ea565c4ffac2e723f77c9d27d0691c33 -PKG_MIRROR_HASH:=75262534b1fbeba2299621ec3112d9d22b3e3de4cb73e8d7cac1e0b7e5eece77 +PKG_SOURCE_DATE:=2021-03-05 +PKG_SOURCE_VERSION:=3fb6f1cbcce79544b303d94619c5ca4c77537cbf +PKG_MIRROR_HASH:=35042a44973fad5b3418e9cceaadf79d59bacb46066632a5d865af9545c75d8a PKG_FLAGS:=nonshared From 058e4c57aab46ee97850767c1cfc34c3661bfdbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 5 Mar 2021 14:37:01 +0100 Subject: [PATCH 05/19] bcm63xx-cfe: update to the latest master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit d035016 tp-link: rename to tplink to match DT vendor prefix Signed-off-by: Rafał Miłecki (cherry picked from commit 4d961436c490800237fdca177b782a82aa300c32) --- package/kernel/bcm63xx-cfe/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/bcm63xx-cfe/Makefile b/package/kernel/bcm63xx-cfe/Makefile index a760bffee3..7b7557c006 100644 --- a/package/kernel/bcm63xx-cfe/Makefile +++ b/package/kernel/bcm63xx-cfe/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm63xx-cfe -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://github.com/openwrt/bcm63xx-cfe.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2021-03-05 -PKG_SOURCE_VERSION:=3fb6f1cbcce79544b303d94619c5ca4c77537cbf -PKG_MIRROR_HASH:=35042a44973fad5b3418e9cceaadf79d59bacb46066632a5d865af9545c75d8a +PKG_SOURCE_VERSION:=d03501629fc8b1ba8f9b0961d543c256a3d0098f +PKG_MIRROR_HASH:=b32a6f68d59c8f4534def7ec2568ad7da7a612a605b9406328309c78115ee88d PKG_FLAGS:=nonshared From bc2c3d99c8e1ea6af1d8be38ea4d6cdf821afa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 5 Mar 2021 14:38:41 +0100 Subject: [PATCH 06/19] bcm4908: prepare to support TP-Link Archer C2300 V1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's a BCM4906 based device (2 CPU cores). It has 512 MiB of RAM, 4 LAN ports, 1 WAN port, 2 USB ports, NAND flash. WiFi unknown at this point. Flashing is possible using CFE only, proper image will be worked on later. Signed-off-by: Rafał Miłecki (cherry picked from commit 8d24da14702b8da820bf2e3952d5691f77136018) --- target/linux/bcm4908/image/Makefile | 10 + .../tplink_archer-c2300-v1/etc/image_version | 1 + .../image/tplink_archer-c2300-v1/nvram.nvm | Bin 0 -> 8691 bytes ...bcm-document-TP-Link-Archer-C2300-bi.patch | 21 ++ ...om-bcm4908-add-TP-Link-Archer-C2300-.patch | 207 ++++++++++++++++++ 5 files changed, 239 insertions(+) create mode 100644 target/linux/bcm4908/image/tplink_archer-c2300-v1/etc/image_version create mode 100755 target/linux/bcm4908/image/tplink_archer-c2300-v1/nvram.nvm create mode 100644 target/linux/bcm4908/patches-5.4/131-0001-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch create mode 100644 target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile index 8a40a1e6a9..59284d7b63 100644 --- a/target/linux/bcm4908/image/Makefile +++ b/target/linux/bcm4908/image/Makefile @@ -71,4 +71,14 @@ define Device/netgear_r8000p endef TARGET_DEVICES += netgear_r8000p +define Device/tplink_archer-c2300-v1 + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := Archer C2300 + DEVICE_VARIANT := v1 + DEVICE_DTS := broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1 + IMAGES := bin + IMAGE/bin := append-ubi | bcm4908img +endef +TARGET_DEVICES += tplink_archer-c2300-v1 + $(eval $(call BuildImage)) diff --git a/target/linux/bcm4908/image/tplink_archer-c2300-v1/etc/image_version b/target/linux/bcm4908/image/tplink_archer-c2300-v1/etc/image_version new file mode 100644 index 0000000000..4fc5b5c933 --- /dev/null +++ b/target/linux/bcm4908/image/tplink_archer-c2300-v1/etc/image_version @@ -0,0 +1 @@ +5022HNDrc7HND2221446 diff --git a/target/linux/bcm4908/image/tplink_archer-c2300-v1/nvram.nvm b/target/linux/bcm4908/image/tplink_archer-c2300-v1/nvram.nvm new file mode 100755 index 0000000000000000000000000000000000000000..422f391733ce289332309f4c13e19cdaf5399b2c GIT binary patch literal 8691 zcmd5?%d+D(4!xf;ACT%Msi$4#MRzh;WiwN=n4OCfN!t}a6iN49_umf=NJ*3|Rc6^Y ziEW-k0w4%N6p^dGA205%Z?-$w{w)7N9||7{K2m&S_{iU?R{Xy`AG$U7_uE0Kw+g@A zRiCs}W7-^E_$Z&!Uc_T%rY{2Y4;j5uBz z7AJS=i_FU}@{45nZu^_={yeBG`!f6|-bj9<$q9$1zSytgtNi*V_g(wAwf5s66Kc$+ zBWXJLZ-z$`N@qlZna+@u5GhK+KJ5Ks&`K=^ksaJjle(tn!YB1!?e;nQMDFYQVeH}C zAAeB4)}CM}lxUru4l={9lNN_U`d@PVrN&=L_;v5Q&r4sQdAzf?x^J%sMdSLeyEKok zyFMBVsRY@E#9r>yg0jYh2KWAawEBLs7&Y*^F|}?&3wXfU(PwEhU)y0j?iy`y?Ql_j@$`<#7j2 z!=Jsry4L=6ND-t2H0K|+z8*2&*lVwe7_=N4+g={#K#?5u9?w6z-qIv4-2o<#*2%%V z5kY_y76Zvc?)rGNaLiNu0{a|3lMJ5{fzcT6iIg^mIHXCM!N)NwS5ftXma7tg%7c;; zVK;~cs1CawLEU>*(T>VaAM9vMt^r)%?|iTwKgTbZZ4lFX!= zOu5NG8U?|Iv~>p3))`1UZ%SKdAZ?Ag(rWQM{lw8^rBjnfQM0R*xZG25ZlQVvN16S60}D$10?}K!pV^&1_1dcuOa{s zqFhG+J%^~(KQHDvrRgCV)b*c8J^U=0VR8jiFIad$_$=l_?iS20lq*Q@Aao)*XDXAg zlAJ!bMq+B4V)3|LkSXu5!5|@WJP8JaCK3jTG+ifQkVxsMvo?|+`lZ4%^HnSi5+!HK zf%KbdFsS&RVBua#_R#MMGW09S9;#-Kk4Y?hNW1viGLh^dKXOd!Pq~>nHz=geRSG-Y z6J)nfk8yg7s3>7YsE?3yiv&QAa}qKog&3V|SKGF)Q*8Sh#kMoSwnsVZIicQ@Q+|)A zct-03W*Yp~@3ND<-ubA73`Uw?aY`twI3<%+oDxZl_wA*7kZ|n8QMd=`u=onnx$zaG zBjg-})zyy%d1IZRZ+Gv&=$rMxk#R4`?oTT7f}^RUl`vo$$mH)}}| znoqoQ;V-z1o;f@y#^0}%f7apnK$#`avIOrVbDTnM6{nzE#VPDoaJeC0(#z6%|8@CN zugg~(^3{fXMek#4dew&fWJ7+kAwSuWpKQoaH{_=q^3x6ZX(WF*$c)D>dTY1-{FKLU zr*r073O*iSW zcK)iQo1p*vH#;5aW+mw#IJT$sM@pj(|DJb9=x^EK`;TTOMA6^8&+XFHvo2v@MS2E9 zivHox{t-9Wu+EL@*XT*}$lmmm?B)GR?fse9kds&;63Zjf@@VmZ^UFzrlHK%PEUiR%g}N%XHFJH#F+x)9R1Oku?lA8 znFOe0#kLBQQ_Ge$W*iKWb=)#0g~_TCIH?A2VO?nZfUr9&@s*fJwW?XXF4-eNZd$OL zR93>>@u#s+%6PbnBl68f#t|}1@#wJ+nQM_QzS>C0NLq5xP=qYQ7Aa`}j zA!ZeJMHr_9d&?9V+~h|>W;oJl#?Sj*dy#<5IOqo;9#)fRPF-oaNsu4fiY*|K63F%ldB}v{7 zPR3rWIM}T=oSfB|RtKXvrhX!$+Gl;HyI6{JF89n@-RCjTN3Q>gClW8Az3(ky4&LKYQB9C~ zMRhJ}9RJrIh5P&HQT#M9U7 zNc*y0$1_9Sa46ToiCiU|SL)TVsk@g5`k!ctj6XB-#;mqyaPST$!Rgx*duMtkrqJB34q5edBeOaZ7p|Mw| zTWpDvL~;V?e>A9K=lPftxM=^R; +Date: Fri, 5 Mar 2021 13:34:03 +0100 +Subject: [PATCH] dt-bindings: arm: bcm: document TP-Link Archer C2300 binding + +One more BCM4906 based device. + +Signed-off-by: Rafał Miłecki +--- + Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml | 1 + + 1 file changed, 1 insertion(+) + +--- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml ++++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml +@@ -21,6 +21,7 @@ properties: + items: + - enum: + - netgear,r8000p ++ - tplink,archer-c2300-v1 + - const: brcm,bcm4906 + - const: brcm,bcm4908 + diff --git a/target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch b/target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch new file mode 100644 index 0000000000..cc1835e799 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch @@ -0,0 +1,207 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 5 Mar 2021 13:36:25 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: add TP-Link Archer C2300 V1 + +Archer C2300 V1 is a home router based on the BCM4906 (2 CPU cores). It +has 512 MiB of RAM, NAND flash, USB 2.0 and USB 3.0 ports, 4 LAN ports, +1 WAN port. + +Signed-off-by: Rafał Miłecki +--- + arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 1 + + .../bcm4906-tplink-archer-c2300-v1.dts | 182 ++++++++++++++++++ + 2 files changed, 183 insertions(+) + create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/Makefile ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0 + dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb ++dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb + dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts +@@ -0,0 +1,182 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++ ++#include "bcm4906.dtsi" ++ ++/ { ++ compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908"; ++ model = "TP-Link Archer C2300 V1"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00 0x00 0x00 0x20000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power-white { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 2ghz { ++ function = "2ghz"; ++ color = ; ++ gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 5ghz { ++ function = "5ghz"; ++ color = ; ++ gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wan-amber { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wan-blue { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ lan { ++ function = LED_FUNCTION_LAN; ++ color = ; ++ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ function = LED_FUNCTION_WPS; ++ color = ; ++ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb-high-white { ++ function = "usbup"; ++ color = ; ++ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb-low-white { ++ function = "usbdown"; ++ color = ; ++ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; ++ }; ++ ++ brightness { ++ function = LED_FUNCTION_BACKLIGHT; ++ color = ; ++ gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ poll-interval = <100>; ++ ++ brightness { ++ label = "LEDs"; ++ linux,code = ; ++ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wifi { ++ label = "WiFi"; ++ linux,code = ; ++ gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; ++ }; ++ ++ restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&usb_phy { ++ brcm,ioc = <1>; ++ status = "okay"; ++}; ++ ++&ehci { ++ status = "okay"; ++}; ++ ++&ohci { ++ status = "okay"; ++}; ++ ++&xhci { ++ status = "okay"; ++}; ++ ++&ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ phy-mode = "internal"; ++ phy-handle = <&phy12>; ++ label = "wan"; ++ }; ++}; ++ ++&nandcs { ++ nand-ecc-strength = <4>; ++ nand-ecc-step-size = <512>; ++ nand-on-flash-bbt; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ partitions { ++ compatible = "brcm,bcm4908-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "cferom"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ compatible = "brcm,bcm4908-firmware"; ++ reg = <0x100000 0x3900000>; ++ }; ++ ++ partition@5800000 { ++ compatible = "brcm,bcm4908-firmware"; ++ reg = <0x3a00000 0x3900000>; ++ }; ++ }; ++}; From c8b415035cb6414774a83f703ff709371f7089c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 12 Mar 2021 17:37:59 +0100 Subject: [PATCH 07/19] kernel: move mtd ofpart accepted patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move upstream patch to the backport directory. Signed-off-by: Rafał Miłecki (cherry picked from commit deceb039931cd8eb011a0eb65731f335662070d0) --- ....13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/{pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch => backport-5.4/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch} (100%) diff --git a/target/linux/generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/generic/backport-5.4/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch similarity index 100% rename from target/linux/generic/pending-5.4/404-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch rename to target/linux/generic/backport-5.4/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch From 6a217d6d72fff766fc0c8fcf73905fad5fde8fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 12 Mar 2021 18:30:01 +0100 Subject: [PATCH 08/19] kernel: add pending mtd patches adding NVMEM support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's meant to provide upstream support for mtd & NVMEM. It's required e.g. for reading MAC address from mtd partition content. It seems to be in a final shape so it's worth testing. Signed-off-by: Rafał Miłecki (cherry picked from commit e90e75b12c818c49704755b9e530491aee2d554c) --- ...rt-limit-parsing-of-deprecated-DT-sy.patch | 69 +++++++++++ ...em-cells-compatible-to-parse-mtd-as-.patch | 38 ++++++ ...vmem-nvmem-drop-nodename-restriction.patch | 25 ++++ ...Document-use-of-nvmem-cells-compatib.patch | 117 ++++++++++++++++++ .../480-mtd-set-rootfs-to-be-root-dev.patch | 2 +- ...-mtd-core-add-get_mtd_device_by_node.patch | 2 +- .../202-linksys-find-active-root.patch | 4 +- .../patches-5.4/0101-find_active_root.patch | 8 +- .../patches-5.4/400-find_active_root.patch | 4 +- ...or-support-mtd-name-from-device-tree.patch | 2 +- 10 files changed, 260 insertions(+), 11 deletions(-) create mode 100644 target/linux/generic/backport-5.4/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch create mode 100644 target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch create mode 100644 target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch create mode 100644 target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch diff --git a/target/linux/generic/backport-5.4/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch b/target/linux/generic/backport-5.4/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch new file mode 100644 index 0000000000..35058adba7 --- /dev/null +++ b/target/linux/generic/backport-5.4/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch @@ -0,0 +1,69 @@ +From 2d751203aacf86a1b301a188d8551c7da91043ab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 2 Mar 2021 20:00:12 +0100 +Subject: [PATCH] mtd: parsers: ofpart: limit parsing of deprecated DT syntax +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For backward compatibility ofpart still supports the old syntax like: +spi-flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x0>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x100000>; + }; +}; +(without "partitions" subnode). + +There is no reason however to support nested partitions without a clear +"compatible" string like: +partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x100000>; + + partition@0 { + label = "config"; + reg = <0x80000 0x80000>; + }; + }; +}; +(we never officially supported or documented that). + +Make sure ofpart doesn't attempt to parse above. + +Cc: Ansuel Smith +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210302190012.1255-1-zajec5@gmail.com +--- + drivers/mtd/parsers/ofpart_core.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -53,7 +53,7 @@ static int parse_fixed_partitions(struct + return 0; + + ofpart_node = of_get_child_by_name(mtd_node, "partitions"); +- if (!ofpart_node) { ++ if (!ofpart_node && !mtd_is_partition(master)) { + /* + * We might get here even when ofpart isn't used at all (e.g., + * when using another parser), so don't be louder than +@@ -64,6 +64,8 @@ static int parse_fixed_partitions(struct + ofpart_node = mtd_node; + dedicated = false; + } ++ if (!ofpart_node) ++ return 0; + + of_id = of_match_node(parse_ofpart_match_table, ofpart_node); + if (dedicated && !of_id) { diff --git a/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch b/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch new file mode 100644 index 0000000000..25801e4686 --- /dev/null +++ b/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch @@ -0,0 +1,38 @@ +From a5d83d6e2bc747b13f347962d4b335d70b23559b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 12 Mar 2021 07:28:19 +0100 +Subject: [PATCH] mtd: core: add nvmem-cells compatible to parse mtd as nvmem + cells +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Partitions that contains the nvmem-cells compatible will register +their direct subonodes as nvmem cells and the node will be treated as a +nvmem provider. + +Signed-off-by: Ansuel Smith +Tested-by: Rafał Miłecki +--- + drivers/mtd/mtdcore.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -559,6 +559,7 @@ static int mtd_nvmem_reg_read(void *priv + + static int mtd_nvmem_add(struct mtd_info *mtd) + { ++ struct device_node *node = mtd_get_of_node(mtd); + struct nvmem_config config = {}; + + config.id = -1; +@@ -571,7 +572,7 @@ static int mtd_nvmem_add(struct mtd_info + config.stride = 1; + config.read_only = true; + config.root_only = true; +- config.no_of_node = true; ++ config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); + config.priv = mtd; + + mtd->nvmem = nvmem_register(&config); diff --git a/target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch b/target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch new file mode 100644 index 0000000000..14ea3f6b8c --- /dev/null +++ b/target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch @@ -0,0 +1,25 @@ +From 42645976c3289b03a12f1bd2bc131fd98fc27170 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 12 Mar 2021 07:28:20 +0100 +Subject: [PATCH] devicetree: nvmem: nvmem: drop $nodename restriction + +Drop $nodename restriction as now mtd partition can also be used as +nvmem provider. + +Signed-off-by: Ansuel Smith +--- + Documentation/devicetree/bindings/nvmem/nvmem.yaml | 3 --- + 1 file changed, 3 deletions(-) + +--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml ++++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml +@@ -20,9 +20,6 @@ description: | + storage device. + + properties: +- $nodename: +- pattern: "^(eeprom|efuse|nvram)(@.*|-[0-9a-f])*$" +- + "#address-cells": + const: 1 + diff --git a/target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch b/target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch new file mode 100644 index 0000000000..0eb4c637cf --- /dev/null +++ b/target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch @@ -0,0 +1,117 @@ +From 377aa0135dc8489312edd3184d143ce3a89ff7ee Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 12 Mar 2021 07:28:21 +0100 +Subject: [PATCH] dt-bindings: mtd: Document use of nvmem-cells compatible + +Document nvmem-cells compatible used to treat mtd partitions as a +nvmem provider. + +Signed-off-by: Ansuel Smith +Reviewed-by: Rob Herring +--- + .../bindings/mtd/partitions/nvmem-cells.yaml | 99 +++++++++++++++++++ + 1 file changed, 99 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml +@@ -0,0 +1,99 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mtd/partitions/nvmem-cells.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Nvmem cells ++ ++description: | ++ Any partition containing the compatible "nvmem-cells" will register as a ++ nvmem provider. ++ Each direct subnodes represents a nvmem cell following the nvmem binding. ++ Nvmem binding to declare nvmem-cells can be found in: ++ Documentation/devicetree/bindings/nvmem/nvmem.yaml ++ ++maintainers: ++ - Ansuel Smith ++ ++allOf: ++ - $ref: /schemas/nvmem/nvmem.yaml# ++ ++properties: ++ compatible: ++ const: nvmem-cells ++ ++required: ++ - compatible ++ ++additionalProperties: true ++ ++examples: ++ - | ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ /* ... */ ++ ++ }; ++ art: art@1200000 { ++ compatible = "nvmem-cells"; ++ reg = <0x1200000 0x0140000>; ++ label = "art"; ++ read-only; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ macaddr_gmac1: macaddr_gmac1@0 { ++ reg = <0x0 0x6>; ++ }; ++ ++ macaddr_gmac2: macaddr_gmac2@6 { ++ reg = <0x6 0x6>; ++ }; ++ ++ pre_cal_24g: pre_cal_24g@1000 { ++ reg = <0x1000 0x2f20>; ++ }; ++ ++ pre_cal_5g: pre_cal_5g@5000{ ++ reg = <0x5000 0x2f20>; ++ }; ++ }; ++ - | ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bootloader"; ++ reg = <0x000000 0x100000>; ++ read-only; ++ }; ++ ++ firmware@100000 { ++ compatible = "brcm,trx"; ++ label = "firmware"; ++ reg = <0x100000 0xe00000>; ++ }; ++ ++ calibration@f00000 { ++ compatible = "nvmem-cells"; ++ label = "calibration"; ++ reg = <0xf00000 0x100000>; ++ ranges = <0 0xf00000 0x100000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ wifi0@0 { ++ reg = <0x000000 0x080000>; ++ }; ++ ++ wifi1@80000 { ++ reg = <0x080000 0x080000>; ++ }; ++ }; ++ }; diff --git a/target/linux/generic/pending-5.4/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-5.4/480-mtd-set-rootfs-to-be-root-dev.patch index 3907ac2368..95863d6edb 100644 --- a/target/linux/generic/pending-5.4/480-mtd-set-rootfs-to-be-root-dev.patch +++ b/target/linux/generic/pending-5.4/480-mtd-set-rootfs-to-be-root-dev.patch @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos #include #include -@@ -698,6 +699,15 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -699,6 +700,15 @@ int add_mtd_device(struct mtd_info *mtd) of this try_ nonsense, and no bitching about it either. :) */ __module_get(THIS_MODULE); diff --git a/target/linux/generic/pending-5.4/495-mtd-core-add-get_mtd_device_by_node.patch b/target/linux/generic/pending-5.4/495-mtd-core-add-get_mtd_device_by_node.patch index 3a118e38fe..b6e36410e7 100644 --- a/target/linux/generic/pending-5.4/495-mtd-core-add-get_mtd_device_by_node.patch +++ b/target/linux/generic/pending-5.4/495-mtd-core-add-get_mtd_device_by_node.patch @@ -17,7 +17,7 @@ Reviewed-by: Miquel Raynal --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -1049,6 +1049,44 @@ out_unlock: +@@ -1050,6 +1050,44 @@ out_unlock: } EXPORT_SYMBOL_GPL(get_mtd_device_nm); diff --git a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch index cc35583b98..3077e718c3 100644 --- a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch +++ b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz const char *partname; struct device_node *pp; int nr_parts, i, ret = 0; -@@ -124,9 +127,15 @@ static int parse_fixed_partitions(struct +@@ -126,9 +129,15 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -41,7 +41,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -239,6 +248,18 @@ static int __init ofpart_parser_init(voi +@@ -241,6 +250,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch index d541cc247c..201cdd3f87 100644 --- a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch +++ b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch @@ -48,7 +48,7 @@ /* Pull of_node from the master device node */ mtd_node = mtd_get_of_node(master); -@@ -86,7 +120,9 @@ static int parse_fixed_partitions(struct +@@ -88,7 +122,9 @@ static int parse_fixed_partitions(struct return 0; parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); @@ -59,7 +59,7 @@ return -ENOMEM; i = 0; -@@ -135,6 +171,11 @@ static int parse_fixed_partitions(struct +@@ -137,6 +173,11 @@ static int parse_fixed_partitions(struct if (of_get_property(pp, "lock", &len)) parts[i].mask_flags |= MTD_POWERUP_LOCK; @@ -71,7 +71,7 @@ i++; } -@@ -144,6 +185,11 @@ static int parse_fixed_partitions(struct +@@ -146,6 +187,11 @@ static int parse_fixed_partitions(struct if (quirks && quirks->post_parse) quirks->post_parse(master, parts, nr_parts); @@ -83,7 +83,7 @@ *pparts = parts; return nr_parts; -@@ -154,6 +200,7 @@ ofpart_fail: +@@ -156,6 +202,7 @@ ofpart_fail: ofpart_none: of_node_put(pp); kfree(parts); diff --git a/target/linux/mvebu/patches-5.4/400-find_active_root.patch b/target/linux/mvebu/patches-5.4/400-find_active_root.patch index 8475bec925..6ac777a1d2 100644 --- a/target/linux/mvebu/patches-5.4/400-find_active_root.patch +++ b/target/linux/mvebu/patches-5.4/400-find_active_root.patch @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; -@@ -124,9 +127,13 @@ static int parse_fixed_partitions(struct +@@ -126,9 +129,13 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -39,7 +39,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -239,6 +246,18 @@ static int __init ofpart_parser_init(voi +@@ -241,6 +248,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch index 2d0b1cc634..69a8303d2b 100644 --- a/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -778,6 +778,17 @@ out_error: +@@ -779,6 +779,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { From b18fe2ecc45a1dd83533fbab64479b4c1be74f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 14 Mar 2021 19:22:18 +0100 Subject: [PATCH 09/19] bcm4908: use accepted 5.13 DTS patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some patches were slightly cleaned up. One things worth mentioning is that adding: phy-mode = "rgmii" broke SF2 driver. It made it access random register breaking switch setup. That's why this commit also adds a quick sf2 fix. Signed-off-by: Rafał Miłecki (cherry picked from commit 05dbfe616d551bce1a19d3846c8949c047325624) --- ...com-bcm4908-describe-internal-switch.patch | 28 ++--- ...s-broadcom-bcm4908-describe-USB-PHY.patch} | 6 +- ...m-bcm4908-describe-Ethernet-control.patch} | 11 +- ...m-bcm4908-describe-Netgear-R8000P-s.patch} | 4 +- ...m-bcm4908-add-remaining-Netgear-R80.patch} | 27 +++-- ...m-bcm4908-describe-firmware-partiti.patch} | 4 +- ...om-bcm4908-fix-switch-parent-node-na.patch | 30 +++++ ...cm-document-TP-Link-Archer-C2300-bi.patch} | 8 +- ...m-bcm4908-add-TP-Link-Archer-C2300-.patch} | 31 ++--- ...om-bcm4908-set-Asus-GT-AC5300-port-7.patch | 28 +++++ ...oadcom-bcm4908-limit-amount-of-GPIOs.patch | 2 +- ...quick-fix-for-RGMII-reg-access-on-BC.patch | 109 ++++++++++++++++++ 12 files changed, 238 insertions(+), 50 deletions(-) rename target/linux/bcm4908/patches-5.4/{130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch => 032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch} (94%) rename target/linux/bcm4908/patches-5.4/{130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch => 032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch} (79%) rename target/linux/bcm4908/patches-5.4/{130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch => 032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch} (85%) rename target/linux/bcm4908/patches-5.4/{130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch => 032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch} (78%) rename target/linux/bcm4908/patches-5.4/{130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch => 032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch} (90%) create mode 100644 target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch rename target/linux/bcm4908/patches-5.4/{131-0001-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch => 032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch} (69%) rename target/linux/bcm4908/patches-5.4/{131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch => 032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch} (89%) create mode 100644 target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch create mode 100644 target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch index c0e27a4e92..f80dc239bc 100644 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch +++ b/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch @@ -1,4 +1,4 @@ -From 961c38974fa5b34d6232d7485120e4392d279ab4 Mon Sep 17 00:00:00 2001 +From 527a3ac9bdf81da4b7160ce3cea57f28a0e5eb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 13 Jan 2021 12:14:06 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe internal switch @@ -58,22 +58,22 @@ Signed-off-by: Florian Fainelli + +&mdio { + /* lan8 */ -+ phy@0 { ++ ethernet-phy@0 { + reg = <0>; + }; + + /* lan7 */ -+ phy@1 { ++ ethernet-phy@1 { + reg = <1>; + }; + + /* lan4 */ -+ phy@2 { ++ ethernet-phy@2 { + reg = <2>; + }; + + /* lan3 */ -+ phy@3 { ++ ethernet-phy@3 { + reg = <3>; + }; +}; @@ -97,13 +97,13 @@ Signed-off-by: Florian Fainelli status = "disabled"; }; + -+ switch@80000 { ++ ethernet-switch@80000 { + compatible = "simple-bus"; + #size-cells = <1>; + #address-cells = <1>; + ranges = <0 0x80000 0x50000>; + -+ switch@0 { ++ ethernet-switch@0 { + compatible = "brcm,bcm4908-switch"; + reg = <0x0 0x40000>, + <0x40000 0x110>, @@ -155,26 +155,26 @@ Signed-off-by: Florian Fainelli + compatible = "brcm,unimac-mdio"; + reg = <0x405c0 0x8>; + reg-names = "mdio"; -+ #size-cells = <1>; -+ #address-cells = <0>; ++ #size-cells = <0>; ++ #address-cells = <1>; + -+ phy8: phy@8 { ++ phy8: ethernet-phy@8 { + reg = <8>; + }; + -+ phy9: phy@9 { ++ phy9: ethernet-phy@9 { + reg = <9>; + }; + -+ phy10: phy@a { ++ phy10: ethernet-phy@a { + reg = <10>; + }; + -+ phy11: phy@b { ++ phy11: ethernet-phy@b { + reg = <11>; + }; + -+ phy12: phy@c { ++ phy12: ethernet-phy@c { + reg = <12>; + }; + }; diff --git a/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch similarity index 94% rename from target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch index 8a10212d92..edf2ca6a38 100644 --- a/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch @@ -1,5 +1,6 @@ +From 3c321ba794ca6383a4aa68ea803e18cc6ad44412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 19:46:54 +0100 +Date: Fri, 19 Feb 2021 06:50:26 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe USB PHY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,6 +10,7 @@ BCM4908 uses slightly modified STB family USB PHY. It handles OHCI/EHCI and XHCI. It requires powering up using the PMB. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- .../bcm4908/bcm4906-netgear-r8000p.dts | 17 +++++++++++++ .../bcm4908/bcm4908-asus-gt-ac5300.dts | 17 +++++++++++++ @@ -86,7 +88,7 @@ Signed-off-by: Rafał Miłecki + usb_phy: usb-phy@c200 { + compatible = "brcm,bcm4908-usb-phy"; + reg = <0xc200 0x100>; -+ reg-names = "crtl"; ++ reg-names = "ctrl"; + power-domains = <&pmb BCM_PMB_HOST_USB>; + dr_mode = "host"; + brcm,has-xhci; diff --git a/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch similarity index 79% rename from target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch index 30487851c1..6c41e3d797 100644 --- a/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch @@ -1,5 +1,6 @@ +From b1bbe48eec190b6a35f400c5a3ec6b0fc8fc3fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 19:51:26 +0100 +Date: Fri, 19 Feb 2021 06:50:27 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Ethernet controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,9 +9,10 @@ Content-Transfer-Encoding: 8bit BCM4908 SoCs have an integrated Ethernet controller. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 20 +++++++++++++++++++ - 1 file changed, 20 insertions(+) + .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi @@ -29,7 +31,7 @@ Signed-off-by: Rafał Miłecki usb_phy: usb-phy@c200 { compatible = "brcm,bcm4908-usb-phy"; reg = <0xc200 0x100>; -@@ -199,6 +207,18 @@ +@@ -199,6 +207,17 @@ phy-mode = "internal"; phy-handle = <&phy11>; }; @@ -38,7 +40,6 @@ Signed-off-by: Rafał Miłecki + reg = <8>; + phy-mode = "internal"; + ethernet = <&enet>; -+ brcm,use-bcm-hdr; + + fixed-link { + speed = <1000>; diff --git a/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch similarity index 85% rename from target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch index 1ee59d7e2d..9c7f9cee6c 100644 --- a/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch @@ -1,5 +1,6 @@ +From 406e98afffe975982f63ea5d21bf9a47a81b56ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 19:52:58 +0100 +Date: Fri, 19 Feb 2021 06:50:28 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Netgear R8000P switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,6 +9,7 @@ Content-Transfer-Encoding: 8bit R8000P model has 4 LAN ports and 1 WAN port. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- .../bcm4908/bcm4906-netgear-r8000p.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch similarity index 78% rename from target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch index c192c35df0..56249c82f8 100644 --- a/target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch @@ -1,5 +1,6 @@ +From 6224415c0389ba6661825746312163a64ece8f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 20:05:41 +0100 +Date: Fri, 19 Feb 2021 06:50:29 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: add remaining Netgear R8000P LEDs MIME-Version: 1.0 @@ -10,9 +11,10 @@ There are a few more GPIO connected LEDs there didn't get described initially. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- - .../bcm4908/bcm4906-netgear-r8000p.dts | 48 +++++++++++++++++++ - 1 file changed, 48 insertions(+) + .../bcm4908/bcm4906-netgear-r8000p.dts | 50 ++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts @@ -20,55 +22,56 @@ Signed-off-by: Rafał Miłecki leds { compatible = "gpio-leds"; -+ power-white { +- wps { ++ led-power-white { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; + -+ power-amber { ++ led-power-amber { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + }; + - wps { ++ led-wps { function = LED_FUNCTION_WPS; color = ; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; }; + -+ 2ghz { ++ led-2ghz { + function = "2ghz"; + color = ; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + -+ 5ghz-1 { ++ led-5ghz-1 { + function = "5ghz-1"; + color = ; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + }; + -+ 5ghz-2 { ++ led-5ghz-2 { + function = "5ghz-2"; + color = ; + gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + }; + -+ usb2 { ++ led-usb2 { + function = "usb2"; + color = ; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + }; + -+ usb3 { ++ led-usb3 { + function = "usb3"; + color = ; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + -+ wifi { ++ led-wifi { + function = "wifi"; + color = ; + gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; diff --git a/target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch similarity index 90% rename from target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch index 10f33f5140..d03adc1743 100644 --- a/target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch @@ -1,5 +1,6 @@ +From cbaca2c467dc25a163107e14a53b7925214eab17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 20:30:09 +0100 +Date: Fri, 19 Feb 2021 06:50:30 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe firmware partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,6 +10,7 @@ BCM4908 bootloader supports multiple firmware partitions and has its own bindings defined for them. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- .../dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 1 + .../dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 12 +++++++++++- diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch new file mode 100644 index 0000000000..8b95fc2759 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch @@ -0,0 +1,30 @@ +From a348ff97ffb840b9d74b0e64b3e0e6002187d224 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 9 Mar 2021 19:44:09 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: fix switch parent node name +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Ethernet switch and MDIO are grouped using "simple-bus". It's not +allowed to use "ethernet-switch" node name as it isn't a switch. Replace +it with "bus". + +Fixes: 527a3ac9bdf8 ("arm64: dts: broadcom: bcm4908: describe internal switch") +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -156,7 +156,7 @@ + status = "disabled"; + }; + +- ethernet-switch@80000 { ++ bus@80000 { + compatible = "simple-bus"; + #size-cells = <1>; + #address-cells = <1>; diff --git a/target/linux/bcm4908/patches-5.4/131-0001-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch similarity index 69% rename from target/linux/bcm4908/patches-5.4/131-0001-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch index 911237be9a..07d4121ef1 100644 --- a/target/linux/bcm4908/patches-5.4/131-0001-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch @@ -1,10 +1,16 @@ +From b3de2a12d1a61d90a4d86c9840acc7d05066137f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 5 Mar 2021 13:34:03 +0100 +Date: Wed, 10 Mar 2021 08:46:02 +0100 Subject: [PATCH] dt-bindings: arm: bcm: document TP-Link Archer C2300 binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit One more BCM4906 based device. Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch similarity index 89% rename from target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch rename to target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch index cc1835e799..0dd7f2301f 100644 --- a/target/linux/bcm4908/patches-5.4/131-0002-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch @@ -1,12 +1,17 @@ +From 6a30934a5470a0ce7ea32b0c6b600accfae94b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 5 Mar 2021 13:36:25 +0100 +Date: Wed, 10 Mar 2021 08:46:03 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: add TP-Link Archer C2300 V1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Archer C2300 V1 is a home router based on the BCM4906 (2 CPU cores). It has 512 MiB of RAM, NAND flash, USB 2.0 and USB 3.0 ports, 4 LAN ports, 1 WAN port. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 1 + .../bcm4906-tplink-archer-c2300-v1.dts | 182 ++++++++++++++++++ @@ -43,61 +48,61 @@ Signed-off-by: Rafał Miłecki + leds { + compatible = "gpio-leds"; + -+ power-white { ++ led-power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + }; + -+ 2ghz { ++ led-2ghz { + function = "2ghz"; + color = ; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + }; + -+ 5ghz { ++ led-5ghz { + function = "5ghz"; + color = ; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + }; + -+ wan-amber { ++ led-wan-amber { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + }; + -+ wan-blue { ++ led-wan-blue { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; + -+ lan { ++ led-lan { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + -+ wps { ++ led-wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + -+ usb-high-white { -+ function = "usbup"; ++ led-usb2 { ++ function = "usb2"; + color = ; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + }; + -+ usb-low-white { -+ function = "usbdown"; ++ led-usb3 { ++ function = "usbd3"; + color = ; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + }; + -+ brightness { ++ led-brightness { + function = LED_FUNCTION_BACKLIGHT; + color = ; + gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch new file mode 100644 index 0000000000..30def36c39 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch @@ -0,0 +1,28 @@ +From 5ccb9f9cf05bbd729430c6d6d30d40c96a15c56a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 12:01:20 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: set Asus GT-AC5300 port 7 PHY + mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Port 7 is connected to the external BCM53134S switch using RGMII. + +Fixes: 527a3ac9bdf8 ("arm64: dts: broadcom: bcm4908: describe internal switch") +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts +@@ -82,6 +82,7 @@ + port@7 { + label = "sw"; + reg = <7>; ++ phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; diff --git a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch index c28c69c6f8..a3494fd2e5 100644 --- a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch +++ b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -281,7 +281,7 @@ +@@ -280,7 +280,7 @@ gpio0: gpio-controller@500 { compatible = "brcm,bcm6345-gpio"; reg-names = "dirout", "dat"; diff --git a/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch b/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch new file mode 100644 index 0000000000..2d88cf353b --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch @@ -0,0 +1,109 @@ +From 7e2dc41c745f6d9c571919d98abed2d783fce8fb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 14 Mar 2021 22:43:32 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: quick fix for RGMII reg access on BCM4908 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 has only 1 RGMII register and it's used for port 7. + +Signed-off-by: Rafał Miłecki +--- + drivers/net/dsa/bcm_sf2.c | 30 +++++++++++++++++++++++------- + drivers/net/dsa/bcm_sf2_regs.h | 1 + + 2 files changed, 24 insertions(+), 7 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -543,10 +543,19 @@ static void bcm_sf2_sw_mac_config(struct + struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); + u32 id_mode_dis = 0, port_mode; + u32 reg, offset; ++ u32 rgmii_ctrl; + + if (port == core_readl(priv, CORE_IMP0_PRT_ID)) + return; + ++ if (priv->type == BCM4908_DEVICE_ID) { ++ if (port != 7) ++ return; ++ rgmii_ctrl = REG_RGMII_11_CNTRL; ++ } else { ++ rgmii_ctrl = REG_RGMII_CNTRL_P(port); ++ } ++ + if (priv->type == BCM4908_DEVICE_ID || + priv->type == BCM7445_DEVICE_ID) + offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); +@@ -574,7 +583,7 @@ static void bcm_sf2_sw_mac_config(struct + /* Clear id_mode_dis bit, and the existing port mode, let + * RGMII_MODE_EN bet set by mac_link_{up,down} + */ +- reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); ++ reg = reg_readl(priv, rgmii_ctrl); + reg &= ~ID_MODE_DIS; + reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); + reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); +@@ -589,7 +598,7 @@ static void bcm_sf2_sw_mac_config(struct + reg |= RX_PAUSE_EN; + } + +- reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); ++ reg_writel(priv, reg, rgmii_ctrl); + + force_link: + /* Force link settings detected from the PHY */ +@@ -615,6 +624,7 @@ static void bcm_sf2_sw_mac_link_set(stru + phy_interface_t interface, bool link) + { + struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); ++ u32 rgmii_ctrl; + u32 reg; + + if (!phy_interface_mode_is_rgmii(interface) && +@@ -622,13 +632,21 @@ static void bcm_sf2_sw_mac_link_set(stru + interface != PHY_INTERFACE_MODE_REVMII) + return; + ++ if (priv->type == BCM4908_DEVICE_ID) { ++ if (port != 7) ++ return; ++ rgmii_ctrl = REG_RGMII_11_CNTRL; ++ } else { ++ rgmii_ctrl = REG_RGMII_CNTRL_P(port); ++ } ++ + /* If the link is down, just disable the interface to conserve power */ +- reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); ++ reg = reg_readl(priv, rgmii_ctrl); + if (link) + reg |= RGMII_MODE_EN; + else + reg &= ~RGMII_MODE_EN; +- reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); ++ reg_writel(priv, reg, rgmii_ctrl); + } + + static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, +@@ -999,9 +1017,7 @@ static const u16 bcm_sf2_4908_reg_offset + [REG_PHY_REVISION] = 0x14, + [REG_SPHY_CNTRL] = 0x24, + [REG_CROSSBAR] = 0xc8, +- [REG_RGMII_0_CNTRL] = 0xe0, +- [REG_RGMII_1_CNTRL] = 0xec, +- [REG_RGMII_2_CNTRL] = 0xf8, ++ [REG_RGMII_11_CNTRL] = 0x014c, + [REG_LED_0_CNTRL] = 0x40, + [REG_LED_1_CNTRL] = 0x4c, + [REG_LED_2_CNTRL] = 0x58, +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -21,6 +21,7 @@ enum bcm_sf2_reg_offs { + REG_RGMII_0_CNTRL, + REG_RGMII_1_CNTRL, + REG_RGMII_2_CNTRL, ++ REG_RGMII_11_CNTRL, + REG_LED_0_CNTRL, + REG_LED_1_CNTRL, + REG_LED_2_CNTRL, From 763f0bab3e1a1328e4d16a6a98ba6b552055577b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Mar 2021 20:30:21 +0100 Subject: [PATCH 10/19] bcm4908: backport first PHY 5.13 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Upstream accepted version of Kconfig change 2. Documentation binding fix Signed-off-by: Rafał Miłecki (cherry picked from commit d7c8ca4d0b5c18c08e645f010fd0012f54c1c102) --- ...-select-SOC_BRCMSTB-on-brcmstb-only.patch} | 15 +++++++-- ...brcm-brcmstb-usb-phy-add-power-domai.patch | 31 +++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) rename target/linux/bcm4908/patches-5.4/{800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch => 086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch} (51%) create mode 100644 target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch diff --git a/target/linux/bcm4908/patches-5.4/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch b/target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch similarity index 51% rename from target/linux/bcm4908/patches-5.4/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch rename to target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch index 965d60c18e..a341326ef4 100644 --- a/target/linux/bcm4908/patches-5.4/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch +++ b/target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch @@ -1,14 +1,23 @@ -From 73f63c66bf80bebd46d38a2660078dbe3fe11170 Mon Sep 17 00:00:00 2001 +From 261ab1fd5c5d2d7ff7d5bab3f5db3c69c4bcea58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 14 Jan 2021 12:02:28 +0100 +Date: Fri, 5 Mar 2021 16:24:06 +0100 Subject: [PATCH] phy: phy-brcm-usb: select SOC_BRCMSTB on brcmstb only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -BCM4908 doesn't need brcmstb SoC stuff compiled. +phy-brcm-usb has some conditional init code required on selected brcmstb +devices. Execution of that code depends on family / product detected by +brcmstb soc code. +For ARCH_BCM4908 brcmstb soc code always return 0 values as ids. Don't +bother selecting & compiling that redundant driver. + +Depends-on: 149ae80b1d50 ("soc: bcm: brcmstb: add stubs for getting platform IDs") Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210305152406.2588-1-zajec5@gmail.com +Signed-off-by: Vinod Koul --- drivers/phy/broadcom/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch b/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch new file mode 100644 index 0000000000..4db442c0ae --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch @@ -0,0 +1,31 @@ +From d9de0cbd5b1f6b51c92a40937945f26a35d848ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 9 Mar 2021 19:26:16 +0100 +Subject: [PATCH] dt-bindings: phy: brcm,brcmstb-usb-phy: add power-domains +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On BCM4908 USB PHY is managed using power controller so it needs +describing properly using the power-domains. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210309182616.25783-1-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + .../devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml ++++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml +@@ -42,6 +42,9 @@ properties: + - const: usb_mdio + - const: bdc_ec + ++ power-domains: ++ maxItems: 1 ++ + clocks: + minItems: 1 + maxItems: 2 From 86eb3de66eb3fd96eef7e223a1376517edf29dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 16 Mar 2021 23:35:45 +0100 Subject: [PATCH 11/19] bcm4908: backport recent bcm4908_enet changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes 5.12 fix and 5.13 improvements. Signed-off-by: Rafał Miłecki (cherry picked from commit 7091e312307f4563d4a7afb5946140120cfa87fa) --- ...4908_ENET-should-not-default-to-y-un.patch | 33 ++ ...oadcom-bcm4908_enet-read-MAC-from-OF.patch | 48 +++ ...bcm4908-enet-add-optional-TX-interru.patch | 50 +++ ...om-bcm4908_enet-support-TX-interrupt.patch | 300 ++++++++++++++++++ 4 files changed, 431 insertions(+) create mode 100644 target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch create mode 100644 target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch create mode 100644 target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch create mode 100644 target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch new file mode 100644 index 0000000000..43e5ee01bf --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch @@ -0,0 +1,33 @@ +From a3bc483216650a7232559bf0a1debfbabff3e12c Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Tue, 16 Mar 2021 15:03:41 +0100 +Subject: [PATCH] net: broadcom: BCM4908_ENET should not default to y, + unconditionally +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Merely enabling compile-testing should not enable additional code. +To fix this, restrict the automatic enabling of BCM4908_ENET to +ARCH_BCM4908. + +Fixes: 4feffeadbcb2e5b1 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") +Signed-off-by: Geert Uytterhoeven +Acked-by: Florian Fainelli +Acked-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/Kconfig ++++ b/drivers/net/ethernet/broadcom/Kconfig +@@ -54,7 +54,7 @@ config B44_PCI + config BCM4908_ENET + tristate "Broadcom BCM4908 internal mac support" + depends on ARCH_BCM4908 || COMPILE_TEST +- default y ++ default y if ARCH_BCM4908 + help + This driver supports Ethernet controller integrated into Broadcom + BCM4908 family SoCs. diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch new file mode 100644 index 0000000000..4b8e1f83b8 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch @@ -0,0 +1,48 @@ +From 3559c1ea4336636c886002996d50805365d3055c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 10 Mar 2021 09:48:13 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: read MAC from OF +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 devices have MAC address accessible using NVMEM so it's needed +to use OF helper for reading it. + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -620,6 +621,7 @@ static int bcm4908_enet_probe(struct pla + struct device *dev = &pdev->dev; + struct net_device *netdev; + struct bcm4908_enet *enet; ++ const u8 *mac; + int err; + + netdev = devm_alloc_etherdev(dev, sizeof(*enet)); +@@ -647,7 +649,11 @@ static int bcm4908_enet_probe(struct pla + return err; + + SET_NETDEV_DEV(netdev, &pdev->dev); +- eth_hw_addr_random(netdev); ++ mac = of_get_mac_address(dev->of_node); ++ if (!IS_ERR(mac)) ++ ether_addr_copy(netdev->dev_addr, mac); ++ else ++ eth_hw_addr_random(netdev); + netdev->netdev_ops = &bcm4908_enet_netdev_ops; + netdev->min_mtu = ETH_ZLEN; + netdev->mtu = ETH_DATA_LEN; diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch new file mode 100644 index 0000000000..b61437a2de --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch @@ -0,0 +1,50 @@ +From ab4dda7a8cb7e55ea3d92fd5e249cf6f5396028c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 11 Mar 2021 13:35:20 +0100 +Subject: [PATCH] dt-bindings: net: bcm4908-enet: add optional TX interrupt +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +I discovered that hardware actually supports two interrupts, one per DMA +channel (RX and TX). + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + .../bindings/net/brcm,bcm4908-enet.yaml | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +--- a/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml ++++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml +@@ -22,10 +22,18 @@ properties: + maxItems: 1 + + interrupts: +- description: RX interrupt ++ minItems: 1 ++ maxItems: 2 ++ items: ++ - description: RX interrupt ++ - description: TX interrupt + + interrupt-names: +- const: rx ++ minItems: 1 ++ maxItems: 2 ++ items: ++ - const: rx ++ - const: tx + + required: + - reg +@@ -43,6 +51,7 @@ examples: + compatible = "brcm,bcm4908-enet"; + reg = <0x80002000 0x1000>; + +- interrupts = ; +- interrupt-names = "rx"; ++ interrupts = , ++ ; ++ interrupt-names = "rx", "tx"; + }; diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch new file mode 100644 index 0000000000..a20be2ae8b --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch @@ -0,0 +1,300 @@ +From 12bb508bfe5a564c36864b12253db23cac83bfa1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 11 Mar 2021 13:35:21 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: support TX interrupt +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It appears that each DMA channel has its own interrupt and both rings +can be configured (the same way) to handle interrupts. + +1. Make ring interrupts code generic (make it operate on given ring) +2. Move napi to ring (so each has its own) +3. Make IRQ handler generic (match ring against received IRQ number) +4. Add (optional) support for TX interrupt + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 138 ++++++++++++++----- + 1 file changed, 103 insertions(+), 35 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -54,6 +54,7 @@ struct bcm4908_enet_dma_ring { + int length; + u16 cfg_block; + u16 st_ram_block; ++ struct napi_struct napi; + + union { + void *cpu_addr; +@@ -67,8 +68,8 @@ struct bcm4908_enet_dma_ring { + struct bcm4908_enet { + struct device *dev; + struct net_device *netdev; +- struct napi_struct napi; + void __iomem *base; ++ int irq_tx; + + struct bcm4908_enet_dma_ring tx_ring; + struct bcm4908_enet_dma_ring rx_ring; +@@ -123,24 +124,31 @@ static void enet_umac_set(struct bcm4908 + * Helpers + */ + +-static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet) ++static void bcm4908_enet_set_mtu(struct bcm4908_enet *enet, int mtu) + { +- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS); ++ enet_umac_write(enet, UMAC_MAX_FRAME_LEN, mtu + ENET_MAX_ETH_OVERHEAD); + } + +-static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet) ++/*** ++ * DMA ring ops ++ */ ++ ++static void bcm4908_enet_dma_ring_intrs_on(struct bcm4908_enet *enet, ++ struct bcm4908_enet_dma_ring *ring) + { +- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0); ++ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS); + } + +-static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet) ++static void bcm4908_enet_dma_ring_intrs_off(struct bcm4908_enet *enet, ++ struct bcm4908_enet_dma_ring *ring) + { +- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); ++ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0); + } + +-static void bcm4908_enet_set_mtu(struct bcm4908_enet *enet, int mtu) ++static void bcm4908_enet_dma_ring_intrs_ack(struct bcm4908_enet *enet, ++ struct bcm4908_enet_dma_ring *ring) + { +- enet_umac_write(enet, UMAC_MAX_FRAME_LEN, mtu + ENET_MAX_ETH_OVERHEAD); ++ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); + } + + /*** +@@ -414,11 +422,14 @@ static void bcm4908_enet_gmac_init(struc + static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id) + { + struct bcm4908_enet *enet = dev_id; ++ struct bcm4908_enet_dma_ring *ring; + +- bcm4908_enet_intrs_off(enet); +- bcm4908_enet_intrs_ack(enet); ++ ring = (irq == enet->irq_tx) ? &enet->tx_ring : &enet->rx_ring; + +- napi_schedule(&enet->napi); ++ bcm4908_enet_dma_ring_intrs_off(enet, ring); ++ bcm4908_enet_dma_ring_intrs_ack(enet, ring); ++ ++ napi_schedule(&ring->napi); + + return IRQ_HANDLED; + } +@@ -426,6 +437,8 @@ static irqreturn_t bcm4908_enet_irq_hand + static int bcm4908_enet_open(struct net_device *netdev) + { + struct bcm4908_enet *enet = netdev_priv(netdev); ++ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring; ++ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; + struct device *dev = enet->dev; + int err; + +@@ -435,6 +448,17 @@ static int bcm4908_enet_open(struct net_ + return err; + } + ++ if (enet->irq_tx > 0) { ++ err = request_irq(enet->irq_tx, bcm4908_enet_irq_handler, 0, ++ "tx", enet); ++ if (err) { ++ dev_err(dev, "Failed to request IRQ %d: %d\n", ++ enet->irq_tx, err); ++ free_irq(netdev->irq, enet); ++ return err; ++ } ++ } ++ + bcm4908_enet_gmac_init(enet); + bcm4908_enet_dma_reset(enet); + bcm4908_enet_dma_init(enet); +@@ -443,14 +467,19 @@ static int bcm4908_enet_open(struct net_ + + enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN); + enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0); +- bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); + +- napi_enable(&enet->napi); ++ if (enet->irq_tx > 0) { ++ napi_enable(&tx_ring->napi); ++ bcm4908_enet_dma_ring_intrs_ack(enet, tx_ring); ++ bcm4908_enet_dma_ring_intrs_on(enet, tx_ring); ++ } ++ ++ bcm4908_enet_dma_rx_ring_enable(enet, rx_ring); ++ napi_enable(&rx_ring->napi); + netif_carrier_on(netdev); + netif_start_queue(netdev); +- +- bcm4908_enet_intrs_ack(enet); +- bcm4908_enet_intrs_on(enet); ++ bcm4908_enet_dma_ring_intrs_ack(enet, rx_ring); ++ bcm4908_enet_dma_ring_intrs_on(enet, rx_ring); + + return 0; + } +@@ -458,16 +487,20 @@ static int bcm4908_enet_open(struct net_ + static int bcm4908_enet_stop(struct net_device *netdev) + { + struct bcm4908_enet *enet = netdev_priv(netdev); ++ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring; ++ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; + + netif_stop_queue(netdev); + netif_carrier_off(netdev); +- napi_disable(&enet->napi); ++ napi_disable(&rx_ring->napi); ++ napi_disable(&tx_ring->napi); + + bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring); + bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring); + + bcm4908_enet_dma_uninit(enet); + ++ free_irq(enet->irq_tx, enet); + free_irq(enet->netdev->irq, enet); + + return 0; +@@ -484,25 +517,19 @@ static int bcm4908_enet_start_xmit(struc + u32 tmp; + + /* Free transmitted skbs */ +- while (ring->read_idx != ring->write_idx) { +- buf_desc = &ring->buf_desc[ring->read_idx]; +- if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN) +- break; +- slot = &ring->slots[ring->read_idx]; +- +- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); +- dev_kfree_skb(slot->skb); +- if (++ring->read_idx == ring->length) +- ring->read_idx = 0; +- } ++ if (enet->irq_tx < 0 && ++ !(le32_to_cpu(ring->buf_desc[ring->read_idx].ctl) & DMA_CTL_STATUS_OWN)) ++ napi_schedule(&enet->tx_ring.napi); + + /* Don't use the last empty buf descriptor */ + if (ring->read_idx <= ring->write_idx) + free_buf_descs = ring->read_idx - ring->write_idx + ring->length; + else + free_buf_descs = ring->read_idx - ring->write_idx; +- if (free_buf_descs < 2) ++ if (free_buf_descs < 2) { ++ netif_stop_queue(netdev); + return NETDEV_TX_BUSY; ++ } + + /* Hardware removes OWN bit after sending data */ + buf_desc = &ring->buf_desc[ring->write_idx]; +@@ -539,9 +566,10 @@ static int bcm4908_enet_start_xmit(struc + return NETDEV_TX_OK; + } + +-static int bcm4908_enet_poll(struct napi_struct *napi, int weight) ++static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight) + { +- struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi); ++ struct bcm4908_enet_dma_ring *rx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi); ++ struct bcm4908_enet *enet = container_of(rx_ring, struct bcm4908_enet, rx_ring); + struct device *dev = enet->dev; + int handled = 0; + +@@ -590,7 +618,7 @@ static int bcm4908_enet_poll(struct napi + + if (handled < weight) { + napi_complete_done(napi, handled); +- bcm4908_enet_intrs_on(enet); ++ bcm4908_enet_dma_ring_intrs_on(enet, rx_ring); + } + + /* Hardware could disable ring if it run out of descriptors */ +@@ -599,6 +627,42 @@ static int bcm4908_enet_poll(struct napi + return handled; + } + ++static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight) ++{ ++ struct bcm4908_enet_dma_ring *tx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi); ++ struct bcm4908_enet *enet = container_of(tx_ring, struct bcm4908_enet, tx_ring); ++ struct bcm4908_enet_dma_ring_bd *buf_desc; ++ struct bcm4908_enet_dma_ring_slot *slot; ++ struct device *dev = enet->dev; ++ unsigned int bytes = 0; ++ int handled = 0; ++ ++ while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) { ++ buf_desc = &tx_ring->buf_desc[tx_ring->read_idx]; ++ if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN) ++ break; ++ slot = &tx_ring->slots[tx_ring->read_idx]; ++ ++ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); ++ dev_kfree_skb(slot->skb); ++ bytes += slot->len; ++ if (++tx_ring->read_idx == tx_ring->length) ++ tx_ring->read_idx = 0; ++ ++ handled++; ++ } ++ ++ if (handled < weight) { ++ napi_complete_done(napi, handled); ++ bcm4908_enet_dma_ring_intrs_on(enet, tx_ring); ++ } ++ ++ if (netif_queue_stopped(enet->netdev)) ++ netif_wake_queue(enet->netdev); ++ ++ return handled; ++} ++ + static int bcm4908_enet_change_mtu(struct net_device *netdev, int new_mtu) + { + struct bcm4908_enet *enet = netdev_priv(netdev); +@@ -642,6 +706,8 @@ static int bcm4908_enet_probe(struct pla + if (netdev->irq < 0) + return netdev->irq; + ++ enet->irq_tx = platform_get_irq_byname(pdev, "tx"); ++ + dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); + + err = bcm4908_enet_dma_alloc(enet); +@@ -658,7 +724,8 @@ static int bcm4908_enet_probe(struct pla + netdev->min_mtu = ETH_ZLEN; + netdev->mtu = ETH_DATA_LEN; + netdev->max_mtu = ENET_MTU_MAX; +- netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64); ++ netif_tx_napi_add(netdev, &enet->tx_ring.napi, bcm4908_enet_poll_tx, NAPI_POLL_WEIGHT); ++ netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT); + + err = register_netdev(netdev); + if (err) { +@@ -676,7 +743,8 @@ static int bcm4908_enet_remove(struct pl + struct bcm4908_enet *enet = platform_get_drvdata(pdev); + + unregister_netdev(enet->netdev); +- netif_napi_del(&enet->napi); ++ netif_napi_del(&enet->rx_ring.napi); ++ netif_napi_del(&enet->tx_ring.napi); + bcm4908_enet_dma_free(enet); + + return 0; From 15d142262ac6e725d20c2125617b7df2c0f45194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Mar 2021 07:40:49 +0100 Subject: [PATCH 12/19] bcm4908: backport recent bcm_sf2 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One 5.12 link fix and 5.13 crossbar support. Signed-off-by: Rafał Miłecki (cherry picked from commit e1b4fd52a8efe1dfcad4f4fbe59f1c35a09be0bd) --- ...support-BCM4908-s-integrated-switch.patch} | 0 ...-use-2-Gbps-IMP-port-link-on-BCM4908.patch | 33 ++++ ...store-PHY-interface-mode-in-port-str.patch | 72 +++++++++ ..._sf2-setup-BCM4908-internal-crossbar.patch | 152 ++++++++++++++++++ ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...quick-fix-for-RGMII-reg-access-on-BC.patch | 12 +- 7 files changed, 265 insertions(+), 8 deletions(-) rename target/linux/bcm4908/patches-5.4/{071-v5.12-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch => 071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch} (100%) create mode 100644 target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch create mode 100644 target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch create mode 100644 target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch similarity index 100% rename from target/linux/bcm4908/patches-5.4/071-v5.12-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch rename to target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch new file mode 100644 index 0000000000..2ab34c1261 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch @@ -0,0 +1,33 @@ +From 8373a0fe9c7160a55482effa8a3f725efd3f8434 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 10 Mar 2021 13:51:59 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: use 2 Gbps IMP port link on BCM4908 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 uses 2 Gbps link between switch and the Ethernet interface. +Without this BCM4908 devices were able to achieve only 2 x ~895 Mb/s. +This allows handling e.g. NAT traffic with 940 Mb/s. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -70,7 +70,10 @@ static void bcm_sf2_imp_setup(struct dsa + /* Force link status for IMP port */ + reg = core_readl(priv, offset); + reg |= (MII_SW_OR | LINK_STS); +- reg &= ~GMII_SPEED_UP_2G; ++ if (priv->type == BCM4908_DEVICE_ID) ++ reg |= GMII_SPEED_UP_2G; ++ else ++ reg &= ~GMII_SPEED_UP_2G; + core_writel(priv, reg, offset); + + /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch new file mode 100644 index 0000000000..e9a0b2c79d --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch @@ -0,0 +1,72 @@ +From 01488a0ccd9abe15565bed50a45afcddbb0fe199 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 11:41:07 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: store PHY interface/mode in port structure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's needed later for proper switch / crossbar setup. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 16 ++++++++++++---- + drivers/net/dsa/bcm_sf2.h | 1 + + 2 files changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -385,8 +385,9 @@ static void bcm_sf2_intr_disable(struct + static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, + struct device_node *dn) + { ++ struct device *dev = priv->dev->ds->dev; ++ struct bcm_sf2_port_status *port_st; + struct device_node *port; +- int mode; + unsigned int port_num; + + priv->moca_port = -1; +@@ -395,19 +396,26 @@ static void bcm_sf2_identify_ports(struc + if (of_property_read_u32(port, "reg", &port_num)) + continue; + ++ if (port_num >= DSA_MAX_PORTS) { ++ dev_err(dev, "Invalid port number %d\n", port_num); ++ continue; ++ } ++ ++ port_st = &priv->port_sts[port_num]; ++ + /* Internal PHYs get assigned a specific 'phy-mode' property + * value: "internal" to help flag them before MDIO probing + * has completed, since they might be turned off at that + * time + */ +- mode = of_get_phy_mode(port); +- if (mode < 0) ++ port_st->mode = of_get_phy_mode(port); ++ if (port_st->mode < 0) + continue; + +- if (mode == PHY_INTERFACE_MODE_INTERNAL) ++ if (port_st->mode == PHY_INTERFACE_MODE_INTERNAL) + priv->int_phy_mask |= 1 << port_num; + +- if (mode == PHY_INTERFACE_MODE_MOCA) ++ if (port_st->mode == PHY_INTERFACE_MODE_MOCA) + priv->moca_port = port_num; + + if (of_property_read_bool(port, "brcm,use-bcm-hdr")) +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -43,6 +43,7 @@ struct bcm_sf2_hw_params { + #define BCM_SF2_REGS_NUM 6 + + struct bcm_sf2_port_status { ++ int mode; + unsigned int link; + }; + diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch new file mode 100644 index 0000000000..cd49ec1ab8 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch @@ -0,0 +1,152 @@ +From a9349f08ec6c1251d41ef167d27a15cc39bc5b97 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 11:41:08 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: setup BCM4908 internal crossbar +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On some SoCs (e.g. BCM4908, BCM631[345]8) SF2 has an integrated +crossbar. It allows connecting its selected external ports to internal +ports. It's used by vendors to handle custom Ethernet setups. + +BCM4908 has following 3x2 crossbar. On Asus GT-AC5300 rgmii is used for +connecting external BCM53134S switch. GPHY4 is usually used for WAN +port. More fancy devices use SerDes for 2.5 Gbps Ethernet. + + ┌──────────┐ +SerDes ─── 0 ─┤ │ + │ 3x2 ├─ 0 ─── switch port 7 + GPHY4 ─── 1 ─┤ │ + │ crossbar ├─ 1 ─── runner (accelerator) + rgmii ─── 2 ─┤ │ + └──────────┘ + +Use setup data based on DT info to configure BCM4908's switch port 7. +Right now only GPHY and rgmii variants are supported. Handling SerDes +can be implemented later. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 45 ++++++++++++++++++++++++++++++++++ + drivers/net/dsa/bcm_sf2.h | 1 + + drivers/net/dsa/bcm_sf2_regs.h | 7 ++++++ + 3 files changed, 53 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -374,6 +374,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 + return 0; + } + ++static void bcm_sf2_crossbar_setup(struct bcm_sf2_priv *priv) ++{ ++ struct device *dev = priv->dev->ds->dev; ++ int shift; ++ u32 mask; ++ u32 reg; ++ int i; ++ ++ mask = BIT(priv->num_crossbar_int_ports) - 1; ++ ++ reg = reg_readl(priv, REG_CROSSBAR); ++ switch (priv->type) { ++ case BCM4908_DEVICE_ID: ++ shift = CROSSBAR_BCM4908_INT_P7 * priv->num_crossbar_int_ports; ++ reg &= ~(mask << shift); ++ if (0) /* FIXME */ ++ reg |= CROSSBAR_BCM4908_EXT_SERDES << shift; ++ else if (priv->int_phy_mask & BIT(7)) ++ reg |= CROSSBAR_BCM4908_EXT_GPHY4 << shift; ++ else if (phy_interface_mode_is_rgmii(priv->port_sts[7].mode)) ++ reg |= CROSSBAR_BCM4908_EXT_RGMII << shift; ++ else if (WARN(1, "Invalid port mode\n")) ++ return; ++ break; ++ default: ++ return; ++ } ++ reg_writel(priv, reg, REG_CROSSBAR); ++ ++ reg = reg_readl(priv, REG_CROSSBAR); ++ for (i = 0; i < priv->num_crossbar_int_ports; i++) { ++ shift = i * priv->num_crossbar_int_ports; ++ ++ dev_dbg(dev, "crossbar int port #%d - ext port #%d\n", i, ++ (reg >> shift) & mask); ++ } ++} ++ + static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) + { + intrl2_0_mask_set(priv, 0xffffffff); +@@ -737,6 +775,8 @@ static int bcm_sf2_sw_resume(struct dsa_ + return ret; + } + ++ bcm_sf2_crossbar_setup(priv); ++ + ret = bcm_sf2_cfp_resume(ds); + if (ret) + return ret; +@@ -999,6 +1039,7 @@ struct bcm_sf2_of_data { + const u16 *reg_offsets; + unsigned int core_reg_align; + unsigned int num_cfp_rules; ++ unsigned int num_crossbar_int_ports; + }; + + static const u16 bcm_sf2_4908_reg_offsets[] = { +@@ -1023,6 +1064,7 @@ static const struct bcm_sf2_of_data bcm_ + .core_reg_align = 0, + .reg_offsets = bcm_sf2_4908_reg_offsets, + .num_cfp_rules = 0, /* FIXME */ ++ .num_crossbar_int_ports = 2, + }; + + /* Register offsets for the SWITCH_REG_* block */ +@@ -1133,6 +1175,7 @@ static int bcm_sf2_sw_probe(struct platf + priv->reg_offsets = data->reg_offsets; + priv->core_reg_align = data->core_reg_align; + priv->num_cfp_rules = data->num_cfp_rules; ++ priv->num_crossbar_int_ports = data->num_crossbar_int_ports; + + /* Auto-detection using standard registers will not work, so + * provide an indication of what kind of device we are for +@@ -1187,6 +1230,8 @@ static int bcm_sf2_sw_probe(struct platf + return ret; + } + ++ bcm_sf2_crossbar_setup(priv); ++ + bcm_sf2_gphy_enable_set(priv->dev->ds, true); + + ret = bcm_sf2_mdio_register(ds); +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -70,6 +70,7 @@ struct bcm_sf2_priv { + const u16 *reg_offsets; + unsigned int core_reg_align; + unsigned int num_cfp_rules; ++ unsigned int num_crossbar_int_ports; + + /* spinlock protecting access to the indirect registers */ + spinlock_t indir_lock; +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -48,6 +48,13 @@ enum bcm_sf2_reg_offs { + #define PHY_PHYAD_SHIFT 8 + #define PHY_PHYAD_MASK 0x1F + ++/* Relative to REG_CROSSBAR */ ++#define CROSSBAR_BCM4908_INT_P7 0 ++#define CROSSBAR_BCM4908_INT_RUNNER 1 ++#define CROSSBAR_BCM4908_EXT_SERDES 0 ++#define CROSSBAR_BCM4908_EXT_GPHY4 1 ++#define CROSSBAR_BCM4908_EXT_RGMII 2 ++ + #define REG_RGMII_CNTRL_P(x) (REG_RGMII_0_CNTRL + (x)) + + /* Relative to REG_RGMII_CNTRL */ diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index 26f6216061..7ba7f73f15 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1234,10 +1234,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1290,10 +1290,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 559430a3a7..da5fec8022 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1248,6 +1248,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1304,6 +1304,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch b/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch index 2d88cf353b..49b1ef68a3 100644 --- a/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch +++ b/target/linux/bcm4908/patches-5.4/702-net-dsa-bcm_sf2-quick-fix-for-RGMII-reg-access-on-BC.patch @@ -16,7 +16,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -543,10 +543,19 @@ static void bcm_sf2_sw_mac_config(struct +@@ -592,10 +592,19 @@ static void bcm_sf2_sw_mac_config(struct struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); u32 id_mode_dis = 0, port_mode; u32 reg, offset; @@ -36,7 +36,7 @@ Signed-off-by: Rafał Miłecki if (priv->type == BCM4908_DEVICE_ID || priv->type == BCM7445_DEVICE_ID) offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); -@@ -574,7 +583,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -623,7 +632,7 @@ static void bcm_sf2_sw_mac_config(struct /* Clear id_mode_dis bit, and the existing port mode, let * RGMII_MODE_EN bet set by mac_link_{up,down} */ @@ -45,7 +45,7 @@ Signed-off-by: Rafał Miłecki reg &= ~ID_MODE_DIS; reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -589,7 +598,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -638,7 +647,7 @@ static void bcm_sf2_sw_mac_config(struct reg |= RX_PAUSE_EN; } @@ -54,7 +54,7 @@ Signed-off-by: Rafał Miłecki force_link: /* Force link settings detected from the PHY */ -@@ -615,6 +624,7 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -664,6 +673,7 @@ static void bcm_sf2_sw_mac_link_set(stru phy_interface_t interface, bool link) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); @@ -62,7 +62,7 @@ Signed-off-by: Rafał Miłecki u32 reg; if (!phy_interface_mode_is_rgmii(interface) && -@@ -622,13 +632,21 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -671,13 +681,21 @@ static void bcm_sf2_sw_mac_link_set(stru interface != PHY_INTERFACE_MODE_REVMII) return; @@ -86,7 +86,7 @@ Signed-off-by: Rafał Miłecki } static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, -@@ -999,9 +1017,7 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1051,9 +1069,7 @@ static const u16 bcm_sf2_4908_reg_offset [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, From 7d03fdb004e70ed80b3b7484870454d165aacec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 25 Feb 2021 19:34:21 +0100 Subject: [PATCH 13/19] bcm53xx: group dts backports by upstream kernel version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's a simple renaming thing. Signed-off-by: Rafał Miłecki (cherry picked from commit d0ee398c36983ccb2ee514e71f10d3c274546f17) --- ...5.10-0001-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch} | 0 ...10-0002-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch} | 0 ...10-0003-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch} | 0 ...3-v5.10-0004-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch} | 7 ++++++- 4 files changed, 6 insertions(+), 1 deletion(-) rename target/linux/bcm53xx/patches-5.4/{033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch => 033-v5.10-0001-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch} (100%) rename target/linux/bcm53xx/patches-5.4/{034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch => 033-v5.10-0002-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch} (100%) rename target/linux/bcm53xx/patches-5.4/{035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch => 033-v5.10-0003-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch} (100%) rename target/linux/bcm53xx/patches-5.4/{330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch => 033-v5.10-0004-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch} (95%) diff --git a/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-0001-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch rename to target/linux/bcm53xx/patches-5.4/033-v5.10-0001-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-0002-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch rename to target/linux/bcm53xx/patches-5.4/033-v5.10-0002-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-0003-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch rename to target/linux/bcm53xx/patches-5.4/033-v5.10-0003-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch diff --git a/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-0004-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch similarity index 95% rename from target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch rename to target/linux/bcm53xx/patches-5.4/033-v5.10-0004-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch index 29329eb3f0..e96815ba38 100644 --- a/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch +++ b/target/linux/bcm53xx/patches-5.4/033-v5.10-0004-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch @@ -48,10 +48,15 @@ Odd stuff: Signed-off-by: Christian Lamparter Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 197 +++++++++++++++++++++ + 2 files changed, 198 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm53016-meraki-mr32.dts --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -119,6 +119,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ +@@ -118,6 +118,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ bcm47094-luxul-xwr-3150-v1.dtb \ bcm47094-netgear-r8500.dtb \ bcm47094-phicomm-k3.dtb \ From d523f61135ea359b9ac17e4086498850df4c2f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 25 Feb 2021 20:45:02 +0100 Subject: [PATCH 14/19] bcm53xx: backport more upstream dts stuff from kernel 5.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 8078d89a5357d13dc3f2e2055fd9d663c4f1bd04) --- ...1X-Harmonize-EHCI-OHCI-DT-nodes-name.patch | 60 ++++++ ...CM5310X-Harmonize-xHCI-DT-nodes-name.patch | 29 +++ ...-Disable-USB-3-PHY-on-devices-withou.patch | 94 +++++++++ ...X-Enable-USB-3-PHY-on-Luxul-XWR-3150.patch | 30 +++ ...01X-Update-Ethernet-switch-node-name.patch | 32 ++++ ...-Add-a-default-compatible-for-switch.patch | 82 ++++++++ ...-Provide-defaults-ports-container-no.patch | 180 ++++++++++++++++++ 7 files changed, 507 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0002-ARM-dts-BCM5301X-Harmonize-EHCI-OHCI-DT-nodes-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0003-ARM-dts-BCM5310X-Harmonize-xHCI-DT-nodes-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0008-ARM-dts-BCM5301X-Disable-USB-3-PHY-on-devices-withou.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0009-ARM-dts-BCM5301X-Enable-USB-3-PHY-on-Luxul-XWR-3150.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0002-ARM-dts-BCM5301X-Harmonize-EHCI-OHCI-DT-nodes-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0002-ARM-dts-BCM5301X-Harmonize-EHCI-OHCI-DT-nodes-name.patch new file mode 100644 index 0000000000..271257c669 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0002-ARM-dts-BCM5301X-Harmonize-EHCI-OHCI-DT-nodes-name.patch @@ -0,0 +1,60 @@ +From 74abbfe99f43eb7466d26d9e48fbeb46b8f3d804 Mon Sep 17 00:00:00 2001 +From: Serge Semin +Date: Tue, 20 Oct 2020 14:59:37 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Harmonize EHCI/OHCI DT nodes name + +In accordance with the Generic EHCI/OHCI bindings the corresponding node +name is suppose to comply with the Generic USB HCD DT schema, which +requires the USB nodes to have the name acceptable by the regexp: +"^usb(@.*)?" . Make sure the "generic-ehci" and "generic-ohci"-compatible +nodes are correctly named. + +Signed-off-by: Serge Semin +Acked-by: Florian Fainelli +Acked-by: Krzysztof Kozlowski +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 4 ++-- + arch/arm/boot/dts/bcm53573.dtsi | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -265,7 +265,7 @@ + + interrupt-parent = <&gic>; + +- ehci: ehci@21000 { ++ ehci: usb@21000 { + #usb-cells = <0>; + + compatible = "generic-ehci"; +@@ -287,7 +287,7 @@ + }; + }; + +- ohci: ohci@22000 { ++ ohci: usb@22000 { + #usb-cells = <0>; + + compatible = "generic-ohci"; +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -135,7 +135,7 @@ + #address-cells = <1>; + #size-cells = <1>; + +- ehci: ehci@4000 { ++ ehci: usb@4000 { + compatible = "generic-ehci"; + reg = <0x4000 0x1000>; + interrupt-parent = <&gic>; +@@ -155,7 +155,7 @@ + }; + }; + +- ohci: ohci@d000 { ++ ohci: usb@d000 { + #usb-cells = <0>; + + compatible = "generic-ohci"; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0003-ARM-dts-BCM5310X-Harmonize-xHCI-DT-nodes-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0003-ARM-dts-BCM5310X-Harmonize-xHCI-DT-nodes-name.patch new file mode 100644 index 0000000000..08380d735c --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0003-ARM-dts-BCM5310X-Harmonize-xHCI-DT-nodes-name.patch @@ -0,0 +1,29 @@ +From 4b650a20bdb5f9558007dd3055a17a1644a91c3e Mon Sep 17 00:00:00 2001 +From: Serge Semin +Date: Tue, 20 Oct 2020 14:59:46 +0300 +Subject: [PATCH] ARM: dts: BCM5310X: Harmonize xHCI DT nodes name + +In accordance with the Generic xHCI bindings the corresponding node +name is suppose to comply with the Generic USB HCD DT schema, which +requires the USB nodes to have the name acceptable by the regexp: +"^usb(@.*)?" . Make sure the "generic-xhci"-compatible nodes are +correctly named. + +Signed-off-by: Serge Semin +Acked-by: Krzysztof Kozlowski +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -318,7 +318,7 @@ + + interrupt-parent = <&gic>; + +- xhci: xhci@23000 { ++ xhci: usb@23000 { + #usb-cells = <0>; + + compatible = "generic-xhci"; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0008-ARM-dts-BCM5301X-Disable-USB-3-PHY-on-devices-withou.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0008-ARM-dts-BCM5301X-Disable-USB-3-PHY-on-devices-withou.patch new file mode 100644 index 0000000000..64415c14db --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0008-ARM-dts-BCM5301X-Disable-USB-3-PHY-on-devices-withou.patch @@ -0,0 +1,94 @@ +From 632ddf978565378e7efb9ea77c0ba239ea66bfdc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Nov 2020 11:09:19 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Disable USB 3 PHY on devices without USB + 3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It seems pointless to have it enabled. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 4 ---- + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 4 ---- + arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 4 ---- + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 4 ---- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 4 ---- + arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts | 4 ---- + 6 files changed, 24 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -57,10 +57,6 @@ + status = "okay"; + }; + +-&usb3_phy { +- status = "okay"; +-}; +- + &srab { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -64,10 +64,6 @@ + status = "okay"; + }; + +-&usb3_phy { +- status = "okay"; +-}; +- + &srab { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -117,7 +117,3 @@ + }; + }; + }; +- +-&usb3_phy { +- status = "okay"; +-}; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -57,10 +57,6 @@ + status = "okay"; + }; + +-&usb3_phy { +- status = "okay"; +-}; +- + &srab { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -105,10 +105,6 @@ + status = "okay"; + }; + +-&usb3_phy { +- status = "okay"; +-}; +- + &srab { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -126,7 +126,3 @@ + &usb2 { + vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; +- +-&usb3_phy { +- status = "okay"; +-}; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0009-ARM-dts-BCM5301X-Enable-USB-3-PHY-on-Luxul-XWR-3150.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0009-ARM-dts-BCM5301X-Enable-USB-3-PHY-on-Luxul-XWR-3150.patch new file mode 100644 index 0000000000..5834e300f5 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0009-ARM-dts-BCM5301X-Enable-USB-3-PHY-on-Luxul-XWR-3150.patch @@ -0,0 +1,30 @@ +From b2ab5e8697ef6591aeeda23be49e096705dbbda3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Nov 2020 10:50:12 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Enable USB 3 PHY on Luxul XWR-3150 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device has a functional USB 3 port so PHY is required. + +Signed-off-by: Rafał Miłecki +Reported-by: kernel test robot +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -71,6 +71,10 @@ + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + ++&usb3_phy { ++ status = "okay"; ++}; ++ + &spi_nor { + status = "okay"; + }; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch new file mode 100644 index 0000000000..9165572b95 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch @@ -0,0 +1,32 @@ +From f527cb6f3345f7faa8e61dd9f3c437437327428c Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 11:41:01 -0800 +Subject: [PATCH] ARM: dts: BCM5301X: Update Ethernet switch node name + +Update the switch unit name from srab to ethernet-switch, allowing us to +fix warnings such as: + + CHECK arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml: +srab@18007000: $nodename:0: 'srab@18007000' does not match +'^(ethernet-)?switch(@.*)?$' + From schema: +Documentation/devicetree/bindings/net/dsa/b53.yaml + +Reviewed-by: Vladimir Oltean +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -482,7 +482,7 @@ + #thermal-sensor-cells = <0>; + }; + +- srab: srab@18007000 { ++ srab: ethernet-switch@18007000 { + compatible = "brcm,bcm5301x-srab"; + reg = <0x18007000 0x1000>; + diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch new file mode 100644 index 0000000000..6c1c39b30b --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch @@ -0,0 +1,82 @@ +From 953efcb0c0234f8c488ebd4090378e949d6ba78b Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 16:42:09 -0800 +Subject: [PATCH] ARM: dts: BCM5301X: Add a default compatible for switch node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Provide a default compatible string which is based on the 53011 SRAB +compatible by default. The 4709 and 47094 default to the 53012 SRAB +compatible. + +This allows us to have sane defaults and silences the following +warnings: + +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dt.yaml: +ethernet-switch@18007000: compatible: 'oneOf' conditional failed, one +must be fixed: + ['brcm,bcm5301x-srab'] is too short + 'brcm,bcm5325' was expected + 'brcm,bcm53115' was expected + 'brcm,bcm53125' was expected + 'brcm,bcm53128' was expected + 'brcm,bcm5365' was expected + 'brcm,bcm5395' was expected + 'brcm,bcm5389' was expected + 'brcm,bcm5397' was expected + 'brcm,bcm5398' was expected + 'brcm,bcm11360-srab' was expected + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm53010-srab', +'brcm,bcm53011-srab', 'brcm,bcm53012-srab', 'brcm,bcm53018-srab', +'brcm,bcm53019-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm11404-srab', +'brcm,bcm11407-srab', 'brcm,bcm11409-srab', 'brcm,bcm58310-srab', +'brcm,bcm58311-srab', 'brcm,bcm58313-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm58522-srab', +'brcm,bcm58523-srab', 'brcm,bcm58525-srab', 'brcm,bcm58622-srab', +'brcm,bcm58623-srab', 'brcm,bcm58625-srab', 'brcm,bcm88312-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm3384-switch', +'brcm,bcm6328-switch', 'brcm,bcm6368-switch'] + From schema: +Documentation/devicetree/bindings/net/dsa/b53.yaml + +Acked-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4709.dtsi | 4 ++++ + arch/arm/boot/dts/bcm47094.dtsi | 4 ++++ + arch/arm/boot/dts/bcm5301x.dtsi | 2 +- + 3 files changed, 9 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm4709.dtsi ++++ b/arch/arm/boot/dts/bcm4709.dtsi +@@ -9,3 +9,7 @@ + clock-frequency = <125000000>; + status = "okay"; + }; ++ ++&srab { ++ compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; ++}; +--- a/arch/arm/boot/dts/bcm47094.dtsi ++++ b/arch/arm/boot/dts/bcm47094.dtsi +@@ -16,3 +16,7 @@ + clock-frequency = <125000000>; + status = "okay"; + }; ++ ++&srab { ++ compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; ++}; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -483,7 +483,7 @@ + }; + + srab: ethernet-switch@18007000 { +- compatible = "brcm,bcm5301x-srab"; ++ compatible = "brcm,bcm53011-srab", "brcm,bcm5301x-srab"; + reg = <0x18007000 0x1000>; + + status = "disabled"; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch new file mode 100644 index 0000000000..9cdee333cb --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch @@ -0,0 +1,180 @@ +From fd577b41421bc24e2d04cab96d387301b649eb14 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 17:20:17 -0800 +Subject: [PATCH] ARM: dts: BCM5301X: Provide defaults ports container node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Provide an empty 'ports' container node with the correct #address-cells +and #size-cells properties. This silences the following warning: + +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dt.yaml: +ethernet-switch@18007000: 'oneOf' conditional failed, one must be fixed: + 'ports' is a required property + 'ethernet-ports' is a required property + From schema: +Documentation/devicetree/bindings/net/dsa/b53.yaml + +Acked-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 3 --- + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 3 --- + arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 3 --- + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 3 --- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 3 --- + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 3 --- + arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 3 --- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 3 --- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 3 --- + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 3 --- + arch/arm/boot/dts/bcm5301x.dtsi | 4 ++++ + arch/arm/boot/dts/bcm953012er.dts | 3 --- + 12 files changed, 4 insertions(+), 33 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -61,9 +61,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "poe"; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -68,9 +68,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@4 { + reg = <4>; + label = "lan"; +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -122,9 +122,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan4"; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -61,9 +61,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@4 { + reg = <4>; + label = "poe"; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -109,9 +109,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan4"; +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -219,9 +219,6 @@ + dsa,member = <0 0>; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@1 { + reg = <1>; + label = "lan7"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -59,9 +59,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "poe"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -57,9 +57,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -108,9 +108,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan4"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -83,9 +83,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan4"; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -489,6 +489,10 @@ + status = "disabled"; + + /* ports are defined in board DTS */ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; + }; + + rng: rng@18004000 { +--- a/arch/arm/boot/dts/bcm953012er.dts ++++ b/arch/arm/boot/dts/bcm953012er.dts +@@ -69,9 +69,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "port0"; From 3ce0d62b39ecbf002623b5f72388a9c54daa521e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 10 Mar 2021 23:22:18 +0100 Subject: [PATCH 15/19] bcm53xx: backport NVMEM NVRAM driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It supports NVRAM access described using DT binding. Right now NVRAM data is exposed using /sys/bus/nvmem/ only. Signed-off-by: Rafał Miłecki (cherry picked from commit 01b1b375281b77233d65eb0ebda8e4e3a1bd2407) --- target/linux/bcm53xx/config-5.4 | 1 + ...-bindings-nvmem-add-Broadcom-s-NVRAM.patch | 56 ++++++++ ...-new-driver-exposing-Broadcom-s-NVRA.patch | 124 ++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/080-v5.13-0001-dt-bindings-nvmem-add-Broadcom-s-NVRAM.patch create mode 100644 target/linux/bcm53xx/patches-5.4/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4 index f0c54bbd8e..07a8f85aa0 100644 --- a/target/linux/bcm53xx/config-5.4 +++ b/target/linux/bcm53xx/config-5.4 @@ -271,6 +271,7 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_BRCM_NVRAM=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/bcm53xx/patches-5.4/080-v5.13-0001-dt-bindings-nvmem-add-Broadcom-s-NVRAM.patch b/target/linux/bcm53xx/patches-5.4/080-v5.13-0001-dt-bindings-nvmem-add-Broadcom-s-NVRAM.patch new file mode 100644 index 0000000000..01e29aaad6 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/080-v5.13-0001-dt-bindings-nvmem-add-Broadcom-s-NVRAM.patch @@ -0,0 +1,56 @@ +From c39edb9f9dcb6c8a0ba0ebf5df9e0ac93ab94b82 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 5 Mar 2021 19:32:35 +0100 +Subject: [PATCH] dt-bindings: nvmem: add Broadcom's NVRAM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Broadcom's NVRAM structure contains device data and can be accessed +using I/O mapping. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + .../devicetree/bindings/nvmem/brcm,nvram.yaml | 34 +++++++++++++++++++ + 1 file changed, 34 insertions(+) + create mode 100644 Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +@@ -0,0 +1,34 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/nvmem/brcm,nvram.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom's NVRAM ++ ++description: | ++ Broadcom's NVRAM is a structure containing device specific environment ++ variables. It is used for storing device configuration, booting parameters ++ and calibration data. ++ ++ NVRAM can be accessed on Broadcom BCM47xx MIPS and Northstar ARM Cortex-A9 ++ devices usiong I/O mapped memory. ++ ++maintainers: ++ - Rafał Miłecki ++ ++allOf: ++ - $ref: "nvmem.yaml#" ++ ++properties: ++ compatible: ++ const: brcm,nvram ++ ++unevaluatedProperties: false ++ ++examples: ++ - | ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; diff --git a/target/linux/bcm53xx/patches-5.4/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch b/target/linux/bcm53xx/patches-5.4/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch new file mode 100644 index 0000000000..61def7a93d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch @@ -0,0 +1,124 @@ +From b152bbeb0282bfcf6f91d0d5befd7582c1c3fc23 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 5 Mar 2021 19:32:36 +0100 +Subject: [PATCH] nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This driver provides access to Broadcom's NVRAM. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/Kconfig | 9 +++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/brcm_nvram.c | 78 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 89 insertions(+) + create mode 100644 drivers/nvmem/brcm_nvram.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -230,4 +230,13 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + ++ ++config NVMEM_BRCM_NVRAM ++ tristate "Broadcom's NVRAM support" ++ depends on ARCH_BCM_5301X || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support for Broadcom's NVRAM that can be accessed ++ using I/O mapping. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -50,3 +50,5 @@ obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27 + nvmem-sc27xx-efuse-y := sc27xx-efuse.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o ++obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o ++nvmem_brcm_nvram-y := brcm_nvram.o +--- /dev/null ++++ b/drivers/nvmem/brcm_nvram.c +@@ -0,0 +1,78 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2021 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct brcm_nvram { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++static int brcm_nvram_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct brcm_nvram *priv = context; ++ u8 *dst = val; ++ ++ while (bytes--) ++ *dst++ = readb(priv->base + offset++); ++ ++ return 0; ++} ++ ++static int brcm_nvram_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { ++ .name = "brcm-nvram", ++ .reg_read = brcm_nvram_read, ++ }; ++ struct device *dev = &pdev->dev; ++ struct resource *res; ++ struct brcm_nvram *priv; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ priv->dev = dev; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ priv->base = devm_ioremap_resource(dev, res); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ config.dev = dev; ++ config.priv = priv; ++ config.size = resource_size(res); ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++} ++ ++static const struct of_device_id brcm_nvram_of_match_table[] = { ++ { .compatible = "brcm,nvram", }, ++ {}, ++}; ++ ++static struct platform_driver brcm_nvram_driver = { ++ .probe = brcm_nvram_probe, ++ .driver = { ++ .name = "brcm_nvram", ++ .of_match_table = brcm_nvram_of_match_table, ++ }, ++}; ++ ++static int __init brcm_nvram_init(void) ++{ ++ return platform_driver_register(&brcm_nvram_driver); ++} ++ ++subsys_initcall_sync(brcm_nvram_init); ++ ++MODULE_AUTHOR("Rafał Miłecki"); ++MODULE_LICENSE("GPL"); ++MODULE_DEVICE_TABLE(of, brcm_nvram_of_match_table); From 946bfd59a648f0f87f74fe1ae04dc734ef22599b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 12 Mar 2021 18:07:57 +0100 Subject: [PATCH 16/19] kernel: backport Broadcom NVRAM driver cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactoring of bcm47xx_nvram driver. It's used by bcm47xx and bcm53xx. Signed-off-by: Rafał Miłecki (cherry picked from commit 1c48eee5b2bcfaf9815cc9a6f6664392d17164cb) --- ..._nvram-rename-finding-function-and-i.patch | 80 +++++++++++++++++ ..._nvram-add-helper-checking-for-NVRAM.patch | 90 +++++++++++++++++++ ...7xx_nvram-extract-code-copying-NVRAM.patch | 80 +++++++++++++++++ ..._nvram-look-for-NVRAM-with-for-inste.patch | 37 ++++++++ ..._nvram-inline-code-checking-NVRAM-si.patch | 70 +++++++++++++++ 5 files changed, 357 insertions(+) create mode 100644 target/linux/generic/backport-5.4/831-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch create mode 100644 target/linux/generic/backport-5.4/831-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch create mode 100644 target/linux/generic/backport-5.4/831-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch create mode 100644 target/linux/generic/backport-5.4/831-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch create mode 100644 target/linux/generic/backport-5.4/831-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch diff --git a/target/linux/generic/backport-5.4/831-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch b/target/linux/generic/backport-5.4/831-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch new file mode 100644 index 0000000000..19938704b7 --- /dev/null +++ b/target/linux/generic/backport-5.4/831-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch @@ -0,0 +1,80 @@ +From fb009cbdd0693bd633f11e99526617b3d392cfad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Mar 2021 10:03:16 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: rename finding function and its + variables +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Use "bcm47xx_" function name prefix for consistency +2. It takes flash start as argument so s/iobase/flash_start/ +3. "off" was used for finding flash end so just call it "flash_size" + +Signed-off-by: Rafał Miłecki +Signed-off-by: Thomas Bogendoerfer +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 24 ++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -48,11 +48,13 @@ static u32 find_nvram_size(void __iomem + return 0; + } + +-/* Probe for NVRAM header */ +-static int nvram_find_and_copy(void __iomem *iobase, u32 lim) ++/** ++ * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it ++ */ ++static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size) + { + struct nvram_header __iomem *header; +- u32 off; ++ size_t flash_size; + u32 size; + + if (nvram_len) { +@@ -61,25 +63,25 @@ static int nvram_find_and_copy(void __io + } + + /* TODO: when nvram is on nand flash check for bad blocks first. */ +- off = FLASH_MIN; +- while (off <= lim) { ++ flash_size = FLASH_MIN; ++ while (flash_size <= res_size) { + /* Windowed flash access */ +- size = find_nvram_size(iobase + off); ++ size = find_nvram_size(flash_start + flash_size); + if (size) { +- header = (struct nvram_header *)(iobase + off - size); ++ header = (struct nvram_header *)(flash_start + flash_size - size); + goto found; + } +- off <<= 1; ++ flash_size <<= 1; + } + + /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ +- header = (struct nvram_header *)(iobase + 4096); ++ header = (struct nvram_header *)(flash_start + 4096); + if (header->magic == NVRAM_MAGIC) { + size = NVRAM_SPACE; + goto found; + } + +- header = (struct nvram_header *)(iobase + 1024); ++ header = (struct nvram_header *)(flash_start + 1024); + if (header->magic == NVRAM_MAGIC) { + size = NVRAM_SPACE; + goto found; +@@ -124,7 +126,7 @@ int bcm47xx_nvram_init_from_mem(u32 base + if (!iobase) + return -ENOMEM; + +- err = nvram_find_and_copy(iobase, lim); ++ err = bcm47xx_nvram_find_and_copy(iobase, lim); + + iounmap(iobase); + diff --git a/target/linux/generic/backport-5.4/831-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch b/target/linux/generic/backport-5.4/831-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch new file mode 100644 index 0000000000..6ab072883d --- /dev/null +++ b/target/linux/generic/backport-5.4/831-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch @@ -0,0 +1,90 @@ +From 0a24b51a3264a3f942a75025ea5ff6133c8989b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Mar 2021 10:03:17 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: add helper checking for NVRAM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This avoids duplicating code doing casting and checking for NVRAM magic. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Thomas Bogendoerfer +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 30 ++++++++++++++--------- + 1 file changed, 18 insertions(+), 12 deletions(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -34,14 +34,20 @@ static char nvram_buf[NVRAM_SPACE]; + static size_t nvram_len; + static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; + ++/** ++ * bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory ++ */ ++static bool bcm47xx_nvram_is_valid(void __iomem *nvram) ++{ ++ return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC; ++} ++ + static u32 find_nvram_size(void __iomem *end) + { +- struct nvram_header __iomem *header; + int i; + + for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { +- header = (struct nvram_header *)(end - nvram_sizes[i]); +- if (header->magic == NVRAM_MAGIC) ++ if (bcm47xx_nvram_is_valid(end - nvram_sizes[i])) + return nvram_sizes[i]; + } + +@@ -55,6 +61,7 @@ static int bcm47xx_nvram_find_and_copy(v + { + struct nvram_header __iomem *header; + size_t flash_size; ++ size_t offset; + u32 size; + + if (nvram_len) { +@@ -68,31 +75,30 @@ static int bcm47xx_nvram_find_and_copy(v + /* Windowed flash access */ + size = find_nvram_size(flash_start + flash_size); + if (size) { +- header = (struct nvram_header *)(flash_start + flash_size - size); ++ offset = flash_size - size; + goto found; + } + flash_size <<= 1; + } + + /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ +- header = (struct nvram_header *)(flash_start + 4096); +- if (header->magic == NVRAM_MAGIC) { +- size = NVRAM_SPACE; ++ ++ offset = 4096; ++ if (bcm47xx_nvram_is_valid(flash_start + offset)) + goto found; +- } + +- header = (struct nvram_header *)(flash_start + 1024); +- if (header->magic == NVRAM_MAGIC) { +- size = NVRAM_SPACE; ++ offset = 1024; ++ if (bcm47xx_nvram_is_valid(flash_start + offset)) + goto found; +- } + + pr_err("no nvram found\n"); + return -ENXIO; + + found: ++ header = (struct nvram_header *)(flash_start + offset); + __ioread32_copy(nvram_buf, header, sizeof(*header) / 4); + nvram_len = ((struct nvram_header *)(nvram_buf))->len; ++ size = res_size - offset; + if (nvram_len > size) { + pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); + nvram_len = size; diff --git a/target/linux/generic/backport-5.4/831-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch b/target/linux/generic/backport-5.4/831-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch new file mode 100644 index 0000000000..a1351f1197 --- /dev/null +++ b/target/linux/generic/backport-5.4/831-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch @@ -0,0 +1,80 @@ +From 298923cf999cecd2ef06df126f85a3d68da8c4d8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Mar 2021 10:03:18 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: extract code copying NVRAM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This simplifies function finding NVRAM. It doesn't directly deal with +NVRAM structure anymore and is a bit smaller. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Thomas Bogendoerfer +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 43 +++++++++++++---------- + 1 file changed, 25 insertions(+), 18 deletions(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -55,11 +55,34 @@ static u32 find_nvram_size(void __iomem + } + + /** ++ * bcm47xx_nvram_copy - copy NVRAM to internal buffer ++ */ ++static void bcm47xx_nvram_copy(void __iomem *nvram_start, size_t res_size) ++{ ++ struct nvram_header __iomem *header = nvram_start; ++ size_t copy_size; ++ ++ copy_size = header->len; ++ if (copy_size > res_size) { ++ pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); ++ copy_size = res_size; ++ } ++ if (copy_size >= NVRAM_SPACE) { ++ pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", ++ copy_size, NVRAM_SPACE - 1); ++ copy_size = NVRAM_SPACE - 1; ++ } ++ ++ __ioread32_copy(nvram_buf, nvram_start, DIV_ROUND_UP(copy_size, 4)); ++ nvram_buf[NVRAM_SPACE - 1] = '\0'; ++ nvram_len = copy_size; ++} ++ ++/** + * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it + */ + static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size) + { +- struct nvram_header __iomem *header; + size_t flash_size; + size_t offset; + u32 size; +@@ -95,23 +118,7 @@ static int bcm47xx_nvram_find_and_copy(v + return -ENXIO; + + found: +- header = (struct nvram_header *)(flash_start + offset); +- __ioread32_copy(nvram_buf, header, sizeof(*header) / 4); +- nvram_len = ((struct nvram_header *)(nvram_buf))->len; +- size = res_size - offset; +- if (nvram_len > size) { +- pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); +- nvram_len = size; +- } +- if (nvram_len >= NVRAM_SPACE) { +- pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", +- nvram_len, NVRAM_SPACE - 1); +- nvram_len = NVRAM_SPACE - 1; +- } +- /* proceed reading data after header */ +- __ioread32_copy(nvram_buf + sizeof(*header), header + 1, +- DIV_ROUND_UP(nvram_len, 4)); +- nvram_buf[NVRAM_SPACE - 1] = '\0'; ++ bcm47xx_nvram_copy(flash_start + offset, res_size - offset); + + return 0; + } diff --git a/target/linux/generic/backport-5.4/831-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch b/target/linux/generic/backport-5.4/831-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch new file mode 100644 index 0000000000..059a13220b --- /dev/null +++ b/target/linux/generic/backport-5.4/831-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch @@ -0,0 +1,37 @@ +From 98b68324f67236e8c9152976535dc1f27fb67ba8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Mar 2021 10:03:19 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: look for NVRAM with for instead of + while +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This loop requires variable initialization, stop condition and post +iteration increment. It's pretty much a for loop definition. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Thomas Bogendoerfer +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(v + } + + /* TODO: when nvram is on nand flash check for bad blocks first. */ +- flash_size = FLASH_MIN; +- while (flash_size <= res_size) { ++ for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) { + /* Windowed flash access */ + size = find_nvram_size(flash_start + flash_size); + if (size) { + offset = flash_size - size; + goto found; + } +- flash_size <<= 1; + } + + /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ diff --git a/target/linux/generic/backport-5.4/831-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch b/target/linux/generic/backport-5.4/831-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch new file mode 100644 index 0000000000..21d250049e --- /dev/null +++ b/target/linux/generic/backport-5.4/831-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch @@ -0,0 +1,70 @@ +From f52da4ccfec9192e17f5c16260dfdd6d3ea76f65 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Mar 2021 10:03:20 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: inline code checking NVRAM size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Separated function was not improving code quality much (or at all). +Moreover it expected possible flash end address as argument and it was +returning NVRAM size. + +The new code always operates on offsets which means less logic and less +calculations. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Thomas Bogendoerfer +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 25 +++++++---------------- + 1 file changed, 7 insertions(+), 18 deletions(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -42,18 +42,6 @@ static bool bcm47xx_nvram_is_valid(void + return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC; + } + +-static u32 find_nvram_size(void __iomem *end) +-{ +- int i; +- +- for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { +- if (bcm47xx_nvram_is_valid(end - nvram_sizes[i])) +- return nvram_sizes[i]; +- } +- +- return 0; +-} +- + /** + * bcm47xx_nvram_copy - copy NVRAM to internal buffer + */ +@@ -85,7 +73,7 @@ static int bcm47xx_nvram_find_and_copy(v + { + size_t flash_size; + size_t offset; +- u32 size; ++ int i; + + if (nvram_len) { + pr_warn("nvram already initialized\n"); +@@ -93,12 +81,13 @@ static int bcm47xx_nvram_find_and_copy(v + } + + /* TODO: when nvram is on nand flash check for bad blocks first. */ ++ ++ /* Try every possible flash size and check for NVRAM at its end */ + for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) { +- /* Windowed flash access */ +- size = find_nvram_size(flash_start + flash_size); +- if (size) { +- offset = flash_size - size; +- goto found; ++ for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { ++ offset = flash_size - nvram_sizes[i]; ++ if (bcm47xx_nvram_is_valid(flash_start + offset)) ++ goto found; + } + } + From 20fe0e66f3c243b9c196b6811d7abc47fa2b92db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 12 Mar 2021 18:10:09 +0100 Subject: [PATCH 17/19] bcm53xx: initialize NVRAM from NVMEM driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NVRAM access may be needed early in boot process. Reading it using mtd happens quite late in the init process. Add NVRAM initialization to the NVMEM driver which comes up early and depends on IO mapping only. This is required by Linksys devices which use NVRAM content for proper partitioning (detecting current firmware partition). Signed-off-by: Rafał Miłecki (cherry picked from commit baf04eed028a838518c65be48cbaabe0892343aa) --- ...xx_nvram-support-init-from-IO-memory.patch | 61 +++++++++++++++++++ ...-provide-NVMEM-content-to-the-NVRAM-.patch | 31 ++++++++++ 2 files changed, 92 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/800-0001-firmware-bcm47xx_nvram-support-init-from-IO-memory.patch create mode 100644 target/linux/bcm53xx/patches-5.4/800-0002-nvmem-brcm_nvram-provide-NVMEM-content-to-the-NVRAM-.patch diff --git a/target/linux/bcm53xx/patches-5.4/800-0001-firmware-bcm47xx_nvram-support-init-from-IO-memory.patch b/target/linux/bcm53xx/patches-5.4/800-0001-firmware-bcm47xx_nvram-support-init-from-IO-memory.patch new file mode 100644 index 0000000000..86792d6ebf --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/800-0001-firmware-bcm47xx_nvram-support-init-from-IO-memory.patch @@ -0,0 +1,61 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 11 Mar 2021 08:24:44 +0100 +Subject: [PATCH] firmware: bcm47xx_nvram: support init from IO memory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 17 +++++++++++++++++ + include/linux/bcm47xx_nvram.h | 6 ++++++ + 2 files changed, 23 insertions(+) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -110,6 +110,23 @@ found: + return 0; + } + ++int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size) ++{ ++ if (nvram_len) { ++ pr_warn("nvram already initialized\n"); ++ return -EEXIST; ++ } ++ ++ if (!bcm47xx_nvram_is_valid(nvram_start)) { ++ pr_err("No valid NVRAM found\n"); ++ return -ENOENT; ++ } ++ ++ bcm47xx_nvram_copy(nvram_start, res_size); ++ ++ return 0; ++} ++ + /* + * On bcm47xx we need access to the NVRAM very early, so we can't use mtd + * subsystem to access flash. We can't even use platform device / driver to +--- a/include/linux/bcm47xx_nvram.h ++++ b/include/linux/bcm47xx_nvram.h +@@ -11,6 +11,7 @@ + #include + + #ifdef CONFIG_BCM47XX_NVRAM ++int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size); + int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); + int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); + int bcm47xx_nvram_gpio_pin(const char *name); +@@ -20,6 +21,11 @@ static inline void bcm47xx_nvram_release + vfree(nvram); + }; + #else ++static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, ++ size_t res_size) ++{ ++ return -ENOTSUPP; ++} + static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) + { + return -ENOTSUPP; diff --git a/target/linux/bcm53xx/patches-5.4/800-0002-nvmem-brcm_nvram-provide-NVMEM-content-to-the-NVRAM-.patch b/target/linux/bcm53xx/patches-5.4/800-0002-nvmem-brcm_nvram-provide-NVMEM-content-to-the-NVRAM-.patch new file mode 100644 index 0000000000..cf5952ad5f --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/800-0002-nvmem-brcm_nvram-provide-NVMEM-content-to-the-NVRAM-.patch @@ -0,0 +1,31 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 11 Mar 2021 08:26:14 +0100 +Subject: [PATCH] nvmem: brcm_nvram: provide NVMEM content to the NVRAM driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki +--- + drivers/nvmem/brcm_nvram.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -3,6 +3,7 @@ + * Copyright (C) 2021 Rafał Miłecki + */ + ++#include + #include + #include + #include +@@ -46,6 +47,8 @@ static int brcm_nvram_probe(struct platf + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + ++ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res)); ++ + config.dev = dev; + config.priv = priv; + config.size = resource_size(res); From 761df5c4cff9b0e31d591e544f8f7a6805c49b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 12 Mar 2021 21:08:24 +0100 Subject: [PATCH 18/19] bcm47xx: make WGT634U NVRAM patch apply again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 1c48eee5b2bc ("kernel: backport Broadcom NVRAM driver cleanups") Signed-off-by: Rafał Miłecki (cherry picked from commit 9530b9bb78845910de711d425f1e4b1c7d539b13) --- .../patches-5.4/820-wgt634u-nvram-fix.patch | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch b/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch index 6d58c1b042..5f4af85df2 100644 --- a/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch +++ b/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch @@ -250,28 +250,18 @@ out the configuration than the in kernel cfe config reader. +static int cfe_env; +extern char *cfe_env_get(char *nv_buf, const char *name); - static u32 find_nvram_size(void __iomem *end) - { -@@ -52,7 +54,9 @@ static u32 find_nvram_size(void __iomem - static int nvram_find_and_copy(void __iomem *iobase, u32 lim) - { - struct nvram_header __iomem *header; -+ int i; - u32 off; -+ u32 *src, *dst; - u32 size; - - if (nvram_len) { -@@ -60,6 +64,26 @@ static int nvram_find_and_copy(void __io + /** + * bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory +@@ -80,6 +82,26 @@ static int bcm47xx_nvram_find_and_copy(v return -EEXIST; } + cfe_env = 0; + + /* XXX: hack for supporting the CFE environment stuff on WGT634U */ -+ if (lim >= 8 * 1024 * 1024) { -+ src = (u32 *)(iobase + 8 * 1024 * 1024 - 0x2000); -+ dst = (u32 *)nvram_buf; ++ if (res_size >= 8 * 1024 * 1024) { ++ u32 *src = (u32 *)(flash_start + 8 * 1024 * 1024 - 0x2000); ++ u32 *dst = (u32 *)nvram_buf; + + if ((*src & 0xff00ff) == 0x000001) { + printk("early_nvram_init: WGT634U NVRAM found.\n"); @@ -287,9 +277,9 @@ out the configuration than the in kernel cfe config reader. + } + /* TODO: when nvram is on nand flash check for bad blocks first. */ - off = FLASH_MIN; - while (off <= lim) { -@@ -170,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam + + /* Try every possible flash size and check for NVRAM at its end */ +@@ -172,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam if (!name) return -EINVAL; From 192486ac74e04ad5e485bb543ff7f0a718090b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 14 Mar 2021 19:10:18 +0100 Subject: [PATCH 19/19] bcm53xx: backport first 5.13 DTS changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds NVMEM bindings that are needed for proper booting on Linksys devices. Signed-off-by: Rafał Miłecki (cherry picked from commit 98d456a14e00e24acec36247fb5bd379da90f84e) --- ...1X-fix-reg-formatting-in-memory-node.patch | 339 ++++++++++++++++++ ...-Describe-NVMEM-NVRAM-on-Linksys-Lux.patch | 136 +++++++ ...-BCM5301X-Add-serial-to-the-bootargs.patch | 2 +- 3 files changed, 476 insertions(+), 1 deletion(-) create mode 100644 target/linux/bcm53xx/patches-5.4/035-v5.13-0001-ARM-dts-BCM5301X-fix-reg-formatting-in-memory-node.patch create mode 100644 target/linux/bcm53xx/patches-5.4/035-v5.13-0002-ARM-dts-BCM5301X-Describe-NVMEM-NVRAM-on-Linksys-Lux.patch diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.13-0001-ARM-dts-BCM5301X-fix-reg-formatting-in-memory-node.patch b/target/linux/bcm53xx/patches-5.4/035-v5.13-0001-ARM-dts-BCM5301X-fix-reg-formatting-in-memory-node.patch new file mode 100644 index 0000000000..532c1f72ab --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/035-v5.13-0001-ARM-dts-BCM5301X-fix-reg-formatting-in-memory-node.patch @@ -0,0 +1,339 @@ +From d0b16b9596468c29742049e26a866f559ec476bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 9 Mar 2021 13:55:00 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: fix "reg" formatting in /memory node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes warnings/errors like: +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml: /: memory@0:reg:0: [0, 134217728, 2281701376, 402653184] is too long + From schema: /lib/python3.6/site-packages/dtschema/schemas/reg.yaml + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-linksys-ea9200.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-netgear-r7000.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-netgear-r8500.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-phicomm-k3.dts | 4 ++-- + 23 files changed, 46 insertions(+), 46 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + spi { +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -22,8 +22,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts ++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + spi { +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + spi { +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -21,8 +21,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts ++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +@@ -21,8 +21,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -18,8 +18,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + gpio-keys { +--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +@@ -21,8 +21,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -32,8 +32,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -21,8 +21,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + nand: nand@18028000 { +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + gpio-keys { +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -18,8 +18,8 @@ + + memory { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x08000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts ++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +@@ -18,8 +18,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + leds { +--- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts ++++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +@@ -15,8 +15,8 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x00000000 0x08000000 +- 0x88000000 0x18000000>; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; + }; + + gpio-keys { diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.13-0002-ARM-dts-BCM5301X-Describe-NVMEM-NVRAM-on-Linksys-Lux.patch b/target/linux/bcm53xx/patches-5.4/035-v5.13-0002-ARM-dts-BCM5301X-Describe-NVMEM-NVRAM-on-Linksys-Lux.patch new file mode 100644 index 0000000000..136d221a97 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/035-v5.13-0002-ARM-dts-BCM5301X-Describe-NVMEM-NVRAM-on-Linksys-Lux.patch @@ -0,0 +1,136 @@ +From 428ac8df021dd1cbcc693eb76636873d42327e5d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 10 Mar 2021 22:04:46 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Describe NVMEM NVRAM on Linksys & Luxul + routers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Provide access to NVRAM which contains device environment variables. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts | 5 +++++ + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 5 +++++ + arch/arm/boot/dts/bcm4709-linksys-ea9200.dts | 5 +++++ + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 5 +++++ + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 5 +++++ + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 5 +++++ + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 5 +++++ + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 5 +++++ + 8 files changed, 40 insertions(+) + +--- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts ++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts +@@ -21,6 +21,11 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1c080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1c080000 0x180000>; ++ }; ++ + gpio-keys { + compatible = "gpio-keys"; + +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -21,6 +21,11 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; ++ + leds { + compatible = "gpio-leds"; + +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x08000000>; + }; + ++ nvram@1c080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1c080000 0x180000>; ++ }; ++ + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x08000000>; + }; + ++ nvram@1c080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1c080000 0x100000>; ++ }; ++ + gpio-keys { + compatible = "gpio-keys"; + +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x18000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; ++ + leds { + compatible = "gpio-leds"; + +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x18000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; ++ + leds { + compatible = "gpio-leds"; + +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; ++ + leds { + compatible = "gpio-leds"; + +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -22,6 +22,11 @@ + <0x88000000 0x18000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ }; ++ + leds { + compatible = "gpio-leds"; + diff --git a/target/linux/bcm53xx/patches-5.4/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch b/target/linux/bcm53xx/patches-5.4/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch index cbba087daa..f0d5d0cae4 100644 --- a/target/linux/bcm53xx/patches-5.4/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch +++ b/target/linux/bcm53xx/patches-5.4/320-ARM-dts-BCM5301X-Add-serial-to-the-bootargs.patch @@ -102,7 +102,7 @@ Signed-off-by: Rafał Miłecki + memory@0 { device_type = "memory"; - reg = <0x00000000 0x08000000 + reg = <0x00000000 0x08000000>, --- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts @@ -13,7 +13,7 @@