Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src Pull up following revision(s) (requested by msaitoh in ti...



details:   https://anonhg.NetBSD.org/src/rev/8b2c86867bd4
branches:  netbsd-7
changeset: 800024:8b2c86867bd4
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Dec 08 07:34:34 2016 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1286):
        sys/dev/i2c/sdtemp.c: revisions 1.26-1.32 via patch
        sys/dev/i2c/sdtemp_reg.h: revisions 1.8-1.12
        share/man/man4/sdtemp.4: revisions1.5-1.6
Changes for sdtemp(4):
- Add support for Atmel AT30TS00, AT30TSE004, Giantec GT30TS00,
  GT34TS02, Microchip MCP9804, MCP98244, IDT TS3000GB[02], TS3001GB2,
  TSE2004GB2, On Semiconductor CAT34TS02C and CAT34TS04.
- Add JEDEC TSE2004av support. If a device conforms TES2004av, it can
  be used without adding new entry into the matching table.
- Check the temperature resolution field in the capability register
  instead of the hard coded value in the match table. With this change,
  some devices' temperature resolution would be fixed.
- The resolution register is a vendor specific register.
- All of IDT devices have the resolution register.
- The address of the resolution register of Microchip MCP98244 is
  different from other Microchip devices.
- Show accuracy, range, resolution, high voltage standoff and shutdown.
- Show timeout with AB_DEBUG.
- Fix dmesg of STTS2004.

diffstat:

 share/man/man4/sdtemp.4  |   50 ++++++--
 sys/dev/i2c/sdtemp.c     |  258 ++++++++++++++++++++++++++++++++++++----------
 sys/dev/i2c/sdtemp_reg.h |   64 ++++++++++-
 3 files changed, 294 insertions(+), 78 deletions(-)

diffs (truncated from 609 to 300 lines):

diff -r 26f0955e95d1 -r 8b2c86867bd4 share/man/man4/sdtemp.4
--- a/share/man/man4/sdtemp.4   Thu Dec 08 00:15:50 2016 +0000
+++ b/share/man/man4/sdtemp.4   Thu Dec 08 07:34:34 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sdtemp.4,v 1.4 2011/10/11 17:53:27 njoly Exp $
+.\"    $NetBSD: sdtemp.4,v 1.4.20.1 2016/12/08 07:34:34 snj Exp $
 .\"
 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 8, 2011
+.Dd July 28, 2016
 .Dt SDTEMP 4
 .Os
 .Sh NAME
@@ -49,7 +49,7 @@
 .Tn Microchip Technology
 MCP9805/98242 and other chips that conform to JEDEC Standard 21-C section
 4.7.
-Memory module temperature sensors are optional on DDR2 and DDR3 SDRAM DIMMs.
+Memory module temperature sensors are optional on DDR2 and newer DIMMs.
 Sensors provided by this driver, including the on-chip thresholds for the
 Alarm Window and Critical level, are accessed through the
 .Xr envsys 4
@@ -61,32 +61,51 @@
 .Pp
 Chips supported by the
 .Nm
-driver include:
+driver include TSE2004av compliant devices and:
 .Pp
 .Bl -bullet -offset indent
 .It
-.Tn Catalyst
-.Em CAT34TS02
-and
-.Em CAT6095
-.It
 .Tn Analog Devices
 .Em ADT7408
 .It
+.Tn Atmel
+.Em AT30TS00
+and
+.Em AT30TSE004
+.It
+.Tn On semiconductor (Catalyst)
+.Em CAT34TS02 ,
+.Em CAT34TS02C ,
+.Em CAT34TS04
+and
+.Em CAT6095
+.It
+.Tn Giantec Semiconductor
+.Em GT30TS00
+and
+.Em GT34TS02
+.It
 .Tn Integrated Deviced Technology
-.Em TSE2002B3
+.Em TSE2002B3 ,
+.Em TSE2002GB2 ,
+.Em TSE2004GB2 ,
+.Em TS3000B3 ,
+.Em TS3000GB0 ,
+.Em TS3000GB2
 and
-.Em TSE3000B3
+.Em TS30001GB2
 .It
 .Tn Maxim
 .Em MAX6604
 .It
 .Tn Microchip Technology
+.Em MCP9804 ,
 .Em MCP9805 ,
 .Em MCP9843 ,
 .Em MCP98242 ,
+.Em MCP98243
 and
-.Em MCP98243
+.Em MCP98244
 .It
 .Tn NXP Semiconductors
 .Em SE97
@@ -94,9 +113,12 @@
 .Em SE98
 .It
 .Tn STmicroelectronics
-.Em STTS424
+.Em STTS424 ,
+.Em STTS424E ,
+.Em STTS2002 ,
+.Em STTS2004
 and
-.Em STTS424E
+.Em STTS3000
 .El
 .Sh SEE ALSO
 .Xr envsys 4 ,
diff -r 26f0955e95d1 -r 8b2c86867bd4 sys/dev/i2c/sdtemp.c
--- a/sys/dev/i2c/sdtemp.c      Thu Dec 08 00:15:50 2016 +0000
+++ b/sys/dev/i2c/sdtemp.c      Thu Dec 08 07:34:34 2016 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sdtemp.c,v 1.23.4.1 2015/03/21 17:11:35 snj Exp $        */
+/*      $NetBSD: sdtemp.c,v 1.23.4.2 2016/12/08 07:34:34 snj Exp $        */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.23.4.1 2015/03/21 17:11:35 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.23.4.2 2016/12/08 07:34:34 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,9 @@
        sysmon_envsys_lim_t sc_deflims;
        uint32_t sc_defprops;
        int sc_resolution;
+       uint16_t sc_mfgid;
+       uint16_t sc_devid;
+       uint16_t sc_devid_masked;
        uint16_t sc_capability;
 };
 
@@ -79,12 +82,15 @@
 static uint32_t        sdtemp_decode_temp(struct sdtemp_softc *, uint16_t);
 static bool    sdtemp_pmf_suspend(device_t, const pmf_qual_t *);
 static bool    sdtemp_pmf_resume(device_t, const pmf_qual_t *);
+/* Device dependent config functions */
+static void    sdtemp_config_mcp(struct sdtemp_softc *);
+static void    sdtemp_config_idt(struct sdtemp_softc *);
 
 struct sdtemp_dev_entry {
        const uint16_t sdtemp_mfg_id;
-       const uint16_t  sdtemp_devrev;
-       const uint16_t  sdtemp_mask;
-       const uint8_t  sdtemp_resolution;
+       const uint16_t sdtemp_devrev;
+       const uint16_t sdtemp_mask;
+       void         (*sdtemp_config)(struct sdtemp_softc *);
        const char    *sdtemp_desc;
 };
 
@@ -92,45 +98,82 @@
 
 #define        __UK2C(uk) (((uk) - 273150000) / 1000000)
 
-/*
- * List of devices known to conform to JEDEC JC42.4
- *
- * NOTE: A non-negative value for resolution indicates that the sensor
- * resolution is fixed at that number of fractional bits;  a negative
- * value indicates that the sensor needs to be configured.  In either
- * case, trip-point registers are fixed at two-bit (0.25C) resolution.
- */
+/* List of devices known to conform to JEDEC JC42.4 */
+
+#define        CMCP sdtemp_config_mcp
+#define        CIDT sdtemp_config_idt
+
 static const struct sdtemp_dev_entry
 sdtemp_dev_table[] = {
-    { MAXIM_MANUFACTURER_ID, MAX_6604_DEVICE_ID,    MAX_6604_MASK,   3,
+    { AT_MANUFACTURER_ID,   AT_30TS00_DEVICE_ID,     AT_30TS00_MASK,     NULL,
+       "Atmel AT30TS00" },
+    { AT2_MANUFACTURER_ID,  AT2_30TSE004_DEVICE_ID,  AT2_30TSE004_MASK,          NULL,
+       "Atmel AT30TSE004" },
+    { GT_MANUFACTURER_ID,   GT_30TS00_DEVICE_ID,     GT_30TS00_MASK,     NULL,
+       "Giantec GT30TS00" },
+    { GT2_MANUFACTURER_ID,  GT2_34TS02_DEVICE_ID,    GT2_34TS02_MASK,    NULL,
+       "Giantec GT34TS02" },
+    { MAXIM_MANUFACTURER_ID, MAX_6604_DEVICE_ID,     MAX_6604_MASK,      NULL,
        "Maxim MAX6604" },
-    { MCP_MANUFACTURER_ID,   MCP_9805_DEVICE_ID,    MCP_9805_MASK,   2,
+    { MCP_MANUFACTURER_ID,  MCP_9804_DEVICE_ID,             MCP_9804_MASK,       CMCP,
+       "Microchip Tech MCP9804" },
+    { MCP_MANUFACTURER_ID,  MCP_9805_DEVICE_ID,             MCP_9805_MASK,       NULL,
        "Microchip Tech MCP9805/MCP9843" },
-    { MCP_MANUFACTURER_ID,   MCP_98243_DEVICE_ID,   MCP_98243_MASK, -4,
+    { MCP_MANUFACTURER_ID,  MCP_98242_DEVICE_ID,     MCP_98242_MASK,     CMCP,
+       "Microchip Tech MCP98242" },
+    { MCP_MANUFACTURER_ID,  MCP_98243_DEVICE_ID,     MCP_98243_MASK,     CMCP,
        "Microchip Tech MCP98243" },
-    { MCP_MANUFACTURER_ID,   MCP_98242_DEVICE_ID,   MCP_98242_MASK, -4,
-       "Microchip Tech MCP98242" },
-    { ADT_MANUFACTURER_ID,   ADT_7408_DEVICE_ID,    ADT_7408_MASK,   4,
+    { MCP_MANUFACTURER_ID,  MCP_98244_DEVICE_ID,     MCP_98244_MASK,     CMCP,
+       "Microchip Tech MCP98244" },
+    { ADT_MANUFACTURER_ID,  ADT_7408_DEVICE_ID,             ADT_7408_MASK,       NULL,
        "Analog Devices ADT7408" },
-    { NXP_MANUFACTURER_ID,   NXP_SE98_DEVICE_ID,    NXP_SE98_MASK,   3,
+    { NXP_MANUFACTURER_ID,  NXP_SE98_DEVICE_ID,             NXP_SE98_MASK,       NULL,
        "NXP Semiconductors SE97B/SE98" },
-    { NXP_MANUFACTURER_ID,   NXP_SE97_DEVICE_ID,    NXP_SE97_MASK,   3,
+    { NXP_MANUFACTURER_ID,  NXP_SE97_DEVICE_ID,             NXP_SE97_MASK,       NULL,
        "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" }, 
-    { STTS_MANUFACTURER_ID,  STTS_2002_DEVICE_ID,    STTS_2002_MASK,   2,
-       "STmicroelectronics STTS2002" }, 
-    { STTS_MANUFACTURER_ID,  STTS_2004_DEVICE_ID,    STTS_2004_MASK,   2,
-       "STmicroelectronics STTS2002" }, 
-    { STTS_MANUFACTURER_ID,  STTS_3000_DEVICE_ID,    STTS_3000_MASK,   2,
-       "STmicroelectronics STTS3000" }, 
-    { CAT_MANUFACTURER_ID,   CAT_34TS02_DEVICE_ID,  CAT_34TS02_MASK, 4,
+    { STTS_MANUFACTURER_ID, STTS_424E_DEVICE_ID,     STTS_424E_MASK,     NULL,
+       "STmicroelectronics STTS424E" },
+    { STTS_MANUFACTURER_ID, STTS_424_DEVICE_ID,             STTS_424_MASK,       NULL,
+       "STmicroelectronics STTS424" },
+    { STTS_MANUFACTURER_ID, STTS_2002_DEVICE_ID,     STTS_2002_MASK,     NULL,
+       "STmicroelectronics STTS2002" },
+    { STTS_MANUFACTURER_ID, STTS_2004_DEVICE_ID,     STTS_2004_MASK,     NULL,
+       "STmicroelectronics STTS2004" },
+    { STTS_MANUFACTURER_ID, STTS_3000_DEVICE_ID,     STTS_3000_MASK,     NULL,
+       "STmicroelectronics STTS3000" },
+    { CAT_MANUFACTURER_ID,  CAT_34TS02_DEVICE_ID,    CAT_34TS02_MASK,    NULL,
        "Catalyst CAT34TS02/CAT6095" },
-    { IDT_MANUFACTURER_ID,   IDT_TS3000B3_DEVICE_ID, IDT_TS3000B3_MASK, 4,
+    { CAT_MANUFACTURER_ID,  CAT_34TS02C_DEVICE_ID,   CAT_34TS02C_MASK,   NULL,
+       "Catalyst CAT34TS02C" },
+    { CAT_MANUFACTURER_ID,  CAT_34TS04_DEVICE_ID,    CAT_34TS04_MASK,    NULL,
+       "Catalyst CAT34TS04" },
+    { IDT_MANUFACTURER_ID,  IDT_TSE2004GB2_DEVICE_ID,IDT_TSE2004GB2_MASK, NULL,
+       "Integrated Device Technology TSE2004GB2" },
+    { IDT_MANUFACTURER_ID,  IDT_TS3000B3_DEVICE_ID,  IDT_TS3000B3_MASK,          CIDT,
        "Integrated Device Technology TS3000B3/TSE2002B3" },
-    { 0, 0, 0, 2, "Unknown" }
+    { IDT_MANUFACTURER_ID,  IDT_TS3000GB0_DEVICE_ID, IDT_TS3000GB0_MASK,  CIDT,
+       "Integrated Device Technology TS3000GB0" },
+    { IDT_MANUFACTURER_ID,  IDT_TS3000GB2_DEVICE_ID, IDT_TS3000GB2_MASK,  CIDT,
+       "Integrated Device Technology TS3000GB2" },
+    { IDT_MANUFACTURER_ID,  IDT_TS3001GB2_DEVICE_ID, IDT_TS3001GB2_MASK,  CIDT,
+       "Integrated Device Technology TS3001GB2" },
+    /*
+     * Don't change the location of the following two entries. Device specific
+     * entry must be located at above.
+     */
+    { 0,                   TSE2004AV_ID,            TSE2004AV_MASK,      NULL,
+       "TSE2004av compliant device (generic driver)" },
+    { 0, 0, 0, NULL, "Unknown" }
+};
+
+#undef CMCP
+#undef CIDT
+
+static const char *temp_resl[] = {
+       "0.5C",
+       "0.25C",
+       "0.125C",
+       "0.0625C"
 };
 
 static int
@@ -145,6 +188,10 @@
                    sdtemp_dev_table[i].sdtemp_devrev)
                        break;
        }
+       /* Check TSE2004av */
+       if ((sdtemp_dev_table[i].sdtemp_mfg_id == 0)
+           && (SDTEMP_IS_TSE2004AV(devrev) == 0))
+                       i++; /* Unknown */
 
        return i;
 }
@@ -153,7 +200,7 @@
 sdtemp_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct i2c_attach_args *ia = aux;
-       uint16_t mfgid, devid;
+       uint16_t mfgid, devid, cap;
        struct sdtemp_softc sc;
        int i, error;
 
@@ -163,23 +210,32 @@
        if ((ia->ia_addr & SDTEMP_ADDRMASK) != SDTEMP_ADDR)
                return 0;
 
-       /* Verify that we can read the manufacturer ID  & Device ID */
+       /* Verify that we can read the manufacturer ID, Device ID and the capability */
        iic_acquire_bus(sc.sc_tag, 0);
        error = sdtemp_read_16(&sc, SDTEMP_REG_MFG_ID,  &mfgid) |
-               sdtemp_read_16(&sc, SDTEMP_REG_DEV_REV, &devid);
+               sdtemp_read_16(&sc, SDTEMP_REG_DEV_REV, &devid) |
+               sdtemp_read_16(&sc, SDTEMP_REG_CAPABILITY, &cap);
        iic_release_bus(sc.sc_tag, 0);
 
        if (error)
                return 0;
 
        i = sdtemp_lookup(mfgid, devid);
-       if (sdtemp_dev_table[i].sdtemp_mfg_id == 0) {



Home | Main Index | Thread Index | Old Index