gplugd.c 3.7 KB

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