Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107134318
D27139.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D27139.diff
View Options
diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c
--- a/sys/arm64/rockchip/rk_i2c.c
+++ b/sys/arm64/rockchip/rk_i2c.c
@@ -291,6 +291,7 @@
rk_i2c_intr_locked(struct rk_i2c_softc *sc)
{
uint32_t reg;
+ int transfer_len;
sc->ipd = RK_I2C_READ(sc, RK_I2C_IPD);
@@ -324,11 +325,16 @@
RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBRFIEN |
RK_I2C_IEN_NAKRCVIEN);
- reg = RK_I2C_READ(sc, RK_I2C_CON);
- reg |= RK_I2C_CON_LASTACK;
- RK_I2C_WRITE(sc, RK_I2C_CON, reg);
+ if ((sc->msg->len - sc->cnt) > 32)
+ transfer_len = 32;
+ else {
+ transfer_len = sc->msg->len - sc->cnt;
+ reg = RK_I2C_READ(sc, RK_I2C_CON);
+ reg |= RK_I2C_CON_LASTACK;
+ RK_I2C_WRITE(sc, RK_I2C_CON, reg);
+ }
- RK_I2C_WRITE(sc, RK_I2C_MRXCNT, sc->msg->len);
+ RK_I2C_WRITE(sc, RK_I2C_MRXCNT, transfer_len);
} else {
sc->state = STATE_WRITE;
RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBTFIEN |
@@ -344,6 +350,23 @@
if (sc->cnt == sc->msg->len)
rk_i2c_send_stop(sc);
+ else {
+ sc->mode = RK_I2C_CON_MODE_RX;
+ reg = RK_I2C_READ(sc, RK_I2C_CON) & \
+ ~RK_I2C_CON_CTRL_MASK;
+ reg |= sc->mode << RK_I2C_CON_MODE_SHIFT;
+ reg |= RK_I2C_CON_EN;
+
+ if ((sc->msg->len - sc->cnt) > 32)
+ transfer_len = 32;
+ else {
+ transfer_len = sc->msg->len - sc->cnt;
+ reg |= RK_I2C_CON_LASTACK;
+ }
+
+ RK_I2C_WRITE(sc, RK_I2C_CON, reg);
+ RK_I2C_WRITE(sc, RK_I2C_MRXCNT, transfer_len);
+ }
break;
case STATE_WRITE:
@@ -509,7 +532,7 @@
sc->mode = RK_I2C_CON_MODE_RX;
} else {
sc->mode = RK_I2C_CON_MODE_RRX;
- reg = msgs[i].slave & LSB;
+ reg = msgs[i].slave & ~LSB;
reg |= RK_I2C_MRXADDR_VALID(0);
RK_I2C_WRITE(sc, RK_I2C_MRXADDR, reg);
RK_I2C_WRITE(sc, RK_I2C_MRXRADDR, 0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 3:59 PM (15 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15755282
Default Alt Text
D27139.diff (1 KB)
Attached To
Mode
D27139: rk_i2c bug fix
Attached
Detach File
Event Timeline
Log In to Comment