summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNitin Garg <nitin.garg@freescale.com>2012-03-06 15:48:31 -0600
committerNitin Garg <nitin.garg@freescale.com>2012-03-06 15:48:31 -0600
commit90841a2089d500c8ce1405b720349214093ab292 (patch)
treec03ec19fcc163e829a990178c552d52f2b2517b8 /drivers
parenta2fa26f5eb0d70aac3a6df1c37d72499ea270cde (diff)
ENGR00175602-1: Suspend/Resume: Alarm cannot wake up system from suspend mode
Alarm cannot wakeup the system from suspend mode due to missing da9053 PMIC fixups. Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/da9052-core.c4
-rw-r--r--drivers/rtc/rtc-da9052.c103
-rw-r--r--drivers/watchdog/imx2_wdt.c4
3 files changed, 43 insertions, 68 deletions
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 44ba8d9b6f66..e1e65da5ebd6 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -305,8 +305,8 @@ void eh_workqueue_isr(struct work_struct *work)
/* Collect all events */
for (cnt = 0; cnt < DA9052_EVE_REGISTERS; cnt++)
- events_sts |= (eve_data[cnt].data << (DA9052_EVE_REGISTER_SIZE
- * cnt));
+ events_sts |= ((eve_data[cnt].data&0xff) <<
+ (DA9052_EVE_REGISTER_SIZE * cnt));
/* Check if we really got any event */
if (events_sts == 0) {
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 3ae835bfbe61..dd6bf53457b2 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -1,5 +1,6 @@
/*
* Copyright(c) 2009 Dialog Semiconductor Ltd.
+ * Copyright 2010-2012 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +51,6 @@ void da9052_rtc_notifier(struct da9052_eh_nb *eh_data, unsigned int event)
da9052_unlock(rtc->da9052);
-
if (msg.data & DA9052_ALARMMI_ALARMTYPE) {
da9052_rtc_enable_alarm(rtc->da9052, 0);
pr_debug("RTC: TIMER ALARM\n");
@@ -261,8 +261,6 @@ static int da9052_alarm_settime(struct da9052 *da9052, struct rtc_time *rtc_tm)
unsigned char loop_index = 0;
int ret = 0;
- rtc_tm->tm_sec = 0;
-
/* System compatability */
rtc_tm->tm_year -= 100;
rtc_tm->tm_mon += 1;
@@ -281,6 +279,24 @@ static int da9052_alarm_settime(struct da9052 *da9052, struct rtc_time *rtc_tm)
return ret;
}
+ /* Since DA9053 does support seconds timer, go to next mins boundary */
+ if (rtc_tm->tm_sec) {
+ rtc_tm->tm_min = rtc_tm->tm_min + 1;
+ rtc_tm->tm_sec = 0;
+
+ /* If minutes rolls over the boundary */
+ if (rtc_tm->tm_min > 59) {
+ rtc_tm->tm_hour = rtc_tm->tm_hour + 1;
+ rtc_tm->tm_min = 0;
+
+ /* If hours rolls over the boundary */
+ if (rtc_tm->tm_hour > 23) {
+ rtc_tm->tm_mday = rtc_tm->tm_mday + 1;
+ rtc_tm->tm_hour = 0;
+ }
+ }
+ }
+
msg.data = msg.data & ~(DA9052_ALARMMI_ALARMMIN);
msg.data |= rtc_tm->tm_min;
@@ -309,9 +325,8 @@ static int da9052_alarm_settime(struct da9052 *da9052, struct rtc_time *rtc_tm)
}
msg.data = msg.data & ~(DA9052_ALARMY_ALARMYEAR);
-
-
msg.data |= rtc_tm->tm_year;
+
msg_arr[loop_index].addr = DA9052_ALARMY_REG;
msg_arr[loop_index].data = 0;
msg_arr[loop_index++].data = msg.data;
@@ -336,8 +351,8 @@ static int da9052_rtc_get_alarm_status(struct da9052 *da9052)
da9052_lock(da9052);
ret = da9052->read(da9052, &msg);
if (ret != 0) {
- da9052_unlock(da9052);
- return ret;
+ da9052_unlock(da9052);
+ return ret;
}
da9052_unlock(da9052);
@@ -370,45 +385,14 @@ static int da9052_rtc_enable_alarm(struct da9052 *da9052, unsigned char flag)
da9052_unlock(da9052);
return ret;
}
- da9052_unlock(da9052);
-
- return 0;
-}
-
-
-static ssize_t da9052_rtc_mask_irq(struct da9052 *da9052)
- {
- unsigned char data = 0;
- ssize_t ret = 0;
- struct da9052_ssc_msg ssc_msg;
-
- ssc_msg.addr = DA9052_IRQMASKA_REG;
- ssc_msg.data = 0;
-
- da9052_lock(da9052);
- ret = da9052->read(da9052, &ssc_msg);
- if (ret != 0) {
- da9052_unlock(da9052);
- return ret;
- }
-
- data = ret;
- ssc_msg.data = data |= DA9052_IRQMASKA_MALRAM;
-
- ret = da9052->write(da9052, &ssc_msg);
- if (ret != 0) {
- da9052_unlock(da9052);
- return ret;
- }
da9052_unlock(da9052);
+
return 0;
}
-
static ssize_t da9052_rtc_unmask_irq(struct da9052 *da9052)
{
- unsigned char data = 0;
ssize_t ret = 0;
struct da9052_ssc_msg ssc_msg;
@@ -422,8 +406,8 @@ static ssize_t da9052_rtc_unmask_irq(struct da9052 *da9052)
return ret;
}
- data = ret;
- ssc_msg.data = data &= ~DA9052_IRQMASKA_MALRAM;
+ ssc_msg.data &= ~DA9052_IRQMASKA_MALRAM;
+ ssc_msg.data |= DA9052_IRQMASKA_MSEQRDY;
ret = da9052->write(da9052, &ssc_msg);
if (ret != 0) {
@@ -462,6 +446,7 @@ static int da9052_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
int ret;
struct rtc_time *tm = &alrm->time;
struct da9052 *da9052 = dev_get_drvdata(dev->parent);
+
ret = da9052_alarm_gettime(da9052, tm);
if (ret)
@@ -479,29 +464,19 @@ static int da9052_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
struct rtc_time *tm = &alrm->time;
struct da9052 *da9052 = dev_get_drvdata(dev->parent);
- ret = da9052_alarm_settime(da9052, tm);
+ ret = da9052_rtc_enable_alarm(da9052, 0);
+ if (ret)
+ return ret;
+ ret = da9052_alarm_settime(da9052, tm);
if (ret)
return ret;
ret = da9052_rtc_enable_alarm(da9052, 1);
+ if (ret)
+ return ret;
- return ret;
-}
-
-static int da9052_rtc_update_irq_enable(struct device *dev,
- unsigned int enabled)
-{
- struct da9052_rtc *priv = dev_get_drvdata(dev);
- int ret = -ENODATA;
-
- da9052_lock(priv->da9052);
-
- ret = (enabled ? da9052_rtc_unmask_irq : da9052_rtc_mask_irq)
- (priv->da9052);
-
- da9052_unlock(priv->da9052);
-
+ ret = da9052_rtc_unmask_irq(da9052);
return ret;
}
@@ -510,10 +485,7 @@ static int da9052_rtc_alarm_irq_enable(struct device *dev,
{
struct da9052_rtc *priv = dev_get_drvdata(dev);
- if (enabled)
- return da9052_rtc_enable_alarm(priv->da9052, enabled);
- else
- return da9052_rtc_enable_alarm(priv->da9052, enabled);
+ return da9052_rtc_enable_alarm(priv->da9052, enabled);
}
static const struct rtc_class_ops da9052_rtc_ops = {
@@ -521,10 +493,7 @@ static const struct rtc_class_ops da9052_rtc_ops = {
.set_time = da9052_rtc_class_ops_settime,
.read_alarm = da9052_rtc_readalarm,
.set_alarm = da9052_rtc_setalarm,
-#if 0
- .update_irq_enable = da9052_rtc_update_irq_enable,
.alarm_irq_enable = da9052_rtc_alarm_irq_enable,
-#endif
};
@@ -553,7 +522,7 @@ static int __devinit da9052_rtc_probe(struct platform_device *pdev)
goto err_register_alarm;
priv->is_min_alarm = 1;
- priv->enable_tick_alarm = 1;
+ priv->enable_tick_alarm = 0;
priv->enable_clk_buffer = 1;
priv->set_osc_trim_freq = 5;
/* Enable/Disable TICK Alarm */
@@ -635,6 +604,8 @@ static int __devinit da9052_rtc_probe(struct platform_device *pdev)
goto err_ssc_comm;
}
da9052_unlock(priv->da9052);
+ /* disable rtc-alarm */
+ da9052_rtc_enable_alarm(priv->da9052, 0);
priv->rtc = rtc_device_register(pdev->name,
&pdev->dev, &da9052_rtc_ops, THIS_MODULE);
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index ad2a40fefc6c..249a66eb6611 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -2,6 +2,7 @@
* Watchdog driver for IMX2 and later processors
*
* Copyright (C) 2010 Wolfram Sang, Pengutronix e.K. <w.sang@pengutronix.de>
+ * Copyright 2010-2012 Freescale Semiconductor, Inc.
*
* some parts adapted by similar drivers from Darius Augulis and Vladimir
* Zapolskiy, additional improvements by Wim Van Sebroeck.
@@ -41,6 +42,7 @@
#define IMX2_WDT_WCR_WT (0xFF << 8) /* -> Watchdog Timeout Field */
#define IMX2_WDT_WCR_WRE (1 << 3) /* -> WDOG Reset Enable */
#define IMX2_WDT_WCR_WDE (1 << 2) /* -> Watchdog Enable */
+#define IMX2_WDT_WCR_WDBG (1 << 1) /* -> Watchdog DBG bit */
#define IMX2_WDT_WCR_WDZST (1 << 0) /* -> Watchdog timer Suspend */
#define IMX2_WDT_WSR 0x02 /* Service Register */
@@ -88,6 +90,8 @@ static inline void imx2_wdt_setup(void)
/* Suspend watch dog timer in low power mode, write once-only */
val |= IMX2_WDT_WCR_WDZST;
+ /* Enable Watchdog Debug */
+ val |= IMX2_WDT_WCR_WDBG;
/* Strip the old watchdog Time-Out value */
val &= ~IMX2_WDT_WCR_WT;
/* Generate reset if WDOG times out */