Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / arm / mach-pnx4008 / serial.c
blob95a1b3f964a2ca60a56d7b6480fadaa6a7a13ad2
1 /*
2 * linux/arch/arm/mach-pnx4008/serial.c
4 * PNX4008 UART initialization
6 * Copyright: MontaVista Software Inc. (c) 2005
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
16 #include <asm/io.h>
18 #include <asm/arch/platform.h>
19 #include <asm/hardware.h>
21 #include <linux/serial_core.h>
22 #include <linux/serial_reg.h>
23 #include <asm/arch/gpio.h>
25 #include <asm/arch/clock.h>
27 #define UART_3 0
28 #define UART_4 1
29 #define UART_5 2
30 #define UART_6 3
31 #define UART_UNKNOWN (-1)
33 #define UART3_BASE_VA IO_ADDRESS(PNX4008_UART3_BASE)
34 #define UART4_BASE_VA IO_ADDRESS(PNX4008_UART4_BASE)
35 #define UART5_BASE_VA IO_ADDRESS(PNX4008_UART5_BASE)
36 #define UART6_BASE_VA IO_ADDRESS(PNX4008_UART6_BASE)
38 #define UART_FCR_OFFSET 8
39 #define UART_FIFO_SIZE 64
41 void pnx4008_uart_init(void)
43 u32 tmp;
44 int i = UART_FIFO_SIZE;
46 __raw_writel(0xC1, UART5_BASE_VA + UART_FCR_OFFSET);
47 __raw_writel(0xC1, UART3_BASE_VA + UART_FCR_OFFSET);
49 /* Send a NULL to fix the UART HW bug */
50 __raw_writel(0x00, UART5_BASE_VA);
51 __raw_writel(0x00, UART3_BASE_VA);
53 while (i--) {
54 tmp = __raw_readl(UART5_BASE_VA);
55 tmp = __raw_readl(UART3_BASE_VA);
57 __raw_writel(0, UART5_BASE_VA + UART_FCR_OFFSET);
58 __raw_writel(0, UART3_BASE_VA + UART_FCR_OFFSET);
60 /* setup wakeup interrupt */
61 start_int_set_rising_edge(SE_U3_RX_INT);
62 start_int_ack(SE_U3_RX_INT);
63 start_int_umask(SE_U3_RX_INT);
65 start_int_set_rising_edge(SE_U5_RX_INT);
66 start_int_ack(SE_U5_RX_INT);
67 start_int_umask(SE_U5_RX_INT);