diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2017-12-17 14:15:29 +0100 |
---|---|---|
committer | Jonas Gorski <jonas.gorski@gmail.com> | 2018-02-11 23:15:05 +0100 |
commit | a41ad1b6f60bdd95c12fbe8ca2d84692360d73d6 (patch) | |
tree | 89f2e50df8b9a2e61cc9a624230f1142058ac494 /target/linux/brcm63xx | |
parent | 457e7a160a31d6c8c4bfe0c3e309b30e0d3132f3 (diff) | |
download | upstream-a41ad1b6f60bdd95c12fbe8ca2d84692360d73d6.tar.gz upstream-a41ad1b6f60bdd95c12fbe8ca2d84692360d73d6.tar.bz2 upstream-a41ad1b6f60bdd95c12fbe8ca2d84692360d73d6.zip |
brcm63xx: backport latest bcm63xx_enet changes from upstream
No functional changes, just simple cleanups.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx')
11 files changed, 201 insertions, 19 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch new file mode 100644 index 0000000000..32ef2cb195 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch @@ -0,0 +1,39 @@ +From 943b0832e0cf3afe5bd40ffb1885d06106122c5d Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sun, 16 Jul 2017 12:49:49 +0200 +Subject: [PATCH 1/4] bcm63xx_enet: just use "enet" as the clock name + +Now that we have the individual clocks available as "enet" we +don't need to rely on the device id for them anymore. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1733,7 +1733,6 @@ static int bcm_enet_probe(struct platfor + struct bcm63xx_enet_platform_data *pd; + struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx; + struct mii_bus *bus; +- const char *clk_name; + int i, ret; + + if (!bcm_enet_shared_base[0]) +@@ -1774,14 +1773,12 @@ static int bcm_enet_probe(struct platfor + if (priv->mac_id == 0) { + priv->rx_chan = 0; + priv->tx_chan = 1; +- clk_name = "enet0"; + } else { + priv->rx_chan = 2; + priv->tx_chan = 3; +- clk_name = "enet1"; + } + +- priv->mac_clk = devm_clk_get(&pdev->dev, clk_name); ++ priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); + if (IS_ERR(priv->mac_clk)) { + ret = PTR_ERR(priv->mac_clk); + goto out; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch new file mode 100644 index 0000000000..51d1058957 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch @@ -0,0 +1,72 @@ +From b7d1d1f345bb3b25c360c1df812d98866e2ee7fb Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sat, 30 Sep 2017 13:50:03 +0200 +Subject: [PATCH 2/4] bcm63xx_enet: use platform data for dma channel numbers + +To reduce the reliance on device ids, pass the dma channel numbers to +the enet devices as platform data. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + arch/mips/bcm63xx/dev-enet.c | 8 ++++++++ + arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 4 ++++ + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++--------- + 3 files changed, 14 insertions(+), 9 deletions(-) + +--- a/arch/mips/bcm63xx/dev-enet.c ++++ b/arch/mips/bcm63xx/dev-enet.c +@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int uni + dpd->dma_chan_width = ENETDMA_CHAN_WIDTH; + } + ++ if (unit == 0) { ++ dpd->rx_chan = 0; ++ dpd->tx_chan = 1; ++ } else { ++ dpd->rx_chan = 2; ++ dpd->tx_chan = 3; ++ } ++ + ret = platform_device_register(pdev); + if (ret) + return ret; +--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +@@ -54,6 +54,10 @@ struct bcm63xx_enet_platform_data { + + /* DMA descriptor shift */ + unsigned int dma_desc_shift; ++ ++ /* dma channel ids */ ++ int rx_chan; ++ int tx_chan; + }; + + /* +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1769,15 +1769,6 @@ static int bcm_enet_probe(struct platfor + priv->irq_tx = res_irq_tx->start; + priv->mac_id = pdev->id; + +- /* get rx & tx dma channel id for this mac */ +- if (priv->mac_id == 0) { +- priv->rx_chan = 0; +- priv->tx_chan = 1; +- } else { +- priv->rx_chan = 2; +- priv->tx_chan = 3; +- } +- + priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); + if (IS_ERR(priv->mac_clk)) { + ret = PTR_ERR(priv->mac_clk); +@@ -1809,6 +1800,8 @@ static int bcm_enet_probe(struct platfor + priv->dma_chan_width = pd->dma_chan_width; + priv->dma_has_sram = pd->dma_has_sram; + priv->dma_desc_shift = pd->dma_desc_shift; ++ priv->rx_chan = pd->rx_chan; ++ priv->tx_chan = pd->tx_chan; + } + + if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch new file mode 100644 index 0000000000..6e6f320b81 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch @@ -0,0 +1,25 @@ +From 8c61608e5dd2e15575c171ee9cd558ddc3b94962 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sun, 17 Dec 2017 12:54:30 +0100 +Subject: [PATCH 3/4] bcm63xx_enet: remove pointless mac_id check + +Enabling the ephy clock for mac 1 is harmless, and the actual usage of +the ephy is not restricted to mac 0, so we might as well remove the +check. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1804,7 +1804,7 @@ static int bcm_enet_probe(struct platfor + priv->tx_chan = pd->tx_chan; + } + +- if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { ++ if (priv->has_phy && !priv->use_external_mii) { + /* using internal PHY, enable clock */ + priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); + if (IS_ERR(priv->phy_clk)) { diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch new file mode 100644 index 0000000000..2c8206ec9a --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch @@ -0,0 +1,46 @@ +From faea89cd893a1a7af81185f026a64dad603ef72f Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sun, 17 Dec 2017 12:58:12 +0100 +Subject: [PATCH 4/4] bcm63xx_enet: use platform device id directly for miibus + name + +Directly use the platform device for generating the miibus name. This removes +the last user of bcm_enet_priv::mac_id and we can remove the field. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 +-- + drivers/net/ethernet/broadcom/bcm63xx_enet.h | 3 --- + 2 files changed, 1 insertion(+), 5 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1767,7 +1767,6 @@ static int bcm_enet_probe(struct platfor + dev->irq = priv->irq = res_irq->start; + priv->irq_rx = res_irq_rx->start; + priv->irq_tx = res_irq_tx->start; +- priv->mac_id = pdev->id; + + priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); + if (IS_ERR(priv->mac_clk)) { +@@ -1835,7 +1834,7 @@ static int bcm_enet_probe(struct platfor + bus->priv = priv; + bus->read = bcm_enet_mdio_read_phylib; + bus->write = bcm_enet_mdio_write_phylib; +- sprintf(bus->id, "%s-%d", pdev->name, priv->mac_id); ++ sprintf(bus->id, "%s-%d", pdev->name, pdev->id); + + /* only probe bus where we think the PHY is, because + * the mdio read operation return 0 instead of 0xffff +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h +@@ -192,9 +192,6 @@ struct bcm_enet_mib_counters { + + struct bcm_enet_priv { + +- /* mac id (from platform device id) */ +- int mac_id; +- + /* base remapped address of device */ + void __iomem *base; + diff --git a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch index 85abad4d30..05922bd58d 100644 --- a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ b/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch @@ -706,7 +706,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> chan_count = 32; else if (BCMCPU_IS_6345()) chan_count = 8; -@@ -276,7 +277,8 @@ bcm63xx_enetsw_register(const struct bcm +@@ -284,7 +285,8 @@ bcm63xx_enetsw_register(const struct bcm { int ret; @@ -716,7 +716,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> return -ENODEV; ret = register_shared(); -@@ -297,6 +299,8 @@ bcm63xx_enetsw_register(const struct bcm +@@ -305,6 +307,8 @@ bcm63xx_enetsw_register(const struct bcm enetsw_pd.num_ports = ENETSW_PORTS_6328; else if (BCMCPU_IS_6362() || BCMCPU_IS_6368()) enetsw_pd.num_ports = ENETSW_PORTS_6368; @@ -727,7 +727,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH; --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -@@ -62,6 +62,7 @@ struct bcm63xx_enet_platform_data { +@@ -66,6 +66,7 @@ struct bcm63xx_enet_platform_data { #define ENETSW_MAX_PORT 8 #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */ #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */ diff --git a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch index 3b5da024b4..277f54dffd 100644 --- a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ b/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch @@ -652,7 +652,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 chan_count = 32; else if (BCMCPU_IS_6345()) chan_count = 8; -@@ -277,8 +277,8 @@ bcm63xx_enetsw_register(const struct bcm +@@ -285,8 +285,8 @@ bcm63xx_enetsw_register(const struct bcm { int ret; @@ -663,7 +663,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 return -ENODEV; ret = register_shared(); -@@ -295,7 +295,7 @@ bcm63xx_enetsw_register(const struct bcm +@@ -303,7 +303,7 @@ bcm63xx_enetsw_register(const struct bcm memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd)); diff --git a/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch b/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch index 7c2b686a98..5b754ad968 100644 --- a/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch +++ b/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch @@ -100,7 +100,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> return 0; } -@@ -1832,6 +1791,8 @@ static int bcm_enet_probe(struct platfor +@@ -1821,6 +1780,8 @@ static int bcm_enet_probe(struct platfor /* MII bus registration */ if (priv->has_phy) { @@ -109,7 +109,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> priv->mii_bus = mdiobus_alloc(); if (!priv->mii_bus) { -@@ -1869,6 +1830,38 @@ static int bcm_enet_probe(struct platfor +@@ -1858,6 +1819,38 @@ static int bcm_enet_probe(struct platfor dev_err(&pdev->dev, "unable to register mdio bus\n"); goto out_free_mdio; } @@ -148,7 +148,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> } else { /* run platform code to initialize PHY device */ -@@ -1914,6 +1907,9 @@ static int bcm_enet_probe(struct platfor +@@ -1903,6 +1896,9 @@ static int bcm_enet_probe(struct platfor return 0; out_unregister_mdio: @@ -158,7 +158,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> if (priv->mii_bus) mdiobus_unregister(priv->mii_bus); -@@ -1951,6 +1947,8 @@ static int bcm_enet_remove(struct platfo +@@ -1940,6 +1936,8 @@ static int bcm_enet_remove(struct platfo enet_writel(priv, 0, ENET_MIISC_REG); if (priv->has_phy) { diff --git a/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch b/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch index cf3715e4fe..49b9c73e85 100644 --- a/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch +++ b/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch @@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports #define ENETSW_MDIOC_EXT_MASK (1 << 16) --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2223,6 +2223,18 @@ static int bcm_enetsw_open(struct net_de +@@ -2212,6 +2212,18 @@ static int bcm_enetsw_open(struct net_de priv->sw_port_link[i] = 0; } diff --git a/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch b/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch index c905cb2d44..499928f701 100644 --- a/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch +++ b/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h -@@ -335,6 +335,9 @@ struct bcm_enet_priv { +@@ -332,6 +332,9 @@ struct bcm_enet_priv { struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT]; int sw_port_link[ENETSW_MAX_PORT]; @@ -20,7 +20,7 @@ #include <bcm63xx_dev_enet.h> #include "bcm63xx_enet.h" -@@ -1968,7 +1969,8 @@ static int bcm_enet_remove(struct platfo +@@ -1957,7 +1958,8 @@ static int bcm_enet_remove(struct platfo return 0; } @@ -30,7 +30,7 @@ .probe = bcm_enet_probe, .remove = bcm_enet_remove, .driver = { -@@ -1977,6 +1979,42 @@ struct platform_driver bcm63xx_enet_driv +@@ -1966,6 +1968,42 @@ struct platform_driver bcm63xx_enet_driv }, }; @@ -73,7 +73,7 @@ /* * switch mii access callbacks */ -@@ -2235,29 +2273,6 @@ static int bcm_enetsw_open(struct net_de +@@ -2224,29 +2262,6 @@ static int bcm_enetsw_open(struct net_de enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); } @@ -103,7 +103,7 @@ /* initialize flow control buffer allocation */ enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0, ENETDMA_BUFALLOC_REG(priv->rx_chan)); -@@ -2716,6 +2731,9 @@ static int bcm_enetsw_probe(struct platf +@@ -2705,6 +2720,9 @@ static int bcm_enetsw_probe(struct platf struct bcm63xx_enetsw_platform_data *pd; struct resource *res_mem; int ret, irq_rx, irq_tx; @@ -113,7 +113,7 @@ if (!bcm_enet_shared_base[0]) return -EPROBE_DEFER; -@@ -2798,6 +2816,43 @@ static int bcm_enetsw_probe(struct platf +@@ -2787,6 +2805,43 @@ static int bcm_enetsw_probe(struct platf priv->pdev = pdev; priv->net_dev = dev; @@ -157,7 +157,7 @@ return 0; out_disable_clk: -@@ -2819,6 +2874,9 @@ static int bcm_enetsw_remove(struct plat +@@ -2808,6 +2863,9 @@ static int bcm_enetsw_remove(struct plat priv = netdev_priv(dev); unregister_netdev(dev); diff --git a/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch b/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch index f1c7589c4f..700fb01148 100644 --- a/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch +++ b/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2775,9 +2775,9 @@ static int bcm_enetsw_probe(struct platf +@@ -2764,9 +2764,9 @@ static int bcm_enetsw_probe(struct platf if (ret) goto out; diff --git a/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch b/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch index a573d2166b..5949f890ea 100644 --- a/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch +++ b/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2270,6 +2270,10 @@ static int bcm_enetsw_open(struct net_de +@@ -2259,6 +2259,10 @@ static int bcm_enetsw_open(struct net_de rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; |