[MIPS] Alchemy, PNX: Use symbolic constants for DMA masks.
[linux-2.6] / arch / mips / nxp / pnx8550 / common / platform.c
1 /*
2  * Platform device support for NXP 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/dma-mapping.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/resource.h>
20 #include <linux/serial.h>
21 #include <linux/serial_pnx8xxx.h>
22 #include <linux/platform_device.h>
23
24 #include <int.h>
25 #include <usb.h>
26 #include <uart.h>
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 pnx8xxx_port pnx8xxx_ports[] = {
66         [0] = {
67                 .port   = {
68                         .type           = PORT_PNX8XXX,
69                         .iotype         = UPIO_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                         .flags          = UPF_BOOT_AUTOCONF,
76                         .line           = 0,
77                 },
78         },
79         [1] = {
80                 .port   = {
81                         .type           = PORT_PNX8XXX,
82                         .iotype         = UPIO_MEM,
83                         .membase        = (void __iomem *)PNX8550_UART_PORT1,
84                         .mapbase        = PNX8550_UART_PORT1,
85                         .irq            = PNX8550_UART_INT(1),
86                         .uartclk        = 3692300,
87                         .fifosize       = 16,
88                         .flags          = UPF_BOOT_AUTOCONF,
89                         .line           = 1,
90                 },
91         },
92 };
93
94 /* The dmamask must be set for OHCI to work */
95 static u64 ohci_dmamask = DMA_32BIT_MASK;
96
97 static u64 uart_dmamask = DMA_32BIT_MASK;
98
99 static struct platform_device pnx8550_usb_ohci_device = {
100         .name           = "pnx8550-ohci",
101         .id             = -1,
102         .dev = {
103                 .dma_mask               = &ohci_dmamask,
104                 .coherent_dma_mask      = DMA_32BIT_MASK,
105         },
106         .num_resources  = ARRAY_SIZE(pnx8550_usb_ohci_resources),
107         .resource       = pnx8550_usb_ohci_resources,
108 };
109
110 static struct platform_device pnx8550_uart_device = {
111         .name           = "pnx8xxx-uart",
112         .id             = -1,
113         .dev = {
114                 .dma_mask               = &uart_dmamask,
115                 .coherent_dma_mask      = DMA_32BIT_MASK,
116                 .platform_data = pnx8xxx_ports,
117         },
118         .num_resources  = ARRAY_SIZE(pnx8550_uart_resources),
119         .resource       = pnx8550_uart_resources,
120 };
121
122 static struct platform_device *pnx8550_platform_devices[] __initdata = {
123         &pnx8550_usb_ohci_device,
124         &pnx8550_uart_device,
125 };
126
127 static int __init pnx8550_platform_init(void)
128 {
129         return platform_add_devices(pnx8550_platform_devices,
130                                     ARRAY_SIZE(pnx8550_platform_devices));
131 }
132
133 arch_initcall(pnx8550_platform_init);