#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
-@@ -190,12 +192,47 @@ static int bcm47xx_get_invariants(struct
+@@ -166,6 +168,31 @@ static int bcm47xx_get_invariants(struct
+ return 0;
+ }
- void __init plat_mem_setup(void)
- {
-- int err;
-+ int i, err;
-+ char buf[100];
-+ struct ssb_mipscore *mcore;
-
- err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
- bcm47xx_get_invariants);
- if (err)
- panic("Failed to initialize SSB bus (err %d)\n", err);
-+ mcore = &ssb_bcm47xx.mipscore;
-+
-+ if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
-+ if (strstr(buf, "console=ttyS1")) {
-+ struct ssb_serial_port port;
-+
-+ printk(KERN_DEBUG "Swapping serial ports!\n");
-+ /* swap serial ports */
-+ memcpy(&port, &mcore->serial_ports[0], sizeof(port));
-+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
-+ sizeof(port));
-+ memcpy(&mcore->serial_ports[1], &port, sizeof(port));
-+ }
-+ }
++#ifdef CONFIG_SERIAL_8250
++static void __init bcm47xx_early_serial_setup(struct ssb_mipscore *mcore)
++{
++ int i;
+
+ for (i = 0; i < mcore->nr_serial_ports; i++) {
+ struct ssb_serial_port *port = &(mcore->serial_ports[i]);
+ early_serial_setup(&s);
+ }
+ printk(KERN_DEBUG "Serial init done.\n");
++}
++#endif
++
+ void __init plat_mem_setup(void)
+ {
+ int err;
+@@ -191,6 +218,10 @@ void __init plat_mem_setup(void)
+ }
+ }
++#ifdef CONFIG_SERIAL_8250
++ bcm47xx_early_serial_setup(mcore);
++#endif
++
_machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt;
+ pm_power_off = bcm47xx_machine_halt;