Skip to content

Commit 55491a5

Browse files
srevinodkoul
authored andcommitted
phy: rockchip-snps-pcie3: fix clearing PHP_GRF_PCIESEL_CON bits
Currently the PCIe v3 PHY driver only sets the pcie1ln_sel bits, but does not clear them because of an incorrect write mask. This fixes up the issue by using a newly introduced constant for the write mask. While at it also introduces a proper GENMASK based constant for the PCIE30_PHY_MODE. Fixes: 2e9bffc ("phy: rockchip: Support PCIe v3") Signed-off-by: Sebastian Reichel <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/20240404-rk3588-pcie-bifurcation-fixes-v1-2-9907136eeafd@kernel.org Signed-off-by: Vinod Koul <[email protected]>
1 parent f8020df commit 55491a5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/phy/rockchip/phy-rockchip-snps-pcie3.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define RK3588_BIFURCATION_LANE_0_1 BIT(0)
4141
#define RK3588_BIFURCATION_LANE_2_3 BIT(1)
4242
#define RK3588_LANE_AGGREGATION BIT(2)
43+
#define RK3588_PCIE1LN_SEL_EN (GENMASK(1, 0) << 16)
44+
#define RK3588_PCIE30_PHY_MODE_EN (GENMASK(2, 0) << 16)
4345

4446
struct rockchip_p3phy_ops;
4547

@@ -149,14 +151,15 @@ static int rockchip_p3phy_rk3588_init(struct rockchip_p3phy_priv *priv)
149151
}
150152

151153
reg = mode;
152-
regmap_write(priv->phy_grf, RK3588_PCIE3PHY_GRF_CMN_CON0, (0x7<<16) | reg);
154+
regmap_write(priv->phy_grf, RK3588_PCIE3PHY_GRF_CMN_CON0,
155+
RK3588_PCIE30_PHY_MODE_EN | reg);
153156

154157
/* Set pcie1ln_sel in PHP_GRF_PCIESEL_CON */
155158
if (!IS_ERR(priv->pipe_grf)) {
156-
reg = mode & 3;
159+
reg = mode & (RK3588_BIFURCATION_LANE_0_1 | RK3588_BIFURCATION_LANE_2_3);
157160
if (reg)
158161
regmap_write(priv->pipe_grf, PHP_GRF_PCIESEL_CON,
159-
(reg << 16) | reg);
162+
RK3588_PCIE1LN_SEL_EN | reg);
160163
}
161164

162165
reset_control_deassert(priv->p30phy);

0 commit comments

Comments
 (0)