linux_dsm_epyc7002/drivers/clk/meson
Martin Blumenstingl b8c1ddadc8 clk: meson: meson8b: add support for the NAND clocks
This adds the NAND clocks (from the HHI_NAND_CLK_CNTL register) to the
Meson8b clock driver. There are three NAND clocks: a gate which enables
or disables the NAND clock, a mux and a divider (which divides the mux
output).
Unfortunately the public S805 datasheet does not document the mux
parents. However, the vendor kernel has a few hints for us which allows
us to make an educated guess about the clock parents. To do this we need
to have a look at set_nand_core_clk() from the vendor's NAND driver (see
[0]):
- XTAL = (4<<9) | (1<<8) | 0
- 160MHz = (0<<9) | (1<<8) | 3)
- 182MHz = (3<<9) | (1<<8) | 1)
- 212MHz = (1<<9) | (1<<8) | 3)
- 255MHz = (2<<9) | (1<<8) | 1)

While there is a comment for the XTAL parent (which indicates that it
should only be used for debugging) we have to do a bit of math for the
other parents: target_freq * divider = rate of parent clock
Bit 8 above is the enable bit, so we can ignore it here. Bits 11:9 are
the mux index and bits 6:0 are the 0-based divider (so we need to add
1). This gives us:
- mux 0 (160MHz * 4) = fclk_div4 (actual rate = 637.5MHz, off by 2.5MHz)
- mux 1 (212MHz * 4) = fclk_div3 (actual rate = 850MHz, off by 2MHz)
- mux 2 (255MHz * 2) = fclk_div5 (matches exactly 510MHz)
- mux 3 (182MHz * 2) = fclk_div7 (actual rate = 346.3MHz, off by 0.3MHz)

[0] https://github.com/khadas/linux/blob/9587681285cb/drivers/amlogic/amlnf/dev/amlnf_ctrl.c#L314

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
2018-05-15 14:18:38 +02:00
..
axg.c clk: meson: Drop unused local variable and add static 2018-03-14 15:36:31 -07:00
axg.h clk: meson: add fdiv clock gates 2018-03-13 10:09:58 +01:00
clk-audio-divider.c clk: meson: migrate the audio divider clock to clk_regmap 2018-03-13 10:04:02 +01:00
clk-mpll.c clk: meson: split divider and gate part of mpll 2018-03-13 10:04:03 +01:00
clk-pll.c clk: meson: add ROUND_CLOSEST to the pll driver 2018-03-13 10:09:49 +01:00
clk-regmap.c clk: meson: add regmap clocks 2018-03-13 10:03:58 +01:00
clk-regmap.h clk: meson: add regmap clocks 2018-03-13 10:03:58 +01:00
clkc.h clk: meson: add ROUND_CLOSEST to the pll driver 2018-03-13 10:09:49 +01:00
gxbb-aoclk-32k.c clk: meson: gxbb-aoclk: Add CEC 32k clock 2017-08-04 18:02:02 +02:00
gxbb-aoclk.c clk: meson: switch gxbb ao_clk to clk_regmap 2018-03-13 10:03:59 +01:00
gxbb-aoclk.h clk: meson: remove superseded aoclk_gate_regmap 2018-03-13 10:03:59 +01:00
gxbb.c clk: meson: Drop unused local variable and add static 2018-03-14 15:36:31 -07:00
gxbb.h clk: meson: add fdiv clock gates 2018-03-13 10:09:58 +01:00
Kconfig clk: meson: use hhi syscon if available 2018-03-13 10:04:04 +01:00
Makefile clk: meson: remove obsolete cpu_clk 2018-03-13 10:04:04 +01:00
meson8b.c clk: meson: meson8b: add support for the NAND clocks 2018-05-15 14:18:38 +02:00
meson8b.h clk: meson: meson8b: add support for the NAND clocks 2018-05-15 14:18:38 +02:00