bcm53xx: initial support for kernel 3.18
[openwrt.git] / target / linux / bcm53xx / patches-3.18 / 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 --- a/drivers/bcma/bcma_private.h
21 +++ b/drivers/bcma/bcma_private.h
22 @@ -24,6 +24,7 @@ struct bcma_bus;
23  /* main.c */
24  bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
25                      int timeout);
26 +void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
27  int bcma_bus_register(struct bcma_bus *bus);
28  void bcma_bus_unregister(struct bcma_bus *bus);
29  int __init bcma_bus_early_register(struct bcma_bus *bus,
30 --- a/drivers/bcma/main.c
31 +++ b/drivers/bcma/main.c
32 @@ -172,10 +172,8 @@ static void bcma_of_fill_device(struct p
33  }
34  #endif /* CONFIG_OF */
35  
36 -static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
37 +void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
38  {
39 -       int err;
40 -
41         core->dev.release = bcma_release_core_dev;
42         core->dev.bus = &bcma_bus_type;
43         dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
44 @@ -199,6 +197,11 @@ static void bcma_register_core(struct bc
45         case BCMA_HOSTTYPE_SDIO:
46                 break;
47         }
48 +}
49 +
50 +static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
51 +{
52 +       int err;
53  
54         err = device_register(&core->dev);
55         if (err) {
56 --- a/drivers/bcma/scan.c
57 +++ b/drivers/bcma/scan.c
58 @@ -505,6 +505,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
59                 bus->nr_cores++;
60                 other_core = bcma_find_core_reverse(bus, core->id.id);
61                 core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
62 +               bcma_prepare_core(bus, core);
63  
64                 bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
65                           core->core_index, bcma_device_name(&core->id),