brcm47xx: fill the whole sprom with data
[openwrt.git] / target / linux / brcm47xx / patches-2.6.35 / 014-MIPS-BCM47xx-Setup-and-register-serial-early.patch
1 From a41121d789e236fd637ab49beb5ce7b48763613a Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 18 Jul 2010 14:59:24 +0200
4 Subject: [PATCH 4/5] MIPS: BCM47xx: Setup and register serial early
5
6 Swap the first and second serial if console=ttyS1 was set.
7 Set it up and register it for early serial support.
8
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
10 ---
11 arch/mips/Kconfig | 1 -
12 arch/mips/bcm47xx/setup.c | 37 ++++++++++++++++++++++++++++++++++++-
13 2 files changed, 36 insertions(+), 2 deletions(-)
14
15 --- a/arch/mips/Kconfig
16 +++ b/arch/mips/Kconfig
17 @@ -65,7 +65,6 @@ config BCM47XX
18 select SSB_B43_PCI_BRIDGE if PCI
19 select SSB_PCICORE_HOSTMODE if PCI
20 select GENERIC_GPIO
21 - select SYS_HAS_EARLY_PRINTK
22 select CFE
23 help
24 Support for BCM47XX based boards
25 --- a/arch/mips/bcm47xx/setup.c
26 +++ b/arch/mips/bcm47xx/setup.c
27 @@ -28,6 +28,8 @@
28 #include <linux/types.h>
29 #include <linux/ssb/ssb.h>
30 #include <linux/ssb/ssb_embedded.h>
31 +#include <linux/serial.h>
32 +#include <linux/serial_8250.h>
33 #include <asm/bootinfo.h>
34 #include <asm/reboot.h>
35 #include <asm/time.h>
36 @@ -190,12 +192,45 @@ static int bcm47xx_get_invariants(struct
37
38 void __init plat_mem_setup(void)
39 {
40 - int err;
41 + int i, err;
42 + char buf[100];
43 + struct ssb_mipscore *mcore;
44
45 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
46 bcm47xx_get_invariants);
47 if (err)
48 panic("Failed to initialize SSB bus (err %d)\n", err);
49 + mcore = &ssb_bcm47xx.mipscore;
50 +
51 + nvram_getenv("kernel_args", buf, sizeof(buf));
52 + if (!strncmp(buf, "console=ttyS1", 13)) {
53 + struct ssb_serial_port port;
54 +
55 + printk(KERN_DEBUG "Swapping serial ports!\n");
56 + /* swap serial ports */
57 + memcpy(&port, &mcore->serial_ports[0], sizeof(port));
58 + memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
59 + sizeof(port));
60 + memcpy(&mcore->serial_ports[1], &port, sizeof(port));
61 + }
62 +
63 + for (i = 0; i < mcore->nr_serial_ports; i++) {
64 + struct ssb_serial_port *port = &(mcore->serial_ports[i]);
65 + struct uart_port s;
66 +
67 + memset(&s, 0, sizeof(s));
68 + s.line = i;
69 + s.mapbase = (unsigned int) port->regs;
70 + s.membase = port->regs;
71 + s.irq = port->irq + 2;
72 + s.uartclk = port->baud_base;
73 + s.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
74 + s.iotype = SERIAL_IO_MEM;
75 + s.regshift = port->reg_shift;
76 +
77 + early_serial_setup(&s);
78 + }
79 + printk(KERN_DEBUG "Serial init done.\n");
80
81 _machine_restart = bcm47xx_machine_restart;
82 _machine_halt = bcm47xx_machine_halt;
This page took 0.050164 seconds and 5 git commands to generate.