blob: a5e3ea4136948c5c9fc09a9f4485721344bcf60c [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 */
10#include <linux/device.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/resource.h>
14
Pete Popov26a940e2005-09-15 08:03:12 +000015#include <asm/mach-au1x00/au1xxx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Pete Popov64abf642005-09-14 16:17:59 +000017/* OHCI (USB full speed host controller) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018static struct resource au1xxx_usb_ohci_resources[] = {
19 [0] = {
20 .start = USB_OHCI_BASE,
21 .end = USB_OHCI_BASE + USB_OHCI_LEN,
22 .flags = IORESOURCE_MEM,
23 },
24 [1] = {
25 .start = AU1000_USB_HOST_INT,
26 .end = AU1000_USB_HOST_INT,
27 .flags = IORESOURCE_IRQ,
28 },
29};
30
31/* The dmamask must be set for OHCI to work */
32static u64 ohci_dmamask = ~(u32)0;
33
34static struct platform_device au1xxx_usb_ohci_device = {
35 .name = "au1xxx-ohci",
36 .id = 0,
37 .dev = {
38 .dma_mask = &ohci_dmamask,
39 .coherent_dma_mask = 0xffffffff,
40 },
41 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
42 .resource = au1xxx_usb_ohci_resources,
43};
44
Pete Popov3b495f22005-04-04 01:06:19 +000045/*** AU1100 LCD controller ***/
46
47#ifdef CONFIG_FB_AU1100
48static struct resource au1100_lcd_resources[] = {
49 [0] = {
50 .start = LCD_PHYS_ADDR,
51 .end = LCD_PHYS_ADDR + 0x800 - 1,
52 .flags = IORESOURCE_MEM,
53 },
54 [1] = {
55 .start = AU1100_LCD_INT,
56 .end = AU1100_LCD_INT,
57 .flags = IORESOURCE_IRQ,
58 }
59};
60
61static u64 au1100_lcd_dmamask = ~(u32)0;
62
63static struct platform_device au1100_lcd_device = {
64 .name = "au1100-lcd",
65 .id = 0,
66 .dev = {
67 .dma_mask = &au1100_lcd_dmamask,
68 .coherent_dma_mask = 0xffffffff,
69 },
70 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
71 .resource = au1100_lcd_resources,
72};
73#endif
74
Pete Popov64abf642005-09-14 16:17:59 +000075#ifdef CONFIG_SOC_AU1200
76/* EHCI (USB high speed host controller) */
77static struct resource au1xxx_usb_ehci_resources[] = {
78 [0] = {
79 .start = USB_EHCI_BASE,
80 .end = USB_EHCI_BASE + USB_EHCI_LEN - 1,
81 .flags = IORESOURCE_MEM,
82 },
83 [1] = {
84 .start = AU1000_USB_HOST_INT,
85 .end = AU1000_USB_HOST_INT,
86 .flags = IORESOURCE_IRQ,
87 },
88};
89
90static u64 ehci_dmamask = ~(u32)0;
91
92static struct platform_device au1xxx_usb_ehci_device = {
93 .name = "au1xxx-ehci",
94 .id = 0,
95 .dev = {
96 .dma_mask = &ehci_dmamask,
97 .coherent_dma_mask = 0xffffffff,
98 },
99 .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
100 .resource = au1xxx_usb_ehci_resources,
101};
102
103/* Au1200 UDC (USB gadget controller) */
104static struct resource au1xxx_usb_gdt_resources[] = {
105 [0] = {
106 .start = USB_UDC_BASE,
107 .end = USB_UDC_BASE + USB_UDC_LEN - 1,
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = AU1200_USB_INT,
112 .end = AU1200_USB_INT,
113 .flags = IORESOURCE_IRQ,
114 },
115};
116
117static u64 udc_dmamask = ~(u32)0;
118
119static struct platform_device au1xxx_usb_gdt_device = {
120 .name = "au1xxx-udc",
121 .id = 0,
122 .dev = {
123 .dma_mask = &udc_dmamask,
124 .coherent_dma_mask = 0xffffffff,
125 },
126 .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
127 .resource = au1xxx_usb_gdt_resources,
128};
129
130/* Au1200 UOC (USB OTG controller) */
131static struct resource au1xxx_usb_otg_resources[] = {
132 [0] = {
133 .start = USB_UOC_BASE,
134 .end = USB_UOC_BASE + USB_UOC_LEN - 1,
135 .flags = IORESOURCE_MEM,
136 },
137 [1] = {
138 .start = AU1200_USB_INT,
139 .end = AU1200_USB_INT,
140 .flags = IORESOURCE_IRQ,
141 },
142};
143
144static u64 uoc_dmamask = ~(u32)0;
145
146static struct platform_device au1xxx_usb_otg_device = {
147 .name = "au1xxx-uoc",
148 .id = 0,
149 .dev = {
150 .dma_mask = &uoc_dmamask,
151 .coherent_dma_mask = 0xffffffff,
152 },
153 .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
154 .resource = au1xxx_usb_otg_resources,
155};
156
Pete Popov64abf642005-09-14 16:17:59 +0000157static struct resource au1200_lcd_resources[] = {
158 [0] = {
159 .start = LCD_PHYS_ADDR,
160 .end = LCD_PHYS_ADDR + 0x800 - 1,
161 .flags = IORESOURCE_MEM,
162 },
163 [1] = {
164 .start = AU1200_LCD_INT,
165 .end = AU1200_LCD_INT,
166 .flags = IORESOURCE_IRQ,
167 }
168};
169
Pete Popov26a940e2005-09-15 08:03:12 +0000170static struct resource au1200_ide0_resources[] = {
171 [0] = {
172 .start = AU1XXX_ATA_PHYS_ADDR,
173 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
174 .flags = IORESOURCE_MEM,
175 },
176 [1] = {
177 .start = AU1XXX_ATA_INT,
178 .end = AU1XXX_ATA_INT,
179 .flags = IORESOURCE_IRQ,
180 }
181};
182
Pete Popov64abf642005-09-14 16:17:59 +0000183static u64 au1200_lcd_dmamask = ~(u32)0;
184
185static struct platform_device au1200_lcd_device = {
186 .name = "au1200-lcd",
187 .id = 0,
188 .dev = {
189 .dma_mask = &au1200_lcd_dmamask,
190 .coherent_dma_mask = 0xffffffff,
191 },
192 .num_resources = ARRAY_SIZE(au1200_lcd_resources),
193 .resource = au1200_lcd_resources,
194};
Pete Popov26a940e2005-09-15 08:03:12 +0000195
196
197static u64 ide0_dmamask = ~(u32)0;
198
199static struct platform_device au1200_ide0_device = {
200 .name = "au1200-ide",
201 .id = 0,
202 .dev = {
203 .dma_mask = &ide0_dmamask,
204 .coherent_dma_mask = 0xffffffff,
205 },
206 .num_resources = ARRAY_SIZE(au1200_ide0_resources),
207 .resource = au1200_ide0_resources,
208};
209
Pete Popov64abf642005-09-14 16:17:59 +0000210#endif
Pete Popov3b495f22005-04-04 01:06:19 +0000211
Pete Popovefe29c02005-09-15 23:42:27 +0000212static struct platform_device au1x00_pcmcia_device = {
213 .name = "au1x00-pcmcia",
214 .id = 0,
215};
216
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217static struct platform_device *au1xxx_platform_devices[] __initdata = {
218 &au1xxx_usb_ohci_device,
Pete Popovefe29c02005-09-15 23:42:27 +0000219 &au1x00_pcmcia_device,
Pete Popov3b495f22005-04-04 01:06:19 +0000220#ifdef CONFIG_FB_AU1100
221 &au1100_lcd_device,
222#endif
Pete Popov64abf642005-09-14 16:17:59 +0000223#ifdef CONFIG_SOC_AU1200
224#if 0 /* fixme */
225 &au1xxx_usb_ehci_device,
226#endif
227 &au1xxx_usb_gdt_device,
228 &au1xxx_usb_otg_device,
229 &au1200_lcd_device,
Pete Popov26a940e2005-09-15 08:03:12 +0000230 &au1200_ide0_device,
Pete Popov64abf642005-09-14 16:17:59 +0000231#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232};
233
234int au1xxx_platform_init(void)
235{
236 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
237}
238
239arch_initcall(au1xxx_platform_init);