From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 3 10:33:02 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 59B6F26D; Mon, 3 Nov 2014 10:33:02 +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 2BAF4B63; Mon, 3 Nov 2014 10:33:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA3AX2oo018387; Mon, 3 Nov 2014 10:33:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA3AX1DC018384; Mon, 3 Nov 2014 10:33:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201411031033.sA3AX1DC018384@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 3 Nov 2014 10:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274028 - stable/10/sys/dev/iicbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2014 10:33:02 -0000 Author: kib Date: Mon Nov 3 10:33:01 2014 New Revision: 274028 URL: https://svnweb.freebsd.org/changeset/base/274028 Log: MFC r273728: Add a method to iicbus to request IIC_M_NOSTOP behaviour for multibyte transfers to be default. Modified: stable/10/sys/dev/iicbus/iicbus.h stable/10/sys/dev/iicbus/iiconf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iicbus/iicbus.h ============================================================================== --- stable/10/sys/dev/iicbus/iicbus.h Mon Nov 3 10:30:44 2014 (r274027) +++ stable/10/sys/dev/iicbus/iicbus.h Mon Nov 3 10:33:01 2014 (r274028) @@ -49,16 +49,19 @@ struct iicbus_softc struct iicbus_ivar { uint32_t addr; + bool nostop; }; enum { - IICBUS_IVAR_ADDR /* Address or base address */ + IICBUS_IVAR_ADDR, /* Address or base address */ + IICBUS_IVAR_NOSTOP, /* nostop defaults */ }; #define IICBUS_ACCESSOR(A, B, T) \ __BUS_ACCESSOR(iicbus, A, IICBUS, B, T) IICBUS_ACCESSOR(addr, ADDR, uint32_t) +IICBUS_ACCESSOR(nostop, NOSTOP, bool) #define IICBUS_LOCK(sc) mtx_lock(&(sc)->lock) #define IICBUS_UNLOCK(sc) mtx_unlock(&(sc)->lock) Modified: stable/10/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/10/sys/dev/iicbus/iiconf.c Mon Nov 3 10:30:44 2014 (r274027) +++ stable/10/sys/dev/iicbus/iiconf.c Mon Nov 3 10:33:01 2014 (r274028) @@ -365,6 +365,7 @@ iicbus_transfer_gen(device_t dev, struct { int i, error, lenread, lenwrote, nkid, rpstart, addr; device_t *children, bus; + bool nostop; if ((error = device_get_children(dev, &children, &nkid)) != 0) return (error); @@ -375,6 +376,7 @@ iicbus_transfer_gen(device_t dev, struct bus = children[0]; rpstart = 0; free(children, M_TEMP); + nostop = iicbus_get_nostop(dev); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { addr = msgs[i].slave; if (msgs[i].flags & IIC_M_RD) @@ -399,11 +401,12 @@ iicbus_transfer_gen(device_t dev, struct error = iicbus_write(bus, msgs[i].buf, msgs[i].len, &lenwrote, 0); - if (!(msgs[i].flags & IIC_M_NOSTOP)) { + if ((msgs[i].flags & IIC_M_NOSTOP) != 0 || + (nostop && i + 1 < nmsgs)) { + rpstart = 1; /* Next message gets repeated start */ + } else { rpstart = 0; iicbus_stop(bus); - } else { - rpstart = 1; /* Next message gets repeated start */ } } return (error);