1 From 09ebc2952d9d3df6b9c548d9943dc8bcffb87540 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
6 Swap the first and second serial if console=ttyS1 was set.
7 Set it up and register it for early serial support.
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 arch/mips/Kconfig | 1 -
12 arch/mips/bcm47xx/setup.c | 36 +++++++++++++++++++++++++++++++++++-
13 2 files changed, 35 insertions(+), 2 deletions(-)
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
21 - select SYS_HAS_EARLY_PRINTK
24 Support for BCM47XX based boards
25 --- a/arch/mips/bcm47xx/setup.c
26 +++ b/arch/mips/bcm47xx/setup.c
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>
36 @@ -184,12 +186,44 @@ static int bcm47xx_get_invariants(struct
38 void __init plat_mem_setup(void)
43 + struct ssb_mipscore *mcore;
45 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
46 bcm47xx_get_invariants);
48 panic("Failed to initialize SSB bus (err %d)\n", err);
49 + mcore = &ssb_bcm47xx.mipscore;
51 + nvram_getenv("kernel_args", buf, sizeof(buf));
52 + if (!strncmp(buf, "console=ttyS1", 13)) {
53 + struct ssb_serial_port port;
55 + printk("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], sizeof(port));
59 + memcpy(&mcore->serial_ports[1], &port, sizeof(port));
62 + for (i = 0; i < mcore->nr_serial_ports; i++) {
63 + struct ssb_serial_port *port = &(mcore->serial_ports[i]);
66 + memset(&s, 0, sizeof(s));
68 + s.mapbase = (unsigned int) port->regs;
69 + s.membase = port->regs;
70 + s.irq = port->irq + 2;
71 + s.uartclk = port->baud_base;
72 + s.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
73 + s.iotype = SERIAL_IO_MEM;
74 + s.regshift = port->reg_shift;
76 + early_serial_setup(&s);
78 + printk("Serial init done.\n");
80 _machine_restart = bcm47xx_machine_restart;
81 _machine_halt = bcm47xx_machine_halt;