Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5140739rwd; Tue, 23 May 2023 19:17:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60U6Rw2/7AGZaSQmtY0NLU+PFIe0RB8/sVWdqaayZJ5XV6COajNsXOQHOshP1ZoCzf09oU X-Received: by 2002:a05:6a00:802:b0:64d:61f2:ca88 with SMTP id m2-20020a056a00080200b0064d61f2ca88mr1311174pfk.12.1684894653846; Tue, 23 May 2023 19:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684894653; cv=none; d=google.com; s=arc-20160816; b=YLqRPViYDhzuFKuvVfTV6ZHNPz+mRtLvQ0LoToa+1AbFRayMbB4UKH2HLI0acRtg73 QTKoguIbmSBWiFq/aSoEGzAtLNaFQvqAus04ZefmmasCRulAhxbqUaObThPo303misQS yPZqV6GMrA9xH0dVbIxBnGKhB0t0JVqanuhAJf+wO4DcxnZ9/sAZPoi3e1AOxcpyg6zi BspjktUEug3+AYqe6zVhH12VoAFtIi3uNIcFiiAmY+gsDzCW33207Ty9mcEypeNjXOoL AgwyESCNMxm+n2NWitsGHsTeHVlluqoMqeSSLhHLglw0fdKVvcDL8ag9lkDTuXbuRzOC 4kAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:subject:cc:to:from :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=7xKrfRYohvYmH3MdHD8wyvhetckB2y4WwsWqjBwCXZA=; b=UNKArt5ckEtrf8FPMe38akM6NChJvvbicjb/NUGrFxTN38kKiP5ORGSzb9iSaAT9Uh fx/lwp5WQi9jsH6cr/eFUD6YL6IDMyEC90KIx3dwPwqcipUSec7YN1VNud/mcL4QsvFY 1SurGWAXYTHQ8dkLvEBso6IY3rYnR+ta4GFhrex3Vc/RPe7B6qtZN5PozEvaoe1bq9we nUggz8hHpFSSM0v8ycEd0sFu74mLJuoCI8zTC+DqNmRIQpKHL8/S5IkHuPrj5K1Rqx8a 1EoidnOvQNwRA9OfPpk8CufjDKD59BINid7TEP7Ih4rfutygsXLKSRS0X+fj9fTt3L13 IeJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=By4SDccw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a621948000000b0064d44ee66b1si5186370pfz.225.2023.05.23.19.17.20; Tue, 23 May 2023 19:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=By4SDccw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233808AbjEXCGP (ORCPT + 99 others); Tue, 23 May 2023 22:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231317AbjEXCGO (ORCPT ); Tue, 23 May 2023 22:06:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 428F9B5; Tue, 23 May 2023 19:06:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0E5761118; Wed, 24 May 2023 02:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4C02C433D2; Wed, 24 May 2023 02:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684893972; bh=GhEwIZj3aSbyxIefFCwUKUtxrj24KTZ/dxPQOWeLZzc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=By4SDccw9VtWV0z+TuZHGC3nwb9A2zIqlXKlPDPl6kiSUSqAIBwSyqkSa9q7Nw7bv AJsp+3fNzYTbhApQgpVQTE5uWkxpYlke5T7kSb6T4W+u1m4jqk+6rtbxAcWMS2Pkp6 At+JSNti+S5Dfr17VQygXg1dsBPWAJbua2z/cwLCuCVuSyxPDLfDyBsltmV4HajfO1 7aNHP9w4+yt48B4R/LLjw2JUiPEfaYG9mv+U5FgJq3m75KxJr6xh3vHCNXegO6JCrm UzU7gt1wVgsowgf8oqagJhZwnrOwCa704vZhU1fdd5UH74JtBudpQ5FqPjpyDYWYO0 S0zV3KWEmGEUA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 24 May 2023 05:06:09 +0300 Message-Id: From: "Jarkko Sakkinen" To: , Cc: , , , Subject: Re: [PATCH v3] tpm_tis_spi: Release chip select when flow control fails X-Mailer: aerc 0.14.0 References: <20230522070140.33719-1-shaopeijie@cestc.cn> <20230523024536.4294-1-shaopeijie@cestc.cn> In-Reply-To: <20230523024536.4294-1-shaopeijie@cestc.cn> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue May 23, 2023 at 5:45 AM EEST, wrote: > From: Peijie Shao > > The failure paths in tpm_tis_spi_transfer() do not deactivate > chip select. Send an empty message (cs_select =3D=3D 0) to overcome > this. > > The patch is tested by two ways. > One way needs to touch hardware: > 1. force pull MISO pin down to GND, it emulates a forever > 'WAIT' timing. > 2. probe cs pin by an oscilloscope. > 3. load tpm_tis_spi.ko. > After loading, dmesg prints: > "probe of spi0.0 failed with error -110" > and oscilloscope shows cs pin goes high(deactivated) after > the failure. Before the patch, cs pin keeps low. > > Second way is by writing a fake spi controller. > 1. implement .transfer_one method, fill all rx buf with 0. > 2. implement .set_cs method, print the state of cs pin. > we can see cs goes high after the failure. > > Signed-off-by: Peijie Shao Looks good to me + great explanation, thank you. Reviewed-by: Jarkko Sakkinen BR, Jarkko