platform-mxc-ehci.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_IMX27
  18. const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  19. imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
  20. const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
  21. imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
  22. imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
  23. };
  24. #endif /* ifdef CONFIG_SOC_IMX27 */
  25. struct platform_device *__init imx_add_mxc_ehci(
  26. const struct imx_mxc_ehci_data *data,
  27. const struct mxc_usbh_platform_data *pdata)
  28. {
  29. struct resource res[] = {
  30. {
  31. .start = data->iobase,
  32. .end = data->iobase + SZ_512 - 1,
  33. .flags = IORESOURCE_MEM,
  34. }, {
  35. .start = data->irq,
  36. .end = data->irq,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. return imx_add_platform_device_dmamask("mxc-ehci", data->id,
  41. res, ARRAY_SIZE(res),
  42. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  43. }