]> git.sur5r.net Git - u-boot/blobdiff - drivers/rtc/m41t62.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / drivers / rtc / m41t62.c
index 62c2446939607fcd89440303aa2ee3011ee03662..d53ef7d8628aa734935445da9488b65f1ec37f43 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * based on a the Linux rtc-m41t80.c driver which is:
  *   Alexander Bigga <ab@mycable.de>, 2006 (c) mycable GmbH
- *
- * 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 the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
  */
 
 /*
@@ -63,6 +49,8 @@
 #define M41T62_FEATURE_HT      (1 << 0)
 #define M41T62_FEATURE_BL      (1 << 1)
 
+#define M41T80_ALHOUR_HT       (1 << 6)        /* HT: Halt Update Bit */
+
 int rtc_get(struct rtc_time *tm)
 {
        u8 buf[M41T62_DATETIME_REG_SIZE];
@@ -132,9 +120,15 @@ int rtc_set(struct rtc_time *tm)
 
 void rtc_reset(void)
 {
+       u8 val;
+
        /*
-        * Nothing to do
+        * M41T82: Make sure HT (Halt Update) bit is cleared.
+        * This bit is 0 in M41T62 so its save to clear it always.
         */
+       i2c_read(CONFIG_SYS_I2C_RTC_ADDR, M41T62_REG_ALARM_HOUR, 1, &val, 1);
+       val &= ~M41T80_ALHOUR_HT;
+       i2c_write(CONFIG_SYS_I2C_RTC_ADDR, M41T62_REG_ALARM_HOUR, 1, &val, 1);
 }
 
 #endif