2003-11-02 12:08:16 +03:00
|
|
|
.\" $NetBSD: mk48txx.4,v 1.13 2003/11/02 09:08:16 wiz Exp $
|
2000-07-26 01:02:54 +04:00
|
|
|
.\"
|
2002-02-26 02:21:15 +03:00
|
|
|
.\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
|
2000-07-26 01:02:54 +04:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Paul Kranenburg.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2003-11-02 07:20:04 +03:00
|
|
|
.Dd November 1, 2003
|
2000-07-26 01:02:54 +04:00
|
|
|
.Dt MK48TXX 4
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm mk48txx
|
|
|
|
.Nd
|
2003-11-02 12:08:16 +03:00
|
|
|
.Tn Mostek
|
|
|
|
time-of-day clock driver
|
2000-07-26 01:02:54 +04:00
|
|
|
.Sh SYNOPSIS
|
2003-04-16 17:34:34 +04:00
|
|
|
.In dev/ic/mk48txxreg.h
|
2003-11-02 07:20:04 +03:00
|
|
|
.In dev/ic/mk48txxvar.h
|
2000-07-26 01:02:54 +04:00
|
|
|
.Cd "define mk48txx"
|
|
|
|
.Cd "file dev/ic/mk48txx.c mk48txx"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver provides access to several models of
|
2002-01-21 20:49:23 +03:00
|
|
|
.Tn Mostek
|
2003-06-27 22:36:20 +04:00
|
|
|
time-of-day clock chips.
|
|
|
|
Access methods to retrieve and set date and time
|
2000-07-26 01:02:54 +04:00
|
|
|
are provided through the
|
|
|
|
.Em TODR
|
|
|
|
interface defined in
|
|
|
|
.Xr todr 9 .
|
|
|
|
.Pp
|
2003-11-02 12:08:16 +03:00
|
|
|
To tie an instance of this device to the system, use the
|
|
|
|
.Fn mk48txx_attach
|
|
|
|
function and the mk48txx_softc structure defined as follows:
|
2003-11-02 07:20:04 +03:00
|
|
|
.Pp
|
|
|
|
.nr nS 1
|
|
|
|
.Ft "void"
|
|
|
|
.Fn mk48txx_attach "struct mk48txx_softc"
|
|
|
|
.Pp
|
2002-02-26 02:21:15 +03:00
|
|
|
.Bd -literal
|
2003-11-02 07:20:04 +03:00
|
|
|
typedef uint8_t (*mk48txx_nvrd_t)(struct mk48txx_softc, int off);
|
|
|
|
typedef void (*mk48txx_nvwr_t)(struct mk48txx_softc, int off,
|
|
|
|
uint8_t datum);
|
|
|
|
.Ed
|
|
|
|
.Bd -literal
|
|
|
|
struct mk48txx_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
bus_space_tag_t sc_bst;
|
|
|
|
bus_space_handle_t sc_bsh;
|
|
|
|
struct todr_chip_handle sc_handle;
|
|
|
|
const char *sc_model;
|
|
|
|
bus_size_t sc_nvramsz;
|
|
|
|
bus_size_t sc_clkoffset;
|
|
|
|
u_int sc_year0;
|
|
|
|
u_int sc_flag;
|
|
|
|
mk48txx_nvrd_t sc_nvrd;
|
|
|
|
mk48txx_nvwr_t sc_nvwr;
|
|
|
|
};
|
2002-02-26 02:21:15 +03:00
|
|
|
.Ed
|
2000-07-26 01:02:54 +04:00
|
|
|
.Pp
|
2002-02-07 06:15:06 +03:00
|
|
|
.Bl -tag -width Dv -offset indent
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_bst
|
|
|
|
.It Fa sc_bsh
|
2000-07-26 01:02:54 +04:00
|
|
|
Specify bus space access to the chip's non-volatile memory
|
|
|
|
.Pq including the clock registers .
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_handle
|
2003-11-02 12:08:16 +03:00
|
|
|
TODR handle passed to the
|
2003-11-02 07:20:04 +03:00
|
|
|
.Fn todr_attach
|
|
|
|
function to register
|
|
|
|
.Xr todr 9
|
|
|
|
interface.
|
|
|
|
.It Fa sc_model
|
2003-06-27 22:36:20 +04:00
|
|
|
The chip model which this instance should serve.
|
|
|
|
Must be one of
|
2000-07-26 01:02:54 +04:00
|
|
|
.Dq mk48t02 ,
|
2002-01-21 21:48:31 +03:00
|
|
|
.Dq mk48t08 ,
|
2003-11-02 12:08:16 +03:00
|
|
|
.Dq mk48t18 ,
|
2000-07-26 01:02:54 +04:00
|
|
|
or
|
|
|
|
.Dq mk48t59 .
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_nvramsz
|
2003-11-02 12:08:16 +03:00
|
|
|
Size of non-volatile RAM in the
|
|
|
|
.Tn Mostek
|
|
|
|
chip.
|
|
|
|
This value is set by
|
|
|
|
.Fn mk48txx_attach .
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_clkoffset
|
2003-11-02 12:08:16 +03:00
|
|
|
Offset into the control registers of the
|
|
|
|
.Tn Mostek
|
|
|
|
chip.
|
|
|
|
This value is set by
|
|
|
|
.Fn mk48txx_attach .
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_year0
|
2000-07-26 01:02:54 +04:00
|
|
|
The actual year represented by the clock's
|
|
|
|
.Sq year
|
2003-06-27 22:36:20 +04:00
|
|
|
counter.
|
|
|
|
This is generally dependent on the system configuration in which
|
|
|
|
the clock device is mounted.
|
2003-11-02 12:08:16 +03:00
|
|
|
For instance, on
|
|
|
|
.Tn Sun Microsystems
|
|
|
|
machines the convention is to have clock's two-digit year represent
|
|
|
|
the year 1968.
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_flag
|
2003-11-02 12:08:16 +03:00
|
|
|
This flag is used to specify machine-dependent features.
|
2003-11-02 07:20:04 +03:00
|
|
|
.It Fa sc_nvread
|
|
|
|
.It Fa sc_nvwrite
|
2002-02-26 02:21:15 +03:00
|
|
|
Specify alternate access methods for reading resp. writing clock
|
2003-06-27 22:36:20 +04:00
|
|
|
device registers.
|
|
|
|
The default, when
|
2002-02-26 02:21:15 +03:00
|
|
|
.Dv NULL
|
|
|
|
is passed as an access method, is to access the chip memory
|
|
|
|
.Pq and clock registers
|
|
|
|
as if they were direct-mapped with using the specified bus space.
|
|
|
|
.Pp
|
|
|
|
Otherwise, the driver will call the respective function to perform the
|
|
|
|
access, passing it the specified bus space and the offset
|
|
|
|
.Va off
|
|
|
|
of the chip memory
|
|
|
|
.Pq or clock register
|
|
|
|
location to be read from or written to, respectively.
|
2000-07-26 01:02:54 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Note that if the resulting date retrieved with the todr_gettime() method
|
|
|
|
is earlier that January 1, 1970, the driver will assume that the chip's
|
2003-06-27 22:36:20 +04:00
|
|
|
year counter actually represents a year in the 21st century.
|
2003-11-02 12:08:16 +03:00
|
|
|
This behaviour can be overridden by setting the
|
2003-11-02 07:20:04 +03:00
|
|
|
.Va MK48TXX_NO_CENT_ADJUST
|
|
|
|
flag in
|
|
|
|
.Fa sc_flag .
|
2000-07-26 01:02:54 +04:00
|
|
|
.Sh HARDWARE
|
|
|
|
The following models are supported:
|
|
|
|
.Pp
|
2002-02-07 06:15:06 +03:00
|
|
|
.Bl -tag -width indent -offset indent -compact
|
2000-07-26 01:02:54 +04:00
|
|
|
.It Tn Mostek MK48T02
|
|
|
|
.It Tn Mostek MK48T08
|
2002-01-21 21:48:31 +03:00
|
|
|
.It Tn Mostek MK48T18
|
2000-07-26 01:02:54 +04:00
|
|
|
.It Tn Mostek MK48T59
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr intro 4 ,
|
2001-09-22 05:34:47 +04:00
|
|
|
.Xr todr 9
|
2000-07-26 01:02:54 +04:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm mk48txx
|
|
|
|
driver first appeared in
|
|
|
|
.Nx 1.5 .
|
2001-09-22 05:34:47 +04:00
|
|
|
.Sh AUTHORS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver was written by
|
|
|
|
.An Paul Kranenburg
|
2003-02-14 18:20:17 +03:00
|
|
|
.Aq pk@NetBSD.org .
|