1 .\" $NetBSD: mk48txx.4,v 1.15 2008/04/30 13:10:54 martin Exp $
3 .\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Paul Kranenburg.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
37 time-of-day clock driver
39 .In dev/ic/mk48txxreg.h
40 .In dev/ic/mk48txxvar.h
42 .Cd "file dev/ic/mk48txx.c mk48txx"
46 driver provides access to several models of
48 time-of-day clock chips.
49 Access methods to retrieve and set date and time
50 are provided through the
55 To tie an instance of this device to the system, use the
57 function and the mk48txx_softc structure defined as follows:
60 .Fn mk48txx_attach "struct mk48txx_softc *"
63 typedef uint8_t (*mk48txx_nvrd_t)(struct mk48txx_softc *, int off);
64 typedef void (*mk48txx_nvwr_t)(struct mk48txx_softc *, int off,
68 struct mk48txx_softc {
70 bus_space_tag_t sc_bst;
71 bus_space_handle_t sc_bsh;
72 struct todr_chip_handle sc_handle;
74 bus_size_t sc_nvramsz;
75 bus_size_t sc_clkoffset;
78 mk48txx_nvrd_t sc_nvrd;
79 mk48txx_nvwr_t sc_nvwr;
83 .Bl -tag -width Dv -offset indent
86 Specify bus space access to the chip's non-volatile memory
87 .Pq including the clock registers .
89 TODR handle passed to the
95 The chip model which this instance should serve.
103 Size of non-volatile RAM in the
109 Offset into the control registers of the
115 The actual year represented by the clock's
118 This is generally dependent on the system configuration in which
119 the clock device is mounted.
122 machines the convention is to have clock's two-digit year represent
125 This flag is used to specify machine-dependent features.
128 Specify alternate access methods for reading resp. writing clock
132 is passed as an access method, is to access the chip memory
133 .Pq and clock registers
134 as if they were direct-mapped with using the specified bus space.
136 Otherwise, the driver will call the respective function to perform the
137 access, passing it the specified bus space and the offset
140 .Pq or clock register
141 location to be read from or written to, respectively.
144 Note that if the resulting date retrieved with the todr_gettime() method
145 is earlier that January 1, 1970, the driver will assume that the chip's
146 year counter actually represents a year in the 21st century.
147 This behaviour can be overridden by setting the
148 .Va MK48TXX_NO_CENT_ADJUST
152 The following models are supported:
154 .Bl -tag -width indent -offset indent -compact
155 .It Tn Mostek MK48T02
156 .It Tn Mostek MK48T08
157 .It Tn Mostek MK48T18
158 .It Tn Mostek MK48T59
166 driver first appeared in
171 driver was written by