mach-mx23evk.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/delay.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/gpio.h>
  17. #include <linux/irq.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/time.h>
  21. #include <mach/common.h>
  22. #include <mach/iomux-mx23.h>
  23. #include "devices-mx23.h"
  24. #define MX23EVK_LCD_ENABLE MXS_GPIO_NR(1, 18)
  25. #define MX23EVK_BL_ENABLE MXS_GPIO_NR(1, 28)
  26. #define MX23EVK_MMC0_WRITE_PROTECT MXS_GPIO_NR(1, 30)
  27. #define MX23EVK_MMC0_SLOT_POWER MXS_GPIO_NR(1, 29)
  28. static const iomux_cfg_t mx23evk_pads[] __initconst = {
  29. /* duart */
  30. MX23_PAD_PWM0__DUART_RX | MXS_PAD_CTRL,
  31. MX23_PAD_PWM1__DUART_TX | MXS_PAD_CTRL,
  32. /* auart */
  33. MX23_PAD_AUART1_RX__AUART1_RX | MXS_PAD_CTRL,
  34. MX23_PAD_AUART1_TX__AUART1_TX | MXS_PAD_CTRL,
  35. MX23_PAD_AUART1_CTS__AUART1_CTS | MXS_PAD_CTRL,
  36. MX23_PAD_AUART1_RTS__AUART1_RTS | MXS_PAD_CTRL,
  37. /* mxsfb (lcdif) */
  38. MX23_PAD_LCD_D00__LCD_D00 | MXS_PAD_CTRL,
  39. MX23_PAD_LCD_D01__LCD_D01 | MXS_PAD_CTRL,
  40. MX23_PAD_LCD_D02__LCD_D02 | MXS_PAD_CTRL,
  41. MX23_PAD_LCD_D03__LCD_D03 | MXS_PAD_CTRL,
  42. MX23_PAD_LCD_D04__LCD_D04 | MXS_PAD_CTRL,
  43. MX23_PAD_LCD_D05__LCD_D05 | MXS_PAD_CTRL,
  44. MX23_PAD_LCD_D06__LCD_D06 | MXS_PAD_CTRL,
  45. MX23_PAD_LCD_D07__LCD_D07 | MXS_PAD_CTRL,
  46. MX23_PAD_LCD_D08__LCD_D08 | MXS_PAD_CTRL,
  47. MX23_PAD_LCD_D09__LCD_D09 | MXS_PAD_CTRL,
  48. MX23_PAD_LCD_D10__LCD_D10 | MXS_PAD_CTRL,
  49. MX23_PAD_LCD_D11__LCD_D11 | MXS_PAD_CTRL,
  50. MX23_PAD_LCD_D12__LCD_D12 | MXS_PAD_CTRL,
  51. MX23_PAD_LCD_D13__LCD_D13 | MXS_PAD_CTRL,
  52. MX23_PAD_LCD_D14__LCD_D14 | MXS_PAD_CTRL,
  53. MX23_PAD_LCD_D15__LCD_D15 | MXS_PAD_CTRL,
  54. MX23_PAD_LCD_D16__LCD_D16 | MXS_PAD_CTRL,
  55. MX23_PAD_LCD_D17__LCD_D17 | MXS_PAD_CTRL,
  56. MX23_PAD_GPMI_D08__LCD_D18 | MXS_PAD_CTRL,
  57. MX23_PAD_GPMI_D09__LCD_D19 | MXS_PAD_CTRL,
  58. MX23_PAD_GPMI_D10__LCD_D20 | MXS_PAD_CTRL,
  59. MX23_PAD_GPMI_D11__LCD_D21 | MXS_PAD_CTRL,
  60. MX23_PAD_GPMI_D12__LCD_D22 | MXS_PAD_CTRL,
  61. MX23_PAD_GPMI_D13__LCD_D23 | MXS_PAD_CTRL,
  62. MX23_PAD_LCD_VSYNC__LCD_VSYNC | MXS_PAD_CTRL,
  63. MX23_PAD_LCD_HSYNC__LCD_HSYNC | MXS_PAD_CTRL,
  64. MX23_PAD_LCD_DOTCK__LCD_DOTCK | MXS_PAD_CTRL,
  65. MX23_PAD_LCD_ENABLE__LCD_ENABLE | MXS_PAD_CTRL,
  66. /* LCD panel enable */
  67. MX23_PAD_LCD_RESET__GPIO_1_18 | MXS_PAD_CTRL,
  68. /* backlight control */
  69. MX23_PAD_PWM2__GPIO_1_28 | MXS_PAD_CTRL,
  70. /* mmc */
  71. MX23_PAD_SSP1_DATA0__SSP1_DATA0 |
  72. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  73. MX23_PAD_SSP1_DATA1__SSP1_DATA1 |
  74. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  75. MX23_PAD_SSP1_DATA2__SSP1_DATA2 |
  76. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  77. MX23_PAD_SSP1_DATA3__SSP1_DATA3 |
  78. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  79. MX23_PAD_GPMI_D08__SSP1_DATA4 |
  80. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  81. MX23_PAD_GPMI_D09__SSP1_DATA5 |
  82. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  83. MX23_PAD_GPMI_D10__SSP1_DATA6 |
  84. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  85. MX23_PAD_GPMI_D11__SSP1_DATA7 |
  86. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  87. MX23_PAD_SSP1_CMD__SSP1_CMD |
  88. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  89. MX23_PAD_SSP1_DETECT__SSP1_DETECT |
  90. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  91. MX23_PAD_SSP1_SCK__SSP1_SCK |
  92. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  93. /* write protect */
  94. MX23_PAD_PWM4__GPIO_1_30 |
  95. (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  96. /* slot power enable */
  97. MX23_PAD_PWM3__GPIO_1_29 |
  98. (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  99. };
  100. /* mxsfb (lcdif) */
  101. static struct fb_videomode mx23evk_video_modes[] = {
  102. {
  103. .name = "Samsung-LMS430HF02",
  104. .refresh = 60,
  105. .xres = 480,
  106. .yres = 272,
  107. .pixclock = 108096, /* picosecond (9.2 MHz) */
  108. .left_margin = 15,
  109. .right_margin = 8,
  110. .upper_margin = 12,
  111. .lower_margin = 4,
  112. .hsync_len = 1,
  113. .vsync_len = 1,
  114. .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT |
  115. FB_SYNC_DOTCLK_FAILING_ACT,
  116. },
  117. };
  118. static const struct mxsfb_platform_data mx23evk_mxsfb_pdata __initconst = {
  119. .mode_list = mx23evk_video_modes,
  120. .mode_count = ARRAY_SIZE(mx23evk_video_modes),
  121. .default_bpp = 32,
  122. .ld_intf_width = STMLCDIF_24BIT,
  123. };
  124. static struct mxs_mmc_platform_data mx23evk_mmc_pdata __initdata = {
  125. .wp_gpio = MX23EVK_MMC0_WRITE_PROTECT,
  126. .flags = SLOTF_8_BIT_CAPABLE,
  127. };
  128. static void __init mx23evk_init(void)
  129. {
  130. int ret;
  131. mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
  132. mx23_add_duart();
  133. mx23_add_auart0();
  134. /* power on mmc slot by writing 0 to the gpio */
  135. ret = gpio_request_one(MX23EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW,
  136. "mmc0-slot-power");
  137. if (ret)
  138. pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret);
  139. mx23_add_mxs_mmc(0, &mx23evk_mmc_pdata);
  140. ret = gpio_request_one(MX23EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable");
  141. if (ret)
  142. pr_warn("failed to request gpio lcd-enable: %d\n", ret);
  143. else
  144. gpio_set_value(MX23EVK_LCD_ENABLE, 1);
  145. ret = gpio_request_one(MX23EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable");
  146. if (ret)
  147. pr_warn("failed to request gpio bl-enable: %d\n", ret);
  148. else
  149. gpio_set_value(MX23EVK_BL_ENABLE, 1);
  150. mx23_add_mxsfb(&mx23evk_mxsfb_pdata);
  151. }
  152. static void __init mx23evk_timer_init(void)
  153. {
  154. mx23_clocks_init();
  155. }
  156. static struct sys_timer mx23evk_timer = {
  157. .init = mx23evk_timer_init,
  158. };
  159. MACHINE_START(MX23EVK, "Freescale MX23 EVK")
  160. /* Maintainer: Freescale Semiconductor, Inc. */
  161. .map_io = mx23_map_io,
  162. .init_irq = mx23_init_irq,
  163. .init_machine = mx23evk_init,
  164. .timer = &mx23evk_timer,
  165. MACHINE_END