code style scripts/checkpatch.pl (linux-3.9-rc1) formatting
[linux-2.6.34.14-moxart.git] / arch / arm / mach-moxart / devices.c
blob5c41ae940121e6493d130c58f809e437f55e9f3a
1 /* Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License,
5 * or (at your option) any later version. */
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/io.h>
10 #include <linux/platform_device.h>
11 #include <linux/serial_8250.h>
12 #include <linux/mtd/physmap.h>
14 #include <mach/irqs.h>
15 #include <mach/hardware.h>
16 #include <mach/board.h>
18 static struct plat_serial8250_port __initdata serial_platform_data[] = {
20 .membase = (void *)IO_ADDRESS(MOXART_UART1_BASE),
21 .mapbase = MOXART_UART1_BASE,
22 /* .iobase = IO_ADDRESS(MOXART_UART1_BASE), */
23 .irq = IRQ_UART,
24 .uartclk = UART_CLK,
25 .regshift = 2,
26 .iotype = UPIO_MEM,
27 .type = PORT_16550A,
28 .flags = UPF_SHARE_IRQ | UPF_SKIP_TEST,
30 /*{
31 .membase = (void *)IO_ADDRESS(MOXART_UART2_BASE),
32 .mapbase = MOXART_UART2_BASE,
33 .iobase = IO_ADDRESS(MOXART_UART2_BASE),
34 .irq = IRQ_UART,
35 .uartclk = UART_CLK,
36 .regshift = 2,
37 .iotype = UPIO_MEM,
38 .type = PORT_16550A,
39 .flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF |
40 UPF_SKIP_TEST | UPF_FIXED_TYPE,
41 },*/
42 {},
45 static struct platform_device __initdata serial_device = {
46 .name = "serial8250",
47 .id = PLAT8250_DEV_PLATFORM,
48 .dev = {
49 .platform_data = &serial_platform_data,
53 void __init moxart_register_uart(void)
55 platform_device_register(&serial_device);
58 /*static struct uart_port moxart_serial_ports[] = {
60 .iobase = IO_ADDRESS(MOXART_UART1_BASE),
61 .mapbase = MOXART_UART1_BASE,
62 .irq = IRQ_UART,
63 .flags = UPF_SKIP_TEST | UPF_SHARE_IRQ,
64 .iotype = UPIO_PORT,
65 .regshift = 2,
66 .uartclk = UART_CLK,
67 .line = 0,
68 .type = PORT_16550A,
69 .fifosize = 16
72 .iobase = IO_ADDRESS(MOXART_UART2_BASE),
73 .mapbase = MOXART_UART2_BASE,
74 .irq = IRQ_UART,
75 .flags = UPF_SKIP_TEST | UPF_SHARE_IRQ,
76 .iotype = UPIO_PORT,
77 .regshift = 2,
78 .uartclk = UART_CLK,
79 .line = 1,
80 .type = PORT_16550A,
81 .fifosize = 16
83 };*/
85 /*static void __init moxart_serial_init(void)
87 early_serial_setup(&moxart_serial_ports[0]);
88 early_serial_setup(&moxart_serial_ports[1]);
89 }*/
91 static struct resource __initdata moxart_mac1_resources[] = {
92 [0] = {
93 .start = IO_ADDRESS(MOXART_FTMAC1_BASE),
94 .end = IO_ADDRESS(MOXART_FTMAC1_BASE) + SZ_4K - 1,
95 .flags = IORESOURCE_MEM,
97 [1] = {
98 .start = IRQ_MAC1,
99 .end = IRQ_MAC1,
100 .flags = IORESOURCE_IRQ,
104 static struct resource __initdata moxart_mac2_resources[] = {
105 [0] = {
106 .start = IO_ADDRESS(MOXART_FTMAC2_BASE),
107 .end = IO_ADDRESS(MOXART_FTMAC2_BASE) + SZ_4K - 1,
108 .flags = IORESOURCE_MEM,
110 [1] = {
111 .start = IRQ_MAC2,
112 .end = IRQ_MAC2,
113 .flags = IORESOURCE_IRQ,
117 static struct moxart_eth_data __initdata moxart_mac1_data = {
118 .base_addr = IO_ADDRESS(MOXART_FTMAC1_BASE),
119 .irq = IRQ_MAC1,
120 .mac_addr_flash_offset = MOXART_FLASH_ETH1_OFFSET,
123 static struct moxart_eth_data __initdata moxart_mac2_data = {
124 .base_addr = IO_ADDRESS(MOXART_FTMAC2_BASE),
125 .irq = IRQ_MAC2,
126 .mac_addr_flash_offset = MOXART_FLASH_ETH2_OFFSET,
129 static struct platform_device __initdata moxart_mac1_device = {
130 .name = "MOXART_RTL8201CP",
131 .id = 0,
132 .dev = {
133 .platform_data = &moxart_mac1_data,
135 .resource = moxart_mac1_resources,
136 .num_resources = ARRAY_SIZE(moxart_mac1_resources),
139 static struct platform_device __initdata moxart_mac2_device = {
140 .name = "MOXART_RTL8201CP",
141 .id = 1,
142 .dev = {
143 .platform_data = &moxart_mac2_data,
145 .resource = moxart_mac2_resources,
146 .num_resources = ARRAY_SIZE(moxart_mac2_resources),
149 /*void __init moxart_add_ethernet_devices(struct moxart_eth_data *data)*/
150 void __init moxart_add_ethernet_devices(void)
152 platform_device_register(&moxart_mac1_device);
153 platform_device_register(&moxart_mac2_device);
156 static struct resource __initdata moxart_rtc_resource[] = {
157 [0] = {
158 .start = IO_ADDRESS(MOXART_PMU_BASE),
159 .end = IO_ADDRESS(MOXART_PMU_BASE) + SZ_4K - 1,
160 .flags = IORESOURCE_MEM,
164 static struct platform_device __initdata moxart_rtc_device = {
165 .name = "MOXART_RTC",
166 .id = 1,
167 .resource = moxart_rtc_resource,
168 .num_resources = ARRAY_SIZE(moxart_rtc_resource),
171 void __init moxart_add_rtc_device()
173 platform_device_register(&moxart_rtc_device);
176 static struct resource __initdata moxart_dma_resource[] = {
177 [0] = {
178 .start = IO_ADDRESS(MOXART_APB_DMA_BASE),
179 .end = IO_ADDRESS(MOXART_APB_DMA_BASE) + SZ_4K - 1,
180 .flags = IORESOURCE_MEM,
184 static struct platform_device __initdata moxart_dma_device = {
185 .name = "MOXART_APB_DMA",
186 .id = 1,
187 .resource = moxart_dma_resource,
188 .num_resources = ARRAY_SIZE(moxart_dma_resource),
191 void __init moxart_add_dma_device()
193 platform_device_register(&moxart_dma_device);