board-sam9g20ek.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*
  2. * Copyright (C) 2005 SAN People
  3. * Copyright (C) 2008 Atmel
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/types.h>
  20. #include <linux/init.h>
  21. #include <linux/mm.h>
  22. #include <linux/module.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/spi/spi.h>
  25. #include <linux/spi/at73c213.h>
  26. #include <linux/clk.h>
  27. #include <mach/hardware.h>
  28. #include <asm/setup.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/irq.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <asm/mach/irq.h>
  34. #include <mach/board.h>
  35. #include <mach/gpio.h>
  36. #include "generic.h"
  37. static void __init ek_map_io(void)
  38. {
  39. /* Initialize processor: 18.432 MHz crystal */
  40. at91sam9260_initialize(18432000);
  41. /* DGBU on ttyS0. (Rx & Tx only) */
  42. at91_register_uart(0, 0, 0);
  43. /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  44. at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
  45. | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
  46. | ATMEL_UART_RI);
  47. /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
  48. at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
  49. /* set serial console to ttyS0 (ie, DBGU) */
  50. at91_set_serial_console(0);
  51. }
  52. static void __init ek_init_irq(void)
  53. {
  54. at91sam9260_init_interrupts(NULL);
  55. }
  56. /*
  57. * USB Host port
  58. */
  59. static struct at91_usbh_data __initdata ek_usbh_data = {
  60. .ports = 2,
  61. };
  62. /*
  63. * USB Device port
  64. */
  65. static struct at91_udc_data __initdata ek_udc_data = {
  66. .vbus_pin = AT91_PIN_PC5,
  67. .pullup_pin = 0, /* pull-up driven by UDC */
  68. };
  69. /*
  70. * SPI devices.
  71. */
  72. static struct spi_board_info ek_spi_devices[] = {
  73. #if !defined(CONFIG_MMC_AT91)
  74. { /* DataFlash chip */
  75. .modalias = "mtd_dataflash",
  76. .chip_select = 1,
  77. .max_speed_hz = 15 * 1000 * 1000,
  78. .bus_num = 0,
  79. },
  80. #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
  81. { /* DataFlash card */
  82. .modalias = "mtd_dataflash",
  83. .chip_select = 0,
  84. .max_speed_hz = 15 * 1000 * 1000,
  85. .bus_num = 0,
  86. },
  87. #endif
  88. #endif
  89. };
  90. /*
  91. * MACB Ethernet device
  92. */
  93. static struct at91_eth_data __initdata ek_macb_data = {
  94. .phy_irq_pin = AT91_PIN_PA7,
  95. .is_rmii = 1,
  96. };
  97. /*
  98. * NAND flash
  99. */
  100. static struct mtd_partition __initdata ek_nand_partition[] = {
  101. {
  102. .name = "Bootstrap",
  103. .offset = 0,
  104. .size = 4 * SZ_1M,
  105. },
  106. {
  107. .name = "Partition 1",
  108. .offset = MTDPART_OFS_NXTBLK,
  109. .size = 60 * SZ_1M,
  110. },
  111. {
  112. .name = "Partition 2",
  113. .offset = MTDPART_OFS_NXTBLK,
  114. .size = MTDPART_SIZ_FULL,
  115. },
  116. };
  117. static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
  118. {
  119. *num_partitions = ARRAY_SIZE(ek_nand_partition);
  120. return ek_nand_partition;
  121. }
  122. /* det_pin is not connected */
  123. static struct atmel_nand_data __initdata ek_nand_data = {
  124. .ale = 21,
  125. .cle = 22,
  126. .rdy_pin = AT91_PIN_PC13,
  127. .enable_pin = AT91_PIN_PC14,
  128. .partition_info = nand_partitions,
  129. #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
  130. .bus_width_16 = 1,
  131. #else
  132. .bus_width_16 = 0,
  133. #endif
  134. };
  135. /*
  136. * MCI (SD/MMC)
  137. * det_pin, wp_pin and vcc_pin are not connected
  138. */
  139. static struct at91_mmc_data __initdata ek_mmc_data = {
  140. .slot_b = 1,
  141. .wire4 = 1,
  142. };
  143. /*
  144. * LEDs
  145. */
  146. static struct gpio_led ek_leds[] = {
  147. { /* "bottom" led, green, userled1 to be defined */
  148. .name = "ds5",
  149. .gpio = AT91_PIN_PA6,
  150. .active_low = 1,
  151. .default_trigger = "none",
  152. },
  153. { /* "power" led, yellow */
  154. .name = "ds1",
  155. .gpio = AT91_PIN_PA9,
  156. .default_trigger = "heartbeat",
  157. }
  158. };
  159. static void __init ek_board_init(void)
  160. {
  161. /* Serial */
  162. at91_add_device_serial();
  163. /* USB Host */
  164. at91_add_device_usbh(&ek_usbh_data);
  165. /* USB Device */
  166. at91_add_device_udc(&ek_udc_data);
  167. /* SPI */
  168. at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
  169. /* NAND */
  170. at91_add_device_nand(&ek_nand_data);
  171. /* Ethernet */
  172. at91_add_device_eth(&ek_macb_data);
  173. /* MMC */
  174. at91_add_device_mmc(0, &ek_mmc_data);
  175. /* I2C */
  176. at91_add_device_i2c(NULL, 0);
  177. /* LEDs */
  178. at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
  179. }
  180. MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
  181. /* Maintainer: Atmel */
  182. .phys_io = AT91_BASE_SYS,
  183. .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
  184. .boot_params = AT91_SDRAM_BASE + 0x100,
  185. .timer = &at91sam926x_timer,
  186. .map_io = ek_map_io,
  187. .init_irq = ek_init_irq,
  188. .init_machine = ek_board_init,
  189. MACHINE_END