platform-mxc-ehci.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU General Public License version 2 as published by the
  7. * Free Software Foundation.
  8. */
  9. #include <linux/dma-mapping.h>
  10. #include <mach/hardware.h>
  11. #include <mach/devices-common.h>
  12. #define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
  13. { \
  14. .id = _id, \
  15. .iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \
  16. .irq = soc ## _INT_USB_ ## hs, \
  17. }
  18. #ifdef CONFIG_SOC_IMX25
  19. const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
  20. imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
  21. const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
  22. imx_mxc_ehci_data_entry_single(MX25, 1, HS);
  23. #endif /* ifdef CONFIG_SOC_IMX25 */
  24. #ifdef CONFIG_SOC_IMX27
  25. const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  26. imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
  27. const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
  28. imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
  29. imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
  30. };
  31. #endif /* ifdef CONFIG_SOC_IMX27 */
  32. #ifdef CONFIG_SOC_IMX31
  33. const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
  34. imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
  35. const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
  36. imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
  37. imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
  38. };
  39. #endif /* ifdef CONFIG_SOC_IMX31 */
  40. #ifdef CONFIG_SOC_IMX35
  41. const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
  42. imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
  43. const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
  44. imx_mxc_ehci_data_entry_single(MX35, 1, HS);
  45. #endif /* ifdef CONFIG_SOC_IMX35 */
  46. #ifdef CONFIG_SOC_IMX51
  47. const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst =
  48. imx_mxc_ehci_data_entry_single(MX51, 0, OTG);
  49. const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[] __initconst = {
  50. imx_mxc_ehci_data_entry_single(MX51, 1, HS1),
  51. imx_mxc_ehci_data_entry_single(MX51, 2, HS2),
  52. };
  53. #endif /* ifdef CONFIG_SOC_IMX51 */
  54. struct platform_device *__init imx_add_mxc_ehci(
  55. const struct imx_mxc_ehci_data *data,
  56. const struct mxc_usbh_platform_data *pdata)
  57. {
  58. struct resource res[] = {
  59. {
  60. .start = data->iobase,
  61. .end = data->iobase + SZ_512 - 1,
  62. .flags = IORESOURCE_MEM,
  63. }, {
  64. .start = data->irq,
  65. .end = data->irq,
  66. .flags = IORESOURCE_IRQ,
  67. },
  68. };
  69. return imx_add_platform_device_dmamask("mxc-ehci", data->id,
  70. res, ARRAY_SIZE(res),
  71. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  72. }