aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-10-03 07:34:18 -0400
committerJohn Crispin <blogic@openwrt.org>2012-11-09 05:37:17 -0500
commit5d24ceab4eaf0dd7825c5a06dc6f264c0a59660c (patch)
treec5407e21c5dc6ba8fed56921e2ec7a174a9d2c67 /arch/mips
parentc47cc20ca53e792938556aa29103fa889ce0d858 (diff)
MIPS: BCM47xx: read out full board data
Read out the full board data independently of the sprom version. Now we also get the full boardflags and so on if sromrev is not set and our code would assume a rev 1 device. When a nvram option is not set because it is not there this is no problem. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4363 Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/bcm47xx/sprom.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index d3a889745e20..7fa3da3fda48 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -164,10 +164,6 @@ static void nvram_read_alpha2(const char *prefix, const char *name,
164static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, 164static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
165 const char *prefix) 165 const char *prefix)
166{ 166{
167 nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0);
168 if (!sprom->board_rev)
169 nvram_read_u16(NULL, NULL, "boardrev", &sprom->board_rev, 0);
170 nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0);
171 nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff); 167 nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff);
172 nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff); 168 nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff);
173 nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff); 169 nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff);
@@ -214,13 +210,6 @@ static void bcm47xx_fill_sprom_r2389(struct ssb_sprom *sprom,
214 nvram_read_u8(prefix, NULL, "pa1himaxpwr", &sprom->maxpwr_ah, 0); 210 nvram_read_u8(prefix, NULL, "pa1himaxpwr", &sprom->maxpwr_ah, 0);
215} 211}
216 212
217static void bcm47xx_fill_sprom_r2(struct ssb_sprom *sprom, const char *prefix)
218{
219 nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
220 &sprom->boardflags_hi);
221 nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0);
222}
223
224static void bcm47xx_fill_sprom_r389(struct ssb_sprom *sprom, const char *prefix) 213static void bcm47xx_fill_sprom_r389(struct ssb_sprom *sprom, const char *prefix)
225{ 214{
226 nvram_read_u8(prefix, NULL, "bxa2g", &sprom->bxa2g, 0); 215 nvram_read_u8(prefix, NULL, "bxa2g", &sprom->bxa2g, 0);
@@ -241,9 +230,6 @@ static void bcm47xx_fill_sprom_r389(struct ssb_sprom *sprom, const char *prefix)
241 230
242static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix) 231static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix)
243{ 232{
244 nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
245 &sprom->boardflags_hi);
246 nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0);
247 nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0); 233 nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0);
248 nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, 234 nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
249 &sprom->leddc_off_time); 235 &sprom->leddc_off_time);
@@ -252,11 +238,6 @@ static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix)
252static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom, 238static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom,
253 const char *prefix) 239 const char *prefix)
254{ 240{
255 nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
256 &sprom->boardflags_hi);
257 nvram_read_u32_2(prefix, "boardflags2", &sprom->boardflags2_lo,
258 &sprom->boardflags2_hi);
259 nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0);
260 nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0); 241 nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0);
261 nvram_read_s8(prefix, NULL, "ag2", &sprom->antenna_gain.a2, 0); 242 nvram_read_s8(prefix, NULL, "ag2", &sprom->antenna_gain.a2, 0);
262 nvram_read_s8(prefix, NULL, "ag3", &sprom->antenna_gain.a3, 0); 243 nvram_read_s8(prefix, NULL, "ag3", &sprom->antenna_gain.a3, 0);
@@ -555,9 +536,23 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix)
555 nvram_read_macaddr(prefix, "il0macaddr", &sprom->il0mac); 536 nvram_read_macaddr(prefix, "il0macaddr", &sprom->il0mac);
556} 537}
557 538
539static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix)
540{
541 nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0);
542 if (!sprom->board_rev)
543 nvram_read_u16(NULL, NULL, "boardrev", &sprom->board_rev, 0);
544 nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0);
545 nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0);
546 nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
547 &sprom->boardflags_hi);
548 nvram_read_u32_2(prefix, "boardflags2", &sprom->boardflags2_lo,
549 &sprom->boardflags2_hi);
550}
551
558void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) 552void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
559{ 553{
560 bcm47xx_fill_sprom_ethernet(sprom, prefix); 554 bcm47xx_fill_sprom_ethernet(sprom, prefix);
555 bcm47xx_fill_board_data(sprom, prefix);
561 556
562 nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0); 557 nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0);
563 558
@@ -571,7 +566,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
571 bcm47xx_fill_sprom_r1234589(sprom, prefix); 566 bcm47xx_fill_sprom_r1234589(sprom, prefix);
572 bcm47xx_fill_sprom_r12389(sprom, prefix); 567 bcm47xx_fill_sprom_r12389(sprom, prefix);
573 bcm47xx_fill_sprom_r2389(sprom, prefix); 568 bcm47xx_fill_sprom_r2389(sprom, prefix);
574 bcm47xx_fill_sprom_r2(sprom, prefix);
575 break; 569 break;
576 case 3: 570 case 3:
577 bcm47xx_fill_sprom_r1234589(sprom, prefix); 571 bcm47xx_fill_sprom_r1234589(sprom, prefix);