All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary
       [not found] <CGME20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0@eucas1p2.samsung.com>
@ 2017-02-22 10:11 ` Andrzej Hajda
  2017-02-22 11:10   ` Marek Szyprowski
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrzej Hajda @ 2017-02-22 10:11 UTC (permalink / raw)
  To: Wolfram Sang, Krzysztof Kozlowski, Javier Martinez Canillas,
	linux-i2c, linux-samsung-soc
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski

Fifo-almost-empty irq signal should be disabled as soon as possible,
to avoid unnecessary interrupt storm. The best moment is when there is
no more data to feed fifo.
This patch fixes system stalls caused by IRQ storm.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
v2:
    - removed doubled conditional

 drivers/i2c/busses/i2c-exynos5.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index bea6071..00e81e3 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -502,8 +502,13 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id)
 		fifo_level = HSI2C_TX_FIFO_LVL(fifo_status);
 
 		len = i2c->variant->fifo_depth - fifo_level;
-		if (len > (i2c->msg->len - i2c->msg_ptr))
+		if (len > (i2c->msg->len - i2c->msg_ptr)) {
+			u32 int_en = readl(i2c->regs + HSI2C_INT_ENABLE);
+
+			int_en &= ~HSI2C_INT_TX_ALMOSTEMPTY_EN;
+			writel(int_en, i2c->regs + HSI2C_INT_ENABLE);
 			len = i2c->msg->len - i2c->msg_ptr;
+		}
 
 		while (len > 0) {
 			byte = i2c->msg->buf[i2c->msg_ptr++];
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary
  2017-02-22 10:11 ` [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary Andrzej Hajda
@ 2017-02-22 11:10   ` Marek Szyprowski
  2017-02-23  6:31   ` Andi Shyti
  2017-02-23 12:03   ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2017-02-22 11:10 UTC (permalink / raw)
  To: Andrzej Hajda, Wolfram Sang, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-i2c, linux-samsung-soc
  Cc: Bartlomiej Zolnierkiewicz, 최찬우

Hi,

On 2017-02-22 11:11, Andrzej Hajda wrote:
> Fifo-almost-empty irq signal should be disabled as soon as possible,
> to avoid unnecessary interrupt storm. The best moment is when there is
> no more data to feed fifo.
> This patch fixes system stalls caused by IRQ storm.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

With this patch TM2 board boots fine on linux-next from 21st Feb 2017
and maxcpus=1 in kernel command line.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
> v2:
>      - removed doubled conditional
>
>   drivers/i2c/busses/i2c-exynos5.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
> index bea6071..00e81e3 100644
> --- a/drivers/i2c/busses/i2c-exynos5.c
> +++ b/drivers/i2c/busses/i2c-exynos5.c
> @@ -502,8 +502,13 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id)
>   		fifo_level = HSI2C_TX_FIFO_LVL(fifo_status);
>   
>   		len = i2c->variant->fifo_depth - fifo_level;
> -		if (len > (i2c->msg->len - i2c->msg_ptr))
> +		if (len > (i2c->msg->len - i2c->msg_ptr)) {
> +			u32 int_en = readl(i2c->regs + HSI2C_INT_ENABLE);
> +
> +			int_en &= ~HSI2C_INT_TX_ALMOSTEMPTY_EN;
> +			writel(int_en, i2c->regs + HSI2C_INT_ENABLE);
>   			len = i2c->msg->len - i2c->msg_ptr;
> +		}
>   
>   		while (len > 0) {
>   			byte = i2c->msg->buf[i2c->msg_ptr++];

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary
  2017-02-22 10:11 ` [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary Andrzej Hajda
  2017-02-22 11:10   ` Marek Szyprowski
@ 2017-02-23  6:31   ` Andi Shyti
  2017-02-23 12:03   ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2017-02-23  6:31 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Wolfram Sang, Krzysztof Kozlowski, Javier Martinez Canillas,
	linux-i2c, linux-samsung-soc, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski

Hi Andrzej,

On Wed, Feb 22, 2017 at 11:11:20AM +0100, Andrzej Hajda wrote:
> Fifo-almost-empty irq signal should be disabled as soon as possible,
> to avoid unnecessary interrupt storm. The best moment is when there is
> no more data to feed fifo.
> This patch fixes system stalls caused by IRQ storm.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Looks good,

Tested-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Andi Shyti <andi.shyti@samsung.com>

Thanks,
Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary
  2017-02-22 10:11 ` [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary Andrzej Hajda
  2017-02-22 11:10   ` Marek Szyprowski
  2017-02-23  6:31   ` Andi Shyti
@ 2017-02-23 12:03   ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2017-02-23 12:03 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Krzysztof Kozlowski, Javier Martinez Canillas, linux-i2c,
	linux-samsung-soc, Bartlomiej Zolnierkiewicz, Marek Szyprowski

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Wed, Feb 22, 2017 at 11:11:20AM +0100, Andrzej Hajda wrote:
> Fifo-almost-empty irq signal should be disabled as soon as possible,
> to avoid unnecessary interrupt storm. The best moment is when there is
> no more data to feed fifo.
> This patch fixes system stalls caused by IRQ storm.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied to for-next (will be in this merge window), thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-23 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0@eucas1p2.samsung.com>
2017-02-22 10:11 ` [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary Andrzej Hajda
2017-02-22 11:10   ` Marek Szyprowski
2017-02-23  6:31   ` Andi Shyti
2017-02-23 12:03   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.