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 @@ -173,6 +176,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;
86 err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
87 @@ -181,3 +185,69 @@ int __init bcma_host_soc_register(struct
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;
116 + err = bcma_bus_register(bus);
118 + goto err_unmap_mmio;
120 + platform_set_drvdata(pdev, bus);
125 + iounmap(bus->mmio);
129 +static int bcma_host_soc_remove(struct platform_device *pdev)
131 + struct bcma_bus *bus = platform_get_drvdata(pdev);
133 + bcma_bus_unregister(bus);
134 + iounmap(bus->mmio);
135 + platform_set_drvdata(pdev, NULL);
140 +static const struct of_device_id bcma_host_soc_of_match[] = {
141 + { .compatible = "brcm,bus-aix", },
144 +MODULE_DEVICE_TABLE(of, bcma_host_soc_of_match);
146 +static struct platform_driver bcma_host_soc_driver = {
148 + .name = "bcma-host-soc",
149 + .owner = THIS_MODULE,
150 + .of_match_table = bcma_host_soc_of_match,
152 + .probe = bcma_host_soc_probe,
153 + .remove = bcma_host_soc_remove,
155 +module_platform_driver(bcma_host_soc_driver);
156 +#endif /* CONFIG_OF */
157 --- a/include/linux/bcma/bcma.h
158 +++ b/include/linux/bcma/bcma.h
159 @@ -323,6 +323,8 @@ struct bcma_bus {
160 struct pci_dev *host_pci;
161 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
162 struct sdio_func *host_sdio;
163 + /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
164 + struct platform_device *host_pdev;
167 struct bcma_chipinfo chipinfo;