Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp94499lqh; Wed, 27 Mar 2024 16:13:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTDB0Ral/0EMBLd8qMaNQSX0pVDiW4dhsjWqMu/2+2MXNDgaRk+qd1bDdP8eSNec8GG52QlH2GzLfog5tC2OislOdtqWyDWz40D9JaYw== X-Google-Smtp-Source: AGHT+IHOmryj+PRvbwdve27337/KxNSpfZngaYoCvHb1VYXrdPpv3bQosdAfhnv+RMcOEUB0Hp6Q X-Received: by 2002:a17:906:e09a:b0:a47:1911:51d9 with SMTP id gh26-20020a170906e09a00b00a47191151d9mr527534ejb.73.1711581221129; Wed, 27 Mar 2024 16:13:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711581221; cv=pass; d=google.com; s=arc-20160816; b=pVgL5+pXjhk+/pVJUcx0Xysom7HsC48y/zQJTkxmkvJgXzmUzcp4nUvul6CaIlBc7B J7Hn8dnxVvDa5NCcDpGR4PjttjcolgwLHmRFT7a5oQ0cmfE/xDvCjHbAhMbDHFjJheI+ zeMeDqaLtgww/Bd4vTPN88s25obqjRm/IqSIlZdv8duhb1WowjALj+FYETsdw+vDazUI 4tIK9djzslObXWvudmWWdpfDK28eIVhK+5trgYI4I16g8uzt6Cw3yjHQrieEa87W95l7 RtCAOvnNqYsQ4x4nG7TwKJKMR6bOfAy6XRErlndV75mOa/CdRamKdBe5rt91TBKWx9ri c3+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=1DrxLRBZT/LUI/LSfZvqLhgDZX5TOENkmG0pV3Ea5ME=; fh=1awwUeS5svG/hEy6X4mP8IyufDsT5VfvU6VFkHcU7wE=; b=EUGimlSDWf48pzi9QLZA6+hlWHT/Dce1xKVyMs5Qub+lfk20r/DQYdNX2JmnZemBJD QR2a+AAcDlNFSOUCgcHyMKoW8FZWpsoEucKDwbl1pYwgw2a4H0fFC+82rPl5bUn5mqKL wqpwx9NQ7v0l8wuEm7qCKZc9So65bm44SMVfJvpgfriBkEMaWtefhPID0KAdYmxliP2D 0v9WIGkmAkl99GoWoA5zGp6ABoKWJLMh5+bwypN5u/qm6YVfLCUzRFWgyFtPHHX3xXdU +Jl7bpBckSHCa6fxTIhZjERHTgCh+PYwCshPrv35YvkV2CqAyLqkPQ8JuafQ++DvJNNt HcQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kzM5YKFv; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-122142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j10-20020a170906474a00b00a4746bf1fc3si52219ejs.775.2024.03.27.16.13.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 16:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kzM5YKFv; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-122142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AF06A1F28811 for ; Wed, 27 Mar 2024 23:13:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BFB015445D; Wed, 27 Mar 2024 23:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kzM5YKFv" Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com [209.85.221.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A44AD5338C for ; Wed, 27 Mar 2024 23:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581210; cv=none; b=E7sO2Kienzah69Ye9WWOT/v8kWmpt1Dq4T0kRtoj8uFX9zbPLG4NAwJBOSYi5WLghxahUTfiYp3cGWIOfulmYPOjBQqlN9N0Fg6IbPwswiV5imdH9yGwtMaSkkMBavDxciVANhzNPzBomR7qAcTxEm4AYWnrNP7UIXEBBeq6TaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581210; c=relaxed/simple; bh=x8cE07s1UqGRQsBqsU0zimnFISfZSQU9RFeRK3ngzHU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NBQRRcsFAu8CT4JBSIhFfOShForqUbwfUaGY9tbCXeLbCE6p/2F5MtVNSV5CxW9qOb1n73icsGYzMyL34SqF75wPJkBQY5llIBdomgLqM528X7R24+DCLIbcXX88wJyUSY6ImKp81zcoTFnF7YYjMTWWCELdadI/KfnNIHXRlAc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kzM5YKFv; arc=none smtp.client-ip=209.85.221.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-vk1-f171.google.com with SMTP id 71dfb90a1353d-4d47000f875so140648e0c.2 for ; Wed, 27 Mar 2024 16:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1711581207; x=1712186007; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1DrxLRBZT/LUI/LSfZvqLhgDZX5TOENkmG0pV3Ea5ME=; b=kzM5YKFvD84pbEzyvePPgw7ekcnrKBuJAmZ46vu72CNBCeXwMGXtInckL+cpK62Muv +bje5gDFTVyzVNcEeNd51RFxateg+83qiplgBIn8wUgso1kTlc7ymojTiFXb/QTpye6P uheZoPoOOVqsvtHFJdrQdEkGP/SNP2c/PFm0g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711581207; x=1712186007; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1DrxLRBZT/LUI/LSfZvqLhgDZX5TOENkmG0pV3Ea5ME=; b=UjGToByN0WSGI3iVyNmQ+NdRUQKdR9DdOiAPoQ0CckaWieo+HhSheS2ewgLRZXH59F lyUmsTy0N6ETwbouJW0eLek/bwl3FR+m9VTcTwJCelHsAQq6XXX4ZVuU2rbfTCU6TktX 7UXmJqdlCf3tFOMLtVgBspp11uSdXnQP4ayCibm9oeta7Yp/dZbLOs4BCHS+uDfjo8BH PtahznXFt/6H0E3+KwUOEyK05GPFlr/P4fSDy7B5gBQdfvy6jtvIHFW7o5H+H5VDX6LD MmroUzDPEE/5o/K3FOtBHwdN56ry0SdUaf1cuIUCApknoaDkIWrUP8mK8FwXcEWowcwT LWBg== X-Forwarded-Encrypted: i=1; AJvYcCUADkN0iT7RbPLPZN6JfcADk3VrPNH4yjjFDcLD4TPYajG0PieIUh6JK2EKumCKH02SWDqCExKbUKnnnRt/1BRq95ajkN+1kcmKdjN3 X-Gm-Message-State: AOJu0YxTun1wTm/MDA5k6Jm5fm4kXFkwML5VU4/Hcq0vC1EzvCt/e75u pbsb2LB8TDnB617k6sZJwPMtUG+2gTv5uHXGsYrM1IoxHm4SaQbsF1RH7BvoQC+JUrkY1iZZtA3 Z+D0kuAUX4t+3tI9VwJXtFXhmcemgoYsgWkNj5vtEb5vjNx8= X-Received: by 2002:a05:6122:180c:b0:4d4:ef9:719d with SMTP id ay12-20020a056122180c00b004d40ef9719dmr1826914vkb.5.1711581207623; Wed, 27 Mar 2024 16:13:27 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240325-ucsi-reset-delay-v1-1-d9e183e0f1e6@chromium.org> <2024032624-subtitle-crisped-f4f1@gregkh> In-Reply-To: From: Pavan Holla Date: Wed, 27 Mar 2024 16:12:51 -0700 Message-ID: Subject: Re: [PATCH] usb: typec: ucsi: Wait 20ms before retrying reset To: Heikki Krogerus Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Abhishek Pandit-Subedi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 27, 2024 at 4:01=E2=80=AFAM Heikki Krogerus wrote: > > Hi, > > Normally the driver does not retry the reset, so maybe you should just > say "wait 20ms before reading the CCI after reset", or something like > that. > > The idea here is to give the PPM time to actually update that field > before reading it, right? Yes, that's the idea. I will change the commit message in v2. > On Tue, Mar 26, 2024 at 04:34:44PM -0700, Pavan Holla wrote: > > On Tue, Mar 26, 2024 at 1:29=E2=80=AFAM Greg Kroah-Hartman > > wrote: > > > > > > On Mon, Mar 25, 2024 at 09:19:43PM +0000, Pavan Holla wrote: > > > > The PPM might take time to process reset. Allow 20ms for the reset = to > > > > complete before issuing another reset. > > > What commit id does this fix? Does it need to go to older kernels? > > > > This does not fix any commit. However, the time taken by a CCI read is > > insufficient for a ChromeOS EC and PDC to perform a reset. > > Perhaps you could put that to the commit message. Will do. > > > > There is a 20ms delay for a reset retry to complete. However, the f= irst > > > > reset attempt is expected to complete immediately after an async wr= ite > > > > of the reset command. This patch adds 20ms between the async write = and > > > > the CCI read that expects the reset to be complete. The additional = delay > > > > also allows the PPM to settle after the first reset, which seems to= be > > > > the intention behind the original 20ms delay ( kernel v4.14 has a c= omment > > > > regarding the same ) > > > > > > Why was the comment removed in newer kernels? > > > > The comment was removed when the old UCSI API was removed in > > 2ede55468ca8cc236da66579359c2c406d4c1cba > > > > > Where does the magic 20ms number come from? What about systems that = do > > > not need that time delay, did things just slow down for them? > > > > I am not sure how 20ms was decided upon. However, UCSI v1.2 has > > MIN_TIME_TO_RESPOND_WITH_BUSY=3D10ms. So, we need to provide at least > > 10ms for the PPM to respond with CCI busy. Indeed, this patch slows dow= n other > > implementations by 20ms. UCSIv3 also defines a 200ms timeout for PPM_RE= SET. > > It does not slow down other implementations. The delay has always been > there before the RESET_COMPLETE bit is actually checked. Ah, maybe other PPM's don't set CCI.busy, and that is probably why a reset isn't retried for them. The UCSIv1 spec itself might have a typo in Table 4-2 whereCCI.busy is only allowed to be 0 for a PPM_RESET. However, figure 4-1 shows that a transition to busy is allowed from PPM Idle (Notification disabled). Moving the msleep(20) before the CCI read is probably a good idea anyway since it gives enough time for CCI.busy to be set. Should we also skip the retry if busy is set? > The change here makes sense to me. Just rewrite the commit message. Will do in v2 if I don't receive further feedback. Thanks, Pavan