From 8e5d509593b5dd0c3ab78f6af0cc67b0e32c30f6 Mon Sep 17 00:00:00 2001 From: Virupax Sadashivpetimath Date: Fri, 16 Dec 2011 19:00:12 +0530 Subject: watchdog: Add 5500 support ST-Ericsson Linux next: NA ST-Ericsson ID: 316540 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I55bf6d145fe3cf4a1fc8de8c45266832c9769a54 Signed-off-by: Virupax Sadashivpetimath Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/42473 Reviewed-by: Srinidhi KASAGAR --- drivers/watchdog/Kconfig | 4 ++-- drivers/watchdog/ux500_wdt.c | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 64289e67c39..14e568be223 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -351,7 +351,7 @@ config IMX2_WDT config UX500_WATCHDOG bool "ST-Ericsson Ux500 watchdog" - depends on UX500_SOC_DB8500 + depends on UX500_SOC_DB8500 || UX500_SOC_DB5500 default y help Say Y here to include Watchdog timer support for the @@ -361,7 +361,7 @@ config UX500_WATCHDOG config UX500_WATCHDOG_DEBUG bool "ST-Ericsson Ux500 watchdog DEBUG" - depends on UX500_SOC_DB8500 && DEBUG_FS + depends on (UX500_SOC_DB8500 || UX500_SOC_DB5500) && DEBUG_FS help Say Y here to add various debugfs entries in wdog/ diff --git a/drivers/watchdog/ux500_wdt.c b/drivers/watchdog/ux500_wdt.c index 78c03285be3..52747e59172 100644 --- a/drivers/watchdog/ux500_wdt.c +++ b/drivers/watchdog/ux500_wdt.c @@ -152,9 +152,17 @@ static long ux500_wdt_ioctl(struct file *file, unsigned int cmd, if (get_user(interval, p)) return -EFAULT; - /* 28 bit resolution in ms, becomes 268435.455 s */ - if (interval > 268435 || interval < 0) + if (cpu_is_u8500()) { + /* 28 bit resolution in ms, becomes 268435.455 s */ + if (interval > 268435 || interval < 0) + return -EINVAL; + } else if (cpu_is_u5500()) { + /* 32 bit resolution in ms, becomes 4294967.295 s */ + if (interval > 4294967 || interval < 0) + return -EINVAL; + } else return -EINVAL; + timeout = interval; prcmu_disable_a9wdog(wdog_id); prcmu_load_a9wdog(wdog_id, timeout * 1000); @@ -384,6 +392,11 @@ static int __exit ux500_wdt_remove(struct platform_device *dev) static int ux500_wdt_suspend(struct platform_device *pdev, pm_message_t state) { + if (wdt_en && cpu_is_u5500()) { + prcmu_disable_a9wdog(wdog_id); + return 0; + } + if (wdt_en && !wdt_auto_off) { prcmu_disable_a9wdog(wdog_id); prcmu_config_a9wdog(1, true); @@ -396,6 +409,12 @@ static int ux500_wdt_suspend(struct platform_device *pdev, static int ux500_wdt_resume(struct platform_device *pdev) { + if (wdt_en && cpu_is_u5500()) { + prcmu_load_a9wdog(wdog_id, timeout * 1000); + prcmu_enable_a9wdog(wdog_id); + return 0; + } + if (wdt_en && !wdt_auto_off) { prcmu_disable_a9wdog(wdog_id); prcmu_config_a9wdog(1, wdt_auto_off); -- cgit v1.2.3