Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: d3ab79553308 ("phy: starfive: Add mipi dphy tx support")

Reviewed-by: Shengyang Chen <shengyang.chen@starfivetech.com>
Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Link: https://lore.kernel.org/r/20240627020059.163535-1-changhuang.liang@starfivetech.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Changhuang Liang and committed by
Vinod Koul
8d2a3539 04490b62

+3 -1
+3 -1
drivers/phy/starfive/phy-jh7110-dphy-tx.c
··· 235 235 const struct stf_dphy_config *p = reg_configs; 236 236 unsigned long alignment = STF_DPHY_BITRATE_ALIGN; 237 237 u32 bitrate = opts->mipi_dphy.hs_clk_rate; 238 - u32 i = stf_dphy_get_config_index(bitrate); 239 238 u32 tmp; 239 + u32 i; 240 240 241 241 if (bitrate % alignment) 242 242 bitrate += alignment - (bitrate % alignment); 243 + 244 + i = stf_dphy_get_config_index(bitrate); 243 245 244 246 tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100)); 245 247 tmp &= ~STF_DPHY_REFCLK_IN_SEL;