freebsd-dev/sys/dev/iicbus
Andriy Gapon 04622a7f21 twsi: move handling of TWSI_CONTROL_ACK into the state machine
Previously the code set TWSI_CONTROL_ACK in twsi_transfer() based on
whether the first message had a length of one.  That was done regardless
of whether the message was a read or write and what kind of messages
followed it.
Now the bit is set or cleared while handling TWSI_STATUS_ADDR_R_ACK
state transition based on the current (read) message.

The old code did not correctly work in a scenario where a single byte
was read from an EEPROM device with two byte addressing.
For example:
    i2c -m tr -a 0x50 -d r -w 16 -o 0 -c 1 -v
The reason is that the first message (a write) has two bytes, so
TWSI_CONTROL_ACK was set and never cleared.
Since the controller did not send NACK the EEPROM sent more data resulting
in a buffer overrun.

While working on TWSI_STATUS_ADDR_R_ACK I also added support for
the zero-length read access and then I did the same for zero-length write
access.
While rare, those types of I2C transactions are completely valid and are
used by some devices.

PR:		258994
MFC after:	3 weeks
2021-11-26 16:17:24 +02:00
..
gpio TCA6408: Add driver for tca6408 gpio expander 2021-11-24 07:40:38 +01:00
mux pca954x: driver for PCA954x / TCA954x I2C switches 2021-11-13 11:27:41 +02:00
pmic pmic: rockchip: Rename the driver with _pmu as it was before 2021-11-14 20:26:33 +01:00
rtc Pcf85063: Add RTC driver 2021-11-24 07:40:38 +01:00
twsi twsi: move handling of TWSI_CONTROL_ACK into the state machine 2021-11-26 16:17:24 +02:00
acpi_iicbus.c newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
ad7417.c
ad7418.c
adm1030.c
ads111x.c Revert "Define PNP info after defining driver modules" 2021-01-23 10:59:41 -05:00
adt746x.c
ds13rtc.c
ds1307.c ds1307: allow configuration via hints on FDT-based systems 2021-11-13 11:23:10 +02:00
ds1307reg.h
ds1631.c
ds1672.c
ds1775.c
ds3231.c
ds3231reg.h The ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed, 2020-07-19 18:53:19 +00:00
htu21.c htu21: don't needlessly bother hardware when measurements are not needed 2021-11-06 19:39:52 +02:00
icee.c icee: allow configuration via hints on FDT-based systems 2021-11-13 11:24:57 +02:00
if_ic.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
iic_recover_bus.c
iic_recover_bus.h
iic.c
iic.h
iicbb_if.m
iicbb.c move defintion of hw.i2c sysctl node from iicbb to iicbus 2020-09-03 08:02:19 +00:00
iicbus_if.m
iicbus.c newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
iicbus.h newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
iichid.c iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts 2021-07-09 22:32:59 +03:00
iicoc_fdt.c iicoc: support building as a module 2021-11-01 12:33:39 +08:00
iicoc_pci.c
iicoc.c iicoc: fix repeated start 2021-11-01 12:29:29 +08:00
iicoc.h
iiconf.c
iiconf.h
iicsmb.c iicsmb: Request the bus recursively in bread() 2021-02-23 20:06:16 +00:00
isl12xx.c
lm75.c
max6690.c Provide a slightly more-tolerant set of thermal parameters for PowerMac 2020-10-15 13:43:43 +00:00
max44009.c driver for MAX44009 I2C illuminance sensor 2021-11-06 19:19:04 +02:00
nxprtc.c
ofw_iicbus.c newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
pcf8591.c pcf8591: driver for adc/dac with i2c interface 2021-11-06 19:14:50 +02:00
rtc8583.c
s35390a.c
sy8106a.c
syr827.c