1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-20 02:12:52 +02:00

brcm47xx: use tab instead of space

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21430 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
hauke 2010-05-12 20:28:39 +00:00
parent 1c1b0687a0
commit 2643f5ec98
4 changed files with 144 additions and 144 deletions

View File

@ -32,20 +32,20 @@
+ +
+static inline void b44_bcm47xx_workarounds(struct b44 *bp) +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
+{ +{
+ /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */ + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
+ if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) { + if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) {
+ bp->phy_addr = B44_PHY_ADDR_NO_PHY; + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+ } else { + } else {
+ /* WL-HDD */ + /* WL-HDD */
+ struct ssb_device *sdev = bp->sdev; + struct ssb_device *sdev = bp->sdev;
+ if (startswith(getvar("hardware_version"), "WL300-")) + if (startswith(getvar("hardware_version"), "WL300-"))
+ { + {
+ if (sdev->bus->sprom.et0phyaddr == 0 && + if (sdev->bus->sprom.et0phyaddr == 0 &&
+ sdev->bus->sprom.et1phyaddr == 1) + sdev->bus->sprom.et1phyaddr == 1)
+ bp->phy_addr = B44_PHY_ADDR_NO_PHY; + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+ } + }
+ } + }
+ return; + return;
+} +}
+ +
+#else +#else

View File

@ -32,20 +32,20 @@
+ +
+static inline void b44_bcm47xx_workarounds(struct b44 *bp) +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
+{ +{
+ /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */ + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
+ if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) { + if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) {
+ bp->phy_addr = B44_PHY_ADDR_NO_PHY; + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+ } else { + } else {
+ /* WL-HDD */ + /* WL-HDD */
+ struct ssb_device *sdev = bp->sdev; + struct ssb_device *sdev = bp->sdev;
+ if (startswith(getvar("hardware_version"), "WL300-")) + if (startswith(getvar("hardware_version"), "WL300-"))
+ { + {
+ if (sdev->bus->sprom.et0phyaddr == 0 && + if (sdev->bus->sprom.et0phyaddr == 0 &&
+ sdev->bus->sprom.et1phyaddr == 1) + sdev->bus->sprom.et1phyaddr == 1)
+ bp->phy_addr = B44_PHY_ADDR_NO_PHY; + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+ } + }
+ } + }
+ return; + return;
+} +}
+ +
+#else +#else

View File

@ -41,18 +41,19 @@ Signed-off-by: Steve Brown <sbrown@cortland.com>
- ssb_write32(dev, 0x400, tmp); - ssb_write32(dev, 0x400, tmp);
- tmp = ssb_read32(dev, 0x400); - tmp = ssb_read32(dev, 0x400);
- printk("USB20H fcr: 0x%0x\n", tmp); - printk("USB20H fcr: 0x%0x\n", tmp);
+ /* Work around for 5354 failures */ -
+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) {
+ /* Change syn01 reg */
+ tmp = 0x00fe00fe;
+ ssb_write32(dev, 0x894, tmp);
- /* Change Shim control reg */ - /* Change Shim control reg */
- tmp = ssb_read32(dev, 0x304); - tmp = ssb_read32(dev, 0x304);
- tmp &= ~0x100; - tmp &= ~0x100;
- ssb_write32(dev, 0x304, tmp); - ssb_write32(dev, 0x304, tmp);
- tmp = ssb_read32(dev, 0x304); - tmp = ssb_read32(dev, 0x304);
- printk("USB20H shim: 0x%0x\n", tmp); - printk("USB20H shim: 0x%0x\n", tmp);
+ /* Work around for 5354 failures */
+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) {
+ /* Change syn01 reg */
+ tmp = 0x00fe00fe;
+ ssb_write32(dev, 0x894, tmp);
+
+ /* Change syn03 reg */ + /* Change syn03 reg */
+ tmp = ssb_read32(dev, 0x89c); + tmp = ssb_read32(dev, 0x89c);
+ tmp |= 0x1; + tmp |= 0x1;

View File

@ -119,81 +119,83 @@
{ {
int i = 0; int i = 0;
@@ -73,51 +83,143 @@ static void str2eaddr(char *str, char *d @@ -73,51 +83,142 @@ static void str2eaddr(char *str, char *d
} }
} }
-static int bcm47xx_get_invariants(struct ssb_bus *bus, -static int bcm47xx_get_invariants(struct ssb_bus *bus,
- struct ssb_init_invariants *iv) - struct ssb_init_invariants *iv)
+static void bcm47xx_fill_sprom(struct ssb_sprom *sprom) +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
{ +{
char buf[100];
+ char *s; + char *s;
+ +
+ memset(sprom, 0xFF, sizeof(struct ssb_sprom)); + memset(sprom, 0xFF, sizeof(struct ssb_sprom));
+ +
+ sprom->revision = 1; + sprom->revision = 1;
+ if ((s = nvram_get("il0macaddr"))) + if ((s = nvram_get("il0macaddr")))
+ e_aton(s, sprom->il0mac); + e_aton(s, sprom->il0mac);
+ if ((s = nvram_get("et0macaddr"))) + if ((s = nvram_get("et0macaddr")))
+ e_aton(s, sprom->et0mac); + e_aton(s, sprom->et0mac);
+ if ((s = nvram_get("et1macaddr"))) + if ((s = nvram_get("et1macaddr")))
+ e_aton(s, sprom->et1mac); + e_aton(s, sprom->et1mac);
+ if ((s = nvram_get("et0phyaddr"))) + if ((s = nvram_get("et0phyaddr")))
+ sprom->et0phyaddr = simple_strtoul(s, NULL, 0); + sprom->et0phyaddr = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("et1phyaddr"))) + if ((s = nvram_get("et1phyaddr")))
+ sprom->et1phyaddr = simple_strtoul(s, NULL, 0); + sprom->et1phyaddr = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("et0mdcport"))) + if ((s = nvram_get("et0mdcport")))
+ sprom->et0mdcport = !!simple_strtoul(s, NULL, 10); + sprom->et0mdcport = !!simple_strtoul(s, NULL, 10);
+ if ((s = nvram_get("et1mdcport"))) + if ((s = nvram_get("et1mdcport")))
+ sprom->et1mdcport = !!simple_strtoul(s, NULL, 10); + sprom->et1mdcport = !!simple_strtoul(s, NULL, 10);
+ if ((s = nvram_get("pa0b0"))) + if ((s = nvram_get("pa0b0")))
+ sprom->pa0b0 = simple_strtoul(s, NULL, 0); + sprom->pa0b0 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa0b1"))) + if ((s = nvram_get("pa0b1")))
+ sprom->pa0b1 = simple_strtoul(s, NULL, 0); + sprom->pa0b1 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa0b2"))) + if ((s = nvram_get("pa0b2")))
+ sprom->pa0b2 = simple_strtoul(s, NULL, 0); + sprom->pa0b2 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa1b0"))) + if ((s = nvram_get("pa1b0")))
+ sprom->pa1b0 = simple_strtoul(s, NULL, 0); + sprom->pa1b0 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa1b1"))) + if ((s = nvram_get("pa1b1")))
+ sprom->pa1b1 = simple_strtoul(s, NULL, 0); + sprom->pa1b1 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa1b2"))) + if ((s = nvram_get("pa1b2")))
+ sprom->pa1b2 = simple_strtoul(s, NULL, 0); + sprom->pa1b2 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("wl0gpio0"))) + if ((s = nvram_get("wl0gpio0")))
+ sprom->gpio0 = simple_strtoul(s, NULL, 0); + sprom->gpio0 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("wl0gpio1"))) + if ((s = nvram_get("wl0gpio1")))
+ sprom->gpio1 = simple_strtoul(s, NULL, 0); + sprom->gpio1 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("wl0gpio2"))) + if ((s = nvram_get("wl0gpio2")))
+ sprom->gpio2 = simple_strtoul(s, NULL, 0); + sprom->gpio2 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("wl0gpio3"))) + if ((s = nvram_get("wl0gpio3")))
+ sprom->gpio3 = simple_strtoul(s, NULL, 0); + sprom->gpio3 = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa0maxpwr"))) + if ((s = nvram_get("pa0maxpwr")))
+ sprom->maxpwr_bg = simple_strtoul(s, NULL, 0); + sprom->maxpwr_bg = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa1maxpwr"))) + if ((s = nvram_get("pa1maxpwr")))
+ sprom->maxpwr_a = simple_strtoul(s, NULL, 0); + sprom->maxpwr_a = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa0itssit"))) + if ((s = nvram_get("pa0itssit")))
+ sprom->itssi_bg = simple_strtoul(s, NULL, 0); + sprom->itssi_bg = simple_strtoul(s, NULL, 0);
+ if ((s = nvram_get("pa1itssit"))) + if ((s = nvram_get("pa1itssit")))
+ sprom->itssi_a = simple_strtoul(s, NULL, 0); + sprom->itssi_a = simple_strtoul(s, NULL, 0);
+ sprom->boardflags_lo = 0; + sprom->boardflags_lo = 0;
+ if ((s = nvram_get("boardflags"))) + if ((s = nvram_get("boardflags")))
+ sprom->boardflags_lo = simple_strtoul(s, NULL, 0); + sprom->boardflags_lo = simple_strtoul(s, NULL, 0);
+ sprom->boardflags_hi = 0; + sprom->boardflags_hi = 0;
+ if ((s = nvram_get("boardflags2"))) + if ((s = nvram_get("boardflags2")))
+ sprom->boardflags_hi = simple_strtoul(s, NULL, 0); + sprom->boardflags_hi = simple_strtoul(s, NULL, 0);
+} +}
+ +
+static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv) +static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv)
+{ {
+ char *s; - char buf[100];
+ char *s;
+
+ 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);
- /* Fill boardinfo structure */ - /* Fill boardinfo structure */
- memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); - memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
+ iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; + bcm47xx_fill_sprom(&iv->sprom);
+ 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);
- if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0) - if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0)
- iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); - iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
@ -218,10 +220,8 @@
- iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10); - iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
- if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0) - if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
- iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10); - iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
+ bcm47xx_fill_sprom(&iv->sprom); + if ((s = nvram_get("cardbus")))
+ + iv->has_cardbus_slot = !!simple_strtoul(s, NULL, 10);
+ if ((s = nvram_get("cardbus")))
+ iv->has_cardbus_slot = !!simple_strtoul(s, NULL, 10);
return 0; return 0;
} }
@ -229,51 +229,50 @@
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
{ {
- int err; - int err;
- + int i, err;
+ char *s;
+ struct ssb_mipscore *mcore;
+
+ 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";
+ printk(msg, err); /* Make sure the message gets out of the box. */
+ panic(msg, err);
+ }
+ mcore = &ssb_bcm47xx.mipscore;
- err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, - err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
- bcm47xx_get_invariants); - bcm47xx_get_invariants);
- if (err) - if (err)
- panic("Failed to initialize SSB bus (err %d)\n", err); - panic("Failed to initialize SSB bus (err %d)\n", err);
+ int i, err; + s = nvram_get("kernel_args");
+ char *s; + if (s && !strncmp(s, "console=ttyS1", 13)) {
+ struct ssb_mipscore *mcore; + struct ssb_serial_port port;
+ +
+ err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, bcm47xx_get_invariants); + printk("Swapping serial ports!\n");
+ if (err) { + /* swap serial ports */
+ const char *msg = "Failed to initialize SSB bus (err %d)\n"; + memcpy(&port, &mcore->serial_ports[0], sizeof(port));
+ printk(msg, err); /* Make sure the message gets out of the box. */ + memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], sizeof(port));
+ panic(msg, err); + memcpy(&mcore->serial_ports[1], &port, sizeof(port));
+ } + }
+ mcore = &ssb_bcm47xx.mipscore;
+ +
+ s = nvram_get("kernel_args"); + for (i = 0; i < mcore->nr_serial_ports; i++) {
+ if (s && !strncmp(s, "console=ttyS1", 13)) { + struct ssb_serial_port *port = &(mcore->serial_ports[i]);
+ struct ssb_serial_port port; + struct uart_port s;
+ +
+ printk("Swapping serial ports!\n"); + memset(&s, 0, sizeof(s));
+ /* swap serial ports */ + s.line = i;
+ memcpy(&port, &mcore->serial_ports[0], sizeof(port)); + s.mapbase = (unsigned int) port->regs;
+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], sizeof(port)); + s.membase = port->regs;
+ memcpy(&mcore->serial_ports[1], &port, sizeof(port)); + s.irq = port->irq + 2;
+ } + s.uartclk = port->baud_base;
+ s.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
+ s.iotype = SERIAL_IO_MEM;
+ s.regshift = port->reg_shift;
+ +
+ for (i = 0; i < mcore->nr_serial_ports; i++) { + early_serial_setup(&s);
+ struct ssb_serial_port *port = &(mcore->serial_ports[i]); + }
+ struct uart_port s; + printk("Serial init done.\n");
+
+ memset(&s, 0, sizeof(s));
+ s.line = i;
+ s.mapbase = (unsigned int) port->regs;
+ s.membase = port->regs;
+ s.irq = port->irq + 2;
+ s.uartclk = port->baud_base;
+ s.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
+ s.iotype = SERIAL_IO_MEM;
+ s.regshift = port->reg_shift;
+
+ early_serial_setup(&s);
+ }
+ printk("Serial init done.\n");
_machine_restart = bcm47xx_machine_restart; _machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt; _machine_halt = bcm47xx_machine_halt;
@ -282,18 +281,18 @@
+ +
+static int __init bcm47xx_register_gpiodev(void) +static int __init bcm47xx_register_gpiodev(void)
+{ +{
+ static struct resource res = { + static struct resource res = {
+ .start = 0xFFFFFFFF, + .start = 0xFFFFFFFF,
+ }; + };
+ struct platform_device *pdev; + struct platform_device *pdev;
+ +
+ pdev = platform_device_register_simple("GPIODEV", 0, &res, 1); + pdev = platform_device_register_simple("GPIODEV", 0, &res, 1);
+ if (!pdev) { + if (!pdev) {
+ printk(KERN_ERR "bcm47xx: GPIODEV init failed\n"); + printk(KERN_ERR "bcm47xx: GPIODEV init failed\n");
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
+ return 0; + return 0;
+} +}
+device_initcall(bcm47xx_register_gpiodev); +device_initcall(bcm47xx_register_gpiodev);
--- a/arch/mips/bcm47xx/time.c --- a/arch/mips/bcm47xx/time.c