bcm53xx: update the bcm53xx patches
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-3.10 / 111-bcma-register-bcma-as-device-tree-driver.patch
index 0077f90379c96f00ad9e913f7190e24193cf793a..fe44827082a8f2f0f625a340bb9ebbc7794b696f 100644 (file)
@@ -1,12 +1,16 @@
-bcma: register bcma as device tree driver
+From c046c19fc8f1af7cf253fea5b0253143c159948a Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 6 Jan 2014 23:29:15 +0100
+Subject: [PATCH 6/8] bcma: register bcma as device tree driver
 
 This driver is used by the bcm53xx ARM SoC code.Now it is possible to
 give the address of the chipcommon core in device tree.
 
 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 ---
- drivers/bcma/host_soc.c |   73 +++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 73 insertions(+)
+ drivers/bcma/host_soc.c   |   70 +++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/bcma/bcma.h |    2 ++
+ 2 files changed, 72 insertions(+)
 
 --- a/drivers/bcma/host_soc.c
 +++ b/drivers/bcma/host_soc.c
@@ -20,7 +24,15 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  #include <linux/bcma/bcma.h>
  #include <linux/bcma/bcma_soc.h>
  
-@@ -181,3 +184,73 @@ int __init bcma_host_soc_register(struct
+@@ -173,6 +176,7 @@ int __init bcma_host_soc_register(struct
+       /* Host specific */
+       bus->hosttype = BCMA_HOSTTYPE_SOC;
+       bus->ops = &bcma_host_soc_ops;
++      bus->host_pdev = NULL;
+       /* Register */
+       err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
+@@ -181,3 +185,69 @@ int __init bcma_host_soc_register(struct
  
        return err;
  }
@@ -34,20 +46,19 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      int err;
 +
 +      /* Alloc */
-+      bus = kzalloc(sizeof(*bus), GFP_KERNEL);
++      bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
 +      if (!bus)
 +              return -ENOMEM;
 +
 +      /* Map MMIO */
-+      err = -ENOMEM;
 +      bus->mmio = of_iomap(np, 0);
 +      if (!bus->mmio)
-+              goto err_kfree_bus;
++              return -ENOMEM;
 +
 +      /* Host specific */
 +      bus->hosttype = BCMA_HOSTTYPE_SOC;
 +      bus->ops = &bcma_host_soc_ops;
-+
++      bus->host_pdev = pdev;
 +
 +      /* Register */
 +      err = bcma_bus_register(bus);
@@ -60,8 +71,6 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +
 +err_unmap_mmio:
 +      iounmap(bus->mmio);
-+err_kfree_bus:
-+      kfree(bus);
 +      return err;
 +}
 +
@@ -71,7 +80,6 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +
 +      bcma_bus_unregister(bus);
 +      iounmap(bus->mmio);
-+      kfree(bus);
 +      platform_set_drvdata(pdev, NULL);
 +
 +      return 0;
@@ -94,3 +102,14 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +};
 +module_platform_driver(bcma_host_soc_driver);
 +#endif /* CONFIG_OF */
+--- a/include/linux/bcma/bcma.h
++++ b/include/linux/bcma/bcma.h
+@@ -319,6 +319,8 @@ struct bcma_bus {
+               struct pci_dev *host_pci;
+               /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
+               struct sdio_func *host_sdio;
++              /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
++              struct platform_device *host_pdev;
+       };
+       struct bcma_chipinfo chipinfo;