aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-davinci/serial.c')
-rw-r--r--arch/arm/mach-davinci/serial.c74
1 files changed, 10 insertions, 64 deletions
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 695075796522..c530c7333d0a 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -33,6 +33,8 @@
33#include <mach/serial.h> 33#include <mach/serial.h>
34#include <mach/irqs.h> 34#include <mach/irqs.h>
35#include <mach/cputype.h> 35#include <mach/cputype.h>
36#include <mach/common.h>
37
36#include "clock.h" 38#include "clock.h"
37 39
38static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, 40static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
@@ -49,44 +51,6 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
49 __raw_writel(value, IO_ADDRESS(p->mapbase) + offset); 51 __raw_writel(value, IO_ADDRESS(p->mapbase) + offset);
50} 52}
51 53
52static struct plat_serial8250_port serial_platform_data[] = {
53 {
54 .mapbase = DAVINCI_UART0_BASE,
55 .irq = IRQ_UARTINT0,
56 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
57 UPF_IOREMAP,
58 .iotype = UPIO_MEM,
59 .regshift = 2,
60 },
61 {
62 .mapbase = DAVINCI_UART1_BASE,
63 .irq = IRQ_UARTINT1,
64 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
65 UPF_IOREMAP,
66 .iotype = UPIO_MEM,
67 .regshift = 2,
68 },
69 {
70 .mapbase = DAVINCI_UART2_BASE,
71 .irq = IRQ_UARTINT2,
72 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
73 UPF_IOREMAP,
74 .iotype = UPIO_MEM,
75 .regshift = 2,
76 },
77 {
78 .flags = 0
79 },
80};
81
82static struct platform_device serial_device = {
83 .name = "serial8250",
84 .id = PLAT8250_DEV_PLATFORM,
85 .dev = {
86 .platform_data = serial_platform_data,
87 },
88};
89
90static void __init davinci_serial_reset(struct plat_serial8250_port *p) 54static void __init davinci_serial_reset(struct plat_serial8250_port *p)
91{ 55{
92 unsigned int pwremu = 0; 56 unsigned int pwremu = 0;
@@ -106,35 +70,22 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
106 UART_DM646X_SCR_TX_WATERMARK); 70 UART_DM646X_SCR_TX_WATERMARK);
107} 71}
108 72
109void __init davinci_serial_init(struct davinci_uart_config *info) 73int __init davinci_serial_init(struct davinci_uart_config *info)
110{ 74{
111 int i; 75 int i;
112 char name[16]; 76 char name[16];
113 struct clk *uart_clk; 77 struct clk *uart_clk;
114 struct device *dev = &serial_device.dev; 78 struct davinci_soc_info *soc_info = &davinci_soc_info;
79 struct device *dev = &soc_info->serial_dev->dev;
80 struct plat_serial8250_port *p = dev->platform_data;
115 81
116 /* 82 /*
117 * Make sure the serial ports are muxed on at this point. 83 * Make sure the serial ports are muxed on at this point.
118 * You have to mux them off in device drivers later on 84 * You have to mux them off in device drivers later on if not needed.
119 * if not needed.
120 */ 85 */
121 for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++) { 86 for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++, p++) {
122 struct plat_serial8250_port *p = serial_platform_data + i; 87 if (!(info->enabled_uarts & (1 << i)))
123
124 if (!(info->enabled_uarts & (1 << i))) {
125 p->flags = 0;
126 continue; 88 continue;
127 }
128
129 if (cpu_is_davinci_dm646x())
130 p->iotype = UPIO_MEM32;
131
132 if (cpu_is_davinci_dm355()) {
133 if (i == 2) {
134 p->mapbase = (unsigned long)DM355_UART2_BASE;
135 p->irq = IRQ_DM355_UARTINT2;
136 }
137 }
138 89
139 sprintf(name, "uart%d", i); 90 sprintf(name, "uart%d", i);
140 uart_clk = clk_get(dev, name); 91 uart_clk = clk_get(dev, name);
@@ -147,11 +98,6 @@ void __init davinci_serial_init(struct davinci_uart_config *info)
147 davinci_serial_reset(p); 98 davinci_serial_reset(p);
148 } 99 }
149 } 100 }
150}
151 101
152static int __init davinci_init(void) 102 return platform_device_register(soc_info->serial_dev);
153{
154 return platform_device_register(&serial_device);
155} 103}
156
157arch_initcall(davinci_init);