mach-mx25_3ds.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /*
  2. * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. /*
  19. * This machine is known as:
  20. * - i.MX25 3-Stack Development System
  21. * - i.MX25 Platform Development Kit (i.MX25 PDK)
  22. */
  23. #include <linux/types.h>
  24. #include <linux/init.h>
  25. #include <linux/delay.h>
  26. #include <linux/clk.h>
  27. #include <linux/irq.h>
  28. #include <linux/gpio.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/usb/otg.h>
  31. #include <mach/hardware.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/mach/arch.h>
  34. #include <asm/mach/time.h>
  35. #include <asm/memory.h>
  36. #include <asm/mach/map.h>
  37. #include <mach/common.h>
  38. #include <mach/mx25.h>
  39. #include <mach/iomux-mx25.h>
  40. #include "devices-imx25.h"
  41. #define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6)
  42. static const struct imxuart_platform_data uart_pdata __initconst = {
  43. .flags = IMXUART_HAVE_RTSCTS,
  44. };
  45. static iomux_v3_cfg_t mx25pdk_pads[] = {
  46. MX25_PAD_FEC_MDC__FEC_MDC,
  47. MX25_PAD_FEC_MDIO__FEC_MDIO,
  48. MX25_PAD_FEC_TDATA0__FEC_TDATA0,
  49. MX25_PAD_FEC_TDATA1__FEC_TDATA1,
  50. MX25_PAD_FEC_TX_EN__FEC_TX_EN,
  51. MX25_PAD_FEC_RDATA0__FEC_RDATA0,
  52. MX25_PAD_FEC_RDATA1__FEC_RDATA1,
  53. MX25_PAD_FEC_RX_DV__FEC_RX_DV,
  54. MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
  55. MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
  56. MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
  57. /* LCD */
  58. MX25_PAD_LD0__LD0,
  59. MX25_PAD_LD1__LD1,
  60. MX25_PAD_LD2__LD2,
  61. MX25_PAD_LD3__LD3,
  62. MX25_PAD_LD4__LD4,
  63. MX25_PAD_LD5__LD5,
  64. MX25_PAD_LD6__LD6,
  65. MX25_PAD_LD7__LD7,
  66. MX25_PAD_LD8__LD8,
  67. MX25_PAD_LD9__LD9,
  68. MX25_PAD_LD10__LD10,
  69. MX25_PAD_LD11__LD11,
  70. MX25_PAD_LD12__LD12,
  71. MX25_PAD_LD13__LD13,
  72. MX25_PAD_LD14__LD14,
  73. MX25_PAD_LD15__LD15,
  74. MX25_PAD_GPIO_E__LD16,
  75. MX25_PAD_GPIO_F__LD17,
  76. MX25_PAD_HSYNC__HSYNC,
  77. MX25_PAD_VSYNC__VSYNC,
  78. MX25_PAD_LSCLK__LSCLK,
  79. MX25_PAD_OE_ACD__OE_ACD,
  80. MX25_PAD_CONTRAST__CONTRAST,
  81. /* Keypad */
  82. MX25_PAD_KPP_ROW0__KPP_ROW0,
  83. MX25_PAD_KPP_ROW1__KPP_ROW1,
  84. MX25_PAD_KPP_ROW2__KPP_ROW2,
  85. MX25_PAD_KPP_ROW3__KPP_ROW3,
  86. MX25_PAD_KPP_COL0__KPP_COL0,
  87. MX25_PAD_KPP_COL1__KPP_COL1,
  88. MX25_PAD_KPP_COL2__KPP_COL2,
  89. MX25_PAD_KPP_COL3__KPP_COL3,
  90. /* SD1 */
  91. MX25_PAD_SD1_CMD__SD1_CMD,
  92. MX25_PAD_SD1_CLK__SD1_CLK,
  93. MX25_PAD_SD1_DATA0__SD1_DATA0,
  94. MX25_PAD_SD1_DATA1__SD1_DATA1,
  95. MX25_PAD_SD1_DATA2__SD1_DATA2,
  96. MX25_PAD_SD1_DATA3__SD1_DATA3,
  97. MX25_PAD_A14__GPIO_2_0, /* WriteProtect */
  98. MX25_PAD_A15__GPIO_2_1, /* CardDetect */
  99. /* I2C1 */
  100. MX25_PAD_I2C1_CLK__I2C1_CLK,
  101. MX25_PAD_I2C1_DAT__I2C1_DAT,
  102. /* CAN1 */
  103. MX25_PAD_GPIO_A__CAN1_TX,
  104. MX25_PAD_GPIO_B__CAN1_RX,
  105. MX25_PAD_D14__GPIO_4_6, /* CAN_PWDN */
  106. };
  107. static const struct fec_platform_data mx25_fec_pdata __initconst = {
  108. .phy = PHY_INTERFACE_MODE_RMII,
  109. };
  110. #define FEC_ENABLE_GPIO IMX_GPIO_NR(2, 3)
  111. #define FEC_RESET_B_GPIO IMX_GPIO_NR(4, 8)
  112. static void __init mx25pdk_fec_reset(void)
  113. {
  114. gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
  115. gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
  116. gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
  117. gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
  118. udelay(2);
  119. /* turn on PHY power and lift reset */
  120. gpio_set_value(FEC_ENABLE_GPIO, 1);
  121. gpio_set_value(FEC_RESET_B_GPIO, 1);
  122. }
  123. static const struct mxc_nand_platform_data
  124. mx25pdk_nand_board_info __initconst = {
  125. .width = 1,
  126. .hw_ecc = 1,
  127. .flash_bbt = 1,
  128. };
  129. static struct imx_fb_videomode mx25pdk_modes[] = {
  130. {
  131. .mode = {
  132. .name = "CRT-VGA",
  133. .refresh = 60,
  134. .xres = 640,
  135. .yres = 480,
  136. .pixclock = 39683,
  137. .left_margin = 45,
  138. .right_margin = 114,
  139. .upper_margin = 33,
  140. .lower_margin = 11,
  141. .hsync_len = 1,
  142. .vsync_len = 1,
  143. },
  144. .bpp = 16,
  145. .pcr = 0xFA208B80,
  146. },
  147. };
  148. static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = {
  149. .mode = mx25pdk_modes,
  150. .num_modes = ARRAY_SIZE(mx25pdk_modes),
  151. .pwmr = 0x00A903FF,
  152. .lscr1 = 0x00120300,
  153. .dmacr = 0x00020010,
  154. };
  155. static const uint32_t mx25pdk_keymap[] = {
  156. KEY(0, 0, KEY_UP),
  157. KEY(0, 1, KEY_DOWN),
  158. KEY(0, 2, KEY_VOLUMEDOWN),
  159. KEY(0, 3, KEY_HOME),
  160. KEY(1, 0, KEY_RIGHT),
  161. KEY(1, 1, KEY_LEFT),
  162. KEY(1, 2, KEY_ENTER),
  163. KEY(1, 3, KEY_VOLUMEUP),
  164. KEY(2, 0, KEY_F6),
  165. KEY(2, 1, KEY_F8),
  166. KEY(2, 2, KEY_F9),
  167. KEY(2, 3, KEY_F10),
  168. KEY(3, 0, KEY_F1),
  169. KEY(3, 1, KEY_F2),
  170. KEY(3, 2, KEY_F3),
  171. KEY(3, 3, KEY_POWER),
  172. };
  173. static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = {
  174. .keymap = mx25pdk_keymap,
  175. .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
  176. };
  177. static int mx25pdk_usbh2_init(struct platform_device *pdev)
  178. {
  179. return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
  180. }
  181. static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
  182. .init = mx25pdk_usbh2_init,
  183. .portsc = MXC_EHCI_MODE_SERIAL,
  184. };
  185. static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
  186. .operating_mode = FSL_USB2_DR_DEVICE,
  187. .phy_mode = FSL_USB2_PHY_UTMI,
  188. };
  189. static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
  190. .bitrate = 100000,
  191. };
  192. #define SD1_GPIO_WP IMX_GPIO_NR(2, 0)
  193. #define SD1_GPIO_CD IMX_GPIO_NR(2, 1)
  194. static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
  195. .wp_gpio = SD1_GPIO_WP,
  196. .cd_gpio = SD1_GPIO_CD,
  197. .wp_type = ESDHC_WP_GPIO,
  198. .cd_type = ESDHC_CD_GPIO,
  199. };
  200. static void __init mx25pdk_init(void)
  201. {
  202. imx25_soc_init();
  203. mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
  204. ARRAY_SIZE(mx25pdk_pads));
  205. imx25_add_imx_uart0(&uart_pdata);
  206. imx25_add_fsl_usb2_udc(&otg_device_pdata);
  207. imx25_add_mxc_ehci_hs(&usbh2_pdata);
  208. imx25_add_mxc_nand(&mx25pdk_nand_board_info);
  209. imx25_add_imxdi_rtc(NULL);
  210. imx25_add_imx_fb(&mx25pdk_fb_pdata);
  211. imx25_add_imx2_wdt(NULL);
  212. mx25pdk_fec_reset();
  213. imx25_add_fec(&mx25_fec_pdata);
  214. imx25_add_imx_keypad(&mx25pdk_keymap_data);
  215. imx25_add_sdhci_esdhc_imx(0, &mx25pdk_esdhc_pdata);
  216. imx25_add_imx_i2c0(&mx25_3ds_i2c0_data);
  217. gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn");
  218. imx25_add_flexcan0(NULL);
  219. }
  220. static void __init mx25pdk_timer_init(void)
  221. {
  222. mx25_clocks_init();
  223. }
  224. static struct sys_timer mx25pdk_timer = {
  225. .init = mx25pdk_timer_init,
  226. };
  227. MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
  228. /* Maintainer: Freescale Semiconductor, Inc. */
  229. .atag_offset = 0x100,
  230. .map_io = mx25_map_io,
  231. .init_early = imx25_init_early,
  232. .init_irq = mx25_init_irq,
  233. .handle_irq = imx25_handle_irq,
  234. .timer = &mx25pdk_timer,
  235. .init_machine = mx25pdk_init,
  236. .restart = mxc_restart,
  237. MACHINE_END