board-eco920.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2 of the License, or
  5. * (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. #include <linux/init.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <linux/gpio.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <mach/board.h>
  24. #include <mach/at91rm9200_mc.h>
  25. #include "generic.h"
  26. static void __init eco920_map_io(void)
  27. {
  28. at91rm9200_initialize(18432000, AT91RM9200_PQFP);
  29. /* Setup the LEDs */
  30. at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
  31. /* DBGU on ttyS0. (Rx & Tx only */
  32. at91_register_uart(0, 0, 0);
  33. /* set serial console to ttyS0 (ie, DBGU) */
  34. at91_set_serial_console(0);
  35. }
  36. static void __init eco920_init_irq(void)
  37. {
  38. at91rm9200_init_interrupts(NULL);
  39. }
  40. static struct at91_eth_data __initdata eco920_eth_data = {
  41. .phy_irq_pin = AT91_PIN_PC2,
  42. .is_rmii = 1,
  43. };
  44. static struct at91_usbh_data __initdata eco920_usbh_data = {
  45. .ports = 1,
  46. };
  47. static struct at91_udc_data __initdata eco920_udc_data = {
  48. .vbus_pin = AT91_PIN_PB12,
  49. .pullup_pin = AT91_PIN_PB13,
  50. };
  51. static struct at91_mmc_data __initdata eco920_mmc_data = {
  52. .slot_b = 0,
  53. .wire4 = 0,
  54. };
  55. static struct physmap_flash_data eco920_flash_data = {
  56. .width = 2,
  57. };
  58. static struct resource eco920_flash_resource = {
  59. .start = 0x11000000,
  60. .end = 0x11ffffff,
  61. .flags = IORESOURCE_MEM,
  62. };
  63. static struct platform_device eco920_flash = {
  64. .name = "physmap-flash",
  65. .id = 0,
  66. .dev = {
  67. .platform_data = &eco920_flash_data,
  68. },
  69. .resource = &eco920_flash_resource,
  70. .num_resources = 1,
  71. };
  72. static struct resource at91_beeper_resources[] = {
  73. [0] = {
  74. .start = AT91RM9200_BASE_TC3,
  75. .end = AT91RM9200_BASE_TC3 + 0x39,
  76. .flags = IORESOURCE_MEM,
  77. },
  78. };
  79. static struct platform_device at91_beeper = {
  80. .name = "at91_beeper",
  81. .id = 0,
  82. .resource = at91_beeper_resources,
  83. .num_resources = ARRAY_SIZE(at91_beeper_resources),
  84. };
  85. static struct spi_board_info eco920_spi_devices[] = {
  86. { /* CAN controller */
  87. .modalias = "tlv5638",
  88. .chip_select = 3,
  89. .max_speed_hz = 20 * 1000 * 1000,
  90. .mode = SPI_CPHA,
  91. },
  92. };
  93. static void __init eco920_board_init(void)
  94. {
  95. at91_add_device_serial();
  96. at91_add_device_eth(&eco920_eth_data);
  97. at91_add_device_usbh(&eco920_usbh_data);
  98. at91_add_device_udc(&eco920_udc_data);
  99. at91_add_device_mmc(0, &eco920_mmc_data);
  100. platform_device_register(&eco920_flash);
  101. at91_sys_write(AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
  102. | AT91_SMC_RWSETUP_(1)
  103. | AT91_SMC_DBW_8
  104. | AT91_SMC_WSEN
  105. | AT91_SMC_NWS_(15));
  106. at91_set_A_periph(AT91_PIN_PC6, 1);
  107. at91_set_gpio_input(AT91_PIN_PA23, 0);
  108. at91_set_deglitch(AT91_PIN_PA23, 1);
  109. /* Initialization of the Static Memory Controller for Chip Select 3 */
  110. at91_sys_write(AT91_SMC_CSR(3),
  111. AT91_SMC_DBW_16 | /* 16 bit */
  112. AT91_SMC_WSEN |
  113. AT91_SMC_NWS_(5) | /* wait states */
  114. AT91_SMC_TDF_(1) /* float time */
  115. );
  116. at91_clock_associate("tc3_clk", &at91_beeper.dev, "at91_beeper");
  117. at91_set_B_periph(AT91_PIN_PB6, 0);
  118. platform_device_register(&at91_beeper);
  119. at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
  120. }
  121. MACHINE_START(ECO920, "eco920")
  122. /* Maintainer: Sascha Hauer */
  123. .phys_io = AT91_BASE_SYS,
  124. .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
  125. .boot_params = AT91_SDRAM_BASE + 0x100,
  126. .timer = &at91rm9200_timer,
  127. .map_io = eco920_map_io,
  128. .init_irq = eco920_init_irq,
  129. .init_machine = eco920_board_init,
  130. MACHINE_END