Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: linux-2.6.32.12/arch/mips/bcm47xx/setup.c
- ===================================================================
- --- linux-2.6.32.12.orig/arch/mips/bcm47xx/setup.c 2010-05-03 16:40:46.000000000 +0200
- +++ linux-2.6.32.12/arch/mips/bcm47xx/setup.c 2010-05-03 19:49:50.000000000 +0200
- @@ -45,6 +45,8 @@
- struct ssb_bus ssb_bcm47xx;
- EXPORT_SYMBOL(ssb_bcm47xx);
- +static struct ssb_sprom fallback_sprom;
- +
- extern void bcm47xx_pci_init(void);
- static void bcm47xx_machine_restart(char *command)
- @@ -83,60 +85,86 @@
- }
- }
- -static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
- +static char *nvram_get_prefix(const char *entry, const char *prefix)
- +{
- + char key[51];
- +
- + if (prefix) {
- + snprintf(key, sizeof(key), "%s%s", prefix, entry);
- +
- + entry = key;
- + }
- +
- + return nvram_get(entry);
- +}
- +
- +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
- {
- char *s;
- memset(sprom, 0xFF, sizeof(struct ssb_sprom));
- - sprom->revision = 1;
- - if ((s = nvram_get("il0macaddr")))
- + if ((s = nvram_get_prefix("sromrev", prefix)))
- + sprom->revision = simple_strtoul(s, NULL, 0);
- + else
- + sprom->revision = 1;
- + if ((s = nvram_get_prefix("il0macaddr", prefix)))
- e_aton(s, sprom->il0mac);
- - if ((s = nvram_get("et0macaddr")))
- + if ((s = nvram_get_prefix("et0macaddr", prefix)))
- e_aton(s, sprom->et0mac);
- - if ((s = nvram_get("et1macaddr")))
- + if ((s = nvram_get_prefix("et1macaddr", prefix)))
- e_aton(s, sprom->et1mac);
- - if ((s = nvram_get("et0phyaddr")))
- + if ((s = nvram_get_prefix("et0phyaddr", prefix)))
- sprom->et0phyaddr = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("et1phyaddr")))
- + if ((s = nvram_get_prefix("et1phyaddr", prefix)))
- sprom->et1phyaddr = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("et0mdcport")))
- + if ((s = nvram_get_prefix("et0mdcport", prefix)))
- sprom->et0mdcport = !!simple_strtoul(s, NULL, 10);
- - if ((s = nvram_get("et1mdcport")))
- + if ((s = nvram_get_prefix("et1mdcport", prefix)))
- sprom->et1mdcport = !!simple_strtoul(s, NULL, 10);
- - if ((s = nvram_get("pa0b0")))
- + if ((s = nvram_get_prefix("pa0b0", prefix)))
- sprom->pa0b0 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa0b1")))
- + if ((s = nvram_get_prefix("pa0b1", prefix)))
- sprom->pa0b1 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa0b2")))
- + if ((s = nvram_get_prefix("pa0b2", prefix)))
- sprom->pa0b2 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa1b0")))
- + if ((s = nvram_get_prefix("pa1b0", prefix)))
- sprom->pa1b0 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa1b1")))
- + if ((s = nvram_get_prefix("pa1b1", prefix)))
- sprom->pa1b1 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa1b2")))
- + if ((s = nvram_get_prefix("pa1b2", prefix)))
- sprom->pa1b2 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("wl0gpio0")))
- + if ((s = nvram_get_prefix("wl0gpio0", prefix)))
- sprom->gpio0 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("wl0gpio1")))
- + if ((s = nvram_get_prefix("wl0gpio1", prefix)))
- sprom->gpio1 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("wl0gpio2")))
- + if ((s = nvram_get_prefix("wl0gpio2", prefix)))
- sprom->gpio2 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("wl0gpio3")))
- + if ((s = nvram_get_prefix("wl0gpio3", prefix)))
- sprom->gpio3 = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa0maxpwr")))
- + if ((s = nvram_get_prefix("pa0maxpwr", prefix)))
- sprom->maxpwr_bg = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa1maxpwr")))
- + if ((s = nvram_get_prefix("pa1maxpwr", prefix)))
- sprom->maxpwr_a = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa0itssit")))
- + if ((s = nvram_get_prefix("pa0itssit", prefix)))
- sprom->itssi_bg = simple_strtoul(s, NULL, 0);
- - if ((s = nvram_get("pa1itssit")))
- + if ((s = nvram_get_prefix("pa1itssit", prefix)))
- sprom->itssi_a = simple_strtoul(s, NULL, 0);
- + if ((s = nvram_get_prefix("ccode", prefix)))
- + sprom->country_code = simple_strtoul(s, NULL, 0);
- + if ((s = nvram_get_prefix("aa0", prefix)))
- + sprom->ant_available_bg = simple_strtoul(s, NULL, 0);
- + if ((s = nvram_get_prefix("aa1", prefix)))
- + sprom->ant_available_a = simple_strtoul(s, NULL, 0);
- + if ((s = nvram_get_prefix("ag0", prefix)))
- + sprom->antenna_gain.ghz24.a0 = simple_strtoul(s, NULL, 0);
- + if ((s = nvram_get_prefix("ag1", prefix)))
- + sprom->antenna_gain.ghz5.a0 = simple_strtoul(s, NULL, 0);
- sprom->boardflags_lo = 0;
- - if ((s = nvram_get("boardflags")))
- + if ((s = nvram_get_prefix("boardflags", prefix)))
- sprom->boardflags_lo = simple_strtoul(s, NULL, 0);
- sprom->boardflags_hi = 0;
- - if ((s = nvram_get("boardflags2")))
- + if ((s = nvram_get_prefix("boardflags2", prefix)))
- sprom->boardflags_hi = simple_strtoul(s, NULL, 0);
- }
- @@ -150,7 +178,7 @@
- if ((s = nvram_get("boardrev")))
- iv->boardinfo.rev = (u16)simple_strtoul(s, NULL, 0);
- - bcm47xx_fill_sprom(&iv->sprom);
- + bcm47xx_fill_sprom(&iv->sprom, NULL);
- if ((s = nvram_get("cardbus")))
- iv->has_cardbus_slot = !!simple_strtoul(s, NULL, 10);
- @@ -164,6 +192,10 @@
- char *s;
- struct ssb_mipscore *mcore;
- +#ifdef CONFIG_SSB_PCIHOST
- + const char *prefix;
- +#endif
- +
- err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, bcm47xx_get_invariants);
- if (err) {
- const char *msg = "Failed to initialize SSB bus (err %d)\n";
- @@ -172,6 +204,18 @@
- }
- mcore = &ssb_bcm47xx.mipscore;
- +#ifdef CONFIG_SSB_PCIHOST
- + printk(KERN_INFO "Using fallback SPROM.\n");
- +
- + prefix = "pci/1/1/";
- + if (nvram_get_prefix("il0macaddr", prefix)) {
- + bcm47xx_fill_sprom(&fallback_sprom, prefix);
- +
- + if (ssb_arch_set_fallback_sprom(&fallback_sprom) < 0)
- + printk(KERN_ERR "failed to register fallback SPROM\n");
- + }
- +#endif
- +
- s = nvram_get("kernel_args");
- if (s && !strncmp(s, "console=ttyS1", 13)) {
- struct ssb_serial_port port;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement