Remove obsolete #include <linux/config.h>
[linux-3.10.git] / arch / mips / au1000 / common / platform.c
1 /*
2  * Platform device support for Au1x00 SoCs.
3  *
4  * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
5  *
6  * This file is licensed under the terms of the GNU General Public
7  * License version 2.  This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10 #include <linux/device.h>
11 #include <linux/platform_device.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/resource.h>
15
16 #include <asm/mach-au1x00/au1xxx.h>
17
18 /* OHCI (USB full speed host controller) */
19 static struct resource au1xxx_usb_ohci_resources[] = {
20         [0] = {
21                 .start          = USB_OHCI_BASE,
22                 .end            = USB_OHCI_BASE + USB_OHCI_LEN - 1,
23                 .flags          = IORESOURCE_MEM,
24         },
25         [1] = {
26                 .start          = AU1000_USB_HOST_INT,
27                 .end            = AU1000_USB_HOST_INT,
28                 .flags          = IORESOURCE_IRQ,
29         },
30 };
31
32 /* The dmamask must be set for OHCI to work */
33 static u64 ohci_dmamask = ~(u32)0;
34
35 static struct platform_device au1xxx_usb_ohci_device = {
36         .name           = "au1xxx-ohci",
37         .id             = 0,
38         .dev = {
39                 .dma_mask               = &ohci_dmamask,
40                 .coherent_dma_mask      = 0xffffffff,
41         },
42         .num_resources  = ARRAY_SIZE(au1xxx_usb_ohci_resources),
43         .resource       = au1xxx_usb_ohci_resources,
44 };
45
46 /*** AU1100 LCD controller ***/
47
48 #ifdef CONFIG_FB_AU1100
49 static struct resource au1100_lcd_resources[] = {
50         [0] = {
51                 .start          = LCD_PHYS_ADDR,
52                 .end            = LCD_PHYS_ADDR + 0x800 - 1,
53                 .flags          = IORESOURCE_MEM,
54         },
55         [1] = {
56                 .start          = AU1100_LCD_INT,
57                 .end            = AU1100_LCD_INT,
58                 .flags          = IORESOURCE_IRQ,
59         }
60 };
61
62 static u64 au1100_lcd_dmamask = ~(u32)0;
63
64 static struct platform_device au1100_lcd_device = {
65         .name           = "au1100-lcd",
66         .id             = 0,
67         .dev = {
68                 .dma_mask               = &au1100_lcd_dmamask,
69                 .coherent_dma_mask      = 0xffffffff,
70         },
71         .num_resources  = ARRAY_SIZE(au1100_lcd_resources),
72         .resource       = au1100_lcd_resources,
73 };
74 #endif
75
76 #ifdef CONFIG_SOC_AU1200
77 /* EHCI (USB high speed host controller) */
78 static struct resource au1xxx_usb_ehci_resources[] = {
79         [0] = {
80                 .start          = USB_EHCI_BASE,
81                 .end            = USB_EHCI_BASE + USB_EHCI_LEN - 1,
82                 .flags          = IORESOURCE_MEM,
83         },
84         [1] = {
85                 .start          = AU1000_USB_HOST_INT,
86                 .end            = AU1000_USB_HOST_INT,
87                 .flags          = IORESOURCE_IRQ,
88         },
89 };
90
91 static u64 ehci_dmamask = ~(u32)0;
92
93 static struct platform_device au1xxx_usb_ehci_device = {
94         .name           = "au1xxx-ehci",
95         .id             = 0,
96         .dev = {
97                 .dma_mask               = &ehci_dmamask,
98                 .coherent_dma_mask      = 0xffffffff,
99         },
100         .num_resources  = ARRAY_SIZE(au1xxx_usb_ehci_resources),
101         .resource       = au1xxx_usb_ehci_resources,
102 };
103
104 /* Au1200 UDC (USB gadget controller) */
105 static struct resource au1xxx_usb_gdt_resources[] = {
106         [0] = {
107                 .start          = USB_UDC_BASE,
108                 .end            = USB_UDC_BASE + USB_UDC_LEN - 1,
109                 .flags          = IORESOURCE_MEM,
110         },
111         [1] = {
112                 .start          = AU1200_USB_INT,
113                 .end            = AU1200_USB_INT,
114                 .flags          = IORESOURCE_IRQ,
115         },
116 };
117
118 static struct resource au1xxx_mmc_resources[] = {
119         [0] = {
120                 .start          = SD0_PHYS_ADDR,
121                 .end            = SD0_PHYS_ADDR + 0x40,
122                 .flags          = IORESOURCE_MEM,
123         },
124         [1] = {
125                 .start          = SD1_PHYS_ADDR,
126                 .end            = SD1_PHYS_ADDR + 0x40,
127                 .flags          = IORESOURCE_MEM,
128         },
129         [2] = {
130                 .start          = AU1200_SD_INT,
131                 .end            = AU1200_SD_INT,
132                 .flags          = IORESOURCE_IRQ,
133         }
134 };
135
136 static u64 udc_dmamask = ~(u32)0;
137
138 static struct platform_device au1xxx_usb_gdt_device = {
139         .name           = "au1xxx-udc",
140         .id             = 0,
141         .dev = {
142                 .dma_mask               = &udc_dmamask,
143                 .coherent_dma_mask      = 0xffffffff,
144         },
145         .num_resources  = ARRAY_SIZE(au1xxx_usb_gdt_resources),
146         .resource       = au1xxx_usb_gdt_resources,
147 };
148
149 /* Au1200 UOC (USB OTG controller) */
150 static struct resource au1xxx_usb_otg_resources[] = {
151         [0] = {
152                 .start          = USB_UOC_BASE,
153                 .end            = USB_UOC_BASE + USB_UOC_LEN - 1,
154                 .flags          = IORESOURCE_MEM,
155         },
156         [1] = {
157                 .start          = AU1200_USB_INT,
158                 .end            = AU1200_USB_INT,
159                 .flags          = IORESOURCE_IRQ,
160         },
161 };
162
163 static u64 uoc_dmamask = ~(u32)0;
164
165 static struct platform_device au1xxx_usb_otg_device = {
166         .name           = "au1xxx-uoc",
167         .id             = 0,
168         .dev = {
169                 .dma_mask               = &uoc_dmamask,
170                 .coherent_dma_mask      = 0xffffffff,
171         },
172         .num_resources  = ARRAY_SIZE(au1xxx_usb_otg_resources),
173         .resource       = au1xxx_usb_otg_resources,
174 };
175
176 static struct resource au1200_lcd_resources[] = {
177         [0] = {
178                 .start          = LCD_PHYS_ADDR,
179                 .end            = LCD_PHYS_ADDR + 0x800 - 1,
180                 .flags          = IORESOURCE_MEM,
181         },
182         [1] = {
183                 .start          = AU1200_LCD_INT,
184                 .end            = AU1200_LCD_INT,
185                 .flags          = IORESOURCE_IRQ,
186         }
187 };
188
189 static struct resource au1200_ide0_resources[] = {
190         [0] = {
191                 .start          = AU1XXX_ATA_PHYS_ADDR,
192                 .end            = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
193                 .flags          = IORESOURCE_MEM,
194         },
195         [1] = {
196                 .start          = AU1XXX_ATA_INT,
197                 .end            = AU1XXX_ATA_INT,
198                 .flags          = IORESOURCE_IRQ,
199         }
200 };
201
202 static u64 au1200_lcd_dmamask = ~(u32)0;
203
204 static struct platform_device au1200_lcd_device = {
205         .name           = "au1200-lcd",
206         .id             = 0,
207         .dev = {
208                 .dma_mask               = &au1200_lcd_dmamask,
209                 .coherent_dma_mask      = 0xffffffff,
210         },
211         .num_resources  = ARRAY_SIZE(au1200_lcd_resources),
212         .resource       = au1200_lcd_resources,
213 };
214
215
216 static u64 ide0_dmamask = ~(u32)0;
217
218 static struct platform_device au1200_ide0_device = {
219         .name           = "au1200-ide",
220         .id             = 0,
221         .dev = {
222                 .dma_mask               = &ide0_dmamask,
223                 .coherent_dma_mask      = 0xffffffff,
224         },
225         .num_resources = ARRAY_SIZE(au1200_ide0_resources),
226         .resource       = au1200_ide0_resources,
227 };
228
229 static u64 au1xxx_mmc_dmamask =  ~(u32)0;
230
231 static struct platform_device au1xxx_mmc_device = {
232         .name = "au1xxx-mmc",
233         .id = 0,
234         .dev = {
235                 .dma_mask               = &au1xxx_mmc_dmamask,
236                 .coherent_dma_mask      = 0xffffffff,
237         },
238         .num_resources  = ARRAY_SIZE(au1xxx_mmc_resources),
239         .resource       = au1xxx_mmc_resources,
240 };
241 #endif /* #ifdef CONFIG_SOC_AU1200 */
242
243 static struct platform_device au1x00_pcmcia_device = {
244         .name           = "au1x00-pcmcia",
245         .id             = 0,
246 };
247
248 #ifdef CONFIG_MIPS_DB1200
249
250 static struct resource smc91x_resources[] = {
251         [0] = {
252                 .name   = "smc91x-regs",
253                 .start  = AU1XXX_SMC91111_PHYS_ADDR,
254                 .end    = AU1XXX_SMC91111_PHYS_ADDR + 0xfffff,
255                 .flags  = IORESOURCE_MEM,
256         },
257         [1] = {
258                 .start  = AU1XXX_SMC91111_IRQ,
259                 .end    = AU1XXX_SMC91111_IRQ,
260                 .flags  = IORESOURCE_IRQ,
261         },
262 };
263
264 static struct platform_device smc91x_device = {
265         .name           = "smc91x",
266         .id             = -1,
267         .num_resources  = ARRAY_SIZE(smc91x_resources),
268         .resource       = smc91x_resources,
269 };
270
271 #endif
272
273 static struct platform_device *au1xxx_platform_devices[] __initdata = {
274         &au1xxx_usb_ohci_device,
275         &au1x00_pcmcia_device,
276 #ifdef CONFIG_FB_AU1100
277         &au1100_lcd_device,
278 #endif
279 #ifdef CONFIG_SOC_AU1200
280         &au1xxx_usb_ehci_device,
281         &au1xxx_usb_gdt_device,
282         &au1xxx_usb_otg_device,
283         &au1200_lcd_device,
284         &au1200_ide0_device,
285         &au1xxx_mmc_device,
286 #endif
287 #ifdef CONFIG_MIPS_DB1200
288         &smc91x_device,
289 #endif
290 };
291
292 int au1xxx_platform_init(void)
293 {
294         return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
295 }
296
297 arch_initcall(au1xxx_platform_init);