X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/532249b5072aacee71b437b5be6de44840dc6e00..f6b242d80b0fd6e280c4a9379bc97323944a0a79:/target/linux/brcm47xx/files/arch/mips/bcm947xx/setup.c diff --git a/target/linux/brcm47xx/files/arch/mips/bcm947xx/setup.c b/target/linux/brcm47xx/files/arch/mips/bcm947xx/setup.c index 780134818..008634a7e 100644 --- a/target/linux/brcm47xx/files/arch/mips/bcm947xx/setup.c +++ b/target/linux/brcm47xx/files/arch/mips/bcm947xx/setup.c @@ -87,38 +87,70 @@ static void e_aton(char *str, char *dest) } static void bcm47xx_fill_sprom(struct ssb_sprom *sprom) -{ - // TODO -} - -static void bcm47xx_fill_sprom_nvram(struct ssb_sprom *sprom) { char *s; - memset(sprom, 0, sizeof(struct ssb_sprom)); - - sprom->revision = 3; + memset(sprom, 0xFF, sizeof(struct ssb_sprom)); + + sprom->revision = 1; + if ((s = nvram_get("il0macaddr"))) + e_aton(s, sprom->r1.il0mac); if ((s = nvram_get("et0macaddr"))) e_aton(s, sprom->r1.et0mac); if ((s = nvram_get("et1macaddr"))) e_aton(s, sprom->r1.et1mac); if ((s = nvram_get("et0phyaddr"))) - sprom->r1.et0phyaddr = simple_strtoul(s, NULL, 10); + sprom->r1.et0phyaddr = simple_strtoul(s, NULL, 0); if ((s = nvram_get("et1phyaddr"))) - sprom->r1.et1phyaddr = simple_strtoul(s, NULL, 10); + sprom->r1.et1phyaddr = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("et0mdcport"))) + sprom->r1.et0mdcport = !!simple_strtoul(s, NULL, 10); + if ((s = nvram_get("et1mdcport"))) + sprom->r1.et1mdcport = !!simple_strtoul(s, NULL, 10); + if ((s = nvram_get("pa0b0"))) + sprom->r1.pa0b0 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa0b1"))) + sprom->r1.pa0b1 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa0b2"))) + sprom->r1.pa0b2 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa1b0"))) + sprom->r1.pa1b0 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa1b1"))) + sprom->r1.pa1b1 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa1b2"))) + sprom->r1.pa1b2 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("wl0gpio0"))) + sprom->r1.gpio0 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("wl0gpio1"))) + sprom->r1.gpio1 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("wl0gpio2"))) + sprom->r1.gpio2 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("wl0gpio3"))) + sprom->r1.gpio3 = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa0maxpwr"))) + sprom->r1.maxpwr_bg = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa1maxpwr"))) + sprom->r1.maxpwr_a = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa0itssit"))) + sprom->r1.itssi_bg = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("pa1itssit"))) + sprom->r1.itssi_a = simple_strtoul(s, NULL, 0); + if ((s = nvram_get("boardflags"))) + sprom->r1.boardflags_lo = simple_strtoul(s, NULL, 0); } static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv) { char *s; - - // TODO - //iv->boardinfo.vendor = + + iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; if ((s = nvram_get("boardtype"))) iv->boardinfo.type = (u16)simple_strtoul(s, NULL, 0); if ((s = nvram_get("boardrev"))) iv->boardinfo.rev = (u16)simple_strtoul(s, NULL, 0); + bcm47xx_fill_sprom(&iv->sprom); + return 0; } @@ -136,10 +168,6 @@ void __init plat_mem_setup(void) } mcore = &ssb.mipscore; - /* FIXME: the nvram init depends on the ssb being fully initializes, - * can't use the fill_sprom callback yet! */ - bcm47xx_fill_sprom_nvram(&ssb.sprom); - s = nvram_get("kernel_args"); if (s && !strncmp(s, "console=ttyS1", 13)) { struct ssb_serial_port port; @@ -158,7 +186,7 @@ void __init plat_mem_setup(void) memset(&s, 0, sizeof(s)); s.line = i; s.membase = port->regs; - s.irq = port->irq + 2;//FIXME? + s.irq = port->irq + 2; s.uartclk = port->baud_base; s.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ; s.iotype = SERIAL_IO_MEM; @@ -171,8 +199,7 @@ void __init plat_mem_setup(void) _machine_restart = bcm47xx_machine_restart; _machine_halt = bcm47xx_machine_halt; pm_power_off = bcm47xx_machine_halt; - - board_time_init = bcm47xx_time_init;//FIXME move into ssb + board_time_init = bcm47xx_time_init; } EXPORT_SYMBOL(ssb);