blob: 8c134c8d7500349f1040cca3fcad40ea851a1bcd [file] [log] [blame]
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +01001/*
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>
Shawn Guo50f2de62012-09-14 14:14:45 +080010
11#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080012#include "devices-common.h"
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010013
Fabio Estevam8c2efec2010-12-06 16:38:32 -020014#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010015 { \
Fabio Estevam8c2efec2010-12-06 16:38:32 -020016 .id = _id, \
17 .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR, \
Uwe Kleine-König00871502010-11-11 16:58:50 +010018 .iosize = _size, \
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010019 }
Fabio Estevam8c2efec2010-12-06 16:38:32 -020020#define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size) \
21 [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010022
23#ifdef CONFIG_SOC_IMX21
24const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020025 imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K);
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010026#endif /* ifdef CONFIG_SOC_IMX21 */
27
28#ifdef CONFIG_SOC_IMX27
29const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020030 imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010031#endif /* ifdef CONFIG_SOC_IMX27 */
32
Uwe Kleine-König742269e2010-11-15 15:28:45 +010033#ifdef CONFIG_SOC_IMX31
34const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020035 imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K);
Uwe Kleine-König742269e2010-11-15 15:28:45 +010036#endif /* ifdef CONFIG_SOC_IMX31 */
37
38#ifdef CONFIG_SOC_IMX35
39const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020040 imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
Uwe Kleine-König742269e2010-11-15 15:28:45 +010041#endif /* ifdef CONFIG_SOC_IMX35 */
42
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010043struct platform_device *__init imx_add_imx2_wdt(
44 const struct imx_imx2_wdt_data *data)
45{
46 struct resource res[] = {
47 {
48 .start = data->iobase,
Uwe Kleine-König00871502010-11-11 16:58:50 +010049 .end = data->iobase + data->iosize - 1,
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010050 .flags = IORESOURCE_MEM,
51 },
52 };
Fabio Estevam8c2efec2010-12-06 16:38:32 -020053 return imx_add_platform_device("imx2-wdt", data->id,
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010054 res, ARRAY_SIZE(res), NULL, 0);
55}