blob: 729c1914e2211bdcb79d8e1cbee7ab5310395e39 [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>
10#include <mach/hardware.h>
Shawn Guoe0557c02012-09-13 15:51:15 +080011#include "devices-common.h"
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010012
Fabio Estevam8c2efec2010-12-06 16:38:32 -020013#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010014 { \
Fabio Estevam8c2efec2010-12-06 16:38:32 -020015 .id = _id, \
16 .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR, \
Uwe Kleine-König00871502010-11-11 16:58:50 +010017 .iosize = _size, \
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010018 }
Fabio Estevam8c2efec2010-12-06 16:38:32 -020019#define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size) \
20 [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010021
22#ifdef CONFIG_SOC_IMX21
23const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020024 imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K);
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010025#endif /* ifdef CONFIG_SOC_IMX21 */
26
Uwe Kleine-König972cc482010-11-11 18:35:01 +010027#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König00871502010-11-11 16:58:50 +010028const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020029 imx_imx2_wdt_data_entry_single(MX25, 0, , SZ_16K);
Uwe Kleine-König972cc482010-11-11 18:35:01 +010030#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König00871502010-11-11 16:58:50 +010031
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010032#ifdef CONFIG_SOC_IMX27
33const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020034 imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010035#endif /* ifdef CONFIG_SOC_IMX27 */
36
Uwe Kleine-König742269e2010-11-15 15:28:45 +010037#ifdef CONFIG_SOC_IMX31
38const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020039 imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K);
Uwe Kleine-König742269e2010-11-15 15:28:45 +010040#endif /* ifdef CONFIG_SOC_IMX31 */
41
42#ifdef CONFIG_SOC_IMX35
43const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
Fabio Estevam8c2efec2010-12-06 16:38:32 -020044 imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
Uwe Kleine-König742269e2010-11-15 15:28:45 +010045#endif /* ifdef CONFIG_SOC_IMX35 */
46
Fabio Estevamb99545c2010-11-26 12:25:59 -020047#ifdef CONFIG_SOC_IMX51
Fabio Estevam8c2efec2010-12-06 16:38:32 -020048const 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};
Fabio Estevamb99545c2010-11-26 12:25:59 -020054#endif /* ifdef CONFIG_SOC_IMX51 */
55
Fabio Estevam78c73592011-02-17 18:09:52 -020056#ifdef CONFIG_SOC_IMX53
57const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst = {
58#define imx53_imx2_wdt_data_entry(_id, _hwid) \
59 imx_imx2_wdt_data_entry(MX53, _id, _hwid, SZ_16K)
60 imx53_imx2_wdt_data_entry(0, 1),
61 imx53_imx2_wdt_data_entry(1, 2),
62};
63#endif /* ifdef CONFIG_SOC_IMX53 */
64
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010065struct platform_device *__init imx_add_imx2_wdt(
66 const struct imx_imx2_wdt_data *data)
67{
68 struct resource res[] = {
69 {
70 .start = data->iobase,
Uwe Kleine-König00871502010-11-11 16:58:50 +010071 .end = data->iobase + data->iosize - 1,
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010072 .flags = IORESOURCE_MEM,
73 },
74 };
Fabio Estevam8c2efec2010-12-06 16:38:32 -020075 return imx_add_platform_device("imx2-wdt", data->id,
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010076 res, ARRAY_SIZE(res), NULL, 0);
77}