diff options
-rw-r--r-- | drivers/bcma/scan.c | 14 | ||||
-rw-r--r-- | include/linux/bcma/bcma.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index cad994857683..e513aa83ec25 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus, | |||
212 | return NULL; | 212 | return NULL; |
213 | } | 213 | } |
214 | 214 | ||
215 | static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid) | ||
216 | { | ||
217 | struct bcma_device *core; | ||
218 | |||
219 | list_for_each_entry_reverse(core, &bus->cores, list) { | ||
220 | if (core->id.id == coreid) | ||
221 | return core; | ||
222 | } | ||
223 | return NULL; | ||
224 | } | ||
225 | |||
215 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | 226 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, |
216 | struct bcma_device_id *match, int core_num, | 227 | struct bcma_device_id *match, int core_num, |
217 | struct bcma_device *core) | 228 | struct bcma_device *core) |
@@ -392,6 +403,7 @@ int bcma_bus_scan(struct bcma_bus *bus) | |||
392 | bcma_scan_switch_core(bus, erombase); | 403 | bcma_scan_switch_core(bus, erombase); |
393 | 404 | ||
394 | while (eromptr < eromend) { | 405 | while (eromptr < eromend) { |
406 | struct bcma_device *other_core; | ||
395 | struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL); | 407 | struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL); |
396 | if (!core) | 408 | if (!core) |
397 | return -ENOMEM; | 409 | return -ENOMEM; |
@@ -411,6 +423,8 @@ int bcma_bus_scan(struct bcma_bus *bus) | |||
411 | 423 | ||
412 | core->core_index = core_num++; | 424 | core->core_index = core_num++; |
413 | bus->nr_cores++; | 425 | bus->nr_cores++; |
426 | other_core = bcma_find_core_reverse(bus, core->id.id); | ||
427 | core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1; | ||
414 | 428 | ||
415 | pr_info("Core %d found: %s " | 429 | pr_info("Core %d found: %s " |
416 | "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", | 430 | "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 83c209f39493..024a6e2a9083 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -136,6 +136,7 @@ struct bcma_device { | |||
136 | bool dev_registered; | 136 | bool dev_registered; |
137 | 137 | ||
138 | u8 core_index; | 138 | u8 core_index; |
139 | u8 core_unit; | ||
139 | 140 | ||
140 | u32 addr; | 141 | u32 addr; |
141 | u32 wrap; | 142 | u32 wrap; |