From owner-svn-src-all@FreeBSD.ORG Sun Jun 1 08:45:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3781B393; Sun, 1 Jun 2014 08:45:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B26625FB; Sun, 1 Jun 2014 08:45:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s518jRS9036723; Sun, 1 Jun 2014 08:45:27 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s518jR5d036721; Sun, 1 Jun 2014 08:45:27 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201406010845.s518jR5d036721@svn.freebsd.org> From: Ruslan Bukin Date: Sun, 1 Jun 2014 08:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266945 - head/sys/arm/samsung/exynos X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jun 2014 08:45:28 -0000 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 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 ");