Skip to content

Commit 03e342d

Browse files
Loic Poulainbebarino
authored andcommitted
clk: qcom: Add CPU clock driver for msm8996
Each of the CPU clusters (Power and Perf) on msm8996 are clocked via 2 PLLs, a primary and alternate. There are also 2 Mux'es, a primary and secondary all connected together as shown below +-------+ XO | | +------------------>0 | | | PLL/2 | SMUX +----+ +------->1 | | | | | | | +-------+ | +-------+ | +---->0 | | | | +---------------+ | +----------->1 | CPU clk |Primary PLL +----+ PLL_EARLY | | +------> | +------+-----------+ +------>2 PMUX | +---------------+ | | | | | +------+ | +-->3 | +--^+ ACD +-----+ | +-------+ +---------------+ +------+ | |Alt PLL | | | +---------------------------+ +---------------+ PLL_EARLY The primary PLL is what drives the CPU clk, except for times when we are reprogramming the PLL itself (for rate changes) when we temporarily switch to an alternate PLL. A subsequent patch adds support to switch between primary and alternate PLL during rate changes. The primary PLL operates on a single VCO range, between 600MHz and 3GHz. However the CPUs do support OPPs with frequencies between 300MHz and 600MHz. In order to support running the CPUs at those frequencies we end up having to lock the PLL at twice the rate and drive the CPU clk via the PLL/2 output and SMUX. So for frequencies above 600MHz we follow the following path Primary PLL --> PLL_EARLY --> PMUX(1) --> CPU clk and for frequencies between 300MHz and 600MHz we follow Primary PLL --> PLL/2 --> SMUX(1) --> PMUX(0) --> CPU clk ACD stands for Adaptive Clock Distribution and is used to detect voltage droops. Signed-off-by: Rajendra Nayak <[email protected]> Rajendra Nayak: Initial RFC - https://lkml.org/lkml/2016/9/29/84 Signed-off-by: Ilia Lin <[email protected]> Ilia Lin: - reworked clock registering - Added clock-tree diagram - non-builtin support - clock notifier on rate change - https://lkml.org/lkml/2018/5/24/123 Signed-off-by: Loic Poulain <[email protected]> Loic Poulain: - fixed driver remove / clk deregistering - Removed useless memory barriers - devm usage when possible - Fixed Kconfig depends Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 2283f9e commit 03e342d

File tree

4 files changed

+554
-0
lines changed

4 files changed

+554
-0
lines changed

drivers/clk/qcom/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ config QCOM_CLK_APCS_MSM8916
3737
Say Y if you want to support CPU frequency scaling on devices
3838
such as msm8916.
3939

40+
config QCOM_CLK_APCC_MSM8996
41+
tristate "MSM8996 CPU Clock Controller"
42+
select QCOM_KRYO_L2_ACCESSORS
43+
depends on ARM64
44+
help
45+
Support for the CPU clock controller on msm8996 devices.
46+
Say Y if you want to support CPU clock scaling using CPUfreq
47+
drivers for dyanmic power management.
48+
4049
config QCOM_CLK_RPM
4150
tristate "RPM based Clock Controller"
4251
depends on MFD_QCOM_RPM

drivers/clk/qcom/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
4444
obj-$(CONFIG_MSM_MMCC_8998) += mmcc-msm8998.o
4545
obj-$(CONFIG_QCOM_A53PLL) += a53-pll.o
4646
obj-$(CONFIG_QCOM_CLK_APCS_MSM8916) += apcs-msm8916.o
47+
obj-$(CONFIG_QCOM_CLK_APCC_MSM8996) += clk-cpu-8996.o
4748
obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
4849
obj-$(CONFIG_QCOM_CLK_RPMH) += clk-rpmh.o
4950
obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o

drivers/clk/qcom/clk-alpha-pll.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ struct pll_vco {
4747
u32 val;
4848
};
4949

50+
#define VCO(a, b, c) { \
51+
.val = a,\
52+
.min_freq = b,\
53+
.max_freq = c,\
54+
}
55+
5056
/**
5157
* struct clk_alpha_pll - phase locked loop (PLL)
5258
* @offset: base address of registers

0 commit comments

Comments
 (0)