gplugd.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-mmp/gplugd.c
  4. *
  5. * Support for the Marvell PXA168-based GuruPlug Display (gplugD) Platform.
  6. */
  7. #include <linux/init.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/gpio.h>
  10. #include <linux/gpio-pxa.h>
  11. #include <asm/mach/arch.h>
  12. #include <asm/mach-types.h>
  13. #include "irqs.h"
  14. #include "pxa168.h"
  15. #include "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 pxa_gpio_platform_data pxa168_gpio_pdata = {
  112. .irq_base = MMP_GPIO_TO_IRQ(0),
  113. };
  114. static struct i2c_board_info gplugd_i2c_board_info[] = {
  115. {
  116. .type = "isl1208",
  117. .addr = 0x6F,
  118. }
  119. };
  120. /* Bring PHY out of reset by setting GPIO 104 */
  121. static int gplugd_eth_init(void)
  122. {
  123. if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
  124. printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
  125. "PHY out of reset\n");
  126. return -EIO;
  127. }
  128. gpio_direction_output(104, 1);
  129. gpio_free(104);
  130. return 0;
  131. }
  132. struct pxa168_eth_platform_data gplugd_eth_platform_data = {
  133. .port_number = 0,
  134. .phy_addr = 0,
  135. .speed = 0, /* Autonagotiation */
  136. .intf = PHY_INTERFACE_MODE_RMII,
  137. .init = gplugd_eth_init,
  138. };
  139. static void __init select_disp_freq(void)
  140. {
  141. /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
  142. if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
  143. printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
  144. "frequency\n");
  145. } else {
  146. gpio_direction_output(35, 1);
  147. gpio_free(35);
  148. }
  149. if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
  150. printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
  151. "frequency\n");
  152. } else {
  153. gpio_direction_output(85, 0);
  154. gpio_free(85);
  155. }
  156. }
  157. static void __init gplugd_init(void)
  158. {
  159. mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
  160. select_disp_freq();
  161. /* on-chip devices */
  162. pxa168_add_uart(3);
  163. pxa168_add_ssp(1);
  164. pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
  165. platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
  166. sizeof(struct pxa_gpio_platform_data));
  167. platform_device_register(&pxa168_device_gpio);
  168. pxa168_add_eth(&gplugd_eth_platform_data);
  169. }
  170. MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
  171. .map_io = mmp_map_io,
  172. .nr_irqs = MMP_NR_IRQS,
  173. .init_irq = pxa168_init_irq,
  174. .init_time = pxa168_timer_init,
  175. .init_machine = gplugd_init,
  176. .restart = pxa168_restart,
  177. MACHINE_END