platform-mxc-ehci.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_ARCH_MX25
  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_ARCH_MX25 */
  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. struct platform_device *__init imx_add_mxc_ehci(
  32. const struct imx_mxc_ehci_data *data,
  33. const struct mxc_usbh_platform_data *pdata)
  34. {
  35. struct resource res[] = {
  36. {
  37. .start = data->iobase,
  38. .end = data->iobase + SZ_512 - 1,
  39. .flags = IORESOURCE_MEM,
  40. }, {
  41. .start = data->irq,
  42. .end = data->irq,
  43. .flags = IORESOURCE_IRQ,
  44. },
  45. };
  46. return imx_add_platform_device_dmamask("mxc-ehci", data->id,
  47. res, ARRAY_SIZE(res),
  48. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  49. }