gplugd.c 3.9 KB

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