Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1733574pxb; Thu, 16 Sep 2021 14:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRqMdgtPhB4FBUhbRThiId5S2QkO7XhnMBZIl9fVyKbfHXbB2JGdQsz6NyetIELo5PPui/ X-Received: by 2002:a05:6e02:1b89:: with SMTP id h9mr5277806ili.297.1631827029231; Thu, 16 Sep 2021 14:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631827029; cv=none; d=google.com; s=arc-20160816; b=sD0ul1xc7QWpnnGz26jLx7DflP/XPFYEmF7m9rOPAbuBDP2tN74d2wzGgPAZkVn63M G5VkTtmrXPa2FSQKC5+wsDtaV68FZTBQS//vUhIWeeW591PYPIB4OfReH9gGB7b7u6Uc fVR6eo9cCW+M79fzk+46BwkL0mJC3LIOHtz0K5x3aUVBcw437wLRlu8pnOhkGCTWps9L BoV0FDF1bPrI9Q/J24vR46n7NI2F8ok3kt/Gbe7B6lzze0FIGKrMmSDolp1HdH5WAQVL 9+tesFDD5RSqHajxoPZYayxSvgwgRRpAVsbU5VRe/XMiKoyZDxA6lDQeCxeZ/6cm1Uho Ao+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=avmoVLdsBx3RfGpQrAacYXH4BodYXTt2XauYTLI4xvY=; b=zRtijmKtyuBtAa7v1ZHMFMcLBC2oZMJf/oOFh1PF5cnlStxUxFPOyvRTlbWDaBTSIL 5AZncHAHxtedI5a73YR47SeSXTI4Ahf5FW8VlQOQ9R/rGPorB/eCA/U9BBhTHh10WGa9 c+G34q5Jkm7Ki1V5A89yhj2hIN+TRdp/+5KC4jYrlj7a5Yy3H8Jbwmbt4l/V1qyrVHWX r+p8SuNjJ6ezbujZwcyWgtIvbOrqGZKfO2qzilSNEOrJy2CW1r83lOQ6vlcxjB8sf8nG T33e2vWd3XHfHGuKrxRzj7Gxx4epu8dYCvtjGLQE64tqGjdsr0q5FwGXYf6VdR3SiBd2 6uYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nYMQPFws; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si3502256iok.10.2021.09.16.14.16.56; Thu, 16 Sep 2021 14:17:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nYMQPFws; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242075AbhIPQcr (ORCPT + 99 others); Thu, 16 Sep 2021 12:32:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:59936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242077AbhIPQYY (ORCPT ); Thu, 16 Sep 2021 12:24:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E262F6127B; Thu, 16 Sep 2021 16:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808977; bh=DPwHQ/O2t7CmzyS/XLygN1/o/YYDUSrXHbgLso137Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nYMQPFwsBA1UKJf/OyO8ZTGI+72/I1bana13ERT9t7fN5Sbq++iDJIiS8x2XhczKE XT3w8WUpOwe0CKC9IUJGN2KmHiOlLI+qfaEba9IcDCRyVFIsT3DqZIpI/hiQZo+z/c YaIwSsJQVOUMajzcJ7wIxwuc6mnZPfy3PX4syLSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patryk Duda , Benson Leung Subject: [PATCH 5.10 293/306] platform/chrome: cros_ec_proto: Send command again when timeout occurs Date: Thu, 16 Sep 2021 18:00:38 +0200 Message-Id: <20210916155804.090816696@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patryk Duda commit 3abc16af57c9939724df92fcbda296b25cc95168 upstream. Sometimes kernel is trying to probe Fingerprint MCU (FPMCU) when it hasn't initialized SPI yet. This can happen because FPMCU is restarted during system boot and kernel can send message in short window eg. between sysjump to RW and SPI initialization. Cc: # 4.4+ Signed-off-by: Patryk Duda Link: https://lore.kernel.org/r/20210518140758.29318-1-pdk@semihalf.com Signed-off-by: Benson Leung Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_proto.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -279,6 +279,15 @@ static int cros_ec_host_command_proto_qu msg->insize = sizeof(struct ec_response_get_protocol_info); ret = send_command(ec_dev, msg); + /* + * Send command once again when timeout occurred. + * Fingerprint MCU (FPMCU) is restarted during system boot which + * introduces small window in which FPMCU won't respond for any + * messages sent by kernel. There is no need to wait before next + * attempt because we waited at least EC_MSG_DEADLINE_MS. + */ + if (ret == -ETIMEDOUT) + ret = send_command(ec_dev, msg); if (ret < 0) { dev_dbg(ec_dev->dev,