xtensa: platform: s6105
[linux-2.6.git] / arch / xtensa / platforms / s6105 / device.c
1 /*
2  * s6105 platform devices
3  *
4  * Copyright (c) 2009 emlix GmbH
5  */
6
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/platform_device.h>
10 #include <linux/serial.h>
11 #include <linux/serial_8250.h>
12
13 #include <variant/hardware.h>
14
15 #define UART_INTNUM             4
16
17 static const signed char uart_irq_mappings[] = {
18         S6_INTC_UART(0),
19         S6_INTC_UART(1),
20         -1,
21 };
22
23 const signed char *platform_irq_mappings[NR_IRQS] = {
24         [UART_INTNUM] = uart_irq_mappings,
25 };
26
27 static struct plat_serial8250_port serial_platform_data[] = {
28         {
29                 .membase = (void *)S6_REG_UART + 0x0000,
30                 .mapbase = S6_REG_UART + 0x0000,
31                 .irq = UART_INTNUM,
32                 .uartclk = S6_SCLK,
33                 .regshift = 2,
34                 .iotype = SERIAL_IO_MEM,
35                 .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
36         },
37         {
38                 .membase = (void *)S6_REG_UART + 0x1000,
39                 .mapbase = S6_REG_UART + 0x1000,
40                 .irq = UART_INTNUM,
41                 .uartclk = S6_SCLK,
42                 .regshift = 2,
43                 .iotype = SERIAL_IO_MEM,
44                 .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
45         },
46         { },
47 };
48
49 static struct platform_device platform_devices[] = {
50         {
51                 .name = "serial8250",
52                 .id = PLAT8250_DEV_PLATFORM,
53                 .dev = {
54                         .platform_data = serial_platform_data,
55                 },
56         },
57 };
58
59 static int __init device_init(void)
60 {
61         int i;
62
63         for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
64                 platform_device_register(&platform_devices[i]);
65         return 0;
66 }
67 arch_initcall_sync(device_init);