diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-12 21:11:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-12 21:11:33 -0400 |
commit | f7d02ae76ebbf5b8a9531fe150c49e126a397704 (patch) | |
tree | bcfdcab6e70658d55a3c843694e04e938bf9168f /arch/arm/mach-davinci/serial.c | |
parent | 78db2ad6f4df9145bfd6aab1c0f1c56d615288ec (diff) | |
parent | 158304ef09a28c7f2dd37d78f536a4e09ba084a1 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (30 commits)
[ARM] Use new get_irqnr_preamble
[ARM] Ensure machine class menu is sorted alphabetically
[ARM] 4333/2: KS8695: Micrel Development board
[ARM] 4332/2: KS8695: Serial driver
[ARM] 4331/3: Support for Micrel/Kendin KS8695 processor
[ARM] 4371/1: AT91: Support for Atmel AT91SAM9RL-EK development board
[ARM] 4372/1: Define byte sizes in asm-arm/sizes.h
[ARM] 4370/3: AT91: Support for Atmel AT91SAM9RL processors.
[ARM] Update mach-types
[ARM] export symbol csum_partial_copy_from_user
[ARM] iop13xx: msi support
[ARM] stacktrace fix
[ARM] Spinlock initializer cleanup
[ARM] remove useless config option GENERIC_BUST_SPINLOCK
[ARM] 4303/3: base kernel support for TI DaVinci
[ARM] 4369/1: AT91: Fix circular dependency in header files
[ARM] 4368/1: S3C24xx: build fix
[ARM] 4364/1: AT91: LEDS on AT91SAM9261-EK
[ARM] Fix iop32x/iop33x build
[ARM] EBSA110: fix build errors caused by missing "const"
...
Diffstat (limited to 'arch/arm/mach-davinci/serial.c')
-rw-r--r-- | arch/arm/mach-davinci/serial.c | 96 |
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 | |||
38 | static 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 | |||
45 | static 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 | |||
52 | static 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 | |||
67 | static struct platform_device serial_device = { | ||
68 | .name = "serial8250", | ||
69 | .id = PLAT8250_DEV_PLATFORM, | ||
70 | .dev = { | ||
71 | .platform_data = serial_platform_data, | ||
72 | }, | ||
73 | }; | ||
74 | |||
75 | static 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 | |||
90 | static int __init davinci_init(void) | ||
91 | { | ||
92 | davinci_serial_reset(&serial_platform_data[0]); | ||
93 | return platform_device_register(&serial_device); | ||
94 | } | ||
95 | |||
96 | arch_initcall(davinci_init); | ||