Commit | Line | Data |
---|---|---|
1da177e4 LT |
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> | |
d052d1be | 11 | #include <linux/platform_device.h> |
1da177e4 LT |
12 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | |
14 | #include <linux/resource.h> | |
15 | ||
26a940e2 | 16 | #include <asm/mach-au1x00/au1xxx.h> |
1da177e4 | 17 | |
64abf64d | 18 | /* OHCI (USB full speed host controller) */ |
1da177e4 LT |
19 | static struct resource au1xxx_usb_ohci_resources[] = { |
20 | [0] = { | |
21 | .start = USB_OHCI_BASE, | |
d5fb7f1b | 22 | .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, |
1da177e4 LT |
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 | ||
3b495f2b PP |
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 | ||
64abf64d PP |
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 | ||
ba264b34 PP |
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 | ||
64abf64d PP |
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 | ||
64abf64d PP |
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 | ||
26a940e2 PP |
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 | ||
64abf64d PP |
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 | }; | |
26a940e2 PP |
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 | ||
ba264b34 PP |
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 | ||
efe29c0f PP |
243 | static struct platform_device au1x00_pcmcia_device = { |
244 | .name = "au1x00-pcmcia", | |
245 | .id = 0, | |
246 | }; | |
247 | ||
0c9ec467 PP |
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", | |
a3dddd56 | 266 | .id = -1, |
0c9ec467 PP |
267 | .num_resources = ARRAY_SIZE(smc91x_resources), |
268 | .resource = smc91x_resources, | |
269 | }; | |
270 | ||
271 | #endif | |
272 | ||
8b798c4d ML |
273 | /* All Alchemy demoboards with I2C have this #define in their headers */ |
274 | #ifdef SMBUS_PSC_BASE | |
275 | static struct resource pbdb_smbus_resources[] = { | |
276 | { | |
277 | .start = SMBUS_PSC_BASE, | |
278 | .end = SMBUS_PSC_BASE + 0x24 - 1, | |
279 | .flags = IORESOURCE_MEM, | |
280 | }, | |
281 | }; | |
282 | ||
283 | static struct platform_device pbdb_smbus_device = { | |
284 | .name = "au1xpsc_smbus", | |
285 | .id = 0, /* bus number */ | |
286 | .num_resources = ARRAY_SIZE(pbdb_smbus_resources), | |
287 | .resource = pbdb_smbus_resources, | |
288 | }; | |
289 | #endif | |
290 | ||
1da177e4 LT |
291 | static struct platform_device *au1xxx_platform_devices[] __initdata = { |
292 | &au1xxx_usb_ohci_device, | |
efe29c0f | 293 | &au1x00_pcmcia_device, |
3b495f2b PP |
294 | #ifdef CONFIG_FB_AU1100 |
295 | &au1100_lcd_device, | |
296 | #endif | |
64abf64d | 297 | #ifdef CONFIG_SOC_AU1200 |
64abf64d | 298 | &au1xxx_usb_ehci_device, |
64abf64d PP |
299 | &au1xxx_usb_gdt_device, |
300 | &au1xxx_usb_otg_device, | |
301 | &au1200_lcd_device, | |
26a940e2 | 302 | &au1200_ide0_device, |
ba264b34 | 303 | &au1xxx_mmc_device, |
64abf64d | 304 | #endif |
0c9ec467 | 305 | #ifdef CONFIG_MIPS_DB1200 |
a3dddd56 | 306 | &smc91x_device, |
0c9ec467 | 307 | #endif |
8b798c4d ML |
308 | #ifdef SMBUS_PSC_BASE |
309 | &pbdb_smbus_device, | |
310 | #endif | |
1da177e4 LT |
311 | }; |
312 | ||
070c7b86 | 313 | int __init au1xxx_platform_init(void) |
1da177e4 LT |
314 | { |
315 | return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); | |
316 | } | |
317 | ||
318 | arch_initcall(au1xxx_platform_init); |