summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2017-01-09 18:14:29 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit20e92f89e4ea4582d5fd31ba023766b52c2e9ea1 (patch)
treea810e3139f9b9e7aa4c2ffeeb69e219bda0b9bca /drivers/rtc
parentb98b9d70fae01939b0860658487c0e5cac4c8dab (diff)
MLK-13702 rtc: snvs: make sure set time is working for i.mx7ulp
On i.MX7ULP, only waiting for enable bit of SNVS RTC clear is NOT enough for RTC time program, need to add at least 12us delay, here adds 38us margins to make sure RTC time can be changed, and this is NOT harmful for other i.MX. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-snvs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index 082f85c601fe..31effe234b3d 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
@@ -18,6 +19,7 @@
#include <linux/platform_device.h>
#include <linux/rtc.h>
#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
@@ -146,6 +148,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
if (ret)
return ret;
+ udelay(50);
+
/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
regmap_write(data->regmap, data->offset + SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
regmap_write(data->regmap, data->offset + SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));