Home | History | Annotate | Line # | Download | only in ic
pcf8584var.h revision 1.4
      1 /*	$NetBSD: pcf8584var.h,v 1.4 2010/02/28 11:47:28 martin Exp $	*/
      2 /*	$OpenBSD: pcf8584var.h,v 1.5 2007/10/20 18:46:21 kettenis Exp $ */
      3 
      4 /*
      5  * Copyright (c) 2006 David Gwynne <dlg (at) openbsd.org>
      6  *
      7  * Permission to use, copy, modify, and distribute this software for any
      8  * purpose with or without fee is hereby granted, provided that the above
      9  * copyright notice and this permission notice appear in all copies.
     10  *
     11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  */
     19 
     20 struct pcfiic_softc {
     21 	device_t		sc_dev;
     22 
     23 	bus_space_tag_t		sc_iot;
     24 	bus_space_handle_t	sc_ioh;
     25 	bus_space_handle_t	sc_ioh2;
     26 	int			sc_master;
     27 	u_int8_t		sc_addr;
     28 	u_int8_t		sc_clock;
     29 	u_int8_t		sc_regmap[2];
     30 
     31 	int			sc_poll;
     32 
     33 	struct i2c_controller	sc_i2c;
     34 	krwlock_t		sc_lock;
     35 };
     36 
     37 /* clock divisor settings */
     38 #define PCF_CLOCK_3		0x00 /* 3 MHz */
     39 #define PCF_CLOCK_4_43		0x10 /* 4.43 MHz */
     40 #define PCF_CLOCK_6		0x14 /* 6 MHz */
     41 #define PCF_CLOCK_8		0x18 /* 8 MHz */
     42 #define PCF_CLOCK_12		0x1c /* 12 MHz */
     43 
     44 /* SCL frequency settings */
     45 #define PCF_FREQ_90		0x00 /* 90 kHz */
     46 #define PCF_FREQ_45		0x01 /* 45 kHz */
     47 #define PCF_FREQ_11		0x02 /* 11 kHz */
     48 #define PCF_FREQ_1_5		0x03 /* 1.5 kHz */
     49 
     50 void	pcfiic_attach(struct pcfiic_softc *, i2c_addr_t, u_int8_t, int);
     51 int	pcfiic_intr(void *);
     52