Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/i2c Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/2d8bed44bca1
branches:  netbsd-8
changeset: 461121:2d8bed44bca1
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Nov 16 16:26:17 2019 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1442):

        sys/dev/i2c/spdmem_i2c.c: revision 1.14

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 961505015917 -r 2d8bed44bca1 sys/dev/i2c/spdmem_i2c.c
--- a/sys/dev/i2c/spdmem_i2c.c  Sat Nov 16 16:23:31 2019 +0000
+++ b/sys/dev/i2c/spdmem_i2c.c  Sat Nov 16 16:26:17 2019 +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.13.8.1 2019/11/16 16:26:17 martin 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.13.8.1 2019/11/16 16:26:17 martin 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