iicoc: fix repeated start
Reviewed by: jrtc27, philip MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32737
This commit is contained in:
parent
e528757ca6
commit
2a36909a94
@ -147,8 +147,8 @@ iicoc_init(device_t dev)
|
||||
return ((value & OC_CONTROL_EN) == 0);
|
||||
}
|
||||
|
||||
int
|
||||
iicoc_iicbus_start(device_t dev, u_char slave, int timeout)
|
||||
static int
|
||||
iicoc_iicbus_start_common(device_t dev, u_char slave, int timeout, bool repeat)
|
||||
{
|
||||
int error = IIC_EBUSERR;
|
||||
struct iicoc_softc *sc;
|
||||
@ -158,7 +158,7 @@ iicoc_iicbus_start(device_t dev, u_char slave, int timeout)
|
||||
sc->i2cdev_addr = (slave >> 1);
|
||||
|
||||
/* Verify the bus is idle */
|
||||
if (iicoc_wait_on_status(dev, OC_STATUS_BUSY) < 0)
|
||||
if (!repeat && iicoc_wait_on_status(dev, OC_STATUS_BUSY) < 0)
|
||||
goto i2c_stx_error;
|
||||
|
||||
/* Write Slave Address */
|
||||
@ -186,6 +186,20 @@ iicoc_iicbus_start(device_t dev, u_char slave, int timeout)
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
iicoc_iicbus_start(device_t dev, u_char slave, int timeout)
|
||||
{
|
||||
|
||||
return (iicoc_iicbus_start_common(dev, slave, timeout, false));
|
||||
}
|
||||
|
||||
int
|
||||
iicoc_iicbus_repeated_start(device_t dev, u_char slave, int timeout)
|
||||
{
|
||||
|
||||
return (iicoc_iicbus_start_common(dev, slave, timeout, true));
|
||||
}
|
||||
|
||||
int
|
||||
iicoc_iicbus_stop(device_t dev)
|
||||
{
|
||||
@ -268,10 +282,3 @@ iicoc_iicbus_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr)
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
iicoc_iicbus_repeated_start(device_t dev, u_char slave, int timeout)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user