Skip to contentSkip to conversation

MSM8998 Multimedia Clock Controller

PATCH Superseded Jeffrey Hugo 3 participants 20 messages Jan 30, 2019 – Feb 6, 2019

Subsystems (5)

v1 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

cover MSM8998 Multimedia Clock Controller

The multimedia clock controller (mmcc) is the main clock controller for the multimedia subsystem and is required to enable things like display and camera.

The mmcc consumes a few external clocks inorder to configure the root clock generators that it controls. We can use DT to grab XO (from rpmcc) and gpll0 (from gcc), but we'll have to rely on the global namespace to consume the plls from elsewhere in the mmss.

Jeffrey Hugo (4):
clk: qcom: smd: Add XO clock for MSM8998
dt-bindings: clock: Add support for the MSM8998 mmcc
clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver
arm64: dts: qcom: msm8998: Add mmcc node

 .../devicetree/bindings/clock/qcom,mmcc.txt        |    7 +
 arch/arm64/boot/dts/qcom/msm8998.dtsi              |   15 +
 drivers/clk/qcom/Kconfig                           |    9 +
 drivers/clk/qcom/Makefile                          |    1 +
 drivers/clk/qcom/clk-smd-rpm.c                     |    4 +
 drivers/clk/qcom/mmcc-msm8998.c                    | 2937 ++++++++++++++++++++
 include/dt-bindings/clock/qcom,mmcc-msm8998.h      |  210 ++
 7 files changed, 3183 insertions(+)
 create mode 100644 drivers/clk/qcom/mmcc-msm8998.c
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-msm8998.h
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

PATCH 1/4 clk: qcom: smd: Add XO clock for MSM8998

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)
---
 drivers/clk/qcom/clk-smd-rpm.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/clk/qcom/clk-smd-rpm.c +4 -0
index 22dd42a..5b1d718 100644
@@ -656,6 +656,8 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm)
 };
 
 /* msm8998 */
+DEFINE_CLK_SMD_RPM_BRANCH(msm8998, xo_clk_src, xo_a_clk_src,
+			  QCOM_SMD_RPM_MISC_CLK, 0, 19200000);
 DEFINE_CLK_SMD_RPM(msm8998, snoc_clk, snoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 1);
 DEFINE_CLK_SMD_RPM(msm8998, cnoc_clk, cnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 2);
 DEFINE_CLK_SMD_RPM(msm8998, ce1_clk, ce1_a_clk, QCOM_SMD_RPM_CE_CLK, 0);
@@ -678,6 +680,8 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm)
 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8998, rf_clk3, rf_clk3_a, 6);
 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8998, rf_clk3_pin, rf_clk3_a_pin, 6);
 static struct clk_smd_rpm *msm8998_clks[] = {
+	[RPM_SMD_XO_CLK_SRC] = &msm8998_xo_clk_src,
+	[RPM_SMD_XO_A_CLK_SRC] = &msm8998_xo_a_clk_src,
 	[RPM_SMD_SNOC_CLK] = &msm8998_snoc_clk,
 	[RPM_SMD_SNOC_A_CLK] = &msm8998_snoc_a_clk,
 	[RPM_SMD_CNOC_CLK] = &msm8998_cnoc_clk,
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#2 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

So are you sure this is OK to do?

#3 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

Quoted 15 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

Quoted 3 lines

So are you sure this is OK to do?

So, I've got pretty much everything as modules, and I haven't seen any issues. However let me take a look at the commit you point out and see.

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#4 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

Quoting Jeffrey Hugo (2019-02-05 14:15:16)

Quoted 16 lines · Stephen Boyd
Quoted 15 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

Quoted 7 lines
Quoted 3 lines

So are you sure this is OK to do?

So, I've got pretty much everything as modules, and I haven't seen any issues. However let me take a look at the commit you point out and see.

Is the name of the clk "xo_clk_src"? That isn't the name that we were expecting the XO clk from RPM to be called. You might have to look back at the history of the rpm clk driver on the list and see when Georgi dropped the XO clk from it and if there was anything wrong with that. I can't recall if this was discussed on the list or if he just told me in some hallway conversation at Connect.

#5 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

Quoted 25 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-02-05 14:15:16)

Quoted 16 lines · Stephen Boyd
Quoted 15 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

Quoted 7 lines
Quoted 3 lines

So are you sure this is OK to do?

So, I've got pretty much everything as modules, and I haven't seen any issues. However let me take a look at the commit you point out and see.

Quoted 7 lines

Is the name of the clk "xo_clk_src"? That isn't the name that we were expecting the XO clk from RPM to be called. You might have to look back at the history of the rpm clk driver on the list and see when Georgi dropped the XO clk from it and if there was anything wrong with that. I can't recall if this was discussed on the list or if he just told me in some hallway conversation at Connect.

Will do. Thanks for pointing out the history.

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#6 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

In reply to Stephen Boyd

Hi Jeffrey,

Quoted 25 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-02-05 14:15:16)

Quoted 16 lines · Stephen Boyd
Quoted 15 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

Quoted 7 lines
Quoted 3 lines

So are you sure this is OK to do?

So, I've got pretty much everything as modules, and I haven't seen any issues. However let me take a look at the commit you point out and see.

Quoted 6 lines

Is the name of the clk "xo_clk_src"? That isn't the name that we were expecting the XO clk from RPM to be called. You might have to look back at the history of the rpm clk driver on the list and see when Georgi dropped the XO clk from it and if there was anything wrong with that. I can't recall if this was discussed on the list or if he just told me in some hallway conversation at Connect.

The problem back then was the following: The RPM clock driver has various dependencies on other drivers (hwspinlock, smem, smd, rpmsg etc) and may probe defer multiple times during boot. Meanwhile the GCC clocks are registered as orphans, as their parent clock (RPM XO) is not there yet. And when some driver calls clk_get_rate() on an orphan clock, a bogus rate is returned. The consequence of this was that the serial console was broken, because of the baud rate being calculated based on this bogus clock rate.

Thanks,
Georgi

#7 lore raw

Re: [PATCH v1 1/4] clk: qcom: smd: Add XO clock for MSM8998

Quoted 35 lines · Georgi Djakov

Hi Jeffrey,

Quoted 25 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-02-05 14:15:16)

Quoted 16 lines · Stephen Boyd
Quoted 15 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:44)

Quoted 5 lines

The XO clock generally feeds into other clock controllers as the parent for a lot of clock generators.

Fixes 6131dc81211c (clk: qcom: smd: Add support for MSM8998 rpm clocks)

We've historically left out the XO clk because it causes problems where the XO vote goes away during late init because nobody references it from the rest of the clk tree and also because RPM defers probe of the system and then the console blows up when it gets a clk that can't change rate. See commit 54823af9cd52 ("clk: qcom: Always add factor clock for xo clocks") for some more info on why we removed all the workarounds and stuff around here too.

Quoted 7 lines
Quoted 3 lines

So are you sure this is OK to do?

So, I've got pretty much everything as modules, and I haven't seen any issues. However let me take a look at the commit you point out and see.

Quoted 6 lines

Is the name of the clk "xo_clk_src"? That isn't the name that we were expecting the XO clk from RPM to be called. You might have to look back at the history of the rpm clk driver on the list and see when Georgi dropped the XO clk from it and if there was anything wrong with that. I can't recall if this was discussed on the list or if he just told me in some hallway conversation at Connect.

Quoted 8 lines

The problem back then was the following: The RPM clock driver has various dependencies on other drivers (hwspinlock, smem, smd, rpmsg etc) and may probe defer multiple times during boot. Meanwhile the GCC clocks are registered as orphans, as their parent clock (RPM XO) is not there yet. And when some driver calls clk_get_rate() on an orphan clock, a bogus rate is returned. The consequence of this was that the serial console was broken, because of the baud rate being calculated based on this bogus clock rate.

Ok. As far as I am aware, that issue still basically exists but I don't seem to be hitting it. I suspect timing. However, it seems like the key point is that GCC is initing, doesn't have its dependencies in place, but is allowing client activity anyways. It seems like either 1) GCC should detect XO isn't present (yet), and probe defer or 2) clocks are somehow not usable if the parent hasn't appeared yet (maybe such parents are marked as critical somehow?)

Stephen, what are your thoughts?

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#8 lore raw

PATCH 2/4 dt-bindings: clock: Add support for the MSM8998 mmcc

In reply to Jeffrey Hugo

Document the multimedia clock controller found on MSM8998

---
 Documentation/devicetree/bindings/clock/qcom,mmcc.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +7 -0
index 8b0f784..ae85bca 100644
@@ -10,11 +10,18 @@ Required properties :
 			"qcom,mmcc-msm8960"
 			"qcom,mmcc-msm8974"
 			"qcom,mmcc-msm8996"
+			"qcom,mmcc-msm8998"
 
 - reg : shall contain base register location and length
 - #clock-cells : shall contain 1
 - #reset-cells : shall contain 1
 
+For MSM8998 only:
+	- clocks: a list of phandles and clock-specifier pairs,
+		  one for each entry in clock-names.
+	- clock-names: "xo" for the xo clock,
+		       "gpll0" for the global pll 0 clock.
+
 Optional properties :
 - #power-domain-cells : shall contain 1
 
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#9 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: Add support for the MSM8998 mmcc

Quoting Jeffrey Hugo (2019-01-30 08:35:59)

Quoted 16 lines

Document the multimedia clock controller found on MSM8998

---
 Documentation/devicetree/bindings/clock/qcom,mmcc.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f784..ae85bca 100644
@@ -10,11 +10,18 @@ Required properties :
                        "qcom,mmcc-msm8960"
                        "qcom,mmcc-msm8974"
                        "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"

Documentation/devicetree/bindings/clock/qcom,mmcc.txt Required properties : · line 23

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +5 -0
 
 - reg : shall contain base register location and length
 - #clock-cells : shall contain 1
 - #reset-cells : shall contain 1
 
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" for the xo clock,
+                      "gpll0" for the global pll 0 clock.

Wouldn't the DSI plls also be listed here? And anything else that is external to this clock controller?

#10 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: Add support for the MSM8998 mmcc

Quoted 22 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-01-30 08:35:59)

Quoted 21 lines

Document the multimedia clock controller found on MSM8998

---
  Documentation/devicetree/bindings/clock/qcom,mmcc.txt | 7 +++++++
  1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f784..ae85bca 100644
@@ -10,11 +10,18 @@ Required properties :
                         "qcom,mmcc-msm8960"
                         "qcom,mmcc-msm8974"
                         "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"
 
  - reg : shall contain base register location and length
  - #clock-cells : shall contain 1
  - #reset-cells : shall contain 1
 
Quoted 9 lines

Documentation/devicetree/bindings/clock/qcom,mmcc.txt Required properties : · line 23

Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +5 -0
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" for the xo clock,
+                      "gpll0" for the global pll 0 clock.

Wouldn't the DSI plls also be listed here? And anything else that is external to this clock controller?

We can't get the DSI plls from DT as far as I am aware (upstream). That is why I mentioned in the cover letter we need to rely on the global namespace.

Also, the DSI plls, etc present a chicken and egg situation, as the plls require mmcc, and mmcc requires the plls. I forsee an unsolvable EPROBE_DEFER issue.

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#11 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: Add support for the MSM8998 mmcc

Quoting Jeffrey Hugo (2019-02-05 14:08:43)

Quoted 33 lines · Stephen Boyd
Quoted 22 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:59)

Quoted 21 lines

Document the multimedia clock controller found on MSM8998

---
  Documentation/devicetree/bindings/clock/qcom,mmcc.txt | 7 +++++++
  1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f784..ae85bca 100644
@@ -10,11 +10,18 @@ Required properties :
                         "qcom,mmcc-msm8960"
                         "qcom,mmcc-msm8974"
                         "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"
 
  - reg : shall contain base register location and length
  - #clock-cells : shall contain 1
  - #reset-cells : shall contain 1
 
Quoted 9 lines

Documentation/devicetree/bindings/clock/qcom,mmcc.txt Required properties : · line 23

Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +5 -0
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" for the xo clock,
+                      "gpll0" for the global pll 0 clock.

Wouldn't the DSI plls also be listed here? And anything else that is external to this clock controller?

Quoted 3 lines

We can't get the DSI plls from DT as far as I am aware (upstream). That is why I mentioned in the cover letter we need to rely on the global namespace.

Why not? Because the DSI PLL isn't a clk provider? Or it doesn't have #clock-cells? Please try to use the DSI PLLs from DT or at least specify them in the binding as optional clocks that may not matter if DSI is not enabled for example.

Quoted 5 lines

Also, the DSI plls, etc present a chicken and egg situation, as the plls require mmcc, and mmcc requires the plls. I forsee an unsolvable EPROBE_DEFER issue.

We've "solved" that problem with orphan clks and the clk parent rewrite series. Maybe you can try it out to help flush out any bugs lurking there.

#12 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: Add support for the MSM8998 mmcc

Quoted 34 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-02-05 14:08:43)

Quoted 33 lines · Stephen Boyd
Quoted 31 lines

Quoting Jeffrey Hugo (2019-01-30 08:35:59)

Quoted 16 lines

Document the multimedia clock controller found on MSM8998

---
   Documentation/devicetree/bindings/clock/qcom,mmcc.txt | 7 +++++++
   1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f784..ae85bca 100644
@@ -10,11 +10,18 @@ Required properties :
                          "qcom,mmcc-msm8960"
                          "qcom,mmcc-msm8974"
                          "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"

Documentation/devicetree/bindings/clock/qcom,mmcc.txt Required properties : · line 23

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +5 -0
 
   - reg : shall contain base register location and length
   - #clock-cells : shall contain 1
   - #reset-cells : shall contain 1
 
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" for the xo clock,
+                      "gpll0" for the global pll 0 clock.

Wouldn't the DSI plls also be listed here? And anything else that is external to this clock controller?

Quoted 8 lines
Quoted 3 lines

We can't get the DSI plls from DT as far as I am aware (upstream). That is why I mentioned in the cover letter we need to rely on the global namespace.

Why not? Because the DSI PLL isn't a clk provider? Or it doesn't have #clock-cells? Please try to use the DSI PLLs from DT or at least specify them in the binding as optional clocks that may not matter if DSI is not enabled for example.

I had thought that there wasn't a DT node that exposed those (I find it very odd how the DSI PLLs get inited), but upon checking again, I see what I have missed. I'll need to incorporate them now.

Quoted 11 lines
Quoted 6 lines

Also, the DSI plls, etc present a chicken and egg situation, as the plls require mmcc, and mmcc requires the plls. I forsee an unsolvable EPROBE_DEFER issue.

We've "solved" that problem with orphan clks and the clk parent rewrite series. Maybe you can try it out to help flush out any bugs lurking there.

Thanks for the reference in your other reply. Will have a look.

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#13 lore raw

PATCH 3/4 clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver

In reply to Jeffrey Hugo

Add a driver for the multimedia clock controller found on MSM8998 based devices. This should allow most multimedia device drivers to probe and control their clocks.

---
 drivers/clk/qcom/Kconfig                      |    9 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/mmcc-msm8998.c               | 2937 +++++++++++++++++++++++++
 include/dt-bindings/clock/qcom,mmcc-msm8998.h |  210 ++
 4 files changed, 3157 insertions(+)
 create mode 100644 drivers/clk/qcom/mmcc-msm8998.c
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-msm8998.h
drivers/clk/qcom/Kconfig +9 -0
index 1c04575c..6c36603 100644
@@ -221,6 +221,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_MMCC_8998
+	tristate "MSM8998 Multimedia Clock Controller"
+	select MSM_GCC_8998
+	select QCOM_GDSC
+	help
+	  Support for the multimedia clock controller on msm8998 devices.
+	  Say Y if you want to support multimedia devices such as display,
+	  graphics, video encode/decode, camera, etc.
+
 config QCS_GCC_404
 	tristate "QCS404 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index ee8d069..d6de24b 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_MSM_GCC_8998) += gcc-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
+obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8998.o
 obj-$(CONFIG_QCOM_A53PLL) += a53-pll.o
 obj-$(CONFIG_QCOM_CLK_APCS_MSM8916) += apcs-msm8916.o
 obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
drivers/clk/qcom/mmcc-msm8998.c new file +2937 -0

2,937 lines not on this page · raw message

include/dt-bindings/clock/qcom,mmcc-msm8998.h new file +210 -0

41 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

Part of the diff is not shown here. View the raw message.

maintainer
#14 lore raw

Re: [PATCH v1 3/4] clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver

Quoting Jeffrey Hugo (2019-01-30 08:36:11)
[..]

Quoted 13 lines
drivers/clk/qcom/mmcc-msm8998.c new file +13 -0
+};
+MODULE_DEVICE_TABLE(of, mmcc_msm8998_match_table);
+
+static int mmcc_msm8998_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       int i, ret;
+       struct regmap *regmap;
+       struct clk *c;
+
+       c = devm_clk_get(dev, "xo");
+       if (!IS_ERR(c))
+               dummy_xo_init.parent_names =

drivers/clk/qcom/mmcc-msm8998.c line 2911

Quoted 10 lines
drivers/clk/qcom/mmcc-msm8998.c new file +10 -0
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);
+
+       c = devm_clk_get(dev, "gpll0");
+       if (!IS_ERR(c))
+               dummy_gpll0_init.parent_names =
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);

Urgh, my parent mapping series can't come be merged fast enough it seems!

drivers/clk/qcom/mmcc-msm8998.c line 2918

Quoted 7 lines
drivers/clk/qcom/mmcc-msm8998.c new file +7 -0
+
+       regmap = qcom_cc_map(pdev, &mmcc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       for (i = 0; i < ARRAY_SIZE(mmcc_msm8998_hws); i++) {
+               ret = devm_clk_hw_register(dev, mmcc_msm8998_hws[i]);

I think we should make this common to the qcom_cc_desc now. Can you throw in an optional list of clk_hw pointers that also get registered as its own patch and update the existing drivers that are all doing this?

Quoted 6 lines
drivers/clk/qcom/mmcc-msm8998.c new file +6 -0
+               if (ret)
+                       return ret;
+       }
+
+       return qcom_cc_really_probe(pdev, &mmcc_msm8998_desc, regmap);
+}
#15 lore raw

Re: [PATCH v1 3/4] clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver

Quoted 20 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-01-30 08:36:11)
[..]

Quoted 18 lines
drivers/clk/qcom/mmcc-msm8998.c new file +18 -0
+};
+MODULE_DEVICE_TABLE(of, mmcc_msm8998_match_table);
+
+static int mmcc_msm8998_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       int i, ret;
+       struct regmap *regmap;
+       struct clk *c;
+
+       c = devm_clk_get(dev, "xo");
+       if (!IS_ERR(c))
+               dummy_xo_init.parent_names =
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);
+
+       c = devm_clk_get(dev, "gpll0");
Quoted 8 lines

drivers/clk/qcom/mmcc-msm8998.c line 2911

Quoted 5 lines
drivers/clk/qcom/mmcc-msm8998.c new file +5 -0
+       if (!IS_ERR(c))
+               dummy_gpll0_init.parent_names =
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);

Urgh, my parent mapping series can't come be merged fast enough it seems!

Sorry, I'm not familiar with the context. Something I should incorporate?

Quoted 12 lines

drivers/clk/qcom/mmcc-msm8998.c line 2918

Quoted 8 lines
drivers/clk/qcom/mmcc-msm8998.c new file +7 -0
+
+       regmap = qcom_cc_map(pdev, &mmcc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       for (i = 0; i < ARRAY_SIZE(mmcc_msm8998_hws); i++) {
+               ret = devm_clk_hw_register(dev, mmcc_msm8998_hws[i]);

I think we should make this common to the qcom_cc_desc now. Can you throw in an optional list of clk_hw pointers that also get registered as its own patch and update the existing drivers that are all doing this?

Yeah, can do.

Quoted 7 lines
Quoted 7 lines
drivers/clk/qcom/mmcc-msm8998.c new file +6 -0
+               if (ret)
+                       return ret;
+       }
+
+       return qcom_cc_really_probe(pdev, &mmcc_msm8998_desc, regmap);
+}
Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#16 lore raw

Re: [PATCH v1 3/4] clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver

Quoting Jeffrey Hugo (2019-02-05 14:12:00)

Quoted 30 lines · Stephen Boyd
Quoted 20 lines

Quoting Jeffrey Hugo (2019-01-30 08:36:11)
[..]

Quoted 18 lines
drivers/clk/qcom/mmcc-msm8998.c new file +18 -0
+};
+MODULE_DEVICE_TABLE(of, mmcc_msm8998_match_table);
+
+static int mmcc_msm8998_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       int i, ret;
+       struct regmap *regmap;
+       struct clk *c;
+
+       c = devm_clk_get(dev, "xo");
+       if (!IS_ERR(c))
+               dummy_xo_init.parent_names =
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);
+
+       c = devm_clk_get(dev, "gpll0");
Quoted 8 lines

drivers/clk/qcom/mmcc-msm8998.c line 2911

Quoted 5 lines
drivers/clk/qcom/mmcc-msm8998.c new file +5 -0
+       if (!IS_ERR(c))
+               dummy_gpll0_init.parent_names =
+                                       (const char *[]){__clk_get_name(c)};
+       else
+               return PTR_ERR(c);

Urgh, my parent mapping series can't come be merged fast enough it seems!

Quoted 2 lines

Sorry, I'm not familiar with the context. Something I should incorporate?

https://lkml.kernel.org/r/[email protected]

#17 lore raw

PATCH 4/4 arm64: dts: qcom: msm8998: Add mmcc node

In reply to Jeffrey Hugo

Add MSM8998 Multimedia Clock Controller DT node.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +15 -0
index 7136ab1..5673a65 100644
@@ -814,6 +814,21 @@
 			status = "disabled";
 		};
 
+		mmcc: clock-controller@c8c0000 {
+			compatible = "qcom,mmcc-msm8998";
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+			reg = <0x0c8c0000 0x40000>;
+
+			clock-names =
+				"xo",
+				"gpll0";
+			clocks =
+				<&rpmcc RPM_SMD_XO_CLK_SRC>,
+				<&gcc GPLL0_OUT_MAIN>;
+		};
+
 		timer@17920000 {
 			#address-cells = <1>;
 			#size-cells = <1>;
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#18 lore raw

Re: [PATCH v1 4/4] arm64: dts: qcom: msm8998: Add mmcc node

Quoting Jeffrey Hugo (2019-01-30 08:36:24)

Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 7136ab1..5673a65 100644
@@ -814,6 +814,21 @@
                        status = "disabled";
                };

arch/arm64/boot/dts/qcom/msm8998.dtsi line 825

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +9 -0
 
+               mmcc: clock-controller@c8c0000 {
+                       compatible = "qcom,mmcc-msm8998";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       #power-domain-cells = <1>;
+                       reg = <0x0c8c0000 0x40000>;
+
+                       clock-names =
+                               "xo",

Weird newline here. Please put "xo" on the same line as clock-names.

arch/arm64/boot/dts/qcom/msm8998.dtsi line 829

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +4 -0
+                               "gpll0";
+                       clocks =
+                               <&rpmcc RPM_SMD_XO_CLK_SRC>,
+                               <&gcc GPLL0_OUT_MAIN>;

Ah ok, so only the multimedia clks get the xo clk from rpm for now?

#19 lore raw

Re: [PATCH v1 4/4] arm64: dts: qcom: msm8998: Add mmcc node

Quoted 21 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-01-30 08:36:24)

Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 7136ab1..5673a65 100644
@@ -814,6 +814,21 @@
                         status = "disabled";
                 };

arch/arm64/boot/dts/qcom/msm8998.dtsi line 825

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +9 -0
 
+               mmcc: clock-controller@c8c0000 {
+                       compatible = "qcom,mmcc-msm8998";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       #power-domain-cells = <1>;
+                       reg = <0x0c8c0000 0x40000>;
+
+                       clock-names =
+                               "xo",

Weird newline here. Please put "xo" on the same line as clock-names.

Quoted 7 lines

arch/arm64/boot/dts/qcom/msm8998.dtsi line 829

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +4 -0
+                               "gpll0";
+                       clocks =
+                               <&rpmcc RPM_SMD_XO_CLK_SRC>,
+                               <&gcc GPLL0_OUT_MAIN>;

Ah ok, so only the multimedia clks get the xo clk from rpm for now?

Yes. With this entire series, its possible to retrofit GCC, but I didn't tackle that since we'd need to consider backwards compatibility. I hope to do this moving forward though.

Signature · 4 lines
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.