Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3958293pjo; Tue, 3 Mar 2020 10:05:46 -0800 (PST) X-Google-Smtp-Source: ADFU+vuVRxYOmQohLRMU5Re2ngGyssU4nCx+zmnUmc/klUr2bxW4OgF25lsH0VgGZc2DeRgWiGGg X-Received: by 2002:aca:1210:: with SMTP id 16mr48801ois.108.1583258745970; Tue, 03 Mar 2020 10:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583258745; cv=none; d=google.com; s=arc-20160816; b=CGa7lkSPHsUjgTfjmJ919LQoTKrEft+b8ZubrOqQQV9umC+X+Ce39O6nRGC6BFui/D +yxAL7kESTZ4TlX4ZB0DnTGxQrX1ZcSxZL5HDlnRjjbQpKzGFufOk3uQQOzw7dcHqwQQ yJdHgSmucchfm9DHfMi4jVK2uz4c23/ppatD/hqauHEJA9g2KQl6L2+a1MMoK6rU/Zqu wfWljYel2PPmoQLgZdT1fweIYam4bVJ8MGG7SBZvbqlIRZRFzwkBlFw5ziMAyvYC2YOy i/2KY71waVbxEPFUpwfiBm62fAqF3ShMKuTRBzstm22zdL22RM9wjEp3E+EmFdgi6CkR W71w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hoQvBrGfD1aHRooS8CDip7oHWCL+rRzzMCXPAI4XKZ4=; b=aTeoAkYHLzE7Xjnk+ljHddyZPPjrRSeT5mtTxnGMf5Wd4dvDvKZmq8b09MxxKQtWEf A9WLoA1dqvfPadlO05OomFAAXNxf+CaT43l7gEiBMYeTUBmP8SsXvrebK3uBdE1dfAMe QCIEDJjgT0EAK9jbPN7DBkRkvUVjtHLnt+a0p8r8k7IeeKnZ+KD4rBgdNlCuTxv6S+T2 q0c/xlw+CSYf3tFHToBKuHfOpQwJZR5d0KV2KJOb0gi/tgPoO9s6DcJRGwdXRksySVPC UjQkq0AUmce22kEV4F7bheXyMICF3D9eteyTJ14Nsi1V3QMNI2x24G4402rx9rj49+fh WnoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Id4OKFa3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si8624741oij.270.2020.03.03.10.05.34; Tue, 03 Mar 2020 10:05:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Id4OKFa3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388059AbgCCSBq (ORCPT + 99 others); Tue, 3 Mar 2020 13:01:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:45936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388034AbgCCSBk (ORCPT ); Tue, 3 Mar 2020 13:01:40 -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 34F9D2072D; Tue, 3 Mar 2020 18:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258499; bh=uVF9Hhhe0uNmt+VdBVe8UzNmmAax9OOOWGcDcal7yGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Id4OKFa3rrKkJGzmJyTteJwC2h8/eHnIXWwjn2ShW9JYNT1kFCtI5wD2jQ+JRmhkD Bw/4WXE6ej7qyE+s209Z1sgprx3TBQELILkSlDiaOY62a+w//Pk0ervuYuZo+6dmjE MX/hhGtPEfypfAix/hcTdmp49cKBac9zSjTTY1pA= 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 4.19 33/87] nfc: pn544: Fix occasional HW initialization failure Date: Tue, 3 Mar 2020 18:43:24 +0100 Message-Id: <20200303174353.618937840@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174349.075101355@linuxfoundation.org> References: <20200303174349.075101355@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -236,6 +236,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)