From patchwork Tue Dec 8 14:10:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bongsu Jeon X-Patchwork-Id: 11958717 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA639C2BB48 for ; Tue, 8 Dec 2020 14:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 934C723AC9 for ; Tue, 8 Dec 2020 14:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729677AbgLHOLq (ORCPT ); Tue, 8 Dec 2020 09:11:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729265AbgLHOLp (ORCPT ); Tue, 8 Dec 2020 09:11:45 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7B1FC061285; Tue, 8 Dec 2020 06:10:42 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id c79so14005044pfc.2; Tue, 08 Dec 2020 06:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jAgAg0NFCQ9D2OHHyIrBitG3IV58eouboI/0tj7JbcU=; b=pZaR/zx95+BhtM8XrrRxKaqIYQhQow/xIHahInXMTn5NA1G4eEP8qHS8vEuxnTa9HC vR/ZBihatAC7Z294Pj+9g+v5k4gFO7FOnVykdo4yhRUeJ50n2AHQO59m6ihF7H/KM9wr ceHIoCxglmh2cAyoZcHSi76Xb0n06LdrQSIH4FGWlcVLSCSCsrc/TdPf3susjp0Iq47R cvI9qcoJdhj9j1+cJP8aiK70n1aKVjFh5bcOcrns05TucVJ2R9Td+Z+G4j6mb3ffDdkw XpBHgDGh14ljnehVPUlIsuHkmCCPreFdrPWniFFv+psi93BXPIccNFgTkdq8DEWppI3R +UHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jAgAg0NFCQ9D2OHHyIrBitG3IV58eouboI/0tj7JbcU=; b=Vwft9cHwvgICgnna3j9bG38shoLnIATxpT+TKtLM3ZJVygOC3cP8n14Hapy0fpYd10 5r1pFxTEqF7av4QLgneDHBIZT7sw6wwdd6EmaaF8uUGNuq8Uhl9hUNxd5ZkAWSMBJC/d +G4PI5vOn+yYVjJBTHtcYzd5n3ViS+bAU+9h5OIVKEymGEhj0wTOeY5E3L7gOU2tmOk2 h7o1gP5n37pNALcQw+wRYsVbgZKS0BYFZmSdS2ZNFMEHBMDulUM9N4av06oatkFQeakw bRym+8iSmXYtgoS+/D1k1eZAwJZfef+AagrXwGWLhte3P8p15MnnuJ43xFAp0HlEoLBu WZPA== X-Gm-Message-State: AOAM532QzWEnvJq7YwkKvn/NW7Q9yBr61VXQU0giqXhvGco4Gq+aI1FR HOusmXln4Cr9gmAyKNXLfxw= X-Google-Smtp-Source: ABdhPJxfDzZKHQI0QwpuTikddnptjHRXefFDE7BiEdJ5Mt3w53Z5yuH+dR92wBN6eXRHkMz43bC4yg== X-Received: by 2002:a62:2cc3:0:b029:197:dda8:476a with SMTP id s186-20020a622cc30000b0290197dda8476amr20191749pfs.37.1607436642315; Tue, 08 Dec 2020 06:10:42 -0800 (PST) Received: from localhost.localdomain ([182.226.226.37]) by smtp.googlemail.com with ESMTPSA id m15sm9071951pfa.72.2020.12.08.06.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 06:10:41 -0800 (PST) From: Bongsu Jeon X-Google-Original-From: Bongsu Jeon To: krzk@kernel.org Cc: linux-nfc@lists.01.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bongsu Jeon Subject: [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type Date: Tue, 8 Dec 2020 23:10:11 +0900 Message-Id: <20201208141012.6033-2-bongsu.jeon@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201208141012.6033-1-bongsu.jeon@samsung.com> References: <20201208141012.6033-1-bongsu.jeon@samsung.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Bongsu Jeon Change interrupt trigger from IRQ_TYPE_LEVEL_HIGH to IRQ_TYPE_EDGE_RISING for stable NFC I2C interrupt handling. Samsung's NFC Firmware sends an i2c frame as below. 1. NFC Firmware sets the GPIO(interrupt pin) high when there is an i2c frame to send. 2. If the CPU's I2C master has received the i2c frame, NFC F/W sets the GPIO low. NFC driver's i2c interrupt handler would be called in the abnormal case as the NFC FW task of number 2 is delayed because of other high priority tasks. In that case, NFC driver will try to receive the i2c frame but there isn't any i2c frame to send in NFC. It would cause an I2C communication problem. This case would hardly happen. But, I changed the interrupt as a defense code. If Driver uses the TRIGGER_RISING instead of the LEVEL trigger, there would be no problem even if the NFC FW task is delayed. Signed-off-by: Bongsu Jeon --- Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml b/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml index ca3904bf90e0..477066e2b821 100644 --- a/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml +++ b/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml @@ -76,7 +76,7 @@ examples: reg = <0x27>; interrupt-parent = <&gpa1>; - interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <3 IRQ_TYPE_EDGE_RISING>; en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>; wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>; From patchwork Tue Dec 8 14:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bongsu Jeon X-Patchwork-Id: 11958719 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 702E7C2BBCA for ; Tue, 8 Dec 2020 14:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 465A823AFB for ; Tue, 8 Dec 2020 14:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729786AbgLHOMX (ORCPT ); Tue, 8 Dec 2020 09:12:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729771AbgLHOMW (ORCPT ); Tue, 8 Dec 2020 09:12:22 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A388CC0619D6; Tue, 8 Dec 2020 06:10:47 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id w16so12262618pga.9; Tue, 08 Dec 2020 06:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WYAUhwB4AEnUmLHEPnWWbsECh1/lymsws54jeNi8rHk=; b=uTE2PPQ1eqF46LhlxYJq8vLv4XFVh7FG2bCB84O6tjwSAQry7gtty2mLw9ERXclvoD 1VHzhIw52uLaZNdlzInPZ/Ay8Ve2gBgK0tgypylJhin5Cg9VlNn0ImB5T4Oteb8Ry/5L sumH7i6/BuozblAdt1ALu+BepxhlUMaNmJHiSLeCzd2strcC+Ka4Fx6ZEd9H8H96N44M 6nr5IAxKypkbXaYL+fnuWGjhTEBtcUD82fGDrDjJcGtOCogpQhq1zq0LXz4erF4O27YO b9H+XBWC6hKThrKoId3VCEnyfc/lf1ddflp7HWuKarmsQYDtkSgoJg6x02Tvp4OxsuQ5 70xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WYAUhwB4AEnUmLHEPnWWbsECh1/lymsws54jeNi8rHk=; b=uenhuUzOeSGV44RYwrU+vC0v9XISzo6ZF2XvcWNNTtL5TaPkBnecwN5PnSYLLhx8bL 6AF4l1Y3A/WTQzvop0TOzgs3QLBD0VomBrp73mblvNAKzQL3eZxXrTAVY1F5kd3Qk6a+ 9i8ncnp74X6R4qK5XWkPS4GIaZgXGfUDFDxj3oZ31klXvND42YAUMhlHiSd/D89W9PWx WRhJ8G8coivoD7d/JBM+wvmTpb29cJn6AE5oEPbtrzKjHq36ilEljHKPcU97a1Fn2CqK Bg74dCMH8yF4GptugmajG5dZ/CkPkg0RfHVGutAa40PmnlAc64YGgTdjVfRIRUpGL704 nKZA== X-Gm-Message-State: AOAM5321NYt3MVZgTThMGCixSuOoxz7NnTtCccwxIvcxzjNmZNvMwC6R LOm+yDIgsug7xJmgCHv+8Z8= X-Google-Smtp-Source: ABdhPJxh/yD4Sij++zuYSOdPdYpmdKk6DDGc+0QAKFfSSYRYRCJvPr8riMdhXMutezXlgxbeF30Qhg== X-Received: by 2002:a63:1616:: with SMTP id w22mr2672435pgl.13.1607436647281; Tue, 08 Dec 2020 06:10:47 -0800 (PST) Received: from localhost.localdomain ([182.226.226.37]) by smtp.googlemail.com with ESMTPSA id m15sm9071951pfa.72.2020.12.08.06.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 06:10:46 -0800 (PST) From: Bongsu Jeon X-Google-Original-From: Bongsu Jeon To: krzk@kernel.org Cc: linux-nfc@lists.01.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bongsu Jeon Subject: [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module Date: Tue, 8 Dec 2020 23:10:12 +0900 Message-Id: <20201208141012.6033-3-bongsu.jeon@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201208141012.6033-1-bongsu.jeon@samsung.com> References: <20201208141012.6033-1-bongsu.jeon@samsung.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Bongsu Jeon For the flexible control of interrupt trigger type, remove the hard coded interrupt trigger type in the i2c module. The trigger type will be loaded from a dts. Signed-off-by: Bongsu Jeon --- drivers/nfc/s3fwrn5/i2c.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c index e1bdde105f24..42f1f610ac2c 100644 --- a/drivers/nfc/s3fwrn5/i2c.c +++ b/drivers/nfc/s3fwrn5/i2c.c @@ -179,6 +179,8 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct s3fwrn5_i2c_phy *phy; + struct irq_data *irq_data; + unsigned long irqflags; int ret; phy = devm_kzalloc(&client->dev, sizeof(*phy), GFP_KERNEL); @@ -212,8 +214,11 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, if (ret < 0) return ret; + irq_data = irq_get_irq_data(client->irq); + irqflags = irqd_get_trigger_type(irq_data) | IRQF_ONESHOT; + ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL, - s3fwrn5_i2c_irq_thread_fn, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + s3fwrn5_i2c_irq_thread_fn, irqflags, S3FWRN5_I2C_DRIVER_NAME, phy); if (ret) s3fwrn5_remove(phy->common.ndev);