clk: ti: add am33xx/am43xx spread spectrum clock support
authorDario Binacchi <dariobin@libero.it>
Sun, 6 Jun 2021 20:22:53 +0000 (22:22 +0200)
committerStephen Boyd <sboyd@kernel.org>
Wed, 9 Jun 2021 00:49:16 +0000 (17:49 -0700)
commit0899431f95a7a695f342527548b24ffd902c68ab
treec84b9c94109024dad91a6091da7489e7f3fc4b81
parent2fdf0b888eba99c244b5ddde69243088951f1976
clk: ti: add am33xx/am43xx spread spectrum clock support

The patch enables spread spectrum clocking (SSC) for MPU and LCD PLLs.
As reported by the TI spruh73x/spruhl7x RM, SSC is only supported for
the DISP/LCD and MPU PLLs on am33xx/am43xx. SSC is not supported for
DDR, PER, and CORE PLLs.

Calculating the required values and setting the registers accordingly
was taken from the set_mpu_spreadspectrum routine contained in the
arch/arm/mach-omap2/am33xx/clock_am33xx.c file of the u-boot project.

In locked condition, DPLL output clock = CLKINP *[M/N]. In case of
SSC enabled, the reference manual explains that there is a restriction
of range of M values. Since the omap2_dpll_round_rate routine attempts
to select the minimum possible N, the value of M obtained is not
guaranteed to be within the range required. With the new "ti,min-div"
parameter it is possible to increase N and consequently M to satisfy the
constraint imposed by SSC.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Tero Kristo <kristo@kernel.org>
Link: https://lore.kernel.org/r/20210606202253.31649-6-dariobin@libero.it
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/ti/dpll.c
drivers/clk/ti/dpll3xxx.c
include/linux/clk/ti.h