board-rsi-ews.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. #include <linux/types.h>
  11. #include <linux/init.h>
  12. #include <linux/mm.h>
  13. #include <linux/module.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/spi/spi.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <asm/setup.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/irq.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/map.h>
  22. #include <asm/mach/irq.h>
  23. #include <mach/hardware.h>
  24. #include <mach/board.h>
  25. #include <linux/gpio.h>
  26. #include "generic.h"
  27. static void __init rsi_ews_init_early(void)
  28. {
  29. /* Initialize processor: 18.432 MHz crystal */
  30. at91_initialize(18432000);
  31. /* Setup the LEDs */
  32. at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
  33. /* DBGU on ttyS0. (Rx & Tx only) */
  34. /* This one is for debugging */
  35. at91_register_uart(0, 0, 0);
  36. /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  37. /* Dialin/-out modem interface */
  38. at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
  39. | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
  40. | ATMEL_UART_RI);
  41. /* USART3 on ttyS4. (Rx, Tx, RTS) */
  42. /* RS485 communication */
  43. at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
  44. /* set serial console to ttyS0 (ie, DBGU) */
  45. at91_set_serial_console(0);
  46. }
  47. /*
  48. * Ethernet
  49. */
  50. static struct macb_platform_data rsi_ews_eth_data __initdata = {
  51. .phy_irq_pin = AT91_PIN_PC4,
  52. .is_rmii = 1,
  53. };
  54. /*
  55. * USB Host
  56. */
  57. static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
  58. .ports = 1,
  59. .vbus_pin = {-EINVAL, -EINVAL},
  60. .overcurrent_pin= {-EINVAL, -EINVAL},
  61. };
  62. /*
  63. * SD/MC
  64. */
  65. static struct at91_mmc_data rsi_ews_mmc_data __initdata = {
  66. .slot_b = 0,
  67. .wire4 = 1,
  68. .det_pin = AT91_PIN_PB27,
  69. .wp_pin = AT91_PIN_PB29,
  70. };
  71. /*
  72. * I2C
  73. */
  74. static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
  75. {
  76. I2C_BOARD_INFO("ds1337", 0x68),
  77. },
  78. {
  79. I2C_BOARD_INFO("24c01", 0x50),
  80. }
  81. };
  82. /*
  83. * LEDs
  84. */
  85. static struct gpio_led rsi_ews_leds[] = {
  86. {
  87. .name = "led0",
  88. .gpio = AT91_PIN_PB6,
  89. .active_low = 0,
  90. },
  91. {
  92. .name = "led1",
  93. .gpio = AT91_PIN_PB7,
  94. .active_low = 0,
  95. },
  96. {
  97. .name = "led2",
  98. .gpio = AT91_PIN_PB8,
  99. .active_low = 0,
  100. },
  101. {
  102. .name = "led3",
  103. .gpio = AT91_PIN_PB9,
  104. .active_low = 0,
  105. },
  106. };
  107. /*
  108. * DataFlash
  109. */
  110. static 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. * NOR flash
  124. */
  125. static 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. static struct physmap_flash_data rsiews_nor_data = {
  156. .width = 2,
  157. .parts = rsiews_nor_partitions,
  158. .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
  159. };
  160. #define NOR_BASE AT91_CHIPSELECT_0
  161. #define NOR_SIZE SZ_16M
  162. static struct resource nor_flash_resources[] = {
  163. {
  164. .start = NOR_BASE,
  165. .end = NOR_BASE + NOR_SIZE - 1,
  166. .flags = IORESOURCE_MEM,
  167. }
  168. };
  169. static struct platform_device rsiews_nor_flash = {
  170. .name = "physmap-flash",
  171. .id = 0,
  172. .dev = {
  173. .platform_data = &rsiews_nor_data,
  174. },
  175. .resource = nor_flash_resources,
  176. .num_resources = ARRAY_SIZE(nor_flash_resources),
  177. };
  178. /*
  179. * Init Func
  180. */
  181. static void __init rsi_ews_board_init(void)
  182. {
  183. /* Serial */
  184. at91_add_device_serial();
  185. at91_set_gpio_output(AT91_PIN_PA21, 0);
  186. /* Ethernet */
  187. at91_add_device_eth(&rsi_ews_eth_data);
  188. /* USB Host */
  189. at91_add_device_usbh(&rsi_ews_usbh_data);
  190. /* I2C */
  191. at91_add_device_i2c(rsi_ews_i2c_devices,
  192. ARRAY_SIZE(rsi_ews_i2c_devices));
  193. /* SPI */
  194. at91_add_device_spi(rsi_ews_spi_devices,
  195. ARRAY_SIZE(rsi_ews_spi_devices));
  196. /* MMC */
  197. at91_add_device_mmc(0, &rsi_ews_mmc_data);
  198. /* NOR Flash */
  199. platform_device_register(&rsiews_nor_flash);
  200. /* LEDs */
  201. at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
  202. }
  203. MACHINE_START(RSI_EWS, "RSI EWS")
  204. /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
  205. .timer = &at91rm9200_timer,
  206. .map_io = at91_map_io,
  207. .init_early = rsi_ews_init_early,
  208. .init_irq = at91_init_irq_default,
  209. .init_machine = rsi_ews_board_init,
  210. MACHINE_END