platform-fec.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifdef CONFIG_SOC_IMX51
  33. /* i.mx51 has the i.mx27 type fec */
  34. const struct imx_fec_data imx51_fec_data __initconst =
  35. imx_fec_data_entry_single(MX51, "imx27-fec");
  36. #endif
  37. #ifdef CONFIG_SOC_IMX53
  38. /* i.mx53 has the i.mx25 type fec */
  39. const struct imx_fec_data imx53_fec_data __initconst =
  40. imx_fec_data_entry_single(MX53, "imx25-fec");
  41. #endif
  42. struct platform_device *__init imx_add_fec(
  43. const struct imx_fec_data *data,
  44. const struct fec_platform_data *pdata)
  45. {
  46. struct resource res[] = {
  47. {
  48. .start = data->iobase,
  49. .end = data->iobase + SZ_4K - 1,
  50. .flags = IORESOURCE_MEM,
  51. }, {
  52. .start = data->irq,
  53. .end = data->irq,
  54. .flags = IORESOURCE_IRQ,
  55. },
  56. };
  57. return imx_add_platform_device_dmamask(data->devid, 0,
  58. res, ARRAY_SIZE(res),
  59. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  60. }