mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branch 'fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
This commit is contained in:
@@ -221,7 +221,7 @@ disable_repeater:
|
||||
disable_vreg:
|
||||
regulator_bulk_disable(M31_EUSB_NUM_VREGS, phy->vregs);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int m31eusb2_phy_exit(struct phy *uphy)
|
||||
|
||||
@@ -452,9 +452,6 @@ static void rk_combphy_common_cfg_ssc(struct rockchip_combphy_priv *priv, unsign
|
||||
struct device_node *np = priv->dev->of_node;
|
||||
u32 val;
|
||||
|
||||
if (!priv->enable_ssc)
|
||||
return;
|
||||
|
||||
/* Set SSC downward spread spectrum for PCIe and USB3 */
|
||||
if (priv->type == PHY_TYPE_PCIE || priv->type == PHY_TYPE_USB3) {
|
||||
val = FIELD_PREP(RK3568_PHYREG32_SSC_MASK, RK3568_PHYREG32_SSC_DOWNWARD);
|
||||
@@ -471,6 +468,9 @@ static void rk_combphy_common_cfg_ssc(struct rockchip_combphy_priv *priv, unsign
|
||||
RK3568_PHYREG32);
|
||||
}
|
||||
|
||||
if (!priv->enable_ssc)
|
||||
return;
|
||||
|
||||
/* Enable SSC */
|
||||
val = readl(priv->mmio + RK3568_PHYREG8);
|
||||
val |= RK3568_PHYREG8_SSC_EN;
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#define L0_TM_DIG_6 0x106c
|
||||
#define L0_TM_DIS_DESCRAMBLE_DECODER 0x0f
|
||||
#define L0_TX_DIG_61 0x00f4
|
||||
#define L0_TM_DISABLE_SCRAMBLE_ENCODER 0x0f
|
||||
#define L0_TM_DISABLE_SCRAMBLE_ENCODER (BIT(3) | GENMASK(1, 0))
|
||||
|
||||
/* PLL Test Mode register parameters */
|
||||
#define L0_TM_PLL_DIG_37 0x2094
|
||||
@@ -502,11 +502,30 @@ static void xpsgtr_lane_set_protocol(struct xpsgtr_phy *gtr_phy)
|
||||
}
|
||||
}
|
||||
|
||||
/* Bypass (de)scrambler and 8b/10b decoder and encoder. */
|
||||
static void xpsgtr_bypass_scrambler_8b10b(struct xpsgtr_phy *gtr_phy)
|
||||
/**
|
||||
* xpsgtr_bypass_scrambler_8b10b - Configure scrambler/encoder behavior
|
||||
* @gtr_phy: pointer to lane context
|
||||
* @bypass: true to enable scrambler/encoder bypass (SATA/SGMII),
|
||||
* false to disable scrambler/encoder bypass (USB3)
|
||||
*
|
||||
* Uses RMW to preserve reserved and unrelated register fields.
|
||||
*/
|
||||
static void xpsgtr_bypass_scrambler_8b10b(struct xpsgtr_phy *gtr_phy,
|
||||
bool bypass)
|
||||
{
|
||||
xpsgtr_write_phy(gtr_phy, L0_TM_DIG_6, L0_TM_DIS_DESCRAMBLE_DECODER);
|
||||
xpsgtr_write_phy(gtr_phy, L0_TX_DIG_61, L0_TM_DISABLE_SCRAMBLE_ENCODER);
|
||||
if (bypass) {
|
||||
xpsgtr_clr_set_phy(gtr_phy, L0_TM_DIG_6,
|
||||
L0_TM_DIS_DESCRAMBLE_DECODER,
|
||||
L0_TM_DIS_DESCRAMBLE_DECODER);
|
||||
xpsgtr_clr_set_phy(gtr_phy, L0_TX_DIG_61,
|
||||
L0_TM_DISABLE_SCRAMBLE_ENCODER,
|
||||
L0_TM_DISABLE_SCRAMBLE_ENCODER);
|
||||
} else {
|
||||
xpsgtr_clr_set_phy(gtr_phy, L0_TM_DIG_6,
|
||||
L0_TM_DIS_DESCRAMBLE_DECODER, 0);
|
||||
xpsgtr_clr_set_phy(gtr_phy, L0_TX_DIG_61,
|
||||
L0_TM_DISABLE_SCRAMBLE_ENCODER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* DP-specific initialization. */
|
||||
@@ -527,7 +546,7 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy)
|
||||
{
|
||||
struct xpsgtr_dev *gtr_dev = gtr_phy->dev;
|
||||
|
||||
xpsgtr_bypass_scrambler_8b10b(gtr_phy);
|
||||
xpsgtr_bypass_scrambler_8b10b(gtr_phy, true);
|
||||
|
||||
writel(gtr_phy->lane, gtr_dev->siou + SATA_CONTROL_OFFSET);
|
||||
}
|
||||
@@ -543,7 +562,7 @@ static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy)
|
||||
xpsgtr_clr_set(gtr_dev, TX_PROT_BUS_WIDTH, mask, val);
|
||||
xpsgtr_clr_set(gtr_dev, RX_PROT_BUS_WIDTH, mask, val);
|
||||
|
||||
xpsgtr_bypass_scrambler_8b10b(gtr_phy);
|
||||
xpsgtr_bypass_scrambler_8b10b(gtr_phy, true);
|
||||
}
|
||||
|
||||
/* Configure TX de-emphasis and margining for DP. */
|
||||
@@ -658,12 +677,13 @@ static int xpsgtr_phy_init(struct phy *phy)
|
||||
{
|
||||
struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy);
|
||||
struct xpsgtr_dev *gtr_dev = gtr_phy->dev;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
mutex_lock(>r_dev->gtr_mutex);
|
||||
|
||||
/* Configure and enable the clock when peripheral phy_init call */
|
||||
if (clk_prepare_enable(gtr_dev->clk[gtr_phy->refclk]))
|
||||
ret = clk_prepare_enable(gtr_dev->clk[gtr_phy->refclk]);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
/* Skip initialization if not required. */
|
||||
@@ -673,7 +693,7 @@ static int xpsgtr_phy_init(struct phy *phy)
|
||||
if (gtr_dev->tx_term_fix) {
|
||||
ret = xpsgtr_phy_tx_term_fix(gtr_phy);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
goto out_disable_clk;
|
||||
|
||||
gtr_dev->tx_term_fix = false;
|
||||
}
|
||||
@@ -687,7 +707,7 @@ static int xpsgtr_phy_init(struct phy *phy)
|
||||
*/
|
||||
ret = xpsgtr_configure_pll(gtr_phy);
|
||||
if (ret)
|
||||
goto out;
|
||||
goto out_disable_clk;
|
||||
|
||||
xpsgtr_lane_set_protocol(gtr_phy);
|
||||
|
||||
@@ -703,8 +723,16 @@ static int xpsgtr_phy_init(struct phy *phy)
|
||||
case ICM_PROTOCOL_SGMII:
|
||||
xpsgtr_phy_init_sgmii(gtr_phy);
|
||||
break;
|
||||
|
||||
case ICM_PROTOCOL_USB:
|
||||
xpsgtr_bypass_scrambler_8b10b(gtr_phy, false);
|
||||
break;
|
||||
}
|
||||
|
||||
goto out;
|
||||
|
||||
out_disable_clk:
|
||||
clk_disable_unprepare(gtr_dev->clk[gtr_phy->refclk]);
|
||||
out:
|
||||
mutex_unlock(>r_dev->gtr_mutex);
|
||||
return ret;
|
||||
@@ -1039,6 +1067,12 @@ static int xpsgtr_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(provider);
|
||||
}
|
||||
|
||||
gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev,
|
||||
sizeof(save_reg_address),
|
||||
GFP_KERNEL);
|
||||
if (!gtr_dev->saved_regs)
|
||||
return -ENOMEM;
|
||||
|
||||
pm_runtime_set_active(gtr_dev->dev);
|
||||
pm_runtime_enable(gtr_dev->dev);
|
||||
|
||||
@@ -1048,12 +1082,6 @@ static int xpsgtr_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev,
|
||||
sizeof(save_reg_address),
|
||||
GFP_KERNEL);
|
||||
if (!gtr_dev->saved_regs)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user