All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Lukas Wunner <lukas@wunner.de>,
	Andreas Noever <andreas.noever@gmail.com>,
	Gil Fine <gil.fine@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 05/20] thunderbolt: Rework Titan Ridge TMU objection disable function
Date: Mon, 29 May 2023 13:04:10 +0300	[thread overview]
Message-ID: <20230529100425.6125-6-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20230529100425.6125-1-mika.westerberg@linux.intel.com>

Now this is split into two with one having a misleading name
(tb_switch_tmu_unidirectional_enable()).

Make this easier to read, rename and consolidate the two functions into
one with name that explains what it actually does. Use the two constants
as well that were added but never used to make it clear which bits are
being set.

No functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/tmu.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c
index 5d508ea8baa5..30f18806abb7 100644
--- a/drivers/thunderbolt/tmu.c
+++ b/drivers/thunderbolt/tmu.c
@@ -503,8 +503,10 @@ static int tb_switch_tmu_enable_bidirectional(struct tb_switch *sw)
 	return ret;
 }
 
-static int tb_switch_tmu_objection_mask(struct tb_switch *sw)
+/* Only needed for Titan Ridge */
+static int tb_switch_tmu_disable_objections(struct tb_switch *sw)
 {
+	struct tb_port *up = tb_upstream_port(sw);
 	u32 val;
 	int ret;
 
@@ -515,17 +517,15 @@ static int tb_switch_tmu_objection_mask(struct tb_switch *sw)
 
 	val &= ~TB_TIME_VSEC_3_CS_9_TMU_OBJ_MASK;
 
-	return tb_sw_write(sw, &val, TB_CFG_SWITCH,
-			   sw->cap_vsec_tmu + TB_TIME_VSEC_3_CS_9, 1);
-}
-
-static int tb_switch_tmu_unidirectional_enable(struct tb_switch *sw)
-{
-	struct tb_port *up = tb_upstream_port(sw);
+	ret = tb_sw_write(sw, &val, TB_CFG_SWITCH,
+			  sw->cap_vsec_tmu + TB_TIME_VSEC_3_CS_9, 1);
+	if (ret)
+		return ret;
 
 	return tb_port_tmu_write(up, TMU_ADP_CS_6,
 				 TMU_ADP_CS_6_DISABLE_TMU_OBJ_MASK,
-				 TMU_ADP_CS_6_DISABLE_TMU_OBJ_MASK);
+				 TMU_ADP_CS_6_DISABLE_TMU_OBJ_CL1 |
+				 TMU_ADP_CS_6_DISABLE_TMU_OBJ_CL2);
 }
 
 /*
@@ -670,11 +670,7 @@ int tb_switch_tmu_enable(struct tb_switch *sw)
 		if (!tb_switch_is_clx_enabled(sw, TB_CL1))
 			return -EOPNOTSUPP;
 
-		ret = tb_switch_tmu_objection_mask(sw);
-		if (ret)
-			return ret;
-
-		ret = tb_switch_tmu_unidirectional_enable(sw);
+		ret = tb_switch_tmu_disable_objections(sw);
 		if (ret)
 			return ret;
 	}
-- 
2.39.2


  parent reply	other threads:[~2023-05-29 10:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 10:04 [PATCH 00/20] thunderbolt: Rework TMU and CLx support Mika Westerberg
2023-05-29 10:04 ` [PATCH 01/20] thunderbolt: Introduce tb_switch_downstream_port() Mika Westerberg
2023-05-29 10:04 ` [PATCH 02/20] thunderbolt: Introduce tb_xdomain_downstream_port() Mika Westerberg
2023-05-29 10:04 ` [PATCH 03/20] thunderbolt: Fix a couple of style issues in TMU code Mika Westerberg
2023-05-29 10:04 ` [PATCH 04/20] thunderbolt: Drop useless 'unidirectional' parameter from tb_switch_tmu_is_enabled() Mika Westerberg
2023-05-29 10:04 ` Mika Westerberg [this message]
2023-05-29 10:04 ` [PATCH 06/20] thunderbolt: Get rid of tb_switch_enable_tmu_1st_child() Mika Westerberg
2023-05-29 10:04 ` [PATCH 07/20] thunderbolt: Move TMU configuration to tb_enable_tmu() Mika Westerberg
2023-05-29 10:04 ` [PATCH 08/20] thunderbolt: Move tb_enable_tmu() close to other TMU functions Mika Westerberg
2023-05-29 10:04 ` [PATCH 09/20] thunderbolt: Check valid TMU configuration in tb_switch_tmu_configure() Mika Westerberg
2023-05-29 10:04 ` [PATCH 10/20] thunderbolt: Move CLx support functions into clx.c Mika Westerberg
2023-05-29 10:04 ` [PATCH 11/20] thunderbolt: Get rid of __tb_switch_[en|dis]able_clx() Mika Westerberg
2023-05-29 10:04 ` [PATCH 12/20] thunderbolt: Move CLx enabling into tb_enable_clx() Mika Westerberg
2023-05-29 10:04 ` [PATCH 13/20] thunderbolt: Switch CL states from enum to a bitmask Mika Westerberg
2023-05-29 10:04 ` [PATCH 14/20] thunderbolt: Check for first depth router in tb.c Mika Westerberg
2023-05-29 10:04 ` [PATCH 15/20] thunderbolt: Do not call CLx functions from TMU code Mika Westerberg
2023-05-29 10:04 ` [PATCH 16/20] thunderbolt: Prefix TMU post time log message with "TMU: " Mika Westerberg
2023-05-29 10:04 ` [PATCH 17/20] thunderbolt: Prefix CL state related log messages with "CLx: " Mika Westerberg
2023-05-29 10:04 ` [PATCH 18/20] thunderbolt: Initialize CL states from the hardware Mika Westerberg
2023-05-29 10:04 ` [PATCH 19/20] thunderbolt: Make tb_switch_clx_disable() return CL states that were enabled Mika Westerberg
2023-05-29 10:04 ` [PATCH 20/20] thunderbolt: Disable CL states when a DMA tunnel is established Mika Westerberg
2023-06-09  9:09 ` [PATCH 00/20] thunderbolt: Rework TMU and CLx support Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230529100425.6125-6-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=gil.fine@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.