linux/arch/arm/plat-mxc/devices/platform-fec.c
<<
>>
Prefs
   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
  14#define imx_fec_data_entry_single(soc, _devid)                          \
  15        {                                                               \
  16                .devid = _devid,                                        \
  17                .iobase = soc ## _FEC_BASE_ADDR,                        \
  18                .irq = soc ## _INT_FEC,                                 \
  19        }
  20
  21#ifdef CONFIG_SOC_IMX25
  22const struct imx_fec_data imx25_fec_data __initconst =
  23        imx_fec_data_entry_single(MX25, "imx25-fec");
  24#endif /* ifdef CONFIG_SOC_IMX25 */
  25
  26#ifdef CONFIG_SOC_IMX27
  27const struct imx_fec_data imx27_fec_data __initconst =
  28        imx_fec_data_entry_single(MX27, "imx27-fec");
  29#endif /* ifdef CONFIG_SOC_IMX27 */
  30
  31#ifdef CONFIG_SOC_IMX35
  32/* i.mx35 has the i.mx27 type fec */
  33const struct imx_fec_data imx35_fec_data __initconst =
  34        imx_fec_data_entry_single(MX35, "imx27-fec");
  35#endif
  36
  37#ifdef CONFIG_SOC_IMX50
  38/* i.mx50 has the i.mx25 type fec */
  39const struct imx_fec_data imx50_fec_data __initconst =
  40        imx_fec_data_entry_single(MX50, "imx25-fec");
  41#endif
  42
  43#ifdef CONFIG_SOC_IMX51
  44/* i.mx51 has the i.mx27 type fec */
  45const struct imx_fec_data imx51_fec_data __initconst =
  46        imx_fec_data_entry_single(MX51, "imx27-fec");
  47#endif
  48
  49#ifdef CONFIG_SOC_IMX53
  50/* i.mx53 has the i.mx25 type fec */
  51const struct imx_fec_data imx53_fec_data __initconst =
  52        imx_fec_data_entry_single(MX53, "imx25-fec");
  53#endif
  54
  55struct platform_device *__init imx_add_fec(
  56                const struct imx_fec_data *data,
  57                const struct fec_platform_data *pdata)
  58{
  59        struct resource res[] = {
  60                {
  61                        .start = data->iobase,
  62                        .end = data->iobase + SZ_4K - 1,
  63                        .flags = IORESOURCE_MEM,
  64                }, {
  65                        .start = data->irq,
  66                        .end = data->irq,
  67                        .flags = IORESOURCE_IRQ,
  68                },
  69        };
  70
  71        return imx_add_platform_device_dmamask(data->devid, 0,
  72                        res, ARRAY_SIZE(res),
  73                        pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  74}
  75