mach-mx51_3ds.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright (C) 2010 Jason Wang <jason77.wang@gmail.com>
  4. *
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #include <linux/irq.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/spi/spi.h>
  15. #include <linux/gpio.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/time.h>
  19. #include <mach/hardware.h>
  20. #include <mach/common.h>
  21. #include <mach/iomux-mx51.h>
  22. #include <mach/3ds_debugboard.h>
  23. #include "devices-imx51.h"
  24. #define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28)
  25. static iomux_v3_cfg_t mx51_3ds_pads[] = {
  26. /* UART1 */
  27. MX51_PAD_UART1_RXD__UART1_RXD,
  28. MX51_PAD_UART1_TXD__UART1_TXD,
  29. MX51_PAD_UART1_RTS__UART1_RTS,
  30. MX51_PAD_UART1_CTS__UART1_CTS,
  31. /* UART2 */
  32. MX51_PAD_UART2_RXD__UART2_RXD,
  33. MX51_PAD_UART2_TXD__UART2_TXD,
  34. MX51_PAD_EIM_D25__UART2_CTS,
  35. MX51_PAD_EIM_D26__UART2_RTS,
  36. /* UART3 */
  37. MX51_PAD_UART3_RXD__UART3_RXD,
  38. MX51_PAD_UART3_TXD__UART3_TXD,
  39. MX51_PAD_EIM_D24__UART3_CTS,
  40. MX51_PAD_EIM_D27__UART3_RTS,
  41. /* CPLD PARENT IRQ PIN */
  42. MX51_PAD_GPIO1_6__GPIO1_6,
  43. /* KPP */
  44. MX51_PAD_KEY_ROW0__KEY_ROW0,
  45. MX51_PAD_KEY_ROW1__KEY_ROW1,
  46. MX51_PAD_KEY_ROW2__KEY_ROW2,
  47. MX51_PAD_KEY_ROW3__KEY_ROW3,
  48. MX51_PAD_KEY_COL0__KEY_COL0,
  49. MX51_PAD_KEY_COL1__KEY_COL1,
  50. MX51_PAD_KEY_COL2__KEY_COL2,
  51. MX51_PAD_KEY_COL3__KEY_COL3,
  52. MX51_PAD_KEY_COL4__KEY_COL4,
  53. MX51_PAD_KEY_COL5__KEY_COL5,
  54. /* eCSPI2 */
  55. MX51_PAD_NANDF_RB2__ECSPI2_SCLK,
  56. MX51_PAD_NANDF_RB3__ECSPI2_MISO,
  57. MX51_PAD_NANDF_D15__ECSPI2_MOSI,
  58. MX51_PAD_NANDF_D12__GPIO3_28,
  59. };
  60. /* Serial ports */
  61. static const struct imxuart_platform_data uart_pdata __initconst = {
  62. .flags = IMXUART_HAVE_RTSCTS,
  63. };
  64. static int mx51_3ds_board_keymap[] = {
  65. KEY(0, 0, KEY_1),
  66. KEY(0, 1, KEY_2),
  67. KEY(0, 2, KEY_3),
  68. KEY(0, 3, KEY_F1),
  69. KEY(0, 4, KEY_UP),
  70. KEY(0, 5, KEY_F2),
  71. KEY(1, 0, KEY_4),
  72. KEY(1, 1, KEY_5),
  73. KEY(1, 2, KEY_6),
  74. KEY(1, 3, KEY_LEFT),
  75. KEY(1, 4, KEY_SELECT),
  76. KEY(1, 5, KEY_RIGHT),
  77. KEY(2, 0, KEY_7),
  78. KEY(2, 1, KEY_8),
  79. KEY(2, 2, KEY_9),
  80. KEY(2, 3, KEY_F3),
  81. KEY(2, 4, KEY_DOWN),
  82. KEY(2, 5, KEY_F4),
  83. KEY(3, 0, KEY_0),
  84. KEY(3, 1, KEY_OK),
  85. KEY(3, 2, KEY_ESC),
  86. KEY(3, 3, KEY_ENTER),
  87. KEY(3, 4, KEY_MENU),
  88. KEY(3, 5, KEY_BACK)
  89. };
  90. static const struct matrix_keymap_data mx51_3ds_map_data __initconst = {
  91. .keymap = mx51_3ds_board_keymap,
  92. .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap),
  93. };
  94. static int mx51_3ds_spi2_cs[] = {
  95. MXC_SPI_CS(0),
  96. MX51_3DS_ECSPI2_CS,
  97. };
  98. static const struct spi_imx_master mx51_3ds_ecspi2_pdata __initconst = {
  99. .chipselect = mx51_3ds_spi2_cs,
  100. .num_chipselect = ARRAY_SIZE(mx51_3ds_spi2_cs),
  101. };
  102. static struct spi_board_info mx51_3ds_spi_nor_device[] = {
  103. {
  104. .modalias = "m25p80",
  105. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  106. .bus_num = 1,
  107. .chip_select = 1,
  108. .mode = SPI_MODE_0,
  109. .platform_data = NULL,},
  110. };
  111. /*
  112. * Board specific initialization.
  113. */
  114. static void __init mx51_3ds_init(void)
  115. {
  116. imx51_soc_init();
  117. mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads,
  118. ARRAY_SIZE(mx51_3ds_pads));
  119. imx51_add_imx_uart(0, &uart_pdata);
  120. imx51_add_imx_uart(1, &uart_pdata);
  121. imx51_add_imx_uart(2, &uart_pdata);
  122. imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata);
  123. spi_register_board_info(mx51_3ds_spi_nor_device,
  124. ARRAY_SIZE(mx51_3ds_spi_nor_device));
  125. if (mxc_expio_init(MX51_CS5_BASE_ADDR, IMX_GPIO_NR(1, 6)))
  126. printk(KERN_WARNING "Init of the debugboard failed, all "
  127. "devices on the board are unusable.\n");
  128. imx51_add_sdhci_esdhc_imx(0, NULL);
  129. imx51_add_imx_keypad(&mx51_3ds_map_data);
  130. imx51_add_imx2_wdt(0);
  131. }
  132. static void __init mx51_3ds_timer_init(void)
  133. {
  134. mx51_clocks_init(32768, 24000000, 22579200, 0);
  135. }
  136. static struct sys_timer mx51_3ds_timer = {
  137. .init = mx51_3ds_timer_init,
  138. };
  139. MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board")
  140. /* Maintainer: Freescale Semiconductor, Inc. */
  141. .atag_offset = 0x100,
  142. .map_io = mx51_map_io,
  143. .init_early = imx51_init_early,
  144. .init_irq = mx51_init_irq,
  145. .handle_irq = imx51_handle_irq,
  146. .timer = &mx51_3ds_timer,
  147. .init_machine = mx51_3ds_init,
  148. .init_late = imx51_init_late,
  149. .restart = mxc_restart,
  150. MACHINE_END