blob: 3be14b09157c253f4d1dc717a2a7aab1be97d796 [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 *
Sergei Shtylyov6e766452008-04-04 00:02:53 +04006 * (C) Copyright Embedded Alley Solutions, Inc 2005
7 * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
8 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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.
12 */
Sergei Shtylyovce28f942008-04-23 22:43:55 +040013
Ralf Baechle4b622202008-07-15 18:44:29 +010014#include <linux/dma-mapping.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010015#include <linux/platform_device.h>
Sergei Shtylyov6e766452008-04-04 00:02:53 +040016#include <linux/serial_8250.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Pete Popov26a940e2005-09-15 08:03:12 +000019#include <asm/mach-au1x00/au1xxx.h>
Manuel Laussf591eb12008-10-21 08:59:14 +020020#include <asm/mach-au1x00/au1xxx_dbdma.h>
21#include <asm/mach-au1x00/au1100_mmc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Manuel Laussb6e6d122009-10-15 19:07:34 +020023#define PORT(_base, _irq) \
24 { \
25 .mapbase = _base, \
26 .irq = _irq, \
27 .regshift = 2, \
28 .iotype = UPIO_AU, \
Manuel Lauss63ea3362009-10-28 21:49:46 +010029 .flags = UPF_SKIP_TEST | UPF_IOREMAP | \
30 UPF_FIXED_TYPE, \
31 .type = PORT_16550A, \
Sergei Shtylyov6e766452008-04-04 00:02:53 +040032 }
33
34static struct plat_serial8250_port au1x00_uart_data[] = {
35#if defined(CONFIG_SERIAL_8250_AU1X00)
36#if defined(CONFIG_SOC_AU1000)
Manuel Laussb6e6d122009-10-15 19:07:34 +020037 PORT(UART0_PHYS_ADDR, AU1000_UART0_INT),
38 PORT(UART1_PHYS_ADDR, AU1000_UART1_INT),
39 PORT(UART2_PHYS_ADDR, AU1000_UART2_INT),
40 PORT(UART3_PHYS_ADDR, AU1000_UART3_INT),
Sergei Shtylyov6e766452008-04-04 00:02:53 +040041#elif defined(CONFIG_SOC_AU1500)
Manuel Laussb6e6d122009-10-15 19:07:34 +020042 PORT(UART0_PHYS_ADDR, AU1500_UART0_INT),
43 PORT(UART3_PHYS_ADDR, AU1500_UART3_INT),
Sergei Shtylyov6e766452008-04-04 00:02:53 +040044#elif defined(CONFIG_SOC_AU1100)
Manuel Laussb6e6d122009-10-15 19:07:34 +020045 PORT(UART0_PHYS_ADDR, AU1100_UART0_INT),
46 PORT(UART1_PHYS_ADDR, AU1100_UART1_INT),
47 PORT(UART3_PHYS_ADDR, AU1100_UART3_INT),
Sergei Shtylyov6e766452008-04-04 00:02:53 +040048#elif defined(CONFIG_SOC_AU1550)
Manuel Laussb6e6d122009-10-15 19:07:34 +020049 PORT(UART0_PHYS_ADDR, AU1550_UART0_INT),
50 PORT(UART1_PHYS_ADDR, AU1550_UART1_INT),
51 PORT(UART3_PHYS_ADDR, AU1550_UART3_INT),
Sergei Shtylyov6e766452008-04-04 00:02:53 +040052#elif defined(CONFIG_SOC_AU1200)
Manuel Laussb6e6d122009-10-15 19:07:34 +020053 PORT(UART0_PHYS_ADDR, AU1200_UART0_INT),
54 PORT(UART1_PHYS_ADDR, AU1200_UART1_INT),
Sergei Shtylyov6e766452008-04-04 00:02:53 +040055#endif
56#endif /* CONFIG_SERIAL_8250_AU1X00 */
57 { },
58};
59
60static struct platform_device au1xx0_uart_device = {
61 .name = "serial8250",
62 .id = PLAT8250_DEV_AU1X00,
63 .dev = {
64 .platform_data = au1x00_uart_data,
65 },
66};
67
Pete Popov64abf642005-09-14 16:17:59 +000068/* OHCI (USB full speed host controller) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070069static struct resource au1xxx_usb_ohci_resources[] = {
70 [0] = {
71 .start = USB_OHCI_BASE,
Jordan Croused5fb7f12006-01-20 14:09:54 -080072 .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
Manuel Lauss78814462009-10-07 20:15:15 +020076 .start = FOR_PLATFORM_C_USB_HOST_INT,
77 .end = FOR_PLATFORM_C_USB_HOST_INT,
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 .flags = IORESOURCE_IRQ,
79 },
80};
81
82/* The dmamask must be set for OHCI to work */
Yang Hongyang284901a2009-04-06 19:01:15 -070083static u64 ohci_dmamask = DMA_BIT_MASK(32);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85static struct platform_device au1xxx_usb_ohci_device = {
86 .name = "au1xxx-ohci",
87 .id = 0,
88 .dev = {
89 .dma_mask = &ohci_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -070090 .coherent_dma_mask = DMA_BIT_MASK(32),
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 },
92 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
93 .resource = au1xxx_usb_ohci_resources,
94};
95
Pete Popov3b495f22005-04-04 01:06:19 +000096/*** AU1100 LCD controller ***/
97
98#ifdef CONFIG_FB_AU1100
99static struct resource au1100_lcd_resources[] = {
100 [0] = {
101 .start = LCD_PHYS_ADDR,
102 .end = LCD_PHYS_ADDR + 0x800 - 1,
103 .flags = IORESOURCE_MEM,
104 },
105 [1] = {
106 .start = AU1100_LCD_INT,
107 .end = AU1100_LCD_INT,
108 .flags = IORESOURCE_IRQ,
109 }
110};
111
Yang Hongyang284901a2009-04-06 19:01:15 -0700112static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32);
Pete Popov3b495f22005-04-04 01:06:19 +0000113
114static struct platform_device au1100_lcd_device = {
115 .name = "au1100-lcd",
116 .id = 0,
117 .dev = {
118 .dma_mask = &au1100_lcd_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700119 .coherent_dma_mask = DMA_BIT_MASK(32),
Pete Popov3b495f22005-04-04 01:06:19 +0000120 },
121 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
122 .resource = au1100_lcd_resources,
123};
124#endif
125
Pete Popov64abf642005-09-14 16:17:59 +0000126#ifdef CONFIG_SOC_AU1200
127/* EHCI (USB high speed host controller) */
128static struct resource au1xxx_usb_ehci_resources[] = {
129 [0] = {
130 .start = USB_EHCI_BASE,
131 .end = USB_EHCI_BASE + USB_EHCI_LEN - 1,
132 .flags = IORESOURCE_MEM,
133 },
134 [1] = {
Manuel Lauss78814462009-10-07 20:15:15 +0200135 .start = AU1200_USB_INT,
136 .end = AU1200_USB_INT,
Pete Popov64abf642005-09-14 16:17:59 +0000137 .flags = IORESOURCE_IRQ,
138 },
139};
140
Yang Hongyang284901a2009-04-06 19:01:15 -0700141static u64 ehci_dmamask = DMA_BIT_MASK(32);
Pete Popov64abf642005-09-14 16:17:59 +0000142
143static struct platform_device au1xxx_usb_ehci_device = {
144 .name = "au1xxx-ehci",
145 .id = 0,
146 .dev = {
147 .dma_mask = &ehci_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700148 .coherent_dma_mask = DMA_BIT_MASK(32),
Pete Popov64abf642005-09-14 16:17:59 +0000149 },
150 .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
151 .resource = au1xxx_usb_ehci_resources,
152};
153
154/* Au1200 UDC (USB gadget controller) */
155static struct resource au1xxx_usb_gdt_resources[] = {
156 [0] = {
157 .start = USB_UDC_BASE,
158 .end = USB_UDC_BASE + USB_UDC_LEN - 1,
159 .flags = IORESOURCE_MEM,
160 },
161 [1] = {
162 .start = AU1200_USB_INT,
163 .end = AU1200_USB_INT,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
Yang Hongyang284901a2009-04-06 19:01:15 -0700168static u64 udc_dmamask = DMA_BIT_MASK(32);
Pete Popov64abf642005-09-14 16:17:59 +0000169
170static struct platform_device au1xxx_usb_gdt_device = {
171 .name = "au1xxx-udc",
172 .id = 0,
173 .dev = {
174 .dma_mask = &udc_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700175 .coherent_dma_mask = DMA_BIT_MASK(32),
Pete Popov64abf642005-09-14 16:17:59 +0000176 },
177 .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
178 .resource = au1xxx_usb_gdt_resources,
179};
180
181/* Au1200 UOC (USB OTG controller) */
182static struct resource au1xxx_usb_otg_resources[] = {
183 [0] = {
184 .start = USB_UOC_BASE,
185 .end = USB_UOC_BASE + USB_UOC_LEN - 1,
186 .flags = IORESOURCE_MEM,
187 },
188 [1] = {
189 .start = AU1200_USB_INT,
190 .end = AU1200_USB_INT,
191 .flags = IORESOURCE_IRQ,
192 },
193};
194
Yang Hongyang284901a2009-04-06 19:01:15 -0700195static u64 uoc_dmamask = DMA_BIT_MASK(32);
Pete Popov64abf642005-09-14 16:17:59 +0000196
197static struct platform_device au1xxx_usb_otg_device = {
198 .name = "au1xxx-uoc",
199 .id = 0,
200 .dev = {
201 .dma_mask = &uoc_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700202 .coherent_dma_mask = DMA_BIT_MASK(32),
Pete Popov64abf642005-09-14 16:17:59 +0000203 },
204 .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
205 .resource = au1xxx_usb_otg_resources,
206};
207
Pete Popov64abf642005-09-14 16:17:59 +0000208static struct resource au1200_lcd_resources[] = {
209 [0] = {
210 .start = LCD_PHYS_ADDR,
211 .end = LCD_PHYS_ADDR + 0x800 - 1,
212 .flags = IORESOURCE_MEM,
213 },
214 [1] = {
215 .start = AU1200_LCD_INT,
216 .end = AU1200_LCD_INT,
217 .flags = IORESOURCE_IRQ,
218 }
219};
220
Yang Hongyang284901a2009-04-06 19:01:15 -0700221static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
Pete Popov64abf642005-09-14 16:17:59 +0000222
223static struct platform_device au1200_lcd_device = {
224 .name = "au1200-lcd",
225 .id = 0,
226 .dev = {
227 .dma_mask = &au1200_lcd_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700228 .coherent_dma_mask = DMA_BIT_MASK(32),
Pete Popov64abf642005-09-14 16:17:59 +0000229 },
230 .num_resources = ARRAY_SIZE(au1200_lcd_resources),
231 .resource = au1200_lcd_resources,
232};
Pete Popov26a940e2005-09-15 08:03:12 +0000233
Yang Hongyang284901a2009-04-06 19:01:15 -0700234static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
Pete Popovba264b32005-09-21 06:18:27 +0000235
Manuel Laussf591eb12008-10-21 08:59:14 +0200236extern struct au1xmmc_platform_data au1xmmc_platdata[2];
237
238static struct resource au1200_mmc0_resources[] = {
239 [0] = {
240 .start = SD0_PHYS_ADDR,
241 .end = SD0_PHYS_ADDR + 0x7ffff,
242 .flags = IORESOURCE_MEM,
243 },
244 [1] = {
245 .start = AU1200_SD_INT,
246 .end = AU1200_SD_INT,
247 .flags = IORESOURCE_IRQ,
248 },
249 [2] = {
250 .start = DSCR_CMD0_SDMS_TX0,
251 .end = DSCR_CMD0_SDMS_TX0,
252 .flags = IORESOURCE_DMA,
253 },
254 [3] = {
255 .start = DSCR_CMD0_SDMS_RX0,
256 .end = DSCR_CMD0_SDMS_RX0,
257 .flags = IORESOURCE_DMA,
258 }
259};
260
261static struct platform_device au1200_mmc0_device = {
Pete Popovba264b32005-09-21 06:18:27 +0000262 .name = "au1xxx-mmc",
263 .id = 0,
264 .dev = {
Manuel Laussf591eb12008-10-21 08:59:14 +0200265 .dma_mask = &au1xxx_mmc_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700266 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Laussf591eb12008-10-21 08:59:14 +0200267 .platform_data = &au1xmmc_platdata[0],
Pete Popovba264b32005-09-21 06:18:27 +0000268 },
Manuel Laussf591eb12008-10-21 08:59:14 +0200269 .num_resources = ARRAY_SIZE(au1200_mmc0_resources),
270 .resource = au1200_mmc0_resources,
Pete Popovba264b32005-09-21 06:18:27 +0000271};
Manuel Laussf591eb12008-10-21 08:59:14 +0200272
273#ifndef CONFIG_MIPS_DB1200
274static struct resource au1200_mmc1_resources[] = {
275 [0] = {
276 .start = SD1_PHYS_ADDR,
277 .end = SD1_PHYS_ADDR + 0x7ffff,
278 .flags = IORESOURCE_MEM,
279 },
280 [1] = {
281 .start = AU1200_SD_INT,
282 .end = AU1200_SD_INT,
283 .flags = IORESOURCE_IRQ,
284 },
285 [2] = {
286 .start = DSCR_CMD0_SDMS_TX1,
287 .end = DSCR_CMD0_SDMS_TX1,
288 .flags = IORESOURCE_DMA,
289 },
290 [3] = {
291 .start = DSCR_CMD0_SDMS_RX1,
292 .end = DSCR_CMD0_SDMS_RX1,
293 .flags = IORESOURCE_DMA,
294 }
295};
296
297static struct platform_device au1200_mmc1_device = {
298 .name = "au1xxx-mmc",
299 .id = 1,
300 .dev = {
301 .dma_mask = &au1xxx_mmc_dmamask,
Yang Hongyang284901a2009-04-06 19:01:15 -0700302 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Laussf591eb12008-10-21 08:59:14 +0200303 .platform_data = &au1xmmc_platdata[1],
304 },
305 .num_resources = ARRAY_SIZE(au1200_mmc1_resources),
306 .resource = au1200_mmc1_resources,
307};
308#endif /* #ifndef CONFIG_MIPS_DB1200 */
Pete Popovba264b32005-09-21 06:18:27 +0000309#endif /* #ifdef CONFIG_SOC_AU1200 */
310
Manuel Lauss8b798c42008-01-27 18:14:52 +0100311/* All Alchemy demoboards with I2C have this #define in their headers */
312#ifdef SMBUS_PSC_BASE
313static struct resource pbdb_smbus_resources[] = {
314 {
Sergei Shtylyov8e07c2c2008-04-05 22:16:21 +0400315 .start = CPHYSADDR(SMBUS_PSC_BASE),
316 .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff),
Manuel Lauss8b798c42008-01-27 18:14:52 +0100317 .flags = IORESOURCE_MEM,
318 },
319};
320
321static struct platform_device pbdb_smbus_device = {
322 .name = "au1xpsc_smbus",
323 .id = 0, /* bus number */
324 .num_resources = ARRAY_SIZE(pbdb_smbus_resources),
325 .resource = pbdb_smbus_resources,
326};
327#endif
328
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329static struct platform_device *au1xxx_platform_devices[] __initdata = {
Sergei Shtylyov6e766452008-04-04 00:02:53 +0400330 &au1xx0_uart_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 &au1xxx_usb_ohci_device,
Pete Popov3b495f22005-04-04 01:06:19 +0000332#ifdef CONFIG_FB_AU1100
333 &au1100_lcd_device,
334#endif
Pete Popov64abf642005-09-14 16:17:59 +0000335#ifdef CONFIG_SOC_AU1200
Pete Popov64abf642005-09-14 16:17:59 +0000336 &au1xxx_usb_ehci_device,
Pete Popov64abf642005-09-14 16:17:59 +0000337 &au1xxx_usb_gdt_device,
338 &au1xxx_usb_otg_device,
339 &au1200_lcd_device,
Manuel Laussf591eb12008-10-21 08:59:14 +0200340 &au1200_mmc0_device,
341#ifndef CONFIG_MIPS_DB1200
342 &au1200_mmc1_device,
343#endif
Pete Popov64abf642005-09-14 16:17:59 +0000344#endif
Manuel Lauss8b798c42008-01-27 18:14:52 +0100345#ifdef SMBUS_PSC_BASE
346 &pbdb_smbus_device,
347#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348};
349
Sergei Shtylyovc1dcb142008-04-30 23:18:41 +0400350static int __init au1xxx_platform_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351{
Sergei Shtylyov6e766452008-04-04 00:02:53 +0400352 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
353 int i;
354
355 /* Fill up uartclk. */
Sergei Shtylyovc1dcb142008-04-30 23:18:41 +0400356 for (i = 0; au1x00_uart_data[i].flags; i++)
Sergei Shtylyov6e766452008-04-04 00:02:53 +0400357 au1x00_uart_data[i].uartclk = uartclk;
358
Sergei Shtylyovc1dcb142008-04-30 23:18:41 +0400359 return platform_add_devices(au1xxx_platform_devices,
360 ARRAY_SIZE(au1xxx_platform_devices));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361}
362
363arch_initcall(au1xxx_platform_init);