NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/44685: patch to support the SMSC EMC6D103S in dbcool(4)
>Number: 44685
>Category: kern
>Synopsis: patch to support the SMSC EMC6D103S in dbcool(4)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Mar 05 09:25:00 +0000 2011
>Originator: Jasper Wallace
>Release: -current
>Organization:
>Environment:
NetBSD monstrosity 5.99.45 NetBSD 5.99.45 (MONSTROSITY) #19: Wed Mar 2
12:42:56 GMT 2011
jasper@limpit:/home/jasper/develop/netbsd/netbsd-src-and-build/tree/l.64/obj/sys/arch/amd64/compile/MONSTROSITY
amd64
>Description:
we don't have support for the SMSC EMC6D103S environmental monitoring chip, so
patch dbcool(4) to support it.
>How-To-Repeat:
run netbsd on a tyan S3992 and not the lack of environmental monitoring.
>Fix:
Index: src/share/man/man4/dbcool.4
===================================================================
RCS file: /cvsroot/src/share/man/man4/dbcool.4,v
retrieving revision 1.8
diff -u -u -r1.8 dbcool.4
--- src/share/man/man4/dbcool.4 1 Apr 2010 05:10:52 -0000 1.8
+++ src/share/man/man4/dbcool.4 5 Mar 2011 08:48:56 -0000
@@ -42,7 +42,8 @@
.Nm adt7473 ,
.Nm adt7475 ,
.Nm adt7476 ,
-.Nm adt7490
+.Nm adt7490 ,
+.Nm emc6d103s
.Nd dbCool(tm) family of environmental monitors and fan controllers
.Sh SYNOPSIS
.Cd "dbcool* at ki2c?"
@@ -52,7 +53,9 @@
.Nm
driver provides support for the
.Tn Analog Devices
-dbCool environmental monitor chips to be used with the
+dbCool and the
+.Tn SMSC
+EMC6D103S environmental monitor chips to be used with the
.Xr envsys 4
API.
.Pp
Index: dbcool.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/dbcool.c,v
retrieving revision 1.26
diff -u -u -r1.26 dbcool.c
--- src/sys/dev/i2c/dbcool.c 13 Nov 2010 13:51:59 -0000 1.26
+++ src/sys/dev/i2c/dbcool.c 5 Mar 2011 08:56:01 -0000
@@ -44,6 +44,7 @@
* http://www.onsemi.com/pub/Collateral/ADT7475-D.PDF
* http://www.onsemi.com/pub/Collateral/ADT7476-D.PDF
* http://www.onsemi.com/pub/Collateral/ADT7490-D.PDF
+ * http://www.smsc.com/media/Downloads_Public/Data_Sheets/6d103s.pdf
*
* (URLs are correct as of October 5, 2008)
*/
@@ -598,6 +599,68 @@
"fan_control_2" },
{ { 0, 0, 0, 0 }, NULL }
};
+
+struct dbcool_sensor EMC6D103S_sensor_table[] = {
+ { DBC_TEMP, { DBCOOL_LOCAL_TEMP,
+ DBCOOL_LOCAL_HIGHLIM,
+ DBCOOL_LOCAL_LOWLIM }, 0, 0, 0 },
+ { DBC_TEMP, { DBCOOL_REMOTE1_TEMP,
+ DBCOOL_REMOTE1_HIGHLIM,
+ DBCOOL_REMOTE1_LOWLIM }, 1, 0, 0 },
+ { DBC_TEMP, { DBCOOL_REMOTE2_TEMP,
+ DBCOOL_REMOTE2_HIGHLIM,
+ DBCOOL_REMOTE2_LOWLIM }, 2, 0, 0 },
+ { DBC_VOLT, { DBCOOL_VCCP,
+ DBCOOL_VCCP_HIGHLIM,
+ DBCOOL_VCCP_LOWLIM }, 3, 0, 1 },
+ { DBC_VOLT, { DBCOOL_VCC,
+ DBCOOL_VCC_HIGHLIM,
+ DBCOOL_VCC_LOWLIM }, 4, 0, 0 },
+ { DBC_VOLT, { DBCOOL_25VIN,
+ DBCOOL_25VIN_HIGHLIM,
+ DBCOOL_25VIN_LOWLIM }, 11, 0, 2 },
+ { DBC_VOLT, { DBCOOL_5VIN,
+ DBCOOL_5VIN_HIGHLIM,
+ DBCOOL_5VIN_LOWLIM }, 12, 0, 3 },
+ { DBC_VOLT, { DBCOOL_12VIN,
+ DBCOOL_12VIN_HIGHLIM,
+ DBCOOL_12VIN_LOWLIM }, 13, 0, 4 },
+ { DBC_FAN, { DBCOOL_FAN1_TACH_LSB,
+ DBCOOL_NO_REG,
+ DBCOOL_TACH1_MIN_LSB }, 5, 0, 0 },
+ { DBC_FAN, { DBCOOL_FAN2_TACH_LSB,
+ DBCOOL_NO_REG,
+ DBCOOL_TACH2_MIN_LSB }, 6, 0, 0 },
+ { DBC_FAN, { DBCOOL_FAN3_TACH_LSB,
+ DBCOOL_NO_REG,
+ DBCOOL_TACH3_MIN_LSB }, 7, 0, 0 },
+ { DBC_FAN, { DBCOOL_FAN4_TACH_LSB,
+ DBCOOL_NO_REG,
+ DBCOOL_TACH4_MIN_LSB }, 8, 0, 0 },
+ { DBC_VID, { DBCOOL_VID_REG,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 16, 0, 0 },
+ { DBC_CTL, { DBCOOL_LOCAL_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 0, 5, 0 },
+ { DBC_CTL, { DBCOOL_LOCAL_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 0, 6, 0 },
+ { DBC_CTL, { DBCOOL_REMOTE1_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 1, 5, 0 },
+ { DBC_CTL, { DBCOOL_REMOTE1_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 1, 6, 0 },
+ { DBC_CTL, { DBCOOL_REMOTE2_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 2, 5, 0 },
+ { DBC_CTL, { DBCOOL_REMOTE2_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 2, 6, 0 },
+ { DBC_EOF, { 0, 0, 0 }, 0, 0, 0 }
+};
+
struct chip_id chip_table[] = {
{ DBCOOL_COMPANYID, ADT7490_DEVICEID, ADT7490_REV_ID,
ADT7490_sensor_table, ADT7475_power_table,
@@ -649,6 +712,10 @@
ADM1031_sensor_table, ADM1030_power_table,
DBCFLAG_ADM1030 | DBCFLAG_NO_READBYTE,
11250 * 60, "ADM1031" },
+ { SMSC_COMPANYID, EMC6D103S_DEVICEID, EMC6D103S_REV_ID,
+ EMC6D103S_sensor_table, ADT7475_power_table,
+ DBCFLAG_4BIT_VER,
+ 90000 * 60, "EMC6D103S" },
{ 0, 0, 0, NULL, NULL, 0, 0, NULL }
};
@@ -702,9 +769,16 @@
ver = sc->sc_dc.dc_readreg(&sc->sc_dc, DBCOOL_REVISION_REG);
if (sc->sc_dc.dc_chip->flags & DBCFLAG_4BIT_VER)
- aprint_normal_dev(self, "%s dBCool(tm) Controller "
- "(rev 0x%02x, stepping 0x%02x)\n",
sc->sc_dc.dc_chip->name,
- ver >> 4, ver & 0x0f);
+ if (sc->sc_dc.dc_chip->company == SMSC_COMPANYID)
+ {
+ aprint_normal_dev(self, "SMSC %s Controller "
+ "(rev 0x%02x, stepping 0x%02x)\n",
sc->sc_dc.dc_chip->name,
+ ver >> 4, ver & 0x0f);
+ } else {
+ aprint_normal_dev(self, "%s dBCool(tm) Controller "
+ "(rev 0x%02x, stepping 0x%02x)\n",
sc->sc_dc.dc_chip->name,
+ ver >> 4, ver & 0x0f);
+ }
else
aprint_normal_dev(self, "%s dBCool(tm) Controller "
"(rev 0x%04x)\n", sc->sc_dc.dc_chip->name, ver);
@@ -804,7 +878,7 @@
(void)iic_smbus_write_byte(dc->dc_tag, dc->dc_addr, reg, val, 0);
iic_release_bus(dc->dc_tag, 0);
-}
+}
static bool
dbcool_islocked(struct dbcool_softc *sc)
@@ -1760,6 +1834,27 @@
c_id = dc->dc_readreg(dc, DBCOOL_COMPANYID_REG);
d_id = dc->dc_readreg(dc, DBCOOL_DEVICEID_REG);
r_id = dc->dc_readreg(dc, DBCOOL_REVISION_REG);
+
+ /* The EMC6D103S only supports read_byte and since dc->dc_chip is
+ * NULL when we call dc->dc_readreg above we use
+ * send_byte/receive_byte which dosn't work.
+ *
+ * So if we only get 0's back then try again with dc->dc_chip
+ * set to the EMC6D103S_DEVICEID and which dosn't have
+ * DBCFLAG_NO_READBYTE set so read_byte will be used
+ */
+ if ((c_id == 0) && (d_id == 0) && (r_id == 0))
+ {
+ for (i = 0; chip_table[i].company != 0; i++)
+ if ((SMSC_COMPANYID == chip_table[i].company) &&
+ (EMC6D103S_DEVICEID == chip_table[i].device)) {
+ dc->dc_chip = &chip_table[i];
+ break;
+ }
+ c_id = dc->dc_readreg(dc, DBCOOL_COMPANYID_REG);
+ d_id = dc->dc_readreg(dc, DBCOOL_DEVICEID_REG);
+ r_id = dc->dc_readreg(dc, DBCOOL_REVISION_REG);
+ }
for (i = 0; chip_table[i].company != 0; i++)
if ((c_id == chip_table[i].company) &&
Index: dbcool_reg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/dbcool_reg.h,v
retrieving revision 1.5
diff -u -u -r1.5 dbcool_reg.h
--- src/sys/dev/i2c/dbcool_reg.h 1 Apr 2010 04:29:35 -0000 1.5
+++ src/sys/dev/i2c/dbcool_reg.h 5 Mar 2011 08:56:01 -0000
@@ -384,6 +384,9 @@
/* Company and Device ID values */
#define DBCOOL_COMPANYID 0x41
+#define SMSC_COMPANYID 0x5c
+#define EMC6D103S_REV_ID 0x68 /* A0 stepping */
+#define EMC6D103S_DEVICEID 0xff /* device id not used */
#define ADM1027_DEVICEID 0x27
#define ADM1030_DEVICEID 0x30
Index: dbcool_var.h
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/dbcool_var.h,v
retrieving revision 1.12
diff -u -u -r1.12 dbcool_var.h
--- src/sys/dev/i2c/dbcool_var.h 10 Apr 2010 19:02:39 -0000 1.12
+++ src/sys/dev/i2c/dbcool_var.h 5 Mar 2011 08:56:01 -0000
@@ -36,9 +36,9 @@
#ifndef DBCOOLVAR_H
#define DBCOOLVAR_H
-/*
+#ifdef DEBUG
#define DBCOOL_DEBUG
-*/
+#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dbcool_var.h,v 1.12 2010/04/10 19:02:39 pgoyette
Exp $");
Home |
Main Index |
Thread Index |
Old Index