platform-fec.c 2.0 KB

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