colibri-pxa320.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * arch/arm/mach-pxa/colibri-pxa320.c
  3. *
  4. * Support for Toradex PXA320/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/pxa3xx-regs.h>
  23. #include <mach/mfp-pxa320.h>
  24. #include <mach/colibri.h>
  25. #include <mach/pxafb.h>
  26. #include <mach/ohci.h>
  27. #include "generic.h"
  28. #include "devices.h"
  29. #if defined(CONFIG_AX88796)
  30. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
  31. /*
  32. * Asix AX88796 Ethernet
  33. */
  34. static struct ax_plat_data colibri_asix_platdata = {
  35. .flags = 0, /* defined later */
  36. .wordlength = 2,
  37. };
  38. static struct resource colibri_asix_resource[] = {
  39. [0] = {
  40. .start = PXA3xx_CS2_PHYS,
  41. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  46. .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  47. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  48. }
  49. };
  50. static struct platform_device asix_device = {
  51. .name = "ax88796",
  52. .id = 0,
  53. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  54. .resource = colibri_asix_resource,
  55. .dev = {
  56. .platform_data = &colibri_asix_platdata
  57. }
  58. };
  59. static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
  60. GPIO3_nCS2, /* AX88796 chip select */
  61. GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  62. };
  63. static void __init colibri_pxa320_init_eth(void)
  64. {
  65. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  66. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
  67. platform_device_register(&asix_device);
  68. }
  69. #else
  70. static inline void __init colibri_pxa320_init_eth(void) {}
  71. #endif /* CONFIG_AX88796 */
  72. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  73. static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
  74. GPIO2_2_USBH_PEN,
  75. GPIO3_2_USBH_PWR,
  76. };
  77. static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
  78. .port_mode = PMM_GLOBAL_MODE,
  79. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  80. };
  81. void __init colibri_pxa320_init_ohci(void)
  82. {
  83. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
  84. pxa_set_ohci_info(&colibri_pxa320_ohci_info);
  85. }
  86. #else
  87. static inline void colibri_pxa320_init_ohci(void) {}
  88. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  89. static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
  90. GPIO22_MMC1_CLK,
  91. GPIO23_MMC1_CMD,
  92. GPIO18_MMC1_DAT0,
  93. GPIO19_MMC1_DAT1,
  94. GPIO20_MMC1_DAT2,
  95. GPIO21_MMC1_DAT3
  96. };
  97. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  98. static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
  99. GPIO6_2_LCD_LDD_0,
  100. GPIO7_2_LCD_LDD_1,
  101. GPIO8_2_LCD_LDD_2,
  102. GPIO9_2_LCD_LDD_3,
  103. GPIO10_2_LCD_LDD_4,
  104. GPIO11_2_LCD_LDD_5,
  105. GPIO12_2_LCD_LDD_6,
  106. GPIO13_2_LCD_LDD_7,
  107. GPIO63_LCD_LDD_8,
  108. GPIO64_LCD_LDD_9,
  109. GPIO65_LCD_LDD_10,
  110. GPIO66_LCD_LDD_11,
  111. GPIO67_LCD_LDD_12,
  112. GPIO68_LCD_LDD_13,
  113. GPIO69_LCD_LDD_14,
  114. GPIO70_LCD_LDD_15,
  115. GPIO71_LCD_LDD_16,
  116. GPIO72_LCD_LDD_17,
  117. GPIO73_LCD_CS_N,
  118. GPIO74_LCD_VSYNC,
  119. GPIO14_2_LCD_FCLK,
  120. GPIO15_2_LCD_LCLK,
  121. GPIO16_2_LCD_PCLK,
  122. GPIO17_2_LCD_BIAS,
  123. };
  124. static void __init colibri_pxa320_init_lcd(void)
  125. {
  126. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
  127. }
  128. #else
  129. static inline void colibri_pxa320_init_lcd(void) {}
  130. #endif
  131. #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
  132. static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
  133. GPIO34_AC97_SYSCLK,
  134. GPIO35_AC97_SDATA_IN_0,
  135. GPIO37_AC97_SDATA_OUT,
  136. GPIO38_AC97_SYNC,
  137. GPIO39_AC97_BITCLK,
  138. GPIO40_AC97_nACRESET
  139. };
  140. static inline void __init colibri_pxa320_init_ac97(void)
  141. {
  142. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
  143. pxa_set_ac97_info(NULL);
  144. }
  145. #else
  146. static inline void colibri_pxa320_init_ac97(void) {}
  147. #endif
  148. void __init colibri_pxa320_init(void)
  149. {
  150. colibri_pxa320_init_eth();
  151. colibri_pxa320_init_ohci();
  152. colibri_pxa320_init_lcd();
  153. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
  154. colibri_pxa320_init_ac97();
  155. colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
  156. mfp_to_gpio(MFP_PIN_GPIO28));
  157. }
  158. MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
  159. .phys_io = 0x40000000,
  160. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  161. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  162. .init_machine = colibri_pxa320_init,
  163. .map_io = pxa_map_io,
  164. .init_irq = pxa3xx_init_irq,
  165. .timer = &pxa_timer,
  166. MACHINE_END