Skip to content

Commit 8d2a353

Browse files
changhuangliangvinodkoul
authored andcommitted
phy: starfive: Correct the dphy configure process
We actually want to calculate the alignment values first, then use the alignment value to look up the data from reg_configs[]. Fixes: d3ab795 ("phy: starfive: Add mipi dphy tx support") Reviewed-by: Shengyang Chen <[email protected]> Signed-off-by: Changhuang Liang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 04490b6 commit 8d2a353

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/phy/starfive/phy-jh7110-dphy-tx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,14 @@ static int stf_dphy_configure(struct phy *phy, union phy_configure_opts *opts)
235235
const struct stf_dphy_config *p = reg_configs;
236236
unsigned long alignment = STF_DPHY_BITRATE_ALIGN;
237237
u32 bitrate = opts->mipi_dphy.hs_clk_rate;
238-
u32 i = stf_dphy_get_config_index(bitrate);
239238
u32 tmp;
239+
u32 i;
240240

241241
if (bitrate % alignment)
242242
bitrate += alignment - (bitrate % alignment);
243243

244+
i = stf_dphy_get_config_index(bitrate);
245+
244246
tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100));
245247
tmp &= ~STF_DPHY_REFCLK_IN_SEL;
246248
tmp |= FIELD_PREP(STF_DPHY_REFCLK_IN_SEL, STF_DPHY_REFCLK_12M);

0 commit comments

Comments
 (0)