1 From 3e59da41882a408064cd23f4c9124a7938bdb91f Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Thu, 9 Jan 2014 19:40:14 +0100
4 Subject: [PATCH 06/15] bcma: get irqs from dt
6 If bcma was registered with device tree it will search for some nodes
7 with the irq number and add it to the core configuration.
9 drivers/bcma/main.c | 42 +++++++++++++++++++++++++++++++++++++++++-
10 1 file changed, 41 insertions(+), 1 deletion(-)
12 --- a/drivers/bcma/main.c
13 +++ b/drivers/bcma/main.c
15 #include <linux/platform_device.h>
16 #include <linux/bcma/bcma.h>
17 #include <linux/slab.h>
18 +#include <linux/of_irq.h>
19 +#include <linux/of_address.h>
21 MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
22 MODULE_LICENSE("GPL");
23 @@ -120,6 +122,38 @@ static void bcma_release_core_dev(struct
27 +static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
28 + struct bcma_device *core)
30 + struct device_node *node;
34 + if (!parent || !parent->dev.of_node)
37 + for_each_child_of_node(parent->dev.of_node, node) {
38 + reg = of_get_address(node, 0, &size, 0);
41 + if (be32_to_cpup(reg) == core->addr)
47 +static void bcma_of_fill_device(struct platform_device *parent,
48 + struct bcma_device *core)
50 + struct device_node *node;
52 + node = bcma_of_find_child_device(parent, core);
55 + core->dev.of_node = node;
56 + core->irq = irq_of_parse_and_map(node, 0);
59 static int bcma_register_cores(struct bcma_bus *bus)
61 struct bcma_device *core;
62 @@ -155,7 +189,13 @@ static int bcma_register_cores(struct bc
64 case BCMA_HOSTTYPE_SOC:
65 core->dev.dma_mask = &core->dev.coherent_dma_mask;
66 - core->dma_dev = &core->dev;
67 + if (bus->host_pdev) {
68 + core->dma_dev = &bus->host_pdev->dev;
69 + core->dev.parent = &bus->host_pdev->dev;
70 + bcma_of_fill_device(bus->host_pdev, core);
72 + core->dma_dev = &core->dev;
75 case BCMA_HOSTTYPE_SDIO: