diff options
| author | Lennert Buytenhek <buytenh@wantstofly.org> | 2006-03-25 18:03:13 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-03-25 18:03:13 -0500 |
| commit | 104c7b03ea0913a24be103db66d8cf1f1f99a49a (patch) | |
| tree | de9a2584e7a9c36a875e2e16d5d7ee7a7ee60de7 | |
| parent | 98639a67a9482fbfc4f9c91b4b59bf0d06b1f6c1 (diff) | |
[ARM] 3383/3: ixp2000: ixdp2x01 platform serial conversion
Patch from Lennert Buytenhek
Add a PLAT8250_DEV_PLATFORM2, and convert the two ixdp2x01 CPLD serial
ports to use platform serial devices with ids PLAT8250_DEV_PLATFORM[12].
(The on-chip xscale UART is PLAT8250_DEV_PLATFORM, id #0.)
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/mach-ixp2000/ixdp2x01.c | 78 | ||||
| -rw-r--r-- | include/linux/serial_8250.h | 1 |
2 files changed, 60 insertions, 19 deletions
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c index f9d4968c1d66..66915282a463 100644 --- a/arch/arm/mach-ixp2000/ixdp2x01.c +++ b/arch/arm/mach-ixp2000/ixdp2x01.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/tty.h> | 30 | #include <linux/tty.h> |
| 31 | #include <linux/serial_core.h> | 31 | #include <linux/serial_core.h> |
| 32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
| 33 | #include <linux/serial_8250.h> | ||
| 33 | 34 | ||
| 34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
| 35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
| @@ -132,7 +133,7 @@ void __init ixdp2x01_init_irq(void) | |||
| 132 | 133 | ||
| 133 | 134 | ||
| 134 | /************************************************************************* | 135 | /************************************************************************* |
| 135 | * IXDP2x01 memory map and serial ports | 136 | * IXDP2x01 memory map |
| 136 | *************************************************************************/ | 137 | *************************************************************************/ |
| 137 | static struct map_desc ixdp2x01_io_desc __initdata = { | 138 | static struct map_desc ixdp2x01_io_desc __initdata = { |
| 138 | .virtual = IXDP2X01_VIRT_CPLD_BASE, | 139 | .virtual = IXDP2X01_VIRT_CPLD_BASE, |
| @@ -141,40 +142,78 @@ static struct map_desc ixdp2x01_io_desc __initdata = { | |||
| 141 | .type = MT_DEVICE | 142 | .type = MT_DEVICE |
| 142 | }; | 143 | }; |
| 143 | 144 | ||
| 144 | static struct uart_port ixdp2x01_serial_ports[2] = { | 145 | static void __init ixdp2x01_map_io(void) |
| 146 | { | ||
| 147 | ixp2000_map_io(); | ||
| 148 | iotable_init(&ixdp2x01_io_desc, 1); | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | /************************************************************************* | ||
| 153 | * IXDP2x01 serial ports | ||
| 154 | *************************************************************************/ | ||
| 155 | static struct plat_serial8250_port ixdp2x01_serial_port1[] = { | ||
| 145 | { | 156 | { |
| 146 | .membase = (char *)(IXDP2X01_UART1_VIRT_BASE), | ||
| 147 | .mapbase = (unsigned long)IXDP2X01_UART1_PHYS_BASE, | 157 | .mapbase = (unsigned long)IXDP2X01_UART1_PHYS_BASE, |
| 158 | .membase = (char *)IXDP2X01_UART1_VIRT_BASE, | ||
| 148 | .irq = IRQ_IXDP2X01_UART1, | 159 | .irq = IRQ_IXDP2X01_UART1, |
| 149 | .flags = UPF_SKIP_TEST, | 160 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 150 | .iotype = UPIO_MEM32, | 161 | .iotype = UPIO_MEM32, |
| 151 | .regshift = 2, | 162 | .regshift = 2, |
| 152 | .uartclk = IXDP2X01_UART_CLK, | 163 | .uartclk = IXDP2X01_UART_CLK, |
| 153 | .line = 1, | 164 | }, |
| 154 | .type = PORT_16550A, | 165 | { } |
| 155 | .fifosize = 16 | 166 | }; |
| 156 | }, { | 167 | |
| 157 | .membase = (char *)(IXDP2X01_UART2_VIRT_BASE), | 168 | static struct resource ixdp2x01_uart_resource1 = { |
| 169 | .start = IXDP2X01_UART1_PHYS_BASE, | ||
| 170 | .end = IXDP2X01_UART1_PHYS_BASE + 0xffff, | ||
| 171 | .flags = IORESOURCE_MEM, | ||
| 172 | }; | ||
| 173 | |||
| 174 | static struct platform_device ixdp2x01_serial_device1 = { | ||
| 175 | .name = "serial8250", | ||
| 176 | .id = PLAT8250_DEV_PLATFORM1, | ||
| 177 | .dev = { | ||
| 178 | .platform_data = ixdp2x01_serial_port1, | ||
| 179 | }, | ||
| 180 | .num_resources = 1, | ||
| 181 | .resource = &ixdp2x01_uart_resource1, | ||
| 182 | }; | ||
| 183 | |||
| 184 | static struct plat_serial8250_port ixdp2x01_serial_port2[] = { | ||
| 185 | { | ||
| 158 | .mapbase = (unsigned long)IXDP2X01_UART2_PHYS_BASE, | 186 | .mapbase = (unsigned long)IXDP2X01_UART2_PHYS_BASE, |
| 187 | .membase = (char *)IXDP2X01_UART2_VIRT_BASE, | ||
| 159 | .irq = IRQ_IXDP2X01_UART2, | 188 | .irq = IRQ_IXDP2X01_UART2, |
| 160 | .flags = UPF_SKIP_TEST, | 189 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 161 | .iotype = UPIO_MEM32, | 190 | .iotype = UPIO_MEM32, |
| 162 | .regshift = 2, | 191 | .regshift = 2, |
| 163 | .uartclk = IXDP2X01_UART_CLK, | 192 | .uartclk = IXDP2X01_UART_CLK, |
| 164 | .line = 2, | ||
| 165 | .type = PORT_16550A, | ||
| 166 | .fifosize = 16 | ||
| 167 | }, | 193 | }, |
| 194 | { } | ||
| 168 | }; | 195 | }; |
| 169 | 196 | ||
| 170 | static void __init ixdp2x01_map_io(void) | 197 | static struct resource ixdp2x01_uart_resource2 = { |
| 171 | { | 198 | .start = IXDP2X01_UART2_PHYS_BASE, |
| 172 | ixp2000_map_io(); | 199 | .end = IXDP2X01_UART2_PHYS_BASE + 0xffff, |
| 200 | .flags = IORESOURCE_MEM, | ||
| 201 | }; | ||
| 173 | 202 | ||
| 174 | iotable_init(&ixdp2x01_io_desc, 1); | 203 | static struct platform_device ixdp2x01_serial_device2 = { |
| 204 | .name = "serial8250", | ||
| 205 | .id = PLAT8250_DEV_PLATFORM2, | ||
| 206 | .dev = { | ||
| 207 | .platform_data = ixdp2x01_serial_port2, | ||
| 208 | }, | ||
| 209 | .num_resources = 1, | ||
| 210 | .resource = &ixdp2x01_uart_resource2, | ||
| 211 | }; | ||
| 175 | 212 | ||
| 176 | early_serial_setup(&ixdp2x01_serial_ports[0]); | 213 | static void ixdp2x01_uart_init(void) |
| 177 | early_serial_setup(&ixdp2x01_serial_ports[1]); | 214 | { |
| 215 | platform_device_register(&ixdp2x01_serial_device1); | ||
| 216 | platform_device_register(&ixdp2x01_serial_device2); | ||
| 178 | } | 217 | } |
| 179 | 218 | ||
| 180 | 219 | ||
| @@ -374,6 +413,7 @@ static void __init ixdp2x01_init_machine(void) | |||
| 374 | 413 | ||
| 375 | platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices)); | 414 | platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices)); |
| 376 | ixp2000_uart_init(); | 415 | ixp2000_uart_init(); |
| 416 | ixdp2x01_uart_init(); | ||
| 377 | } | 417 | } |
| 378 | 418 | ||
| 379 | 419 | ||
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 73b464f0926a..8e9681413726 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -37,6 +37,7 @@ enum { | |||
| 37 | PLAT8250_DEV_LEGACY = -1, | 37 | PLAT8250_DEV_LEGACY = -1, |
| 38 | PLAT8250_DEV_PLATFORM, | 38 | PLAT8250_DEV_PLATFORM, |
| 39 | PLAT8250_DEV_PLATFORM1, | 39 | PLAT8250_DEV_PLATFORM1, |
| 40 | PLAT8250_DEV_PLATFORM2, | ||
| 40 | PLAT8250_DEV_FOURPORT, | 41 | PLAT8250_DEV_FOURPORT, |
| 41 | PLAT8250_DEV_ACCENT, | 42 | PLAT8250_DEV_ACCENT, |
| 42 | PLAT8250_DEV_BOCA, | 43 | PLAT8250_DEV_BOCA, |
