platform-fec.c 1.4 KB

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