colibri-pxa300.c 4.6 KB

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