Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319489pxb; Mon, 20 Sep 2021 18:42:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzdBE1IzboNlSy+GwAfHm3e1d6Wi6W6YBqYO9/MtuBF2O98BngS3Hc2j4v6919Yp9dVDhS X-Received: by 2002:a02:9f83:: with SMTP id a3mr5058121jam.8.1632188558032; Mon, 20 Sep 2021 18:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188558; cv=none; d=google.com; s=arc-20160816; b=K6g8qUlpIkAudfnddYn4lyNWZ+NyFw1/vFS5MehAArihnSkxvx1GI2ALXzF+UtZF1Y jPRHEVfgYVTl45cNp9kaJukhVnyCCImLA3fdbUTcVSHh8Ff1ZcU8en8edE3sYrv75gSw 62NF/rb+ODDFl6V/I0uXcKy/Em3mdmB1gIib5oSaxmiGvpfkjrZgLSqEauitXK3itxGV b3dwhX1Ad07F8fkZuZys4/SyPijeT6KFcADOExMuLDq0SuzVcWv8K9iOKCuAbajlFJD4 0P11t6oc1b3jh3Rwu8xRj9iXVPt8WTgLwUx6ZgKFchdugha9vIzLaNzttTpjmythX+eR wrhQ== 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=U5U+zyaXFSsXkQeNbsww1/fX3hiNATJEGw8taggphxg=; b=B4jOBiPzRyzSSUStapJQI+kApwTCNCPIyHsjISWGmg825JzJhhW7gzYnWs+89U0HRi bg3513LF99Rfq5SzfcVYgrOmxPoJGGwedFZMofdAAIfvnb16p25oSjhuYHNJK+/7HxQ0 tl6bPQbvlJ0sgYKIkZYfEln4fepVf1JRIxKzIBh7ohUEauU1Ym3jTXJGxCOpkEUCKWj/ Y9bC6yeMT6B/yLKOLNUoQ0q6qhCnIqgHwhyk0zg+sIcU2zy9c1TsyLodUrqyBo/wFnp5 MJuFhb5M+6hSiwtvEYm4oSfZuBpGrit9/IDYtXBn/AcASkXGnRpNfC4msw4yB01pBPDF lH4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CV9q+7w2; 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 g13si6907235ila.118.2021.09.20.18.42.27; Mon, 20 Sep 2021 18:42:38 -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=CV9q+7w2; 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 S240802AbhITQzT (ORCPT + 99 others); Mon, 20 Sep 2021 12:55:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:36554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244594AbhITQu4 (ORCPT ); Mon, 20 Sep 2021 12:50:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D668E6124C; Mon, 20 Sep 2021 16:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156565; bh=6oOBJ1qGDe0ntOruCDolaOWVwqicF3bNkq2aqk+9SZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CV9q+7w2/FisUzWY3S/pGiQ9fQT3ZQYaCYtKUjXoxgIpFThq20JEMx0tkEwTj/O2b TPOq40l7aLwR9O6wMYq7rTnsJLjG4SAd4wgdwwxc9eNrisqvwOpQ9lpkNQzqj/J9MI abKxyunEJSv58wM2vEoI3OeL3iME2DL+SquVxFrk= 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.4 117/133] platform/chrome: cros_ec_proto: Send command again when timeout occurs Date: Mon, 20 Sep 2021 18:43:15 +0200 Message-Id: <20210920163916.451142469@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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 @@ -182,6 +182,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,