2 * arch/arm/plat-orion/common.c
4 * Marvell Orion SoC common setup code used by multiple mach-/common.c
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.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/serial_8250.h>
16 /* Fill in the resources structure and link it into the platform
17 device structure. There is always a memory region, and nearly
18 always an interrupt.*/
19 static void fill_resources(struct platform_device *device,
20 struct resource *resources,
21 resource_size_t mapbase,
25 device->resource = resources;
26 device->num_resources = 1;
27 resources[0].flags = IORESOURCE_MEM;
28 resources[0].start = mapbase;
29 resources[0].end = mapbase + size;
32 device->num_resources++;
33 resources[1].flags = IORESOURCE_IRQ;
34 resources[1].start = irq;
35 resources[1].end = irq;
39 /*****************************************************************************
41 ****************************************************************************/
42 static void __init uart_complete(
43 struct platform_device *orion_uart,
44 struct plat_serial8250_port *data,
45 struct resource *resources,
47 resource_size_t mapbase,
51 data->mapbase = mapbase;
52 data->membase = (void __iomem *)membase;
54 data->uartclk = uartclk;
55 orion_uart->dev.platform_data = data;
57 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
58 platform_device_register(orion_uart);
61 /*****************************************************************************
63 ****************************************************************************/
64 static struct plat_serial8250_port orion_uart0_data[] = {
66 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
73 static struct resource orion_uart0_resources[2];
75 static struct platform_device orion_uart0 = {
77 .id = PLAT8250_DEV_PLATFORM,
80 void __init orion_uart0_init(unsigned int membase,
81 resource_size_t mapbase,
85 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
86 membase, mapbase, irq, uartclk);
89 /*****************************************************************************
91 ****************************************************************************/
92 static struct plat_serial8250_port orion_uart1_data[] = {
94 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
101 static struct resource orion_uart1_resources[2];
103 static struct platform_device orion_uart1 = {
104 .name = "serial8250",
105 .id = PLAT8250_DEV_PLATFORM1,
108 void __init orion_uart1_init(unsigned int membase,
109 resource_size_t mapbase,
111 unsigned int uartclk)
113 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
114 membase, mapbase, irq, uartclk);
117 /*****************************************************************************
119 ****************************************************************************/
120 static struct plat_serial8250_port orion_uart2_data[] = {
122 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
129 static struct resource orion_uart2_resources[2];
131 static struct platform_device orion_uart2 = {
132 .name = "serial8250",
133 .id = PLAT8250_DEV_PLATFORM2,
136 void __init orion_uart2_init(unsigned int membase,
137 resource_size_t mapbase,
139 unsigned int uartclk)
141 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
142 membase, mapbase, irq, uartclk);
145 /*****************************************************************************
147 ****************************************************************************/
148 static struct plat_serial8250_port orion_uart3_data[] = {
150 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
157 static struct resource orion_uart3_resources[2];
159 static struct platform_device orion_uart3 = {
160 .name = "serial8250",
164 void __init orion_uart3_init(unsigned int membase,
165 resource_size_t mapbase,
167 unsigned int uartclk)
169 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
170 membase, mapbase, irq, uartclk);