xref: /freebsd/share/man/man4/ds1307.4 (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1.\"
2.\" Copyright (c) 2015 Luiz Otavio O Souza <loos@freebsd.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd March 7, 2015
28.Dt DS1307 4
29.Os
30.Sh NAME
31.Nm ds1307
32.Nd 64 x 8, serial, i2c real-time clock
33.Sh SYNOPSIS
34.Cd "device iic"
35.Cd "device iicbus"
36.Cd "device ds1307"
37.Sh DESCRIPTION
38The
39.Nm
40serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD)
41clock/calendar plus 56 bytes of NV SRAM.
42.Pp
43The
44.Nm
45has a built-in power-sense circuit that detects power failures and
46automatically switches to the backup supply.
47Timekeeping operation continues while the part operates from the backup supply.
48.Pp
49Access to
50.Nm
51settings is made with the
52.Xr sysctl 8
53interface:
54.Bd -literal
55dev.ds1307.0.%desc: Maxim DS1307 RTC
56dev.ds1307.0.%driver: ds1307
57dev.ds1307.0.%location: addr=0xd0
58dev.ds1307.0.%pnpinfo: name=rtc compat=maxim,ds1307
59dev.ds1307.0.%parent: iicbus1
60dev.ds1307.0.sqwe: 1
61dev.ds1307.0.sqw_freq: 32768
62dev.ds1307.0.sqw_out: 0
63.Ed
64.Bl -tag -width ".Va dev.ds1307.%d.sqw_freq"
65.It Va dev.ds1307.%d.sqwe
66If set to 1, the SQW pin drives a square-wave of
67.Va dev.ds1307.%d.sqw_freq
68frequency.
69If set to 0, the output level of SQW pin is controlled by
70.Va dev.ds1307.%d.sqw_out .
71.It Va dev.ds1307.%d.sqw_freq
72Select the frequency of the SQW pin when the square-wave output is enabled on
73.Va dev.ds1307.%d.sqwe .
74It can be set to 1, 4096, 8192 and 32768.
75.It Va dev.ds1307.%d.sqw_out
76Set the output level of the SQW pin when
77.Va dev.ds1307.%d.sqwe
78is set to 0.
79.El
80.Pp
81Please check the
82.Nm
83datasheet for more details.
84.Pp
85On a
86.Xr device.hints 5
87based system, such as
88.Li MIPS ,
89these values are configurable for
90.Nm :
91.Bl -tag -width ".Va hint.ds1307.%d.addr"
92.It Va hint.ds1307.%d.at
93The
94.Xr iicbus 4
95that the
96.Nm
97is connected to.
98.It Va hint.ds1307.%d.addr
99The i2c address of
100.Nm .
101.El
102.Pp
103On a
104.Xr FDT 4
105based system the following properties must be set:
106.Bl -tag -width ".Va compatible"
107.It Va compatible
108Must always be set to "dallas,ds1307" or "maxim,ds1307".
109.It Va reg
110The i2c address of
111.Nm .
112The default address for
113.Nm
114is 0xd0.
115.El
116.Sh SEE ALSO
117.Xr fdt 4 ,
118.Xr iic 4 ,
119.Xr iicbus 4 ,
120.Xr sysctl 8
121.Sh HISTORY
122The
123.Nm
124driver first appeared in
125.Fx 11.0 .
126.Sh AUTHORS
127.An -nosplit
128The
129.Nm
130driver and this manual page were written by
131.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org .
132