platform-fec.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <asm/sizes.h>
  11. #include "../hardware.h"
  12. #include "devices-common.h"
  13. #define imx_fec_data_entry_single(soc, _devid) \
  14. { \
  15. .devid = _devid, \
  16. .iobase = soc ## _FEC_BASE_ADDR, \
  17. .irq = soc ## _INT_FEC, \
  18. }
  19. #ifdef CONFIG_SOC_IMX25
  20. const struct imx_fec_data imx25_fec_data __initconst =
  21. imx_fec_data_entry_single(MX25, "imx25-fec");
  22. #endif /* ifdef CONFIG_SOC_IMX25 */
  23. #ifdef CONFIG_SOC_IMX27
  24. const struct imx_fec_data imx27_fec_data __initconst =
  25. imx_fec_data_entry_single(MX27, "imx27-fec");
  26. #endif /* ifdef CONFIG_SOC_IMX27 */
  27. #ifdef CONFIG_SOC_IMX35
  28. /* i.mx35 has the i.mx27 type fec */
  29. const struct imx_fec_data imx35_fec_data __initconst =
  30. imx_fec_data_entry_single(MX35, "imx27-fec");
  31. #endif
  32. struct platform_device *__init imx_add_fec(
  33. const struct imx_fec_data *data,
  34. const struct fec_platform_data *pdata)
  35. {
  36. struct resource res[] = {
  37. {
  38. .start = data->iobase,
  39. .end = data->iobase + SZ_4K - 1,
  40. .flags = IORESOURCE_MEM,
  41. }, {
  42. .start = data->irq,
  43. .end = data->irq,
  44. .flags = IORESOURCE_IRQ,
  45. },
  46. };
  47. return imx_add_platform_device_dmamask(data->devid, 0,
  48. res, ARRAY_SIZE(res),
  49. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  50. }