[PATCH RFC 0/3] clk: thead: add support for T-HEAD TH1520 AP clock controller
From: Drew Fustini
Date: Wed Jan 10 2024 - 11:36:11 EST
This series adds support for the AP sub system clock controller in the
T-HEAD TH1520. This include CPU, DPU, GMAC and TEE PLLs.
Yangtao Li originally submitted this series back in May [1]. Jisheng
made additional improvements and then passed on the work in progress to
me. The driver code is cleaner than the version in the T-Head SDK [2].
I fixed checkpatch and dt_binding_check warnings along with:
- deduplicated CLK_NPU and CLK_NPU_AXI number in header
- corrected the npu_clk enable bit
- fixed c910_i0_clk reg typo
I am marking this as an RFC because I have not been able to get the eMMC
controller to work with the clock driver yet. The T-Head SDK does have
full clock driver support but it still uses a fixed clock for the mmc
controller. I've not yet determined why that is.
According to the documentation [4], the "emmc sdio ref clk" is listed as
792 MHz in table "4.3.4 Clock Frequency of Key Module". PERI_CLK_CFG
contains the clock gate. 792 MHz divided by 4 is 198 MHz which is the
fixed clock frequency used for the mmc controller. However, I can't seem
to figured how the divider is controlled for the "emmc sdio ref clk".
Anyways, Emil is working on the pinctrl driver and Conor asked about the
state of the clock driver [5]. I thought it best to send this RFC now so
that discussion can take place on the list.
Thank you,
Drew
[1] https://lore.kernel.org/linux-riscv/20230515054402.27633-1-frank.li@xxxxxxxx/
[2] https://openbeagle.org/beaglev-ahead/beaglev-ahead-linux/-/blob/beaglev-v5.10.113-1.1.2/drivers/clk/thead/clk-light-fm.c
[3] https://openbeagle.org/beaglev-ahead/beaglev-ahead-linux/-/blob/beaglev-v5.10.113-1.1.2/arch/riscv/boot/dts/thead/light.dtsi
[4] https://openbeagle.org/beaglev-ahead/beaglev-ahead/-/blob/main/docs/TH1520%20System%20User%20Manual.pdf
[5] https://lore.kernel.org/linux-riscv/20240109-boggle-frugality-03a77cab8308@spud/
Signed-off-by: Drew Fustini <dfustini@xxxxxxxxxxxxxxx>
---
Jisheng Zhang (1):
clk: thead: add support for T-HEAD TH1520 AP clocks
Yangtao Li (2):
dt-bindings: clock: Add T-Head TH1520 AP clock definitions
dt-bindings: clock: Document T-Head TH1520 AP clock controller
.../bindings/clock/thead,th1520-clk-ap.yaml | 65 ++
MAINTAINERS | 3 +
drivers/clk/Kconfig | 1 +
drivers/clk/Makefile | 1 +
drivers/clk/thead/Kconfig | 12 +
drivers/clk/thead/Makefile | 2 +
drivers/clk/thead/clk-th1520-ap.c | 1018 ++++++++++++++++++++
include/dt-bindings/clock/thead,th1520-clk.h | 96 ++
8 files changed, 1198 insertions(+)
---
base-commit: 8cb47d7cd090a690c1785385b2f3d407d4a53ad0
change-id: 20240109-clk-th1520-399429299d51
Best regards,
--
Drew Fustini <dfustini@xxxxxxxxxxxxxxx>