From patchwork Tue Mar 3 17:41:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 230054 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 ACE1CC3F2D1 for ; Tue, 3 Mar 2020 17:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C3AF2146E for ; Tue, 3 Mar 2020 17:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257571; bh=YJBfCqSByjSFxgGWmbPxYXFHCKKUp9aukC1dgwZBS04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1egwtufG3xSLmfIvsJlVZcgVB5JNM3W7jILRUpBlqBsly63mVQ4ngWchfzPK/z5+s jBPwzVl82/EeWAJhmgergF2fr6D2kAkIFV0kYIQTQnf/Lnb+2wvaDVjCrvTXe9uAM8 KfgZYR5+xSLFIKu9xJlUo8zlBqnm/8ucaNbBr6WE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730767AbgCCRqH (ORCPT ); Tue, 3 Mar 2020 12:46:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:52506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731056AbgCCRqG (ORCPT ); Tue, 3 Mar 2020 12:46:06 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A404E20870; Tue, 3 Mar 2020 17:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257565; bh=YJBfCqSByjSFxgGWmbPxYXFHCKKUp9aukC1dgwZBS04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elMrqc83Uqq62VcF4h9I0QpRGwsmw/q2Cz1TvLPGeUjuDjfAaHT6ead59hfeRkB7T jHM1QRnZnZpSbTLN36syzRie9wMzFsX8eiwKIjA9R3ZxOZDYkn9tFjbLFLLSjcTItM vj0H4bJYT3g73OZqLUIjYI6p+NxD1tPekqFf/zX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , "David S. Miller" Subject: [PATCH 5.5 009/176] nfc: pn544: Fix occasional HW initialization failure Date: Tue, 3 Mar 2020 18:41:13 +0100 Message-Id: <20200303174305.644646973@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Osipenko [ Upstream commit c3331d2fe3fd4d5e321f2467d01f72de7edfb5d0 ] The PN544 driver checks the "enable" polarity during of driver's probe and it's doing that by turning ON and OFF NFC with different polarities until enabling succeeds. It takes some time for the hardware to power-down, and thus, to deassert the IRQ that is raised by turning ON the hardware. Since the delay after last power-down of the polarity-checking process is missed in the code, the interrupt may trigger immediately after installing the IRQ handler (right after the checking is done), which results in IRQ handler trying to touch the disabled HW and ends with marking NFC as 'DEAD' during of the driver's probe: pn544_hci_i2c 1-002a: NFC: nfc_en polarity : active high pn544_hci_i2c 1-002a: NFC: invalid len byte shdlc: llc_shdlc_recv_frame: NULL Frame -> link is dead This patch fixes the occasional NFC initialization failure on Nexus 7 device. Signed-off-by: Dmitry Osipenko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/nfc/pn544/i2c.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -225,6 +225,7 @@ static void pn544_hci_i2c_platform_init( out: gpiod_set_value_cansleep(phy->gpiod_en, !phy->en_polarity); + usleep_range(10000, 15000); } static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode)