openwrt/target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

47 lines
1.5 KiB
Diff

From 85048a8a0df324df94f9585c1e01d0a4419de4dc Mon Sep 17 00:00:00 2001
From: Clark Wang <xiaoning.wang@nxp.com>
Date: Wed, 27 Nov 2019 14:23:55 +0800
Subject: [PATCH] LF-98 i2c: imx: fix the judgement of slave mode in isr
The I2CR[MSTA] will be modified by software or hardware even in master
mode. The judgment of slave mode by reading CR register is unreliable.
Change to use i2c_imx->slave registered status to judge i2c mode.
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
---
drivers/i2c/busses/i2c-imx.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1451,23 +1451,20 @@ static const struct i2c_algorithm i2c_im
static irqreturn_t i2c_imx_isr(int irq, void *dev_id)
{
struct imx_i2c_struct *i2c_imx = dev_id;
- unsigned int status, ctl;
- irqreturn_t irq_status = IRQ_NONE;
+ unsigned int status;
status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
- ctl = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
if (status & I2SR_IIF) {
i2c_imx_clr_if_bit(status, i2c_imx);
- if (ctl & I2CR_MSTA)
- irq_status = i2c_imx_master_isr(i2c_imx);
#if IS_ENABLED(CONFIG_I2C_SLAVE)
- else
- irq_status = i2c_imx_slave_isr(i2c_imx);
+ if (i2c_imx->slave)
+ return i2c_imx_slave_isr(i2c_imx);
#endif
+ return i2c_imx_master_isr(i2c_imx);
}
- return irq_status;
+ return IRQ_NONE;
}
static int i2c_imx_probe(struct platform_device *pdev)