board-flexibity.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * linux/arch/arm/mach-at91/board-flexibity.c
  3. *
  4. * Copyright (C) 2010-2011 Flexibity
  5. * Copyright (C) 2005 SAN People
  6. * Copyright (C) 2006 Atmel
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #include <linux/init.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/spi/spi.h>
  25. #include <linux/input.h>
  26. #include <linux/gpio.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/mach/irq.h>
  31. #include <mach/hardware.h>
  32. #include "at91_aic.h"
  33. #include "board.h"
  34. #include "generic.h"
  35. #include "gpio.h"
  36. static void __init flexibity_init_early(void)
  37. {
  38. /* Initialize processor: 18.432 MHz crystal */
  39. at91_initialize(18432000);
  40. }
  41. /* USB Host port */
  42. static struct at91_usbh_data __initdata flexibity_usbh_data = {
  43. .ports = 2,
  44. .vbus_pin = {-EINVAL, -EINVAL},
  45. .overcurrent_pin= {-EINVAL, -EINVAL},
  46. };
  47. /* USB Device port */
  48. static struct at91_udc_data __initdata flexibity_udc_data = {
  49. .vbus_pin = AT91_PIN_PC5,
  50. .pullup_pin = -EINVAL, /* pull-up driven by UDC */
  51. };
  52. /* I2C devices */
  53. static struct i2c_board_info __initdata flexibity_i2c_devices[] = {
  54. {
  55. I2C_BOARD_INFO("ds1307", 0x68),
  56. },
  57. };
  58. /* SPI devices */
  59. static struct spi_board_info flexibity_spi_devices[] = {
  60. { /* DataFlash chip */
  61. .modalias = "mtd_dataflash",
  62. .chip_select = 1,
  63. .max_speed_hz = 15 * 1000 * 1000,
  64. .bus_num = 0,
  65. },
  66. };
  67. /* MCI (SD/MMC) */
  68. static struct mci_platform_data __initdata flexibity_mci0_data = {
  69. .slot[0] = {
  70. .bus_width = 4,
  71. .detect_pin = AT91_PIN_PC9,
  72. .wp_pin = AT91_PIN_PC4,
  73. },
  74. };
  75. /* LEDs */
  76. static struct gpio_led flexibity_leds[] = {
  77. {
  78. .name = "usb1:green",
  79. .gpio = AT91_PIN_PA12,
  80. .active_low = 1,
  81. .default_trigger = "default-on",
  82. },
  83. {
  84. .name = "usb1:red",
  85. .gpio = AT91_PIN_PA13,
  86. .active_low = 1,
  87. .default_trigger = "default-on",
  88. },
  89. {
  90. .name = "usb2:green",
  91. .gpio = AT91_PIN_PB26,
  92. .active_low = 1,
  93. .default_trigger = "default-on",
  94. },
  95. {
  96. .name = "usb2:red",
  97. .gpio = AT91_PIN_PB27,
  98. .active_low = 1,
  99. .default_trigger = "default-on",
  100. },
  101. {
  102. .name = "usb3:green",
  103. .gpio = AT91_PIN_PC8,
  104. .active_low = 1,
  105. .default_trigger = "default-on",
  106. },
  107. {
  108. .name = "usb3:red",
  109. .gpio = AT91_PIN_PC6,
  110. .active_low = 1,
  111. .default_trigger = "default-on",
  112. },
  113. {
  114. .name = "usb4:green",
  115. .gpio = AT91_PIN_PB4,
  116. .active_low = 1,
  117. .default_trigger = "default-on",
  118. },
  119. {
  120. .name = "usb4:red",
  121. .gpio = AT91_PIN_PB5,
  122. .active_low = 1,
  123. .default_trigger = "default-on",
  124. }
  125. };
  126. static void __init flexibity_board_init(void)
  127. {
  128. at91_register_devices();
  129. /* Serial */
  130. /* DBGU on ttyS0. (Rx & Tx only) */
  131. at91_register_uart(0, 0, 0);
  132. at91_add_device_serial();
  133. /* USB Host */
  134. at91_add_device_usbh(&flexibity_usbh_data);
  135. /* USB Device */
  136. at91_add_device_udc(&flexibity_udc_data);
  137. /* I2C */
  138. at91_add_device_i2c(flexibity_i2c_devices,
  139. ARRAY_SIZE(flexibity_i2c_devices));
  140. /* SPI */
  141. at91_add_device_spi(flexibity_spi_devices,
  142. ARRAY_SIZE(flexibity_spi_devices));
  143. /* MMC */
  144. at91_add_device_mci(0, &flexibity_mci0_data);
  145. /* LEDs */
  146. at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
  147. }
  148. MACHINE_START(FLEXIBITY, "Flexibity Connect")
  149. /* Maintainer: Maxim Osipov */
  150. .init_time = at91_init_time,
  151. .map_io = at91_map_io,
  152. .handle_irq = at91_aic_handle_irq,
  153. .init_early = flexibity_init_early,
  154. .init_irq = at91_init_irq_default,
  155. .init_machine = flexibity_board_init,
  156. MACHINE_END