Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / arch / mips / au1000 / common / platform.c
blob39d68126529770701c6668017edc19611ab59dbb
1 /*
2 * Platform device support for Au1x00 SoCs.
4 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
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>
11 #include <linux/platform_device.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/resource.h>
16 #include <asm/mach-au1x00/au1xxx.h>
18 /* OHCI (USB full speed host controller) */
19 static struct resource au1xxx_usb_ohci_resources[] = {
20 [0] = {
21 .start = USB_OHCI_BASE,
22 .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
23 .flags = IORESOURCE_MEM,
25 [1] = {
26 .start = AU1000_USB_HOST_INT,
27 .end = AU1000_USB_HOST_INT,
28 .flags = IORESOURCE_IRQ,
32 /* The dmamask must be set for OHCI to work */
33 static u64 ohci_dmamask = ~(u32)0;
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,
42 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
43 .resource = au1xxx_usb_ohci_resources,
46 /*** AU1100 LCD controller ***/
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,
55 [1] = {
56 .start = AU1100_LCD_INT,
57 .end = AU1100_LCD_INT,
58 .flags = IORESOURCE_IRQ,
62 static u64 au1100_lcd_dmamask = ~(u32)0;
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,
71 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
72 .resource = au1100_lcd_resources,
74 #endif
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,
84 [1] = {
85 .start = AU1000_USB_HOST_INT,
86 .end = AU1000_USB_HOST_INT,
87 .flags = IORESOURCE_IRQ,
91 static u64 ehci_dmamask = ~(u32)0;
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,
100 .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
101 .resource = au1xxx_usb_ehci_resources,
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,
111 [1] = {
112 .start = AU1200_USB_INT,
113 .end = AU1200_USB_INT,
114 .flags = IORESOURCE_IRQ,
118 static struct resource au1xxx_mmc_resources[] = {
119 [0] = {
120 .start = SD0_PHYS_ADDR,
121 .end = SD0_PHYS_ADDR + 0x40,
122 .flags = IORESOURCE_MEM,
124 [1] = {
125 .start = SD1_PHYS_ADDR,
126 .end = SD1_PHYS_ADDR + 0x40,
127 .flags = IORESOURCE_MEM,
129 [2] = {
130 .start = AU1200_SD_INT,
131 .end = AU1200_SD_INT,
132 .flags = IORESOURCE_IRQ,
136 static u64 udc_dmamask = ~(u32)0;
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,
145 .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
146 .resource = au1xxx_usb_gdt_resources,
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,
156 [1] = {
157 .start = AU1200_USB_INT,
158 .end = AU1200_USB_INT,
159 .flags = IORESOURCE_IRQ,
163 static u64 uoc_dmamask = ~(u32)0;
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,
172 .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
173 .resource = au1xxx_usb_otg_resources,
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,
182 [1] = {
183 .start = AU1200_LCD_INT,
184 .end = AU1200_LCD_INT,
185 .flags = IORESOURCE_IRQ,
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 - 1,
193 .flags = IORESOURCE_MEM,
195 [1] = {
196 .start = AU1XXX_ATA_INT,
197 .end = AU1XXX_ATA_INT,
198 .flags = IORESOURCE_IRQ,
202 static u64 au1200_lcd_dmamask = ~(u32)0;
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,
211 .num_resources = ARRAY_SIZE(au1200_lcd_resources),
212 .resource = au1200_lcd_resources,
216 static u64 ide0_dmamask = ~(u32)0;
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,
225 .num_resources = ARRAY_SIZE(au1200_ide0_resources),
226 .resource = au1200_ide0_resources,
229 static u64 au1xxx_mmc_dmamask = ~(u32)0;
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,
238 .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
239 .resource = au1xxx_mmc_resources,
241 #endif /* #ifdef CONFIG_SOC_AU1200 */
243 static struct platform_device au1x00_pcmcia_device = {
244 .name = "au1x00-pcmcia",
245 .id = 0,
248 #ifdef CONFIG_MIPS_DB1200
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,
257 [1] = {
258 .start = AU1XXX_SMC91111_IRQ,
259 .end = AU1XXX_SMC91111_IRQ,
260 .flags = IORESOURCE_IRQ,
264 static struct platform_device smc91x_device = {
265 .name = "smc91x",
266 .id = -1,
267 .num_resources = ARRAY_SIZE(smc91x_resources),
268 .resource = smc91x_resources,
271 #endif
273 /* All Alchemy demoboards with I2C have this #define in their headers */
274 #ifdef SMBUS_PSC_BASE
275 static struct resource pbdb_smbus_resources[] = {
277 .start = SMBUS_PSC_BASE,
278 .end = SMBUS_PSC_BASE + 0x24 - 1,
279 .flags = IORESOURCE_MEM,
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,
289 #endif
291 static struct platform_device *au1xxx_platform_devices[] __initdata = {
292 &au1xxx_usb_ohci_device,
293 &au1x00_pcmcia_device,
294 #ifdef CONFIG_FB_AU1100
295 &au1100_lcd_device,
296 #endif
297 #ifdef CONFIG_SOC_AU1200
298 &au1xxx_usb_ehci_device,
299 &au1xxx_usb_gdt_device,
300 &au1xxx_usb_otg_device,
301 &au1200_lcd_device,
302 &au1200_ide0_device,
303 &au1xxx_mmc_device,
304 #endif
305 #ifdef CONFIG_MIPS_DB1200
306 &smc91x_device,
307 #endif
308 #ifdef SMBUS_PSC_BASE
309 &pbdb_smbus_device,
310 #endif
313 int __init au1xxx_platform_init(void)
315 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
318 arch_initcall(au1xxx_platform_init);