Pull release into acpica branch
[pandora-kernel.git] / arch / mips / philips / pnx8550 / common / platform.c
1 /*
2  * Platform device support for Philips PNX8550 SoCs
3  *
4  * Copyright 2005, Embedded Alley Solutions, Inc
5  *
6  * Based on arch/mips/au1000/common/platform.c
7  * Platform device support for Au1x00 SoCs.
8  *
9  * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
10  *
11  * This file is licensed under the terms of the GNU General Public
12  * License version 2.  This program is licensed "as is" without any
13  * warranty of any kind, whether express or implied.
14  */
15 #include <linux/device.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/resource.h>
19 #include <linux/serial.h>
20 #include <linux/serial_ip3106.h>
21
22 #include <int.h>
23 #include <usb.h>
24 #include <uart.h>
25
26 extern struct uart_ops ip3106_pops;
27
28 static struct resource pnx8550_usb_ohci_resources[] = {
29         [0] = {
30                 .start          = PNX8550_USB_OHCI_OP_BASE,
31                 .end            = PNX8550_USB_OHCI_OP_BASE +
32                                   PNX8550_USB_OHCI_OP_LEN,
33                 .flags          = IORESOURCE_MEM,
34         },
35         [1] = {
36                 .start          = PNX8550_INT_USB,
37                 .end            = PNX8550_INT_USB,
38                 .flags          = IORESOURCE_IRQ,
39         },
40 };
41
42 static struct resource pnx8550_uart_resources[] = {
43         [0] = {
44                 .start          = PNX8550_UART_PORT0,
45                 .end            = PNX8550_UART_PORT0 + 0xfff,
46                 .flags          = IORESOURCE_MEM,
47         },
48         [1] = {
49                 .start          = PNX8550_UART_INT(0),
50                 .end            = PNX8550_UART_INT(0),
51                 .flags          = IORESOURCE_IRQ,
52         },
53         [2] = {
54                 .start          = PNX8550_UART_PORT1,
55                 .end            = PNX8550_UART_PORT1 + 0xfff,
56                 .flags          = IORESOURCE_MEM,
57         },
58         [3] = {
59                 .start          = PNX8550_UART_INT(1),
60                 .end            = PNX8550_UART_INT(1),
61                 .flags          = IORESOURCE_IRQ,
62         },
63 };
64
65 struct ip3106_port ip3106_ports[] = {
66         [0] = {
67                 .port   = {
68                         .type           = PORT_IP3106,
69                         .iotype         = SERIAL_IO_MEM,
70                         .membase        = (void __iomem *)PNX8550_UART_PORT0,
71                         .mapbase        = PNX8550_UART_PORT0,
72                         .irq            = PNX8550_UART_INT(0),
73                         .uartclk        = 3692300,
74                         .fifosize       = 16,
75                         .ops            = &ip3106_pops,
76                         .flags          = ASYNC_BOOT_AUTOCONF,
77                         .line           = 0,
78                 },
79         },
80         [1] = {
81                 .port   = {
82                         .type           = PORT_IP3106,
83                         .iotype         = SERIAL_IO_MEM,
84                         .membase        = (void __iomem *)PNX8550_UART_PORT1,
85                         .mapbase        = PNX8550_UART_PORT1,
86                         .irq            = PNX8550_UART_INT(1),
87                         .uartclk        = 3692300,
88                         .fifosize       = 16,
89                         .ops            = &ip3106_pops,
90                         .flags          = ASYNC_BOOT_AUTOCONF,
91                         .line           = 1,
92                 },
93         },
94 };
95
96 /* The dmamask must be set for OHCI to work */
97 static u64 ohci_dmamask = ~(u32)0;
98
99 static u64 uart_dmamask = ~(u32)0;
100
101 static struct platform_device pnx8550_usb_ohci_device = {
102         .name           = "pnx8550-ohci",
103         .id             = -1,
104         .dev = {
105                 .dma_mask               = &ohci_dmamask,
106                 .coherent_dma_mask      = 0xffffffff,
107         },
108         .num_resources  = ARRAY_SIZE(pnx8550_usb_ohci_resources),
109         .resource       = pnx8550_usb_ohci_resources,
110 };
111
112 static struct platform_device pnx8550_uart_device = {
113         .name           = "ip3106-uart",
114         .id             = -1,
115         .dev = {
116                 .dma_mask               = &uart_dmamask,
117                 .coherent_dma_mask      = 0xffffffff,
118                 .platform_data = ip3106_ports,
119         },
120         .num_resources  = ARRAY_SIZE(pnx8550_uart_resources),
121         .resource       = pnx8550_uart_resources,
122 };
123
124 static struct platform_device *pnx8550_platform_devices[] __initdata = {
125         &pnx8550_usb_ohci_device,
126         &pnx8550_uart_device,
127 };
128
129 int pnx8550_platform_init(void)
130 {
131         return platform_add_devices(pnx8550_platform_devices,
132                                     ARRAY_SIZE(pnx8550_platform_devices));
133 }
134
135 arch_initcall(pnx8550_platform_init);