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

clk: tegra: Ensure that PLLU configuration is applied properly

The PLLU (USB) consists of the PLL configuration itself and configuration
of the PLLU outputs. The PLLU programming is inconsistent on T30 vs T114,
where T114 immediately bails out if PLLU is enabled and T30 re-enables
a potentially already enabled PLL (left after bootloader) and then fully
reprograms it, which could be unsafe to do. The correct way should be to
skip enabling of the PLL if it's already enabled and then apply
configuration to the outputs. This patch doesn't fix any known problems,
it's a minor improvement.

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Dmitry Osipenko and committed by
Thierry Reding
a7196048 c592c8a2

+4 -5
+4 -5
drivers/clk/tegra/clk-pll.c
··· 1131 1131 if (pll->lock) 1132 1132 spin_lock_irqsave(pll->lock, flags); 1133 1133 1134 - _clk_pll_enable(hw); 1134 + if (!clk_pll_is_enabled(hw)) 1135 + _clk_pll_enable(hw); 1135 1136 1136 1137 ret = clk_pll_wait_for_lock(pll); 1137 1138 if (ret < 0) ··· 1749 1748 return -EINVAL; 1750 1749 } 1751 1750 1752 - if (clk_pll_is_enabled(hw)) 1753 - return 0; 1754 - 1755 1751 input_rate = clk_hw_get_rate(__clk_get_hw(osc)); 1756 1752 1757 1753 if (pll->lock) 1758 1754 spin_lock_irqsave(pll->lock, flags); 1759 1755 1760 - _clk_pll_enable(hw); 1756 + if (!clk_pll_is_enabled(hw)) 1757 + _clk_pll_enable(hw); 1761 1758 1762 1759 ret = clk_pll_wait_for_lock(pll); 1763 1760 if (ret < 0)