1 From 04b91da96d7c163fd39c0849d2034e2928103f4d Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Mon, 6 Jan 2014 23:29:15 +0100
4 Subject: [PATCH 04/17] bcma: register bcma as device tree driver
6 This driver is used by the bcm53xx ARM SoC code. Now it is possible to
7 give the address of the chipcommon core in device tree and bcma will
8 search for all the other cores.
10 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 Documentation/devicetree/bindings/bus/bcma.txt | 46 +++++++++++++++++
13 drivers/bcma/host_soc.c | 70 ++++++++++++++++++++++++++
14 include/linux/bcma/bcma.h | 2 +
15 3 files changed, 118 insertions(+)
16 create mode 100644 Documentation/devicetree/bindings/bus/bcma.txt
19 +++ b/Documentation/devicetree/bindings/bus/bcma.txt
21 +Broadcom AIX bcma bus driver
26 +- compatible : brcm,bus-aix
28 +- reg : iomem address range of chipcommon core
32 +- sprom: reference to a sprom driver. This is needed for sprom less devices.
33 + Use bcm47xx_sprom for example.
36 +The cores on the AIX bus are auto detected by bcma. Detection of the
37 +IRQ number is not supported on BCM47xx/BCM53xx ARM SoCs, so it is
38 +possible to provide the IRQ number over device tree. The IRQ number and
39 +the device tree child entry will be added to the core with the matching
45 + compatible = "brcm,bus-aix";
46 + reg = <0x18000000 0x1000>;
47 + ranges = <0x00000000 0x18000000 0x00100000>;
48 + #address-cells = <1>;
53 + reg = <0x18024000 0x1000>;
54 + interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>;
58 + reg = <0x18025000 0x1000>;
59 + interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
63 + reg = <0x18012000 0x1000>;
64 + interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
67 --- a/drivers/bcma/host_soc.c
68 +++ b/drivers/bcma/host_soc.c
71 #include "bcma_private.h"
73 +#include <linux/slab.h>
74 +#include <linux/module.h>
75 +#include <linux/of_address.h>
76 #include <linux/bcma/bcma.h>
77 #include <linux/bcma/bcma_soc.h>
79 @@ -176,6 +179,7 @@ int __init bcma_host_soc_register(struct
81 bus->hosttype = BCMA_HOSTTYPE_SOC;
82 bus->ops = &bcma_host_soc_ops;
83 + bus->host_pdev = NULL;
85 /* Initialize struct, detect chip */
87 @@ -195,3 +199,72 @@ int __init bcma_host_soc_init(struct bcm
93 +static int bcma_host_soc_probe(struct platform_device *pdev)
95 + struct device *dev = &pdev->dev;
96 + struct device_node *np = dev->of_node;
97 + struct bcma_bus *bus;
101 + bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
106 + bus->mmio = of_iomap(np, 0);
110 + /* Host specific */
111 + bus->hosttype = BCMA_HOSTTYPE_SOC;
112 + bus->ops = &bcma_host_soc_ops;
113 + bus->host_pdev = pdev;
115 + /* Initialize struct, detect chip */
116 + bcma_init_bus(bus);
119 + err = bcma_bus_register(bus);
121 + goto err_unmap_mmio;
123 + platform_set_drvdata(pdev, bus);
128 + iounmap(bus->mmio);
132 +static int bcma_host_soc_remove(struct platform_device *pdev)
134 + struct bcma_bus *bus = platform_get_drvdata(pdev);
136 + bcma_bus_unregister(bus);
137 + iounmap(bus->mmio);
138 + platform_set_drvdata(pdev, NULL);
143 +static const struct of_device_id bcma_host_soc_of_match[] = {
144 + { .compatible = "brcm,bus-aix", },
147 +MODULE_DEVICE_TABLE(of, bcma_host_soc_of_match);
149 +static struct platform_driver bcma_host_soc_driver = {
151 + .name = "bcma-host-soc",
152 + .owner = THIS_MODULE,
153 + .of_match_table = bcma_host_soc_of_match,
155 + .probe = bcma_host_soc_probe,
156 + .remove = bcma_host_soc_remove,
158 +module_platform_driver(bcma_host_soc_driver);
159 +#endif /* CONFIG_OF */
160 --- a/include/linux/bcma/bcma.h
161 +++ b/include/linux/bcma/bcma.h
162 @@ -323,6 +323,8 @@ struct bcma_bus {
163 struct pci_dev *host_pci;
164 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
165 struct sdio_func *host_sdio;
166 + /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
167 + struct platform_device *host_pdev;
170 struct bcma_chipinfo chipinfo;