X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=target%2Flinux%2Far7%2Ffiles%2Farch%2Fmips%2Far7%2Fsetup.c;h=f54aedc2a421403ea78e05015b2be0921e8250e7;hb=3241f2e6afb0144ecf5c9537989e3eaf7fab5612;hp=388557ff0d713530bf4230e71df84d25f8faeb7a;hpb=6485c8ba0a21f44100aa96123f2edd70fe9edbe6;p=openwrt-10.03%2F.git diff --git a/target/linux/ar7/files/arch/mips/ar7/setup.c b/target/linux/ar7/files/arch/mips/ar7/setup.c index 388557ff0..f54aedc2a 100644 --- a/target/linux/ar7/files/arch/mips/ar7/setup.c +++ b/target/linux/ar7/files/arch/mips/ar7/setup.c @@ -1,6 +1,4 @@ /* - * Copyright (C) 2006, 2007 OpenWrt.org - * * Carsten Langgaard, carstenl@mips.com * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * @@ -17,16 +15,22 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ +#include #include #include #include +#include +#include +#include -#include #include #include #include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) /* TODO remove when 2.6.24 is stable */ extern void ar7_time_init(void); +#endif static void ar7_machine_restart(char *command); static void ar7_machine_halt(void); static void ar7_machine_power_off(void); @@ -68,7 +72,40 @@ const char *get_system_type(void) static int __init ar7_init_console(void) { - return 0; + int res; + + static struct uart_port uart_port[2]; + + memset(uart_port, 0, sizeof(struct uart_port) * 2); + + uart_port[0].type = PORT_AR7; + uart_port[0].line = 0; + uart_port[0].irq = AR7_IRQ_UART0; + uart_port[0].uartclk = ar7_bus_freq() / 2; + uart_port[0].iotype = UPIO_MEM; + uart_port[0].mapbase = AR7_REGS_UART0; + uart_port[0].membase = ioremap(uart_port[0].mapbase, 256); + uart_port[0].regshift = 2; + res = early_serial_setup(&uart_port[0]); + if (res) + return res; + + /* Only TNETD73xx have a second serial port */ + if (ar7_has_second_uart()) { + uart_port[1].type = PORT_AR7; + uart_port[1].line = 1; + uart_port[1].irq = AR7_IRQ_UART1; + uart_port[1].uartclk = ar7_bus_freq() / 2; + uart_port[1].iotype = UPIO_MEM; + uart_port[1].mapbase = UR8_REGS_UART1; + uart_port[1].membase = ioremap(uart_port[1].mapbase, 256); + uart_port[1].regshift = 2; + res = early_serial_setup(&uart_port[1]); + if (res) + return res; + } + + return add_preferred_console("ttyS", 0, NULL); } /* @@ -85,7 +122,9 @@ void __init plat_mem_setup(void) _machine_restart = ar7_machine_restart; _machine_halt = ar7_machine_halt; pm_power_off = ar7_machine_power_off; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) /* TODO remove when 2.6.24 is stable */ board_time_init = ar7_time_init; +#endif panic_timeout = 3; io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);