linux/arch/arm/plat-mxc/devices/platform-imx2-wdt.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 <asm/sizes.h>
  10#include <mach/hardware.h>
  11#include <mach/devices-common.h>
  12
  13#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)          \
  14        {                                                               \
  15                .id = _id,                                              \
  16                .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR,          \
  17                .iosize = _size,                                        \
  18        }
  19#define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size)                 \
  20        [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)
  21
  22#ifdef CONFIG_SOC_IMX21
  23const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
  24        imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K);
  25#endif /* ifdef CONFIG_SOC_IMX21 */
  26
  27#ifdef CONFIG_SOC_IMX25
  28const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
  29        imx_imx2_wdt_data_entry_single(MX25, 0, , SZ_16K);
  30#endif /* ifdef CONFIG_SOC_IMX25 */
  31
  32#ifdef CONFIG_SOC_IMX27
  33const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
  34        imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
  35#endif /* ifdef CONFIG_SOC_IMX27 */
  36
  37#ifdef CONFIG_SOC_IMX31
  38const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
  39        imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K);
  40#endif /* ifdef CONFIG_SOC_IMX31 */
  41
  42#ifdef CONFIG_SOC_IMX35
  43const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
  44        imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
  45#endif /* ifdef CONFIG_SOC_IMX35 */
  46
  47#ifdef CONFIG_SOC_IMX51
  48const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst = {
  49#define imx51_imx2_wdt_data_entry(_id, _hwid)                           \
  50        imx_imx2_wdt_data_entry(MX51, _id, _hwid, SZ_16K)
  51        imx51_imx2_wdt_data_entry(0, 1),
  52        imx51_imx2_wdt_data_entry(1, 2),
  53};
  54#endif /* ifdef CONFIG_SOC_IMX51 */
  55
  56struct platform_device *__init imx_add_imx2_wdt(
  57                const struct imx_imx2_wdt_data *data)
  58{
  59        struct resource res[] = {
  60                {
  61                        .start = data->iobase,
  62                        .end = data->iobase + data->iosize - 1,
  63                        .flags = IORESOURCE_MEM,
  64                },
  65        };
  66        return imx_add_platform_device("imx2-wdt", data->id,
  67                        res, ARRAY_SIZE(res), NULL, 0);
  68}
  69