blob: c1c860c6a6e1c8c1870ea29b6a9ccb5a04331aaa [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 */
Sergei Shtylyovce28f942008-04-23 22:43:55 +040010
Russell Kingd052d1b2005-10-29 19:07:23 +010011#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Pete Popov26a940e2005-09-15 08:03:12 +000014#include <asm/mach-au1x00/au1xxx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Pete Popov64abf642005-09-14 16:17:59 +000016/* OHCI (USB full speed host controller) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070017static struct resource au1xxx_usb_ohci_resources[] = {
18 [0] = {
19 .start = USB_OHCI_BASE,
Jordan Croused5fb7f12006-01-20 14:09:54 -080020 .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 .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 */
31static u64 ohci_dmamask = ~(u32)0;
32
33static 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
Pete Popov3b495f22005-04-04 01:06:19 +000044/*** AU1100 LCD controller ***/
45
46#ifdef CONFIG_FB_AU1100
47static 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
60static u64 au1100_lcd_dmamask = ~(u32)0;
61
62static 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
Pete Popov64abf642005-09-14 16:17:59 +000074#ifdef CONFIG_SOC_AU1200
75/* EHCI (USB high speed host controller) */
76static 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
89static u64 ehci_dmamask = ~(u32)0;
90
91static 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) */
103static 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
Pete Popovba264b32005-09-21 06:18:27 +0000116static 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
Pete Popov64abf642005-09-14 16:17:59 +0000134static u64 udc_dmamask = ~(u32)0;
135
136static 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) */
148static 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
161static u64 uoc_dmamask = ~(u32)0;
162
163static 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
Pete Popov64abf642005-09-14 16:17:59 +0000174static 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
Pete Popov26a940e2005-09-15 08:03:12 +0000187static struct resource au1200_ide0_resources[] = {
188 [0] = {
189 .start = AU1XXX_ATA_PHYS_ADDR,
Sergei Shtylyovb4dcaea2008-04-17 01:14:33 +0200190 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN - 1,
Pete Popov26a940e2005-09-15 08:03:12 +0000191 .flags = IORESOURCE_MEM,
192 },
193 [1] = {
194 .start = AU1XXX_ATA_INT,
195 .end = AU1XXX_ATA_INT,
196 .flags = IORESOURCE_IRQ,
197 }
198};
199
Pete Popov64abf642005-09-14 16:17:59 +0000200static u64 au1200_lcd_dmamask = ~(u32)0;
201
202static 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};
Pete Popov26a940e2005-09-15 08:03:12 +0000212
213
214static u64 ide0_dmamask = ~(u32)0;
215
216static 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
Pete Popovba264b32005-09-21 06:18:27 +0000227static u64 au1xxx_mmc_dmamask = ~(u32)0;
228
229static 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
Pete Popovefe29c02005-09-15 23:42:27 +0000241static struct platform_device au1x00_pcmcia_device = {
242 .name = "au1x00-pcmcia",
243 .id = 0,
244};
245
Pete Popov0c9ec462005-09-21 21:39:44 +0000246#ifdef CONFIG_MIPS_DB1200
247
248static 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
262static struct platform_device smc91x_device = {
263 .name = "smc91x",
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000264 .id = -1,
Pete Popov0c9ec462005-09-21 21:39:44 +0000265 .num_resources = ARRAY_SIZE(smc91x_resources),
266 .resource = smc91x_resources,
267};
268
269#endif
270
Manuel Lauss8b798c42008-01-27 18:14:52 +0100271/* All Alchemy demoboards with I2C have this #define in their headers */
272#ifdef SMBUS_PSC_BASE
273static 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
281static 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289static struct platform_device *au1xxx_platform_devices[] __initdata = {
290 &au1xxx_usb_ohci_device,
Pete Popovefe29c02005-09-15 23:42:27 +0000291 &au1x00_pcmcia_device,
Pete Popov3b495f22005-04-04 01:06:19 +0000292#ifdef CONFIG_FB_AU1100
293 &au1100_lcd_device,
294#endif
Pete Popov64abf642005-09-14 16:17:59 +0000295#ifdef CONFIG_SOC_AU1200
Pete Popov64abf642005-09-14 16:17:59 +0000296 &au1xxx_usb_ehci_device,
Pete Popov64abf642005-09-14 16:17:59 +0000297 &au1xxx_usb_gdt_device,
298 &au1xxx_usb_otg_device,
299 &au1200_lcd_device,
Pete Popov26a940e2005-09-15 08:03:12 +0000300 &au1200_ide0_device,
Pete Popovba264b32005-09-21 06:18:27 +0000301 &au1xxx_mmc_device,
Pete Popov64abf642005-09-14 16:17:59 +0000302#endif
Pete Popov0c9ec462005-09-21 21:39:44 +0000303#ifdef CONFIG_MIPS_DB1200
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000304 &smc91x_device,
Pete Popov0c9ec462005-09-21 21:39:44 +0000305#endif
Manuel Lauss8b798c42008-01-27 18:14:52 +0100306#ifdef SMBUS_PSC_BASE
307 &pbdb_smbus_device,
308#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309};
310
Ralf Baechle070c7b82007-07-10 09:35:12 +0100311int __init au1xxx_platform_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312{
313 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
314}
315
316arch_initcall(au1xxx_platform_init);