add ar7-2.6 fixes by Stefan Weil
[openwrt.git] / target / linux / ar7-2.6 / files / arch / mips / ar7 / prom.c
index d19714c..38037dd 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/io.h>
 #include <asm/bootinfo.h>
 #include <asm/mips-boards/prom.h>
+#include <asm/gdb-stub.h>
 
 #include <asm/ar7/ar7.h>
 
@@ -232,11 +233,54 @@ static void __init ar7_init_env(struct env_var *env)
        }
 }
 
+static void __init console_config(void)
+{
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+       char console_string[40];
+       int baud = 0;
+       char parity = '\0', bits = '\0', flow = '\0';
+       char *s, *p;
+
+       if (strstr(prom_getcmdline(), "console="))
+               return;
+
+#ifdef CONFIG_KGDB
+       strcat(prom_getcmdline(), " console=kgdb");
+       kgdb_enabled = 1;
+       return;
+#endif
+
+       if ((s = prom_getenv("modetty0"))) {
+               baud = simple_strtoul(s, &p, 10);
+               s = p;
+               if (*s == ',') s++;
+               if (*s) parity = *s++;
+               if (*s == ',') s++;
+               if (*s) bits = *s++;
+               if (*s == ',') s++;
+               if (*s == 'h') flow = 'r';
+       }
+
+       if (baud == 0)
+               baud = 38400;
+       if (parity != 'n' && parity != 'o' && parity != 'e')
+               parity = 'n';
+       if (bits != '7' && bits != '8')
+               bits = '8';
+       if (flow == '\0')
+               flow = 'r';
+
+       sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
+               parity, bits, flow);
+       strcat(prom_getcmdline(), console_string);
+#endif
+}
+
 void __init prom_init(void)
 {
-       prom_printf("\nLINUX running...\n");
        ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
        ar7_init_env((struct env_var *)fw_arg2);
+       console_config();
 }
 
 #define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))
@@ -263,4 +307,16 @@ int prom_putchar(char c)
        return 1;
 }
 
+#ifdef CONFIG_KGDB
+int putDebugChar(char c)
+{
+       return prom_putchar(c);
+}
+
+char getDebugChar(void)
+{
+       return prom_getchar();
+}
+#endif
+
 EXPORT_SYMBOL(prom_getenv);
This page took 0.025369 seconds and 4 git commands to generate.