diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2017-10-02 11:41:43 +0200 |
---|---|---|
committer | Jonas Gorski <jonas.gorski@gmail.com> | 2017-12-16 12:57:05 +0100 |
commit | 49c3b1c4555db688c4c514d1284254f954e46180 (patch) | |
tree | 4e8bb279e592509354f071118ebfb24a3690d7bb /target/linux | |
parent | aba4e29eadfb82ef7f52f85cdb4cd10a4abad622 (diff) | |
download | upstream-49c3b1c4555db688c4c514d1284254f954e46180.tar.gz upstream-49c3b1c4555db688c4c514d1284254f954e46180.tar.bz2 upstream-49c3b1c4555db688c4c514d1284254f954e46180.zip |
brcm63xx: backport enet cleanup patches
Align with upstream version, mostly non-fixes and small clean ups.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux')
14 files changed, 415 insertions, 36 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch new file mode 100644 index 0000000000..b85f38b59d --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch @@ -0,0 +1,101 @@ +From d0423d3e4fa7ae305729cb50369427f075ccb279 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sat, 25 Feb 2017 12:41:28 +0100 +Subject: [PATCH 1/6] bcm63xx_enet: correct clock usage + +Check the return code of prepare_enable and change one last instance of +enable only to prepare_enable. Also properly disable and release the +clock in error paths and on remove for enetsw. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1787,7 +1787,9 @@ static int bcm_enet_probe(struct platfor + ret = PTR_ERR(priv->mac_clk); + goto out; + } +- clk_prepare_enable(priv->mac_clk); ++ ret = clk_prepare_enable(priv->mac_clk); ++ if (ret) ++ goto out_put_clk_mac; + + /* initialize default and fetch platform data */ + priv->rx_ring_size = BCMENET_DEF_RX_DESC; +@@ -1819,9 +1821,11 @@ static int bcm_enet_probe(struct platfor + if (IS_ERR(priv->phy_clk)) { + ret = PTR_ERR(priv->phy_clk); + priv->phy_clk = NULL; +- goto out_put_clk_mac; ++ goto out_disable_clk_mac; + } +- clk_prepare_enable(priv->phy_clk); ++ ret = clk_prepare_enable(priv->phy_clk); ++ if (ret) ++ goto out_put_clk_phy; + } + + /* do minimal hardware init to be able to probe mii bus */ +@@ -1921,13 +1925,16 @@ out_free_mdio: + out_uninit_hw: + /* turn off mdc clock */ + enet_writel(priv, 0, ENET_MIISC_REG); +- if (priv->phy_clk) { ++ if (priv->phy_clk) + clk_disable_unprepare(priv->phy_clk); ++ ++out_put_clk_phy: ++ if (priv->phy_clk) + clk_put(priv->phy_clk); +- } + +-out_put_clk_mac: ++out_disable_clk_mac: + clk_disable_unprepare(priv->mac_clk); ++out_put_clk_mac: + clk_put(priv->mac_clk); + out: + free_netdev(dev); +@@ -2772,7 +2779,9 @@ static int bcm_enetsw_probe(struct platf + ret = PTR_ERR(priv->mac_clk); + goto out_unmap; + } +- clk_enable(priv->mac_clk); ++ ret = clk_prepare_enable(priv->mac_clk); ++ if (ret) ++ goto out_put_clk; + + priv->rx_chan = 0; + priv->tx_chan = 1; +@@ -2793,7 +2802,7 @@ static int bcm_enetsw_probe(struct platf + + ret = register_netdev(dev); + if (ret) +- goto out_put_clk; ++ goto out_disable_clk; + + netif_carrier_off(dev); + platform_set_drvdata(pdev, dev); +@@ -2802,6 +2811,9 @@ static int bcm_enetsw_probe(struct platf + + return 0; + ++out_disable_clk: ++ clk_disable_unprepare(priv->mac_clk); ++ + out_put_clk: + clk_put(priv->mac_clk); + +@@ -2833,6 +2845,9 @@ static int bcm_enetsw_remove(struct plat + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + release_mem_region(res->start, resource_size(res)); + ++ clk_disable_unprepare(priv->mac_clk); ++ clk_put(priv->mac_clk); ++ + free_netdev(dev); + return 0; + } diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch new file mode 100644 index 0000000000..22c6d01873 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch @@ -0,0 +1,29 @@ +From 23d94cb855b6f4f0ee1c01679224472104ac6440 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sat, 30 Sep 2017 14:10:18 +0200 +Subject: [PATCH 2/6] bcm63xx_enet: do not write to random DMA channel on + BCM6345 + +The DMA controller regs actually point to DMA channel 0, so the write to +ENETDMA_CFG_REG will actually modify a random DMA channel. + +Since DMA controller registers do not exist on BCM6345, guard the write +with the usual check for dma_has_sram. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1063,7 +1063,8 @@ static int bcm_enet_open(struct net_devi + val = enet_readl(priv, ENET_CTL_REG); + val |= ENET_CTL_ENABLE_MASK; + enet_writel(priv, val, ENET_CTL_REG); +- enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); ++ if (priv->dma_has_sram) ++ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); + enet_dmac_writel(priv, priv->dma_chan_en_mask, + ENETDMAC_CHANCFG, priv->rx_chan); + diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch new file mode 100644 index 0000000000..b14dedcd76 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch @@ -0,0 +1,41 @@ +From 71710bb6cbc82f411a4e5faafa0c3178e48e7137 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Tue, 30 May 2017 13:31:45 +0200 +Subject: [PATCH 3/6] bcm63xx_enet: do not rely on probe order + +Do not rely on the shared device being probed before the enet(sw) +devices. This makes it easier to eventually move out the shared +device as a dma controller driver (what it should be). + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1736,10 +1736,8 @@ static int bcm_enet_probe(struct platfor + const char *clk_name; + int i, ret; + +- /* stop if shared driver failed, assume driver->probe will be +- * called in the same order we register devices (correct ?) */ + if (!bcm_enet_shared_base[0]) +- return -ENODEV; ++ return -EPROBE_DEFER; + + res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1); +@@ -2720,11 +2718,8 @@ static int bcm_enetsw_probe(struct platf + struct resource *res_mem; + int ret, irq_rx, irq_tx; + +- /* stop if shared driver failed, assume driver->probe will be +- * called in the same order we register devices (correct ?) +- */ + if (!bcm_enet_shared_base[0]) +- return -ENODEV; ++ return -EPROBE_DEFER; + + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq_rx = platform_get_irq(pdev, 0); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch new file mode 100644 index 0000000000..ae009064bf --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch @@ -0,0 +1,150 @@ +From 179a445ae4ef36ec44f4aea18e5f42d21334d186 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Sat, 25 Feb 2017 12:39:25 +0100 +Subject: [PATCH 4/6] bcm63xx_enet: use managed functions for clock/ioremap + +Use managed functions where possible to reduce the amount of resource +handling on error and remove paths. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 54 +++++++--------------------- + 1 file changed, 12 insertions(+), 42 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1781,14 +1781,14 @@ static int bcm_enet_probe(struct platfor + clk_name = "enet1"; + } + +- priv->mac_clk = clk_get(&pdev->dev, clk_name); ++ priv->mac_clk = devm_clk_get(&pdev->dev, clk_name); + if (IS_ERR(priv->mac_clk)) { + ret = PTR_ERR(priv->mac_clk); + goto out; + } + ret = clk_prepare_enable(priv->mac_clk); + if (ret) +- goto out_put_clk_mac; ++ goto out; + + /* initialize default and fetch platform data */ + priv->rx_ring_size = BCMENET_DEF_RX_DESC; +@@ -1816,7 +1816,7 @@ static int bcm_enet_probe(struct platfor + + if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { + /* using internal PHY, enable clock */ +- priv->phy_clk = clk_get(&pdev->dev, "ephy"); ++ priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); + if (IS_ERR(priv->phy_clk)) { + ret = PTR_ERR(priv->phy_clk); + priv->phy_clk = NULL; +@@ -1824,7 +1824,7 @@ static int bcm_enet_probe(struct platfor + } + ret = clk_prepare_enable(priv->phy_clk); + if (ret) +- goto out_put_clk_phy; ++ goto out_disable_clk_mac; + } + + /* do minimal hardware init to be able to probe mii bus */ +@@ -1927,14 +1927,8 @@ out_uninit_hw: + if (priv->phy_clk) + clk_disable_unprepare(priv->phy_clk); + +-out_put_clk_phy: +- if (priv->phy_clk) +- clk_put(priv->phy_clk); +- + out_disable_clk_mac: + clk_disable_unprepare(priv->mac_clk); +-out_put_clk_mac: +- clk_put(priv->mac_clk); + out: + free_netdev(dev); + return ret; +@@ -1970,12 +1964,10 @@ static int bcm_enet_remove(struct platfo + } + + /* disable hw block clocks */ +- if (priv->phy_clk) { ++ if (priv->phy_clk) + clk_disable_unprepare(priv->phy_clk); +- clk_put(priv->phy_clk); +- } ++ + clk_disable_unprepare(priv->mac_clk); +- clk_put(priv->mac_clk); + + free_netdev(dev); + return 0; +@@ -2758,26 +2750,20 @@ static int bcm_enetsw_probe(struct platf + if (ret) + goto out; + +- if (!request_mem_region(res_mem->start, resource_size(res_mem), +- "bcm63xx_enetsw")) { +- ret = -EBUSY; ++ priv->base = devm_ioremap_resource(&pdev->dev, res_mem); ++ if (IS_ERR(priv->base)) { ++ ret = PTR_ERR(priv->base); + goto out; + } + +- priv->base = ioremap(res_mem->start, resource_size(res_mem)); +- if (priv->base == NULL) { +- ret = -ENOMEM; +- goto out_release_mem; +- } +- +- priv->mac_clk = clk_get(&pdev->dev, "enetsw"); ++ priv->mac_clk = devm_clk_get(&pdev->dev, "enetsw"); + if (IS_ERR(priv->mac_clk)) { + ret = PTR_ERR(priv->mac_clk); +- goto out_unmap; ++ goto out; + } + ret = clk_prepare_enable(priv->mac_clk); + if (ret) +- goto out_put_clk; ++ goto out; + + priv->rx_chan = 0; + priv->tx_chan = 1; +@@ -2809,15 +2795,6 @@ static int bcm_enetsw_probe(struct platf + + out_disable_clk: + clk_disable_unprepare(priv->mac_clk); +- +-out_put_clk: +- clk_put(priv->mac_clk); +- +-out_unmap: +- iounmap(priv->base); +- +-out_release_mem: +- release_mem_region(res_mem->start, resource_size(res_mem)); + out: + free_netdev(dev); + return ret; +@@ -2829,20 +2806,13 @@ static int bcm_enetsw_remove(struct plat + { + struct bcm_enet_priv *priv; + struct net_device *dev; +- struct resource *res; + + /* stop netdevice */ + dev = platform_get_drvdata(pdev); + priv = netdev_priv(dev); + unregister_netdev(dev); + +- /* release device resources */ +- iounmap(priv->base); +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- release_mem_region(res->start, resource_size(res)); +- + clk_disable_unprepare(priv->mac_clk); +- clk_put(priv->mac_clk); + + free_netdev(dev); + return 0; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch new file mode 100644 index 0000000000..957c0f3725 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch @@ -0,0 +1,36 @@ +From 555baec974ede81e616ca88ac6d3fca09239368f Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Tue, 18 Jul 2017 13:18:01 +0200 +Subject: [PATCH 5/6] bcm63xx_enet: drop unneeded NULL phy_clk check + +clk_disable and clk_unprepare are NULL-safe, so need to duplicate the +NULL check of the functions. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -1924,8 +1924,7 @@ out_free_mdio: + out_uninit_hw: + /* turn off mdc clock */ + enet_writel(priv, 0, ENET_MIISC_REG); +- if (priv->phy_clk) +- clk_disable_unprepare(priv->phy_clk); ++ clk_disable_unprepare(priv->phy_clk); + + out_disable_clk_mac: + clk_disable_unprepare(priv->mac_clk); +@@ -1964,9 +1963,7 @@ static int bcm_enet_remove(struct platfo + } + + /* disable hw block clocks */ +- if (priv->phy_clk) +- clk_disable_unprepare(priv->phy_clk); +- ++ clk_disable_unprepare(priv->phy_clk); + clk_disable_unprepare(priv->mac_clk); + + free_netdev(dev); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch new file mode 100644 index 0000000000..482bd58929 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch @@ -0,0 +1,22 @@ +From 77364ce98037972fb1c57d0ee0418eb1c2b26521 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Mon, 29 May 2017 13:11:14 +0200 +Subject: [PATCH 6/6] bcm63xx_enet: remove unneeded include + +We don't use anyhing from that file, so drop it. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/net/ethernet/broadcom/bcm63xx_enet.h | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h +@@ -8,7 +8,6 @@ + #include <linux/platform_device.h> + + #include <bcm63xx_regs.h> +-#include <bcm63xx_irq.h> + #include <bcm63xx_io.h> + #include <bcm63xx_iudma.h> + diff --git a/target/linux/brcm63xx/patches-4.4/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.4/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch index db3fc5bc3a..ca72bbf495 100644 --- a/target/linux/brcm63xx/patches-4.4/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch +++ b/target/linux/brcm63xx/patches-4.4/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch @@ -18,7 +18,7 @@ Allow using a named optional gpio for ephy reset gpio registration. #include <bcm63xx_dev_enet.h> #include "bcm63xx_enet.h" -@@ -2851,10 +2852,15 @@ static int bcm_enet_shared_probe(struct +@@ -2829,10 +2830,15 @@ static int bcm_enet_shared_probe(struct { struct resource *res; void __iomem *p[3]; @@ -34,7 +34,7 @@ Allow using a named optional gpio for ephy reset gpio registration. for (i = 0; i < 3; i++) { res = platform_get_resource(pdev, IORESOURCE_MEM, i); p[i] = devm_ioremap_resource(&pdev->dev, res); -@@ -2864,6 +2870,9 @@ static int bcm_enet_shared_probe(struct +@@ -2842,6 +2848,9 @@ static int bcm_enet_shared_probe(struct memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base)); diff --git a/target/linux/brcm63xx/patches-4.4/381-net-bcm63xx_enet-fully-reset-ephy.patch b/target/linux/brcm63xx/patches-4.4/381-net-bcm63xx_enet-fully-reset-ephy.patch index dc9e3c1344..c591243799 100644 --- a/target/linux/brcm63xx/patches-4.4/381-net-bcm63xx_enet-fully-reset-ephy.patch +++ b/target/linux/brcm63xx/patches-4.4/381-net-bcm63xx_enet-fully-reset-ephy.patch @@ -8,7 +8,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2857,7 +2857,7 @@ static int bcm_enet_shared_probe(struct +@@ -2835,7 +2835,7 @@ static int bcm_enet_shared_probe(struct memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base)); @@ -17,7 +17,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> if (IS_ERR(ephy_reset)) return PTR_ERR(ephy_reset); -@@ -2871,7 +2871,7 @@ static int bcm_enet_shared_probe(struct +@@ -2849,7 +2849,7 @@ static int bcm_enet_shared_probe(struct memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base)); if (ephy_reset) diff --git a/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch b/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch index 8cb8099e97..fc2e8ab7a7 100644 --- a/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch +++ b/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1632,7 +1632,7 @@ static int compute_hw_mtu(struct bcm_ene +@@ -1633,7 +1633,7 @@ static int compute_hw_mtu(struct bcm_ene actual_mtu = mtu; /* add ethernet header + vlan tag size */ 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 a1acd614af..6bc62a0386 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 @@ -77,7 +77,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0, dev->name, dev); -@@ -1128,9 +1096,6 @@ out_freeirq_rx: +@@ -1129,9 +1097,6 @@ out_freeirq_rx: out_freeirq: free_irq(dev->irq, dev); @@ -87,7 +87,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> return ret; } -@@ -1235,12 +1200,6 @@ static int bcm_enet_stop(struct net_devi +@@ -1236,12 +1201,6 @@ static int bcm_enet_stop(struct net_devi free_irq(priv->irq_rx, dev); free_irq(dev->irq, dev); @@ -100,7 +100,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> return 0; } -@@ -1830,6 +1789,8 @@ static int bcm_enet_probe(struct platfor +@@ -1833,6 +1792,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) { -@@ -1867,6 +1828,38 @@ static int bcm_enet_probe(struct platfor +@@ -1870,6 +1831,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 */ -@@ -1912,6 +1905,9 @@ static int bcm_enet_probe(struct platfor +@@ -1915,6 +1908,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); -@@ -1953,6 +1949,8 @@ static int bcm_enet_remove(struct platfo +@@ -1952,6 +1948,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 1cff9c1ff9..0a97b25bcd 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 -@@ -2229,6 +2229,18 @@ static int bcm_enetsw_open(struct net_de +@@ -2224,6 +2224,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 19d7905114..b498edf028 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 -@@ -336,6 +336,9 @@ struct bcm_enet_priv { +@@ -335,6 +335,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" -@@ -1974,7 +1975,8 @@ static int bcm_enet_remove(struct platfo +@@ -1969,7 +1970,8 @@ static int bcm_enet_remove(struct platfo return 0; } @@ -30,7 +30,7 @@ .probe = bcm_enet_probe, .remove = bcm_enet_remove, .driver = { -@@ -1983,6 +1985,42 @@ struct platform_driver bcm63xx_enet_driv +@@ -1978,6 +1980,42 @@ struct platform_driver bcm63xx_enet_driv }, }; @@ -73,7 +73,7 @@ /* * switch mii access callbacks */ -@@ -2241,29 +2279,6 @@ static int bcm_enetsw_open(struct net_de +@@ -2236,29 +2274,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)); -@@ -2722,6 +2737,9 @@ static int bcm_enetsw_probe(struct platf +@@ -2717,6 +2732,9 @@ static int bcm_enetsw_probe(struct platf struct bcm63xx_enetsw_platform_data *pd; struct resource *res_mem; int ret, irq_rx, irq_tx; @@ -111,9 +111,9 @@ + u16 port_mask = BIT(8); + u8 val; - /* stop if shared driver failed, assume driver->probe will be - * called in the same order we register devices (correct ?) -@@ -2811,6 +2829,43 @@ static int bcm_enetsw_probe(struct platf + if (!bcm_enet_shared_base[0]) + return -EPROBE_DEFER; +@@ -2799,6 +2817,43 @@ static int bcm_enetsw_probe(struct platf priv->pdev = pdev; priv->net_dev = dev; @@ -156,14 +156,14 @@ + return 0; - out_put_clk: -@@ -2839,6 +2894,9 @@ static int bcm_enetsw_remove(struct plat + out_disable_clk: +@@ -2820,6 +2875,9 @@ static int bcm_enetsw_remove(struct plat priv = netdev_priv(dev); unregister_netdev(dev); + /* remove switch */ + bcmenet_switch_unregister(priv); + - /* release device resources */ - iounmap(priv->base); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + clk_disable_unprepare(priv->mac_clk); + + free_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 24dd27a292..5762ae7513 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,15 +1,15 @@ --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2784,12 +2784,6 @@ static int bcm_enetsw_probe(struct platf +@@ -2776,9 +2776,9 @@ static int bcm_enetsw_probe(struct platf if (ret) goto out; -- if (!request_mem_region(res_mem->start, resource_size(res_mem), -- "bcm63xx_enetsw")) { -- ret = -EBUSY; -- goto out; -- } -- - priv->base = ioremap(res_mem->start, resource_size(res_mem)); - if (priv->base == NULL) { - ret = -ENOMEM; +- priv->base = devm_ioremap_resource(&pdev->dev, res_mem); +- if (IS_ERR(priv->base)) { +- ret = PTR_ERR(priv->base); ++ priv->base = devm_ioremap(&pdev->dev, res_mem->start, resource_size(res_mem)); ++ if (priv->base == NULL) { ++ ret = -ENOMEM; + 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 99075c6b9b..0ea35186c3 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 -@@ -2276,6 +2276,10 @@ static int bcm_enetsw_open(struct net_de +@@ -2271,6 +2271,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; |