NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/44687: patch to support the NXP PCA9544A I2C bus multiplxer
>Number: 44687
>Category: kern
>Synopsis: patch to support the NXP PCA9544A I2C bus multiplxer
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Mar 05 11:45:00 +0000 2011
>Originator: Jasper Wallace
>Release: 5.99.45
>Organization:
Pointless.net
>Environment:
NetBSD monstrosity 5.99.45 NetBSD 5.99.45 (MONSTROSITY) #30: Sat Mar 5
08:33:13 GMT 2011
jasper@limpit:/home/jasper/develop/netbsd/netbsd-src-and-build/tree/l.64/obj/sys/arch/amd64/compile/MONSTROSITY
amd64
>Description:
The Tyan S3992 has 2 i2c buses, access to which are switched by an NXP PCA9544A
I2C bus multiplxer which we don't support.
>How-To-Repeat:
Obtain a Tyan S3992. Be filled with a irrational urge to support all the
devices on it's SMBus.
>Fix:
If the patch is mangled you can also find it here:
http://pointless.net/~jasper/S3992-patches/iicmux.patch
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/sys/dev/i2c/iicmux.c 2011-03-05 08:32:52.000000000 +0000
@@ -0,0 +1,152 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2011 Jasper Wallace
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JASPER WALLACE
+ * ``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 JASPER WALLACE
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/rwlock.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/errno.h>
+
+#include <sys/bus.h>
+#include <dev/i2c/i2cvar.h>
+#include <dev/i2c/iicmuxreg.h>
+#include <dev/i2c/iicmuxvar.h>
+#include <dev/i2c/iicmuxchanvar.h>
+
+#include "locators.h"
+
+/*
+ * Driver for the PCA9544A quad i2c bus multiplexer/switch
+ */
+
+static int iicmux_match(device_t, cfdata_t, void *);
+static void iicmux_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(iicmux, sizeof (struct iicmux_softc),
+ iicmux_match, iicmux_attach, NULL, NULL);
+
+static int iicmux_search(device_t parent, cfdata_t cf, const int *ldesc, void
* aux);
+static int iicmux_print(void * aux, const char *pnp);
+
+static int
+iicmux_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct i2c_attach_args *ia = aux;
+ struct iicmuxchan_softc *psc = NULL;
+ struct iicmux_softc *ppsc = NULL;
+
+ /* check that the parent's parent isn't an instance of iicmuxchan,
+ * this stops us recursivly attaching to ourself.
+ * Check that the chanel's parents address isn't the same as ours.
+ */
+ if (strstr(parent->dv_parent->dv_xname, "iicmuxchan") ==
parent->dv_parent->dv_xname) {
+ psc = device_private(parent->dv_parent);
+ ppsc = device_private(psc->parent);
+
+ if (ia->ia_addr == ppsc->sc_address)
+ {
+ return 0;
+ }
+ }
+
+ /* not much to probe for, so just check the address is possible */
+ if ((ia->ia_addr & IICMUX_ADDRMASK) == IICMUX_ADDR)
+ return 1;
+ return 0;
+}
+
+static void
+iicmux_attach(device_t parent, device_t self, void *aux)
+{
+ struct iicmux_softc *sc = device_private(self);
+ struct i2c_attach_args *ia = aux;
+ uint8_t current = 0;
+ int ret;
+
+ sc->sc_address = ia->ia_addr;
+ sc->sc_tag = ia->ia_tag;
+ sc->bus_type = ia->ia_type;
+
+ rw_init(&sc->sc_rwlock);
+
+ iic_acquire_bus(sc->sc_tag, 0);
+ ret = iic_smbus_receive_byte(sc->sc_tag, sc->sc_address, ¤t, 0);
+ iic_release_bus(sc->sc_tag, 0);
+
+ sc->current = (current & IICMUX_CHANMASK) - 4;
+
+ aprint_naive(": current channel: %d\n", sc->current);
+ aprint_normal(": current channel: %d\n", sc->current);
+
+ config_search_ia(iicmux_search, self, "iicmux", NULL);
+}
+
+static int
+iicmux_print(void * aux, const char *pnp)
+{
+ struct iicmux_attach_args *ia = aux;
+
+ aprint_normal(" channel %d", ia->channel);
+
+ return(UNCONF);
+}
+
+static int
+iicmux_search(device_t parent, cfdata_t cf, const int *ldesc, void * aux)
+{
+ struct iicmux_attach_args ia;
+
+ ia.channel = cf->cf_loc[IICMUXCF_CHANNEL];
+
+ if (config_match(parent, cf, &ia) > 0)
+ config_attach(parent, cf, &ia, iicmux_print);
+
+ return 0;
+}
+
+int iicmux_switchto(device_t self, int channel)
+{
+ struct iicmux_softc *sc = device_private(self);
+ int ret;
+
+ /*
+ * the child bus must aquire the (parent) bus before calling us
+ * also we should be locked.
+ */
+ KASSERT(rw_write_held(&sc->sc_rwlock));
+
+ ret = iic_smbus_send_byte(sc->sc_tag, sc->sc_address, channel + 4, 0);
+ sc->current = channel;
+
+ return ret;
+}
+
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/sys/dev/i2c/iicmuxchan.c 2011-03-05 08:30:57.000000000 +0000
@@ -0,0 +1,167 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2011 Jasper Wallace
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JASPER WALLACE
+ * ``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 JASPER WALLACE
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <sys/rwlock.h>
+#include <sys/bus.h>
+#include <sys/intr.h>
+
+#include <dev/i2c/i2cvar.h>
+#include <dev/i2c/iicmuxchanvar.h>
+#include <dev/i2c/iicmuxvar.h>
+
+static int iicmuxchan_match(device_t, cfdata_t, void *);
+static void iicmuxchan_attach(device_t, device_t, void *);
+
+static int iicmuxchan_acquire_bus(void *, int);
+static void iicmuxchan_release_bus(void *, int);
+static int iicmuxchan_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
+ void *, size_t, int);
+
+static const struct i2c_controller iicmuxchancontroller = {
+ .ic_acquire_bus = iicmuxchan_acquire_bus,
+ .ic_release_bus = iicmuxchan_release_bus,
+ .ic_exec = iicmuxchan_exec,
+};
+
+CFATTACH_DECL_NEW(iicmuxchan, sizeof (struct iicmuxchan_softc),
+ iicmuxchan_match, iicmuxchan_attach, NULL, NULL);
+
+static int
+iicmuxchan_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct iicmux_attach_args *ia = aux;
+
+ // not much to match on.
+ if (ia->channel < 0 || ia->channel > 3)
+ return 0;
+
+ return 1;
+}
+
+void
+iicmuxchan_attach(device_t parent, device_t self, void *aux)
+{
+ struct iicmuxchan_softc *sc = device_private(self);
+ struct iicmux_attach_args *ia = aux;
+ struct i2cbus_attach_args iba;
+ struct iicmux_softc * psc = device_private(parent);
+
+ rw_init(&sc->sc_rwlock);
+
+ sc->channel = ia->channel;
+ sc->parent = parent;
+ sc->sc_i2c = iicmuxchancontroller;
+ sc->sc_i2c.ic_cookie = sc;
+
+ memset(&iba, 0, sizeof(iba));
+ iba.iba_type = psc->bus_type; /* The parents bus type */
+ iba.iba_tag = &sc->sc_i2c;
+
+ aprint_naive("\n");
+ aprint_normal("\n");
+
+ config_found_ia(self, "i2cbus", &iba, iicbus_print);
+}
+
+static int
+iicmuxchan_acquire_bus(void *v, int flags)
+{
+ struct iicmuxchan_softc * const sc = v;
+ struct iicmux_softc * psc = device_private(sc->parent);
+ int ret;
+
+ /* XXX do something with flags == I2C_F_POLL */
+ rw_enter(&sc->sc_rwlock, RW_WRITER);
+
+ /* lock the parent bus */
+ ret = iic_acquire_bus(psc->sc_tag, flags);
+
+ if (ret != 0)
+ {
+ /* if ret then we failed to acquire the parents lock
+ * above and so we don't need to release it.
+ */
+ rw_exit(&sc->sc_rwlock);
+ return ret;
+ }
+
+ /* acquire our parent device lock */
+ rw_enter(&psc->sc_rwlock, RW_WRITER);
+
+ /* are we already on the right channel? */
+ if (psc->current != sc->channel)
+ {
+ iicmux_switchto(sc->parent, sc->channel);
+ }
+
+ return 0;
+}
+
+static void
+iicmuxchan_release_bus(void *v, int flags)
+{
+ struct iicmuxchan_softc * const sc = v;
+ struct iicmux_softc * psc = device_private(sc->parent);
+
+ rw_exit(&sc->sc_rwlock);
+ /* release parent bus */
+ iic_release_bus(psc->sc_tag, flags);
+ /* and parent device */
+ rw_exit(&psc->sc_rwlock);
+}
+
+int
+iicmuxchan_exec(void *v, i2c_op_t op, i2c_addr_t addr,
+ const void *cmdbuf, size_t cmdlen,
+ void *databuf, size_t datalen,
+ int flags)
+{
+ struct iicmuxchan_softc * const sc = v;
+ struct iicmux_softc * psc = device_private(sc->parent);
+ int ret;
+
+ KASSERT(rw_write_held(&sc->sc_rwlock));
+ KASSERT(rw_write_held(&psc->sc_rwlock));
+
+ /* this can trigger if a device on the bus dosn't acquire the
+ * bus before trying to use it.
+ */
+ KASSERT(psc->current == sc->channel);
+
+ /* fire it off using the parents bus tag. */
+ ret = iic_exec(psc->sc_tag, op, addr, cmdbuf, cmdlen, databuf, datalen,
+ flags);
+
+ return ret;
+}
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/sys/dev/i2c/iicmuxchanvar.h 2011-03-05 03:57:56.000000000 +0000
@@ -0,0 +1,50 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2011 Jasper Wallace
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JASPER WALLACE
+ * ``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 JASPER WALLACE
+ * 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.
+ */
+
+#ifndef _DEV_I2C_IICMUXCHANVAR_H_
+#define _DEV_I2C_IICMUXCHANVAR_H_
+
+#include <dev/i2c/i2cvar.h>
+#include <sys/rwlock.h>
+
+struct iicmuxchan_softc {
+ device_t sc_dev;
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+
+ struct i2c_controller sc_i2c;
+
+ krwlock_t sc_rwlock;
+
+ int channel;
+ device_t parent; /* the actual controller */
+};
+
+void iicmuxchan_attach_common(device_t, struct iicmuxchan_softc *);
+
+#endif /* !_DEV_I2C_IICMUXCHANVAR_H_ */
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/sys/dev/i2c/iicmuxreg.h 2011-03-05 03:57:55.000000000 +0000
@@ -0,0 +1,47 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2011 Jasper Wallace
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JASPER WALLACE
+ * ``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 JASPER WALLACE
+ * 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.
+ */
+
+#ifndef _DEV_I2C_IICMUXREG_H_
+#define _DEV_I2C_IICMUXREG_H_
+
+/*
+ * PCA9544A has bottom 3 address bits vairable, top 4 are 1110
+ */
+
+#define IICMUX_ADDR 0x70
+#define IICMUX_ADDRMASK 0x78
+
+#define IICMUX_CHAN0 4
+#define IICMUX_CHAN1 5
+#define IICMUX_CHAN2 6
+#define IICMUX_CHAN3 7
+
+#define IICMUX_CHANMASK 7
+#define IICMUX_INTMASK 0xf
+
+#endif /* _DEV_I2C_IICMUXREG_H_ */
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/sys/dev/i2c/iicmuxvar.h 2011-03-05 08:24:49.000000000 +0000
@@ -0,0 +1,53 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2011 Jasper Wallace
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JASPER WALLACE
+ * ``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 JASPER WALLACE
+ * 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.
+ */
+
+#ifndef _DEV_I2C_IICMUXVAR_H_
+#define _DEV_I2C_IICMUXVAR_H_
+
+
+#include <dev/i2c/i2cvar.h>
+#include <sys/rwlock.h>
+
+struct iicmux_attach_args {
+ int channel;
+};
+
+struct iicmux_softc {
+ device_t sc_dev;
+ i2c_tag_t sc_tag;
+ i2c_addr_t sc_address;
+
+ int current; /* the current channel */
+ int bus_type; /* type of i2c bus */
+
+ krwlock_t sc_rwlock; /* lock for the sub busses, sort of. */
+};
+
+int iicmux_switchto(device_t, int);
+
+#endif /* !_DEV_I2C_IICMUXVAR_H_ */
Index: src/sys/dev/i2c/files.i2c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/files.i2c,v
retrieving revision 1.33
diff -u -u -r1.33 files.i2c
--- src/sys/dev/i2c/files.i2c 14 Feb 2011 08:50:39 -0000 1.33
+++ src/sys/dev/i2c/files.i2c 5 Mar 2011 08:58:05 -0000
@@ -150,3 +150,14 @@
device ibmhawk: sysmon_envsys
attach ibmhawk at iic
file dev/i2c/ibmhawk.c ibmhawk
+
+# PCA9544A i2c bus multiplexer
+device iicmux {[channel = -1]}
+attach iicmux at iic
+file dev/i2c/iicmux.c iicmux
+
+# the channel we're multiplexing
+device iicmuxchan: i2cbus
+attach iicmuxchan at iicmux
+file dev/i2c/iicmuxchan.c iicmuxchan needs-flag
+
Index: src/share/man/man4/Makefile
===================================================================
RCS file: /cvsroot/src/share/man/man4/Makefile,v
retrieving revision 1.548
diff -u -u -r1.548 Makefile
--- src/share/man/man4/Makefile 26 Jan 2011 18:48:12 -0000 1.548
+++ src/share/man/man4/Makefile 5 Mar 2011 11:36:39 -0000
@@ -29,8 +29,8 @@
glxtphy.4 gpib.4 gpio.4 gpiolock.4 gpiosim.4 gre.4 gphyter.4 gsip.4 \
hdaudio.4 hifn.4 hme.4 hpqlb.4 hptide.4 \
ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
- ifmedia.4 igphy.4 igsfb.4 iha.4 ihphy.4 iic.4 inet.4 ikphy.4 inphy.4 \
- intersil7170.4 \
+ ifmedia.4 igphy.4 igsfb.4 iha.4 ihphy.4 iic.4 iicmux.4 inet.4 \
+ ikphy.4 inphy.4 intersil7170.4 \
ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
iso.4 isp.4 isv.4 itesio.4 iteide.4 iwi.4 iwn.4 ixpide.4 \
jme.4 jmide.4 joy.4 \
@@ -182,6 +182,7 @@
MLINKS+=hdaudio.4 hdaudiobus.4
MLINKS+=icp.4 icpsp.4
MLINKS+=irframe.4 irda.4
+MLiNKS+=iicmux.4 iicmuxchan.4
MLINKS+=le.4 bicc.4 le.4 nele.4 le.4 depca.4
MLINKS+=midi.4 music.4
MLINKS+=midi.4 rmidi.4
--- /dev/null 2011-03-04 20:14:38.533221912 +0000
+++ src/share/man/man4/iicmux.4 2011-03-05 11:38:59.000000000 +0000
@@ -0,0 +1,98 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2011 Jasper Wallace <jasper%pointless.net@localhost>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd March 5, 2011
+.Dt iicmux 4
+.Os
+.Sh NAME
+.Nm iicmux
+.Nd I2C Multiplexer
+.Sh SYNOPSIS
+.Cd "iicmux0 at iic?"
+.Cd "iicmuxchan0 at iicmux0 channel 2"
+.Cd "iicmuxchan1 at iicmux0 channel 3"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn Philips Semiconductors
+NXP PCA9544A
+.Xr iic
+bus multiplexer.
+The device supports up to 4 sub
+.Xr iic
+buses which are switched to as needed when devices on the child buses are
accessed.
+Which channels to use should be specified by the channel argument to the
+iicmuxchan child devices.
+.Sh EXAMPLES
+For a
+.Tn Tyan
+S3992 this
+.Xr config 5
+works:
+.Bd -literal
+piixpm* at pci? dev ? function ?
+iic0 at piixpm?
+iicmux0 at iic0 addr 0x71
+iicmuxchan0 at iicmux0 channel 2
+iicmuxchan1 at iicmux0 channel 3
+iic1 at iicmuxchan0
+iic2 at iicmuxchan1
+dbcool* at iic1 addr 0x2E
+dbcool* at iic2 addr 0x2E
+spdmem* at iic1 addr 0x50
+spdmem* at iic2 addr 0x50
+spdmem* at iic1 addr 0x51
+spdmem* at iic2 addr 0x51
+spdmem* at iic1 addr 0x52
+spdmem* at iic2 addr 0x52
+spdmem* at iic1 addr 0x53
+spdmem* at iic2 addr 0x53
+spdmem* at iic1 addr 0x54
+spdmem* at iic2 addr 0x54
+spdmem* at iic1 addr 0x55
+spdmem* at iic2 addr 0x55
+spdmem* at iic1 addr 0x56
+spdmem* at iic2 addr 0x56
+spdmem* at iic1 addr 0x57
+spdmem* at iic2 addr 0x57
+.Ed
+.Sh SEE ALSO
+.Xr iic 4
+.Sh HISTORY
+The
+.Nm
+device appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Jasper Wallace .
+.Sh CAVEATS
+Due to the nature of I2C It's not possible to work out which channels
+actually have buses attached to them.
+You may be forced to resort to attaching a logic analyser onto the SMBus
+header pins on your motherboard and then running the BIOS's hardware
+monitoring to see which devices are at what addresses and channels.
+.Pp
+It's probably not a good idea to configure channels that you're not
+certain are physically present on your motherboard.
+.Sh BUGS
+Any devices configured on the child channels that share addresses with
+devices configured on the parent bus will break things horribly.
+.Pp
+Interrupt support is unimplemented.
Home |
Main Index |
Thread Index |
Old Index