1 1.6 thorpej /* $NetBSD: gttwsivar.h,v 1.6 2020/01/12 17:48:42 thorpej Exp $ */ 2 1.1 matt /* 3 1.1 matt * Copyright (c) 2008 Eiji Kawauchi. 4 1.1 matt * All rights reserved. 5 1.1 matt * 6 1.1 matt * Redistribution and use in source and binary forms, with or without 7 1.1 matt * modification, are permitted provided that the following conditions 8 1.1 matt * are met: 9 1.1 matt * 1. Redistributions of source code must retain the above copyright 10 1.1 matt * notice, this list of conditions and the following disclaimer. 11 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright 12 1.1 matt * notice, this list of conditions and the following disclaimer in the 13 1.1 matt * documentation and/or other materials provided with the distribution. 14 1.1 matt * 3. All advertising materials mentioning features or use of this software 15 1.1 matt * must display the following acknowledgement: 16 1.1 matt * This product includes software developed for the NetBSD Project by 17 1.1 matt * Eiji Kawauchi. 18 1.1 matt * 4. The name of the author may not be used to endorse or promote products 19 1.1 matt * derived from this software without specific prior written permission 20 1.1 matt * 21 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 1.1 matt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 1.1 matt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 1.1 matt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 1.1 matt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 1.1 matt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 1.1 matt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 1.1 matt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 1.1 matt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 1.1 matt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 1.1 matt */ 32 1.1 matt /* 33 1.1 matt * Copyright (c) 2005 Brocade Communcations, inc. 34 1.1 matt * All rights reserved. 35 1.1 matt * 36 1.1 matt * Written by Matt Thomas for Brocade Communcations, Inc. 37 1.1 matt * 38 1.1 matt * Redistribution and use in source and binary forms, with or without 39 1.1 matt * modification, are permitted provided that the following conditions 40 1.1 matt * are met: 41 1.1 matt * 1. Redistributions of source code must retain the above copyright 42 1.1 matt * notice, this list of conditions and the following disclaimer. 43 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright 44 1.1 matt * notice, this list of conditions and the following disclaimer in the 45 1.1 matt * documentation and/or other materials provided with the distribution. 46 1.1 matt * 3. The name of Brocade Communications, Inc. may not be used to endorse 47 1.1 matt * or promote products derived from this software without specific prior 48 1.1 matt * written permission. 49 1.1 matt * 50 1.1 matt * THIS SOFTWARE IS PROVIDED BY BROCADE COMMUNICATIONS, INC. ``AS IS'' AND 51 1.1 matt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 1.1 matt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 1.1 matt * ARE DISCLAIMED. IN NO EVENT SHALL EITHER BROCADE COMMUNICATIONS, INC. BE 54 1.1 matt * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 55 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 56 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 57 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 58 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 59 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 60 1.1 matt * OF THE POSSIBILITY OF SUCH DAMAGE. 61 1.1 matt */ 62 1.1 matt 63 1.1 matt #ifndef _DEV_MARVELL_GTTWSIVAR_H_ 64 1.1 matt #define _DEV_MARVELL_GTTWSIVAR_H_ 65 1.1 matt 66 1.1 matt /* 67 1.1 matt * Marvell Two-Wire Serial Interface (aka I2C) master driver 68 1.1 matt */ 69 1.1 matt 70 1.1 matt #include <sys/param.h> 71 1.1 matt #include <sys/bus.h> 72 1.1 matt #include <sys/condvar.h> 73 1.1 matt #include <sys/device.h> 74 1.1 matt #include <sys/errno.h> 75 1.1 matt #include <sys/kernel.h> 76 1.1 matt #include <sys/mutex.h> 77 1.1 matt #include <sys/systm.h> 78 1.1 matt 79 1.1 matt #include <dev/i2c/i2cvar.h> 80 1.1 matt 81 1.1 matt struct gttwsi_softc { 82 1.1 matt device_t sc_dev; 83 1.1 matt bus_space_tag_t sc_bust; 84 1.1 matt bus_space_handle_t sc_bush; 85 1.1 matt bool sc_started; 86 1.1 matt struct i2c_controller sc_i2c; 87 1.1 matt kmutex_t sc_buslock; 88 1.1 matt kmutex_t sc_mtx; 89 1.1 matt kcondvar_t sc_cv; 90 1.2 jmcneill 91 1.6 thorpej const bus_size_t *sc_regmap; /* GTTWSI_NREGS entries */ 92 1.6 thorpej 93 1.2 jmcneill bool sc_iflg_rwc; 94 1.1 matt }; 95 1.1 matt 96 1.6 thorpej void gttwsi_attach_subr(device_t, bus_space_tag_t, bus_space_handle_t, 97 1.6 thorpej const bus_size_t *); 98 1.1 matt void gttwsi_config_children(device_t); 99 1.1 matt 100 1.6 thorpej uint32_t gttwsi_read_4(struct gttwsi_softc *, uint32_t); 101 1.6 thorpej void gttwsi_write_4(struct gttwsi_softc *, uint32_t, uint32_t); 102 1.6 thorpej 103 1.1 matt int gttwsi_intr(void *); 104 1.1 matt 105 1.1 matt #endif /* _DEV_MARVELL_GTTSWI_VAR_H_ */ 106