blob: d7a8f0a811feb35d2679c4b32a3f8242488616e9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Pete Popovba264b32005-09-21 06:18:27 +000010#include <linux/config.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/device.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010012#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/resource.h>
16
Pete Popov26a940e2005-09-15 08:03:12 +000017#include <asm/mach-au1x00/au1xxx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Pete Popov64abf642005-09-14 16:17:59 +000019/* OHCI (USB full speed host controller) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020static 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 */
34static u64 ohci_dmamask = ~(u32)0;
35
36static 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
Pete Popov3b495f22005-04-04 01:06:19 +000047/*** AU1100 LCD controller ***/
48
49#ifdef CONFIG_FB_AU1100
50static 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
63static u64 au1100_lcd_dmamask = ~(u32)0;
64
65static 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
Pete Popov64abf642005-09-14 16:17:59 +000077#ifdef CONFIG_SOC_AU1200
78/* EHCI (USB high speed host controller) */
79static 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
92static u64 ehci_dmamask = ~(u32)0;
93
94static 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) */
106static 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
Pete Popovba264b32005-09-21 06:18:27 +0000119static 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
Pete Popov64abf642005-09-14 16:17:59 +0000137static u64 udc_dmamask = ~(u32)0;
138
139static 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) */
151static 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
164static u64 uoc_dmamask = ~(u32)0;
165
166static 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
Pete Popov64abf642005-09-14 16:17:59 +0000177static 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
Pete Popov26a940e2005-09-15 08:03:12 +0000190static 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
Pete Popov64abf642005-09-14 16:17:59 +0000203static u64 au1200_lcd_dmamask = ~(u32)0;
204
205static 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};
Pete Popov26a940e2005-09-15 08:03:12 +0000215
216
217static u64 ide0_dmamask = ~(u32)0;
218
219static 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
Pete Popovba264b32005-09-21 06:18:27 +0000230static u64 au1xxx_mmc_dmamask = ~(u32)0;
231
232static 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
Pete Popovefe29c02005-09-15 23:42:27 +0000244static struct platform_device au1x00_pcmcia_device = {
245 .name = "au1x00-pcmcia",
246 .id = 0,
247};
248
Pete Popov0c9ec462005-09-21 21:39:44 +0000249#ifdef CONFIG_MIPS_DB1200
250
251static 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
265static struct platform_device smc91x_device = {
266 .name = "smc91x",
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000267 .id = -1,
Pete Popov0c9ec462005-09-21 21:39:44 +0000268 .num_resources = ARRAY_SIZE(smc91x_resources),
269 .resource = smc91x_resources,
270};
271
272#endif
273
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274static struct platform_device *au1xxx_platform_devices[] __initdata = {
275 &au1xxx_usb_ohci_device,
Pete Popovefe29c02005-09-15 23:42:27 +0000276 &au1x00_pcmcia_device,
Pete Popov3b495f22005-04-04 01:06:19 +0000277#ifdef CONFIG_FB_AU1100
278 &au1100_lcd_device,
279#endif
Pete Popov64abf642005-09-14 16:17:59 +0000280#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,
Pete Popov26a940e2005-09-15 08:03:12 +0000287 &au1200_ide0_device,
Pete Popovba264b32005-09-21 06:18:27 +0000288 &au1xxx_mmc_device,
Pete Popov64abf642005-09-14 16:17:59 +0000289#endif
Pete Popov0c9ec462005-09-21 21:39:44 +0000290#ifdef CONFIG_MIPS_DB1200
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000291 &smc91x_device,
Pete Popov0c9ec462005-09-21 21:39:44 +0000292#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293};
294
295int au1xxx_platform_init(void)
296{
297 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
298}
299
300arch_initcall(au1xxx_platform_init);