colibri-pxa300.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 "generic.h"
  27. #include "devices.h"
  28. #if defined(CONFIG_AX88796)
  29. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
  30. /*
  31. * Asix AX88796 Ethernet
  32. */
  33. static struct ax_plat_data colibri_asix_platdata = {
  34. .flags = 0, /* defined later */
  35. .wordlength = 2,
  36. };
  37. static struct resource colibri_asix_resource[] = {
  38. [0] = {
  39. .start = PXA3xx_CS2_PHYS,
  40. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  45. .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  46. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  47. }
  48. };
  49. static struct platform_device asix_device = {
  50. .name = "ax88796",
  51. .id = 0,
  52. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  53. .resource = colibri_asix_resource,
  54. .dev = {
  55. .platform_data = &colibri_asix_platdata
  56. }
  57. };
  58. static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
  59. GPIO1_nCS2, /* AX88796 chip select */
  60. GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  61. };
  62. static void __init colibri_pxa300_init_eth(void)
  63. {
  64. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  65. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
  66. platform_device_register(&asix_device);
  67. }
  68. #else
  69. static inline void __init colibri_pxa300_init_eth(void) {}
  70. #endif /* CONFIG_AX88796 */
  71. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  72. static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
  73. GPIO0_2_USBH_PEN,
  74. GPIO1_2_USBH_PWR,
  75. };
  76. static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
  77. .port_mode = PMM_GLOBAL_MODE,
  78. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  79. };
  80. void __init colibri_pxa300_init_ohci(void)
  81. {
  82. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
  83. pxa_set_ohci_info(&colibri_pxa300_ohci_info);
  84. }
  85. #else
  86. static inline void colibri_pxa300_init_ohci(void) {}
  87. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  88. static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
  89. GPIO7_MMC1_CLK,
  90. GPIO14_MMC1_CMD,
  91. GPIO3_MMC1_DAT0,
  92. GPIO4_MMC1_DAT1,
  93. GPIO5_MMC1_DAT2,
  94. GPIO6_MMC1_DAT3,
  95. };
  96. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  97. static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
  98. GPIO54_LCD_LDD_0,
  99. GPIO55_LCD_LDD_1,
  100. GPIO56_LCD_LDD_2,
  101. GPIO57_LCD_LDD_3,
  102. GPIO58_LCD_LDD_4,
  103. GPIO59_LCD_LDD_5,
  104. GPIO60_LCD_LDD_6,
  105. GPIO61_LCD_LDD_7,
  106. GPIO62_LCD_LDD_8,
  107. GPIO63_LCD_LDD_9,
  108. GPIO64_LCD_LDD_10,
  109. GPIO65_LCD_LDD_11,
  110. GPIO66_LCD_LDD_12,
  111. GPIO67_LCD_LDD_13,
  112. GPIO68_LCD_LDD_14,
  113. GPIO69_LCD_LDD_15,
  114. GPIO70_LCD_LDD_16,
  115. GPIO71_LCD_LDD_17,
  116. GPIO62_LCD_CS_N,
  117. GPIO72_LCD_FCLK,
  118. GPIO73_LCD_LCLK,
  119. GPIO74_LCD_PCLK,
  120. GPIO75_LCD_BIAS,
  121. GPIO76_LCD_VSYNC,
  122. };
  123. static void __init colibri_pxa300_init_lcd(void)
  124. {
  125. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
  126. }
  127. #else
  128. static inline void colibri_pxa300_init_lcd(void) {}
  129. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  130. #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
  131. static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
  132. GPIO24_AC97_SYSCLK,
  133. GPIO23_AC97_nACRESET,
  134. GPIO25_AC97_SDATA_IN_0,
  135. GPIO27_AC97_SDATA_OUT,
  136. GPIO28_AC97_SYNC,
  137. GPIO29_AC97_BITCLK
  138. };
  139. static inline void __init colibri_pxa310_init_ac97(void)
  140. {
  141. /* no AC97 codec on Colibri PXA300 */
  142. if (!cpu_is_pxa310())
  143. return;
  144. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
  145. pxa_set_ac97_info(NULL);
  146. }
  147. #else
  148. static inline void colibri_pxa310_init_ac97(void) {}
  149. #endif
  150. void __init colibri_pxa300_init(void)
  151. {
  152. colibri_pxa300_init_eth();
  153. colibri_pxa300_init_ohci();
  154. colibri_pxa3xx_init_nand();
  155. colibri_pxa300_init_lcd();
  156. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
  157. colibri_pxa310_init_ac97();
  158. colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
  159. mfp_to_gpio(MFP_PIN_GPIO13));
  160. }
  161. MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
  162. .phys_io = 0x40000000,
  163. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  164. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  165. .init_machine = colibri_pxa300_init,
  166. .map_io = pxa_map_io,
  167. .init_irq = pxa3xx_init_irq,
  168. .timer = &pxa_timer,
  169. MACHINE_END