brcm47xx: BCMA - Always map 4 bytes
[openwrt.git] / target / linux / brcm47xx / patches-3.2 / 230-bcma-find-name-for-non-brcm.patch
1 --- a/drivers/bcma/scan.c
2 +++ b/drivers/bcma/scan.c
3 @@ -19,7 +19,14 @@ struct bcma_device_id_name {
4 u16 id;
5 const char *name;
6 };
7 -struct bcma_device_id_name bcma_device_names[] = {
8 +
9 +static const struct bcma_device_id_name bcma_arm_device_names[] = {
10 + { BCMA_CORE_ARM_1176, "ARM 1176" },
11 + { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
12 + { BCMA_CORE_ARM_CM3, "ARM CM3" },
13 +};
14 +
15 +static const struct bcma_device_id_name bcma_bcm_device_names[] = {
16 { BCMA_CORE_OOB_ROUTER, "OOB Router" },
17 { BCMA_CORE_INVALID, "Invalid" },
18 { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
19 @@ -27,7 +34,6 @@ struct bcma_device_id_name bcma_device_n
20 { BCMA_CORE_SRAM, "SRAM" },
21 { BCMA_CORE_SDRAM, "SDRAM" },
22 { BCMA_CORE_PCI, "PCI" },
23 - { BCMA_CORE_MIPS, "MIPS" },
24 { BCMA_CORE_ETHERNET, "Fast Ethernet" },
25 { BCMA_CORE_V90, "V90" },
26 { BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
27 @@ -44,7 +50,6 @@ struct bcma_device_id_name bcma_device_n
28 { BCMA_CORE_PHY_A, "PHY A" },
29 { BCMA_CORE_PHY_B, "PHY B" },
30 { BCMA_CORE_PHY_G, "PHY G" },
31 - { BCMA_CORE_MIPS_3302, "MIPS 3302" },
32 { BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
33 { BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
34 { BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
35 @@ -58,15 +63,11 @@ struct bcma_device_id_name bcma_device_n
36 { BCMA_CORE_PHY_N, "PHY N" },
37 { BCMA_CORE_SRAM_CTL, "SRAM Controller" },
38 { BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
39 - { BCMA_CORE_ARM_1176, "ARM 1176" },
40 - { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
41 { BCMA_CORE_PHY_LP, "PHY LP" },
42 { BCMA_CORE_PMU, "PMU" },
43 { BCMA_CORE_PHY_SSN, "PHY SSN" },
44 { BCMA_CORE_SDIO_DEV, "SDIO Device" },
45 - { BCMA_CORE_ARM_CM3, "ARM CM3" },
46 { BCMA_CORE_PHY_HT, "PHY HT" },
47 - { BCMA_CORE_MIPS_74K, "MIPS 74K" },
48 { BCMA_CORE_MAC_GBIT, "GBit MAC" },
49 { BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
50 { BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
51 @@ -79,16 +80,57 @@ struct bcma_device_id_name bcma_device_n
52 { BCMA_CORE_SHIM, "SHIM" },
53 { BCMA_CORE_DEFAULT, "Default" },
54 };
55 -const char *bcma_device_name(struct bcma_device_id *id)
56 +
57 +static const struct bcma_device_id_name bcma_mips_device_names[] = {
58 + { BCMA_CORE_MIPS, "MIPS" },
59 + { BCMA_CORE_MIPS_3302, "MIPS 3302" },
60 + { BCMA_CORE_MIPS_74K, "MIPS 74K" },
61 +};
62 +
63 +static const char *bcma_scan_device_names(const struct bcma_device_id *id,
64 + const struct bcma_device_id_name *device_names,
65 + int array_size)
66 {
67 int i;
68
69 - if (id->manuf == BCMA_MANUF_BCM) {
70 - for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
71 - if (bcma_device_names[i].id == id->id)
72 - return bcma_device_names[i].name;
73 - }
74 + for (i = 0; i < array_size; i++) {
75 + if (device_names[i].id == id->id)
76 + return device_names[i].name;
77 }
78 + return NULL;
79 +}
80 +
81 +static const char *bcma_device_name(const struct bcma_device_id *id)
82 +{
83 + const char *name;
84 + const struct bcma_device_id_name *names;
85 + int size;
86 +
87 + /* search manufacturer specific names */
88 + switch (id->manuf) {
89 + case BCMA_MANUF_ARM:
90 + names = bcma_arm_device_names;
91 + size = ARRAY_SIZE(bcma_arm_device_names);
92 + break;
93 + case BCMA_MANUF_BCM:
94 + names = bcma_bcm_device_names;
95 + size = ARRAY_SIZE(bcma_bcm_device_names);
96 + break;
97 + case BCMA_MANUF_MIPS:
98 + names = bcma_mips_device_names;
99 + size = ARRAY_SIZE(bcma_mips_device_names);
100 + break;
101 + default:
102 + names = NULL;
103 + break;
104 + }
105 +
106 + if (names) {
107 + name = bcma_scan_device_names(id, names, size);
108 + if (name)
109 + return name;
110 + }
111 +
112 return "UNKNOWN";
113 }
114
This page took 0.040679 seconds and 5 git commands to generate.