1 From c046c19fc8f1af7cf253fea5b0253143c159948a 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 6/8] 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.
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 drivers/bcma/host_soc.c | 70 +++++++++++++++++++++++++++++++++++++++++++++
12 include/linux/bcma/bcma.h | 2 ++
13 2 files changed, 72 insertions(+)
15 --- a/drivers/bcma/host_soc.c
16 +++ b/drivers/bcma/host_soc.c
19 #include "bcma_private.h"
21 +#include <linux/slab.h>
22 +#include <linux/module.h>
23 +#include <linux/of_address.h>
24 #include <linux/bcma/bcma.h>
25 #include <linux/bcma/bcma_soc.h>
27 @@ -173,6 +176,7 @@ int __init bcma_host_soc_register(struct
29 bus->hosttype = BCMA_HOSTTYPE_SOC;
30 bus->ops = &bcma_host_soc_ops;
31 + bus->host_pdev = NULL;
34 err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
35 @@ -181,3 +185,69 @@ int __init bcma_host_soc_register(struct
41 +static int bcma_host_soc_probe(struct platform_device *pdev)
43 + struct device *dev = &pdev->dev;
44 + struct device_node *np = dev->of_node;
45 + struct bcma_bus *bus;
49 + bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
54 + bus->mmio = of_iomap(np, 0);
59 + bus->hosttype = BCMA_HOSTTYPE_SOC;
60 + bus->ops = &bcma_host_soc_ops;
61 + bus->host_pdev = pdev;
64 + err = bcma_bus_register(bus);
66 + goto err_unmap_mmio;
68 + platform_set_drvdata(pdev, bus);
77 +static int bcma_host_soc_remove(struct platform_device *pdev)
79 + struct bcma_bus *bus = platform_get_drvdata(pdev);
81 + bcma_bus_unregister(bus);
83 + platform_set_drvdata(pdev, NULL);
88 +static const struct of_device_id bcma_host_soc_of_match[] = {
89 + { .compatible = "brcm,bus-aix", },
92 +MODULE_DEVICE_TABLE(of, bcma_host_soc_of_match);
94 +static struct platform_driver bcma_host_soc_driver = {
96 + .name = "bcma-host-soc",
97 + .owner = THIS_MODULE,
98 + .of_match_table = bcma_host_soc_of_match,
100 + .probe = bcma_host_soc_probe,
101 + .remove = bcma_host_soc_remove,
103 +module_platform_driver(bcma_host_soc_driver);
104 +#endif /* CONFIG_OF */
105 --- a/include/linux/bcma/bcma.h
106 +++ b/include/linux/bcma/bcma.h
107 @@ -319,6 +319,8 @@ struct bcma_bus {
108 struct pci_dev *host_pci;
109 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
110 struct sdio_func *host_sdio;
111 + /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
112 + struct platform_device *host_pdev;
115 struct bcma_chipinfo chipinfo;