Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1432978pxb; Fri, 13 Nov 2020 12:31:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwavE3/In79dTm5catPlPpii1FVBE8vIvdoeKCBf2wMkIFTBx2BFv25mW6k3/3cL2u8Ypwx X-Received: by 2002:a17:906:3a8c:: with SMTP id y12mr3693360ejd.531.1605299504084; Fri, 13 Nov 2020 12:31:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605299504; cv=none; d=google.com; s=arc-20160816; b=Irw2dRlY3w5xab8rwY6kgUcRGoiPw7/wxzcI2+fGJmJKU5Qrwo+Hww0OQa9Faz9T53 fO4g4/grsVpqcPKGLd3ERNYwrrJJFOigZkHTA5KyjktHJkQUnaD3X452rB2/8CNol58r ZEuSNYazJ66KU3gfx4TZNceg2kU2KEKxzFCIHFhNz0OiTyM8US4RQUmxjAjIKUUV59xJ AZy3jWkxlWOQCyLqAEcHDVW9btZ06fCkWnudlTD0gI5FrinerSOg2SBp5uPDDH2a40Ty /l4CiepwnknRnU/yyLQS5pTdjvOaFzS2z19HthV029BQK9bR3A+B1hQCtnqRI2TdCaeB Rtdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=6LkRt2g9YRao+PUlmegcxlb/9QlFZ3sbPn1ZlhiWeGw=; b=DMh/0qxih8haJIwIGX6lYVeglNQsuMuaeTEP9HRZl36LzHb2KvCUT4K+rejtNqKEZ4 j1J/PP7sLxozSYq0W8HNpE/gHnqH3ySBjKy4UvSnBvKQ0lYJYOMyHOdrad5fKVmd0KfZ B5443ydRlcLRPXVVEhccsDVVXflYXuLDKcxTPSeSMMK6++USyh+uhGZZxnF4Vj3HnCD6 gqq9hOrBkBI5az8CaQmg0bShewwNExnwf+AFogRCsYn83Iz2sGTsAsuSMsmsoe06QQt9 Yd899bSWIkKv+Q4VOR2vmnEaXu+Fem7USUlzRXKdSvSMZ8ITswSVDhihSCStaemsU9Uu ZCsA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj4si6746850edb.64.2020.11.13.12.31.20; Fri, 13 Nov 2020 12:31:44 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726537AbgKMU1P (ORCPT + 99 others); Fri, 13 Nov 2020 15:27:15 -0500 Received: from mga06.intel.com ([134.134.136.31]:13739 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbgKMU06 (ORCPT ); Fri, 13 Nov 2020 15:26:58 -0500 IronPort-SDR: gcp1kCNvvUDczGXxtjARdppfR7vaZqYGwyWnr6mrzplIQPaaEVuGPYMRfUxi3a7X77bEMI/DBJ b/VrUU4xosZg== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145827" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145827" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2020 12:26:55 -0800 IronPort-SDR: 2bMsU2l9cUsP1l8qHlIF5iztInvDUKwPz07Sbc3fAG4ZkuNJoH3ZRIYCWxbmfTRKwPnC4rulOc 6eyehdPP1VWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050287" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga007.jf.intel.com with ESMTP; 13 Nov 2020 12:26:55 -0800 From: Utkarsh Patel To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, pmalani@chromium.org, enric.balletbo@collabora.com, rajmohan.mani@intel.com, azhar.shaikh@intel.com, Utkarsh Patel Subject: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode Date: Fri, 13 Nov 2020 12:25:01 -0800 Message-Id: <20201113202503.6559-7-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201113202503.6559-1-utkarsh.h.patel@intel.com> References: <20201113202503.6559-1-utkarsh.h.patel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables. While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value. Suggested-by: Heikki Krogerus Signed-off-by: Utkarsh Patel -- Changes in v2: - No change. -- --- drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 8111ed1fc574..b7416e82c3b3 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec, else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE) data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT; - data.active_link_training = !!(pd_ctrl->control_flags & - USB_PD_CTRL_ACTIVE_LINK_UNIDIR); + /* + * This driver does not have access to the identity information or + * capabilities of the cable, so we don't know is it a real USB4 or + * TBT3 cable. Therefore pretending that it's always TBT3 cable by + * filling the TBT3 Cable VDO. + */ + data.tbt_cable_vdo = TBT_MODE; + + if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR) + data.tbt_cable_vdo |= TBT_CABLE_LINK_TRAINING; + + data.tbt_cable_vdo |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen); port->state.alt = NULL; port->state.data = &data; -- 2.17.1