colibri-pxa300.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 <net/ax88796.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 "generic.h"
  26. #include "devices.h"
  27. #if defined(CONFIG_AX88796)
  28. #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
  29. /*
  30. * Asix AX88796 Ethernet
  31. */
  32. static struct ax_plat_data colibri_asix_platdata = {
  33. .flags = AXFLG_MAC_FROMDEV,
  34. .wordlength = 2
  35. };
  36. static struct resource colibri_asix_resource[] = {
  37. [0] = {
  38. .start = PXA3xx_CS2_PHYS,
  39. .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  40. .flags = IORESOURCE_MEM,
  41. },
  42. [1] = {
  43. .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  44. .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  45. .flags = IORESOURCE_IRQ
  46. }
  47. };
  48. static struct platform_device asix_device = {
  49. .name = "ax88796",
  50. .id = 0,
  51. .num_resources = ARRAY_SIZE(colibri_asix_resource),
  52. .resource = colibri_asix_resource,
  53. .dev = {
  54. .platform_data = &colibri_asix_platdata
  55. }
  56. };
  57. static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
  58. GPIO1_nCS2, /* AX88796 chip select */
  59. GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
  60. };
  61. static void __init colibri_pxa300_init_eth(void)
  62. {
  63. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
  64. set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
  65. platform_device_register(&asix_device);
  66. }
  67. #else
  68. static inline void __init colibri_pxa300_init_eth(void) {}
  69. #endif /* CONFIG_AX88796 */
  70. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  71. static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
  72. GPIO0_2_USBH_PEN,
  73. GPIO1_2_USBH_PWR,
  74. };
  75. static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
  76. .port_mode = PMM_GLOBAL_MODE,
  77. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  78. };
  79. void __init colibri_pxa300_init_ohci(void)
  80. {
  81. pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
  82. pxa_set_ohci_info(&colibri_pxa300_ohci_info);
  83. }
  84. #else
  85. static inline void colibri_pxa300_init_ohci(void) {}
  86. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  87. static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
  88. GPIO7_MMC1_CLK,
  89. GPIO14_MMC1_CMD,
  90. GPIO3_MMC1_DAT0,
  91. GPIO4_MMC1_DAT1,
  92. GPIO5_MMC1_DAT2,
  93. GPIO6_MMC1_DAT3,
  94. };
  95. void __init colibri_pxa300_init(void)
  96. {
  97. colibri_pxa300_init_eth();
  98. colibri_pxa300_init_ohci();
  99. colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
  100. mfp_to_gpio(MFP_PIN_GPIO13));
  101. }
  102. MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
  103. .phys_io = 0x40000000,
  104. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  105. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  106. .init_machine = colibri_pxa300_init,
  107. .map_io = pxa_map_io,
  108. .init_irq = pxa3xx_init_irq,
  109. .timer = &pxa_timer,
  110. MACHINE_END