1f7233b80737d6470d3df3bfcc8c8342cc06d1ba
[openwrt/staging/robimarko.git] /
1 From 7515c6f1da334184c3ece06e6f61461086d8e2b1 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Wed, 1 Apr 2015 18:18:01 +0200
4 Subject: [PATCH] MIPS: BCM47xx: Keep ID entries for non-standard devices
5 together
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
11 Cc: linux-mips@linux-mips.org
12 Cc: Hauke Mehrtens <hauke@hauke-m.de>
13 Patchwork: https://patchwork.linux-mips.org/patch/9655/
14 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
15 ---
16 arch/mips/bcm47xx/board.c | 48 ++++++++++++++++++++---------------------------
17 1 file changed, 20 insertions(+), 28 deletions(-)
18
19 diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
20 index d4a5a51..f936dcc 100644
21 --- a/arch/mips/bcm47xx/board.c
22 +++ b/arch/mips/bcm47xx/board.c
23 @@ -40,20 +40,6 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
24 { {0}, NULL},
25 };
26
27 -/* model_no */
28 -static const
29 -struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
30 - {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
31 - { {0}, NULL},
32 -};
33 -
34 -/* machine_name */
35 -static const
36 -struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
37 - {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
38 - { {0}, NULL},
39 -};
40 -
41 /* hardware_version */
42 static const
43 struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
44 @@ -202,6 +188,18 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst
45 { {0}, NULL},
46 };
47
48 +/*
49 + * Some devices don't use any common NVRAM entry for identification and they
50 + * have only one model specific variable.
51 + * They don't deserve own arrays, let's group them there using key-value array.
52 + */
53 +static const
54 +struct bcm47xx_board_type_list2 bcm47xx_board_list_key_value[] __initconst = {
55 + {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "model_no", "WL700"},
56 + {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "machine_name", "WRTSL54GS"},
57 + { {0}, NULL},
58 +};
59 +
60 static const
61 struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
62 {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
63 @@ -225,20 +223,6 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
64 }
65 }
66
67 - if (bcm47xx_nvram_getenv("model_no", buf1, sizeof(buf1)) >= 0) {
68 - for (e1 = bcm47xx_board_list_model_no; e1->value1; e1++) {
69 - if (strstarts(buf1, e1->value1))
70 - return &e1->board;
71 - }
72 - }
73 -
74 - if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
75 - for (e1 = bcm47xx_board_list_machine_name; e1->value1; e1++) {
76 - if (strstarts(buf1, e1->value1))
77 - return &e1->board;
78 - }
79 - }
80 -
81 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
82 for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) {
83 if (strstarts(buf1, e1->value1))
84 @@ -314,6 +298,14 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
85 return &e2->board;
86 }
87 }
88 +
89 + for (e2 = bcm47xx_board_list_key_value; e2->value1; e2++) {
90 + if (bcm47xx_nvram_getenv(e2->value1, buf1, sizeof(buf1)) >= 0) {
91 + if (!strcmp(buf1, e2->value2))
92 + return &e2->board;
93 + }
94 + }
95 +
96 return bcm47xx_board_unknown;
97 }
98
99 --
100 1.8.4.5
101