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>
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), */
28 .flags
= UPF_SHARE_IRQ
| UPF_SKIP_TEST
,
31 .membase = (void *)IO_ADDRESS(MOXART_UART2_BASE),
32 .mapbase = MOXART_UART2_BASE,
33 .iobase = IO_ADDRESS(MOXART_UART2_BASE),
39 .flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF |
40 UPF_SKIP_TEST | UPF_FIXED_TYPE,
45 static struct platform_device __initdata serial_device
= {
47 .id
= PLAT8250_DEV_PLATFORM
,
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,
63 .flags = UPF_SKIP_TEST | UPF_SHARE_IRQ,
72 .iobase = IO_ADDRESS(MOXART_UART2_BASE),
73 .mapbase = MOXART_UART2_BASE,
75 .flags = UPF_SKIP_TEST | UPF_SHARE_IRQ,
85 /*static void __init moxart_serial_init(void)
87 early_serial_setup(&moxart_serial_ports[0]);
88 early_serial_setup(&moxart_serial_ports[1]);
91 static struct resource __initdata moxart_mac1_resources
[] = {
93 .start
= IO_ADDRESS(MOXART_FTMAC1_BASE
),
94 .end
= IO_ADDRESS(MOXART_FTMAC1_BASE
) + SZ_4K
- 1,
95 .flags
= IORESOURCE_MEM
,
100 .flags
= IORESOURCE_IRQ
,
104 static struct resource __initdata moxart_mac2_resources
[] = {
106 .start
= IO_ADDRESS(MOXART_FTMAC2_BASE
),
107 .end
= IO_ADDRESS(MOXART_FTMAC2_BASE
) + SZ_4K
- 1,
108 .flags
= IORESOURCE_MEM
,
113 .flags
= IORESOURCE_IRQ
,
117 static struct moxart_eth_data __initdata moxart_mac1_data
= {
118 .base_addr
= IO_ADDRESS(MOXART_FTMAC1_BASE
),
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
),
126 .mac_addr_flash_offset
= MOXART_FLASH_ETH2_OFFSET
,
129 static struct platform_device __initdata moxart_mac1_device
= {
130 .name
= "MOXART_RTL8201CP",
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",
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
[] = {
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",
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
[] = {
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",
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
);