blob: c3b43aefdb7597d2f71dc5e8e40e054019b891f6 [file] [log] [blame]
Josef Holzmayr82cb8652011-08-02 13:28:42 +02001/*
2 * board-rsi-ews.c
3 *
4 * Copyright (C)
5 * 2005 SAN People,
6 * 2008-2011 R-S-I Elektrotechnik GmbH & Co. KG
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/spi/spi.h>
17#include <linux/mtd/physmap.h>
18
19#include <asm/setup.h>
20#include <asm/mach-types.h>
21#include <asm/irq.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <mach/hardware.h>
28#include <mach/board.h>
Ludovic Desroches3e135462012-06-11 15:38:03 +020029#include <mach/at91_aic.h>
Josef Holzmayr82cb8652011-08-02 13:28:42 +020030
31#include <linux/gpio.h>
32
33#include "generic.h"
34
35static void __init rsi_ews_init_early(void)
36{
37 /* Initialize processor: 18.432 MHz crystal */
38 at91_initialize(18432000);
Josef Holzmayr82cb8652011-08-02 13:28:42 +020039}
40
41/*
42 * Ethernet
43 */
Jamie Iles84e0cdb2011-03-08 20:17:06 +000044static struct macb_platform_data rsi_ews_eth_data __initdata = {
Josef Holzmayr82cb8652011-08-02 13:28:42 +020045 .phy_irq_pin = AT91_PIN_PC4,
46 .is_rmii = 1,
47};
48
49/*
50 * USB Host
51 */
52static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
53 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080054 .vbus_pin = {-EINVAL, -EINVAL},
55 .overcurrent_pin= {-EINVAL, -EINVAL},
Josef Holzmayr82cb8652011-08-02 13:28:42 +020056};
57
58/*
59 * SD/MC
60 */
61static struct at91_mmc_data rsi_ews_mmc_data __initdata = {
62 .slot_b = 0,
63 .wire4 = 1,
64 .det_pin = AT91_PIN_PB27,
65 .wp_pin = AT91_PIN_PB29,
66};
67
68/*
69 * I2C
70 */
71static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
72 {
73 I2C_BOARD_INFO("ds1337", 0x68),
74 },
75 {
76 I2C_BOARD_INFO("24c01", 0x50),
77 }
78};
79
80/*
81 * LEDs
82 */
83static struct gpio_led rsi_ews_leds[] = {
84 {
85 .name = "led0",
86 .gpio = AT91_PIN_PB6,
87 .active_low = 0,
88 },
89 {
90 .name = "led1",
91 .gpio = AT91_PIN_PB7,
92 .active_low = 0,
93 },
94 {
95 .name = "led2",
96 .gpio = AT91_PIN_PB8,
97 .active_low = 0,
98 },
99 {
100 .name = "led3",
101 .gpio = AT91_PIN_PB9,
102 .active_low = 0,
103 },
104};
105
106/*
107 * DataFlash
108 */
109static struct spi_board_info rsi_ews_spi_devices[] = {
110 { /* DataFlash chip 1*/
111 .modalias = "mtd_dataflash",
112 .chip_select = 0,
113 .max_speed_hz = 5 * 1000 * 1000,
114 },
115 { /* DataFlash chip 2*/
116 .modalias = "mtd_dataflash",
117 .chip_select = 1,
118 .max_speed_hz = 5 * 1000 * 1000,
119 },
120};
121
122/*
123 * NOR flash
124 */
125static struct mtd_partition rsiews_nor_partitions[] = {
126 {
127 .name = "boot",
128 .offset = 0,
129 .size = 3 * SZ_128K,
130 .mask_flags = MTD_WRITEABLE
131 },
132 {
133 .name = "kernel",
134 .offset = MTDPART_OFS_NXTBLK,
135 .size = SZ_2M - (3 * SZ_128K)
136 },
137 {
138 .name = "root",
139 .offset = MTDPART_OFS_NXTBLK,
140 .size = SZ_8M
141 },
142 {
143 .name = "kernelupd",
144 .offset = MTDPART_OFS_NXTBLK,
145 .size = 3 * SZ_512K,
146 .mask_flags = MTD_WRITEABLE
147 },
148 {
149 .name = "rootupd",
150 .offset = MTDPART_OFS_NXTBLK,
151 .size = 9 * SZ_512K,
152 .mask_flags = MTD_WRITEABLE
153 },
154};
155
156static struct physmap_flash_data rsiews_nor_data = {
157 .width = 2,
158 .parts = rsiews_nor_partitions,
159 .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
160};
161
162#define NOR_BASE AT91_CHIPSELECT_0
163#define NOR_SIZE SZ_16M
164
165static struct resource nor_flash_resources[] = {
166 {
167 .start = NOR_BASE,
168 .end = NOR_BASE + NOR_SIZE - 1,
169 .flags = IORESOURCE_MEM,
170 }
171};
172
173static struct platform_device rsiews_nor_flash = {
174 .name = "physmap-flash",
175 .id = 0,
176 .dev = {
177 .platform_data = &rsiews_nor_data,
178 },
179 .resource = nor_flash_resources,
180 .num_resources = ARRAY_SIZE(nor_flash_resources),
181};
182
183/*
184 * Init Func
185 */
186static void __init rsi_ews_board_init(void)
187{
Jean-Christophe PLAGNIOL-VILLARD7eb1dbb2012-04-05 14:27:57 +0800188 /* Setup the LEDs */
189 at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
190
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200191 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800192 /* DBGU on ttyS0. (Rx & Tx only) */
193 /* This one is for debugging */
194 at91_register_uart(0, 0, 0);
195
196 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
197 /* Dialin/-out modem interface */
198 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
199 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
200 | ATMEL_UART_RI);
201
202 /* USART3 on ttyS4. (Rx, Tx, RTS) */
203 /* RS485 communication */
204 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200205 at91_add_device_serial();
206 at91_set_gpio_output(AT91_PIN_PA21, 0);
207 /* Ethernet */
208 at91_add_device_eth(&rsi_ews_eth_data);
209 /* USB Host */
210 at91_add_device_usbh(&rsi_ews_usbh_data);
211 /* I2C */
212 at91_add_device_i2c(rsi_ews_i2c_devices,
213 ARRAY_SIZE(rsi_ews_i2c_devices));
214 /* SPI */
215 at91_add_device_spi(rsi_ews_spi_devices,
216 ARRAY_SIZE(rsi_ews_spi_devices));
217 /* MMC */
218 at91_add_device_mmc(0, &rsi_ews_mmc_data);
219 /* NOR Flash */
220 platform_device_register(&rsiews_nor_flash);
221 /* LEDs */
222 at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
223}
224
225MACHINE_START(RSI_EWS, "RSI EWS")
226 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
227 .timer = &at91rm9200_timer,
228 .map_io = at91_map_io,
Ludovic Desroches3e135462012-06-11 15:38:03 +0200229 .handle_irq = at91_aic_handle_irq,
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200230 .init_early = rsi_ews_init_early,
231 .init_irq = at91_init_irq_default,
232 .init_machine = rsi_ews_board_init,
233MACHINE_END