Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp47072pxa; Mon, 10 Aug 2020 18:12:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx55TK/7+BzdSDyGTr0bhEo5zYwkfqZuCR5kc0ACkEDoKNwDbcwgAXNvOABkAi8IMVg3/x/ X-Received: by 2002:aa7:c697:: with SMTP id n23mr23003246edq.50.1597108375091; Mon, 10 Aug 2020 18:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597108375; cv=none; d=google.com; s=arc-20160816; b=qbh4odFdqc9GCQ6LvJNHKgkAa1wcCW71GirJ1WkbwFjgo2bDI5Ir37HPsImMo7n2gY XxkvWyUDbA0ltpr41fUv8kl6CozPKUWaBLxKN3IWWjicOTf0ZFW4l5iFMxI3B9Pi0rn0 HrFjNa9Wh3ssCdeYks490vFGEYe4Ir4LGPrWgt4bLTVNTRtWMbUiqxG5jl23wOTHIJC+ ds2s8hWvu1hASC3zKaELk+ZOHML90fJcLDco6F/0ylCDY+TY2wxffGIA4a3iYIJMmpmB qeU/NhFTu7DqqqJ/WQtsNjKg1N5c9PS/8Jgd1EgytrPfojnwkTAFQXCd0PjlPeE8UhNu MPkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=hZlSontx+TLwHcuOl3hzbTHUYgf3jf+x/xXiXRfowoA=; b=ptxHSnPMsCbdSlZ24mWJAV5ZGCGRNxsBXrZPsinAI+qnnce6Rgb1u2pxfuxq/FVjCL diRghlnWhgt1ljxAFKpjlK4WQODKqe66K4v3NHsFcbWUiwxAw8nvxhRNo9+Nuzo/ITEO FpKLOzfklGywHtLimj6vuV9FJu+ZHBz8d1E5aQRYbf1ryok9xv6xShIDXtUK0wpOYtpt WXpNRMzqCYgBmutRGYJ3ZiAnjpBd0thSjfUF3E4epTH4a6Nu/VhR0VAtk6Dedl+pmAPl or/AymBOf+wBz2AJuDFqc59NtTEyF2DiYNTjuC+FBgIEnzE+Vp4W5vo/d4e2Weha4XmZ L1oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XHm0e4TR; 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 c5si12042212ejm.274.2020.08.10.18.12.32; Mon, 10 Aug 2020 18:12:55 -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=XHm0e4TR; 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 S1728005AbgHKBLc (ORCPT + 99 others); Mon, 10 Aug 2020 21:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbgHKBLb (ORCPT ); Mon, 10 Aug 2020 21:11:31 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B816C06174A for ; Mon, 10 Aug 2020 18:11:31 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id h2so7729096pgc.19 for ; Mon, 10 Aug 2020 18:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=hZlSontx+TLwHcuOl3hzbTHUYgf3jf+x/xXiXRfowoA=; b=XHm0e4TRpae8mWNjQYrTYKPVSJRU+t/VHQMdxFHwdS6jWGfXUm3yKc9g9CjmB+yuO2 evHZa5O+BSv5/MfifDnhN61AY2lafaEm678cEZVvvZY1hqy+qwy3NkptIjuchWaaFXKA duzLUUATH4nBhGJpDkmwICsHOPSaCZJ1nHuPfni2htZQ6OhDwfANXdJeyw/quhNrpjbe 5Wdga7j44i7JMffxqHkt2+v+YBRzU5gKXr1J58iABmh3uBf3R1TR4ALkjrL1nkkLUNx6 QkuzMNCI2D5Z+PlYl+LUbwjnZRDR7dgoYYyDR4oRn/w/Bs6JP0rwxD1b5PeAyr/18+nl WLqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=hZlSontx+TLwHcuOl3hzbTHUYgf3jf+x/xXiXRfowoA=; b=lMOsDav7fJnVz4XN57u4m2ZCnWYIwHZCaLNGFDU0bw8RFnE7InLVSsaq0ow81aO58u y28DN8EhTC1FRA5woITwQrAUjAm/riSLJqvlBSkI4eHv4rpNnfSthlSlLZVrBd8kCI2C pnI6jQ9fCtxtEU2OXeCSBuRYXzx8VwR6SzNZAXkIqwLu5myHW9DrSCZuUC5ung/7eVC4 pPkwJeIQYXDDQ/B2D8qjW7FBezD+NxbkViDzU9HDYCyrKV6pBqPTF9vZTODQPSzoX80t 4qAghsWxVrZt6wn8XMHHFB7TNvFOaMI5zbXsFTyN4OFV1RVvEFGrsp+qKP6CnGGEj5Bo SdYA== X-Gm-Message-State: AOAM531aTYHqqbe/jA56JRxXEgGzdJQUVGk6DlYcZzDeo9dg8por/F5f qGwy10svWWCsYsqCM7V7jD272xqbmEg= X-Received: by 2002:a63:5b65:: with SMTP id l37mr23190683pgm.72.1597108290020; Mon, 10 Aug 2020 18:11:30 -0700 (PDT) Date: Mon, 10 Aug 2020 18:11:26 -0700 Message-Id: <20200811011126.130297-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [PATCH v1] usb: typec: tcpm: Fix TDA 2.2.1.1 and TDA 2.2.1.2 failures From: Badhri Jagan Sridharan To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan 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 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]." Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 3ef37202ee37..e41c4e5d3c71 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3372,13 +3372,19 @@ static void run_state_machine(struct tcpm_port *port) tcpm_set_state(port, SNK_HARD_RESET_SINK_OFF, 0); break; case SRC_HARD_RESET_VBUS_OFF: - tcpm_set_vconn(port, true); + /* + * 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. + */ + tcpm_set_vconn(port, false); tcpm_set_vbus(port, false); tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, tcpm_data_role_for_source(port)); - tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); break; case SRC_HARD_RESET_VBUS_ON: + tcpm_set_vconn(port, true); tcpm_set_vbus(port, true); port->tcpc->set_pd_rx(port->tcpc, true); tcpm_set_attached_state(port, true); @@ -3944,7 +3950,11 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) tcpm_set_state(port, SNK_HARD_RESET_WAIT_VBUS, 0); break; case SRC_HARD_RESET_VBUS_OFF: - tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, 0); + /* + * After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait + * tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V. + */ + tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); break; case HARD_RESET_SEND: break; -- 2.28.0.236.gb10cc79966-goog