Skip to content

Commit 82a7c2b

Browse files
nlhintzlinvjw
authored andcommitted
bcma: Find names of non BCM cores
bcma_device_name only provides names for Broadcom cores. Modify logic to provide names for MIPS and ARM cores as well. Signed-off-by: Nathan Hintz <nlhintz@hotmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 22291ce commit 82a7c2b

1 file changed

Lines changed: 40 additions & 14 deletions

File tree

‎drivers/bcma/scan.c‎

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ struct bcma_device_id_name {
1919
u16 id;
2020
const char *name;
2121
};
22-
struct bcma_device_id_name bcma_device_names[] = {
22+
23+
static const struct bcma_device_id_name bcma_arm_device_names[] = {
24+
{ BCMA_CORE_ARM_1176, "ARM 1176" },
25+
{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
26+
{ BCMA_CORE_ARM_CM3, "ARM CM3" },
27+
};
28+
29+
static const struct bcma_device_id_name bcma_bcm_device_names[] = {
2330
{ BCMA_CORE_OOB_ROUTER, "OOB Router" },
2431
{ BCMA_CORE_INVALID, "Invalid" },
2532
{ BCMA_CORE_CHIPCOMMON, "ChipCommon" },
2633
{ BCMA_CORE_ILINE20, "ILine 20" },
2734
{ BCMA_CORE_SRAM, "SRAM" },
2835
{ BCMA_CORE_SDRAM, "SDRAM" },
2936
{ BCMA_CORE_PCI, "PCI" },
30-
{ BCMA_CORE_MIPS, "MIPS" },
3137
{ BCMA_CORE_ETHERNET, "Fast Ethernet" },
3238
{ BCMA_CORE_V90, "V90" },
3339
{ BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
@@ -44,7 +50,6 @@ struct bcma_device_id_name bcma_device_names[] = {
4450
{ BCMA_CORE_PHY_A, "PHY A" },
4551
{ BCMA_CORE_PHY_B, "PHY B" },
4652
{ BCMA_CORE_PHY_G, "PHY G" },
47-
{ BCMA_CORE_MIPS_3302, "MIPS 3302" },
4853
{ BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
4954
{ BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
5055
{ BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
@@ -58,15 +63,11 @@ struct bcma_device_id_name bcma_device_names[] = {
5863
{ BCMA_CORE_PHY_N, "PHY N" },
5964
{ BCMA_CORE_SRAM_CTL, "SRAM Controller" },
6065
{ BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
61-
{ BCMA_CORE_ARM_1176, "ARM 1176" },
62-
{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
6366
{ BCMA_CORE_PHY_LP, "PHY LP" },
6467
{ BCMA_CORE_PMU, "PMU" },
6568
{ BCMA_CORE_PHY_SSN, "PHY SSN" },
6669
{ BCMA_CORE_SDIO_DEV, "SDIO Device" },
67-
{ BCMA_CORE_ARM_CM3, "ARM CM3" },
6870
{ BCMA_CORE_PHY_HT, "PHY HT" },
69-
{ BCMA_CORE_MIPS_74K, "MIPS 74K" },
7071
{ BCMA_CORE_MAC_GBIT, "GBit MAC" },
7172
{ BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
7273
{ BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
@@ -79,16 +80,41 @@ struct bcma_device_id_name bcma_device_names[] = {
7980
{ BCMA_CORE_SHIM, "SHIM" },
8081
{ BCMA_CORE_DEFAULT, "Default" },
8182
};
82-
const char *bcma_device_name(struct bcma_device_id *id)
83+
84+
static const struct bcma_device_id_name bcma_mips_device_names[] = {
85+
{ BCMA_CORE_MIPS, "MIPS" },
86+
{ BCMA_CORE_MIPS_3302, "MIPS 3302" },
87+
{ BCMA_CORE_MIPS_74K, "MIPS 74K" },
88+
};
89+
90+
static const char *bcma_device_name(const struct bcma_device_id *id)
8391
{
84-
int i;
92+
const struct bcma_device_id_name *names;
93+
int size, i;
94+
95+
/* search manufacturer specific names */
96+
switch (id->manuf) {
97+
case BCMA_MANUF_ARM:
98+
names = bcma_arm_device_names;
99+
size = ARRAY_SIZE(bcma_arm_device_names);
100+
break;
101+
case BCMA_MANUF_BCM:
102+
names = bcma_bcm_device_names;
103+
size = ARRAY_SIZE(bcma_bcm_device_names);
104+
break;
105+
case BCMA_MANUF_MIPS:
106+
names = bcma_mips_device_names;
107+
size = ARRAY_SIZE(bcma_mips_device_names);
108+
break;
109+
default:
110+
return "UNKNOWN";
111+
}
85112

86-
if (id->manuf == BCMA_MANUF_BCM) {
87-
for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
88-
if (bcma_device_names[i].id == id->id)
89-
return bcma_device_names[i].name;
90-
}
113+
for (i = 0; i < size; i++) {
114+
if (names[i].id == id->id)
115+
return names[i].name;
91116
}
117+
92118
return "UNKNOWN";
93119
}
94120

0 commit comments

Comments
 (0)