From patchwork Fri Nov 13 20:24:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904549 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A511697 for ; Fri, 13 Nov 2020 20:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E859B20B80 for ; Fri, 13 Nov 2020 20:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726497AbgKMU04 (ORCPT ); Fri, 13 Nov 2020 15:26:56 -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 S1726090AbgKMU0z (ORCPT ); Fri, 13 Nov 2020 15:26:55 -0500 IronPort-SDR: beNN5KLIZ+rF+5qsHe/5dB0LXYLz1qPyi45eX9Pfs463ie3VW//ZHJeHg+Vr871n5NaAT9PT7S omVs/S9a9ygA== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145822" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145822" 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:54 -0800 IronPort-SDR: dCEbx2WZURtavMopFhFjC+0yVd/sYXqSCUHHc7Mge6UGphduyRyYRhmOotSvWxV7gKHmkikTIf V/Q6gZtUB1FA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050271" 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:54 -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 1/8] usb: typec: Correct the bit values for the Thunderbolt rounded/non-rounded cable support Date: Fri, 13 Nov 2020 12:24:56 -0800 Message-Id: <20201113202503.6559-2-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-usb@vger.kernel.org Rounded and non-rounded Thunderbolt cables are represented by two bits as per USB Type-C Connector specification v2.0 section F.2.6. Corrected that in the Thunderbolt 3 cable discover mode VDO. Signed-off-by: Utkarsh Patel Reviewed-by: Heikki Krogerus --- Changes in v2: - Removed the fixes tag as there is no functional implication. -- --- include/linux/usb/typec_tbt.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/usb/typec_tbt.h b/include/linux/usb/typec_tbt.h index 47c2d501ddce..aad648d14bb3 100644 --- a/include/linux/usb/typec_tbt.h +++ b/include/linux/usb/typec_tbt.h @@ -40,11 +40,16 @@ struct typec_thunderbolt_data { #define TBT_CABLE_USB3_PASSIVE 2 #define TBT_CABLE_10_AND_20GBPS 3 #define TBT_CABLE_ROUNDED BIT(19) +#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \ + (((_vdo_) & GENMASK(20, 19)) >> 19) +#define TBT_GEN3_NON_ROUNDED 0 +#define TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED 1 #define TBT_CABLE_OPTICAL BIT(21) #define TBT_CABLE_RETIMER BIT(22) #define TBT_CABLE_LINK_TRAINING BIT(23) #define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16) +#define TBT_SET_CABLE_ROUNDED(_g_) (((_g_) & GENMASK(1, 0)) << 19) /* TBT3 Device Enter Mode VDO bits */ #define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s) From patchwork Fri Nov 13 20:24:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904545 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10268697 for ; Fri, 13 Nov 2020 20:27:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F284022248 for ; Fri, 13 Nov 2020 20:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbgKMU1T (ORCPT ); Fri, 13 Nov 2020 15:27:19 -0500 Received: from mga06.intel.com ([134.134.136.31]:13742 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbgKMU04 (ORCPT ); Fri, 13 Nov 2020 15:26:56 -0500 IronPort-SDR: sDis2yQ7BfVTfchd60UJUXoqI0hYq0XMtIops3wQu7IR/gWZp5yD0e68HUKFi6GQtjRPzINIIz 5pejLxsojNNg== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145823" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145823" 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:54 -0800 IronPort-SDR: PwGPkE4CWgjf/mw2PfFOu+jtCzgDAjKQ8RVEreTUy/5RSENrh2eYtPvV3FM35PK6P/BNlguQK2 LOV/Rw/9nn2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050275" 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:54 -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 2/8] platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support Date: Fri, 13 Nov 2020 12:24:57 -0800 Message-Id: <20201113202503.6559-3-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-usb@vger.kernel.org Thunderbolt rounded/non-rounded cable support is two bits value. Correcting it as per the Thunderbolt 3 cable discover mode VDO changes done in the Thunderbolt 3 alternate mode header. Signed-off-by: Utkarsh Patel Reviewed-by: Heikki Krogerus Acked-by: Enric Balletbo i Serra --- Changes in v2: - Removed the fixes tag as there is no functional implication. -- --- drivers/platform/chrome/cros_ec_typec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 31be31161350..8111ed1fc574 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -438,8 +438,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec, if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR) data.cable_mode |= TBT_CABLE_LINK_TRAINING; - if (pd_ctrl->cable_gen) - data.cable_mode |= TBT_CABLE_ROUNDED; + data.cable_mode |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen); /* Enter Mode VDO */ data.enter_vdo = TBT_SET_CABLE_SPEED(pd_ctrl->cable_speed); From patchwork Fri Nov 13 20:24:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1535138B for ; Fri, 13 Nov 2020 20:26:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CD5920B80 for ; Fri, 13 Nov 2020 20:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726522AbgKMU05 (ORCPT ); Fri, 13 Nov 2020 15:26:57 -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 S1725959AbgKMU04 (ORCPT ); Fri, 13 Nov 2020 15:26:56 -0500 IronPort-SDR: DQRTFUfTiH8AOdwVl8kWn/xI5zMEirezSbi9K0qwbPx7vA09uyASlgU1IwbOtqkEOBbJNRLaFX FO3uUQE8eGIw== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145824" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145824" 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:54 -0800 IronPort-SDR: vKKnmB9R8KKVlCCxVaMUZVnKsP4BGr4X6wOENHvwPN1MH0c7ZrqLMtNqziDFxPQhwURbCnuh80 OcUw3q5EuqzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050277" 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:54 -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 3/8] usb: typec: intel_pmc_mux: Configure Thunderbolt cable generation bits Date: Fri, 13 Nov 2020 12:24:58 -0800 Message-Id: <20201113202503.6559-4-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-usb@vger.kernel.org Thunderbolt cable generation bits received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured for Thunderbolt rounded and non-rounded cable support in the Thunderbolt alternate mode. Signed-off-by: Utkarsh Patel Reviewed-by: Heikki Krogerus --- Changes in v2: - No change. -- --- drivers/usb/typec/mux/intel_pmc_mux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index d7f63b74c6b1..aa3211f1c4c3 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -256,6 +256,7 @@ static int pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) { struct typec_thunderbolt_data *data = state->data; + u8 cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode); u8 cable_speed = TBT_CABLE_SPEED(data->cable_mode); struct altmode_req req = { }; @@ -284,6 +285,8 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed); + req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded); + return pmc_usb_command(port, (void *)&req, sizeof(req)); } From patchwork Fri Nov 13 20:24:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89176697 for ; Fri, 13 Nov 2020 20:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77CE320B80 for ; Fri, 13 Nov 2020 20:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbgKMU1B (ORCPT ); Fri, 13 Nov 2020 15:27:01 -0500 Received: from mga06.intel.com ([134.134.136.31]:13742 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbgKMU06 (ORCPT ); Fri, 13 Nov 2020 15:26:58 -0500 IronPort-SDR: IAv27fhk5PN0ERH4Js1n5ZlmoaewuJF6OFKO6EMieO/9IyZD66C+Pc8ScjKF+pTD7ui6kALKU2 Vxonlahskl0g== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145825" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145825" 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:54 -0800 IronPort-SDR: 0uYqFerfBpohQ/FhcKesQtVO6X7QMnFZJ1OuCAGQbOvS46kQscQke8uA8UNN8hIAOcTZUmalHS 4YwulySiLKNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050281" 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:54 -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 4/8] usb: typec: Remove one bit support for the Thunderbolt rounded/non-rounded cable Date: Fri, 13 Nov 2020 12:24:59 -0800 Message-Id: <20201113202503.6559-5-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-usb@vger.kernel.org Two bits support for the Thunderbolt rounded/non-rounded cable has been added to the header file. Hence, removing unused TBT_CABLE_ROUNDED definition from the header file. Signed-off-by: Utkarsh Patel Reviewed-by: Heikki Krogerus --- changes in v2: - Removed the fixes tag as there is no functional implication. -- --- include/linux/usb/typec_tbt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/usb/typec_tbt.h b/include/linux/usb/typec_tbt.h index aad648d14bb3..63dd44b72e0c 100644 --- a/include/linux/usb/typec_tbt.h +++ b/include/linux/usb/typec_tbt.h @@ -39,7 +39,6 @@ struct typec_thunderbolt_data { #define TBT_CABLE_USB3_GEN1 1 #define TBT_CABLE_USB3_PASSIVE 2 #define TBT_CABLE_10_AND_20GBPS 3 -#define TBT_CABLE_ROUNDED BIT(19) #define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \ (((_vdo_) & GENMASK(20, 19)) >> 19) #define TBT_GEN3_NON_ROUNDED 0 From patchwork Fri Nov 13 20:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F6D4138B for ; Fri, 13 Nov 2020 20:27:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E48620B80 for ; Fri, 13 Nov 2020 20:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbgKMU1T (ORCPT ); Fri, 13 Nov 2020 15:27:19 -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 S1726507AbgKMU04 (ORCPT ); Fri, 13 Nov 2020 15:26:56 -0500 IronPort-SDR: ApxSU5/+tgkMG2WNKGW/1xVF6mKA2m+q7nEQSV8dP0lNOeSckXNoFjNASUYBjmGqjRDuk1Tk5Z xRjHm0L+ZKQw== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145826" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145826" 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: J1v9hMYtdprMGM/vkcaJwmWy3vF8yklLS+XlBQt0wqnOSfyGk4m0k30HWC31/29LxDH1mkPYS0 cXuLZMOzgAcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050284" 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:54 -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 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message Date: Fri, 13 Nov 2020 12:25:00 -0800 Message-Id: <20201113202503.6559-6-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-usb@vger.kernel.org USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support. Suggested-by: Heikki Krogerus Signed-off-by: Utkarsh Patel --- Changes in v2: - No change. -- --- include/linux/usb/typec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 6be558045942..d91e09d9d91c 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -75,6 +75,7 @@ enum typec_orientation { /* * struct enter_usb_data - Enter_USB Message details * @eudo: Enter_USB Data Object + * @tbt_cable_vdo: TBT3 Cable Discover Mode Response * @active_link_training: Active Cable Plug Link Training * * @active_link_training is a flag that should be set with uni-directional SBRX @@ -83,6 +84,7 @@ enum typec_orientation { */ struct enter_usb_data { u32 eudo; + u32 tbt_cable_vdo; unsigned char active_link_training:1; }; From patchwork Fri Nov 13 20:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904543 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65F92697 for ; Fri, 13 Nov 2020 20:27:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5165D2224A for ; Fri, 13 Nov 2020 20:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbgKMU1O (ORCPT ); Fri, 13 Nov 2020 15:27:14 -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-usb@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 Acked-by: Enric Balletbo i Serra Reviewed-by: Heikki Krogerus --- 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; From patchwork Fri Nov 13 20:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904541 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7936616C0 for ; Fri, 13 Nov 2020 20:27:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C8B622242 for ; Fri, 13 Nov 2020 20:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726545AbgKMU1A (ORCPT ); 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-usb@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; } From patchwork Fri Nov 13 20:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patel, Utkarsh H" X-Patchwork-Id: 11904539 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF79B697 for ; Fri, 13 Nov 2020 20:27:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEB4322242 for ; Fri, 13 Nov 2020 20:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbgKMU1B (ORCPT ); Fri, 13 Nov 2020 15:27:01 -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 S1725959AbgKMU07 (ORCPT ); Fri, 13 Nov 2020 15:26:59 -0500 IronPort-SDR: Gs8YenaL4IKKmvCjSXMnumMKYmAGxXvwM6GpYcktb3LLhfWzAAlGCm4UCqHzq/nOkMntYBEc/8 /nKnzzhP0WDw== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="232145829" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="232145829" 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: Fe1lLJqLe3XwSO91v4PXXtxMEhKUXUAzdCfmW98bnXl89UQp9KrpbyeJx6Z8HYq8Ro5o0VBQNa K+ZsuutbVR0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="367050293" 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 8/8] usb: typec: Remove active_link_training variable from Enter_USB message Date: Fri, 13 Nov 2020 12:25:03 -0800 Message-Id: <20201113202503.6559-9-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-usb@vger.kernel.org Thunderbolt 3 cable discover mode VDO support has been added as part of Enter_USB message to fill details of active cable plug link training. Hence, removing unused variable active_link_training from Enter_USB message data structure. Signed-off-by: Utkarsh Patel Reviewed-by: Heikki Krogerus --- Changes in v2: - No change. -- --- include/linux/usb/typec.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index d91e09d9d91c..4a9608a15ac1 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -76,16 +76,10 @@ enum typec_orientation { * struct enter_usb_data - Enter_USB Message details * @eudo: Enter_USB Data Object * @tbt_cable_vdo: TBT3 Cable Discover Mode Response - * @active_link_training: Active Cable Plug Link Training - * - * @active_link_training is a flag that should be set with uni-directional SBRX - * communication, and left 0 with passive cables and with bi-directional SBRX - * communication. */ struct enter_usb_data { u32 eudo; u32 tbt_cable_vdo; - unsigned char active_link_training:1; }; /*