Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / arch / arm / plat-mxc / devices / platform-imx2-wdt.c
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
23 const 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
28 const 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
33 const 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
38 const 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
43 const 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
48 const 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
56 #ifdef CONFIG_SOC_IMX53
57 const 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
65 struct 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,
71                         .end = data->iobase + data->iosize - 1,
72                         .flags = IORESOURCE_MEM,
73                 },
74         };
75         return imx_add_platform_device("imx2-wdt", data->id,
76                         res, ARRAY_SIZE(res), NULL, 0);
77 }