platform-mxc-ehci.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "../hardware.h"
  11. #include "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_IMX27
  19. const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  20. imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
  21. const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
  22. imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
  23. imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
  24. };
  25. #endif /* ifdef CONFIG_SOC_IMX27 */
  26. #ifdef CONFIG_SOC_IMX31
  27. const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
  28. imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
  29. const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
  30. imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
  31. imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
  32. };
  33. #endif /* ifdef CONFIG_SOC_IMX31 */
  34. #ifdef CONFIG_SOC_IMX35
  35. const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
  36. imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
  37. const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
  38. imx_mxc_ehci_data_entry_single(MX35, 1, HS);
  39. #endif /* ifdef CONFIG_SOC_IMX35 */
  40. struct platform_device *__init imx_add_mxc_ehci(
  41. const struct imx_mxc_ehci_data *data,
  42. const struct mxc_usbh_platform_data *pdata)
  43. {
  44. struct resource res[] = {
  45. {
  46. .start = data->iobase,
  47. .end = data->iobase + SZ_512 - 1,
  48. .flags = IORESOURCE_MEM,
  49. }, {
  50. .start = data->irq,
  51. .end = data->irq,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. return imx_add_platform_device_dmamask("mxc-ehci", data->id,
  56. res, ARRAY_SIZE(res),
  57. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  58. }