Root/target/linux/brcm47xx/patches-3.2/0036-bcma-add-the-core-unit-number.patch

1From 7b9116eeaf44c0d368b5eeaa06eb101465284596 Mon Sep 17 00:00:00 2001
2From: Hauke Mehrtens <hauke@hauke-m.de>
3Date: Wed, 11 Jan 2012 15:26:11 +0100
4Subject: [PATCH 23/31] bcma: add the core unit number
5
6Some SoCs have two pcie or gmac cores and we need to know the number of
7the specific core on the bus. This is the case for the BCM4706.
8
9Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
10---
11 drivers/bcma/scan.c | 14 ++++++++++++++
12 include/linux/bcma/bcma.h | 1 +
13 2 files changed, 15 insertions(+), 0 deletions(-)
14
15--- a/drivers/bcma/scan.c
16+++ b/drivers/bcma/scan.c
17@@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_cor
18     return NULL;
19 }
20 
21+static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid)
22+{
23+ struct bcma_device *core;
24+
25+ list_for_each_entry_reverse(core, &bus->cores, list) {
26+ if (core->id.id == coreid)
27+ return core;
28+ }
29+ return NULL;
30+}
31+
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);
37 
38     while (eromptr < eromend) {
39+ struct bcma_device *other_core;
40         struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
41         if (!core)
42             return -ENOMEM;
43@@ -411,6 +423,8 @@ int bcma_bus_scan(struct bcma_bus *bus)
44 
45         core->core_index = core_num++;
46         bus->nr_cores++;
47+ other_core = bcma_find_core_reverse(bus, core->id.id);
48+ core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
49 
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 {
55     bool dev_registered;
56 
57     u8 core_index;
58+ u8 core_unit;
59 
60     u32 addr;
61     u32 wrap;
62

Archive Download this file



interactive