6 * 2008-2011 R-S-I Elektrotechnik GmbH & Co. KG
8 * Licensed under GPLv2 or later.
11 #include <linux/types.h>
12 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
16 #include <linux/spi/spi.h>
17 #include <linux/mtd/physmap.h>
19 #include <asm/setup.h>
20 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
27 #include <mach/hardware.h>
29 #include <linux/gpio.h>
36 static void __init rsi_ews_init_early(void)
38 /* Initialize processor: 18.432 MHz crystal */
39 at91_initialize(18432000);
45 static struct macb_platform_data rsi_ews_eth_data __initdata = {
46 .phy_irq_pin = AT91_PIN_PC4,
53 static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
55 .vbus_pin = {-EINVAL, -EINVAL},
56 .overcurrent_pin= {-EINVAL, -EINVAL},
62 static struct mci_platform_data __initdata rsi_ews_mci0_data = {
65 .detect_pin = AT91_PIN_PB27,
66 .wp_pin = AT91_PIN_PB29,
73 static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
75 I2C_BOARD_INFO("ds1337", 0x68),
78 I2C_BOARD_INFO("24c01", 0x50),
85 static struct gpio_led rsi_ews_leds[] = {
103 .gpio = AT91_PIN_PB9,
111 static struct spi_board_info rsi_ews_spi_devices[] = {
112 { /* DataFlash chip 1*/
113 .modalias = "mtd_dataflash",
115 .max_speed_hz = 5 * 1000 * 1000,
117 { /* DataFlash chip 2*/
118 .modalias = "mtd_dataflash",
120 .max_speed_hz = 5 * 1000 * 1000,
127 static struct mtd_partition rsiews_nor_partitions[] = {
132 .mask_flags = MTD_WRITEABLE
136 .offset = MTDPART_OFS_NXTBLK,
137 .size = SZ_2M - (3 * SZ_128K)
141 .offset = MTDPART_OFS_NXTBLK,
146 .offset = MTDPART_OFS_NXTBLK,
148 .mask_flags = MTD_WRITEABLE
152 .offset = MTDPART_OFS_NXTBLK,
154 .mask_flags = MTD_WRITEABLE
158 static struct physmap_flash_data rsiews_nor_data = {
160 .parts = rsiews_nor_partitions,
161 .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
164 #define NOR_BASE AT91_CHIPSELECT_0
165 #define NOR_SIZE SZ_16M
167 static struct resource nor_flash_resources[] = {
170 .end = NOR_BASE + NOR_SIZE - 1,
171 .flags = IORESOURCE_MEM,
175 static struct platform_device rsiews_nor_flash = {
176 .name = "physmap-flash",
179 .platform_data = &rsiews_nor_data,
181 .resource = nor_flash_resources,
182 .num_resources = ARRAY_SIZE(nor_flash_resources),
188 static void __init rsi_ews_board_init(void)
191 /* DBGU on ttyS0. (Rx & Tx only) */
192 /* This one is for debugging */
193 at91_register_uart(0, 0, 0);
195 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
196 /* Dialin/-out modem interface */
197 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
198 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
201 /* USART3 on ttyS4. (Rx, Tx, RTS) */
202 /* RS485 communication */
203 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
204 at91_add_device_serial();
205 at91_set_gpio_output(AT91_PIN_PA21, 0);
207 at91_add_device_eth(&rsi_ews_eth_data);
209 at91_add_device_usbh(&rsi_ews_usbh_data);
211 at91_add_device_i2c(rsi_ews_i2c_devices,
212 ARRAY_SIZE(rsi_ews_i2c_devices));
214 at91_add_device_spi(rsi_ews_spi_devices,
215 ARRAY_SIZE(rsi_ews_spi_devices));
217 at91_add_device_mci(0, &rsi_ews_mci0_data);
219 platform_device_register(&rsiews_nor_flash);
221 at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
224 MACHINE_START(RSI_EWS, "RSI EWS")
225 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
226 .init_time = at91rm9200_timer_init,
227 .map_io = at91_map_io,
228 .handle_irq = at91_aic_handle_irq,
229 .init_early = rsi_ews_init_early,
230 .init_irq = at91_init_irq_default,
231 .init_machine = rsi_ews_board_init,