platform-imx_udc.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_imx_udc_data_entry_single(soc, _size) \
  12. { \
  13. .iobase = soc ## _USBD_BASE_ADDR, \
  14. .iosize = _size, \
  15. .irq0 = soc ## _INT_USBD0, \
  16. .irq1 = soc ## _INT_USBD1, \
  17. .irq2 = soc ## _INT_USBD2, \
  18. .irq3 = soc ## _INT_USBD3, \
  19. .irq4 = soc ## _INT_USBD4, \
  20. .irq5 = soc ## _INT_USBD5, \
  21. .irq6 = soc ## _INT_USBD6, \
  22. }
  23. #define imx_imx_udc_data_entry(soc, _size) \
  24. [_id] = imx_imx_udc_data_entry_single(soc, _size)
  25. #ifdef CONFIG_SOC_IMX1
  26. const struct imx_imx_udc_data imx1_imx_udc_data __initconst =
  27. imx_imx_udc_data_entry_single(MX1, SZ_4K);
  28. #endif /* ifdef CONFIG_SOC_IMX1 */
  29. struct platform_device *__init imx_add_imx_udc(
  30. const struct imx_imx_udc_data *data,
  31. const struct imxusb_platform_data *pdata)
  32. {
  33. struct resource res[] = {
  34. {
  35. .start = data->iobase,
  36. .end = data->iobase + data->iosize - 1,
  37. .flags = IORESOURCE_MEM,
  38. }, {
  39. .start = data->irq0,
  40. .end = data->irq0,
  41. .flags = IORESOURCE_IRQ,
  42. }, {
  43. .start = data->irq1,
  44. .end = data->irq1,
  45. .flags = IORESOURCE_IRQ,
  46. }, {
  47. .start = data->irq2,
  48. .end = data->irq2,
  49. .flags = IORESOURCE_IRQ,
  50. }, {
  51. .start = data->irq3,
  52. .end = data->irq3,
  53. .flags = IORESOURCE_IRQ,
  54. }, {
  55. .start = data->irq4,
  56. .end = data->irq4,
  57. .flags = IORESOURCE_IRQ,
  58. }, {
  59. .start = data->irq5,
  60. .end = data->irq5,
  61. .flags = IORESOURCE_IRQ,
  62. }, {
  63. .start = data->irq6,
  64. .end = data->irq6,
  65. .flags = IORESOURCE_IRQ,
  66. },
  67. };
  68. return imx_add_platform_device("imx_udc", 0,
  69. res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
  70. }