gplugd.c 4.2 KB

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