FAILED: patch "[PATCH] phy: tegra: xusb: Fix per-pad high-speed termination" failed to apply to 6.1-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x da110228b54f2e2143d97ea7151e0dc22e539d67
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026052822-poking-retrace-342b@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From da110228b54f2e2143d97ea7151e0dc22e539d67 Mon Sep 17 00:00:00 2001
From: Wayne Chang <[email protected]>
Date: Mon, 4 May 2026 11:33:05 +0800
Subject: [PATCH] phy: tegra: xusb: Fix per-pad high-speed termination
calibration
The existing code reads a single hs_term_range_adj value from bit field [10:7] of FUSE_SKU_CALIB_0 and applies it to all USB2 pads uniformly. However, on SoCs that support per-pad termination, each pad has its own hs_term_range_adj field: pad 0 in FUSE_SKU_CALIB_0[10:7], and pads 1-3 in FUSE_USB_CALIB_EXT_0 at bit offsets [8:5], [12:9], and [16:13] respectively.
Fix the calibration by reading per-pad values from the appropriate fuse registers. For SoCs that do not support per-pad termination, replicate pad 0's value to all pads to maintain existing behavior.
Add a has_per_pad_term flag to the SoC data to indicate whether per-pad termination values are available in FUSE_USB_CALIB_EXT_0.
drivers/phy/tegra/xusb-tegra186.c +26 -7
@@ -20,8 +20,8 @@/* FUSE USB_CALIB registers */ #define HS_CURR_LEVEL_PADX_SHIFT (x) ((x) ? (11 + (x - 1) * 6) : 0)#define HS_CURR_LEVEL_PAD_MASK 0x3f -#define HS_TERM_RANGE_ADJ_SHIFT 7 -#define HS_TERM_RANGE_ADJ_MASK 0xf +#define HS_TERM_RANGE_ADJ_PADX_SHIFT (x) ((x) ? (5 + (x - 1) * 4) : 7) +#define HS_TERM_RANGE_ADJ_PAD_MASK 0xf#define HS_SQUELCH_SHIFT 29#define HS_SQUELCH_MASK 0x7
@@ -253,7 +253,7 @@struct tegra_xusb_fuse_calibration {u32 *hs_curr_level;u32 hs_squelch; -u32 hs_term_range_adj; +u32 *hs_term_range_adj;u32 rpd_ctrl; };
@@ -930,7 +930,7 @@ static int tegra186_utmi_phy_power_on(struct phy *phy) value =padctl_readl (padctl,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index)); value &= ~TERM_RANGE_ADJ (~0 ); - value |=TERM_RANGE_ADJ (priv->calib.hs_term_range_adj); + value |=TERM_RANGE_ADJ (priv->calib.hs_term_range_adj[index]); value &= ~RPD_CTRL (~0 ); value |=RPD_CTRL (priv->calib.rpd_ctrl);padctl_writel (padctl, value,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index));
@@ -1464,17 +1464,23 @@ static const char * const tegra186_usb3_functions[] = {static int tegra186_xusb_read_fuse_calibration (struct tegra186_xusb_padctl *padctl) { +const struct tegra_xusb_padctl_soc *soc = padctl->base.soc;struct device *dev = padctl->base.dev;unsigned int i, count;u32 value, *level; +u32 *hs_term_range_adj;int err; - count = padctl->base.soc->ports.usb2.count; + count = soc->ports.usb2.count; level =devm_kcalloc (dev, count,sizeof (u32),GFP_KERNEL );if (!level)return -ENOMEM ; + hs_term_range_adj =devm_kcalloc (dev, count,sizeof (u32),GFP_KERNEL ); +if (!hs_term_range_adj) +return -ENOMEM ; + err =tegra_fuse_readl (TEGRA_FUSE_SKU_CALIB_0 , &value);if (err) return dev_err_probe(dev, err,
@@ -1490,8 +1496,8 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) padctl->calib.hs_squelch = (value >>HS_SQUELCH_SHIFT ) &HS_SQUELCH_MASK ; - padctl->calib.hs_term_range_adj = (value >>HS_TERM_RANGE_ADJ_SHIFT ) & -HS_TERM_RANGE_ADJ_MASK ; + hs_term_range_adj[0 ] = (value >>HS_TERM_RANGE_ADJ_PADX_SHIFT (0 )) & +HS_TERM_RANGE_ADJ_PAD_MASK ; err =tegra_fuse_readl (TEGRA_FUSE_USB_CALIB_EXT_0 , &value);if (err) {
@@ -1503,6 +1509,17 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) padctl->calib.rpd_ctrl = (value >>RPD_CTRL_SHIFT ) &RPD_CTRL_MASK ; +for (i =1 ; i < count; i++) { +if (soc->has_per_pad_term) + hs_term_range_adj[i] = + (value >>HS_TERM_RANGE_ADJ_PADX_SHIFT (i)) & +HS_TERM_RANGE_ADJ_PAD_MASK ; +else + hs_term_range_adj[i] = hs_term_range_adj[0 ]; + } + + padctl->calib.hs_term_range_adj = hs_term_range_adj; +return 0 ; }
@@ -1708,6 +1725,7 @@ const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc = { .num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names), .supports_gen2 = true, .poll_trk_completed = true, + .has_per_pad_term = true, };EXPORT_SYMBOL_GPL (tegra194_xusb_padctl_soc);
@@ -1732,6 +1750,7 @@ const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc = { .trk_hw_mode = false, .trk_update_on_idle = true, .supports_lp_cfg_en = true, + .has_per_pad_term = true, };EXPORT_SYMBOL_GPL (tegra234_xusb_padctl_soc);#endif
drivers/phy/tegra/xusb.h +1 -0
@@ -435,6 +435,7 @@ struct tegra_xusb_padctl_soc {bool trk_hw_mode;bool trk_update_on_idle;bool supports_lp_cfg_en; +bool has_per_pad_term; };struct tegra_xusb_padctl {
Sasha Levin
maintainerPATCH 1/2 phy: tegra: xusb: Disable trk clk when not in use
From: Wayne Chang <[email protected]>
[ Upstream commit 71d9e899584e11bbd7eaf9934a619c69a15060d8 ]
Pad tracking is a one-time calibration for Tegra186 and Tegra194. Clk should be disabled after calibration.
Disable clk after calibration.
While at it add 100us delay for HW recording the calibration value.
Stable-dep-of: da110228b54f ("phy: tegra: xusb: Fix per-pad high-speed termination calibration")
--- drivers/phy/tegra/xusb-tegra186.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/tegra/xusb-tegra186.c +4 -2
@@ -612,6 +612,10 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value &= ~USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); +udelay (100 ); + +clk_disable_unprepare (priv->usb2_trk_clk); +mutex_unlock (&padctl->lock); }
@@ -636,8 +640,6 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) value |=USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); -clk_disable_unprepare (priv->usb2_trk_clk); -mutex_unlock (&padctl->lock); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 phy: tegra: xusb: Fix per-pad high-speed termination calibration
From: Wayne Chang <[email protected]>
[ Upstream commit da110228b54f2e2143d97ea7151e0dc22e539d67 ]
The existing code reads a single hs_term_range_adj value from bit field [10:7] of FUSE_SKU_CALIB_0 and applies it to all USB2 pads uniformly. However, on SoCs that support per-pad termination, each pad has its own hs_term_range_adj field: pad 0 in FUSE_SKU_CALIB_0[10:7], and pads 1-3 in FUSE_USB_CALIB_EXT_0 at bit offsets [8:5], [12:9], and [16:13] respectively.
Fix the calibration by reading per-pad values from the appropriate fuse registers. For SoCs that do not support per-pad termination, replicate pad 0's value to all pads to maintain existing behavior.
Add a has_per_pad_term flag to the SoC data to indicate whether per-pad termination values are available in FUSE_USB_CALIB_EXT_0.
--- drivers/phy/tegra/xusb-tegra186.c | 32 ++++++++++++++++++++++++------- drivers/phy/tegra/xusb.h | 1 + 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/phy/tegra/xusb-tegra186.c +25 -7
@@ -20,8 +20,8 @@/* FUSE USB_CALIB registers */ #define HS_CURR_LEVEL_PADX_SHIFT (x) ((x) ? (11 + (x - 1) * 6) : 0)#define HS_CURR_LEVEL_PAD_MASK 0x3f -#define HS_TERM_RANGE_ADJ_SHIFT 7 -#define HS_TERM_RANGE_ADJ_MASK 0xf +#define HS_TERM_RANGE_ADJ_PADX_SHIFT (x) ((x) ? (5 + (x - 1) * 4) : 7) +#define HS_TERM_RANGE_ADJ_PAD_MASK 0xf#define HS_SQUELCH_SHIFT 29#define HS_SQUELCH_MASK 0x7
@@ -238,7 +238,7 @@struct tegra_xusb_fuse_calibration {u32 *hs_curr_level;u32 hs_squelch; -u32 hs_term_range_adj; +u32 *hs_term_range_adj;u32 rpd_ctrl; };
@@ -868,7 +868,7 @@ static int tegra186_utmi_phy_power_on(struct phy *phy) value =padctl_readl (padctl,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index)); value &= ~TERM_RANGE_ADJ (~0 ); - value |=TERM_RANGE_ADJ (priv->calib.hs_term_range_adj); + value |=TERM_RANGE_ADJ (priv->calib.hs_term_range_adj[index]); value &= ~RPD_CTRL (~0 ); value |=RPD_CTRL (priv->calib.rpd_ctrl);padctl_writel (padctl, value,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index));
@@ -1403,17 +1403,23 @@ static const char * const tegra186_usb3_functions[] = {static int tegra186_xusb_read_fuse_calibration (struct tegra186_xusb_padctl *padctl) { +const struct tegra_xusb_padctl_soc *soc = padctl->base.soc;struct device *dev = padctl->base.dev;unsigned int i, count;u32 value, *level; +u32 *hs_term_range_adj;int err; - count = padctl->base.soc->ports.usb2.count; + count = soc->ports.usb2.count; level =devm_kcalloc (dev, count,sizeof (u32),GFP_KERNEL );if (!level)return -ENOMEM ; + hs_term_range_adj =devm_kcalloc (dev, count,sizeof (u32),GFP_KERNEL ); +if (!hs_term_range_adj) +return -ENOMEM ; + err =tegra_fuse_readl (TEGRA_FUSE_SKU_CALIB_0 , &value);if (err) return dev_err_probe(dev, err,
@@ -1429,8 +1435,8 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) padctl->calib.hs_squelch = (value >>HS_SQUELCH_SHIFT ) &HS_SQUELCH_MASK ; - padctl->calib.hs_term_range_adj = (value >>HS_TERM_RANGE_ADJ_SHIFT ) & -HS_TERM_RANGE_ADJ_MASK ; + hs_term_range_adj[0 ] = (value >>HS_TERM_RANGE_ADJ_PADX_SHIFT (0 )) & +HS_TERM_RANGE_ADJ_PAD_MASK ; err =tegra_fuse_readl (TEGRA_FUSE_USB_CALIB_EXT_0 , &value);if (err) {
@@ -1442,6 +1448,17 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) padctl->calib.rpd_ctrl = (value >>RPD_CTRL_SHIFT ) &RPD_CTRL_MASK ; +for (i =1 ; i < count; i++) { +if (soc->has_per_pad_term) + hs_term_range_adj[i] = + (value >>HS_TERM_RANGE_ADJ_PADX_SHIFT (i)) & +HS_TERM_RANGE_ADJ_PAD_MASK ; +else + hs_term_range_adj[i] = hs_term_range_adj[0 ]; + } + + padctl->calib.hs_term_range_adj = hs_term_range_adj; +return 0 ; }
@@ -1645,6 +1662,7 @@ const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc = { .supply_names = tegra194_xusb_padctl_supply_names, .num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names), .supports_gen2 = true, + .has_per_pad_term = true, };EXPORT_SYMBOL_GPL (tegra194_xusb_padctl_soc);#endif
drivers/phy/tegra/xusb.h +1 -0
@@ -433,6 +433,7 @@ struct tegra_xusb_padctl_soc {unsigned int num_supplies;bool supports_gen2;bool need_fake_usb3_port; +bool has_per_pad_term; };struct tegra_xusb_padctl {
Signature · 1 line
2.53.0