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

phy: ti-pipe3: Program the DPLL even if it was already locked

If bootloader has set a wrong DPLL then we must trash those values
and re-program it anyways. This fixes USB3 devices not being enumerated
on beagle-x15 if usb was started in u-boot.

We don't re-program SATA DPLL if it is locked as it was causing
SATA failures if device was hotpluged after boot.

Reported-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Roger Quadros and committed by
Kishon Vijay Abraham I
31b2a32f 06061dc6

+11 -4
+11 -4
drivers/phy/phy-ti-pipe3.c
··· 293 293 ret = ti_pipe3_dpll_wait_lock(phy); 294 294 } 295 295 296 - /* Program the DPLL only if not locked */ 296 + /* SATA has issues if re-programmed when locked */ 297 297 val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); 298 - if (!(val & PLL_LOCK)) 299 - if (ti_pipe3_dpll_program(phy)) 300 - return -EINVAL; 298 + if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node, 299 + "ti,phy-pipe3-sata")) 300 + return ret; 301 + 302 + /* Program the DPLL */ 303 + ret = ti_pipe3_dpll_program(phy); 304 + if (ret) { 305 + ti_pipe3_disable_clocks(phy); 306 + return -EINVAL; 307 + } 301 308 302 309 return ret; 303 310 }