colibri-pxa300.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. #if defined(CONFIG_AX88796)
  30. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_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_pxa300_eth_pin_config[] __initdata = {
  60. GPIO1_nCS2, /* AX88796 chip select */
  61. GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  62. };
  63. static void __init colibri_pxa300_init_eth(void)
  64. {
  65. colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  66. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
  67. platform_device_register(&asix_device);
  68. }
  69. #else
  70. static inline void __init colibri_pxa300_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_pxa300_usb_pin_config[] __initdata = {
  74. GPIO0_2_USBH_PEN,
  75. GPIO1_2_USBH_PWR,
  76. };
  77. static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
  78. .port_mode = PMM_GLOBAL_MODE,
  79. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  80. };
  81. void __init colibri_pxa300_init_ohci(void)
  82. {
  83. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
  84. pxa_set_ohci_info(&colibri_pxa300_ohci_info);
  85. }
  86. #else
  87. static inline void colibri_pxa300_init_ohci(void) {}
  88. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  89. static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
  90. GPIO7_MMC1_CLK,
  91. GPIO14_MMC1_CMD,
  92. GPIO3_MMC1_DAT0,
  93. GPIO4_MMC1_DAT1,
  94. GPIO5_MMC1_DAT2,
  95. GPIO6_MMC1_DAT3,
  96. };
  97. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  98. static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
  99. GPIO54_LCD_LDD_0,
  100. GPIO55_LCD_LDD_1,
  101. GPIO56_LCD_LDD_2,
  102. GPIO57_LCD_LDD_3,
  103. GPIO58_LCD_LDD_4,
  104. GPIO59_LCD_LDD_5,
  105. GPIO60_LCD_LDD_6,
  106. GPIO61_LCD_LDD_7,
  107. GPIO62_LCD_LDD_8,
  108. GPIO63_LCD_LDD_9,
  109. GPIO64_LCD_LDD_10,
  110. GPIO65_LCD_LDD_11,
  111. GPIO66_LCD_LDD_12,
  112. GPIO67_LCD_LDD_13,
  113. GPIO68_LCD_LDD_14,
  114. GPIO69_LCD_LDD_15,
  115. GPIO70_LCD_LDD_16,
  116. GPIO71_LCD_LDD_17,
  117. GPIO62_LCD_CS_N,
  118. GPIO72_LCD_FCLK,
  119. GPIO73_LCD_LCLK,
  120. GPIO74_LCD_PCLK,
  121. GPIO75_LCD_BIAS,
  122. GPIO76_LCD_VSYNC,
  123. };
  124. static void __init colibri_pxa300_init_lcd(void)
  125. {
  126. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
  127. }
  128. #else
  129. static inline void colibri_pxa300_init_lcd(void) {}
  130. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  131. #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
  132. static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
  133. GPIO24_AC97_SYSCLK,
  134. GPIO23_AC97_nACRESET,
  135. GPIO25_AC97_SDATA_IN_0,
  136. GPIO27_AC97_SDATA_OUT,
  137. GPIO28_AC97_SYNC,
  138. GPIO29_AC97_BITCLK
  139. };
  140. static inline void __init colibri_pxa310_init_ac97(void)
  141. {
  142. /* no AC97 codec on Colibri PXA300 */
  143. if (!cpu_is_pxa310())
  144. return;
  145. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
  146. pxa_set_ac97_info(NULL);
  147. }
  148. #else
  149. static inline void colibri_pxa310_init_ac97(void) {}
  150. #endif
  151. void __init colibri_pxa300_init(void)
  152. {
  153. pxa_set_ffuart_info(NULL);
  154. pxa_set_btuart_info(NULL);
  155. pxa_set_stuart_info(NULL);
  156. colibri_pxa300_init_eth();
  157. colibri_pxa300_init_ohci();
  158. colibri_pxa3xx_init_nand();
  159. colibri_pxa300_init_lcd();
  160. colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
  161. colibri_pxa310_init_ac97();
  162. colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
  163. mfp_to_gpio(MFP_PIN_GPIO13));
  164. }
  165. MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
  166. .phys_io = 0x40000000,
  167. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  168. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  169. .init_machine = colibri_pxa300_init,
  170. .map_io = pxa_map_io,
  171. .init_irq = pxa3xx_init_irq,
  172. .timer = &pxa_timer,
  173. MACHINE_END