* [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
@ 2021-05-27 12:04 qii.wang
2021-05-27 20:14 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: qii.wang @ 2021-05-27 12:04 UTC (permalink / raw)
To: wsa
Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
linux-mediatek, srv_heupstream, leilk.liu, qii.wang
From: Qii Wang <qii.wang@mediatek.com>
The i2c controller driver do dma reset after transfer timeout,
but sometimes dma reset will trigger an unexpected DMA_ERR irq.
It will cause the i2c controller to continuously send interrupts
to the system and cause soft lock-up. So we need to disable i2c
start_en and clear intr_stat to stop i2c controller before dma
reset when transfer timeout.
Signed-off-by: Qii Wang <qii.wang@mediatek.com>
---
drivers/i2c/busses/i2c-mt65xx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index ea337ba..bfd80b2 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -479,6 +479,11 @@ static void mtk_i2c_clock_disable(struct mtk_i2c *i2c)
static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
{
u16 control_reg;
+ u16 intr_stat_reg;
+
+ mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START);
+ intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT);
+ mtk_i2c_writew(i2c, intr_stat_reg, OFFSET_INTR_STAT);
if (i2c->dev_comp->apdma_sync) {
writel(I2C_DMA_WARM_RST, i2c->pdmabase + OFFSET_RST);
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
2021-05-27 12:04 [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset qii.wang
@ 2021-05-27 20:14 ` Wolfram Sang
2021-05-28 1:37 ` Qii Wang
0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2021-05-27 20:14 UTC (permalink / raw)
To: qii.wang
Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
linux-mediatek, srv_heupstream, leilk.liu
[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]
On Thu, May 27, 2021 at 08:04:04PM +0800, qii.wang@mediatek.com wrote:
> From: Qii Wang <qii.wang@mediatek.com>
>
> The i2c controller driver do dma reset after transfer timeout,
> but sometimes dma reset will trigger an unexpected DMA_ERR irq.
> It will cause the i2c controller to continuously send interrupts
> to the system and cause soft lock-up. So we need to disable i2c
> start_en and clear intr_stat to stop i2c controller before dma
> reset when transfer timeout.
>
> Signed-off-by: Qii Wang <qii.wang@mediatek.com>
Is there a suitable Fixes tag for this?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
2021-05-27 20:14 ` Wolfram Sang
@ 2021-05-28 1:37 ` Qii Wang
2021-05-28 8:13 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Qii Wang @ 2021-05-28 1:37 UTC (permalink / raw)
To: Wolfram Sang
Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
linux-mediatek, srv_heupstream, leilk.liu
On Thu, 2021-05-27 at 22:14 +0200, Wolfram Sang wrote:
> On Thu, May 27, 2021 at 08:04:04PM +0800, qii.wang@mediatek.com wrote:
> > From: Qii Wang <qii.wang@mediatek.com>
> >
> > The i2c controller driver do dma reset after transfer timeout,
> > but sometimes dma reset will trigger an unexpected DMA_ERR irq.
> > It will cause the i2c controller to continuously send interrupts
> > to the system and cause soft lock-up. So we need to disable i2c
> > start_en and clear intr_stat to stop i2c controller before dma
> > reset when transfer timeout.
> >
> > Signed-off-by: Qii Wang <qii.wang@mediatek.com>
>
> Is there a suitable Fixes tag for this?
>
Can you help to add the following tag, thanks
Fixes: aafced673c06("i2c: mediatek: move dma reset before i2c reset")
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
2021-05-28 1:37 ` Qii Wang
@ 2021-05-28 8:13 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-05-28 8:13 UTC (permalink / raw)
To: Qii Wang
Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
linux-mediatek, srv_heupstream, leilk.liu
[-- Attachment #1.1: Type: text/plain, Size: 939 bytes --]
On Fri, May 28, 2021 at 09:37:43AM +0800, Qii Wang wrote:
> On Thu, 2021-05-27 at 22:14 +0200, Wolfram Sang wrote:
> > On Thu, May 27, 2021 at 08:04:04PM +0800, qii.wang@mediatek.com wrote:
> > > From: Qii Wang <qii.wang@mediatek.com>
> > >
> > > The i2c controller driver do dma reset after transfer timeout,
> > > but sometimes dma reset will trigger an unexpected DMA_ERR irq.
> > > It will cause the i2c controller to continuously send interrupts
> > > to the system and cause soft lock-up. So we need to disable i2c
> > > start_en and clear intr_stat to stop i2c controller before dma
> > > reset when transfer timeout.
> > >
> > > Signed-off-by: Qii Wang <qii.wang@mediatek.com>
> >
> > Is there a suitable Fixes tag for this?
> >
>
> Can you help to add the following tag, thanks
> Fixes: aafced673c06("i2c: mediatek: move dma reset before i2c reset")
Added this tag and applied to for-current, thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-28 8:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 12:04 [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset qii.wang
2021-05-27 20:14 ` Wolfram Sang
2021-05-28 1:37 ` Qii Wang
2021-05-28 8:13 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).