colibri-pxa320.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 <mach/audio.h>
  28. #include "generic.h"
  29. #include "devices.h"
  30. #if defined(CONFIG_AX88796)
  31. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
  32. /*
  33. * Asix AX88796 Ethernet
  34. */
  35. static struct ax_plat_data colibri_asix_platdata = {
  36. .flags = 0, /* defined later */
  37. .wordlength = 2,
  38. };
  39. static struct resource colibri_asix_resource[] = {
  40. [0] = {
  41. .start = PXA3xx_CS2_PHYS,
  42. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  47. .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  48. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  49. }
  50. };
  51. static struct platform_device asix_device = {
  52. .name = "ax88796",
  53. .id = 0,
  54. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  55. .resource = colibri_asix_resource,
  56. .dev = {
  57. .platform_data = &colibri_asix_platdata
  58. }
  59. };
  60. static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
  61. GPIO3_nCS2, /* AX88796 chip select */
  62. GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  63. };
  64. static void __init colibri_pxa320_init_eth(void)
  65. {
  66. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  67. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
  68. platform_device_register(&asix_device);
  69. }
  70. #else
  71. static inline void __init colibri_pxa320_init_eth(void) {}
  72. #endif /* CONFIG_AX88796 */
  73. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  74. static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
  75. GPIO2_2_USBH_PEN,
  76. GPIO3_2_USBH_PWR,
  77. };
  78. static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
  79. .port_mode = PMM_GLOBAL_MODE,
  80. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  81. };
  82. void __init colibri_pxa320_init_ohci(void)
  83. {
  84. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
  85. pxa_set_ohci_info(&colibri_pxa320_ohci_info);
  86. }
  87. #else
  88. static inline void colibri_pxa320_init_ohci(void) {}
  89. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  90. static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
  91. GPIO22_MMC1_CLK,
  92. GPIO23_MMC1_CMD,
  93. GPIO18_MMC1_DAT0,
  94. GPIO19_MMC1_DAT1,
  95. GPIO20_MMC1_DAT2,
  96. GPIO21_MMC1_DAT3
  97. };
  98. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  99. static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
  100. GPIO6_2_LCD_LDD_0,
  101. GPIO7_2_LCD_LDD_1,
  102. GPIO8_2_LCD_LDD_2,
  103. GPIO9_2_LCD_LDD_3,
  104. GPIO10_2_LCD_LDD_4,
  105. GPIO11_2_LCD_LDD_5,
  106. GPIO12_2_LCD_LDD_6,
  107. GPIO13_2_LCD_LDD_7,
  108. GPIO63_LCD_LDD_8,
  109. GPIO64_LCD_LDD_9,
  110. GPIO65_LCD_LDD_10,
  111. GPIO66_LCD_LDD_11,
  112. GPIO67_LCD_LDD_12,
  113. GPIO68_LCD_LDD_13,
  114. GPIO69_LCD_LDD_14,
  115. GPIO70_LCD_LDD_15,
  116. GPIO71_LCD_LDD_16,
  117. GPIO72_LCD_LDD_17,
  118. GPIO73_LCD_CS_N,
  119. GPIO74_LCD_VSYNC,
  120. GPIO14_2_LCD_FCLK,
  121. GPIO15_2_LCD_LCLK,
  122. GPIO16_2_LCD_PCLK,
  123. GPIO17_2_LCD_BIAS,
  124. };
  125. static void __init colibri_pxa320_init_lcd(void)
  126. {
  127. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
  128. }
  129. #else
  130. static inline void colibri_pxa320_init_lcd(void) {}
  131. #endif
  132. #if defined(CONFIG_SND_AC97_CODEC) || \
  133. defined(CONFIG_SND_AC97_CODEC_MODULE)
  134. static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
  135. GPIO34_AC97_SYSCLK,
  136. GPIO35_AC97_SDATA_IN_0,
  137. GPIO37_AC97_SDATA_OUT,
  138. GPIO38_AC97_SYNC,
  139. GPIO39_AC97_BITCLK,
  140. GPIO40_AC97_nACRESET
  141. };
  142. static inline void __init colibri_pxa320_init_ac97(void)
  143. {
  144. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
  145. pxa_set_ac97_info(NULL);
  146. }
  147. #else
  148. static inline void colibri_pxa320_init_ac97(void) {}
  149. #endif
  150. /*
  151. * The following configuration is verified to work with the Toradex Orchid
  152. * carrier board
  153. */
  154. static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
  155. /* UART 1 configuration (may be set by bootloader) */
  156. GPIO99_UART1_CTS,
  157. GPIO104_UART1_RTS,
  158. GPIO97_UART1_RXD,
  159. GPIO98_UART1_TXD,
  160. GPIO101_UART1_DTR,
  161. GPIO103_UART1_DSR,
  162. GPIO100_UART1_DCD,
  163. GPIO102_UART1_RI,
  164. /* UART 2 configuration */
  165. GPIO109_UART2_CTS,
  166. GPIO112_UART2_RTS,
  167. GPIO110_UART2_RXD,
  168. GPIO111_UART2_TXD,
  169. /* UART 3 configuration */
  170. GPIO30_UART3_RXD,
  171. GPIO31_UART3_TXD,
  172. };
  173. static void __init colibri_pxa320_init_uart(void)
  174. {
  175. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config));
  176. }
  177. void __init colibri_pxa320_init(void)
  178. {
  179. colibri_pxa320_init_eth();
  180. colibri_pxa320_init_ohci();
  181. colibri_pxa3xx_init_nand();
  182. colibri_pxa320_init_lcd();
  183. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
  184. colibri_pxa320_init_ac97();
  185. colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
  186. mfp_to_gpio(MFP_PIN_GPIO28));
  187. colibri_pxa320_init_uart();
  188. }
  189. MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
  190. .phys_io = 0x40000000,
  191. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  192. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  193. .init_machine = colibri_pxa320_init,
  194. .map_io = pxa_map_io,
  195. .init_irq = pxa3xx_init_irq,
  196. .timer = &pxa_timer,
  197. MACHINE_END