Date: Sun, 1 Jun 2014 08:45:27 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266945 - head/sys/arm/samsung/exynos Message-ID: <201406010845.s518jR5d036721@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: br Date: Sun Jun 1 08:45:27 2014 New Revision: 266945 URL: http://svnweb.freebsd.org/changeset/base/266945 Log: Fix i2c communication interface to be compatible with vendor tools, e.g. embedded controller tool Submitted by: Maxim Ignatenko <gelraen.ua@gmail.com> Modified: head/sys/arm/samsung/exynos/chrome_ec.c head/sys/arm/samsung/exynos/exynos5_i2c.c Modified: head/sys/arm/samsung/exynos/chrome_ec.c ============================================================================== --- head/sys/arm/samsung/exynos/chrome_ec.c Sun Jun 1 08:34:45 2014 (r266944) +++ head/sys/arm/samsung/exynos/chrome_ec.c Sun Jun 1 08:45:27 2014 (r266945) @@ -165,7 +165,7 @@ ec_command(uint8_t cmd, uint8_t *dout, u int i; msg_dout = malloc(dout_len + 4, M_DEVBUF, M_NOWAIT); - msg_dinp = malloc(dinp_len + 4, M_DEVBUF, M_NOWAIT); + msg_dinp = malloc(dinp_len + 3, M_DEVBUF, M_NOWAIT); if (ec_sc == NULL) return (-1); @@ -184,7 +184,7 @@ ec_command(uint8_t cmd, uint8_t *dout, u struct iic_msg msgs[] = { { 0x1e, IIC_M_WR, dout_len + 4, msg_dout, }, - { 0x1e, IIC_M_RD, dinp_len + 4, msg_dinp, }, + { 0x1e, IIC_M_RD, dinp_len + 3, msg_dinp, }, }; ret = iicbus_transfer(sc->dev, msgs, 2); @@ -196,7 +196,7 @@ ec_command(uint8_t cmd, uint8_t *dout, u } for (i = 0; i < dinp_len; i++) { - dinp[i] = msg_dinp[i + 3]; + dinp[i] = msg_dinp[i + 2]; }; free(msg_dout, M_DEVBUF); Modified: head/sys/arm/samsung/exynos/exynos5_i2c.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_i2c.c Sun Jun 1 08:34:45 2014 (r266944) +++ head/sys/arm/samsung/exynos/exynos5_i2c.c Sun Jun 1 08:45:27 2014 (r266945) @@ -372,6 +372,13 @@ i2c_read(device_t dev, char *buf, int le mtx_lock(&sc->mutex); /* dummy read */ + clear_ipend(sc); + error = wait_for_iif(sc); + if (error) { + DPRINTF("cant i2c read: iif error\n"); + mtx_unlock(&sc->mutex); + return (error); + } READ1(sc, I2CDS); DPRINTF("Read ");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406010845.s518jR5d036721>