diff options
author | Eugene Konev <ejka@openwrt.org> | 2007-05-06 13:30:38 +0000 |
---|---|---|
committer | Eugene Konev <ejka@openwrt.org> | 2007-05-06 13:30:38 +0000 |
commit | 2b6081bc39764186d58da6900a98831bbd7202cb (patch) | |
tree | 6c28a323f6df995073faab26db0df5bb3c2cb0a8 /target | |
parent | 0f2c3af3417f20048198989d421a9bf83b614cd0 (diff) | |
download | upstream-2b6081bc39764186d58da6900a98831bbd7202cb.tar.gz upstream-2b6081bc39764186d58da6900a98831bbd7202cb.tar.bz2 upstream-2b6081bc39764186d58da6900a98831bbd7202cb.zip |
Use console config from adam2/pspboot environment (#1623).
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7107 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ar7-2.6/config/default | 2 | ||||
-rw-r--r-- | target/linux/ar7-2.6/files/arch/mips/ar7/prom.c | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/target/linux/ar7-2.6/config/default b/target/linux/ar7-2.6/config/default index 3e97e88e35..6d0edccc2e 100644 --- a/target/linux/ar7-2.6/config/default +++ b/target/linux/ar7-2.6/config/default @@ -10,7 +10,7 @@ CONFIG_BASE_SMALL=0 # CONFIG_BLK_DEV_INITRD is not set CONFIG_BOOT_ELF32=y # CONFIG_BT is not set -CONFIG_CMDLINE="console=ttyS0,38400n8r init=/etc/preinit rootfstype=squashfs,jffs2," +CONFIG_CMDLINE="init=/etc/preinit rootfstype=squashfs,jffs2," CONFIG_CPMAC=y # CONFIG_CPU_BIG_ENDIAN is not set CONFIG_CPU_HAS_LLSC=y diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c b/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c index d19714c85b..99b528d447 100644 --- a/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c +++ b/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c @@ -232,11 +232,49 @@ 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; + + 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))) |