platform-mxc-ehci.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 <mach/hardware.h>
  10. #include <mach/devices-common.h>
  11. #define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
  12. { \
  13. .id = _id, \
  14. .iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \
  15. .irq = soc ## _INT_USB_ ## hs, \
  16. }
  17. #ifdef CONFIG_SOC_IMX25
  18. const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
  19. imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
  20. const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
  21. imx_mxc_ehci_data_entry_single(MX25, 1, HS);
  22. #endif /* ifdef CONFIG_SOC_IMX25 */
  23. #ifdef CONFIG_SOC_IMX27
  24. const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  25. imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
  26. const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
  27. imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
  28. imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
  29. };
  30. #endif /* ifdef CONFIG_SOC_IMX27 */
  31. #ifdef CONFIG_SOC_IMX31
  32. const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
  33. imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
  34. const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
  35. imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
  36. imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
  37. };
  38. #endif /* ifdef CONFIG_SOC_IMX31 */
  39. #ifdef CONFIG_SOC_IMX35
  40. const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
  41. imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
  42. const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
  43. imx_mxc_ehci_data_entry_single(MX35, 1, HS);
  44. #endif /* ifdef CONFIG_SOC_IMX35 */
  45. struct platform_device *__init imx_add_mxc_ehci(
  46. const struct imx_mxc_ehci_data *data,
  47. const struct mxc_usbh_platform_data *pdata)
  48. {
  49. struct resource res[] = {
  50. {
  51. .start = data->iobase,
  52. .end = data->iobase + SZ_512 - 1,
  53. .flags = IORESOURCE_MEM,
  54. }, {
  55. .start = data->irq,
  56. .end = data->irq,
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. return imx_add_platform_device_dmamask("mxc-ehci", data->id,
  61. res, ARRAY_SIZE(res),
  62. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  63. }