Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1433270pxb; Fri, 13 Nov 2020 12:32:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy16WbQv6zBpZixsnJLueP4Y2vxpBxLZs+MdkICmvV/3JzA5WyysU4bkZCmRHV0Bo7OYpLJ X-Received: by 2002:a17:906:578b:: with SMTP id k11mr3793399ejq.330.1605299530308; Fri, 13 Nov 2020 12:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605299530; cv=none; d=google.com; s=arc-20160816; b=kqs8ThTb5jbsnVM281NDhMAoymEiWwEWVKhvZZK6+u2a0r0hpaQcfnPJvxyFwiYA08 YJVyD3c4ijyQHtna2459c7OwL5SPv7N8Gd3LzMiZAKsoDoo2lN9KAp0tHbyG15mqRjkl cM1/Vi0JS4ruBOXzW6tekqxd1XF5nhUkhpzLmvZkU6ahgrIL1rK/kGUzGFY6FKvNVvif NsrTOompwI9wjXpoi5RBgwGF12SIt3RaY6H4RZ/NvyfABkd3WMRYiTOWuaFBoAJG8zVT rMq1uwYy4jtt2vG/fECJuZQv+OggrrvMP7qEc8B8AdfIcRMhJnQT0/5IvG/vDHkO5Pzk U2Hw== 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=ACT5wvHhZGACmKCX9mbqiQRvDTlvBZVExoeFTyHLymM=; b=lMDUGLWT5Z+K1aYBr0CCjkmDxYJLf5/iz8RtATKKzDE2x1gHhCDiX2MBpMV4BBaLXa r2USuBs/lHcBhYWRYJ2DwfsPQMyuslwkEAs5yFgQkYDww7U0rjnyQmDlxup5s0BYjB2X 8Cv3qTRWTtqDOekXmAxq3ogECivskJZRKDahS+cXy2fKau3a5iTiR3jCG4GkDQsCsYWp l0M/2T1MUpPIBxqmrOt5aDL2+ptAVuqQtdRsEJmbu4idomgN2US7m4cIqQhnocH1D2l3 6td4D3PSZEX27RB+pTAOS6sSlpJLsanZEtJf/465vcm4F6kKevVp53psrjC/EbmRwEh7 kbWA== 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 u4si7042047eda.182.2020.11.13.12.31.47; Fri, 13 Nov 2020 12:32:10 -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 S1726552AbgKMU1A (ORCPT + 99 others); Fri, 13 Nov 2020 15:27:00 -0500 Received: from mga06.intel.com ([134.134.136.31]:13747 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgKMU07 (ORCPT ); Fri, 13 Nov 2020 15:26:59 -0500 IronPort-SDR: 09W50NKRHJwRQmyIpDCfiaz2nlbfTNKlJDr7GSuLBpamCDQDLnHz0d7CNc3ntPkeYCz4Y+Cw2Z rE9oVuU4iGDQ== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145828" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145828" 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: i29wMykUxtWb7qPZ5mtgPhDowYjpWDUJHeWScD0Ezb4AXBTld5he7EcK1tj6Q8nDucAp2mgK4c zYLM3JYnQqDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050290" 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 7/8] usb: typec: intel_pmc_mux: Configure active cable properties for USB4 Date: Fri, 13 Nov 2020 12:25:02 -0800 Message-Id: <20201113202503.6559-8-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 Value received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured in the USB4 mode for the Thunderbolt rounded support and active cable plug link training. Suggested-by: Heikki Krogerus Signed-off-by: Utkarsh Patel -- Changes in v2: - No change. -- --- drivers/usb/typec/mux/intel_pmc_mux.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index aa3211f1c4c3..61feb358aad3 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -295,6 +295,7 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) { struct enter_usb_data *data = state->data; struct altmode_req req = { }; + u8 cable_rounded; u8 cable_speed; if (IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) || @@ -308,9 +309,6 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) /* USB4 Mode */ req.mode_data = PMC_USB_ALTMODE_FORCE_LSR; - if (data->active_link_training) - req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK; - req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; @@ -322,6 +320,20 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) fallthrough; default: req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE; + + if (data->tbt_cable_vdo) { + /* Active Thunderbolt 3 cable */ + if (data->tbt_cable_vdo & TBT_CABLE_LINK_TRAINING) + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK; + + cable_rounded = + TBT_CABLE_ROUNDED_SUPPORT(data->tbt_cable_vdo); + req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded); + } else { + /* Active USB4 cable */ + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK | + PMC_USB_ALTMODE_TBT_GEN(1); + } break; } -- 2.17.1