2 * Platform device support for Au1x00 SoCs.
4 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
6 * (C) Copyright Embedded Alley Solutions, Inc 2005
7 * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
14 #include <linux/platform_device.h>
15 #include <linux/serial_8250.h>
16 #include <linux/init.h>
18 #include <asm/mach-au1x00/au1xxx.h>
20 #define PORT(_base, _irq) \
23 .membase = (void __iomem *)_base,\
24 .mapbase = CPHYSADDR(_base), \
28 .flags = UPF_SKIP_TEST \
31 static struct plat_serial8250_port au1x00_uart_data[] = {
32 #if defined(CONFIG_SERIAL_8250_AU1X00)
33 #if defined(CONFIG_SOC_AU1000)
34 PORT(UART0_ADDR, AU1000_UART0_INT),
35 PORT(UART1_ADDR, AU1000_UART1_INT),
36 PORT(UART2_ADDR, AU1000_UART2_INT),
37 PORT(UART3_ADDR, AU1000_UART3_INT),
38 #elif defined(CONFIG_SOC_AU1500)
39 PORT(UART0_ADDR, AU1500_UART0_INT),
40 PORT(UART3_ADDR, AU1500_UART3_INT),
41 #elif defined(CONFIG_SOC_AU1100)
42 PORT(UART0_ADDR, AU1100_UART0_INT),
43 PORT(UART1_ADDR, AU1100_UART1_INT),
44 PORT(UART3_ADDR, AU1100_UART3_INT),
45 #elif defined(CONFIG_SOC_AU1550)
46 PORT(UART0_ADDR, AU1550_UART0_INT),
47 PORT(UART1_ADDR, AU1550_UART1_INT),
48 PORT(UART3_ADDR, AU1550_UART3_INT),
49 #elif defined(CONFIG_SOC_AU1200)
50 PORT(UART0_ADDR, AU1200_UART0_INT),
51 PORT(UART1_ADDR, AU1200_UART1_INT),
53 #endif /* CONFIG_SERIAL_8250_AU1X00 */
57 static struct platform_device au1xx0_uart_device = {
59 .id = PLAT8250_DEV_AU1X00,
61 .platform_data = au1x00_uart_data,
65 /* OHCI (USB full speed host controller) */
66 static struct resource au1xxx_usb_ohci_resources[] = {
68 .start = USB_OHCI_BASE,
69 .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
70 .flags = IORESOURCE_MEM,
73 .start = AU1000_USB_HOST_INT,
74 .end = AU1000_USB_HOST_INT,
75 .flags = IORESOURCE_IRQ,
79 /* The dmamask must be set for OHCI to work */
80 static u64 ohci_dmamask = ~(u32)0;
82 static struct platform_device au1xxx_usb_ohci_device = {
83 .name = "au1xxx-ohci",
86 .dma_mask = &ohci_dmamask,
87 .coherent_dma_mask = 0xffffffff,
89 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
90 .resource = au1xxx_usb_ohci_resources,
93 /*** AU1100 LCD controller ***/
95 #ifdef CONFIG_FB_AU1100
96 static struct resource au1100_lcd_resources[] = {
98 .start = LCD_PHYS_ADDR,
99 .end = LCD_PHYS_ADDR + 0x800 - 1,
100 .flags = IORESOURCE_MEM,
103 .start = AU1100_LCD_INT,
104 .end = AU1100_LCD_INT,
105 .flags = IORESOURCE_IRQ,
109 static u64 au1100_lcd_dmamask = ~(u32)0;
111 static struct platform_device au1100_lcd_device = {
112 .name = "au1100-lcd",
115 .dma_mask = &au1100_lcd_dmamask,
116 .coherent_dma_mask = 0xffffffff,
118 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
119 .resource = au1100_lcd_resources,
123 #ifdef CONFIG_SOC_AU1200
124 /* EHCI (USB high speed host controller) */
125 static struct resource au1xxx_usb_ehci_resources[] = {
127 .start = USB_EHCI_BASE,
128 .end = USB_EHCI_BASE + USB_EHCI_LEN - 1,
129 .flags = IORESOURCE_MEM,
132 .start = AU1000_USB_HOST_INT,
133 .end = AU1000_USB_HOST_INT,
134 .flags = IORESOURCE_IRQ,
138 static u64 ehci_dmamask = ~(u32)0;
140 static struct platform_device au1xxx_usb_ehci_device = {
141 .name = "au1xxx-ehci",
144 .dma_mask = &ehci_dmamask,
145 .coherent_dma_mask = 0xffffffff,
147 .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
148 .resource = au1xxx_usb_ehci_resources,
151 /* Au1200 UDC (USB gadget controller) */
152 static struct resource au1xxx_usb_gdt_resources[] = {
154 .start = USB_UDC_BASE,
155 .end = USB_UDC_BASE + USB_UDC_LEN - 1,
156 .flags = IORESOURCE_MEM,
159 .start = AU1200_USB_INT,
160 .end = AU1200_USB_INT,
161 .flags = IORESOURCE_IRQ,
165 static struct resource au1xxx_mmc_resources[] = {
167 .start = SD0_PHYS_ADDR,
168 .end = SD0_PHYS_ADDR + 0x40,
169 .flags = IORESOURCE_MEM,
172 .start = SD1_PHYS_ADDR,
173 .end = SD1_PHYS_ADDR + 0x40,
174 .flags = IORESOURCE_MEM,
177 .start = AU1200_SD_INT,
178 .end = AU1200_SD_INT,
179 .flags = IORESOURCE_IRQ,
183 static u64 udc_dmamask = ~(u32)0;
185 static struct platform_device au1xxx_usb_gdt_device = {
186 .name = "au1xxx-udc",
189 .dma_mask = &udc_dmamask,
190 .coherent_dma_mask = 0xffffffff,
192 .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
193 .resource = au1xxx_usb_gdt_resources,
196 /* Au1200 UOC (USB OTG controller) */
197 static struct resource au1xxx_usb_otg_resources[] = {
199 .start = USB_UOC_BASE,
200 .end = USB_UOC_BASE + USB_UOC_LEN - 1,
201 .flags = IORESOURCE_MEM,
204 .start = AU1200_USB_INT,
205 .end = AU1200_USB_INT,
206 .flags = IORESOURCE_IRQ,
210 static u64 uoc_dmamask = ~(u32)0;
212 static struct platform_device au1xxx_usb_otg_device = {
213 .name = "au1xxx-uoc",
216 .dma_mask = &uoc_dmamask,
217 .coherent_dma_mask = 0xffffffff,
219 .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
220 .resource = au1xxx_usb_otg_resources,
223 static struct resource au1200_lcd_resources[] = {
225 .start = LCD_PHYS_ADDR,
226 .end = LCD_PHYS_ADDR + 0x800 - 1,
227 .flags = IORESOURCE_MEM,
230 .start = AU1200_LCD_INT,
231 .end = AU1200_LCD_INT,
232 .flags = IORESOURCE_IRQ,
236 static struct resource au1200_ide0_resources[] = {
238 .start = AU1XXX_ATA_PHYS_ADDR,
239 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN - 1,
240 .flags = IORESOURCE_MEM,
243 .start = AU1XXX_ATA_INT,
244 .end = AU1XXX_ATA_INT,
245 .flags = IORESOURCE_IRQ,
249 static u64 au1200_lcd_dmamask = ~(u32)0;
251 static struct platform_device au1200_lcd_device = {
252 .name = "au1200-lcd",
255 .dma_mask = &au1200_lcd_dmamask,
256 .coherent_dma_mask = 0xffffffff,
258 .num_resources = ARRAY_SIZE(au1200_lcd_resources),
259 .resource = au1200_lcd_resources,
263 static u64 ide0_dmamask = ~(u32)0;
265 static struct platform_device au1200_ide0_device = {
266 .name = "au1200-ide",
269 .dma_mask = &ide0_dmamask,
270 .coherent_dma_mask = 0xffffffff,
272 .num_resources = ARRAY_SIZE(au1200_ide0_resources),
273 .resource = au1200_ide0_resources,
276 static u64 au1xxx_mmc_dmamask = ~(u32)0;
278 static struct platform_device au1xxx_mmc_device = {
279 .name = "au1xxx-mmc",
282 .dma_mask = &au1xxx_mmc_dmamask,
283 .coherent_dma_mask = 0xffffffff,
285 .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
286 .resource = au1xxx_mmc_resources,
288 #endif /* #ifdef CONFIG_SOC_AU1200 */
290 static struct platform_device au1x00_pcmcia_device = {
291 .name = "au1x00-pcmcia",
295 #ifdef CONFIG_MIPS_DB1200
297 static struct resource smc91x_resources[] = {
299 .name = "smc91x-regs",
300 .start = AU1XXX_SMC91111_PHYS_ADDR,
301 .end = AU1XXX_SMC91111_PHYS_ADDR + 0xfffff,
302 .flags = IORESOURCE_MEM,
305 .start = AU1XXX_SMC91111_IRQ,
306 .end = AU1XXX_SMC91111_IRQ,
307 .flags = IORESOURCE_IRQ,
311 static struct platform_device smc91x_device = {
314 .num_resources = ARRAY_SIZE(smc91x_resources),
315 .resource = smc91x_resources,
320 /* All Alchemy demoboards with I2C have this #define in their headers */
321 #ifdef SMBUS_PSC_BASE
322 static struct resource pbdb_smbus_resources[] = {
324 .start = SMBUS_PSC_BASE,
325 .end = SMBUS_PSC_BASE + 0x24 - 1,
326 .flags = IORESOURCE_MEM,
330 static struct platform_device pbdb_smbus_device = {
331 .name = "au1xpsc_smbus",
332 .id = 0, /* bus number */
333 .num_resources = ARRAY_SIZE(pbdb_smbus_resources),
334 .resource = pbdb_smbus_resources,
338 static struct platform_device *au1xxx_platform_devices[] __initdata = {
340 &au1xxx_usb_ohci_device,
341 &au1x00_pcmcia_device,
342 #ifdef CONFIG_FB_AU1100
345 #ifdef CONFIG_SOC_AU1200
346 &au1xxx_usb_ehci_device,
347 &au1xxx_usb_gdt_device,
348 &au1xxx_usb_otg_device,
353 #ifdef CONFIG_MIPS_DB1200
356 #ifdef SMBUS_PSC_BASE
361 int __init au1xxx_platform_init(void)
363 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
366 /* Fill up uartclk. */
367 for (i = 0; au1x00_uart_data[i].flags ; i++)
368 au1x00_uart_data[i].uartclk = uartclk;
370 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
373 arch_initcall(au1xxx_platform_init);