Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1598608pxa; Thu, 13 Aug 2020 12:12:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpM50Ca8Iy1t8iXvHA7Iob4+DTHWznhqwJcXT575MDazsEJW2pONUQSo+C9mErkp8QuTT/ X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr6073097ejz.239.1597345927645; Thu, 13 Aug 2020 12:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597345927; cv=none; d=google.com; s=arc-20160816; b=TIOVuqOOe8zK/Z13GVM0gZSok7H6WQWQblBATqsTRiktT5ITsUUif4c5Dp7h8cd7Lx r2I9ET3oH5SWqQUki22U3yUhH6t02W1V9o+Ac4pg0L2rxKTnbuKSjX9bsm2WL3gkGKEU uCeHHOvnVuo+MjggNgjq+BuLO7KBjeXPw4LyruxtnvFsULLlXw36G8aKTRtLccho1Ni+ Z6Os+/ZnfLLsMkOdcIxRhjaWVeedr3/kAFxezG3Rlh2uArKHFCTvb6SAL36GClgACpIW dYaLdluXd/8rwI/D0bQtF4iRrCb3ZUyJ7gTmxW8DgJN1ZtL4CLkArU3Cwm8toA1oFnJ7 D9gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hVfowbxzyxcugBKoGU08vmnN0a1YFEFi/I55w6LvOjw=; b=cF5ijqB+3JQ5RV+g1TJiWtmVrDrtqwqfMgoh92hdbB+NXU4l0+aPOVAK1vNTW1bA4p yL7uY7iYV1PD7QPeUxmMVrwNyKBHC+RIId+AWZPXDD7cwwN0+bceWKOFYEgNb1TDLJ90 RphJcC5GF+/H3Zu3Sx9+ST5bY9Jj5MhrWsjL6MTbgnRwO7dOKE4L2HNYqsxWS6hELI4B 9Nu47/FRQZY8WirmOeJB3RDhsYwCrlsQhD1wV7DenmuyHJbRvieqY/Y5jI+Rz5z2fXVL lquekuoIrhABRfkPSTYp8LjWSGDlzQuQ1Km+1Mb7bH8/l8USobwSNIJIQOGMt4WAhT4F Wnjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rzNOCF5+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si3758332ejz.318.2020.08.13.12.11.43; Thu, 13 Aug 2020 12:12:07 -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=@google.com header.s=20161025 header.b=rzNOCF5+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726167AbgHMTLM (ORCPT + 99 others); Thu, 13 Aug 2020 15:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbgHMTLM (ORCPT ); Thu, 13 Aug 2020 15:11:12 -0400 Received: from mail-ua1-x944.google.com (mail-ua1-x944.google.com [IPv6:2607:f8b0:4864:20::944]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00226C061383 for ; Thu, 13 Aug 2020 12:11:11 -0700 (PDT) Received: by mail-ua1-x944.google.com with SMTP id u15so1965966uau.10 for ; Thu, 13 Aug 2020 12:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hVfowbxzyxcugBKoGU08vmnN0a1YFEFi/I55w6LvOjw=; b=rzNOCF5+okDp7MgI4wWWGs7h4ZqC5YuJm8HrIm+aegeBO+RVWmMawYdmtAiCG/JqLy yoCHcD9nOH3olLgc3O1XXlA4ntf2gV5sZ66NQen+J/9Z2a1fsruQax1uSVgp97FSLt6/ x/DDEmIcYuZjTCiHumYKqaG/HxkfgpCYVk1lnijPub2O6zrngIyfk/jciQWZ0NOnuvnp w0IuoP9qTjhNm/Ol11KRDEbO0VW0NKljwaYRqyMKq+kxhhX7XdB85nhnaFqLOSY+oMsx HkJr5uw/QYrHjXWT+BIHu/4TFVPnNHppPFr+lyIUMDTRsgWi+Yz9STiL2qakwSs3N3uq 6yCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hVfowbxzyxcugBKoGU08vmnN0a1YFEFi/I55w6LvOjw=; b=N7tq8lMFP5Q2C8AfgNCJ+/V2Dbnet9NkU8P0bZVP7EXnNe/pH8+TTV0kzjanShcICd xsHs87/fLeV3Am2JhtID12YDI6OBoTUk6jAS1dLPa01rmV/f27qXxgarHIZIqzJEVWoE 57uc93B9zLVdK4W2xA8YK4wJg3X1iFL0FijgRn6pTwHQ/EwpLNRsQ7R04x8u1a8i4uaR kFQ6zKl/Ys+sYIM+igszsymmpVnrQborIlCxHH3AMTlLvcT/douwAmPThPe783cdNsVV UZmHU/b2EG9Ia6fzrbUrQ+JSztdYA7GXRxkK+lkQ7aqWoDuP7gh1vJv0FCtCx2FEuGJP FxQg== X-Gm-Message-State: AOAM53028v6tIP8q5zHdLJ8QvBsOgGAWOtjXB2DOXvnK1kybGVObRnQA PbQsbEwRifB4/29IC4Su0LQkZZbZ4x6z7TR0Hu76Jw== X-Received: by 2002:ab0:69d6:: with SMTP id u22mr4727761uaq.65.1597345870549; Thu, 13 Aug 2020 12:11:10 -0700 (PDT) MIME-Version: 1.0 References: <20200812025126.574519-1-badhri@google.com> <20200813080821.GD1169992@kuha.fi.intel.com> In-Reply-To: <20200813080821.GD1169992@kuha.fi.intel.com> From: Badhri Jagan Sridharan Date: Thu, 13 Aug 2020 12:10:34 -0700 Message-ID: Subject: Re: [PATCH v3] usb: typec: tcpm: Fix TDA 2.2.1.1 and TDA 2.2.1.2 failures To: Heikki Krogerus Cc: Guenter Roeck , Greg Kroah-Hartman , USB , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Heikki, Sure. I will try to address your question here and will update the commit description once you are satisfied with the description. However, I have to quote the spec as spec is the source of truth. But, I will try to link to code. I corrected the test case numbers as well. Subject: Fix source hard reset response Commit description: The patch addresses the compliance test failures while running TDA 2.3.1.1 and TDA 2.3.1.2 of the "PD Communications Engine USB PD Compliance MOI" test plan published in https://www.usb.org/usbc. For a product to be Type-C compliant, it's expected that these tests are run on usb.org certified Type-C compliance tester as mentioned in https://www.usb.org/usbc. While the purpose of TDA 2.3.1.1 and TDA 2.3.1.2 is to verify that the static and dynamic electrical capabilities of a Source meet the requirements for each PDO offered, while doing so, the tests also monitor that the timing of the VBUS waveform versus the messages meets the requirements for Hard Reset defined in PROT-PROC-HR-TSTR as mentioned in step 11 of TDA.2.3.1.1 and step 15 of TDA.2.3.1.2. TDB.2.2.13.1: PROT-PROC-HR-TSTR Procedure and Checks for Tester Originated Hard Reset Purpose: To perform the appropriate protocol checks relating to any circumstance in which the Hard Reset signal is sent by the Tester. UUT is behaving as source: The Tester sends a Hard Reset signal. 1. Check VBUS stays within present valid voltage range for tPSHardReset min (25ms) after last bit of Hard Reset signal. [PROT_PROC_HR_TSTR_1] 2. Check that VBUS starts to fall below present valid voltage range by tPSHardReset max (35ms). [PROT_PROC_HR_TSTR_2] 3. Check that VBUS reaches vSafe0V within tSafe0v max (650 ms). [PROT_PROC_HR_TSTR_3] 4. Check that VBUS starts rising to vSafe5V after a delay of tSrcRecover (0.66s - 1s) from reaching vSafe0V. [PROT_PROC_HR_TSTR_4] 5. Check that VBUS reaches vSafe5V within tSrcTurnOn max (275ms) of rising above vSafe0v max (0.8V). [PROT_PROC_HR_TSTR_5] Power Delivery Compliance Plan 139 6. Check that Source Capabilities are finished sending within tFirstSourceCap max (250ms) of VBUS reaching vSafe5v min. [PROT_PROC_HR_TSTR_6]. This is in line with 7.1.5 Response to Hard Resets of the USB Power Delivery Specification Revision 3.0, Version 1.2, "Hard Reset Signaling indicates a communication failure has occurred and the Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin and Shall drive VBUS to vSafe0V as shown in Figure 7-9. The USB connection May reset during a Hard Reset since the VBUS voltage will be less than vSafe5V for an extended period of time. After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V. A Source Shall conform to the VCONN timing as specified in [USB Type-C 1.3]." With the above guidelines from the spec in mind, TCPM does not turn off VCONN while entering SRC_HARD_RESET_VBUS_OFF. The patch makes TCPM turn off VCONN while entering SRC_HARD_RESET_VBUS_OFF and turn it back on while entering SRC_HARD_RESET_VBUS_ON along with vbus instead of having VCONN on through hardreset. Also, the spec clearly states that "After establishing the vSafe0V voltage condition on VBUS", the Source Shall wait tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V. TCPM does not conform to this requirement. If the TCPC driver calls tcpm_vbus_change with vbus off signal, TCPM right away enters SRC_HARD_RESET_VBUS_ON without waiting for tSrcRecover. For TCPC's which are buggy/does not call tcpm_vbus_change, TCPM assumes that the vsafe0v is instantaneous as TCPM only waits tSrcRecover instead of waiting for tSafe0v + tSrcRecover. This patch also fixes this behavior by making sure that TCPM waits for tSrcRecover before transitioning into SRC_HARD_RESET_VBUS_ON when tcpm_vbus_change is called by TCPC. When TCPC does not call tcpm_vbus_change, TCPM assumes the worst case i.e. tSafe0v + tSrcRecover before transitioning into SRC_HARD_RESET_VBUS_ON. Thanks, Badhri On Thu, Aug 13, 2020 at 1:08 AM Heikki Krogerus wrote: > > Hi, > > On Tue, Aug 11, 2020 at 07:51:26PM -0700, Badhri Jagan Sridharan wrote: > > >From the spec: > > "7.1.5 Response to Hard Resets > > Hard Reset Signaling indicates a communication failure has occurred and > > the Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin > > and Shall drive VBUS to vSafe0V as shown in Figure 7-9. The USB connection > > May reset during a Hard Reset since the VBUS voltage will be less than > > vSafe5V for an extended period of time. After establishing the vSafe0V > > voltage condition on VBUS, the Source Shall wait tSrcRecover before > > re-applying VCONN and restoring VBUS to vSafe5V. A Source Shall conform > > to the VCONN timing as specified in [USB Type-C 1.3]." > > I really think you need to explain the patch at least a little. > Consider people who don't understand that much about USB PD. Open it > up somehow instead of just quoting the spec. > > Can you please start by explaining what exactly is TDA 2.2.1.1 and TDA > 2.2.1.2. Perhaps you could also consider a better subject line for > this? > > thanks, > > -- > heikki