Module Name: src Committed By: martin Date: Sat Nov 16 16:26:17 UTC 2019
Modified Files: src/sys/dev/i2c [netbsd-8]: spdmem_i2c.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.8.1 src/sys/dev/i2c/spdmem_i2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.13 src/sys/dev/i2c/spdmem_i2c.c:1.13.8.1 --- src/sys/dev/i2c/spdmem_i2c.c:1.13 Fri Sep 9 05:36:59 2016 +++ src/sys/dev/i2c/spdmem_i2c.c Sat Nov 16 16:26:17 2019 @@ -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 @@ static int 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 @@ spdmem_reset_page(struct spdmem_i2c_soft * 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, - ®, 1, NULL, 0, I2C_F_POLL); + ®, 1, &dummy, 1, I2C_F_POLL); if (rv != 0) { /* * The possibilities are: @@ -152,7 +153,7 @@ spdmem_reset_page(struct spdmem_i2c_soft * Is there no way to distinguish them now? */ rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, - sc->sc_page0, ®, 1, NULL, 0, I2C_F_POLL); + sc->sc_page0, ®, 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 @@ spdmem_i2c_read(struct spdmem_softc *sof 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, ®, 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, ®, 1, val, 1, I2C_F_POLL);