1 From 3902bba103634d3256dac557020d7974f0d08aff 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 | 37 ++++++++++++++++++++++++++++++++++++-
13 2 files changed, 36 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 @@ -189,12 +191,45 @@ 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(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],
60 + memcpy(&mcore->serial_ports[1], &port, sizeof(port));
63 + for (i = 0; i < mcore->nr_serial_ports; i++) {
64 + struct ssb_serial_port *port = &(mcore->serial_ports[i]);
67 + memset(&s, 0, sizeof(s));
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;
77 + early_serial_setup(&s);
79 + printk(KERN_DEBUG "Serial init done.\n");
81 _machine_restart = bcm47xx_machine_restart;
82 _machine_halt = bcm47xx_machine_halt;