diff options
Diffstat (limited to 'arch/arm/mach-imx/devices/platform-imx2-wdt.c')
-rw-r--r-- | arch/arm/mach-imx/devices/platform-imx2-wdt.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/devices/platform-imx2-wdt.c b/arch/arm/mach-imx/devices/platform-imx2-wdt.c new file mode 100644 index 000000000000..ec75d6413686 --- /dev/null +++ b/arch/arm/mach-imx/devices/platform-imx2-wdt.c | |||
@@ -0,0 +1,78 @@ | |||
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 | |||
11 | #include "../hardware.h" | ||
12 | #include "devices-common.h" | ||
13 | |||
14 | #define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \ | ||
15 | { \ | ||
16 | .id = _id, \ | ||
17 | .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR, \ | ||
18 | .iosize = _size, \ | ||
19 | } | ||
20 | #define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size) \ | ||
21 | [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) | ||
22 | |||
23 | #ifdef CONFIG_SOC_IMX21 | ||
24 | const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst = | ||
25 | imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K); | ||
26 | #endif /* ifdef CONFIG_SOC_IMX21 */ | ||
27 | |||
28 | #ifdef CONFIG_SOC_IMX25 | ||
29 | const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst = | ||
30 | imx_imx2_wdt_data_entry_single(MX25, 0, , SZ_16K); | ||
31 | #endif /* ifdef CONFIG_SOC_IMX25 */ | ||
32 | |||
33 | #ifdef CONFIG_SOC_IMX27 | ||
34 | const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst = | ||
35 | imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K); | ||
36 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
37 | |||
38 | #ifdef CONFIG_SOC_IMX31 | ||
39 | const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst = | ||
40 | imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K); | ||
41 | #endif /* ifdef CONFIG_SOC_IMX31 */ | ||
42 | |||
43 | #ifdef CONFIG_SOC_IMX35 | ||
44 | const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst = | ||
45 | imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K); | ||
46 | #endif /* ifdef CONFIG_SOC_IMX35 */ | ||
47 | |||
48 | #ifdef CONFIG_SOC_IMX51 | ||
49 | const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst = { | ||
50 | #define imx51_imx2_wdt_data_entry(_id, _hwid) \ | ||
51 | imx_imx2_wdt_data_entry(MX51, _id, _hwid, SZ_16K) | ||
52 | imx51_imx2_wdt_data_entry(0, 1), | ||
53 | imx51_imx2_wdt_data_entry(1, 2), | ||
54 | }; | ||
55 | #endif /* ifdef CONFIG_SOC_IMX51 */ | ||
56 | |||
57 | #ifdef CONFIG_SOC_IMX53 | ||
58 | const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst = { | ||
59 | #define imx53_imx2_wdt_data_entry(_id, _hwid) \ | ||
60 | imx_imx2_wdt_data_entry(MX53, _id, _hwid, SZ_16K) | ||
61 | imx53_imx2_wdt_data_entry(0, 1), | ||
62 | imx53_imx2_wdt_data_entry(1, 2), | ||
63 | }; | ||
64 | #endif /* ifdef CONFIG_SOC_IMX53 */ | ||
65 | |||
66 | struct platform_device *__init imx_add_imx2_wdt( | ||
67 | const struct imx_imx2_wdt_data *data) | ||
68 | { | ||
69 | struct resource res[] = { | ||
70 | { | ||
71 | .start = data->iobase, | ||
72 | .end = data->iobase + data->iosize - 1, | ||
73 | .flags = IORESOURCE_MEM, | ||
74 | }, | ||
75 | }; | ||
76 | return imx_add_platform_device("imx2-wdt", data->id, | ||
77 | res, ARRAY_SIZE(res), NULL, 0); | ||
78 | } | ||