MSM8998 GPUCC Support
Subsystems (5)
v5 cover MSM8998 GPUCC Support
The Adreno GPU on MSM8998 has its own clock controller, which is a dependency for bringing up the GPU. This series gets the gpucc all in place as another step on the road to getting the GPU enabled.
v5:
-drop clk.h
-add missing clk_set_rate_parent flag on gfx3d
-fix compatible
-allow const ratio freq tables
v4:
-rebase onto mmcc series
-remove clk_get from the clock provider
v3:
-drop accepted DT patch
-correct "avoid" typo
-expand comment on why XO is required
v2:
-drop dead code
Jeffrey Hugo (3):
clk: qcom: Allow constant ratio freq tables for rcg
clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver
arm64: dts: qcom: msm8998: Add gpucc node
arch/arm64/boot/dts/qcom/msm8998.dtsi | 14 ++ drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-rcg2.c | 2 + drivers/clk/qcom/common.c | 3 + drivers/clk/qcom/gpucc-msm8998.c | 338 ++++++++++++++++++++++++++ 6 files changed, 367 insertions(+) create mode 100644 drivers/clk/qcom/gpucc-msm8998.c
Signature · 1 line
2.17.1
PATCH v5 1/3 clk: qcom: Allow constant ratio freq tables for rcg
Some RCGs (the gfx_3d_src_clk in msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie:
{ .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 },
{ }So, lets support that.
We need to fix a corner case in qcom_find_freq() where if the freq table is non-null, but has no frequencies, we end up returning an "entry" before the table array, which is bad. Then, we need ignore the freq from the table, and instead base everything on the requested freq.
--- drivers/clk/qcom/clk-rcg2.c | 2 ++ drivers/clk/qcom/common.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/clk/qcom/clk-rcg2.c +2 -0
@@ -220,6 +220,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,if (clk_flags &CLK_SET_RATE_PARENT ) { rate = f->freq;if (f->pre_div) { +if (!rate) + rate = req->rate; rate /=2 ; rate *= f->pre_div +1 ; }
drivers/clk/qcom/common.c +3 -0
@@ -29,6 +29,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)if (!f)return NULL ; +if (!f->freq) +return f; +for (; f->freq; f++)if (rate <= f->freq)return f;
Signature · 1 line
2.17.1
Re: [PATCH v5 1/3] clk: qcom: Allow constant ratio freq tables for rcg
Quoted 9 lines · Jeffrey Hugo
Some RCGs (the
gfx_3d_src_clkin msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie:{ .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 }, { }So, lets support that.
[]
drivers/clk/qcom/common.c
Quoted 1 line
drivers/clk/qcom/common.c +0
-0
[]
drivers/clk/qcom/common.c struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate) · line 34
Quoted 7 lines
drivers/clk/qcom/common.c +3
-0@@ -29,6 +29,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)if (!f)return NULL ; +if (!f->freq) +return f; +
trivia:
Space after if before open parenthesis please.
Can you please make sure to style check your
code with checkpatch before submission?
Thanks.
Re: [PATCH v5 1/3] clk: qcom: Allow constant ratio freq tables for rcg
In reply to Jeffrey HugoQuoting Jeffrey Hugo (2019-10-31 11:57:15)
Quoted 10 lines
Some RCGs (the
gfx_3d_src_clkin msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie:{ .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 }, { }So, lets support that.
Quoted 8 lines
We need to fix a corner case in
qcom_find_freq()where if the freq table is non-null, but has no frequencies, we end up returning an "entry" before the table array, which is bad. Then, we need ignore the freq from the table, and instead base everything on the requested freq.Suggested-by Stephen Boyd <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>---
Applied to clk-next and fixed the space thing. I guess ceil/floor rounding isn't a problem?
Re: [PATCH v5 1/3] clk: qcom: Allow constant ratio freq tables for rcg
Quoted 17 lines · Stephen Boyd
Quoting Jeffrey Hugo (2019-10-31 11:57:15)
Quoted 15 lines
Some RCGs (the
gfx_3d_src_clkin msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie:{ .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 }, { }So, lets support that.
We need to fix a corner case in
qcom_find_freq()where if the freq table is non-null, but has no frequencies, we end up returning an "entry" before the table array, which is bad. Then, we need ignore the freq from the table, and instead base everything on the requested freq.
Quoted 7 lines
Quoted 3 lines
Suggested-by Stephen Boyd <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>---
Applied to clk-next and fixed the space thing. I guess ceil/floor rounding isn't a problem?
Thanks for fixing the nit.
Hmm. Looking back at it, floor is only used with the rcg_floor_ops. Right now, you can't use a constant ratio table with rcg_floor_ops - looks like you'd probably hit a null pointer dereference. I'm having trouble seeing how the floor operation would work with this constant ratio idea in a way that would be different than the normal rcg_ops. I think I would say that either you have a good reason for using the constant ratio table, in which case you should be using the normal rcg_ops, or you have a good reason for using floor which is then incompatible with a constant ratio table. If you think that the constant ratio table concept should be applied to floor ops, can you please detail what you expect the behavior to be?
Stephen Boyd
maintainerRe: [PATCH v5 1/3] clk: qcom: Allow constant ratio freq tables for rcg
Quoting Jeffrey Hugo (2019-11-07 14:12:09)
Quoted 28 lines · Stephen Boyd
Quoted 17 lines
Quoting Jeffrey Hugo (2019-10-31 11:57:15)
Quoted 15 lines
Some RCGs (the
gfx_3d_src_clkin msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie:{ .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 }, { }So, lets support that.
We need to fix a corner case in
qcom_find_freq()where if the freq table is non-null, but has no frequencies, we end up returning an "entry" before the table array, which is bad. Then, we need ignore the freq from the table, and instead base everything on the requested freq.Quoted 7 lines
Quoted 3 lines
Suggested-by Stephen Boyd <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>---
Applied to clk-next and fixed the space thing. I guess ceil/floor rounding isn't a problem?
Thanks for fixing the nit.
Quoted 11 lines
Hmm. Looking back at it, floor is only used with the
rcg_floor_ops. Right now, you can't use a constant ratio table withrcg_floor_ops- looks like you'd probably hit a null pointer dereference. I'm having trouble seeing how the floor operation would work with this constant ratio idea in a way that would be different than the normalrcg_ops. I think I would say that either you have a good reason for using the constant ratio table, in which case you should be using the normalrcg_ops, or you have a good reason for using floor which is then incompatible with a constant ratio table. If you think that the constant ratio table concept should be applied to floor ops, can you please detail what you expect the behavior to be?
I don't think floor ops make sense. I just wanted to make sure that the floor and ceiling stuff in here isn't going to cause problems. Looking again after reading your response I think we're going to be fine.
PATCH v5 2/3 clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver
In reply to Jeffrey HugoThe GPUCC manages the clocks for the Adreno GPU found on MSM8998.
--- drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/gpucc-msm8998.c | 338 +++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 drivers/clk/qcom/gpucc-msm8998.c
drivers/clk/qcom/Kconfig +9 -0
@@ -220,6 +220,15 @@ config MSM_GCC_8998 Say Y if you want to use peripheral devices such as UART, SPI, i2c, USB, UFS, SD/eMMC, PCIe, etc. +config MSM_GPUCC_8998 + tristate "MSM8998 Graphics Clock Controller" + select MSM_GCC_8998 + select QCOM_GDSC + help + Support for the graphics clock controller on MSM8998 devices. + Say Y if you want to support graphics controller devices and + functionality such as 3D graphics. + config QCS_GCC_404 tristate "QCS404 Global Clock Controller" help
drivers/clk/qcom/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_MSM_GCC_8994) += gcc-msm8994.o obj-$(CONFIG_MSM_GCC_8996) += gcc-msm8996.o obj-$(CONFIG_MSM_LCC_8960) += lcc-msm8960.o obj-$(CONFIG_MSM_GCC_8998) += gcc-msm8998.o +obj-$(CONFIG_MSM_GPUCC_8998) += gpucc-msm8998.o obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
drivers/clk/qcom/gpucc-msm8998.c new file +338 -0
338 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v5 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver
Quoting Jeffrey Hugo (2019-10-31 11:57:33)
Quoted 4 lines
The GPUCC manages the clocks for the Adreno GPU found on MSM8998.
Signed-off-by Jeffrey Hugo <[email protected]>---
Applied to clk-next
PATCH v5 3/3 arm64: dts: qcom: msm8998: Add gpucc node
In reply to Jeffrey HugoAdd MSM8998 GPU Clock Controller DT node.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +14 -0
@@ -3,6 +3,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/clock/qcom,gcc-msm8998.h> +#include <dt-bindings/clock/qcom,gpucc-msm8998.h> #include <dt-bindings/clock/qcom,rpmcc.h> #include <dt-bindings/power/qcom-rpmpd.h> #include <dt-bindings/gpio/gpio.h>
@@ -1000,6 +1001,19 @@ #interrupt-cells = <0x2>; }; + gpucc: clock-controller@5065000 { + compatible = "qcom,msm8998-gpucc"; + #clock-cells = <1>; + #reset-cells = <1>; + #power-domain-cells = <1>; + reg = <0x05065000 0x9000>; + + clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, + <&gcc GPLL0_OUT_MAIN>; + clock-names = "xo", + "gpll0"; + }; + stm@6002000 { compatible = "arm,coresight-stm", "arm,primecell"; reg = <0x06002000 0x1000>,
Signature · 1 line
2.17.1