3030#include <linux/tty.h>
3131#include <linux/serial_core.h>
3232#include <linux/platform_device.h>
33+ #include <linux/serial_8250.h>
3334
3435#include <asm/io.h>
3536#include <asm/irq.h>
@@ -132,7 +133,7 @@ void __init ixdp2x01_init_irq(void)
132133
133134
134135/*************************************************************************
135- * IXDP2x01 memory map and serial ports
136+ * IXDP2x01 memory map
136137 *************************************************************************/
137138static struct map_desc ixdp2x01_io_desc __initdata = {
138139 .virtual = IXDP2X01_VIRT_CPLD_BASE ,
@@ -141,40 +142,78 @@ static struct map_desc ixdp2x01_io_desc __initdata = {
141142 .type = MT_DEVICE
142143};
143144
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 [] = {
145156 {
146- .membase = (char * )(IXDP2X01_UART1_VIRT_BASE ),
147157 .mapbase = (unsigned long )IXDP2X01_UART1_PHYS_BASE ,
158+ .membase = (char * )IXDP2X01_UART1_VIRT_BASE ,
148159 .irq = IRQ_IXDP2X01_UART1 ,
149- .flags = UPF_SKIP_TEST ,
160+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST ,
150161 .iotype = UPIO_MEM32 ,
151162 .regshift = 2 ,
152163 .uartclk = IXDP2X01_UART_CLK ,
153- .line = 1 ,
154- .type = PORT_16550A ,
155- .fifosize = 16
156- }, {
157- .membase = (char * )(IXDP2X01_UART2_VIRT_BASE ),
164+ },
165+ { }
166+ };
167+
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+ {
158186 .mapbase = (unsigned long )IXDP2X01_UART2_PHYS_BASE ,
187+ .membase = (char * )IXDP2X01_UART2_VIRT_BASE ,
159188 .irq = IRQ_IXDP2X01_UART2 ,
160- .flags = UPF_SKIP_TEST ,
189+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST ,
161190 .iotype = UPIO_MEM32 ,
162191 .regshift = 2 ,
163192 .uartclk = IXDP2X01_UART_CLK ,
164- .line = 2 ,
165- .type = PORT_16550A ,
166- .fifosize = 16
167193 },
194+ { }
168195};
169196
170- static void __init ixdp2x01_map_io (void )
171- {
172- ixp2000_map_io ();
197+ static struct resource ixdp2x01_uart_resource2 = {
198+ .start = IXDP2X01_UART2_PHYS_BASE ,
199+ .end = IXDP2X01_UART2_PHYS_BASE + 0xffff ,
200+ .flags = IORESOURCE_MEM ,
201+ };
173202
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+ };
175212
176- early_serial_setup (& ixdp2x01_serial_ports [0 ]);
177- early_serial_setup (& ixdp2x01_serial_ports [1 ]);
213+ static void ixdp2x01_uart_init (void )
214+ {
215+ platform_device_register (& ixdp2x01_serial_device1 );
216+ platform_device_register (& ixdp2x01_serial_device2 );
178217}
179218
180219
@@ -374,6 +413,7 @@ static void __init ixdp2x01_init_machine(void)
374413
375414 platform_add_devices (ixdp2x01_devices , ARRAY_SIZE (ixdp2x01_devices ));
376415 ixp2000_uart_init ();
416+ ixdp2x01_uart_init ();
377417}
378418
379419
0 commit comments