aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/serial.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@mvista.com>2007-04-30 14:37:19 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-05-11 12:26:55 -0400
commit7c6337e225364870e9bf02a3ae277d9fdea483f8 (patch)
tree1ba5819dfc424beea0086cd3b855839be29370dd /arch/arm/mach-davinci/serial.c
parent7fdc7849d2f9f926cbaec224bbcbacb164b07b23 (diff)
[ARM] 4303/3: base kernel support for TI DaVinci
Add base kernel support for the TI DaVinci platform. This patch only includes interrupts, timers, CPU identification, serial support and basic power and sleep controller init. More drivers to come. Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-davinci/serial.c')
-rw-r--r--arch/arm/mach-davinci/serial.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
new file mode 100644
index 000000000000..8368c93c788d
--- /dev/null
+++ b/arch/arm/mach-davinci/serial.c
@@ -0,0 +1,96 @@
1/*
2 * TI DaVinci serial driver
3 *
4 * Copyright (C) 2006 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/serial_8250.h>
25#include <linux/serial_reg.h>
26#include <linux/platform_device.h>
27#include <linux/delay.h>
28#include <linux/clk.h>
29
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/hardware.h>
33#include <asm/arch/serial.h>
34#include <asm/arch/irqs.h>
35
36#define UART_DAVINCI_PWREMU 0x0c
37
38static inline unsigned int davinci_serial_in(struct plat_serial8250_port *up,
39 int offset)
40{
41 offset <<= up->regshift;
42 return (unsigned int)__raw_readb(up->membase + offset);
43}
44
45static inline void davinci_serial_outp(struct plat_serial8250_port *p,
46 int offset, int value)
47{
48 offset <<= p->regshift;
49 __raw_writeb(value, p->membase + offset);
50}
51
52static struct plat_serial8250_port serial_platform_data[] = {
53 {
54 .membase = (char *)IO_ADDRESS(DAVINCI_UART0_BASE),
55 .mapbase = (unsigned long)DAVINCI_UART0_BASE,
56 .irq = IRQ_UARTINT0,
57 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
58 .iotype = UPIO_MEM,
59 .regshift = 2,
60 .uartclk = 27000000,
61 },
62 {
63 .flags = 0
64 },
65};
66
67static struct platform_device serial_device = {
68 .name = "serial8250",
69 .id = PLAT8250_DEV_PLATFORM,
70 .dev = {
71 .platform_data = serial_platform_data,
72 },
73};
74
75static void __init davinci_serial_reset(struct plat_serial8250_port *p)
76{
77 /* reset both transmitter and receiver: bits 14,13 = UTRST, URRST */
78 unsigned int pwremu = 0;
79
80 davinci_serial_outp(p, UART_IER, 0); /* disable all interrupts */
81
82 davinci_serial_outp(p, UART_DAVINCI_PWREMU, pwremu);
83 mdelay(10);
84
85 pwremu |= (0x3 << 13);
86 pwremu |= 0x1;
87 davinci_serial_outp(p, UART_DAVINCI_PWREMU, pwremu);
88}
89
90static int __init davinci_init(void)
91{
92 davinci_serial_reset(&serial_platform_data[0]);
93 return platform_device_register(&serial_device);
94}
95
96arch_initcall(davinci_init);