Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Use 1-byte data-buffers when writing to the "con...



details:   https://anonhg.NetBSD.org/src/rev/218009478d9e
branches:  trunk
changeset: 830218:218009478d9e
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Mar 01 05:47:22 2018 +0000

description:
Use 1-byte data-buffers when writing to the "control" device for the
SPD ROMs (we do this for page-selection).  The imcsmb doesn't support
zero-byte transfers.

With this, I'm able to get the data for all 8 of my DIMMs (on two
different imcsmb busses) using the spdmem(4) driver.  And the data
decodes correctly using the decode-dimms utility (from the linux
i2ctools).

diffstat:

 sys/dev/i2c/spdmem_i2c.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 5de9f17f4398 -r 218009478d9e sys/dev/i2c/spdmem_i2c.c
--- a/sys/dev/i2c/spdmem_i2c.c  Thu Mar 01 04:53:05 2018 +0000
+++ b/sys/dev/i2c/spdmem_i2c.c  Thu Mar 01 05:47:22 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem_i2c.c,v 1.13 2016/09/09 05:36:59 msaitoh Exp $ */
+/* $NetBSD: spdmem_i2c.c,v 1.14 2018/03/01 05:47:22 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.13 2016/09/09 05:36:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.14 2018/03/01 05:47:22 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -102,6 +102,7 @@
 spdmem_reset_page(struct spdmem_i2c_softc *sc)
 {
        uint8_t reg, byte0, byte2;
+       static uint8_t dummy = 0;
        int rv;
 
        reg = 0;
@@ -142,7 +143,7 @@
                 * I don't know whether our icc_exec()'s API is good or not.
                 */
                rv = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_page0,
-                   &reg, 1, NULL, 0, I2C_F_POLL);
+                   &reg, 1, &dummy, 1, I2C_F_POLL);
                if (rv != 0) {
                        /*
                         * The possibilities are:
@@ -152,7 +153,7 @@
                         * Is there no way to distinguish them now?
                         */
                        rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
-                           sc->sc_page0, &reg, 1, NULL, 0, I2C_F_POLL);
+                           sc->sc_page0, &reg, 1, &dummy, 1, I2C_F_POLL);
                        if (rv == 0) {
                                aprint_debug("Page 1 was selected. Page 0 is "
                                    "selected now.\n");
@@ -245,11 +246,11 @@
 
        if (addr & 0x100) {
                rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_page1,
-                   &dummy, 1, NULL, 0, I2C_F_POLL);
+                   &dummy, 1, &dummy, 1, I2C_F_POLL);
                rv |= iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
                    &reg, 1, val, 1, I2C_F_POLL);
                rv |= iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
-                   sc->sc_page0, &dummy, 1, NULL, 0, I2C_F_POLL);
+                   sc->sc_page0, &dummy, 1, &dummy, 1, I2C_F_POLL);
        } else {
                rv = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
                    &reg, 1, val, 1, I2C_F_POLL);



Home | Main Index | Thread Index | Old Index