blob: f6d7f1958c7e5822661ac6517f48aa4de21a7247 [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>
Josef Holzmayr82cb8652011-08-02 13:28:42 +020028
29#include <linux/gpio.h>
30
Jean-Christophe PLAGNIOL-VILLARDa510b9b2012-10-30 06:41:28 +080031#include "at91_aic.h"
Jean-Christophe PLAGNIOL-VILLARD43d2f532012-10-30 05:14:17 +080032#include "board.h"
Josef Holzmayr82cb8652011-08-02 13:28:42 +020033#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 */
Ludovic Desroches4cf33262012-05-21 12:23:27 +020061static struct mci_platform_data __initdata rsi_ews_mci0_data = {
62 .slot[0] = {
63 .bus_width = 4,
64 .detect_pin = AT91_PIN_PB27,
65 .wp_pin = AT91_PIN_PB29,
66 },
Josef Holzmayr82cb8652011-08-02 13:28:42 +020067};
68
69/*
70 * I2C
71 */
72static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
73 {
74 I2C_BOARD_INFO("ds1337", 0x68),
75 },
76 {
77 I2C_BOARD_INFO("24c01", 0x50),
78 }
79};
80
81/*
82 * LEDs
83 */
84static struct gpio_led rsi_ews_leds[] = {
85 {
86 .name = "led0",
87 .gpio = AT91_PIN_PB6,
88 .active_low = 0,
89 },
90 {
91 .name = "led1",
92 .gpio = AT91_PIN_PB7,
93 .active_low = 0,
94 },
95 {
96 .name = "led2",
97 .gpio = AT91_PIN_PB8,
98 .active_low = 0,
99 },
100 {
101 .name = "led3",
102 .gpio = AT91_PIN_PB9,
103 .active_low = 0,
104 },
105};
106
107/*
108 * DataFlash
109 */
110static struct spi_board_info rsi_ews_spi_devices[] = {
111 { /* DataFlash chip 1*/
112 .modalias = "mtd_dataflash",
113 .chip_select = 0,
114 .max_speed_hz = 5 * 1000 * 1000,
115 },
116 { /* DataFlash chip 2*/
117 .modalias = "mtd_dataflash",
118 .chip_select = 1,
119 .max_speed_hz = 5 * 1000 * 1000,
120 },
121};
122
123/*
124 * NOR flash
125 */
126static struct mtd_partition rsiews_nor_partitions[] = {
127 {
128 .name = "boot",
129 .offset = 0,
130 .size = 3 * SZ_128K,
131 .mask_flags = MTD_WRITEABLE
132 },
133 {
134 .name = "kernel",
135 .offset = MTDPART_OFS_NXTBLK,
136 .size = SZ_2M - (3 * SZ_128K)
137 },
138 {
139 .name = "root",
140 .offset = MTDPART_OFS_NXTBLK,
141 .size = SZ_8M
142 },
143 {
144 .name = "kernelupd",
145 .offset = MTDPART_OFS_NXTBLK,
146 .size = 3 * SZ_512K,
147 .mask_flags = MTD_WRITEABLE
148 },
149 {
150 .name = "rootupd",
151 .offset = MTDPART_OFS_NXTBLK,
152 .size = 9 * SZ_512K,
153 .mask_flags = MTD_WRITEABLE
154 },
155};
156
157static struct physmap_flash_data rsiews_nor_data = {
158 .width = 2,
159 .parts = rsiews_nor_partitions,
160 .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
161};
162
163#define NOR_BASE AT91_CHIPSELECT_0
164#define NOR_SIZE SZ_16M
165
166static struct resource nor_flash_resources[] = {
167 {
168 .start = NOR_BASE,
169 .end = NOR_BASE + NOR_SIZE - 1,
170 .flags = IORESOURCE_MEM,
171 }
172};
173
174static struct platform_device rsiews_nor_flash = {
175 .name = "physmap-flash",
176 .id = 0,
177 .dev = {
178 .platform_data = &rsiews_nor_data,
179 },
180 .resource = nor_flash_resources,
181 .num_resources = ARRAY_SIZE(nor_flash_resources),
182};
183
184/*
185 * Init Func
186 */
187static void __init rsi_ews_board_init(void)
188{
189 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800190 /* DBGU on ttyS0. (Rx & Tx only) */
191 /* This one is for debugging */
192 at91_register_uart(0, 0, 0);
193
194 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
195 /* Dialin/-out modem interface */
196 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
197 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
198 | ATMEL_UART_RI);
199
200 /* USART3 on ttyS4. (Rx, Tx, RTS) */
201 /* RS485 communication */
202 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200203 at91_add_device_serial();
204 at91_set_gpio_output(AT91_PIN_PA21, 0);
205 /* Ethernet */
206 at91_add_device_eth(&rsi_ews_eth_data);
207 /* USB Host */
208 at91_add_device_usbh(&rsi_ews_usbh_data);
209 /* I2C */
210 at91_add_device_i2c(rsi_ews_i2c_devices,
211 ARRAY_SIZE(rsi_ews_i2c_devices));
212 /* SPI */
213 at91_add_device_spi(rsi_ews_spi_devices,
214 ARRAY_SIZE(rsi_ews_spi_devices));
215 /* MMC */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200216 at91_add_device_mci(0, &rsi_ews_mci0_data);
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200217 /* NOR Flash */
218 platform_device_register(&rsiews_nor_flash);
219 /* LEDs */
220 at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
221}
222
223MACHINE_START(RSI_EWS, "RSI EWS")
224 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700225 .init_time = at91rm9200_timer_init,
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200226 .map_io = at91_map_io,
Ludovic Desroches3e135462012-06-11 15:38:03 +0200227 .handle_irq = at91_aic_handle_irq,
Josef Holzmayr82cb8652011-08-02 13:28:42 +0200228 .init_early = rsi_ews_init_early,
229 .init_irq = at91_init_irq_default,
230 .init_machine = rsi_ews_board_init,
231MACHINE_END