ar71xx: add an id argument to ar71xx_add_device_mdio
[openwrt.git] / target / linux / brcm47xx / patches-2.6.39 / 032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch
1 --- a/arch/mips/bcm47xx/setup.c
2 +++ b/arch/mips/bcm47xx/setup.c
3 @@ -59,10 +59,23 @@ static void bcm47xx_machine_halt(void)
4 }
5
6 #define READ_FROM_NVRAM(_outvar, name, buf) \
7 - if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
8 + if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
9 sprom->_outvar = simple_strtoul(buf, NULL, 0);
10
11 -static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
12 +static inline int nvram_getprefix(const char *prefix, char *name,
13 + char *buf, int len)
14 +{
15 + if (prefix) {
16 + char key[100];
17 +
18 + snprintf(key, sizeof(key), "%s%s", prefix, name);
19 + return nvram_getenv(key, buf, len);
20 + }
21 +
22 + return nvram_getenv(name, buf, len);
23 +}
24 +
25 +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
26 {
27 char buf[100];
28 u32 boardflags;
29 @@ -71,11 +84,11 @@ static void bcm47xx_fill_sprom(struct ss
30
31 sprom->revision = 1; /* Fallback: Old hardware does not define this. */
32 READ_FROM_NVRAM(revision, "sromrev", buf);
33 - if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
34 + if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0)
35 nvram_parse_macaddr(buf, sprom->il0mac);
36 - if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
37 + if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
38 nvram_parse_macaddr(buf, sprom->et0mac);
39 - if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
40 + if (nvram_getprefix(prefix, "et1macaddr", buf, sizeof(buf)) >= 0)
41 nvram_parse_macaddr(buf, sprom->et1mac);
42 READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
43 READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
44 @@ -127,14 +140,14 @@ static void bcm47xx_fill_sprom(struct ss
45 READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
46 READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
47
48 - if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) {
49 + if (nvram_getprefix(prefix, "boardflags", buf, sizeof(buf)) >= 0) {
50 boardflags = simple_strtoul(buf, NULL, 0);
51 if (boardflags) {
52 sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
53 sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
54 }
55 }
56 - if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) {
57 + if (nvram_getprefix(prefix, "boardflags2", buf, sizeof(buf)) >= 0) {
58 boardflags = simple_strtoul(buf, NULL, 0);
59 if (boardflags) {
60 sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
61 @@ -160,7 +173,7 @@ static int bcm47xx_get_invariants(struct
62 if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
63 iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
64
65 - bcm47xx_fill_sprom(&iv->sprom);
66 + bcm47xx_fill_sprom(&iv->sprom, NULL);
67
68 if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
69 iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
This page took 0.043251 seconds and 5 git commands to generate.