|
57 | 57 | #define HISI_I2C_FS_SPK_LEN_CNT GENMASK(7, 0)
|
58 | 58 | #define HISI_I2C_HS_SPK_LEN 0x003c
|
59 | 59 | #define HISI_I2C_HS_SPK_LEN_CNT GENMASK(7, 0)
|
| 60 | +#define HISI_I2C_TX_INT_CLR 0x0040 |
| 61 | +#define HISI_I2C_TX_AEMPTY_INT BIT(0) |
60 | 62 | #define HISI_I2C_INT_MSTAT 0x0044
|
61 | 63 | #define HISI_I2C_INT_CLR 0x0048
|
62 | 64 | #define HISI_I2C_INT_MASK 0x004C
|
@@ -124,6 +126,11 @@ static void hisi_i2c_clear_int(struct hisi_i2c_controller *ctlr, u32 mask)
|
124 | 126 | writel_relaxed(mask, ctlr->iobase + HISI_I2C_INT_CLR);
|
125 | 127 | }
|
126 | 128 |
|
| 129 | +static void hisi_i2c_clear_tx_int(struct hisi_i2c_controller *ctlr, u32 mask) |
| 130 | +{ |
| 131 | + writel_relaxed(mask, ctlr->iobase + HISI_I2C_TX_INT_CLR); |
| 132 | +} |
| 133 | + |
127 | 134 | static void hisi_i2c_handle_errors(struct hisi_i2c_controller *ctlr)
|
128 | 135 | {
|
129 | 136 | u32 int_err = ctlr->xfer_err, reg;
|
@@ -168,6 +175,7 @@ static int hisi_i2c_start_xfer(struct hisi_i2c_controller *ctlr)
|
168 | 175 | writel(reg, ctlr->iobase + HISI_I2C_FIFO_CTRL);
|
169 | 176 |
|
170 | 177 | hisi_i2c_clear_int(ctlr, HISI_I2C_INT_ALL);
|
| 178 | + hisi_i2c_clear_tx_int(ctlr, HISI_I2C_TX_AEMPTY_INT); |
171 | 179 | hisi_i2c_enable_int(ctlr, HISI_I2C_INT_ALL);
|
172 | 180 |
|
173 | 181 | return 0;
|
@@ -323,6 +331,8 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
|
323 | 331 | */
|
324 | 332 | if (ctlr->msg_tx_idx == ctlr->msg_num)
|
325 | 333 | hisi_i2c_disable_int(ctlr, HISI_I2C_INT_TX_EMPTY);
|
| 334 | + |
| 335 | + hisi_i2c_clear_tx_int(ctlr, HISI_I2C_TX_AEMPTY_INT); |
326 | 336 | }
|
327 | 337 |
|
328 | 338 | static irqreturn_t hisi_i2c_irq(int irq, void *context)
|
@@ -363,6 +373,7 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
|
363 | 373 | if (int_stat & HISI_I2C_INT_TRANS_CPLT) {
|
364 | 374 | hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL);
|
365 | 375 | hisi_i2c_clear_int(ctlr, HISI_I2C_INT_ALL);
|
| 376 | + hisi_i2c_clear_tx_int(ctlr, HISI_I2C_TX_AEMPTY_INT); |
366 | 377 | complete(ctlr->completion);
|
367 | 378 | }
|
368 | 379 |
|
|
0 commit comments