2 * Virtex hard ppc405 core common device listing
4 * Copyright 2005-2007 Secret Lab Technologies Ltd.
5 * Copyright 2005 Freescale Semiconductor Inc.
6 * Copyright 2002-2004 MontaVista Software, Inc.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/init.h>
15 #include <linux/module.h>
16 #include <linux/device.h>
17 #include <linux/serial_8250.h>
18 #include <syslib/virtex_devices.h>
19 #include <platforms/4xx/xparameters/xparameters.h>
23 * UARTLITE: shortcut macro for single instance
25 #define XPAR_UARTLITE(num) { \
29 .resource = (struct resource[]) { \
31 .start = XPAR_UARTLITE_##num##_BASEADDR + 3, \
32 .end = XPAR_UARTLITE_##num##_HIGHADDR, \
33 .flags = IORESOURCE_MEM, \
36 .start = XPAR_INTC_0_UARTLITE_##num##_VEC_ID, \
37 .flags = IORESOURCE_IRQ, \
43 * Full UART: shortcut macro for single instance + platform data structure
45 #define XPAR_UART(num) { \
46 .mapbase = XPAR_UARTNS550_##num##_BASEADDR + 3, \
47 .irq = XPAR_INTC_0_UARTNS550_##num##_VEC_ID, \
49 .uartclk = XPAR_UARTNS550_##num##_CLOCK_FREQ_HZ, \
50 .flags = UPF_BOOT_AUTOCONF, \
55 * SystemACE: shortcut macro for single instance
57 #define XPAR_SYSACE(num) { \
59 .id = XPAR_SYSACE_##num##_DEVICE_ID, \
61 .resource = (struct resource[]) { \
63 .start = XPAR_SYSACE_##num##_BASEADDR, \
64 .end = XPAR_SYSACE_##num##_HIGHADDR, \
65 .flags = IORESOURCE_MEM, \
68 .start = XPAR_INTC_0_SYSACE_##num##_VEC_ID, \
69 .flags = IORESOURCE_IRQ, \
75 /* UART 8250 driver platform data table */
76 struct plat_serial8250_port virtex_serial_platform_data[] = {
77 #if defined(XPAR_UARTNS550_0_BASEADDR)
80 #if defined(XPAR_UARTNS550_1_BASEADDR)
83 #if defined(XPAR_UARTNS550_2_BASEADDR)
86 #if defined(XPAR_UARTNS550_3_BASEADDR)
89 #if defined(XPAR_UARTNS550_4_BASEADDR)
92 #if defined(XPAR_UARTNS550_5_BASEADDR)
95 #if defined(XPAR_UARTNS550_6_BASEADDR)
98 #if defined(XPAR_UARTNS550_7_BASEADDR)
101 { }, /* terminated by empty record */
105 struct platform_device virtex_platform_devices[] = {
106 /* UARTLITE instances */
107 #if defined(XPAR_UARTLITE_0_BASEADDR)
110 #if defined(XPAR_UARTLITE_1_BASEADDR)
113 #if defined(XPAR_UARTLITE_2_BASEADDR)
116 #if defined(XPAR_UARTLITE_3_BASEADDR)
119 #if defined(XPAR_UARTLITE_4_BASEADDR)
122 #if defined(XPAR_UARTLITE_5_BASEADDR)
125 #if defined(XPAR_UARTLITE_6_BASEADDR)
128 #if defined(XPAR_UARTLITE_7_BASEADDR)
132 /* Full UART instances */
133 #if defined(XPAR_UARTNS550_0_BASEADDR)
135 .name = "serial8250",
137 .dev.platform_data = virtex_serial_platform_data,
141 /* SystemACE instances */
142 #if defined(XPAR_SYSACE_0_BASEADDR)
145 #if defined(XPAR_SYSACE_1_BASEADDR)
149 /* ML300/403 reference design framebuffer */
150 #if defined(XPAR_TFT_0_BASEADDR)
155 .resource = (struct resource[]) {
157 .start = XPAR_TFT_0_BASEADDR,
158 .end = XPAR_TFT_0_BASEADDR+7,
159 .flags = IORESOURCE_IO,
166 /* Early serial support functions */
168 virtex_early_serial_init(int num, struct plat_serial8250_port *pdata)
170 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
171 struct uart_port serial_req;
173 memset(&serial_req, 0, sizeof(serial_req));
174 serial_req.mapbase = pdata->mapbase;
175 serial_req.membase = pdata->membase;
176 serial_req.irq = pdata->irq;
177 serial_req.uartclk = pdata->uartclk;
178 serial_req.regshift = pdata->regshift;
179 serial_req.iotype = pdata->iotype;
180 serial_req.flags = pdata->flags;
181 gen550_init(num, &serial_req);
186 virtex_early_serial_map(void)
188 #ifdef CONFIG_SERIAL_8250
189 struct plat_serial8250_port *pdata;
192 pdata = virtex_serial_platform_data;
193 while(pdata && pdata->flags) {
194 pdata->membase = ioremap(pdata->mapbase, 0x100);
195 virtex_early_serial_init(i, pdata);
199 #endif /* CONFIG_SERIAL_8250 */
203 * default fixup routine; do nothing and return success.
205 * Reimplement this routine in your custom board support file to
206 * override the default behaviour
208 int __attribute__ ((weak))
209 virtex_device_fixup(struct platform_device *dev)
214 static int __init virtex_init(void)
216 struct platform_device *index = virtex_platform_devices;
217 unsigned int ret = 0;
220 for (i = 0; i < ARRAY_SIZE(virtex_platform_devices); i++, index++) {
221 if (virtex_device_fixup(index) != 0)
224 if (platform_device_register(index)) {
226 printk(KERN_ERR "cannot register dev %s:%d\n",
227 index->name, index->id);
233 subsys_initcall(virtex_init);