summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/i2c/m41t8x.c8
-rw-r--r--sys/dev/ic/m41t8xreg.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/i2c/m41t8x.c b/sys/dev/i2c/m41t8x.c
index a0cea7100d3..fa9a14f6d76 100644
--- a/sys/dev/i2c/m41t8x.c
+++ b/sys/dev/i2c/m41t8x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m41t8x.c,v 1.1 2020/09/30 22:23:41 patrick Exp $ */
+/* $OpenBSD: m41t8x.c,v 1.2 2020/10/23 20:55:15 patrick Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -56,7 +56,8 @@ m41t8xrtc_match(struct device *parent, void *vcf, void *aux)
{
struct i2c_attach_args *ia = (struct i2c_attach_args *)aux;
- if (strcmp(ia->ia_name, "st,m41t83") == 0)
+ if (strcmp(ia->ia_name, "st,m41t83") == 0 ||
+ strcmp(ia->ia_name, "microcrystal,rv4162") == 0)
return (1);
return (0);
@@ -137,7 +138,8 @@ m41t8xrtc_settime(struct todr_chip_handle *handle, struct timeval *tv)
if (dt.dt_year >= 2100)
data[M41T8X_HR] |= M41T8X_CB;
data[M41T8X_HR] |= TOBCD(dt.dt_hour);
- data[M41T8X_DOW] = TOBCD(dt.dt_wday + 1);
+ data[M41T8X_DOW] &= ~M41T8X_DOW_MASK;
+ data[M41T8X_DOW] |= TOBCD(dt.dt_wday + 1);
data[M41T8X_DAY] = TOBCD(dt.dt_day);
data[M41T8X_MON] = TOBCD(dt.dt_mon);
data[M41T8X_YEAR] = TOBCD(dt.dt_year % 100);
diff --git a/sys/dev/ic/m41t8xreg.h b/sys/dev/ic/m41t8xreg.h
index d767a8bb15b..5420260fd7c 100644
--- a/sys/dev/ic/m41t8xreg.h
+++ b/sys/dev/ic/m41t8xreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: m41t8xreg.h,v 1.2 2010/02/19 14:58:13 miod Exp $ */
+/* $OpenBSD: m41t8xreg.h,v 1.3 2020/10/23 20:55:15 patrick Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -40,6 +40,7 @@
#define M41T8X_CEB 0x80 /* century bit toggle enable */
#define M41T8X_CB 0x40 /* century bit */
#define M41T8X_DOW 0x04 /* day of week */
+#define M41T8X_DOW_MASK 0x07 /* day of week bits */
#define M41T8X_DAY 0x05 /* day of month */
#define M41T8X_MON 0x06 /* month */
#define M41T8X_YEAR 0x07 /* year */