colibri-pxa300.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-pxa/colibri-pxa300.c
  4. *
  5. * Support for Toradex PXA300/310 based Colibri module
  6. *
  7. * Daniel Mack <[email protected]>
  8. * Matthias Meier <[email protected]>
  9. */
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/gpio.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/soc/pxa/cpu.h>
  16. #include <asm/mach-types.h>
  17. #include <linux/sizes.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/irq.h>
  20. #include "pxa300.h"
  21. #include "colibri.h"
  22. #include <linux/platform_data/usb-ohci-pxa27x.h>
  23. #include <linux/platform_data/video-pxafb.h>
  24. #include <linux/platform_data/asoc-pxa.h>
  25. #include "generic.h"
  26. #include "devices.h"
  27. #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
  28. static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
  29. /* MMC */
  30. GPIO7_MMC1_CLK,
  31. GPIO14_MMC1_CMD,
  32. GPIO3_MMC1_DAT0,
  33. GPIO4_MMC1_DAT1,
  34. GPIO5_MMC1_DAT2,
  35. GPIO6_MMC1_DAT3,
  36. GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
  37. /* UHC */
  38. GPIO0_2_USBH_PEN,
  39. GPIO1_2_USBH_PWR,
  40. GPIO77_USB_P3_1,
  41. GPIO78_USB_P3_2,
  42. GPIO79_USB_P3_3,
  43. GPIO80_USB_P3_4,
  44. GPIO81_USB_P3_5,
  45. GPIO82_USB_P3_6,
  46. /* I2C */
  47. GPIO21_I2C_SCL,
  48. GPIO22_I2C_SDA,
  49. };
  50. #else
  51. static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
  52. #endif
  53. #if defined(CONFIG_AX88796)
  54. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
  55. /*
  56. * Asix AX88796 Ethernet
  57. */
  58. static struct ax_plat_data colibri_asix_platdata = {
  59. .flags = 0, /* defined later */
  60. .wordlength = 2,
  61. };
  62. static struct resource colibri_asix_resource[] = {
  63. [0] = {
  64. .start = PXA3xx_CS2_PHYS,
  65. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [1] = {
  69. .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
  70. .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
  71. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  72. }
  73. };
  74. static struct platform_device asix_device = {
  75. .name = "ax88796",
  76. .id = 0,
  77. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  78. .resource = colibri_asix_resource,
  79. .dev = {
  80. .platform_data = &colibri_asix_platdata
  81. }
  82. };
  83. static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
  84. GPIO1_nCS2, /* AX88796 chip select */
  85. GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  86. };
  87. static void __init colibri_pxa300_init_eth(void)
  88. {
  89. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  90. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
  91. platform_device_register(&asix_device);
  92. }
  93. #else
  94. static inline void __init colibri_pxa300_init_eth(void) {}
  95. #endif /* CONFIG_AX88796 */
  96. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  97. static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
  98. GPIO54_LCD_LDD_0,
  99. GPIO55_LCD_LDD_1,
  100. GPIO56_LCD_LDD_2,
  101. GPIO57_LCD_LDD_3,
  102. GPIO58_LCD_LDD_4,
  103. GPIO59_LCD_LDD_5,
  104. GPIO60_LCD_LDD_6,
  105. GPIO61_LCD_LDD_7,
  106. GPIO62_LCD_LDD_8,
  107. GPIO63_LCD_LDD_9,
  108. GPIO64_LCD_LDD_10,
  109. GPIO65_LCD_LDD_11,
  110. GPIO66_LCD_LDD_12,
  111. GPIO67_LCD_LDD_13,
  112. GPIO68_LCD_LDD_14,
  113. GPIO69_LCD_LDD_15,
  114. GPIO70_LCD_LDD_16,
  115. GPIO71_LCD_LDD_17,
  116. GPIO62_LCD_CS_N,
  117. GPIO72_LCD_FCLK,
  118. GPIO73_LCD_LCLK,
  119. GPIO74_LCD_PCLK,
  120. GPIO75_LCD_BIAS,
  121. GPIO76_LCD_VSYNC,
  122. };
  123. static void __init colibri_pxa300_init_lcd(void)
  124. {
  125. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
  126. }
  127. #else
  128. static inline void colibri_pxa300_init_lcd(void) {}
  129. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  130. #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
  131. static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
  132. GPIO24_AC97_SYSCLK,
  133. GPIO23_AC97_nACRESET,
  134. GPIO25_AC97_SDATA_IN_0,
  135. GPIO27_AC97_SDATA_OUT,
  136. GPIO28_AC97_SYNC,
  137. GPIO29_AC97_BITCLK
  138. };
  139. static inline void __init colibri_pxa310_init_ac97(void)
  140. {
  141. /* no AC97 codec on Colibri PXA300 */
  142. if (!cpu_is_pxa310())
  143. return;
  144. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
  145. pxa_set_ac97_info(NULL);
  146. }
  147. #else
  148. static inline void colibri_pxa310_init_ac97(void) {}
  149. #endif
  150. void __init colibri_pxa300_init(void)
  151. {
  152. colibri_pxa300_init_eth();
  153. colibri_pxa3xx_init_nand();
  154. colibri_pxa300_init_lcd();
  155. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
  156. colibri_pxa310_init_ac97();
  157. /* Evalboard init */
  158. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
  159. colibri_evalboard_init();
  160. }
  161. MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
  162. .atag_offset = 0x100,
  163. .init_machine = colibri_pxa300_init,
  164. .map_io = pxa3xx_map_io,
  165. .nr_irqs = PXA_NR_IRQS,
  166. .init_irq = pxa3xx_init_irq,
  167. .handle_irq = pxa3xx_handle_irq,
  168. .init_time = pxa_timer_init,
  169. .restart = pxa_restart,
  170. MACHINE_END