board-rsi-ews.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 <linux/gpio.h>
  25. #include "at91_aic.h"
  26. #include "board.h"
  27. #include "generic.h"
  28. static void __init rsi_ews_init_early(void)
  29. {
  30. /* Initialize processor: 18.432 MHz crystal */
  31. at91_initialize(18432000);
  32. }
  33. /*
  34. * Ethernet
  35. */
  36. static struct macb_platform_data rsi_ews_eth_data __initdata = {
  37. .phy_irq_pin = AT91_PIN_PC4,
  38. .is_rmii = 1,
  39. };
  40. /*
  41. * USB Host
  42. */
  43. static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
  44. .ports = 1,
  45. .vbus_pin = {-EINVAL, -EINVAL},
  46. .overcurrent_pin= {-EINVAL, -EINVAL},
  47. };
  48. /*
  49. * SD/MC
  50. */
  51. static struct mci_platform_data __initdata rsi_ews_mci0_data = {
  52. .slot[0] = {
  53. .bus_width = 4,
  54. .detect_pin = AT91_PIN_PB27,
  55. .wp_pin = AT91_PIN_PB29,
  56. },
  57. };
  58. /*
  59. * I2C
  60. */
  61. static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
  62. {
  63. I2C_BOARD_INFO("ds1337", 0x68),
  64. },
  65. {
  66. I2C_BOARD_INFO("24c01", 0x50),
  67. }
  68. };
  69. /*
  70. * LEDs
  71. */
  72. static struct gpio_led rsi_ews_leds[] = {
  73. {
  74. .name = "led0",
  75. .gpio = AT91_PIN_PB6,
  76. .active_low = 0,
  77. },
  78. {
  79. .name = "led1",
  80. .gpio = AT91_PIN_PB7,
  81. .active_low = 0,
  82. },
  83. {
  84. .name = "led2",
  85. .gpio = AT91_PIN_PB8,
  86. .active_low = 0,
  87. },
  88. {
  89. .name = "led3",
  90. .gpio = AT91_PIN_PB9,
  91. .active_low = 0,
  92. },
  93. };
  94. /*
  95. * DataFlash
  96. */
  97. static struct spi_board_info rsi_ews_spi_devices[] = {
  98. { /* DataFlash chip 1*/
  99. .modalias = "mtd_dataflash",
  100. .chip_select = 0,
  101. .max_speed_hz = 5 * 1000 * 1000,
  102. },
  103. { /* DataFlash chip 2*/
  104. .modalias = "mtd_dataflash",
  105. .chip_select = 1,
  106. .max_speed_hz = 5 * 1000 * 1000,
  107. },
  108. };
  109. /*
  110. * NOR flash
  111. */
  112. static struct mtd_partition rsiews_nor_partitions[] = {
  113. {
  114. .name = "boot",
  115. .offset = 0,
  116. .size = 3 * SZ_128K,
  117. .mask_flags = MTD_WRITEABLE
  118. },
  119. {
  120. .name = "kernel",
  121. .offset = MTDPART_OFS_NXTBLK,
  122. .size = SZ_2M - (3 * SZ_128K)
  123. },
  124. {
  125. .name = "root",
  126. .offset = MTDPART_OFS_NXTBLK,
  127. .size = SZ_8M
  128. },
  129. {
  130. .name = "kernelupd",
  131. .offset = MTDPART_OFS_NXTBLK,
  132. .size = 3 * SZ_512K,
  133. .mask_flags = MTD_WRITEABLE
  134. },
  135. {
  136. .name = "rootupd",
  137. .offset = MTDPART_OFS_NXTBLK,
  138. .size = 9 * SZ_512K,
  139. .mask_flags = MTD_WRITEABLE
  140. },
  141. };
  142. static struct physmap_flash_data rsiews_nor_data = {
  143. .width = 2,
  144. .parts = rsiews_nor_partitions,
  145. .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
  146. };
  147. #define NOR_BASE AT91_CHIPSELECT_0
  148. #define NOR_SIZE SZ_16M
  149. static struct resource nor_flash_resources[] = {
  150. {
  151. .start = NOR_BASE,
  152. .end = NOR_BASE + NOR_SIZE - 1,
  153. .flags = IORESOURCE_MEM,
  154. }
  155. };
  156. static struct platform_device rsiews_nor_flash = {
  157. .name = "physmap-flash",
  158. .id = 0,
  159. .dev = {
  160. .platform_data = &rsiews_nor_data,
  161. },
  162. .resource = nor_flash_resources,
  163. .num_resources = ARRAY_SIZE(nor_flash_resources),
  164. };
  165. /*
  166. * Init Func
  167. */
  168. static void __init rsi_ews_board_init(void)
  169. {
  170. /* Serial */
  171. /* DBGU on ttyS0. (Rx & Tx only) */
  172. /* This one is for debugging */
  173. at91_register_uart(0, 0, 0);
  174. /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  175. /* Dialin/-out modem interface */
  176. at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
  177. | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
  178. | ATMEL_UART_RI);
  179. /* USART3 on ttyS4. (Rx, Tx, RTS) */
  180. /* RS485 communication */
  181. at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
  182. at91_add_device_serial();
  183. at91_set_gpio_output(AT91_PIN_PA21, 0);
  184. /* Ethernet */
  185. at91_add_device_eth(&rsi_ews_eth_data);
  186. /* USB Host */
  187. at91_add_device_usbh(&rsi_ews_usbh_data);
  188. /* I2C */
  189. at91_add_device_i2c(rsi_ews_i2c_devices,
  190. ARRAY_SIZE(rsi_ews_i2c_devices));
  191. /* SPI */
  192. at91_add_device_spi(rsi_ews_spi_devices,
  193. ARRAY_SIZE(rsi_ews_spi_devices));
  194. /* MMC */
  195. at91_add_device_mci(0, &rsi_ews_mci0_data);
  196. /* NOR Flash */
  197. platform_device_register(&rsiews_nor_flash);
  198. /* LEDs */
  199. at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
  200. }
  201. MACHINE_START(RSI_EWS, "RSI EWS")
  202. /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
  203. .init_time = at91rm9200_timer_init,
  204. .map_io = at91_map_io,
  205. .handle_irq = at91_aic_handle_irq,
  206. .init_early = rsi_ews_init_early,
  207. .init_irq = at91_init_irq_default,
  208. .init_machine = rsi_ews_board_init,
  209. MACHINE_END