platform-fec.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <asm/sizes.h>
  10. #include <mach/mx28.h>
  11. #include <mach/devices-common.h>
  12. #define mxs_fec_data_entry_single(soc, _id) \
  13. { \
  14. .id = _id, \
  15. .iobase = soc ## _ENET_MAC ## _id ## _BASE_ADDR, \
  16. .irq = soc ## _INT_ENET_MAC ## _id, \
  17. }
  18. #define mxs_fec_data_entry(soc, _id) \
  19. [_id] = mxs_fec_data_entry_single(soc, _id)
  20. #ifdef CONFIG_SOC_IMX28
  21. const struct mxs_fec_data mx28_fec_data[] __initconst = {
  22. #define mx28_fec_data_entry(_id) \
  23. mxs_fec_data_entry(MX28, _id)
  24. mx28_fec_data_entry(0),
  25. mx28_fec_data_entry(1),
  26. };
  27. #endif
  28. struct platform_device *__init mxs_add_fec(
  29. const struct mxs_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_16K - 1,
  36. .flags = IORESOURCE_MEM,
  37. }, {
  38. .start = data->irq,
  39. .end = data->irq,
  40. .flags = IORESOURCE_IRQ,
  41. },
  42. };
  43. return mxs_add_platform_device_dmamask("imx28-fec", data->id,
  44. res, ARRAY_SIZE(res), pdata, sizeof(*pdata),
  45. DMA_BIT_MASK(32));
  46. }