diff options
author | ian <ian@FreeBSD.org> | 2015-10-09 22:49:50 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-10-09 22:49:50 +0000 |
commit | 649b177fe3c5df9bfe4b762d42025e6025d770f9 (patch) | |
tree | bbb140dc59e21b4f7aac6e3bb75a3e623af290c2 /sys/arm | |
parent | 0fec972d61176205b027afb563c843df9b03d010 (diff) | |
download | FreeBSD-src-649b177fe3c5df9bfe4b762d42025e6025d770f9.zip FreeBSD-src-649b177fe3c5df9bfe4b762d42025e6025d770f9.tar.gz |
Use IIC_EBUSBSY and IIC_BUSERR status values consistantly across all drivers.
Make it clearer what each one means in the comments that define them.
IIC_BUSBSY was used in many places to mean two different things, either
"someone else has reserved the bus so you have to wait until they're done"
or "the signal level on the bus was not in the state I expected before/after
issuing some command".
Now IIC_BUSERR is used consistantly to refer to protocol/signaling errors,
and IIC_BUSBSY refers to ownership/reservation of the bus.
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/freescale/imx/imx_i2c.c | 4 | ||||
-rw-r--r-- | sys/arm/freescale/vybrid/vf_i2c.c | 4 | ||||
-rw-r--r-- | sys/arm/samsung/exynos/exynos5_i2c.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/arm/freescale/imx/imx_i2c.c b/sys/arm/freescale/imx/imx_i2c.c index ad2f6b7..0249275 100644 --- a/sys/arm/freescale/imx/imx_i2c.c +++ b/sys/arm/freescale/imx/imx_i2c.c @@ -243,7 +243,7 @@ wait_for_xfer(struct i2c_softc *sc, int checkack) sr = i2c_read_reg(sc, I2C_STATUS_REG); if (sr & I2CSR_MIF) { if (sr & I2CSR_MAL) - return (IIC_EBUSBSY); + return (IIC_EBUSERR); else if (checkack && (sr & I2CSR_RXAK)) return (IIC_ENOACK); else @@ -350,7 +350,7 @@ i2c_start(device_t dev, u_char slave, int timeout) i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); DELAY(10); /* Delay for controller to sample bus state. */ if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) { - return (i2c_error_handler(sc, IIC_EBUSBSY)); + return (i2c_error_handler(sc, IIC_EBUSERR)); } i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX); if ((error = wait_for_busbusy(sc, true)) != IIC_NOERR) diff --git a/sys/arm/freescale/vybrid/vf_i2c.c b/sys/arm/freescale/vybrid/vf_i2c.c index c554ce2..8008d1a 100644 --- a/sys/arm/freescale/vybrid/vf_i2c.c +++ b/sys/arm/freescale/vybrid/vf_i2c.c @@ -232,7 +232,7 @@ i2c_repeated_start(device_t dev, u_char slave, int timeout) if ((READ1(sc, I2C_IBSR) & IBSR_IBB) == 0) { mtx_unlock(&sc->mutex); - return (IIC_EBUSBSY); + return (IIC_EBUSERR); } /* Set repeated start condition */ @@ -275,7 +275,7 @@ i2c_start(device_t dev, u_char slave, int timeout) if (READ1(sc, I2C_IBSR) & IBSR_IBB) { mtx_unlock(&sc->mutex); vf_i2c_dbg(sc, "cant i2c start: IIC_EBUSBSY\n"); - return (IIC_EBUSBSY); + return (IIC_EBUSERR); } /* Set start condition */ diff --git a/sys/arm/samsung/exynos/exynos5_i2c.c b/sys/arm/samsung/exynos/exynos5_i2c.c index 294249a..d879138 100644 --- a/sys/arm/samsung/exynos/exynos5_i2c.c +++ b/sys/arm/samsung/exynos/exynos5_i2c.c @@ -263,8 +263,8 @@ i2c_start(device_t dev, u_char slave, int timeout) error = wait_for_nibb(sc); if (error) { mtx_unlock(&sc->mutex); - DPRINTF("cant i2c start: IIC_EBUSBSY\n"); - return (IIC_EBUSBSY); + DPRINTF("cant i2c start: IIC_EBUSERR\n"); + return (IIC_EBUSERR); } reg = READ1(sc, I2CCON); |