platform-fec.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_IMX27
  20. const struct imx_fec_data imx27_fec_data __initconst =
  21. imx_fec_data_entry_single(MX27, "imx27-fec");
  22. #endif /* ifdef CONFIG_SOC_IMX27 */
  23. #ifdef CONFIG_SOC_IMX35
  24. /* i.mx35 has the i.mx27 type fec */
  25. const struct imx_fec_data imx35_fec_data __initconst =
  26. imx_fec_data_entry_single(MX35, "imx27-fec");
  27. #endif
  28. struct platform_device *__init imx_add_fec(
  29. const struct imx_fec_data *data,
  30. const struct fec_platform_data *pdata)
  31. {
  32. struct resource res[] = {
  33. {
  34. .start = data->iobase,
  35. .end = data->iobase + SZ_4K - 1,
  36. .flags = IORESOURCE_MEM,
  37. }, {
  38. .start = data->irq,
  39. .end = data->irq,
  40. .flags = IORESOURCE_IRQ,
  41. },
  42. };
  43. return imx_add_platform_device_dmamask(data->devid, 0,
  44. res, ARRAY_SIZE(res),
  45. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  46. }