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