From patchwork Wed Feb 22 10:11:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9586521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1225F6020B for ; Wed, 22 Feb 2017 10:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0DA1288DD for ; Wed, 22 Feb 2017 10:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4CBC288E0; Wed, 22 Feb 2017 10:11:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76F3D288EA for ; Wed, 22 Feb 2017 10:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754427AbdBVKL3 (ORCPT ); Wed, 22 Feb 2017 05:11:29 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:42107 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753556AbdBVKL1 (ORCPT ); Wed, 22 Feb 2017 05:11:27 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLR00GY4TN0KD80@mailout3.w1.samsung.com>; Wed, 22 Feb 2017 10:11:24 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170222101124eucas1p10d954448d38e43329e0be80e7802569e~llEboxlpn1258112581eucas1p1Y; Wed, 22 Feb 2017 10:11:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 66.62.28517.BC36DA85; Wed, 22 Feb 2017 10:11:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0~llEa_3Rxi2694926949eucas1p2i; Wed, 22 Feb 2017 10:11:23 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-66-58ad63cb089f Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A1.85.06687.0246DA85; Wed, 22 Feb 2017 10:12:48 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLR00B9LTMYWI00@eusync3.samsung.com>; Wed, 22 Feb 2017 10:11:23 +0000 (GMT) From: Andrzej Hajda To: Wolfram Sang , Krzysztof Kozlowski , Javier Martinez Canillas , linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [PATCH v2] i2c: exynos5: disable fifo-almost-empty irq signal when necessary Date: Wed, 22 Feb 2017 11:11:20 +0100 Message-id: <1487758280-22801-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87qnk9dGGOzfamFxa905VouNM9az Wrx5u4bJ4vz5DewWHX+/MFrMOL+PyWLtkbvsFitPzGJ24PDYtKqTzWNL/112j74tqxg9Tp56 wuLxeZNc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5zgiSYBPQlPi7+SYbSEJE4ACjxLaz/9hBHGaBPkaJxr+rwNqF BcIl+p8tYAWxWQRUJS5/vM4EYvMKOEu0zehkhFgnJ3HzXCfzBEbuBYwMqxhFUkuLc9Nziw31 ihNzi0vz0vWS83M3MQIDdduxn5t3MF7aGHyIUYCDUYmH94H7mggh1sSy4srcQ4wSHMxKIrwC SWsjhHhTEiurUovy44tKc1KLDzGaAi2fyCwlmpwPjKK8knhDE0NzS0MjYwsLcyMjJXHekg9X woUE0hNLUrNTUwtSi2D6mDg4pRoY2Q/q9arNPtH2ZVuhTseZZ7Exy3hbe+d26Zy3frrbkp/9 3X67k07u51bcrle1Fi14GriHYVb9k/RCd6kJyX+L7y5K2r8oi22hI8s550v8z6suJZ5cNLPc I1uv4UB7Vf/jVAflg0Id6/VFDz3deX6e7dusXpenJy5aGQnGru6xuPB+usnhXN96JZbijERD Leai4kQAjckToGoCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0 X-RootMTR: 20170222101123eucas1p25482d192dd5d119aaf6ddc15a01c60c0 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Marek Szyprowski Tested-by: Andi Shyti Reviewed-by: Andi Shyti --- 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++];