diff --git a/sys/arm/samsung/exynos/chrome_ec.c b/sys/arm/samsung/exynos/chrome_ec.c index 7aa28bda831b..ef64c1ac4ecb 100644 --- a/sys/arm/samsung/exynos/chrome_ec.c +++ b/sys/arm/samsung/exynos/chrome_ec.c @@ -165,7 +165,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, int i; msg_dout = malloc(dout_len + 4, M_DEVBUF, M_NOWAIT); - msg_dinp = malloc(dinp_len + 4, M_DEVBUF, M_NOWAIT); + msg_dinp = malloc(dinp_len + 3, M_DEVBUF, M_NOWAIT); if (ec_sc == NULL) return (-1); @@ -184,7 +184,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, struct iic_msg msgs[] = { { 0x1e, IIC_M_WR, dout_len + 4, msg_dout, }, - { 0x1e, IIC_M_RD, dinp_len + 4, msg_dinp, }, + { 0x1e, IIC_M_RD, dinp_len + 3, msg_dinp, }, }; ret = iicbus_transfer(sc->dev, msgs, 2); @@ -196,7 +196,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, } for (i = 0; i < dinp_len; i++) { - dinp[i] = msg_dinp[i + 3]; + dinp[i] = msg_dinp[i + 2]; }; free(msg_dout, M_DEVBUF); diff --git a/sys/arm/samsung/exynos/exynos5_i2c.c b/sys/arm/samsung/exynos/exynos5_i2c.c index bf7548fad83a..ef63a7e7f5f1 100644 --- a/sys/arm/samsung/exynos/exynos5_i2c.c +++ b/sys/arm/samsung/exynos/exynos5_i2c.c @@ -372,6 +372,13 @@ i2c_read(device_t dev, char *buf, int len, mtx_lock(&sc->mutex); /* dummy read */ + clear_ipend(sc); + error = wait_for_iif(sc); + if (error) { + DPRINTF("cant i2c read: iif error\n"); + mtx_unlock(&sc->mutex); + return (error); + } READ1(sc, I2CDS); DPRINTF("Read ");