mach-mx25pdk.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. #include <linux/types.h>
  19. #include <linux/init.h>
  20. #include <linux/delay.h>
  21. #include <linux/clk.h>
  22. #include <linux/irq.h>
  23. #include <linux/gpio.h>
  24. #include <linux/fec.h>
  25. #include <linux/platform_device.h>
  26. #include <mach/hardware.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/time.h>
  30. #include <asm/memory.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/common.h>
  33. #include <mach/imx-uart.h>
  34. #include <mach/mx25.h>
  35. #include <mach/mxc_nand.h>
  36. #include <mach/imxfb.h>
  37. #include "devices.h"
  38. #include <mach/iomux-mx25.h>
  39. static struct imxuart_platform_data uart_pdata = {
  40. .flags = IMXUART_HAVE_RTSCTS,
  41. };
  42. static struct pad_desc mx25pdk_pads[] = {
  43. MX25_PAD_FEC_MDC__FEC_MDC,
  44. MX25_PAD_FEC_MDIO__FEC_MDIO,
  45. MX25_PAD_FEC_TDATA0__FEC_TDATA0,
  46. MX25_PAD_FEC_TDATA1__FEC_TDATA1,
  47. MX25_PAD_FEC_TX_EN__FEC_TX_EN,
  48. MX25_PAD_FEC_RDATA0__FEC_RDATA0,
  49. MX25_PAD_FEC_RDATA1__FEC_RDATA1,
  50. MX25_PAD_FEC_RX_DV__FEC_RX_DV,
  51. MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
  52. MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
  53. MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
  54. /* LCD */
  55. MX25_PAD_LD0__LD0,
  56. MX25_PAD_LD1__LD1,
  57. MX25_PAD_LD2__LD2,
  58. MX25_PAD_LD3__LD3,
  59. MX25_PAD_LD4__LD4,
  60. MX25_PAD_LD5__LD5,
  61. MX25_PAD_LD6__LD6,
  62. MX25_PAD_LD7__LD7,
  63. MX25_PAD_LD8__LD8,
  64. MX25_PAD_LD9__LD9,
  65. MX25_PAD_LD10__LD10,
  66. MX25_PAD_LD11__LD11,
  67. MX25_PAD_LD12__LD12,
  68. MX25_PAD_LD13__LD13,
  69. MX25_PAD_LD14__LD14,
  70. MX25_PAD_LD15__LD15,
  71. MX25_PAD_GPIO_E__LD16,
  72. MX25_PAD_GPIO_F__LD17,
  73. MX25_PAD_HSYNC__HSYNC,
  74. MX25_PAD_VSYNC__VSYNC,
  75. MX25_PAD_LSCLK__LSCLK,
  76. MX25_PAD_OE_ACD__OE_ACD,
  77. MX25_PAD_CONTRAST__CONTRAST,
  78. };
  79. static struct fec_platform_data mx25_fec_pdata = {
  80. .phy = PHY_INTERFACE_MODE_RMII,
  81. };
  82. #define FEC_ENABLE_GPIO 35
  83. #define FEC_RESET_B_GPIO 104
  84. static void __init mx25pdk_fec_reset(void)
  85. {
  86. gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
  87. gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
  88. gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
  89. gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
  90. udelay(2);
  91. /* turn on PHY power and lift reset */
  92. gpio_set_value(FEC_ENABLE_GPIO, 1);
  93. gpio_set_value(FEC_RESET_B_GPIO, 1);
  94. }
  95. static struct mxc_nand_platform_data mx25pdk_nand_board_info = {
  96. .width = 1,
  97. .hw_ecc = 1,
  98. .flash_bbt = 1,
  99. };
  100. static struct imx_fb_videomode mx25pdk_modes[] = {
  101. {
  102. .mode = {
  103. .name = "CRT-VGA",
  104. .refresh = 60,
  105. .xres = 640,
  106. .yres = 480,
  107. .pixclock = 39683,
  108. .left_margin = 45,
  109. .right_margin = 114,
  110. .upper_margin = 33,
  111. .lower_margin = 11,
  112. .hsync_len = 1,
  113. .vsync_len = 1,
  114. },
  115. .bpp = 16,
  116. .pcr = 0xFA208B80,
  117. },
  118. };
  119. static struct imx_fb_platform_data mx25pdk_fb_pdata = {
  120. .mode = mx25pdk_modes,
  121. .num_modes = ARRAY_SIZE(mx25pdk_modes),
  122. .pwmr = 0x00A903FF,
  123. .lscr1 = 0x00120300,
  124. .dmacr = 0x00020010,
  125. };
  126. static void __init mx25pdk_init(void)
  127. {
  128. mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
  129. ARRAY_SIZE(mx25pdk_pads));
  130. mxc_register_device(&mxc_uart_device0, &uart_pdata);
  131. mxc_register_device(&mxc_usbh2, NULL);
  132. mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info);
  133. mxc_register_device(&mx25_rtc_device, NULL);
  134. mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
  135. mx25pdk_fec_reset();
  136. mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
  137. }
  138. static void __init mx25pdk_timer_init(void)
  139. {
  140. mx25_clocks_init();
  141. }
  142. static struct sys_timer mx25pdk_timer = {
  143. .init = mx25pdk_timer_init,
  144. };
  145. MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
  146. /* Maintainer: Freescale Semiconductor, Inc. */
  147. .phys_io = MX25_AIPS1_BASE_ADDR,
  148. .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  149. .boot_params = MX25_PHYS_OFFSET + 0x100,
  150. .map_io = mx25_map_io,
  151. .init_irq = mx25_init_irq,
  152. .init_machine = mx25pdk_init,
  153. .timer = &mx25pdk_timer,
  154. MACHINE_END