gplugd.c 3.9 KB

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