platform-fsl-usb2-udc.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_fsl_usb2_udc_data_entry_single(soc, _devid) \
  13. { \
  14. .devid = _devid, \
  15. .iobase = soc ## _USB_OTG_BASE_ADDR, \
  16. .irq = soc ## _INT_USB_OTG, \
  17. }
  18. #ifdef CONFIG_SOC_IMX27
  19. const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
  20. imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
  21. #endif /* ifdef CONFIG_SOC_IMX27 */
  22. #ifdef CONFIG_SOC_IMX31
  23. const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
  24. imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
  25. #endif /* ifdef CONFIG_SOC_IMX31 */
  26. #ifdef CONFIG_SOC_IMX35
  27. const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
  28. imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
  29. #endif /* ifdef CONFIG_SOC_IMX35 */
  30. struct platform_device *__init imx_add_fsl_usb2_udc(
  31. const struct imx_fsl_usb2_udc_data *data,
  32. const struct fsl_usb2_platform_data *pdata)
  33. {
  34. struct resource res[] = {
  35. {
  36. .start = data->iobase,
  37. .end = data->iobase + SZ_512 - 1,
  38. .flags = IORESOURCE_MEM,
  39. }, {
  40. .start = data->irq,
  41. .end = data->irq,
  42. .flags = IORESOURCE_IRQ,
  43. },
  44. };
  45. return imx_add_platform_device_dmamask(data->devid, -1,
  46. res, ARRAY_SIZE(res),
  47. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  48. }