linux/drivers/clk/meson
Martin Blumenstingl 88e4ac68ea clk: meson: mpll: fix division by zero in rate_from_params
According to the public datasheet all register bits in HHI_MPLL_CNTL7,
HHI_MPLL_CNTL8 and HHI_MPLL_CNTL9 default to zero. On all GX SoCs these
seem to be initialized by the bootloader to some default value.
However, on my Meson8 board they are not initialized, leading to a
division by zero in rate_from_params as the math is:
(parent_rate * SDM_DEN) / ((SDM_DEN * 0) + 0)

According to the datasheet, the minimum n2 value is 4. The rate provided
by the clock when n2 is less than this minimum is unpredictable. In such
case, we report an error.

Although the rate_from_params function was only introduced recently the
original bug has been there for much longer. It was only exposed
recently when the MPLL clocks were added to the Meson8b clock driver.

Fixes: 1c50da4f27 ("clk: meson: add mpll support")
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
2017-04-07 17:45:21 +02:00
..
clk-audio-divider.c clk: meson: add audio clock divider support 2017-04-07 16:50:44 +02:00
clk-cpu.c clk: meson8b: clean up cpu clocks 2016-06-22 18:02:35 -07:00
clk-mpll.c clk: meson: mpll: fix division by zero in rate_from_params 2017-04-07 17:45:21 +02:00
clk-pll.c clk: meson: Add support for parameters for specific PLLs 2017-04-04 12:05:12 -07:00
clkc.h clk: meson: add audio clock divider support 2017-04-07 16:50:44 +02:00
gxbb-aoclk.c clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe() 2016-08-24 00:55:13 -07:00
gxbb.c clk: meson: gxbb: add cts_i958 clock 2017-04-07 16:50:46 +02:00
gxbb.h clk: meson: gxbb: add cts_i958 clock 2017-04-07 16:50:46 +02:00
Kconfig clk: gxbb: add AmLogic GXBB clk controller driver 2016-06-22 18:07:31 -07:00
Makefile clk: meson: add audio clock divider support 2017-04-07 16:50:44 +02:00
meson8b.c clk: meson8b: add the mplls clocks 0, 1 and 2 2017-03-27 12:30:27 -07:00
meson8b.h clk: meson8b: add the mplls clocks 0, 1 and 2 2017-03-27 12:30:27 -07:00