board-afeb-9260v1.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. * linux/arch/arm/mach-at91/board-afeb-9260v1.c
  3. *
  4. * Copyright (C) 2005 SAN People
  5. * Copyright (C) 2006 Atmel
  6. * Copyright (C) 2008 Sergey Lapin
  7. *
  8. * A custom board designed as open hardware; PCBs and various information
  9. * is available at http://groups.google.com/group/arm9fpga-evolution-board/
  10. * Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. */
  26. #include <linux/types.h>
  27. #include <linux/gpio.h>
  28. #include <linux/init.h>
  29. #include <linux/mm.h>
  30. #include <linux/module.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/spi/spi.h>
  33. #include <linux/clk.h>
  34. #include <linux/dma-mapping.h>
  35. #include <mach/hardware.h>
  36. #include <asm/setup.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/irq.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/map.h>
  41. #include <asm/mach/irq.h>
  42. #include "at91_aic.h"
  43. #include "board.h"
  44. #include "generic.h"
  45. #include "gpio.h"
  46. static void __init afeb9260_init_early(void)
  47. {
  48. /* Initialize processor: 18.432 MHz crystal */
  49. at91_initialize(18432000);
  50. }
  51. /*
  52. * USB Host port
  53. */
  54. static struct at91_usbh_data __initdata afeb9260_usbh_data = {
  55. .ports = 1,
  56. .vbus_pin = {-EINVAL, -EINVAL},
  57. .overcurrent_pin= {-EINVAL, -EINVAL},
  58. };
  59. /*
  60. * USB Device port
  61. */
  62. static struct at91_udc_data __initdata afeb9260_udc_data = {
  63. .vbus_pin = AT91_PIN_PC5,
  64. .pullup_pin = -EINVAL, /* pull-up driven by UDC */
  65. };
  66. /*
  67. * SPI devices.
  68. */
  69. static struct spi_board_info afeb9260_spi_devices[] = {
  70. { /* DataFlash chip */
  71. .modalias = "mtd_dataflash",
  72. .chip_select = 1,
  73. .max_speed_hz = 15 * 1000 * 1000,
  74. .bus_num = 0,
  75. },
  76. };
  77. /*
  78. * MACB Ethernet device
  79. */
  80. static struct macb_platform_data __initdata afeb9260_macb_data = {
  81. .phy_irq_pin = AT91_PIN_PA9,
  82. .is_rmii = 0,
  83. };
  84. /*
  85. * NAND flash
  86. */
  87. static struct mtd_partition __initdata afeb9260_nand_partition[] = {
  88. {
  89. .name = "bootloader",
  90. .offset = 0,
  91. .size = (640 * SZ_1K),
  92. },
  93. {
  94. .name = "kernel",
  95. .offset = MTDPART_OFS_NXTBLK,
  96. .size = SZ_2M,
  97. },
  98. {
  99. .name = "rootfs",
  100. .offset = MTDPART_OFS_NXTBLK,
  101. .size = MTDPART_SIZ_FULL,
  102. },
  103. };
  104. static struct atmel_nand_data __initdata afeb9260_nand_data = {
  105. .ale = 21,
  106. .cle = 22,
  107. .rdy_pin = AT91_PIN_PC13,
  108. .enable_pin = AT91_PIN_PC14,
  109. .bus_width_16 = 0,
  110. .ecc_mode = NAND_ECC_SOFT,
  111. .parts = afeb9260_nand_partition,
  112. .num_parts = ARRAY_SIZE(afeb9260_nand_partition),
  113. .det_pin = -EINVAL,
  114. };
  115. /*
  116. * MCI (SD/MMC)
  117. */
  118. static struct mci_platform_data __initdata afeb9260_mci0_data = {
  119. .slot[1] = {
  120. .bus_width = 4,
  121. .detect_pin = AT91_PIN_PC9,
  122. .wp_pin = AT91_PIN_PC4,
  123. },
  124. };
  125. static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {
  126. {
  127. I2C_BOARD_INFO("tlv320aic23", 0x1a),
  128. }, {
  129. I2C_BOARD_INFO("fm3130", 0x68),
  130. }, {
  131. I2C_BOARD_INFO("24c64", 0x50),
  132. },
  133. };
  134. /*
  135. * IDE (CF True IDE mode)
  136. */
  137. static struct at91_cf_data afeb9260_cf_data = {
  138. .chipselect = 4,
  139. .irq_pin = AT91_PIN_PA6,
  140. .det_pin = -EINVAL,
  141. .vcc_pin = -EINVAL,
  142. .rst_pin = AT91_PIN_PA7,
  143. .flags = AT91_CF_TRUE_IDE,
  144. };
  145. static void __init afeb9260_board_init(void)
  146. {
  147. at91_register_devices();
  148. /* Serial */
  149. /* DBGU on ttyS0. (Rx & Tx only) */
  150. at91_register_uart(0, 0, 0);
  151. /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  152. at91_register_uart(AT91SAM9260_ID_US0, 1,
  153. ATMEL_UART_CTS | ATMEL_UART_RTS
  154. | ATMEL_UART_DTR | ATMEL_UART_DSR
  155. | ATMEL_UART_DCD | ATMEL_UART_RI);
  156. /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
  157. at91_register_uart(AT91SAM9260_ID_US1, 2,
  158. ATMEL_UART_CTS | ATMEL_UART_RTS);
  159. at91_add_device_serial();
  160. /* USB Host */
  161. at91_add_device_usbh(&afeb9260_usbh_data);
  162. /* USB Device */
  163. at91_add_device_udc(&afeb9260_udc_data);
  164. /* SPI */
  165. at91_add_device_spi(afeb9260_spi_devices,
  166. ARRAY_SIZE(afeb9260_spi_devices));
  167. /* NAND */
  168. at91_add_device_nand(&afeb9260_nand_data);
  169. /* Ethernet */
  170. at91_add_device_eth(&afeb9260_macb_data);
  171. /* Standard function's pin assignments are not
  172. * appropriate for us and generic code provide
  173. * no API to configure these pins any other way */
  174. at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
  175. at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
  176. /* MMC */
  177. at91_add_device_mci(0, &afeb9260_mci0_data);
  178. /* I2C */
  179. at91_add_device_i2c(afeb9260_i2c_devices,
  180. ARRAY_SIZE(afeb9260_i2c_devices));
  181. /* Audio */
  182. at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
  183. /* IDE */
  184. at91_add_device_cf(&afeb9260_cf_data);
  185. }
  186. MACHINE_START(AFEB9260, "Custom afeb9260 board")
  187. /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
  188. .init_time = at91_init_time,
  189. .map_io = at91_map_io,
  190. .handle_irq = at91_aic_handle_irq,
  191. .init_early = afeb9260_init_early,
  192. .init_irq = at91_init_irq_default,
  193. .init_machine = afeb9260_board_init,
  194. MACHINE_END