diff options
Diffstat (limited to 'target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch')
-rw-r--r-- | target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch b/target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch new file mode 100644 index 0000000000..45f7fa36a2 --- /dev/null +++ b/target/linux/layerscape/patches-5.4/808-i2c-0013-LF-98-i2c-imx-fix-the-judgement-of-slave-mode-in-isr.patch @@ -0,0 +1,46 @@ +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) |