Josef Holzmayr | 82cb865 | 2011-08-02 13:28:42 +0200 | [diff] [blame] | 1 | /* |
| 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> |
| 29 | |
| 30 | #include <linux/gpio.h> |
| 31 | |
| 32 | #include "generic.h" |
| 33 | |
| 34 | static void __init rsi_ews_init_early(void) |
| 35 | { |
| 36 | /* Initialize processor: 18.432 MHz crystal */ |
| 37 | at91_initialize(18432000); |
| 38 | |
| 39 | /* Setup the LEDs */ |
| 40 | at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9); |
| 41 | |
| 42 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 43 | /* This one is for debugging */ |
| 44 | at91_register_uart(0, 0, 0); |
| 45 | |
| 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 |
| 50 | | ATMEL_UART_RI); |
| 51 | |
| 52 | /* USART3 on ttyS4. (Rx, Tx, RTS) */ |
| 53 | /* RS485 communication */ |
| 54 | at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS); |
| 55 | |
| 56 | /* set serial console to ttyS0 (ie, DBGU) */ |
| 57 | at91_set_serial_console(0); |
| 58 | } |
| 59 | |
| 60 | /* |
| 61 | * Ethernet |
| 62 | */ |
Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 63 | static struct macb_platform_data rsi_ews_eth_data __initdata = { |
Josef Holzmayr | 82cb865 | 2011-08-02 13:28:42 +0200 | [diff] [blame] | 64 | .phy_irq_pin = AT91_PIN_PC4, |
| 65 | .is_rmii = 1, |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * USB Host |
| 70 | */ |
| 71 | static struct at91_usbh_data rsi_ews_usbh_data __initdata = { |
| 72 | .ports = 1, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 73 | .vbus_pin = {-EINVAL, -EINVAL}, |
| 74 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
Josef Holzmayr | 82cb865 | 2011-08-02 13:28:42 +0200 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | /* |
| 78 | * SD/MC |
| 79 | */ |
| 80 | static struct at91_mmc_data rsi_ews_mmc_data __initdata = { |
| 81 | .slot_b = 0, |
| 82 | .wire4 = 1, |
| 83 | .det_pin = AT91_PIN_PB27, |
| 84 | .wp_pin = AT91_PIN_PB29, |
| 85 | }; |
| 86 | |
| 87 | /* |
| 88 | * I2C |
| 89 | */ |
| 90 | static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = { |
| 91 | { |
| 92 | I2C_BOARD_INFO("ds1337", 0x68), |
| 93 | }, |
| 94 | { |
| 95 | I2C_BOARD_INFO("24c01", 0x50), |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | /* |
| 100 | * LEDs |
| 101 | */ |
| 102 | static struct gpio_led rsi_ews_leds[] = { |
| 103 | { |
| 104 | .name = "led0", |
| 105 | .gpio = AT91_PIN_PB6, |
| 106 | .active_low = 0, |
| 107 | }, |
| 108 | { |
| 109 | .name = "led1", |
| 110 | .gpio = AT91_PIN_PB7, |
| 111 | .active_low = 0, |
| 112 | }, |
| 113 | { |
| 114 | .name = "led2", |
| 115 | .gpio = AT91_PIN_PB8, |
| 116 | .active_low = 0, |
| 117 | }, |
| 118 | { |
| 119 | .name = "led3", |
| 120 | .gpio = AT91_PIN_PB9, |
| 121 | .active_low = 0, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | /* |
| 126 | * DataFlash |
| 127 | */ |
| 128 | static struct spi_board_info rsi_ews_spi_devices[] = { |
| 129 | { /* DataFlash chip 1*/ |
| 130 | .modalias = "mtd_dataflash", |
| 131 | .chip_select = 0, |
| 132 | .max_speed_hz = 5 * 1000 * 1000, |
| 133 | }, |
| 134 | { /* DataFlash chip 2*/ |
| 135 | .modalias = "mtd_dataflash", |
| 136 | .chip_select = 1, |
| 137 | .max_speed_hz = 5 * 1000 * 1000, |
| 138 | }, |
| 139 | }; |
| 140 | |
| 141 | /* |
| 142 | * NOR flash |
| 143 | */ |
| 144 | static struct mtd_partition rsiews_nor_partitions[] = { |
| 145 | { |
| 146 | .name = "boot", |
| 147 | .offset = 0, |
| 148 | .size = 3 * SZ_128K, |
| 149 | .mask_flags = MTD_WRITEABLE |
| 150 | }, |
| 151 | { |
| 152 | .name = "kernel", |
| 153 | .offset = MTDPART_OFS_NXTBLK, |
| 154 | .size = SZ_2M - (3 * SZ_128K) |
| 155 | }, |
| 156 | { |
| 157 | .name = "root", |
| 158 | .offset = MTDPART_OFS_NXTBLK, |
| 159 | .size = SZ_8M |
| 160 | }, |
| 161 | { |
| 162 | .name = "kernelupd", |
| 163 | .offset = MTDPART_OFS_NXTBLK, |
| 164 | .size = 3 * SZ_512K, |
| 165 | .mask_flags = MTD_WRITEABLE |
| 166 | }, |
| 167 | { |
| 168 | .name = "rootupd", |
| 169 | .offset = MTDPART_OFS_NXTBLK, |
| 170 | .size = 9 * SZ_512K, |
| 171 | .mask_flags = MTD_WRITEABLE |
| 172 | }, |
| 173 | }; |
| 174 | |
| 175 | static struct physmap_flash_data rsiews_nor_data = { |
| 176 | .width = 2, |
| 177 | .parts = rsiews_nor_partitions, |
| 178 | .nr_parts = ARRAY_SIZE(rsiews_nor_partitions), |
| 179 | }; |
| 180 | |
| 181 | #define NOR_BASE AT91_CHIPSELECT_0 |
| 182 | #define NOR_SIZE SZ_16M |
| 183 | |
| 184 | static struct resource nor_flash_resources[] = { |
| 185 | { |
| 186 | .start = NOR_BASE, |
| 187 | .end = NOR_BASE + NOR_SIZE - 1, |
| 188 | .flags = IORESOURCE_MEM, |
| 189 | } |
| 190 | }; |
| 191 | |
| 192 | static struct platform_device rsiews_nor_flash = { |
| 193 | .name = "physmap-flash", |
| 194 | .id = 0, |
| 195 | .dev = { |
| 196 | .platform_data = &rsiews_nor_data, |
| 197 | }, |
| 198 | .resource = nor_flash_resources, |
| 199 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
| 200 | }; |
| 201 | |
| 202 | /* |
| 203 | * Init Func |
| 204 | */ |
| 205 | static void __init rsi_ews_board_init(void) |
| 206 | { |
| 207 | /* Serial */ |
| 208 | at91_add_device_serial(); |
| 209 | at91_set_gpio_output(AT91_PIN_PA21, 0); |
| 210 | /* Ethernet */ |
| 211 | at91_add_device_eth(&rsi_ews_eth_data); |
| 212 | /* USB Host */ |
| 213 | at91_add_device_usbh(&rsi_ews_usbh_data); |
| 214 | /* I2C */ |
| 215 | at91_add_device_i2c(rsi_ews_i2c_devices, |
| 216 | ARRAY_SIZE(rsi_ews_i2c_devices)); |
| 217 | /* SPI */ |
| 218 | at91_add_device_spi(rsi_ews_spi_devices, |
| 219 | ARRAY_SIZE(rsi_ews_spi_devices)); |
| 220 | /* MMC */ |
| 221 | at91_add_device_mmc(0, &rsi_ews_mmc_data); |
| 222 | /* NOR Flash */ |
| 223 | platform_device_register(&rsiews_nor_flash); |
| 224 | /* LEDs */ |
| 225 | at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds)); |
| 226 | } |
| 227 | |
| 228 | MACHINE_START(RSI_EWS, "RSI EWS") |
| 229 | /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */ |
| 230 | .timer = &at91rm9200_timer, |
| 231 | .map_io = at91_map_io, |
| 232 | .init_early = rsi_ews_init_early, |
| 233 | .init_irq = at91_init_irq_default, |
| 234 | .init_machine = rsi_ews_board_init, |
| 235 | MACHINE_END |