Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5206691rwd; Tue, 23 May 2023 20:47:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kEozWl2tulGtw4T24+JIGozjGR2FrpAdKGtiOYamGH02BLMDDGrp+CpLwtvgg/zZyNxWW X-Received: by 2002:a05:6a20:4282:b0:10c:1a3d:6b9c with SMTP id o2-20020a056a20428200b0010c1a3d6b9cmr7411393pzj.21.1684900046999; Tue, 23 May 2023 20:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684900046; cv=none; d=google.com; s=arc-20160816; b=QHpcydyzhpwLnBzp5XvqZMkq0lzYsLEH9/c89NRVGR6AmG4iT+k15a+R/PfP2so1WR uoQJXbaMf+G/3cMTHVrveAx8ATwBPm7FyG3oey4eB+aHuP/gO590ql0s4cmcxTphcmhP OGpswTmp1G8fB23Sq3oG7emOGHnZ0fmNOn032pAnPb1a95U4H+xIy3+MopKcsfXwdUNc xtMghqZeNfnOFjtD6RmTrd13AlMfMSuPtCY7+Jjw3WvlhtAIY3M0MG8u4IUvxLIX1+zm xU3TsY31VoWQ8Rqvk/NslbHmCHlXXFpZW7Rxc//ObZ3wKI2gbJ0SJ8PIgyqRHn8Rr5ui ghHQ== 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:cc:to:from:subject :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=V/ZN1D9UGzK5Xai8rXfYikWe0yqNU1odOqV6J0Ky0yA=; b=XncQxZDsZd9qxuAcC25z8Y74G9dp7C0dGnaILQ3W+PnBVWiahZNGanamMDJwEJn9iu JWVxWp4qnrje9jBjFs1gkYRfxtWDTT9r+hKAJ3p6FZRAJebmvPO76RzeTUJeZocWT4FI a7w7JzIQLATQRnYAAxZ4N8wuCUY8N4WEKp7UNIeFhcG0Hr0rRma79uh8LVYlW/9D1iDi hF8JmEPSWZlmr71DLZCug4tHi4vpJSa1ddNvJPDbN/mon2cgRjiO3Zjzu/lN7rs4h68Z Qi5DeV+0lQXfamXM5gXnBgdkXyGDzdM8zIKyNTnHg7g1bTl2tC0fB1cdBjCDRXvVvI/X 3/+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ww54UMhz; 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 z1-20020a633301000000b0050309caf60esi7735735pgz.750.2023.05.23.20.47.09; Tue, 23 May 2023 20:47:26 -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=Ww54UMhz; 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 S239318AbjEXDQH (ORCPT + 99 others); Tue, 23 May 2023 23:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239314AbjEXDPe (ORCPT ); Tue, 23 May 2023 23:15:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3631735; Tue, 23 May 2023 20:14:24 -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 C09106382F; Wed, 24 May 2023 03:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0213BC433D2; Wed, 24 May 2023 03:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684898063; bh=KIWo62hjuIIQjA6MUc+tEoVlrU/qrhKfIVtzXSXkHW4=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=Ww54UMhzlzXsB6DNy7UABtfpofJS3dGNZxoo9gMXj4mMGmsAPK0jsmAxFk/gP5xgu Tw/3rxo0pFWRAek6vLcNSkDhLKj5idly1Q71EUqwonQY4FucM5ApwyZ7FdGzx3Jx6d vx69BlFGVKkEeEwl2pbdwy07KDNO4xUu4ttnvOol4dMvd00HIyUhc8qfGeH9KOdofs UQ9L0extPBEmMfuOgHqBkdRKkspU0NcCnbArALRZ0TXQCNLZ1ypCC0G8MmLK/6YR/e r4mrwlLVOIa4hN9tELhUlmggdR54CrVFIXVX6o0YX6elLdjk0fiYUvGL3mRKJwEGqO AsY/5o50J3n4Q== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 24 May 2023 06:14:20 +0300 Message-Id: Subject: Re: [PATCH v3] tpm_tis_spi: Release chip select when flow control fails From: "Jarkko Sakkinen" To: , Cc: , , , 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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Thanks I substitute the patch that I applied with this. Again: Reviewed-by: Jarkko Sakkinen BR, Jarkko