WSL2-Linux-Kernel/drivers/clk
Paul Cercueil ecfb9f4047 clk: ingenic: jz4760: Update M/N/OD calculation algorithm
The previous algorithm was pretty broken.

- The inner loop had a '(m > m_max)' condition, and the value of 'm'
  would increase in each iteration;

- Each iteration would actually multiply 'm' by two, so it is not needed
  to re-compute the whole equation at each iteration;

- It would loop until (m & 1) == 0, which means it would loop at most
  once.

- The outer loop would divide the 'n' value by two at the end of each
  iteration. This meant that for a 12 MHz parent clock and a 1.2 GHz
  requested clock, it would first try n=12, then n=6, then n=3, then
  n=1, none of which would work; the only valid value is n=2 in this
  case.

Simplify this algorithm with a single for loop, which decrements 'n'
after each iteration, addressing all of the above problems.

Fixes: bdbfc02937 ("clk: ingenic: Add support for the JZ4760")
Cc: <stable@vger.kernel.org>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221214123704.7305-1-paul@crapouillou.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2023-01-25 16:08:27 -08:00
..
actions
analogbits
at91
axis
axs10x
baikal-t1
bcm
berlin
davinci
hisilicon
imgtec
imx
ingenic clk: ingenic: jz4760: Update M/N/OD calculation algorithm 2023-01-25 16:08:27 -08:00
keystone
loongson1
mediatek
meson
microchip clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings 2023-01-19 11:45:35 +02:00
mmp
mstar
mvebu
mxs
nxp
pistachio
pxa
qcom
ralink
renesas
rockchip
samsung
sifive
socfpga A pile of clk driver updates with a small tracepoint patch to the clk core this 2022-12-13 13:46:07 -08:00
spear
sprd
st
starfive
stm32
sunxi
sunxi-ng
tegra
ti
uniphier
ux500
versatile
visconti
x86
xilinx
zynq
zynqmp
.kunitconfig
Kconfig
Makefile
clk-apple-nco.c
clk-asm9260.c
clk-aspeed.c
clk-aspeed.h
clk-ast2600.c
clk-axi-clkgen.c
clk-axm5516.c
clk-bd718x7.c
clk-bm1880.c
clk-bulk.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c
clk-composite.c
clk-conf.c
clk-cs2000-cp.c
clk-devres.c
clk-divider.c
clk-en7523.c
clk-fixed-factor.c
clk-fixed-mmio.c
clk-fixed-rate.c
clk-fractional-divider.c
clk-fractional-divider.h
clk-fsl-flexspi.c
clk-fsl-sai.c
clk-gate.c
clk-gate_test.c
clk-gemini.c
clk-gpio.c
clk-hi655x.c
clk-highbank.c
clk-hsdk-pll.c
clk-k210.c
clk-lan966x.c
clk-lmk04832.c
clk-lochnagar.c
clk-max9485.c
clk-max77686.c
clk-milbeaut.c
clk-moxart.c
clk-multiplier.c
clk-mux.c
clk-nomadik.c
clk-npcm7xx.c
clk-nspire.c
clk-oxnas.c
clk-palmas.c
clk-plldig.c
clk-pwm.c
clk-qoriq.c
clk-renesas-pcie.c
clk-rk808.c
clk-s2mps11.c
clk-scmi.c
clk-scpi.c
clk-si514.c
clk-si544.c
clk-si570.c
clk-si5341.c
clk-si5351.c
clk-si5351.h
clk-sparx5.c
clk-stm32f4.c
clk-stm32h7.c
clk-stm32mp1.c
clk-tps68470.c
clk-twl6040.c
clk-versaclock5.c
clk-versaclock7.c
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c
clk.h
clk_test.c
clkdev.c