colibri-pxa300.c 4.3 KB

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