Date: Wed, 29 May 2019 09:08:21 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348355 - head/sys/dev/iicbus Message-ID: <201905290908.x4T98L89066643@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Wed May 29 09:08:20 2019 New Revision: 348355 URL: https://svnweb.freebsd.org/changeset/base/348355 Log: revert r273728 and parts of r306589, iicbus no-stop by default feature Since drm2 removal, there has not been any consumer of the feature in the tree. I am also unaware of any out-of-tree consumer. More importantly, the feature has been broken from the very start, both before and after r306589, because the ivar was set on a device that does not support it and it was read from another device that also does not support it. A bus-wide no-stop flag cannot be implemented as an ivar as iicbus attaches as a child of various drivers. Implementing the ivar in each and every I2C driver is just impractical. If we ever want to implement this feature properly, then probably the easiest way to do it would be via a flag in the softc of iicbus. In fact, we might have to do that in the stable branches if we want to fix the code for them. Reported by: ian (long time ago) MFC after: 1 month (maybe) X-MFC-note: cannot just merge the change, must keep drm2 happy Modified: head/sys/dev/iicbus/iicbus.c head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Wed May 29 07:33:51 2019 (r348354) +++ head/sys/dev/iicbus/iicbus.c Wed May 29 09:08:20 2019 (r348355) @@ -194,9 +194,6 @@ iicbus_read_ivar(device_t bus, device_t child, int whi case IICBUS_IVAR_ADDR: *result = devi->addr; break; - case IICBUS_IVAR_NOSTOP: - *result = devi->nostop; - break; } return (0); } @@ -213,9 +210,6 @@ iicbus_write_ivar(device_t bus, device_t child, int wh if (devi->addr != 0) return (EINVAL); devi->addr = value; - case IICBUS_IVAR_NOSTOP: - devi->nostop = value; - break; } return (0); } Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Wed May 29 07:33:51 2019 (r348354) +++ head/sys/dev/iicbus/iicbus.h Wed May 29 09:08:20 2019 (r348355) @@ -54,19 +54,16 @@ struct iicbus_ivar { uint32_t addr; struct resource_list rl; - bool nostop; }; enum { - IICBUS_IVAR_ADDR, /* Address or base address */ - IICBUS_IVAR_NOSTOP, /* nostop defaults */ + IICBUS_IVAR_ADDR /* Address or base address */ }; #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: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Wed May 29 07:33:51 2019 (r348354) +++ head/sys/dev/iicbus/iiconf.c Wed May 29 09:08:20 2019 (r348355) @@ -427,7 +427,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs { int i, error, lenread, lenwrote, nkid, rpstart, addr; device_t *children, bus; - bool nostop, started; + bool started; if ((error = device_get_children(dev, &children, &nkid)) != 0) return (IIC_ERESOURCE); @@ -438,7 +438,6 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs bus = children[0]; rpstart = 0; free(children, M_TEMP); - nostop = iicbus_get_nostop(dev); started = false; for (i = 0, error = 0; i < nmsgs && error == 0; i++) { addr = msgs[i].slave; @@ -466,12 +465,11 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs if (error != 0) break; - if ((msgs[i].flags & IIC_M_NOSTOP) != 0 || - (nostop && i + 1 < nmsgs)) { - rpstart = 1; /* Next message gets repeated start */ - } else { + if (!(msgs[i].flags & IIC_M_NOSTOP)) { rpstart = 0; iicbus_stop(bus); + } else { + rpstart = 1; /* Next message gets repeated start */ } } if (error != 0 && started)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905290908.x4T98L89066643>