diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c index 066edba30c51..048be058d9de 100644 --- a/sys/dev/i2c/i2c.c +++ b/sys/dev/i2c/i2c.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.14 2007/07/09 21:00:32 ad Exp $ */ +/* $NetBSD: i2c.c,v 1.15 2007/09/01 22:19:25 riz Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -109,8 +109,11 @@ iic_attach(struct device *parent, struct device *self, void *aux) { struct iic_softc *sc = device_private(self); struct i2cbus_attach_args *iba = aux; + i2c_addr_t addr; i2c_tag_t ic; int rv; + int found = 0; + uint8_t cmd = 0, val; aprint_naive(": I2C bus\n"); aprint_normal(": I2C bus\n"); @@ -128,6 +131,24 @@ iic_attach(struct device *parent, struct device *self, void *aux) if (rv) printf("%s: unable to create intr thread\n", ic->ic_devname); + if (sc->sc_type == I2C_TYPE_SMBUS) { + for (addr = 0x0; addr < 0x80; addr++) { + iic_acquire_bus(ic, 0); + if (iic_exec(ic, I2C_OP_READ_WITH_STOP, addr, + &cmd, 1, &val, 1, 0) == 0) { + if (found == 0) + aprint_normal("%s: devices at", + ic->ic_devname); + found++; + aprint_normal(" 0x%02x", addr); + } + iic_release_bus(ic, 0); + } + if (found == 0) + aprint_normal("%s: no devices found", ic->ic_devname); + aprint_normal("\n"); + } + /* * Attach all i2c devices described in the kernel * configuration file. diff --git a/sys/dev/pci/ichsmb.c b/sys/dev/pci/ichsmb.c index f97dd973d2f3..46be0ad085c2 100644 --- a/sys/dev/pci/ichsmb.c +++ b/sys/dev/pci/ichsmb.c @@ -1,4 +1,4 @@ -/* $NetBSD: ichsmb.c,v 1.8 2007/08/27 15:57:14 xtraeme Exp $ */ +/* $NetBSD: ichsmb.c,v 1.9 2007/09/01 22:19:25 riz Exp $ */ /* $OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.8 2007/08/27 15:57:14 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.9 2007/09/01 22:19:25 riz Exp $"); #include #include @@ -171,6 +171,7 @@ ichsmb_attach(struct device *parent, struct device *self, void *aux) sc->sc_i2c_tag.ic_exec = ichsmb_i2c_exec; bzero(&iba, sizeof(iba)); + iba.iba_type = I2C_TYPE_SMBUS; iba.iba_tag = &sc->sc_i2c_tag; config_found(self, &iba, iicbus_print); diff --git a/sys/dev/pci/nfsmb.c b/sys/dev/pci/nfsmb.c index c6e4b140de16..dbdecd25b28a 100644 --- a/sys/dev/pci/nfsmb.c +++ b/sys/dev/pci/nfsmb.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfsmb.c,v 1.5 2007/08/27 15:57:13 xtraeme Exp $ */ +/* $NetBSD: nfsmb.c,v 1.6 2007/09/01 22:19:25 riz Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ * */ #include -__KERNEL_RCSID(0, "$NetBSD: nfsmb.c,v 1.5 2007/08/27 15:57:13 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfsmb.c,v 1.6 2007/09/01 22:19:25 riz Exp $"); #include #include @@ -217,6 +217,7 @@ nfsmb_attach(struct device *parent, struct device *self, void *aux) return; } + iba.iba_type = I2C_TYPE_SMBUS; iba.iba_tag = &sc->sc_i2c; (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); }