colibri-pxa300.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 <mach/pxa300.h>
  23. #include <mach/colibri.h>
  24. #include <mach/ohci.h>
  25. #include <mach/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. GPIO39_GPIO, /* SD detect */
  39. /* UHC */
  40. GPIO0_2_USBH_PEN,
  41. GPIO1_2_USBH_PWR,
  42. /* I2C */
  43. GPIO21_I2C_SCL,
  44. GPIO22_I2C_SDA,
  45. };
  46. #else
  47. static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
  48. #endif
  49. #if defined(CONFIG_AX88796)
  50. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
  51. /*
  52. * Asix AX88796 Ethernet
  53. */
  54. static struct ax_plat_data colibri_asix_platdata = {
  55. .flags = 0, /* defined later */
  56. .wordlength = 2,
  57. };
  58. static struct resource colibri_asix_resource[] = {
  59. [0] = {
  60. .start = PXA3xx_CS2_PHYS,
  61. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  62. .flags = IORESOURCE_MEM,
  63. },
  64. [1] = {
  65. .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  66. .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  67. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  68. }
  69. };
  70. static struct platform_device asix_device = {
  71. .name = "ax88796",
  72. .id = 0,
  73. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  74. .resource = colibri_asix_resource,
  75. .dev = {
  76. .platform_data = &colibri_asix_platdata
  77. }
  78. };
  79. static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
  80. GPIO1_nCS2, /* AX88796 chip select */
  81. GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  82. };
  83. static void __init colibri_pxa300_init_eth(void)
  84. {
  85. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  86. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
  87. platform_device_register(&asix_device);
  88. }
  89. #else
  90. static inline void __init colibri_pxa300_init_eth(void) {}
  91. #endif /* CONFIG_AX88796 */
  92. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  93. static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
  94. GPIO54_LCD_LDD_0,
  95. GPIO55_LCD_LDD_1,
  96. GPIO56_LCD_LDD_2,
  97. GPIO57_LCD_LDD_3,
  98. GPIO58_LCD_LDD_4,
  99. GPIO59_LCD_LDD_5,
  100. GPIO60_LCD_LDD_6,
  101. GPIO61_LCD_LDD_7,
  102. GPIO62_LCD_LDD_8,
  103. GPIO63_LCD_LDD_9,
  104. GPIO64_LCD_LDD_10,
  105. GPIO65_LCD_LDD_11,
  106. GPIO66_LCD_LDD_12,
  107. GPIO67_LCD_LDD_13,
  108. GPIO68_LCD_LDD_14,
  109. GPIO69_LCD_LDD_15,
  110. GPIO70_LCD_LDD_16,
  111. GPIO71_LCD_LDD_17,
  112. GPIO62_LCD_CS_N,
  113. GPIO72_LCD_FCLK,
  114. GPIO73_LCD_LCLK,
  115. GPIO74_LCD_PCLK,
  116. GPIO75_LCD_BIAS,
  117. GPIO76_LCD_VSYNC,
  118. };
  119. static void __init colibri_pxa300_init_lcd(void)
  120. {
  121. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
  122. }
  123. #else
  124. static inline void colibri_pxa300_init_lcd(void) {}
  125. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  126. #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
  127. static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
  128. GPIO24_AC97_SYSCLK,
  129. GPIO23_AC97_nACRESET,
  130. GPIO25_AC97_SDATA_IN_0,
  131. GPIO27_AC97_SDATA_OUT,
  132. GPIO28_AC97_SYNC,
  133. GPIO29_AC97_BITCLK
  134. };
  135. static inline void __init colibri_pxa310_init_ac97(void)
  136. {
  137. /* no AC97 codec on Colibri PXA300 */
  138. if (!cpu_is_pxa310())
  139. return;
  140. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
  141. pxa_set_ac97_info(NULL);
  142. }
  143. #else
  144. static inline void colibri_pxa310_init_ac97(void) {}
  145. #endif
  146. void __init colibri_pxa300_init(void)
  147. {
  148. colibri_pxa300_init_eth();
  149. colibri_pxa3xx_init_nand();
  150. colibri_pxa300_init_lcd();
  151. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
  152. colibri_pxa310_init_ac97();
  153. /* Evalboard init */
  154. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
  155. colibri_evalboard_init();
  156. }
  157. MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
  158. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  159. .init_machine = colibri_pxa300_init,
  160. .map_io = pxa3xx_map_io,
  161. .init_irq = pxa3xx_init_irq,
  162. .timer = &pxa_timer,
  163. MACHINE_END