diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-28 01:02:59 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-28 01:02:59 +0000 |
commit | ec18f9a7f85323980dfe58849681f2d362a7b136 (patch) | |
tree | 8784d7a5ab9a739d105cbbfc5ff4ca818324d92e /sys/dev | |
parent | ef73d44570c354fd2af68a01315a8b99be7ff8e1 (diff) |
some chips (especially those crazy i2c/lpc/isa gross things) expose their
banks at other addresses, but there are issues with accessing these other
devices. so allow a driver to "knock" these out from future probing.
tested by kettenis -- unfortunate enough to have one of these winbond pieces
of poo
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/i2c/i2c_scan.c | 54 | ||||
-rw-r--r-- | sys/dev/i2c/i2cvar.h | 4 | ||||
-rw-r--r-- | sys/dev/i2c/lm_i2c.c | 4 |
3 files changed, 28 insertions, 34 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c index a2f97d453dd..85f8d78b9c3 100644 --- a/sys/dev/i2c/i2c_scan.c +++ b/sys/dev/i2c/i2c_scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2c_scan.c,v 1.28 2005/12/27 22:49:57 deraadt Exp $ */ +/* $OpenBSD: i2c_scan.c,v 1.29 2005/12/28 01:02:58 deraadt Exp $ */ /* * Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org> @@ -31,35 +31,6 @@ void iic_probe(struct device *, struct i2cbus_attach_args *, u_int8_t); -/* - * some basic rules for finding devices... - * - * 0x7 == 0x0001 national lm92 - * 0xfe == 0x4d maxim (6659/6658/6659) == lm90 - * no 0x7 register?? maxim (6633/6634/6635) lm92 - * - * XXX remove this block of text later - * 0x00 National (on LM84) - * 0x01 National - * 0x12C3 Asus (at 0x4F) - * 0x23 Analog Devices - * 0x41 Analog Devices (also at 0x16) - * 0x49 TI - * 0x4D Maxim - * 0x54 On Semi - * 0x5C SMSC - * 0x5D SMSC - * 0x55 SMSC - * 0x5CA3 Winbond (at 0x4F) - * 0x90 ITE (at 0x58) - * 0xA1 Philips (at 0x05 too) - * 0xA3 Winbond (at 0x4F) - * 0xAC Myson (at 0x58) - * 0xC3 Asus (at 0x4F) - * 0xDA Dallas - * 0x54 Microchip (at 0x7) - */ - /* addresses at which to probe for sensors */ struct { u_int8_t start, end; @@ -70,6 +41,9 @@ struct { { 0x48, 0x4f } }; +#define MAX_IGNORE 8 +u_int8_t ignore_addrs[MAX_IGNORE]; + /* registers to print if we fail to probe */ u_int8_t probereg[] = { 0x00, 0x01, 0x02, 0x03, 0x07, @@ -210,16 +184,28 @@ xeonprobe(u_int8_t addr) } #endif +void +iic_ignore_addr(u_int8_t addr) +{ + int i; + for (i = 0; i < sizeof(ignore_addrs); i++) + if (ignore_addrs[i] == 0) { + ignore_addrs[i] = addr; + return; + } +} void iic_probe(struct device *self, struct i2cbus_attach_args *iba, u_int8_t addr) { struct i2c_attach_args ia; char *name = NULL; -#ifdef I2C_DEBUG int i; -#endif /* I2C_DEBUG */ + + for (i = 0; i < sizeof(ignore_addrs); i++) + if (ignore_addrs[i] == addr) + return; probeinit(iba, addr); @@ -238,6 +224,9 @@ iic_probe(struct device *self, struct i2cbus_attach_args *iba, u_int8_t addr) probe(0x3d) == 0x70) name = "adt7470"; else if (probe(0x3d) == 0x27 && + (probe(0x3f) == 0x60 || probe(0x3f) == 0x6a)) + name = "adm1027"; /* complete check */ + else if (probe(0x3d) == 0x27 && (probe(0x3f) == 0x62 || probe(0x3f) == 0x6a)) name = "adt7460"; /* complete check */ else if (probe(0x3d) == 0x68 && addr == 0x2e && @@ -419,6 +408,7 @@ iic_scan(struct device *self, struct i2cbus_attach_args *iba) u_int8_t cmd = 0, addr; int i; + bzero(ignore_addrs, sizeof(ignore_addrs)); for (i = 0; i < sizeof(probe_addrs)/sizeof(probe_addrs[0]); i++) { for (addr = probe_addrs[i].start; addr <= probe_addrs[i].end; addr++) { diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h index 01115a23de6..8c3a9edc788 100644 --- a/sys/dev/i2c/i2cvar.h +++ b/sys/dev/i2c/i2cvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i2cvar.h,v 1.6 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: i2cvar.h,v 1.7 2005/12/28 01:02:58 deraadt Exp $ */ /* $NetBSD: i2cvar.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* @@ -146,4 +146,6 @@ int iic_smbus_write_byte(i2c_tag_t, i2c_addr_t, uint8_t, uint8_t, int); int iic_smbus_read_byte(i2c_tag_t, i2c_addr_t, uint8_t, uint8_t *, int); int iic_smbus_receive_byte(i2c_tag_t, i2c_addr_t, uint8_t *, int); +void iic_ignore_addr(u_int8_t addr); + #endif /* _DEV_I2C_I2CVAR_H_ */ diff --git a/sys/dev/i2c/lm_i2c.c b/sys/dev/i2c/lm_i2c.c index 53162e66b68..3f06d9d1fdc 100644 --- a/sys/dev/i2c/lm_i2c.c +++ b/sys/dev/i2c/lm_i2c.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm_i2c.c,v 1.1 2005/12/27 20:47:00 kettenis Exp $ */ +/* $OpenBSD: lm_i2c.c,v 1.2 2005/12/28 01:02:58 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -79,6 +79,8 @@ lm_i2c_attach(struct device *parent, struct device *self, void *aux) printf("%s: satellites at addr 0x%x and addr 0x%x\n", sc->sc_lmsc.sc_dev.dv_xname, 0x48 + (data & 0x7), 0x48 + ((data >> 4) & 0x7)); + iic_ignore_addr(0x48 + (data & 0x7)); + iic_ignore_addr(0x48 + ((data >> 4) & 0x7)); } u_int8_t |