Skip to content

Commit c615035

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into master
Pull i2c fixes from Wolfram Sang: "Again some driver bugfixes and some documentation fixes" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: i2c-qcom-geni: Fix DMA transfer race i2c: rcar: always clear ICSAR to avoid side effects MAINTAINERS: i2c: at91: handover maintenance to Codrin Ciubotariu i2c: drop duplicated word in the header file i2c: cadence: Clear HOLD bit at correct time in Rx path Revert "i2c: cadence: Fix the hold bit setting"
2 parents b85bcb7 + 02b9aec commit c615035

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11241,7 +11241,7 @@ S: Maintained
1124111241
F: drivers/crypto/atmel-ecc.*
1124211242

1124311243
MICROCHIP I2C DRIVER
11244-
M: Ludovic Desroches <ludovic.desroches@microchip.com>
11244+
M: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
1124511245
1124611246
S: Supported
1124711247
F: drivers/i2c/busses/i2c-at91-*.c

drivers/i2c/busses/i2c-cadence.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -421,20 +421,21 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr)
421421
/* Read data if receive data valid is set */
422422
while (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) &
423423
CDNS_I2C_SR_RXDV) {
424-
/*
425-
* Clear hold bit that was set for FIFO control if
426-
* RX data left is less than FIFO depth, unless
427-
* repeated start is selected.
428-
*/
429-
if ((id->recv_count < CDNS_I2C_FIFO_DEPTH) &&
430-
!id->bus_hold_flag)
431-
cdns_i2c_clear_bus_hold(id);
432-
433424
if (id->recv_count > 0) {
434425
*(id->p_recv_buf)++ =
435426
cdns_i2c_readreg(CDNS_I2C_DATA_OFFSET);
436427
id->recv_count--;
437428
id->curr_recv_count--;
429+
430+
/*
431+
* Clear hold bit that was set for FIFO control
432+
* if RX data left is less than or equal to
433+
* FIFO DEPTH unless repeated start is selected
434+
*/
435+
if (id->recv_count <= CDNS_I2C_FIFO_DEPTH &&
436+
!id->bus_hold_flag)
437+
cdns_i2c_clear_bus_hold(id);
438+
438439
} else {
439440
dev_err(id->adap.dev.parent,
440441
"xfer_size reg rollover. xfer aborted!\n");
@@ -594,10 +595,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
594595
* Check for the message size against FIFO depth and set the
595596
* 'hold bus' bit if it is greater than FIFO depth.
596597
*/
597-
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
598+
if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
598599
ctrl_reg |= CDNS_I2C_CR_HOLD;
599-
else
600-
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
601600

602601
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
603602

@@ -654,11 +653,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
654653
* Check for the message size against FIFO depth and set the
655654
* 'hold bus' bit if it is greater than FIFO depth.
656655
*/
657-
if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
656+
if (id->send_count > CDNS_I2C_FIFO_DEPTH)
658657
ctrl_reg |= CDNS_I2C_CR_HOLD;
659-
else
660-
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
661-
662658
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
663659

664660
/* Clear the interrupts in interrupt status register. */

drivers/i2c/busses/i2c-qcom-geni.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,15 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
367367
geni_se_select_mode(se, GENI_SE_FIFO);
368368

369369
writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN);
370-
geni_se_setup_m_cmd(se, I2C_READ, m_param);
371370

372371
if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) {
373372
geni_se_select_mode(se, GENI_SE_FIFO);
374373
i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
375374
dma_buf = NULL;
376375
}
377376

377+
geni_se_setup_m_cmd(se, I2C_READ, m_param);
378+
378379
time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
379380
if (!time_left)
380381
geni_i2c_abort_xfer(gi2c);
@@ -408,14 +409,15 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
408409
geni_se_select_mode(se, GENI_SE_FIFO);
409410

410411
writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN);
411-
geni_se_setup_m_cmd(se, I2C_WRITE, m_param);
412412

413413
if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) {
414414
geni_se_select_mode(se, GENI_SE_FIFO);
415415
i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
416416
dma_buf = NULL;
417417
}
418418

419+
geni_se_setup_m_cmd(se, I2C_WRITE, m_param);
420+
419421
if (!dma_buf) /* Get FIFO IRQ */
420422
writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG);
421423

drivers/i2c/busses/i2c-rcar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ static int rcar_unreg_slave(struct i2c_client *slave)
868868
/* disable irqs and ensure none is running before clearing ptr */
869869
rcar_i2c_write(priv, ICSIER, 0);
870870
rcar_i2c_write(priv, ICSCR, 0);
871+
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
871872

872873
synchronize_irq(priv->irq);
873874
priv->slave = NULL;
@@ -969,6 +970,8 @@ static int rcar_i2c_probe(struct platform_device *pdev)
969970
if (ret < 0)
970971
goto out_pm_put;
971972

973+
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
974+
972975
if (priv->devtype == I2C_RCAR_GEN3) {
973976
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
974977
if (!IS_ERR(priv->rstc)) {

include/linux/i2c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct property_entry;
5656
* on a bus (or read from them). Apart from two basic transfer functions to
5757
* transmit one message at a time, a more complex version can be used to
5858
* transmit an arbitrary number of messages without interruption.
59-
* @count must be be less than 64k since msg.len is u16.
59+
* @count must be less than 64k since msg.len is u16.
6060
*/
6161
int i2c_transfer_buffer_flags(const struct i2c_client *client,
6262
char *buf, int count, u16 flags);

0 commit comments

Comments
 (0)