Tue Oct 4 15:06:59 2016 UTC ()
Add DS1340.


(kiyohara)
diff -r1.22 -r1.23 src/sys/dev/i2c/ds1307.c
diff -r1.6 -r1.7 src/sys/dev/i2c/ds1307reg.h

cvs diff -r1.22 -r1.23 src/sys/dev/i2c/ds1307.c (expand / switch to unified diff)

--- src/sys/dev/i2c/ds1307.c 2016/04/05 10:53:16 1.22
+++ src/sys/dev/i2c/ds1307.c 2016/10/04 15:06:59 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ds1307.c,v 1.22 2016/04/05 10:53:16 bouyer Exp $ */ 1/* $NetBSD: ds1307.c,v 1.23 2016/10/04 15:06:59 kiyohara Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Steve C. Woodford and Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Steve C. Woodford and Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.22 2016/04/05 10:53:16 bouyer Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.23 2016/10/04 15:06:59 kiyohara Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/fcntl.h> 45#include <sys/fcntl.h>
46#include <sys/uio.h> 46#include <sys/uio.h>
47#include <sys/conf.h> 47#include <sys/conf.h>
48#include <sys/event.h> 48#include <sys/event.h>
49 49
50#include <dev/clock_subr.h> 50#include <dev/clock_subr.h>
51 51
52#include <dev/i2c/i2cvar.h> 52#include <dev/i2c/i2cvar.h>
@@ -73,26 +73,33 @@ static const struct dsrtc_model dsrtc_mo @@ -73,26 +73,33 @@ static const struct dsrtc_model dsrtc_mo
73 .dm_ch_reg = DSXXXX_SECONDS, 73 .dm_ch_reg = DSXXXX_SECONDS,
74 .dm_ch_value = DS1307_SECONDS_CH, 74 .dm_ch_value = DS1307_SECONDS_CH,
75 .dm_rtc_start = DS1307_RTC_START, 75 .dm_rtc_start = DS1307_RTC_START,
76 .dm_rtc_size = DS1307_RTC_SIZE, 76 .dm_rtc_size = DS1307_RTC_SIZE,
77 .dm_nvram_start = DS1307_NVRAM_START, 77 .dm_nvram_start = DS1307_NVRAM_START,
78 .dm_nvram_size = DS1307_NVRAM_SIZE, 78 .dm_nvram_size = DS1307_NVRAM_SIZE,
79 .dm_flags = DSRTC_FLAG_BCD | DSRTC_FLAG_CLOCK_HOLD, 79 .dm_flags = DSRTC_FLAG_BCD | DSRTC_FLAG_CLOCK_HOLD,
80 }, { 80 }, {
81 .dm_model = 1339, 81 .dm_model = 1339,
82 .dm_rtc_start = DS1339_RTC_START, 82 .dm_rtc_start = DS1339_RTC_START,
83 .dm_rtc_size = DS1339_RTC_SIZE, 83 .dm_rtc_size = DS1339_RTC_SIZE,
84 .dm_flags = DSRTC_FLAG_BCD, 84 .dm_flags = DSRTC_FLAG_BCD,
85 }, { 85 }, {
 86 .dm_model = 1340,
 87 .dm_ch_reg = DSXXXX_SECONDS,
 88 .dm_ch_value = DS1340_SECONDS_EOSC,
 89 .dm_rtc_start = DS1340_RTC_START,
 90 .dm_rtc_size = DS1340_RTC_SIZE,
 91 .dm_flags = DSRTC_FLAG_BCD,
 92 }, {
86 .dm_model = 1672, 93 .dm_model = 1672,
87 .dm_rtc_start = DS1672_RTC_START, 94 .dm_rtc_start = DS1672_RTC_START,
88 .dm_rtc_size = DS1672_RTC_SIZE, 95 .dm_rtc_size = DS1672_RTC_SIZE,
89 .dm_ch_reg = DS1672_CONTROL, 96 .dm_ch_reg = DS1672_CONTROL,
90 .dm_ch_value = DS1672_CONTROL_CH, 97 .dm_ch_value = DS1672_CONTROL_CH,
91 .dm_flags = 0, 98 .dm_flags = 0,
92 }, { 99 }, {
93 .dm_model = 3231, 100 .dm_model = 3231,
94 .dm_rtc_start = DS3232_RTC_START, 101 .dm_rtc_start = DS3232_RTC_START,
95 .dm_rtc_size = DS3232_RTC_SIZE, 102 .dm_rtc_size = DS3232_RTC_SIZE,
96 /* 103 /*
97 * XXX 104 * XXX
98 * the DS3232 likely has the temperature sensor too but I can't 105 * the DS3232 likely has the temperature sensor too but I can't

cvs diff -r1.6 -r1.7 src/sys/dev/i2c/ds1307reg.h (expand / switch to unified diff)

--- src/sys/dev/i2c/ds1307reg.h 2016/04/05 10:53:16 1.6
+++ src/sys/dev/i2c/ds1307reg.h 2016/10/04 15:06:59 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ds1307reg.h,v 1.6 2016/04/05 10:53:16 bouyer Exp $ */ 1/* $NetBSD: ds1307reg.h,v 1.7 2016/10/04 15:06:59 kiyohara Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc. 7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -55,26 +55,30 @@ @@ -55,26 +55,30 @@
55 55
56#define DS1307_CONTROL 0x07 56#define DS1307_CONTROL 0x07
57#define DS1307_RTC_START 0 57#define DS1307_RTC_START 0
58#define DS1307_RTC_SIZE DSXXXX_RTC_SIZE 58#define DS1307_RTC_SIZE DSXXXX_RTC_SIZE
59#define DS1307_NVRAM_START 0x08 59#define DS1307_NVRAM_START 0x08
60#define DS1307_NVRAM_SIZE 0x38 60#define DS1307_NVRAM_SIZE 0x38
61 61
62#define DS1339_CONTROL 0x0e 62#define DS1339_CONTROL 0x0e
63#define DS1339_RTC_START 0 63#define DS1339_RTC_START 0
64#define DS1339_RTC_SIZE DSXXXX_RTC_SIZE 64#define DS1339_RTC_SIZE DSXXXX_RTC_SIZE
65#define DS1339_NVRAM_START 0 65#define DS1339_NVRAM_START 0
66#define DS1339_NVRAM_SIZE 0 66#define DS1339_NVRAM_SIZE 0
67 67
 68#define DS1340_RTC_START 0
 69#define DS1340_RTC_SIZE DSXXXX_RTC_SIZE
 70#define DS1340_SECONDS_EOSC (1 << 7) /* Clock Hold */
 71
68#define DS1672_CNTR1 0x00 72#define DS1672_CNTR1 0x00
69#define DS1672_CNTR2 0x01 73#define DS1672_CNTR2 0x01
70#define DS1672_CNTR3 0x02 74#define DS1672_CNTR3 0x02
71#define DS1672_CNTR4 0x03 75#define DS1672_CNTR4 0x03
72#define DS1672_CONTROL 0x04 76#define DS1672_CONTROL 0x04
73#define DS1672_CONTROL_CH (1 << 7) /* clock hold */ 77#define DS1672_CONTROL_CH (1 << 7) /* clock hold */
74#define DS1672_TRICKLE 0x05 78#define DS1672_TRICKLE 0x05
75 79
76#define DS1672_RTC_START 0 80#define DS1672_RTC_START 0
77#define DS1672_RTC_SIZE 4 81#define DS1672_RTC_SIZE 4
78#define DS1672_NVRAM_START 0 82#define DS1672_NVRAM_START 0
79#define DS1672_NVRAM_SIZE 0 83#define DS1672_NVRAM_SIZE 0
80 84