Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2368392pxb; Mon, 20 Sep 2021 20:21:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM/VJd1SRDK3BTYiDHMt5ZEd/oIBPkv8u9WcbNxw0bC+YW7LgamFXoJvE9pNZ2Zo135pMr X-Received: by 2002:a6b:b7d6:: with SMTP id h205mr17592282iof.60.1632194473388; Mon, 20 Sep 2021 20:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194473; cv=none; d=google.com; s=arc-20160816; b=Gj2QJTqhmB8ogxwNd2CEAqlEhpYx1DL2Z21nEruW3odYWId8aPIInE8FuIsZN2Tp0G ZM14BOAvHjDvO30zNqHnPF6ou3hqt7wohiGKFf4q8DLjTRrzEygXvMy3w9BrPiCZfBe/ /c9EyD6VPjNEK1W5eQ4Y1xHn9ZR0S3b0ahGJjfmtZ2rV3F+AfPc9awJSddQK5jHJfNLC Jy/BdWb26BJXJdWm0Ufq2AIALDUCGf86uliTFen4wGvjL23yOuJWRmaoiPfwtqbN8/fX YfBEcJYoxY1/ygdS0k6Xw+bdEwn0X1c5hIECDwDH/WsSMERVcUf9pQQRU3u9hV3VgfU1 +NOA== 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=UqQSPr+F+5ZJvgNEOdLfA6LfJ3ZJ/UbFPEI120AI/gA=; b=VAMAFo/WNg9Q2/pnm+Hl/4oSIBcYbNiTa7j5R7LuQspKTumrHEzif1x0QVrxxVZNI2 TxMgWI59yfs1We1q8lw7utblN6jEoUft+t8HWFDshMKIIiwN+zVDxfnsT1V3L780IWL8 LEDwyoM7GwkkSnOR3C40quY9/8q1aIFXRkweqB2yqiW9QfUSKx/CgKIP7aih0s+sWmbq wvx2SBe9k4D6EaZ1DAdyHyGu5gQ22bzGEs7NAK7b8Xna7RHk8iNOwlAm5RIJUNfq/fxN 9qJcc6FYI3iF0pG3ABnGxUveFC/eK+mfDeSH9V6mqsLSWET0L2AHNGFxZCWgYCyz9tAa YZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l8CbCQM1; 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 c6si17281998iow.84.2021.09.20.20.21.01; Mon, 20 Sep 2021 20:21:13 -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=l8CbCQM1; 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 S1378068AbhITSWn (ORCPT + 99 others); Mon, 20 Sep 2021 14:22:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:36234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376853AbhITSOu (ORCPT ); Mon, 20 Sep 2021 14:14:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EB022615A3; Mon, 20 Sep 2021 17:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158501; bh=RWns6g8E6Y/E1cAWrM9I+Wvii0bF7IkXMDPWqTOjPBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8CbCQM1azpyYDsU8pCN7nT19y4k3Hq+mSbBUHH0G7bCgMLB46/lJsca/ReQAog78 5n7s+51kiTi1EvPkliwL18ZY+y1qbx2XrnBi7FtjnXhQEnhsz3BlQqUPxGy/B+DQIY fepuy0B2scFq4HDKuRGUH3epRHcjC+TjbxYt9i7U= 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.4 184/260] platform/chrome: cros_ec_proto: Send command again when timeout occurs Date: Mon, 20 Sep 2021 18:43:22 +0200 Message-Id: <20210920163937.368093600@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 @@ -213,6 +213,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,