summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch
diff options
context:
space:
mode:
authorjogo <jogo@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-04-23 13:55:36 +0000
committerjogo <jogo@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-04-23 13:55:36 +0000
commite2428ebd83861f693ac94cbe2662021d4e7f3775 (patch)
tree5ef4da4d4811465ed5574bd3d084fbf7cb928e21 /target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch
parente3dfb1052672f7359784de8d1002a8eafebc2b68 (diff)
bcm63xx: update patches with upstream submissions
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36407 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch')
-rw-r--r--target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch b/target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch
new file mode 100644
index 0000000000..717bcab5c6
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.8/019-bcm63xx_enet-use-managed-io-memory-allocations.patch
@@ -0,0 +1,118 @@
+From 80b0356aea30e9fc9e075d31c2bf37e7cbfea8c9 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sun, 10 Mar 2013 13:59:55 +0100
+Subject: [PATCH 1/3] bcm63xx_enet: use managed io memory allocations
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/net/ethernet/broadcom/bcm63xx_enet.c | 43 +++++---------------------
+ 1 file changed, 7 insertions(+), 36 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+@@ -1620,7 +1620,6 @@ static int bcm_enet_probe(struct platfor
+ struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
+ struct mii_bus *bus;
+ const char *clk_name;
+- unsigned int iomem_size;
+ int i, ret;
+
+ /* stop if shared driver failed, assume driver->probe will be
+@@ -1645,17 +1644,12 @@ static int bcm_enet_probe(struct platfor
+ if (ret)
+ goto out;
+
+- iomem_size = resource_size(res_mem);
+- if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) {
+- ret = -EBUSY;
+- goto out;
+- }
+-
+- priv->base = ioremap(res_mem->start, iomem_size);
++ priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
+ if (priv->base == NULL) {
+ ret = -ENOMEM;
+- goto out_release_mem;
++ goto out;
+ }
++
+ dev->irq = priv->irq = res_irq->start;
+ priv->irq_rx = res_irq_rx->start;
+ priv->irq_tx = res_irq_tx->start;
+@@ -1675,7 +1669,7 @@ static int bcm_enet_probe(struct platfor
+ priv->mac_clk = clk_get(&pdev->dev, clk_name);
+ if (IS_ERR(priv->mac_clk)) {
+ ret = PTR_ERR(priv->mac_clk);
+- goto out_unmap;
++ goto out;
+ }
+ clk_enable(priv->mac_clk);
+
+@@ -1815,12 +1809,6 @@ out_uninit_hw:
+ out_put_clk_mac:
+ clk_disable(priv->mac_clk);
+ clk_put(priv->mac_clk);
+-
+-out_unmap:
+- iounmap(priv->base);
+-
+-out_release_mem:
+- release_mem_region(res_mem->start, iomem_size);
+ out:
+ free_netdev(dev);
+ return ret;
+@@ -1834,7 +1822,6 @@ static int bcm_enet_remove(struct platfo
+ {
+ struct bcm_enet_priv *priv;
+ struct net_device *dev;
+- struct resource *res;
+
+ /* stop netdevice */
+ dev = platform_get_drvdata(pdev);
+@@ -1857,11 +1844,6 @@ static int bcm_enet_remove(struct platfo
+ bcm_enet_mdio_write_mii);
+ }
+
+- /* release device resources */
+- iounmap(priv->base);
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- release_mem_region(res->start, resource_size(res));
+-
+ /* disable hw block clocks */
+ if (priv->phy_clk) {
+ clk_disable(priv->phy_clk);
+@@ -1890,31 +1872,20 @@ struct platform_driver bcm63xx_enet_driv
+ static int bcm_enet_shared_probe(struct platform_device *pdev)
+ {
+ struct resource *res;
+- unsigned int iomem_size;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+
+- iomem_size = resource_size(res);
+- if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma"))
+- return -EBUSY;
+-
+- bcm_enet_shared_base = ioremap(res->start, iomem_size);
+- if (!bcm_enet_shared_base) {
+- release_mem_region(res->start, iomem_size);
++ bcm_enet_shared_base = devm_request_and_ioremap(&pdev->dev, res);
++ if (!bcm_enet_shared_base)
+ return -ENOMEM;
+- }
++
+ return 0;
+ }
+
+ static int bcm_enet_shared_remove(struct platform_device *pdev)
+ {
+- struct resource *res;
+-
+- iounmap(bcm_enet_shared_base);
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- release_mem_region(res->start, resource_size(res));
+ return 0;
+ }
+