1 From 7b9116eeaf44c0d368b5eeaa06eb101465284596 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed, 11 Jan 2012 15:26:11 +0100
4 Subject: [PATCH 23/31] bcma: add the core unit number
6 Some SoCs have two pcie or gmac cores and we need to know the number of
7 the specific core on the bus. This is the case for the BCM4706.
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 drivers/bcma/scan.c | 14 ++++++++++++++
12 include/linux/bcma/bcma.h | 1 +
13 2 files changed, 15 insertions(+), 0 deletions(-)
15 --- a/drivers/bcma/scan.c
16 +++ b/drivers/bcma/scan.c
17 @@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_cor
21 +static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid)
23 + struct bcma_device *core;
25 + list_for_each_entry_reverse(core, &bus->cores, list) {
26 + if (core->id.id == coreid)
32 static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
33 struct bcma_device_id *match, int core_num,
34 struct bcma_device *core)
35 @@ -392,6 +403,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
36 bcma_scan_switch_core(bus, erombase);
38 while (eromptr < eromend) {
39 + struct bcma_device *other_core;
40 struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
43 @@ -411,6 +423,8 @@ int bcma_bus_scan(struct bcma_bus *bus)
45 core->core_index = core_num++;
47 + other_core = bcma_find_core_reverse(bus, core->id.id);
48 + core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
50 pr_info("Core %d found: %s "
51 "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
52 --- a/include/linux/bcma/bcma.h
53 +++ b/include/linux/bcma/bcma.h
54 @@ -136,6 +136,7 @@ struct bcma_device {