colibri-evalboard.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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/platform_data/i2c-pxa.h>
  22. #include <asm/io.h>
  23. #include "pxa27x.h"
  24. #include "colibri.h"
  25. #include <linux/platform_data/mmc-pxamci.h>
  26. #include <linux/platform_data/usb-ohci-pxa27x.h>
  27. #include "pxa27x-udc.h"
  28. #include "generic.h"
  29. #include "devices.h"
  30. /******************************************************************************
  31. * SD/MMC card controller
  32. ******************************************************************************/
  33. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  34. static struct pxamci_platform_data colibri_mci_platform_data = {
  35. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  36. .gpio_power = -1,
  37. .gpio_card_ro = -1,
  38. .detect_delay_ms = 200,
  39. };
  40. static void __init colibri_mmc_init(void)
  41. {
  42. if (machine_is_colibri()) /* PXA270 Colibri */
  43. colibri_mci_platform_data.gpio_card_detect =
  44. GPIO0_COLIBRI_PXA270_SD_DETECT;
  45. if (machine_is_colibri300()) /* PXA300 Colibri */
  46. colibri_mci_platform_data.gpio_card_detect =
  47. GPIO13_COLIBRI_PXA300_SD_DETECT;
  48. else /* PXA320 Colibri */
  49. colibri_mci_platform_data.gpio_card_detect =
  50. GPIO28_COLIBRI_PXA320_SD_DETECT;
  51. pxa_set_mci_info(&colibri_mci_platform_data);
  52. }
  53. #else
  54. static inline void colibri_mmc_init(void) {}
  55. #endif
  56. /******************************************************************************
  57. * USB Host
  58. ******************************************************************************/
  59. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  60. static int colibri_ohci_init(struct device *dev)
  61. {
  62. UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
  63. return 0;
  64. }
  65. static struct pxaohci_platform_data colibri_ohci_info = {
  66. .port_mode = PMM_PERPORT_MODE,
  67. .flags = ENABLE_PORT1 |
  68. POWER_CONTROL_LOW | POWER_SENSE_LOW,
  69. .init = colibri_ohci_init,
  70. };
  71. static void __init colibri_uhc_init(void)
  72. {
  73. /* Colibri PXA270 has two usb ports, TBA for 320 */
  74. if (machine_is_colibri())
  75. colibri_ohci_info.flags |= ENABLE_PORT2;
  76. pxa_set_ohci_info(&colibri_ohci_info);
  77. }
  78. #else
  79. static inline void colibri_uhc_init(void) {}
  80. #endif
  81. /******************************************************************************
  82. * I2C RTC
  83. ******************************************************************************/
  84. #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
  85. static struct i2c_board_info __initdata colibri_i2c_devs[] = {
  86. {
  87. I2C_BOARD_INFO("m41t00", 0x68),
  88. },
  89. };
  90. static void __init colibri_rtc_init(void)
  91. {
  92. pxa_set_i2c_info(NULL);
  93. i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
  94. }
  95. #else
  96. static inline void colibri_rtc_init(void) {}
  97. #endif
  98. void __init colibri_evalboard_init(void)
  99. {
  100. pxa_set_ffuart_info(NULL);
  101. pxa_set_btuart_info(NULL);
  102. pxa_set_stuart_info(NULL);
  103. colibri_mmc_init();
  104. colibri_uhc_init();
  105. colibri_rtc_init();
  106. }