1 From 06a21484198df9a4d34fe5062878d3bf4fc14340 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 7/8] bcma: get irqs from dt
7 drivers/bcma/main.c | 42 +++++++++++++++++++++++++++++++++++++++++-
8 1 file changed, 41 insertions(+), 1 deletion(-)
10 --- a/drivers/bcma/main.c
11 +++ b/drivers/bcma/main.c
13 #include <linux/platform_device.h>
14 #include <linux/bcma/bcma.h>
15 #include <linux/slab.h>
16 +#include <linux/of_irq.h>
17 +#include <linux/of_address.h>
19 MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
20 MODULE_LICENSE("GPL");
21 @@ -120,6 +122,38 @@ static void bcma_release_core_dev(struct
25 +static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
26 + struct bcma_device *core)
28 + struct device_node *node;
32 + if (!parent || !parent->dev.of_node)
35 + for_each_child_of_node(parent->dev.of_node, node) {
36 + reg = of_get_address(node, 0, &size, 0);
39 + if (be32_to_cpup(reg) == core->addr)
45 +static void bcma_of_fill_device(struct platform_device *parent,
46 + struct bcma_device *core)
48 + struct device_node *node;
50 + node = bcma_of_find_child_device(parent, core);
53 + core->dev.of_node = node;
54 + core->irq = irq_of_parse_and_map(node, 0);
57 static int bcma_register_cores(struct bcma_bus *bus)
59 struct bcma_device *core;
60 @@ -154,7 +188,13 @@ static int bcma_register_cores(struct bc
62 case BCMA_HOSTTYPE_SOC:
63 core->dev.dma_mask = &core->dev.coherent_dma_mask;
64 - core->dma_dev = &core->dev;
65 + if (bus->host_pdev) {
66 + core->dma_dev = &bus->host_pdev->dev;
67 + core->dev.parent = &bus->host_pdev->dev;
68 + bcma_of_fill_device(bus->host_pdev, core);
70 + core->dma_dev = &core->dev;
73 case BCMA_HOSTTYPE_SDIO: