Commit 5f2d6171 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville

bcma: add the core unit number

Some SoCs have two pcie or gmac cores and we need to know the number of
the specific core on the bus. This is the case for the BCM4706.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 268bd858
...@@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus, ...@@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus,
return NULL; return NULL;
} }
static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid)
{
struct bcma_device *core;
list_for_each_entry_reverse(core, &bus->cores, list) {
if (core->id.id == coreid)
return core;
}
return NULL;
}
static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
struct bcma_device_id *match, int core_num, struct bcma_device_id *match, int core_num,
struct bcma_device *core) struct bcma_device *core)
...@@ -392,6 +403,7 @@ int bcma_bus_scan(struct bcma_bus *bus) ...@@ -392,6 +403,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
bcma_scan_switch_core(bus, erombase); bcma_scan_switch_core(bus, erombase);
while (eromptr < eromend) { while (eromptr < eromend) {
struct bcma_device *other_core;
struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL); struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
if (!core) if (!core)
return -ENOMEM; return -ENOMEM;
...@@ -411,6 +423,8 @@ int bcma_bus_scan(struct bcma_bus *bus) ...@@ -411,6 +423,8 @@ int bcma_bus_scan(struct bcma_bus *bus)
core->core_index = core_num++; core->core_index = core_num++;
bus->nr_cores++; bus->nr_cores++;
other_core = bcma_find_core_reverse(bus, core->id.id);
core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
pr_info("Core %d found: %s " pr_info("Core %d found: %s "
"(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
......
...@@ -136,6 +136,7 @@ struct bcma_device { ...@@ -136,6 +136,7 @@ struct bcma_device {
bool dev_registered; bool dev_registered;
u8 core_index; u8 core_index;
u8 core_unit;
u32 addr; u32 addr;
u32 wrap; u32 wrap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment