Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 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> |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 10 | |
| 11 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 12 | #include "devices-common.h" |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 13 | |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 14 | #define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \ |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 15 | { \ |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 16 | .id = _id, \ |
| 17 | .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR, \ |
Uwe Kleine-König | 0087150 | 2010-11-11 16:58:50 +0100 | [diff] [blame] | 18 | .iosize = _size, \ |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 19 | } |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 20 | #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önig | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 22 | |
| 23 | #ifdef CONFIG_SOC_IMX21 |
| 24 | const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst = |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 25 | imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K); |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 26 | #endif /* ifdef CONFIG_SOC_IMX21 */ |
| 27 | |
| 28 | #ifdef CONFIG_SOC_IMX27 |
| 29 | const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst = |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 30 | imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K); |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 31 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 32 | |
Uwe Kleine-König | 742269e | 2010-11-15 15:28:45 +0100 | [diff] [blame] | 33 | #ifdef CONFIG_SOC_IMX31 |
| 34 | const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst = |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 35 | imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K); |
Uwe Kleine-König | 742269e | 2010-11-15 15:28:45 +0100 | [diff] [blame] | 36 | #endif /* ifdef CONFIG_SOC_IMX31 */ |
| 37 | |
| 38 | #ifdef CONFIG_SOC_IMX35 |
| 39 | const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst = |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 40 | imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K); |
Uwe Kleine-König | 742269e | 2010-11-15 15:28:45 +0100 | [diff] [blame] | 41 | #endif /* ifdef CONFIG_SOC_IMX35 */ |
| 42 | |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 43 | struct 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önig | 0087150 | 2010-11-11 16:58:50 +0100 | [diff] [blame] | 49 | .end = data->iobase + data->iosize - 1, |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 50 | .flags = IORESOURCE_MEM, |
| 51 | }, |
| 52 | }; |
Fabio Estevam | 8c2efec | 2010-12-06 16:38:32 -0200 | [diff] [blame] | 53 | return imx_add_platform_device("imx2-wdt", data->id, |
Uwe Kleine-König | e0a1961 | 2010-11-04 10:09:10 +0100 | [diff] [blame] | 54 | res, ARRAY_SIZE(res), NULL, 0); |
| 55 | } |