Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
"Three driver bugfixes, and two reverts because the original patches
revealed underlying problems which the Tegra guys are now working on"

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: aspeed: Avoid i2c interrupt status clear race condition.
i2c: amd-mp2-pci: Fix Oops in amd_mp2_pci_init() error handling
Revert "i2c: tegra: Better handle case where CPU0 is busy for a long time"
Revert "i2c: tegra: Synchronize DMA before termination"
i2c: iproc: generate stop event for slave writes

+20 -26
+1 -1
drivers/i2c/busses/i2c-amd-mp2-pci.c
··· 349 349 if (!privdata) 350 350 return -ENOMEM; 351 351 352 + privdata->pci_dev = pci_dev; 352 353 rc = amd_mp2_pci_init(privdata, pci_dev); 353 354 if (rc) 354 355 return rc; 355 356 356 357 mutex_init(&privdata->c2p_lock); 357 - privdata->pci_dev = pci_dev; 358 358 359 359 pm_runtime_set_autosuspend_delay(&pci_dev->dev, 1000); 360 360 pm_runtime_use_autosuspend(&pci_dev->dev);
+4 -1
drivers/i2c/busses/i2c-aspeed.c
··· 603 603 /* Ack all interrupts except for Rx done */ 604 604 writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE, 605 605 bus->base + ASPEED_I2C_INTR_STS_REG); 606 + readl(bus->base + ASPEED_I2C_INTR_STS_REG); 606 607 irq_remaining = irq_received; 607 608 608 609 #if IS_ENABLED(CONFIG_I2C_SLAVE) ··· 646 645 irq_received, irq_handled); 647 646 648 647 /* Ack Rx done */ 649 - if (irq_received & ASPEED_I2CD_INTR_RX_DONE) 648 + if (irq_received & ASPEED_I2CD_INTR_RX_DONE) { 650 649 writel(ASPEED_I2CD_INTR_RX_DONE, 651 650 bus->base + ASPEED_I2C_INTR_STS_REG); 651 + readl(bus->base + ASPEED_I2C_INTR_STS_REG); 652 + } 652 653 spin_unlock(&bus->lock); 653 654 return irq_remaining ? IRQ_NONE : IRQ_HANDLED; 654 655 }
+3
drivers/i2c/busses/i2c-bcm-iproc.c
··· 360 360 value = (u8)((val >> S_RX_DATA_SHIFT) & S_RX_DATA_MASK); 361 361 i2c_slave_event(iproc_i2c->slave, 362 362 I2C_SLAVE_WRITE_RECEIVED, &value); 363 + if (rx_status == I2C_SLAVE_RX_END) 364 + i2c_slave_event(iproc_i2c->slave, 365 + I2C_SLAVE_STOP, &value); 363 366 } 364 367 } else if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) { 365 368 /* Master read other than start */
+12 -24
drivers/i2c/busses/i2c-tegra.c
··· 996 996 do { 997 997 u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS); 998 998 999 - if (status) 999 + if (status) { 1000 1000 tegra_i2c_isr(i2c_dev->irq, i2c_dev); 1001 1001 1002 - if (completion_done(complete)) { 1003 - s64 delta = ktime_ms_delta(ktimeout, ktime); 1002 + if (completion_done(complete)) { 1003 + s64 delta = ktime_ms_delta(ktimeout, ktime); 1004 1004 1005 - return msecs_to_jiffies(delta) ?: 1; 1005 + return msecs_to_jiffies(delta) ?: 1; 1006 + } 1006 1007 } 1007 1008 1008 1009 ktime = ktime_get(); ··· 1030 1029 disable_irq(i2c_dev->irq); 1031 1030 1032 1031 /* 1033 - * Under some rare circumstances (like running KASAN + 1034 - * NFS root) CPU, which handles interrupt, may stuck in 1035 - * uninterruptible state for a significant time. In this 1036 - * case we will get timeout if I2C transfer is running on 1037 - * a sibling CPU, despite of IRQ being raised. 1038 - * 1039 - * In order to handle this rare condition, the IRQ status 1040 - * needs to be checked after timeout. 1032 + * There is a chance that completion may happen after IRQ 1033 + * synchronization, which is done by disable_irq(). 1041 1034 */ 1042 - if (ret == 0) 1043 - ret = tegra_i2c_poll_completion_timeout(i2c_dev, 1044 - complete, 0); 1035 + if (ret == 0 && completion_done(complete)) { 1036 + dev_warn(i2c_dev->dev, 1037 + "completion done after timeout\n"); 1038 + ret = 1; 1039 + } 1045 1040 } 1046 1041 1047 1042 return ret; ··· 1215 1218 if (dma) { 1216 1219 time_left = tegra_i2c_wait_completion_timeout( 1217 1220 i2c_dev, &i2c_dev->dma_complete, xfer_time); 1218 - 1219 - /* 1220 - * Synchronize DMA first, since dmaengine_terminate_sync() 1221 - * performs synchronization after the transfer's termination 1222 - * and we want to get a completion if transfer succeeded. 1223 - */ 1224 - dmaengine_synchronize(i2c_dev->msg_read ? 1225 - i2c_dev->rx_dma_chan : 1226 - i2c_dev->tx_dma_chan); 1227 1221 1228 1222 dmaengine_terminate_sync(i2c_dev->msg_read ? 1229 1223 i2c_dev->rx_dma_chan :