board-cpuat91.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * linux/arch/arm/mach-at91/board-cpuat91.c
  3. *
  4. * Copyright (C) 2009 Eric Benard - eric@eukrea.com
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/types.h>
  21. #include <linux/gpio.h>
  22. #include <linux/init.h>
  23. #include <linux/mm.h>
  24. #include <linux/module.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/mtd/plat-ram.h>
  28. #include <mach/hardware.h>
  29. #include <asm/setup.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/irq.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/map.h>
  34. #include <asm/mach/irq.h>
  35. #include <mach/at91rm9200_mc.h>
  36. #include <mach/at91_ramc.h>
  37. #include <mach/cpu.h>
  38. #include "at91_aic.h"
  39. #include "board.h"
  40. #include "generic.h"
  41. #include "gpio.h"
  42. static struct gpio_led cpuat91_leds[] = {
  43. {
  44. .name = "led1",
  45. .default_trigger = "heartbeat",
  46. .active_low = 1,
  47. .gpio = AT91_PIN_PC0,
  48. },
  49. };
  50. static void __init cpuat91_init_early(void)
  51. {
  52. /* Set cpu type: PQFP */
  53. at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
  54. /* Initialize processor: 18.432 MHz crystal */
  55. at91_initialize(18432000);
  56. }
  57. static struct macb_platform_data __initdata cpuat91_eth_data = {
  58. .phy_irq_pin = -EINVAL,
  59. .is_rmii = 1,
  60. };
  61. static struct at91_usbh_data __initdata cpuat91_usbh_data = {
  62. .ports = 1,
  63. .vbus_pin = {-EINVAL, -EINVAL},
  64. .overcurrent_pin= {-EINVAL, -EINVAL},
  65. };
  66. static struct at91_udc_data __initdata cpuat91_udc_data = {
  67. .vbus_pin = AT91_PIN_PC15,
  68. .pullup_pin = AT91_PIN_PC14,
  69. };
  70. static struct mci_platform_data __initdata cpuat91_mci0_data = {
  71. .slot[0] = {
  72. .bus_width = 4,
  73. .detect_pin = AT91_PIN_PC2,
  74. .wp_pin = -EINVAL,
  75. },
  76. };
  77. static struct physmap_flash_data cpuat91_flash_data = {
  78. .width = 2,
  79. };
  80. static struct resource cpuat91_flash_resource = {
  81. .start = AT91_CHIPSELECT_0,
  82. .end = AT91_CHIPSELECT_0 + SZ_16M - 1,
  83. .flags = IORESOURCE_MEM,
  84. };
  85. static struct platform_device cpuat91_norflash = {
  86. .name = "physmap-flash",
  87. .id = 0,
  88. .dev = {
  89. .platform_data = &cpuat91_flash_data,
  90. },
  91. .resource = &cpuat91_flash_resource,
  92. .num_resources = 1,
  93. };
  94. #ifdef CONFIG_MTD_PLATRAM
  95. struct platdata_mtd_ram at91_sram_pdata = {
  96. .mapname = "SRAM",
  97. .bankwidth = 2,
  98. };
  99. static struct resource at91_sram_resource[] = {
  100. [0] = {
  101. .start = AT91RM9200_SRAM_BASE,
  102. .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,
  103. .flags = IORESOURCE_MEM,
  104. },
  105. };
  106. static struct platform_device at91_sram = {
  107. .name = "mtd-ram",
  108. .id = 0,
  109. .resource = at91_sram_resource,
  110. .num_resources = ARRAY_SIZE(at91_sram_resource),
  111. .dev = {
  112. .platform_data = &at91_sram_pdata,
  113. },
  114. };
  115. #endif /* MTD_PLATRAM */
  116. static struct platform_device *platform_devices[] __initdata = {
  117. &cpuat91_norflash,
  118. #ifdef CONFIG_MTD_PLATRAM
  119. &at91_sram,
  120. #endif /* CONFIG_MTD_PLATRAM */
  121. };
  122. static void __init cpuat91_board_init(void)
  123. {
  124. /* Serial */
  125. /* DBGU on ttyS0. (Rx & Tx only) */
  126. at91_register_uart(0, 0, 0);
  127. /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
  128. at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
  129. ATMEL_UART_RTS);
  130. /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  131. at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
  132. ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
  133. ATMEL_UART_DCD | ATMEL_UART_RI);
  134. /* USART2 on ttyS3 (Rx, Tx) */
  135. at91_register_uart(AT91RM9200_ID_US2, 3, 0);
  136. /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
  137. at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
  138. ATMEL_UART_RTS);
  139. at91_add_device_serial();
  140. /* LEDs. */
  141. at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
  142. /* Ethernet */
  143. at91_add_device_eth(&cpuat91_eth_data);
  144. /* USB Host */
  145. at91_add_device_usbh(&cpuat91_usbh_data);
  146. /* USB Device */
  147. at91_add_device_udc(&cpuat91_udc_data);
  148. /* MMC */
  149. at91_add_device_mci(0, &cpuat91_mci0_data);
  150. /* I2C */
  151. at91_add_device_i2c(NULL, 0);
  152. /* Platform devices */
  153. platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
  154. }
  155. MACHINE_START(CPUAT91, "Eukrea")
  156. /* Maintainer: Eric Benard - EUKREA Electromatique */
  157. .init_time = at91rm9200_timer_init,
  158. .map_io = at91_map_io,
  159. .handle_irq = at91_aic_handle_irq,
  160. .init_early = cpuat91_init_early,
  161. .init_irq = at91_init_irq_default,
  162. .init_machine = cpuat91_board_init,
  163. MACHINE_END