colibri-evalboard.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * linux/arch/arm/mach-pxa/colibri-evalboard.c
  3. *
  4. * Support for Toradex Colibri Evaluation Carrier Board
  5. * Daniel Mack <daniel@caiaq.de>
  6. * Marek Vasut <marek.vasut@gmail.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/gpio.h>
  17. #include <asm/mach-types.h>
  18. #include <mach/hardware.h>
  19. #include <asm/mach/arch.h>
  20. #include <linux/i2c.h>
  21. #include <linux/i2c/pxa-i2c.h>
  22. #include <mach/pxa27x.h>
  23. #include <mach/colibri.h>
  24. #include <mach/mmc.h>
  25. #include <mach/ohci.h>
  26. #include <mach/pxa27x-udc.h>
  27. #include "generic.h"
  28. #include "devices.h"
  29. /******************************************************************************
  30. * SD/MMC card controller
  31. ******************************************************************************/
  32. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  33. static struct pxamci_platform_data colibri_mci_platform_data = {
  34. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  35. .gpio_power = -1,
  36. .gpio_card_ro = -1,
  37. .detect_delay_ms = 200,
  38. };
  39. static void __init colibri_mmc_init(void)
  40. {
  41. if (machine_is_colibri()) /* PXA270 Colibri */
  42. colibri_mci_platform_data.gpio_card_detect =
  43. GPIO0_COLIBRI_PXA270_SD_DETECT;
  44. if (machine_is_colibri300()) /* PXA300 Colibri */
  45. colibri_mci_platform_data.gpio_card_detect =
  46. GPIO13_COLIBRI_PXA300_SD_DETECT;
  47. else /* PXA320 Colibri */
  48. colibri_mci_platform_data.gpio_card_detect =
  49. GPIO28_COLIBRI_PXA320_SD_DETECT;
  50. pxa_set_mci_info(&colibri_mci_platform_data);
  51. }
  52. #else
  53. static inline void colibri_mmc_init(void) {}
  54. #endif
  55. /******************************************************************************
  56. * USB Host
  57. ******************************************************************************/
  58. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  59. static int colibri_ohci_init(struct device *dev)
  60. {
  61. UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
  62. return 0;
  63. }
  64. static struct pxaohci_platform_data colibri_ohci_info = {
  65. .port_mode = PMM_PERPORT_MODE,
  66. .flags = ENABLE_PORT1 |
  67. POWER_CONTROL_LOW | POWER_SENSE_LOW,
  68. .init = colibri_ohci_init,
  69. };
  70. static void __init colibri_uhc_init(void)
  71. {
  72. /* Colibri PXA270 has two usb ports, TBA for 320 */
  73. if (machine_is_colibri())
  74. colibri_ohci_info.flags |= ENABLE_PORT2;
  75. pxa_set_ohci_info(&colibri_ohci_info);
  76. }
  77. #else
  78. static inline void colibri_uhc_init(void) {}
  79. #endif
  80. /******************************************************************************
  81. * I2C RTC
  82. ******************************************************************************/
  83. #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
  84. static struct i2c_board_info __initdata colibri_i2c_devs[] = {
  85. {
  86. I2C_BOARD_INFO("m41t00", 0x68),
  87. },
  88. };
  89. static void __init colibri_rtc_init(void)
  90. {
  91. pxa_set_i2c_info(NULL);
  92. i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
  93. }
  94. #else
  95. static inline void colibri_rtc_init(void) {}
  96. #endif
  97. void __init colibri_evalboard_init(void)
  98. {
  99. pxa_set_ffuart_info(NULL);
  100. pxa_set_btuart_info(NULL);
  101. pxa_set_stuart_info(NULL);
  102. colibri_mmc_init();
  103. colibri_uhc_init();
  104. colibri_rtc_init();
  105. }