bcm53xx: initial support for kernel 3.18
[openwrt.git] / target / linux / bcm53xx / patches-3.14 / 122-bcma-fill-core-details-for-every-device.patch
1 From 487b997353e2e3afe9c452b20ff5e4320d76e9c3 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Thu, 2 Oct 2014 12:28:54 +0200
4 Subject: [PATCH][RFC] bcma: fill core details for every device
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We were setting things like dma_dev, IRQ, etc. during core registration
10 only. We need such info for cores handled internally (e.g. ChipCommon)
11 as well.
12
13 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
14 ---
15  drivers/bcma/bcma_private.h | 1 +
16  drivers/bcma/main.c         | 9 ++++++---
17  drivers/bcma/scan.c         | 1 +
18  3 files changed, 8 insertions(+), 3 deletions(-)
19
20 diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
21 index b6412b2..314ae40 100644
22 --- a/drivers/bcma/bcma_private.h
23 +++ b/drivers/bcma/bcma_private.h
24 @@ -24,6 +24,7 @@ struct bcma_bus;
25  /* main.c */
26  bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
27                      int timeout);
28 +void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
29  int bcma_bus_register(struct bcma_bus *bus);
30  void bcma_bus_unregister(struct bcma_bus *bus);
31  int __init bcma_bus_early_register(struct bcma_bus *bus,
32 diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
33 index 5e7a3d4..70d0f23 100644
34 --- a/drivers/bcma/main.c
35 +++ b/drivers/bcma/main.c
36 @@ -172,10 +172,8 @@ static void bcma_of_fill_device(struct platform_device *parent,
37  }
38  #endif /* CONFIG_OF */
39  
40 -static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
41 +void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
42  {
43 -       int err;
44 -
45         core->dev.release = bcma_release_core_dev;
46         core->dev.bus = &bcma_bus_type;
47         dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
48 @@ -199,6 +197,11 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
49         case BCMA_HOSTTYPE_SDIO:
50                 break;
51         }
52 +}
53 +
54 +static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
55 +{
56 +       int err;
57  
58         err = device_register(&core->dev);
59         if (err) {
60 diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
61 index 14b5656..9175207 100644
62 --- a/drivers/bcma/scan.c
63 +++ b/drivers/bcma/scan.c
64 @@ -505,6 +505,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
65                 bus->nr_cores++;
66                 other_core = bcma_find_core_reverse(bus, core->id.id);
67                 core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
68 +               bcma_prepare_core(bus, core);
69  
70                 bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
71                           core->core_index, bcma_device_name(&core->id),
72 -- 
73 1.8.4.5
74