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/dma-mapping.h>
15 #include <linux/platform_device.h>
16 #include <linux/serial_8250.h>
17 #include <linux/init.h>
19 #include <asm/mach-au1x00/au1xxx.h>
20 #include <asm/mach-au1x00/au1xxx_dbdma.h>
21 #include <asm/mach-au1x00/au1100_mmc.h>
23 #define PORT(_base, _irq) \
29 .flags = UPF_SKIP_TEST | UPF_IOREMAP \
32 static struct plat_serial8250_port au1x00_uart_data[] = {
33 #if defined(CONFIG_SERIAL_8250_AU1X00)
34 #if defined(CONFIG_SOC_AU1000)
35 PORT(UART0_PHYS_ADDR, AU1000_UART0_INT),
36 PORT(UART1_PHYS_ADDR, AU1000_UART1_INT),
37 PORT(UART2_PHYS_ADDR, AU1000_UART2_INT),
38 PORT(UART3_PHYS_ADDR, AU1000_UART3_INT),
39 #elif defined(CONFIG_SOC_AU1500)
40 PORT(UART0_PHYS_ADDR, AU1500_UART0_INT),
41 PORT(UART3_PHYS_ADDR, AU1500_UART3_INT),
42 #elif defined(CONFIG_SOC_AU1100)
43 PORT(UART0_PHYS_ADDR, AU1100_UART0_INT),
44 PORT(UART1_PHYS_ADDR, AU1100_UART1_INT),
45 PORT(UART3_PHYS_ADDR, AU1100_UART3_INT),
46 #elif defined(CONFIG_SOC_AU1550)
47 PORT(UART0_PHYS_ADDR, AU1550_UART0_INT),
48 PORT(UART1_PHYS_ADDR, AU1550_UART1_INT),
49 PORT(UART3_PHYS_ADDR, AU1550_UART3_INT),
50 #elif defined(CONFIG_SOC_AU1200)
51 PORT(UART0_PHYS_ADDR, AU1200_UART0_INT),
52 PORT(UART1_PHYS_ADDR, AU1200_UART1_INT),
54 #endif /* CONFIG_SERIAL_8250_AU1X00 */
58 static struct platform_device au1xx0_uart_device = {
60 .id = PLAT8250_DEV_AU1X00,
62 .platform_data = au1x00_uart_data,
66 /* OHCI (USB full speed host controller) */
67 static struct resource au1xxx_usb_ohci_resources[] = {
69 .start = USB_OHCI_BASE,
70 .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
71 .flags = IORESOURCE_MEM,
74 .start = FOR_PLATFORM_C_USB_HOST_INT,
75 .end = FOR_PLATFORM_C_USB_HOST_INT,
76 .flags = IORESOURCE_IRQ,
80 /* The dmamask must be set for OHCI to work */
81 static u64 ohci_dmamask = DMA_BIT_MASK(32);
83 static struct platform_device au1xxx_usb_ohci_device = {
84 .name = "au1xxx-ohci",
87 .dma_mask = &ohci_dmamask,
88 .coherent_dma_mask = DMA_BIT_MASK(32),
90 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
91 .resource = au1xxx_usb_ohci_resources,
94 /*** AU1100 LCD controller ***/
96 #ifdef CONFIG_FB_AU1100
97 static struct resource au1100_lcd_resources[] = {
99 .start = LCD_PHYS_ADDR,
100 .end = LCD_PHYS_ADDR + 0x800 - 1,
101 .flags = IORESOURCE_MEM,
104 .start = AU1100_LCD_INT,
105 .end = AU1100_LCD_INT,
106 .flags = IORESOURCE_IRQ,
110 static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32);
112 static struct platform_device au1100_lcd_device = {
113 .name = "au1100-lcd",
116 .dma_mask = &au1100_lcd_dmamask,
117 .coherent_dma_mask = DMA_BIT_MASK(32),
119 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
120 .resource = au1100_lcd_resources,
124 #ifdef CONFIG_SOC_AU1200
125 /* EHCI (USB high speed host controller) */
126 static struct resource au1xxx_usb_ehci_resources[] = {
128 .start = USB_EHCI_BASE,
129 .end = USB_EHCI_BASE + USB_EHCI_LEN - 1,
130 .flags = IORESOURCE_MEM,
133 .start = AU1200_USB_INT,
134 .end = AU1200_USB_INT,
135 .flags = IORESOURCE_IRQ,
139 static u64 ehci_dmamask = DMA_BIT_MASK(32);
141 static struct platform_device au1xxx_usb_ehci_device = {
142 .name = "au1xxx-ehci",
145 .dma_mask = &ehci_dmamask,
146 .coherent_dma_mask = DMA_BIT_MASK(32),
148 .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
149 .resource = au1xxx_usb_ehci_resources,
152 /* Au1200 UDC (USB gadget controller) */
153 static struct resource au1xxx_usb_gdt_resources[] = {
155 .start = USB_UDC_BASE,
156 .end = USB_UDC_BASE + USB_UDC_LEN - 1,
157 .flags = IORESOURCE_MEM,
160 .start = AU1200_USB_INT,
161 .end = AU1200_USB_INT,
162 .flags = IORESOURCE_IRQ,
166 static u64 udc_dmamask = DMA_BIT_MASK(32);
168 static struct platform_device au1xxx_usb_gdt_device = {
169 .name = "au1xxx-udc",
172 .dma_mask = &udc_dmamask,
173 .coherent_dma_mask = DMA_BIT_MASK(32),
175 .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
176 .resource = au1xxx_usb_gdt_resources,
179 /* Au1200 UOC (USB OTG controller) */
180 static struct resource au1xxx_usb_otg_resources[] = {
182 .start = USB_UOC_BASE,
183 .end = USB_UOC_BASE + USB_UOC_LEN - 1,
184 .flags = IORESOURCE_MEM,
187 .start = AU1200_USB_INT,
188 .end = AU1200_USB_INT,
189 .flags = IORESOURCE_IRQ,
193 static u64 uoc_dmamask = DMA_BIT_MASK(32);
195 static struct platform_device au1xxx_usb_otg_device = {
196 .name = "au1xxx-uoc",
199 .dma_mask = &uoc_dmamask,
200 .coherent_dma_mask = DMA_BIT_MASK(32),
202 .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
203 .resource = au1xxx_usb_otg_resources,
206 static struct resource au1200_lcd_resources[] = {
208 .start = LCD_PHYS_ADDR,
209 .end = LCD_PHYS_ADDR + 0x800 - 1,
210 .flags = IORESOURCE_MEM,
213 .start = AU1200_LCD_INT,
214 .end = AU1200_LCD_INT,
215 .flags = IORESOURCE_IRQ,
219 static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
221 static struct platform_device au1200_lcd_device = {
222 .name = "au1200-lcd",
225 .dma_mask = &au1200_lcd_dmamask,
226 .coherent_dma_mask = DMA_BIT_MASK(32),
228 .num_resources = ARRAY_SIZE(au1200_lcd_resources),
229 .resource = au1200_lcd_resources,
232 static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
234 extern struct au1xmmc_platform_data au1xmmc_platdata[2];
236 static struct resource au1200_mmc0_resources[] = {
238 .start = SD0_PHYS_ADDR,
239 .end = SD0_PHYS_ADDR + 0x7ffff,
240 .flags = IORESOURCE_MEM,
243 .start = AU1200_SD_INT,
244 .end = AU1200_SD_INT,
245 .flags = IORESOURCE_IRQ,
248 .start = DSCR_CMD0_SDMS_TX0,
249 .end = DSCR_CMD0_SDMS_TX0,
250 .flags = IORESOURCE_DMA,
253 .start = DSCR_CMD0_SDMS_RX0,
254 .end = DSCR_CMD0_SDMS_RX0,
255 .flags = IORESOURCE_DMA,
259 static struct platform_device au1200_mmc0_device = {
260 .name = "au1xxx-mmc",
263 .dma_mask = &au1xxx_mmc_dmamask,
264 .coherent_dma_mask = DMA_BIT_MASK(32),
265 .platform_data = &au1xmmc_platdata[0],
267 .num_resources = ARRAY_SIZE(au1200_mmc0_resources),
268 .resource = au1200_mmc0_resources,
271 #ifndef CONFIG_MIPS_DB1200
272 static struct resource au1200_mmc1_resources[] = {
274 .start = SD1_PHYS_ADDR,
275 .end = SD1_PHYS_ADDR + 0x7ffff,
276 .flags = IORESOURCE_MEM,
279 .start = AU1200_SD_INT,
280 .end = AU1200_SD_INT,
281 .flags = IORESOURCE_IRQ,
284 .start = DSCR_CMD0_SDMS_TX1,
285 .end = DSCR_CMD0_SDMS_TX1,
286 .flags = IORESOURCE_DMA,
289 .start = DSCR_CMD0_SDMS_RX1,
290 .end = DSCR_CMD0_SDMS_RX1,
291 .flags = IORESOURCE_DMA,
295 static struct platform_device au1200_mmc1_device = {
296 .name = "au1xxx-mmc",
299 .dma_mask = &au1xxx_mmc_dmamask,
300 .coherent_dma_mask = DMA_BIT_MASK(32),
301 .platform_data = &au1xmmc_platdata[1],
303 .num_resources = ARRAY_SIZE(au1200_mmc1_resources),
304 .resource = au1200_mmc1_resources,
306 #endif /* #ifndef CONFIG_MIPS_DB1200 */
307 #endif /* #ifdef CONFIG_SOC_AU1200 */
309 /* All Alchemy demoboards with I2C have this #define in their headers */
310 #ifdef SMBUS_PSC_BASE
311 static struct resource pbdb_smbus_resources[] = {
313 .start = CPHYSADDR(SMBUS_PSC_BASE),
314 .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff),
315 .flags = IORESOURCE_MEM,
319 static struct platform_device pbdb_smbus_device = {
320 .name = "au1xpsc_smbus",
321 .id = 0, /* bus number */
322 .num_resources = ARRAY_SIZE(pbdb_smbus_resources),
323 .resource = pbdb_smbus_resources,
327 static struct platform_device *au1xxx_platform_devices[] __initdata = {
329 &au1xxx_usb_ohci_device,
330 #ifdef CONFIG_FB_AU1100
333 #ifdef CONFIG_SOC_AU1200
334 &au1xxx_usb_ehci_device,
335 &au1xxx_usb_gdt_device,
336 &au1xxx_usb_otg_device,
339 #ifndef CONFIG_MIPS_DB1200
343 #ifdef SMBUS_PSC_BASE
348 static int __init au1xxx_platform_init(void)
350 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
353 /* Fill up uartclk. */
354 for (i = 0; au1x00_uart_data[i].flags; i++)
355 au1x00_uart_data[i].uartclk = uartclk;
357 return platform_add_devices(au1xxx_platform_devices,
358 ARRAY_SIZE(au1xxx_platform_devices));
361 arch_initcall(au1xxx_platform_init);