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>
28 #include <mach/board.h>
30 #include <linux/gpio.h>
34 static void __init
rsi_ews_init_early(void)
36 /* Initialize processor: 18.432 MHz crystal */
37 at91_initialize(18432000);
40 at91_init_leds(AT91_PIN_PB6
, AT91_PIN_PB9
);
42 /* DBGU on ttyS0. (Rx & Tx only) */
43 /* This one is for debugging */
44 at91_register_uart(0, 0, 0);
46 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
47 /* Dialin/-out modem interface */
48 at91_register_uart(AT91RM9200_ID_US1
, 2, ATMEL_UART_CTS
| ATMEL_UART_RTS
49 | ATMEL_UART_DTR
| ATMEL_UART_DSR
| ATMEL_UART_DCD
52 /* USART3 on ttyS4. (Rx, Tx, RTS) */
53 /* RS485 communication */
54 at91_register_uart(AT91RM9200_ID_US3
, 4, ATMEL_UART_RTS
);
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
63 static struct at91_eth_data rsi_ews_eth_data __initdata
= {
64 .phy_irq_pin
= AT91_PIN_PC4
,
71 static struct at91_usbh_data rsi_ews_usbh_data __initdata
= {
78 static struct at91_mmc_data rsi_ews_mmc_data __initdata
= {
81 .det_pin
= AT91_PIN_PB27
,
82 .wp_pin
= AT91_PIN_PB29
,
88 static struct i2c_board_info rsi_ews_i2c_devices
[] __initdata
= {
90 I2C_BOARD_INFO("ds1337", 0x68),
93 I2C_BOARD_INFO("24c01", 0x50),
100 static struct gpio_led rsi_ews_leds
[] = {
103 .gpio
= AT91_PIN_PB6
,
108 .gpio
= AT91_PIN_PB7
,
113 .gpio
= AT91_PIN_PB8
,
118 .gpio
= AT91_PIN_PB9
,
126 static struct spi_board_info rsi_ews_spi_devices
[] = {
127 { /* DataFlash chip 1*/
128 .modalias
= "mtd_dataflash",
130 .max_speed_hz
= 5 * 1000 * 1000,
132 { /* DataFlash chip 2*/
133 .modalias
= "mtd_dataflash",
135 .max_speed_hz
= 5 * 1000 * 1000,
142 static struct mtd_partition rsiews_nor_partitions
[] = {
147 .mask_flags
= MTD_WRITEABLE
151 .offset
= MTDPART_OFS_NXTBLK
,
152 .size
= SZ_2M
- (3 * SZ_128K
)
156 .offset
= MTDPART_OFS_NXTBLK
,
161 .offset
= MTDPART_OFS_NXTBLK
,
163 .mask_flags
= MTD_WRITEABLE
167 .offset
= MTDPART_OFS_NXTBLK
,
169 .mask_flags
= MTD_WRITEABLE
173 static struct physmap_flash_data rsiews_nor_data
= {
175 .parts
= rsiews_nor_partitions
,
176 .nr_parts
= ARRAY_SIZE(rsiews_nor_partitions
),
179 #define NOR_BASE AT91_CHIPSELECT_0
180 #define NOR_SIZE SZ_16M
182 static struct resource nor_flash_resources
[] = {
185 .end
= NOR_BASE
+ NOR_SIZE
- 1,
186 .flags
= IORESOURCE_MEM
,
190 static struct platform_device rsiews_nor_flash
= {
191 .name
= "physmap-flash",
194 .platform_data
= &rsiews_nor_data
,
196 .resource
= nor_flash_resources
,
197 .num_resources
= ARRAY_SIZE(nor_flash_resources
),
203 static void __init
rsi_ews_board_init(void)
206 at91_add_device_serial();
207 at91_set_gpio_output(AT91_PIN_PA21
, 0);
209 at91_add_device_eth(&rsi_ews_eth_data
);
211 at91_add_device_usbh(&rsi_ews_usbh_data
);
213 at91_add_device_i2c(rsi_ews_i2c_devices
,
214 ARRAY_SIZE(rsi_ews_i2c_devices
));
216 at91_add_device_spi(rsi_ews_spi_devices
,
217 ARRAY_SIZE(rsi_ews_spi_devices
));
219 at91_add_device_mmc(0, &rsi_ews_mmc_data
);
221 platform_device_register(&rsiews_nor_flash
);
223 at91_gpio_leds(rsi_ews_leds
, ARRAY_SIZE(rsi_ews_leds
));
226 MACHINE_START(RSI_EWS
, "RSI EWS")
227 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
228 .timer
= &at91rm9200_timer
,
229 .map_io
= at91_map_io
,
230 .init_early
= rsi_ews_init_early
,
231 .init_irq
= at91_init_irq_default
,
232 .init_machine
= rsi_ews_board_init
,