1/*	$NetBSD: mk48txxvar.h,v 1.6 2008/04/28 20:23:50 martin Exp $ */
2/*-
3 * Copyright (c) 2000 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Paul Kranenburg.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
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.
17 *
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.
29 */
30
31struct mk48txx_softc;
32
33typedef uint8_t (*mk48txx_nvrd_t)(struct mk48txx_softc *, int);
34typedef void (*mk48txx_nvwr_t)(struct mk48txx_softc *, int, uint8_t);
35
36struct mk48txx_softc {
37	device_t	sc_dev;
38
39	bus_space_tag_t sc_bst;		/* bus tag & handle */
40	bus_space_handle_t sc_bsh;	/* */
41
42	struct todr_chip_handle sc_handle; /* TODR handle */
43	const char	*sc_model;	/* chip model name */
44	bus_size_t	sc_nvramsz;	/* Size of NVRAM on the chip */
45	bus_size_t	sc_clkoffset;	/* Offset in NVRAM to clock bits */
46	u_int		sc_year0;	/* What year is represented on
47					   the system by the chip's year
48					   counter at 0 */
49	u_int		sc_flag;
50#define MK48TXX_NO_CENT_ADJUST	0x0001
51#define MK48TXX_HAVE_CENT_REG	0x0002
52
53	mk48txx_nvrd_t	sc_nvrd;	/* NVRAM/RTC read function */
54	mk48txx_nvwr_t	sc_nvwr;	/* NVRAM/RTC write function */
55};
56
57/* Chip attach function */
58void mk48txx_attach(struct mk48txx_softc *);
59
60/* Retrieve size of the on-chip NVRAM area */
61int	mk48txx_get_nvram_size(todr_chip_handle_t, bus_size_t *);
62