X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/6e38bb04576b38458e3c2b66edb72f875fc662a5..5df7ea93523bfa0e72424fe9a416588bd154bae1:/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c?ds=sidebyside 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 7176be302..99b528d44 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 @@ -47,7 +47,7 @@ struct psp_chip_map { /* I hate this. No. *I* *HATE* *THIS* */ static __initdata struct psp_chip_map psp_chip_map[] = { { - .chip = 0x5, + .chip = AR7_CHIP_7100, .names = { "dummy", "cpufrequency", "memsize", "flashsize", "modetty0", "modetty1", "prompt", @@ -65,7 +65,7 @@ static __initdata struct psp_chip_map psp_chip_map[] = { }, }, { - .chip = 0x18, + .chip = AR7_CHIP_7200, .names = { "dummy", "cpufrequency", "memsize", "flashsize", "modetty0", "modetty1", "prompt", @@ -83,7 +83,7 @@ static __initdata struct psp_chip_map psp_chip_map[] = { }, }, { - .chip = 0x2b, + .chip = AR7_CHIP_7300, .names = { "dummy", "cpufrequency", "memsize", "flashsize", "modetty0", "modetty1", "prompt", @@ -107,7 +107,7 @@ static __initdata struct psp_chip_map psp_chip_map[] = { static struct env_var adam2_env[MAX_ENTRY] = { { 0, }, }; -char * __init prom_getenv(char *name) +char * prom_getenv(char *name) { int i; for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++) @@ -186,7 +186,7 @@ static int __init parse_psp_env(void *start) char *src, *dest, *name, *value; struct psp_env_var *vars = start; - chip = get_chip_id(); + chip = ar7_chip_id(); for (map = psp_chip_map; map->chip; map++) if (map->chip == chip) break; @@ -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)))