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