summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/i2c_scan.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2009-02-19 23:09:18 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2009-02-19 23:09:18 +0000
commit65a2121963fb441986a20849a0d53e7507410edf (patch)
tree184781499c1e33113f8c14dd14a769dbbb921cf6 /sys/dev/i2c/i2c_scan.c
parent00c47bb1676b76a66b97e10884b2bfef7f3ff2fe (diff)
Move most of spdmem match logic into the driver and add crc16/ddr3
support based on changes in NetBSD by Paul Goyette with goop like bitfields/single decode function mess removed and things like module type/simpler capacity calculations added. Tested by a bunch of people in particular krw who tested a few revs of the ddr3 bits.
Diffstat (limited to 'sys/dev/i2c/i2c_scan.c')
-rw-r--r--sys/dev/i2c/i2c_scan.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c
index 601d20ec510..5d02e8ee026 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.129 2008/12/12 23:38:23 jsg Exp $ */
+/* $OpenBSD: i2c_scan.c,v 1.130 2009/02/19 23:09:17 jsg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt <deraadt@openbsd.org>
@@ -926,20 +926,17 @@ iic_probe_sensor(struct device *self, u_int8_t addr)
char *
iic_probe_eeprom(struct device *self, u_int8_t addr)
{
- int reg, csum = 0;
- u_int8_t size;
+ u_int8_t type;
char *name = NULL;
- /* SPD EEPROMs should only set lower nibble for size (ie <= 32K) */
- size = iicprobe(0x01);
- if (((size & 0xf0) != 0) || size == 0)
+ type = iicprobe(0x02);
+ /* limit to SPD types seen in the wild */
+ if (type < 4 || type > 11)
return (name);
- for (reg = 0; reg < 0x3f; reg++)
- csum += iicprobe(reg);
+ /* more matching in driver(s) */
+ name = "eeprom";
- if (iicprobe(0x3f) == (csum & 0xff))
- name = "spd";
return (name);
}