board-snapper9260.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * linux/arch/arm/mach-at91/board-snapper9260.c
  3. *
  4. * Copyright (C) 2010 Bluewater System Ltd
  5. *
  6. * Author: Andre Renaud <andre@bluewatersys.com>
  7. * Author: Ryan Mallon <ryan@bluewatersys.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. */
  24. #include <linux/init.h>
  25. #include <linux/gpio.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/i2c/pca953x.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <mach/hardware.h>
  32. #include <mach/board.h>
  33. #include <mach/at91sam9_smc.h>
  34. #include "sam9_smc.h"
  35. #include "generic.h"
  36. #define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
  37. static void __init snapper9260_map_io(void)
  38. {
  39. at91sam9260_initialize(18432000);
  40. /* Debug on ttyS0 */
  41. at91_register_uart(0, 0, 0);
  42. at91_set_serial_console(0);
  43. at91_register_uart(AT91SAM9260_ID_US0, 1,
  44. ATMEL_UART_CTS | ATMEL_UART_RTS);
  45. at91_register_uart(AT91SAM9260_ID_US1, 2,
  46. ATMEL_UART_CTS | ATMEL_UART_RTS);
  47. at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
  48. }
  49. static void __init snapper9260_init_irq(void)
  50. {
  51. at91sam9260_init_interrupts(NULL);
  52. }
  53. static struct at91_usbh_data __initdata snapper9260_usbh_data = {
  54. .ports = 2,
  55. };
  56. static struct at91_udc_data __initdata snapper9260_udc_data = {
  57. .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5),
  58. .vbus_active_low = 1,
  59. .vbus_polled = 1,
  60. };
  61. static struct at91_eth_data snapper9260_macb_data = {
  62. .is_rmii = 1,
  63. };
  64. static struct mtd_partition __initdata snapper9260_nand_partitions[] = {
  65. {
  66. .name = "Preboot",
  67. .offset = 0,
  68. .size = SZ_128K,
  69. },
  70. {
  71. .name = "Bootloader",
  72. .offset = MTDPART_OFS_APPEND,
  73. .size = SZ_256K,
  74. },
  75. {
  76. .name = "Environment",
  77. .offset = MTDPART_OFS_APPEND,
  78. .size = SZ_128K,
  79. },
  80. {
  81. .name = "Kernel",
  82. .offset = MTDPART_OFS_APPEND,
  83. .size = SZ_4M,
  84. },
  85. {
  86. .name = "Filesystem",
  87. .offset = MTDPART_OFS_APPEND,
  88. .size = MTDPART_SIZ_FULL,
  89. },
  90. };
  91. static struct mtd_partition * __init
  92. snapper9260_nand_partition_info(int size, int *num_partitions)
  93. {
  94. *num_partitions = ARRAY_SIZE(snapper9260_nand_partitions);
  95. return snapper9260_nand_partitions;
  96. }
  97. static struct atmel_nand_data __initdata snapper9260_nand_data = {
  98. .ale = 21,
  99. .cle = 22,
  100. .rdy_pin = AT91_PIN_PC13,
  101. .partition_info = snapper9260_nand_partition_info,
  102. .bus_width_16 = 0,
  103. };
  104. static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
  105. .ncs_read_setup = 0,
  106. .nrd_setup = 0,
  107. .ncs_write_setup = 0,
  108. .nwe_setup = 0,
  109. .ncs_read_pulse = 5,
  110. .nrd_pulse = 2,
  111. .ncs_write_pulse = 5,
  112. .nwe_pulse = 2,
  113. .read_cycle = 7,
  114. .write_cycle = 7,
  115. .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
  116. AT91_SMC_EXNWMODE_DISABLE),
  117. .tdf_cycles = 1,
  118. };
  119. static struct pca953x_platform_data snapper9260_io_expander_data = {
  120. .gpio_base = SNAPPER9260_IO_EXP_GPIO(0),
  121. };
  122. static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
  123. {
  124. /* IO expander */
  125. I2C_BOARD_INFO("max7312", 0x28),
  126. .platform_data = &snapper9260_io_expander_data,
  127. },
  128. {
  129. /* Audio codec */
  130. I2C_BOARD_INFO("tlv320aic23", 0x1a),
  131. },
  132. {
  133. /* RTC */
  134. I2C_BOARD_INFO("isl1208", 0x6f),
  135. },
  136. };
  137. static void __init snapper9260_add_device_nand(void)
  138. {
  139. at91_set_A_periph(AT91_PIN_PC14, 0);
  140. sam9_smc_configure(3, &snapper9260_nand_smc_config);
  141. at91_add_device_nand(&snapper9260_nand_data);
  142. }
  143. static void __init snapper9260_board_init(void)
  144. {
  145. at91_add_device_i2c(snapper9260_i2c_devices,
  146. ARRAY_SIZE(snapper9260_i2c_devices));
  147. at91_add_device_serial();
  148. at91_add_device_usbh(&snapper9260_usbh_data);
  149. at91_add_device_udc(&snapper9260_udc_data);
  150. at91_add_device_eth(&snapper9260_macb_data);
  151. at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
  152. ATMEL_SSC_TD | ATMEL_SSC_RD));
  153. snapper9260_add_device_nand();
  154. }
  155. MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
  156. .phys_io = AT91_BASE_SYS,
  157. .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
  158. .boot_params = AT91_SDRAM_BASE + 0x100,
  159. .timer = &at91sam926x_timer,
  160. .map_io = snapper9260_map_io,
  161. .init_irq = snapper9260_init_irq,
  162. .init_machine = snapper9260_board_init,
  163. MACHINE_END