board-ecbat91.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * linux/arch/arm/mach-at91rm9200/board-ecbat91.c
  3. * Copyright (C) 2007 emQbit.com.
  4. *
  5. * We started from board-dk.c, which is Copyright (C) 2005 SAN People.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/types.h>
  22. #include <linux/gpio.h>
  23. #include <linux/init.h>
  24. #include <linux/mm.h>
  25. #include <linux/module.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/spi/flash.h>
  29. #include <mach/hardware.h>
  30. #include <asm/setup.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/irq.h>
  33. #include <asm/mach/arch.h>
  34. #include <asm/mach/map.h>
  35. #include <asm/mach/irq.h>
  36. #include <mach/cpu.h>
  37. #include "at91_aic.h"
  38. #include "board.h"
  39. #include "generic.h"
  40. #include "gpio.h"
  41. static void __init ecb_at91init_early(void)
  42. {
  43. /* Set cpu type: PQFP */
  44. at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
  45. /* Initialize processor: 18.432 MHz crystal */
  46. at91_initialize(18432000);
  47. }
  48. static struct macb_platform_data __initdata ecb_at91eth_data = {
  49. .phy_irq_pin = AT91_PIN_PC4,
  50. .is_rmii = 0,
  51. };
  52. static struct at91_usbh_data __initdata ecb_at91usbh_data = {
  53. .ports = 1,
  54. .vbus_pin = {-EINVAL, -EINVAL},
  55. .overcurrent_pin= {-EINVAL, -EINVAL},
  56. };
  57. static struct mci_platform_data __initdata ecbat91_mci0_data = {
  58. .slot[0] = {
  59. .bus_width = 4,
  60. .detect_pin = -EINVAL,
  61. .wp_pin = -EINVAL,
  62. },
  63. };
  64. #if defined(CONFIG_MTD_DATAFLASH)
  65. static struct mtd_partition __initdata my_flash0_partitions[] =
  66. {
  67. { /* 0x8400 */
  68. .name = "Darrell-loader",
  69. .offset = 0,
  70. .size = 12 * 1056,
  71. },
  72. {
  73. .name = "U-boot",
  74. .offset = MTDPART_OFS_NXTBLK,
  75. .size = 110 * 1056,
  76. },
  77. { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
  78. .name = "UBoot-env",
  79. .offset = MTDPART_OFS_NXTBLK,
  80. .size = 8 * 1056,
  81. },
  82. { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
  83. .name = "Kernel",
  84. .offset = MTDPART_OFS_NXTBLK,
  85. .size = 1534 * 1056,
  86. },
  87. { /* 190200 - jffs2 root filesystem */
  88. .name = "Filesystem",
  89. .offset = MTDPART_OFS_NXTBLK,
  90. .size = MTDPART_SIZ_FULL, /* 26 sectors */
  91. }
  92. };
  93. static struct flash_platform_data __initdata my_flash0_platform = {
  94. .name = "Removable flash card",
  95. .parts = my_flash0_partitions,
  96. .nr_parts = ARRAY_SIZE(my_flash0_partitions)
  97. };
  98. #endif
  99. static struct spi_board_info __initdata ecb_at91spi_devices[] = {
  100. { /* DataFlash chip */
  101. .modalias = "mtd_dataflash",
  102. .chip_select = 0,
  103. .max_speed_hz = 10 * 1000 * 1000,
  104. .bus_num = 0,
  105. #if defined(CONFIG_MTD_DATAFLASH)
  106. .platform_data = &my_flash0_platform,
  107. #endif
  108. },
  109. { /* User accessible spi - cs1 (250KHz) */
  110. .modalias = "spi-cs1",
  111. .chip_select = 1,
  112. .max_speed_hz = 250 * 1000,
  113. },
  114. { /* User accessible spi - cs2 (1MHz) */
  115. .modalias = "spi-cs2",
  116. .chip_select = 2,
  117. .max_speed_hz = 1 * 1000 * 1000,
  118. },
  119. { /* User accessible spi - cs3 (10MHz) */
  120. .modalias = "spi-cs3",
  121. .chip_select = 3,
  122. .max_speed_hz = 10 * 1000 * 1000,
  123. },
  124. };
  125. /*
  126. * LEDs
  127. */
  128. static struct gpio_led ecb_leds[] = {
  129. { /* D1 */
  130. .name = "led1",
  131. .gpio = AT91_PIN_PC7,
  132. .active_low = 1,
  133. .default_trigger = "heartbeat",
  134. }
  135. };
  136. static void __init ecb_at91board_init(void)
  137. {
  138. /* Serial */
  139. /* DBGU on ttyS0. (Rx & Tx only) */
  140. at91_register_uart(0, 0, 0);
  141. /* USART0 on ttyS1. (Rx & Tx only) */
  142. at91_register_uart(AT91RM9200_ID_US0, 1, 0);
  143. at91_add_device_serial();
  144. /* Ethernet */
  145. at91_add_device_eth(&ecb_at91eth_data);
  146. /* USB Host */
  147. at91_add_device_usbh(&ecb_at91usbh_data);
  148. /* I2C */
  149. at91_add_device_i2c(NULL, 0);
  150. /* MMC */
  151. at91_add_device_mci(0, &ecbat91_mci0_data);
  152. /* SPI */
  153. at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
  154. /* LEDs */
  155. at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds));
  156. }
  157. MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
  158. /* Maintainer: emQbit.com */
  159. .init_time = at91rm9200_timer_init,
  160. .map_io = at91_map_io,
  161. .handle_irq = at91_aic_handle_irq,
  162. .init_early = ecb_at91init_early,
  163. .init_irq = at91_init_irq_default,
  164. .init_machine = ecb_at91board_init,
  165. MACHINE_END