gplugd.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * linux/arch/arm/mach-mmp/gplugd.c
  3. *
  4. * Support for the Marvell PXA168-based GuruPlug Display (gplugD) Platform.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * publishhed by the Free Software Foundation.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/gpio.h>
  13. #include <asm/mach/arch.h>
  14. #include <asm/mach-types.h>
  15. #include <mach/irqs.h>
  16. #include <mach/pxa168.h>
  17. #include <mach/mfp-pxa168.h>
  18. #include "common.h"
  19. static unsigned long gplugd_pin_config[] __initdata = {
  20. /* UART3 */
  21. GPIO8_UART3_TXD,
  22. GPIO9_UART3_RXD,
  23. GPIO1O_UART3_CTS,
  24. GPIO11_UART3_RTS,
  25. /* USB OTG PEN */
  26. GPIO18_GPIO,
  27. /* MMC2 */
  28. GPIO28_MMC2_CMD,
  29. GPIO29_MMC2_CLK,
  30. GPIO30_MMC2_DAT0,
  31. GPIO31_MMC2_DAT1,
  32. GPIO32_MMC2_DAT2,
  33. GPIO33_MMC2_DAT3,
  34. /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
  35. GPIO35_GPIO,
  36. GPIO36_GPIO, /* CEC Interrupt */
  37. /* MMC1 */
  38. GPIO43_MMC1_CLK,
  39. GPIO49_MMC1_CMD,
  40. GPIO41_MMC1_DAT0,
  41. GPIO40_MMC1_DAT1,
  42. GPIO52_MMC1_DAT2,
  43. GPIO51_MMC1_DAT3,
  44. GPIO53_MMC1_CD,
  45. /* LCD */
  46. GPIO56_LCD_FCLK_RD,
  47. GPIO57_LCD_LCLK_A0,
  48. GPIO58_LCD_PCLK_WR,
  49. GPIO59_LCD_DENA_BIAS,
  50. GPIO60_LCD_DD0,
  51. GPIO61_LCD_DD1,
  52. GPIO62_LCD_DD2,
  53. GPIO63_LCD_DD3,
  54. GPIO64_LCD_DD4,
  55. GPIO65_LCD_DD5,
  56. GPIO66_LCD_DD6,
  57. GPIO67_LCD_DD7,
  58. GPIO68_LCD_DD8,
  59. GPIO69_LCD_DD9,
  60. GPIO70_LCD_DD10,
  61. GPIO71_LCD_DD11,
  62. GPIO72_LCD_DD12,
  63. GPIO73_LCD_DD13,
  64. GPIO74_LCD_DD14,
  65. GPIO75_LCD_DD15,
  66. GPIO76_LCD_DD16,
  67. GPIO77_LCD_DD17,
  68. GPIO78_LCD_DD18,
  69. GPIO79_LCD_DD19,
  70. GPIO80_LCD_DD20,
  71. GPIO81_LCD_DD21,
  72. GPIO82_LCD_DD22,
  73. GPIO83_LCD_DD23,
  74. /* GPIO */
  75. GPIO84_GPIO,
  76. GPIO85_GPIO,
  77. /* Fast-Ethernet*/
  78. GPIO86_TX_CLK,
  79. GPIO87_TX_EN,
  80. GPIO88_TX_DQ3,
  81. GPIO89_TX_DQ2,
  82. GPIO90_TX_DQ1,
  83. GPIO91_TX_DQ0,
  84. GPIO92_MII_CRS,
  85. GPIO93_MII_COL,
  86. GPIO94_RX_CLK,
  87. GPIO95_RX_ER,
  88. GPIO96_RX_DQ3,
  89. GPIO97_RX_DQ2,
  90. GPIO98_RX_DQ1,
  91. GPIO99_RX_DQ0,
  92. GPIO100_MII_MDC,
  93. GPIO101_MII_MDIO,
  94. GPIO103_RX_DV,
  95. GPIO104_GPIO, /* Reset PHY */
  96. /* RTC interrupt */
  97. GPIO102_GPIO,
  98. /* I2C */
  99. GPIO105_CI2C_SDA,
  100. GPIO106_CI2C_SCL,
  101. /* SPI NOR Flash on SSP2 */
  102. GPIO107_SSP2_RXD,
  103. GPIO108_SSP2_TXD,
  104. GPIO110_GPIO, /* SPI_CSn */
  105. GPIO111_SSP2_CLK,
  106. /* Select JTAG */
  107. GPIO109_GPIO,
  108. /* I2S */
  109. GPIO114_I2S_FRM,
  110. GPIO115_I2S_BCLK,
  111. GPIO116_I2S_TXD
  112. };
  113. static struct i2c_board_info gplugd_i2c_board_info[] = {
  114. {
  115. .type = "isl1208",
  116. .addr = 0x6F,
  117. }
  118. };
  119. /* Bring PHY out of reset by setting GPIO 104 */
  120. static int gplugd_eth_init(void)
  121. {
  122. if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
  123. printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
  124. "PHY out of reset\n");
  125. return -EIO;
  126. }
  127. gpio_direction_output(104, 1);
  128. gpio_free(104);
  129. return 0;
  130. }
  131. struct pxa168_eth_platform_data gplugd_eth_platform_data = {
  132. .port_number = 0,
  133. .phy_addr = 0,
  134. .speed = 0, /* Autonagotiation */
  135. .init = gplugd_eth_init,
  136. };
  137. static void __init select_disp_freq(void)
  138. {
  139. /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
  140. if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
  141. printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
  142. "frequency\n");
  143. } else {
  144. gpio_direction_output(35, 1);
  145. gpio_free(35);
  146. }
  147. if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
  148. printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
  149. "frequency\n");
  150. } else {
  151. gpio_direction_output(85, 0);
  152. gpio_free(85);
  153. }
  154. }
  155. static void __init gplugd_init(void)
  156. {
  157. mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
  158. select_disp_freq();
  159. /* on-chip devices */
  160. pxa168_add_uart(3);
  161. pxa168_add_ssp(1);
  162. pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
  163. platform_device_register(&pxa168_device_gpio);
  164. pxa168_add_eth(&gplugd_eth_platform_data);
  165. }
  166. MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
  167. .map_io = mmp_map_io,
  168. .nr_irqs = MMP_NR_IRQS,
  169. .init_irq = pxa168_init_irq,
  170. .init_time = pxa168_timer_init,
  171. .init_machine = gplugd_init,
  172. .restart = pxa168_restart,
  173. MACHINE_END