From patchwork Tue Nov 10 00:37:10 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: 321858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65DE1C5517A for ; Tue, 10 Nov 2020 00:39:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26EA8206D8 for ; Tue, 10 Nov 2020 00:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730467AbgKJAir (ORCPT ); Mon, 9 Nov 2020 19:38:47 -0500 Received: from mga04.intel.com ([192.55.52.120]:25963 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730387AbgKJAiq (ORCPT ); Mon, 9 Nov 2020 19:38:46 -0500 IronPort-SDR: aOBQkAW7iTy9oJ5Jhs1URI2lkmfRKJyCGAl03NASg88WHg/KRWhLi7fICAeCbiSszHo4kRNlil U0FjPbITjv2w== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="167308560" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="167308560" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 16:38:46 -0800 IronPort-SDR: qYE5tI5DSRYrRZocpoW+TfVXos6L0C7s3Y9Rh1exCBm+0CRMV53vzEx+nw1c6srS7EeY1VomgP HlHzb0dzB3wg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="354312331" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2020 16:38:46 -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 2/8] platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support Date: Mon, 9 Nov 2020 16:37:10 -0800 Message-Id: <20201110003716.5164-3-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110003716.5164-1-utkarsh.h.patel@intel.com> References: <20201110003716.5164-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. Fixes: 5b30bd35aab4 ("platform/chrome: cros_ec_typec: Add TBT compat support") Signed-off-by: Utkarsh Patel --- 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 Tue Nov 10 00:37:11 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: 321861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CAEAC4741F for ; Tue, 10 Nov 2020 00:38:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD7AF20789 for ; Tue, 10 Nov 2020 00:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730733AbgKJAit (ORCPT ); Mon, 9 Nov 2020 19:38:49 -0500 Received: from mga04.intel.com ([192.55.52.120]:25963 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730608AbgKJAis (ORCPT ); Mon, 9 Nov 2020 19:38:48 -0500 IronPort-SDR: dFMXm2GE5FHXUWhkCiaOtLJEqlUscMM803h7GIdYgCr/ThiTaBoVpPb8tR9iUY/ZGQZHfXnsST K4cto56jIipA== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="167308563" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="167308563" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 16:38:48 -0800 IronPort-SDR: 8+NyTaOfgOqfj3dSponRGgWOUyPbqwLPWrxFYMIP3BIM+0VuP4bODYMzSh+olKTJjaxzAuktwS Xne/VfvlYHzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="354312344" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2020 16:38:48 -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 3/8] usb: typec: intel_pmc_mux: Configure Thunderbolt cable generation bits Date: Mon, 9 Nov 2020 16:37:11 -0800 Message-Id: <20201110003716.5164-4-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110003716.5164-1-utkarsh.h.patel@intel.com> References: <20201110003716.5164-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 --- 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 Tue Nov 10 00:37:12 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: 321859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21413C2D0A3 for ; Tue, 10 Nov 2020 00:39:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE9B7206D8 for ; Tue, 10 Nov 2020 00:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730846AbgKJAiw (ORCPT ); Mon, 9 Nov 2020 19:38:52 -0500 Received: from mga04.intel.com ([192.55.52.120]:25963 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730790AbgKJAiu (ORCPT ); Mon, 9 Nov 2020 19:38:50 -0500 IronPort-SDR: P9S2hNSbYAiPSWqlTelFyfX/Gdls3BgUiGjC2WdExxO2Bmp23KqCzm18isuZGhXJJVuSp2BL87 TzIXmw3ENwxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="167308568" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="167308568" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 16:38:50 -0800 IronPort-SDR: O/Ttf5HRpmiY+MgxDf0+6LWfFh3Mr15pHDoxn6Xrm1BS2c566MK1aeLZbjbMkdGSArQ4oQAII5 b6qsKRACVf6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="354312348" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2020 16:38:50 -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 4/8] usb: typec: Remove one bit support for the Thunderbolt rounded/non-rounded cable Date: Mon, 9 Nov 2020 16:37:12 -0800 Message-Id: <20201110003716.5164-5-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110003716.5164-1-utkarsh.h.patel@intel.com> References: <20201110003716.5164-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. Fixes: ca469c292edc ("usb: typec: Add definitions for Thunderbolt 3 Alternate Mode") Signed-off-by: Utkarsh Patel --- 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 Tue Nov 10 00:37:13 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: 321860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7746CC4741F for ; Tue, 10 Nov 2020 00:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28E56206D8 for ; Tue, 10 Nov 2020 00:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731095AbgKJAi6 (ORCPT ); Mon, 9 Nov 2020 19:38:58 -0500 Received: from mga04.intel.com ([192.55.52.120]:25963 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730923AbgKJAiy (ORCPT ); Mon, 9 Nov 2020 19:38:54 -0500 IronPort-SDR: hNmH3qcIE0Cs0r6l9Chf9wTntTd/vllA30bS1DEYhKg6nLoIhKcsMyOslp26T84ECRQDS2/at4 EqUav3YvCAhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="167308586" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="167308586" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 16:38:53 -0800 IronPort-SDR: sbf93IN/N67SJ0uH032Yevp3hC3tEfY97Y8p8c4ajFhKIS5ahJc0evkzjFm5qcW0Vq+1YGZOJL q/5ah14Sz2Vw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="354312360" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2020 16:38:52 -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 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message Date: Mon, 9 Nov 2020 16:37:13 -0800 Message-Id: <20201110003716.5164-6-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110003716.5164-1-utkarsh.h.patel@intel.com> References: <20201110003716.5164-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 --- 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; };