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