e6a0d526b361c54dc07da63cb23f98567b44f495
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.36 / 013-MIPS-BCM47xx-Swap-serial-console-if-ttyS1-was-specif.patch
1 From 25abc0cde3f4865910b380d68ffda0916b5870e7 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 27 Nov 2010 12:25:21 +0100
4 Subject: [PATCH 4/6] MIPS: BCM47xx: Swap serial console if ttyS1 was specified.
5
6 Some devices like the Netgear WGT634U are using ttyS1 for default
7 console output. We should switch to that console if it was given in
8 the kernel_args parameters.
9
10 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 ---
12 arch/mips/bcm47xx/setup.c | 16 ++++++++++++++++
13 1 files changed, 16 insertions(+), 0 deletions(-)
14
15 --- a/arch/mips/bcm47xx/setup.c
16 +++ b/arch/mips/bcm47xx/setup.c
17 @@ -169,12 +169,28 @@ static int bcm47xx_get_invariants(struct
18 void __init plat_mem_setup(void)
19 {
20 int err;
21 + char buf[100];
22 + struct ssb_mipscore *mcore;
23
24 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
25 bcm47xx_get_invariants);
26 if (err)
27 panic("Failed to initialize SSB bus (err %d)\n", err);
28
29 + mcore = &ssb_bcm47xx.mipscore;
30 + if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
31 + if (strstr(buf, "console=ttyS1")) {
32 + struct ssb_serial_port port;
33 +
34 + printk(KERN_DEBUG "Swapping serial ports!\n");
35 + /* swap serial ports */
36 + memcpy(&port, &mcore->serial_ports[0], sizeof(port));
37 + memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
38 + sizeof(port));
39 + memcpy(&mcore->serial_ports[1], &port, sizeof(port));
40 + }
41 + }
42 +
43 _machine_restart = bcm47xx_machine_restart;
44 _machine_halt = bcm47xx_machine_halt;
45 pm_power_off = bcm47xx_machine_halt;