From mboxrd@z Thu Jan 1 00:00:00 1970 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=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,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 24E04C433EF for ; Mon, 20 Sep 2021 17:08:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A37E61B50 for ; Mon, 20 Sep 2021 17:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245259AbhITRKB (ORCPT ); Mon, 20 Sep 2021 13:10:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:33902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344992AbhITRHH (ORCPT ); Mon, 20 Sep 2021 13:07:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 78CE96138D; Mon, 20 Sep 2021 16:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156930; bh=Iu3Qyc44vj0VnMintyRrj0uhXpi3bJ46oo5MFD+sjbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZJEEZaSMbUgcElmKfNH3BMtbC23zAIIICpNKTEB8aOLzDqTMt2zZpfPNVSHH7e7W 0RPjGoHzvjBKHSU8t5Ss+Yp6aE/hvkdKdfULgjT9d0wyUosI/Vnm4ApomPAkp0zpyB k9x/21W/r5WgbVImPPSgf1G7a4rMzUrPGb51N87Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patryk Duda , Benson Leung Subject: [PATCH 4.9 152/175] platform/chrome: cros_ec_proto: Send command again when timeout occurs Date: Mon, 20 Sep 2021 18:43:21 +0200 Message-Id: <20210920163923.040458464@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163918.068823680@linuxfoundation.org> References: <20210920163918.068823680@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 @@ -183,6 +183,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,