aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/board.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-01 12:18:01 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-02 07:54:23 -0400
commit7515c6f1da334184c3ece06e6f61461086d8e2b1 (patch)
treeeb7503459976d7e2382edbcb9e79a6a1a48ffad0 /arch/mips/bcm47xx/board.c
parent5db7ccdc9f685fd742cc32efe58aa0c036f380b9 (diff)
MIPS: BCM47xx: Keep ID entries for non-standard devices together
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Cc: linux-mips@linux-mips.org Cc: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: https://patchwork.linux-mips.org/patch/9655/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/bcm47xx/board.c')
-rw-r--r--arch/mips/bcm47xx/board.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index d4a5a51ce232..f936dcc4f549 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -40,20 +40,6 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
40 { {0}, NULL}, 40 { {0}, NULL},
41}; 41};
42 42
43/* model_no */
44static const
45struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
46 {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
47 { {0}, NULL},
48};
49
50/* machine_name */
51static const
52struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
53 {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
54 { {0}, NULL},
55};
56
57/* hardware_version */ 43/* hardware_version */
58static const 44static const
59struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = { 45struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
@@ -202,6 +188,18 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst
202 { {0}, NULL}, 188 { {0}, NULL},
203}; 189};
204 190
191/*
192 * Some devices don't use any common NVRAM entry for identification and they
193 * have only one model specific variable.
194 * They don't deserve own arrays, let's group them there using key-value array.
195 */
196static const
197struct bcm47xx_board_type_list2 bcm47xx_board_list_key_value[] __initconst = {
198 {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "model_no", "WL700"},
199 {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "machine_name", "WRTSL54GS"},
200 { {0}, NULL},
201};
202
205static const 203static const
206struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = { 204struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
207 {BCM47XX_BOARD_UNKNOWN, "Unknown Board"}, 205 {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
@@ -225,20 +223,6 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
225 } 223 }
226 } 224 }
227 225
228 if (bcm47xx_nvram_getenv("model_no", buf1, sizeof(buf1)) >= 0) {
229 for (e1 = bcm47xx_board_list_model_no; e1->value1; e1++) {
230 if (strstarts(buf1, e1->value1))
231 return &e1->board;
232 }
233 }
234
235 if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
236 for (e1 = bcm47xx_board_list_machine_name; e1->value1; e1++) {
237 if (strstarts(buf1, e1->value1))
238 return &e1->board;
239 }
240 }
241
242 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) { 226 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
243 for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) { 227 for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) {
244 if (strstarts(buf1, e1->value1)) 228 if (strstarts(buf1, e1->value1))
@@ -314,6 +298,14 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
314 return &e2->board; 298 return &e2->board;
315 } 299 }
316 } 300 }
301
302 for (e2 = bcm47xx_board_list_key_value; e2->value1; e2++) {
303 if (bcm47xx_nvram_getenv(e2->value1, buf1, sizeof(buf1)) >= 0) {
304 if (!strcmp(buf1, e2->value2))
305 return &e2->board;
306 }
307 }
308
317 return bcm47xx_board_unknown; 309 return bcm47xx_board_unknown;
318} 310}
319 311