Add support for SMSC EMC6D103S
From jasper@pointless.net in PR kern/44685
This commit is contained in:
parent
5f7cc0f228
commit
778be5985f
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: dbcool.4,v 1.8 2010/04/01 05:10:52 macallan Exp $
|
.\" $NetBSD: dbcool.4,v 1.9 2011/03/11 18:38:51 pgoyette Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
@ -42,7 +42,8 @@
|
||||||
.Nm adt7473 ,
|
.Nm adt7473 ,
|
||||||
.Nm adt7475 ,
|
.Nm adt7475 ,
|
||||||
.Nm adt7476 ,
|
.Nm adt7476 ,
|
||||||
.Nm adt7490
|
.Nm adt7490 ,
|
||||||
|
.Nm emc6d103s
|
||||||
.Nd dbCool(tm) family of environmental monitors and fan controllers
|
.Nd dbCool(tm) family of environmental monitors and fan controllers
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Cd "dbcool* at ki2c?"
|
.Cd "dbcool* at ki2c?"
|
||||||
|
@ -52,7 +53,9 @@ The
|
||||||
.Nm
|
.Nm
|
||||||
driver provides support for the
|
driver provides support for the
|
||||||
.Tn Analog Devices
|
.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
|
.Xr envsys 4
|
||||||
API.
|
API.
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: dbcool.c,v 1.26 2010/11/13 13:51:59 uebayasi Exp $ */
|
/* $NetBSD: dbcool.c,v 1.27 2011/03/11 18:38:52 pgoyette Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||||
|
@ -44,12 +44,13 @@
|
||||||
* http://www.onsemi.com/pub/Collateral/ADT7475-D.PDF
|
* http://www.onsemi.com/pub/Collateral/ADT7475-D.PDF
|
||||||
* http://www.onsemi.com/pub/Collateral/ADT7476-D.PDF
|
* http://www.onsemi.com/pub/Collateral/ADT7476-D.PDF
|
||||||
* http://www.onsemi.com/pub/Collateral/ADT7490-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)
|
* (URLs are correct as of October 5, 2008)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.26 2010/11/13 13:51:59 uebayasi Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.27 2011/03/11 18:38:52 pgoyette Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -598,6 +599,68 @@ struct dbcool_power_control ADM1031_power_table[] = {
|
||||||
"fan_control_2" },
|
"fan_control_2" },
|
||||||
{ { 0, 0, 0, 0 }, NULL }
|
{ { 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[] = {
|
struct chip_id chip_table[] = {
|
||||||
{ DBCOOL_COMPANYID, ADT7490_DEVICEID, ADT7490_REV_ID,
|
{ DBCOOL_COMPANYID, ADT7490_DEVICEID, ADT7490_REV_ID,
|
||||||
ADT7490_sensor_table, ADT7475_power_table,
|
ADT7490_sensor_table, ADT7475_power_table,
|
||||||
|
@ -649,6 +712,10 @@ struct chip_id chip_table[] = {
|
||||||
ADM1031_sensor_table, ADM1030_power_table,
|
ADM1031_sensor_table, ADM1030_power_table,
|
||||||
DBCFLAG_ADM1030 | DBCFLAG_NO_READBYTE,
|
DBCFLAG_ADM1030 | DBCFLAG_NO_READBYTE,
|
||||||
11250 * 60, "ADM1031" },
|
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 }
|
{ 0, 0, 0, NULL, NULL, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -702,9 +769,16 @@ dbcool_attach(device_t parent, device_t self, void *aux)
|
||||||
|
|
||||||
ver = sc->sc_dc.dc_readreg(&sc->sc_dc, DBCOOL_REVISION_REG);
|
ver = sc->sc_dc.dc_readreg(&sc->sc_dc, DBCOOL_REVISION_REG);
|
||||||
if (sc->sc_dc.dc_chip->flags & DBCFLAG_4BIT_VER)
|
if (sc->sc_dc.dc_chip->flags & DBCFLAG_4BIT_VER)
|
||||||
aprint_normal_dev(self, "%s dBCool(tm) Controller "
|
if (sc->sc_dc.dc_chip->company == SMSC_COMPANYID)
|
||||||
"(rev 0x%02x, stepping 0x%02x)\n", sc->sc_dc.dc_chip->name,
|
{
|
||||||
ver >> 4, ver & 0x0f);
|
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
|
else
|
||||||
aprint_normal_dev(self, "%s dBCool(tm) Controller "
|
aprint_normal_dev(self, "%s dBCool(tm) Controller "
|
||||||
"(rev 0x%04x)\n", sc->sc_dc.dc_chip->name, ver);
|
"(rev 0x%04x)\n", sc->sc_dc.dc_chip->name, ver);
|
||||||
|
@ -804,7 +878,7 @@ dbcool_writereg(struct dbcool_chipset *dc, uint8_t reg, uint8_t val)
|
||||||
(void)iic_smbus_write_byte(dc->dc_tag, dc->dc_addr, reg, val, 0);
|
(void)iic_smbus_write_byte(dc->dc_tag, dc->dc_addr, reg, val, 0);
|
||||||
|
|
||||||
iic_release_bus(dc->dc_tag, 0);
|
iic_release_bus(dc->dc_tag, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
dbcool_islocked(struct dbcool_softc *sc)
|
dbcool_islocked(struct dbcool_softc *sc)
|
||||||
|
@ -1760,7 +1834,27 @@ dbcool_chip_ident(struct dbcool_chipset *dc)
|
||||||
c_id = dc->dc_readreg(dc, DBCOOL_COMPANYID_REG);
|
c_id = dc->dc_readreg(dc, DBCOOL_COMPANYID_REG);
|
||||||
d_id = dc->dc_readreg(dc, DBCOOL_DEVICEID_REG);
|
d_id = dc->dc_readreg(dc, DBCOOL_DEVICEID_REG);
|
||||||
r_id = dc->dc_readreg(dc, DBCOOL_REVISION_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++)
|
for (i = 0; chip_table[i].company != 0; i++)
|
||||||
if ((c_id == chip_table[i].company) &&
|
if ((c_id == chip_table[i].company) &&
|
||||||
(d_id == chip_table[i].device ||
|
(d_id == chip_table[i].device ||
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: dbcool_reg.h,v 1.5 2010/04/01 04:29:35 macallan Exp $ */
|
/* $NetBSD: dbcool_reg.h,v 1.6 2011/03/11 18:38:52 pgoyette Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#define DBCOOLREG_H
|
#define DBCOOLREG_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: dbcool_reg.h,v 1.5 2010/04/01 04:29:35 macallan Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: dbcool_reg.h,v 1.6 2011/03/11 18:38:52 pgoyette Exp $");
|
||||||
|
|
||||||
#define DBCOOL_ADDRMASK 0x7c
|
#define DBCOOL_ADDRMASK 0x7c
|
||||||
#define DBCOOL_ADDR 0x2c /* Some chips have multiple addrs */
|
#define DBCOOL_ADDR 0x2c /* Some chips have multiple addrs */
|
||||||
|
@ -384,6 +384,9 @@ __KERNEL_RCSID(0, "$NetBSD: dbcool_reg.h,v 1.5 2010/04/01 04:29:35 macallan Exp
|
||||||
|
|
||||||
/* Company and Device ID values */
|
/* Company and Device ID values */
|
||||||
#define DBCOOL_COMPANYID 0x41
|
#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 ADM1027_DEVICEID 0x27
|
||||||
#define ADM1030_DEVICEID 0x30
|
#define ADM1030_DEVICEID 0x30
|
||||||
|
|
Loading…
Reference in New Issue