git: 4501b0707198 - main - rk_i2c: do not hide NACK condition from consumers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Dec 2021 11:16:45 UTC
The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=4501b0707198e7ad1da792639a8b164f9380b95d commit 4501b0707198e7ad1da792639a8b164f9380b95d Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2021-12-15 08:59:22 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2021-12-15 11:16:04 +0000 rk_i2c: do not hide NACK condition from consumers Previously the driver would happily talk to addresses with no device returning some garbage for reads and sending bits into the void for writes. MFC after: 1 week --- sys/arm64/rockchip/rk_i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c index 9db6d8739bbd..ef41044e65cb 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -453,6 +453,7 @@ rk_i2c_start_xfer(struct rk_i2c_softc *sc, struct iic_msg *msg, boolean_t last) RK_I2C_IEN_NAKRCVIEN); } } + reg |= RK_I2C_CON_NAKSTOP; reg |= sc->mode << RK_I2C_CON_MODE_SHIFT; reg |= RK_I2C_CON_EN; RK_I2C_WRITE(sc, RK_I2C_CON, reg); @@ -572,6 +573,9 @@ rk_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) sc->busy = 0; + if (sc->nak_recv) + err = IIC_ENOACK; + RK_I2C_UNLOCK(sc); return (err); }