Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Add additional chip IDs, and be more specific ab...
details: https://anonhg.NetBSD.org/src/rev/8b553a95e02b
branches: trunk
changeset: 756226:8b553a95e02b
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Thu Jul 08 23:27:17 2010 +0000
description:
Add additional chip IDs, and be more specific about which revs we match.
>From Guenter Roeck on a Linux mailing list.
diffstat:
sys/dev/i2c/sdtemp.c | 53 ++++++++++++++++++++++++++---------------------
sys/dev/i2c/sdtemp_reg.h | 29 +++++++++++++++++++-------
2 files changed, 50 insertions(+), 32 deletions(-)
diffs (163 lines):
diff -r 29791a8295f6 -r 8b553a95e02b sys/dev/i2c/sdtemp.c
--- a/sys/dev/i2c/sdtemp.c Thu Jul 08 23:23:37 2010 +0000
+++ b/sys/dev/i2c/sdtemp.c Thu Jul 08 23:27:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdtemp.c,v 1.13 2010/04/10 19:02:39 pgoyette Exp $ */
+/* $NetBSD: sdtemp.c,v 1.14 2010/07/08 23:27:17 pgoyette Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.13 2010/04/10 19:02:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.14 2010/07/08 23:27:17 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -80,8 +80,8 @@
struct sdtemp_dev_entry {
const uint16_t sdtemp_mfg_id;
- const uint8_t sdtemp_dev_id;
- const uint8_t sdtemp_rev_id;
+ const uint16_t sdtemp_devrev;
+ const uint16_t sdtemp_mask;
const uint8_t sdtemp_resolution;
const char *sdtemp_desc;
};
@@ -100,36 +100,41 @@
*/
static const struct sdtemp_dev_entry
sdtemp_dev_table[] = {
- { MAXIM_MANUFACTURER_ID, MAX_6604_DEVICE_ID, 0xff, 3,
+ { MAXIM_MANUFACTURER_ID, MAX_6604_DEVICE_ID, MAX_6604_MASK, 3,
"Maxim MAX604" },
- { MCP_MANUFACTURER_ID, MCP_9805_DEVICE_ID, 0xff, 2,
- "Microchip Tech MCP9805" },
- { MCP_MANUFACTURER_ID, MCP_98242_DEVICE_ID, 0xff, -4,
+ { MCP_MANUFACTURER_ID, MCP_9805_DEVICE_ID, MCP_9805_MASK, 2,
+ "Microchip Tech MCP9805/MCP9843" },
+ { MCP_MANUFACTURER_ID, MCP_98243_DEVICE_ID, MCP_98243_MASK, -4,
+ "Microchip Tech MCP98243" },
+ { MCP_MANUFACTURER_ID, MCP_98242_DEVICE_ID, MCP_98242_MASK, -4,
"Microchip Tech MCP98242" },
- { ADT_MANUFACTURER_ID, ADT_7408_DEVICE_ID, 0xff, 4,
+ { ADT_MANUFACTURER_ID, ADT_7408_DEVICE_ID, ADT_7408_MASK, 4,
"Analog Devices ADT7408" },
- { NXP_MANUFACTURER_ID, NXP_SE97_DEVICE_ID, 0xff, 3,
- "NXP Semiconductors SE97/SE98" },
- { STTS_MANUFACTURER_ID, STTS_424E02_DEVICE_ID, 0x00, 2,
- "STmicroelectronics STTS424E02-DA" },
- { STTS_MANUFACTURER_ID, STTS_424E02_DEVICE_ID, 0x01, 2,
- "STmicroelectronics STTS424E02-DN" },
- { CAT_MANUFACTURER_ID, CAT_34TS02_DEVICE_ID, 0xff, 4,
+ { NXP_MANUFACTURER_ID, NXP_SE98_DEVICE_ID, NXP_SE98_MASK, 3,
+ "NXP Semiconductors SE97B/SE98" },
+ { NXP_MANUFACTURER_ID, NXP_SE97_DEVICE_ID, NXP_SE97_MASK, 3,
+ "NXP Semiconductors SE97" },
+ { STTS_MANUFACTURER_ID, STTS_424E_DEVICE_ID, STTS_424E_MASK, 2,
+ "STmicroelectronics STTS424E" },
+ { STTS_MANUFACTURER_ID, STTS_424_DEVICE_ID, STTS_424_MASK, 2,
+ "STmicroelectronics STTS424" },
+ { CAT_MANUFACTURER_ID, CAT_34TS02_DEVICE_ID, CAT_34TS02_MASK, 4,
"Catalyst CAT34TS02/CAT6095" },
{ 0, 0, 0, 2, "Unknown" }
};
static int
-sdtemp_lookup(uint16_t mfg, uint16_t dev, uint16_t rev)
+sdtemp_lookup(uint16_t mfg, uint16_t devrev)
{
int i;
- for (i = 0; sdtemp_dev_table[i].sdtemp_mfg_id; i++)
- if (sdtemp_dev_table[i].sdtemp_mfg_id == mfg &&
- sdtemp_dev_table[i].sdtemp_dev_id == dev &&
- (sdtemp_dev_table[i].sdtemp_rev_id == 0xff ||
- sdtemp_dev_table[i].sdtemp_rev_id == rev))
+ for (i = 0; sdtemp_dev_table[i].sdtemp_mfg_id; i++) {
+ if (mfg != sdtemp_dev_table[i].sdtemp_mfg_id)
+ continue;
+ if ((devrev & sdtemp_dev_table[i].sdtemp_mask) ==
+ sdtemp_dev_table[i].sdtemp_devrev)
break;
+ }
return i;
}
@@ -157,7 +162,7 @@
if (error)
return 0;
- i = sdtemp_lookup(mfgid, devid >> 8, devid & 0xff);
+ i = sdtemp_lookup(mfgid, devid);
if (sdtemp_dev_table[i].sdtemp_mfg_id == 0) {
aprint_debug("sdtemp: No match for mfg 0x%04x dev 0x%02x "
"rev 0x%02x at address 0x%02x\n", mfgid, devid >> 8,
@@ -189,7 +194,7 @@
aprint_error(": attach error %d\n", error);
return;
}
- i = sdtemp_lookup(mfgid, devid >> 8, devid & 0xff);
+ i = sdtemp_lookup(mfgid, devid);
sc->sc_resolution =
sdtemp_dev_table[i].sdtemp_resolution;
diff -r 29791a8295f6 -r 8b553a95e02b sys/dev/i2c/sdtemp_reg.h
--- a/sys/dev/i2c/sdtemp_reg.h Thu Jul 08 23:23:37 2010 +0000
+++ b/sys/dev/i2c/sdtemp_reg.h Thu Jul 08 23:27:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdtemp_reg.h,v 1.2 2009/06/13 19:02:33 pgoyette Exp $ */
+/* $NetBSD: sdtemp_reg.h,v 1.3 2010/07/08 23:27:17 pgoyette Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -92,26 +92,39 @@
* Devices known to conform to JEDEC JC42.4
*/
#define MAXIM_MANUFACTURER_ID 0x004D
-#define MAX_6604_DEVICE_ID 0x3E
+#define MAX_6604_DEVICE_ID 0x3E00
+#define MAX_6604_MASK 0xFFFF
#define MCP_MANUFACTURER_ID 0x0054
-#define MCP_9805_DEVICE_ID 0x00
-#define MCP_98242_DEVICE_ID 0x20
+#define MCP_9805_DEVICE_ID 0x0000 /* Also matches MCP9843 */
+#define MCP_9805_MASK 0xFFFE
+#define MCP_98242_DEVICE_ID 0x2000
+#define MCP_98242_MASK 0xFFFC
+#define MCP_98243_DEVICE_ID 0x2100
+#define MCP_98243_MASK 0xFFFC
/* According to datasheets, SE97 and SE98 have same ID */
#define NXP_MANUFACTURER_ID 0x1131
-#define NXP_SE97_DEVICE_ID 0xA1
+#define NXP_SE98_DEVICE_ID 0xA100
+#define NXP_SE98_MASK 0xFFFC
+#define NXP_SE97_DEVICE_ID 0xA200
+#define NXP_SE97_MASK 0xFFFC
#define ADT_MANUFACTURER_ID 0x11D4
-#define ADT_7408_DEVICE_ID 0x80
+#define ADT_7408_DEVICE_ID 0x8001
+#define ADT_7408_MASK 0xFFFF
#define STTS_MANUFACTURER_ID 0x104A
-#define STTS_424E02_DEVICE_ID 0x00
+#define STTS_424_DEVICE_ID 0x0101
+#define STTS_424_MASK 0xFFFF
+#define STTS_424E_DEVICE_ID 0x0000
+#define STTS_424E_MASK 0xFFFE
/* According to datasheets, both the CAT6095 and CAT34TS02 have the same ID */
#define CAT_MANUFACTURER_ID 0x1B09
-#define CAT_34TS02_DEVICE_ID 0x08
+#define CAT_34TS02_DEVICE_ID 0x0800
+#define CAT_34TS02_MASK 0xFFE0
#endif /* _DEV_I2C_SDTEMPREG_H */
Home |
Main Index |
Thread Index |
Old Index