Skip to contentSkip to conversation

MSM8998 Multimedia Clock Controller

PATCH Superseded Jeffrey Hugo 2 participants 13 messages Oct 1, 2019 – Nov 8, 2019

Subsystems (5)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v6 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.

v6:
-drop clk_get from mmcc clock provider

v5:
-handle the case where gcc uses rpmcc for xo, but the link is not specified in dt -have gcc select rpmcc

v4:
-fix makefile to use correct config item
-pick up tags
-fix ordering of clocks and clock-names in dt
-drop MODULE_ALIAS
-wait for xo in mmcc since that was found to be useful in some debug configs

v3:
-Rebase onto linux-next to get the final version of the clk parent rewrite series
-Moved the bindings header to the bindings patch per Rob
-Made xo manditory for GCC to work around the lack of clk orphan probe defer to avoid the uart console glitch

v2:
-Rebased on the "Rewrite clk parent handling" series and updated to the clk init mechanisms introduced there.
-Marked XO clk as CLK_IGNORE_UNUSED to avoid the concern about the XO going away "incorrectly" during late init
-Corrected the name of the XO clock to "xo"
-Dropped the fake XO clock in GCC to prevent a namespace conflict -Fully enumerated the external clocks (DSI PLLs, etc) in the DT binding -Cleaned up the weird newlines in the added DT node
-Added DT header file to msm8998 DT for future clients

Jeffrey Hugo (6):
dt-bindings: clock: Document external clocks for MSM8998 gcc
arm64: dts: msm8998: Add xo clock to gcc node
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,gcc.txt    |   10 +
 .../devicetree/bindings/clock/qcom,mmcc.txt   |   21 +
 arch/arm64/boot/dts/qcom/msm8998.dtsi         |   16 +
 drivers/clk/qcom/Kconfig                      |   10 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/clk-smd-rpm.c                |   24 +-
 drivers/clk/qcom/gcc-msm8998.c                |   29 +-
 drivers/clk/qcom/mmcc-msm8998.c               | 2914 +++++++++++++++++
 include/dt-bindings/clock/qcom,mmcc-msm8998.h |  210 ++
 9 files changed, 3214 insertions(+), 21 deletions(-)
 create mode 100644 drivers/clk/qcom/mmcc-msm8998.c
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-msm8998.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v6 1/6 dt-bindings: clock: Document external clocks for MSM8998 gcc

The global clock controller on MSM8998 can consume a number of external clocks. Document them.

---
 Documentation/devicetree/bindings/clock/qcom,gcc.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/clock/qcom,gcc.txt +10 -0
index d14362ad4132..32d430718016 100644
@@ -29,6 +29,16 @@ Required properties :
 - #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" (required)
+		       "usb3_pipe" (optional)
+		       "ufs_rx_symbol0" (optional)
+		       "ufs_rx_symbol1" (optional)
+		       "ufs_tx_symbol0" (optional)
+		       "pcie0_pipe" (optional)
+
 Optional properties :
 - #power-domain-cells : shall contain 1
 - Qualcomm TSENS (thermal sensor device) on some devices can
Signature · 1 line
2.17.1
#4 lore raw

PATCH v6 2/6 arm64: dts: msm8998: Add xo clock to gcc node

In reply to Jeffrey Hugo

GCC is a consumer of the xo clock. Add a reference to the clock supplier to the gcc node.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +2 -0
index a0de62f10792..c926122566ae 100644
@@ -743,6 +743,8 @@
 			#reset-cells = <1>;
 			#power-domain-cells = <1>;
 			reg = <0x00100000 0xb0000>;
+			clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>;
+			clock-names = "xo";
 		};
 
 		rpm_msg_ram: memory@778000 {
Signature · 1 line
2.17.1
#5 lore raw

PATCH v6 3/6 clk: qcom: smd: Add XO clock for MSM8998

In reply to Jeffrey Hugo

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

Drop the "fake" XO clock in GCC now that it is redundant can will cause a namespace conflict. Also enumerate the RPMCC dependency of GCC in Kconfig.

---
 drivers/clk/qcom/Kconfig       |  1 +
 drivers/clk/qcom/clk-smd-rpm.c | 24 ++++++++++++++++++++----
 drivers/clk/qcom/gcc-msm8998.c | 29 ++++++++++++-----------------
 3 files changed, 33 insertions(+), 21 deletions(-)
drivers/clk/qcom/Kconfig +1 -0
index 32dbb4f09492..9675cd067cf7 100644
@@ -215,6 +215,7 @@ config MSM_MMCC_8996
 config MSM_GCC_8998
 	tristate "MSM8998 Global Clock Controller"
 	select QCOM_GDSC
+	select QCOM_CLK_SMD_RPM
 	help
 	  Support for the global clock controller on msm8998 devices.
 	  Say Y if you want to use peripheral devices such as UART, SPI,
drivers/clk/qcom/clk-smd-rpm.c +20 -4
index fef5e8157061..919849848056 100644
@@ -60,7 +60,7 @@
 	}
 
 #define __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id,    \
-				    stat_id, r, key)			      \
+				    stat_id, r, key, ignore_unused)			      \
 	static struct clk_smd_rpm _platform##_##_active;		      \
 	static struct clk_smd_rpm _platform##_##_name = {		      \
 		.rpm_res_type = (type),					      \
@@ -75,6 +75,7 @@
 			.name = #_name,					      \
 			.parent_names = (const char *[]){ "xo_board" },	      \
 			.num_parents = 1,				      \
+			.flags = (ignore_unused) ? CLK_IGNORE_UNUSED : 0,     \
 		},							      \
 	};								      \
 	static struct clk_smd_rpm _platform##_##_active = {		      \
@@ -91,6 +92,7 @@
 			.name = #_active,				      \
 			.parent_names = (const char *[]){ "xo_board" },	      \
 			.num_parents = 1,				      \
+			.flags = (ignore_unused) ? CLK_IGNORE_UNUSED : 0,     \
 		},							      \
 	}
 
@@ -100,7 +102,17 @@
 
 #define DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id, r)   \
 		__DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type,  \
-		r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE)
+		r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE, false)
+
+/*
+ * Intended for XO clock where we don't want it turned off during late init
+ * if we don't have a consumer by then, but can turn it off later for deep
+ * sleep
+ */
+#define DEFINE_CLK_SMD_RPM_BRANCH_SKIP_UNUSED(_platform, _name, _active, type,\
+					      r_id, r)			      \
+		__DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type,  \
+		r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE, true)
 
 #define DEFINE_CLK_SMD_RPM_QDSS(_platform, _name, _active, type, r_id)	      \
 		__DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id,   \
@@ -109,12 +121,12 @@
 #define DEFINE_CLK_SMD_RPM_XO_BUFFER(_platform, _name, _active, r_id)	      \
 		__DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active,	      \
 		QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000,			      \
-		QCOM_RPM_KEY_SOFTWARE_ENABLE)
+		QCOM_RPM_KEY_SOFTWARE_ENABLE, false)
 
 #define DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(_platform, _name, _active, r_id) \
 		__DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active,	      \
 		QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000,			      \
-		QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY)
+		QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY, false)
 
 #define to_clk_smd_rpm(_hw) container_of(_hw, struct clk_smd_rpm, hw)
 
@@ -648,6 +660,8 @@ static const struct rpm_smd_clk_desc rpm_clk_qcs404 = {
 };
 
 /* msm8998 */
+DEFINE_CLK_SMD_RPM_BRANCH_SKIP_UNUSED(msm8998, xo, xo_a, 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);
@@ -670,6 +684,8 @@ DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8998, rf_clk2_pin, rf_clk2_a_pin, 5);
 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,
+	[RPM_SMD_XO_A_CLK_SRC] = &msm8998_xo_a,
 	[RPM_SMD_SNOC_CLK] = &msm8998_snoc_clk,
 	[RPM_SMD_SNOC_A_CLK] = &msm8998_snoc_a_clk,
 	[RPM_SMD_CNOC_CLK] = &msm8998_cnoc_clk,
drivers/clk/qcom/gcc-msm8998.c +12 -17
index 091acd59c1d6..1651a2f47ab8 100644
@@ -11,6 +11,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/clk-provider.h>
+#include <linux/clk.h>
 #include <linux/regmap.h>
 #include <linux/reset-controller.h>
 
@@ -117,17 +118,6 @@ static const char * const gcc_parent_names_5[] = {
 	"core_bi_pll_test_se",
 };
 
-static struct clk_fixed_factor xo = {
-	.mult = 1,
-	.div = 1,
-	.hw.init = &(struct clk_init_data){
-		.name = "xo",
-		.parent_names = (const char *[]){ "xo_board" },
-		.num_parents = 1,
-		.ops = &clk_fixed_factor_ops,
-	},
-};
-
 static struct pll_vco fabia_vco[] = {
 	{ 250000000, 2000000000, 0 },
 	{ 125000000, 1000000000, 1 },
@@ -2959,10 +2949,6 @@ static const struct regmap_config gcc_msm8998_regmap_config = {
 	.fast_io	= true,
 };
 
-static struct clk_hw *gcc_msm8998_hws[] = {
-	&xo.hw,
-};
-
 static const struct qcom_cc_desc gcc_msm8998_desc = {
 	.config = &gcc_msm8998_regmap_config,
 	.clks = gcc_msm8998_clocks,
@@ -2971,14 +2957,23 @@ static const struct qcom_cc_desc gcc_msm8998_desc = {
 	.num_resets = ARRAY_SIZE(gcc_msm8998_resets),
 	.gdscs = gcc_msm8998_gdscs,
 	.num_gdscs = ARRAY_SIZE(gcc_msm8998_gdscs),
-	.clk_hws = gcc_msm8998_hws,
-	.num_clk_hws = ARRAY_SIZE(gcc_msm8998_hws),
 };
 
 static int gcc_msm8998_probe(struct platform_device *pdev)
 {
 	struct regmap *regmap;
 	int ret;
+	struct clk *xo;
+
+	/*
+	 * We must have a valid XO to continue, otherwise having a missing
+	 * parent on a system critical clock like the uart core clock can
+	 * result in strange bugs.  We know XO will be provided by rpmcc,
+	 * but it might not be specified in DT like it should.
+	 */
+	xo = __clk_lookup("xo");
+	if (!xo)
+		return -EPROBE_DEFER;
 
 	regmap = qcom_cc_map(pdev, &gcc_msm8998_desc);
 	if (IS_ERR(regmap))
Signature · 1 line
2.17.1
#7 lore raw

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

In reply to Jeffrey Hugo

Document the multimedia clock controller found on MSM8998.

---
 .../devicetree/bindings/clock/qcom,mmcc.txt   |  21 ++
 include/dt-bindings/clock/qcom,mmcc-msm8998.h | 210 ++++++++++++++++++
 2 files changed, 231 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-msm8998.h
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +21 -0
index 8b0f7841af8d..a92f3cbc9736 100644
@@ -10,11 +10,32 @@ 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.
+		       "dsi0dsi" for the dsi0 pll dsi clock (required if dsi is
+				enabled, optional otherwise).
+		       "dsi0byte" for the dsi0 pll byte clock (required if dsi
+				is enabled, optional otherwise).
+		       "dsi1dsi" for the dsi1 pll dsi clock (required if dsi is
+				enabled, optional otherwise).
+		       "dsi1byte" for the dsi1 pll byte clock (required if dsi
+				is enabled, optional otherwise).
+		       "hdmipll" for the hdmi pll clock (required if hdmi is
+				enabled, optional otherwise).
+		       "dpvco" for the displayport pll vco clock (required if
+				dp is enabled, optional otherwise).
+		       "dplink" for the displayport pll link clock (required if
+				dp is enabled, optional otherwise).
+
 Optional properties :
 - #power-domain-cells : shall contain 1
 
include/dt-bindings/clock/qcom,mmcc-msm8998.h new file +210 -0

210 lines not on this page · raw message

Signature · 1 line
2.17.1
#11 lore raw

PATCH v6 5/6 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 | 2914 +++++++++++++++++++++++++++++++
 3 files changed, 2924 insertions(+)
 create mode 100644 drivers/clk/qcom/mmcc-msm8998.c
drivers/clk/qcom/Kconfig +9 -0
index 9675cd067cf7..96efee18fa6c 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 4a813b4055d0..0ac3c1459313 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_8998) += 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 +2914 -0

2,914 lines not on this page · raw message

Signature · 1 line
2.17.1
#12 lore raw

PATCH v6 6/6 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +14 -0
index c926122566ae..5a9efd749fa6 100644
@@ -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,mmcc-msm8998.h>
 #include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/power/qcom-rpmpd.h>
 #include <dt-bindings/gpio/gpio.h>
@@ -1263,6 +1264,19 @@
 			#size-cells = <0>;
 		};
 
+		mmcc: clock-controller@c8c0000 {
+			compatible = "qcom,mmcc-msm8998";
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+			reg = <0x0c8c0000 0x40000>;
+
+			clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>,
+				 <&gcc GPLL0_OUT_MAIN>;
+			clock-names = "xo",
+				      "gpll0";
+		};
+
 		apcs_glb: mailbox@17911000 {
 			compatible = "qcom,msm8998-apcs-hmss-global";
 			reg = <0x17911000 0x1000>;
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH v6 1/6] dt-bindings: clock: Document external clocks for MSM8998 gcc

In reply to Jeffrey Hugo

Quoting Jeffrey Hugo (2019-10-01 12:55:18)

Quoted 17 lines

The global clock controller on MSM8998 can consume a number of external clocks. Document them.

---
 Documentation/devicetree/bindings/clock/qcom,gcc.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/clock/qcom,gcc.txt +0 -0
index d14362ad4132..32d430718016 100644
@@ -29,6 +29,16 @@ Required properties :
 - #clock-cells : shall contain 1
 - #reset-cells : shall contain 1

Documentation/devicetree/bindings/clock/qcom,gcc.txt Required properties : · line 40

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +9 -0
 
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" (required)
+                      "usb3_pipe" (optional)
+                      "ufs_rx_symbol0" (optional)
+                      "ufs_rx_symbol1" (optional)
+                      "ufs_tx_symbol0" (optional)
+                      "pcie0_pipe" (optional)

This got wrecked by Taniya's changes to this file. Can you resend and rebase it? Sorry for the troubles.

maintainer
#6 lore raw

Re: [PATCH v6 3/6] clk: qcom: smd: Add XO clock for MSM8998

In reply to Jeffrey Hugo

Quoting Jeffrey Hugo (2019-10-01 12:57:08)

Quoted 15 lines
drivers/clk/qcom/gcc-msm8998.c +0 -2
index 091acd59c1d6..1651a2f47ab8 100644
@@ -2971,14 +2957,23 @@ static const struct qcom_cc_desc gcc_msm8998_desc = {
        .num_resets = ARRAY_SIZE(gcc_msm8998_resets),
        .gdscs = gcc_msm8998_gdscs,
        .num_gdscs = ARRAY_SIZE(gcc_msm8998_gdscs),
-       .clk_hws = gcc_msm8998_hws,
-       .num_clk_hws = ARRAY_SIZE(gcc_msm8998_hws),
 };
 
 static int gcc_msm8998_probe(struct platform_device *pdev)
 {
        struct regmap *regmap;

drivers/clk/qcom/gcc-msm8998.c static const struct qcom_cc_desc gcc_msm8998_desc = { · line 2974

Quoted 10 lines
drivers/clk/qcom/gcc-msm8998.c +9 -0
        int ret;
+       struct clk *xo;
+
+       /*
+        * We must have a valid XO to continue, otherwise having a missing
+        * parent on a system critical clock like the uart core clock can
+        * result in strange bugs.  We know XO will be provided by rpmcc,
+        * but it might not be specified in DT like it should.
+        */
+       xo = __clk_lookup("xo");

I very much dislike __clk_lookup(). I think we can not have this patch?

Quoted 3 lines
drivers/clk/qcom/gcc-msm8998.c +2 -0
+       if (!xo)
+               return -EPROBE_DEFER;
 
maintainer
#8 lore raw

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

In reply to Jeffrey Hugo

Quoting Jeffrey Hugo (2019-10-01 12:57:22)

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

Quoted 9 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f7841af8d..a92f3cbc9736 100644
@@ -10,11 +10,32 @@ Required properties :
                        "qcom,mmcc-msm8960"
                        "qcom,mmcc-msm8974"
                        "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"

Can you convert this binding to YAML? Makes it easier to validate it against the dts files.

Quoted 14 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +9 -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.
+                      "dsi0dsi" for the dsi0 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi0byte" for the dsi0 pll byte clock (required if dsi
+                               is enabled, optional otherwise).

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +10 -0
+                      "dsi1dsi" for the dsi1 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi1byte" for the dsi1 pll byte clock (required if dsi
+                               is enabled, optional otherwise).
+                      "hdmipll" for the hdmi pll clock (required if hdmi is
+                               enabled, optional otherwise).
+                      "dpvco" for the displayport pll vco clock (required if
+                               dp is enabled, optional otherwise).
+                      "dplink" for the displayport pll link clock (required if
+                               dp is enabled, optional otherwise).

I'm not sure why it's optional. The hardware is "fixed" in the sense that the dp phy is always there and connected to this hardware block. From a driver perspective I agree it's optional to be used, but from a DT perspective it's always there so it should be required.

#3 lore raw

Re: [PATCH v6 1/6] dt-bindings: clock: Document external clocks for MSM8998 gcc

In reply to Stephen Boyd
Quoted 19 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-10-01 12:55:18)

Quoted 18 lines

The global clock controller on MSM8998 can consume a number of external clocks. Document them.

---
  Documentation/devicetree/bindings/clock/qcom,gcc.txt | 10 ++++++++++
  1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/clock/qcom,gcc.txt +0 -0
index d14362ad4132..32d430718016 100644
@@ -29,6 +29,16 @@ Required properties :
  - #clock-cells : shall contain 1
  - #reset-cells : shall contain 1
 
Quoted 13 lines

Documentation/devicetree/bindings/clock/qcom,gcc.txt Required properties : · line 40

Quoted 9 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +9 -0
+For MSM8998 only:
+       - clocks: a list of phandles and clock-specifier pairs,
+                 one for each entry in clock-names.
+       - clock-names: "xo" (required)
+                      "usb3_pipe" (optional)
+                      "ufs_rx_symbol0" (optional)
+                      "ufs_rx_symbol1" (optional)
+                      "ufs_tx_symbol0" (optional)
+                      "pcie0_pipe" (optional)

This got wrecked by Taniya's changes to this file. Can you resend and rebase it? Sorry for the troubles.

I was afraid of that. I will rewrite and resend.

Signature · 3 lines
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#9 lore raw

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

In reply to Stephen Boyd
Quoted 13 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-10-01 12:57:22)

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

Quoted 9 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +1 -0
index 8b0f7841af8d..a92f3cbc9736 100644
@@ -10,11 +10,32 @@ Required properties :
                         "qcom,mmcc-msm8960"
                         "qcom,mmcc-msm8974"
                         "qcom,mmcc-msm8996"
+                       "qcom,mmcc-msm8998"

Can you convert this binding to YAML? Makes it easier to validate it against the dts files.

I'll look at this since I'm already resending due to the merge conflict.

Quoted 26 lines
Quoted 15 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +9 -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.
+                      "dsi0dsi" for the dsi0 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi0byte" for the dsi0 pll byte clock (required if dsi
+                               is enabled, optional otherwise).

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +10 -0
+                      "dsi1dsi" for the dsi1 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi1byte" for the dsi1 pll byte clock (required if dsi
+                               is enabled, optional otherwise).
+                      "hdmipll" for the hdmi pll clock (required if hdmi is
+                               enabled, optional otherwise).
+                      "dpvco" for the displayport pll vco clock (required if
+                               dp is enabled, optional otherwise).
+                      "dplink" for the displayport pll link clock (required if
+                               dp is enabled, optional otherwise).
Quoted 5 lines

I'm not sure why it's optional. The hardware is "fixed" in the sense that the dp phy is always there and connected to this hardware block.
From a driver perspective I agree it's optional to be used, but from a
DT perspective it's always there so it should be required.

Sure, the DP phy is technically always there, but does a particular platform have an actual DP output connected to the phy? If not, why bother describing something that isn't even used?

From a more practical sense its undefined how to actually get the DP clocks - the DP binding is implicitly a clock provider since it has #clock-cells, but it doesn't specify how to actually get the clocks. The DSI binding tells you which index is the dsi clock, and which is the byte clock.

The HDMI binding is not a clock provider at all. Needs to be revised, which didn't appear trivial when I took a quick look while working on mmcc.

I want to do the right thing here by specifying all the external clocks up front, and not have to worry about backwards compatibility with pre-existing DTs later on, but I also would like to focus on one problem at a time, and not go dig into all the problems with DP/HDMI before landing this, particularly as those components also rely on the mmcc.

Is that justification enough for you? If not, how would you like to proceed? Make them required in the binding, and just have an invalid (per the binding) DT until all the problems get sorted out?

Signature · 3 lines
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#10 lore raw

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

Quoting Jeffrey Hugo (2019-11-07 14:35:21)

Quoted 38 lines · Stephen Boyd
Quoted 31 lines

Quoting Jeffrey Hugo (2019-10-01 12:57:22)

Quoted 19 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +9 -0
index 8b0f7841af8d..a92f3cbc9736 100644
 
 
  - 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.
+                      "dsi0dsi" for the dsi0 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi0byte" for the dsi0 pll byte clock (required if dsi
+                               is enabled, optional otherwise).

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,mmcc.txt +10 -0
+                      "dsi1dsi" for the dsi1 pll dsi clock (required if dsi is
+                               enabled, optional otherwise).
+                      "dsi1byte" for the dsi1 pll byte clock (required if dsi
+                               is enabled, optional otherwise).
+                      "hdmipll" for the hdmi pll clock (required if hdmi is
+                               enabled, optional otherwise).
+                      "dpvco" for the displayport pll vco clock (required if
+                               dp is enabled, optional otherwise).
+                      "dplink" for the displayport pll link clock (required if
+                               dp is enabled, optional otherwise).
Quoted 5 lines

I'm not sure why it's optional. The hardware is "fixed" in the sense that the dp phy is always there and connected to this hardware block.
From a driver perspective I agree it's optional to be used, but from a
DT perspective it's always there so it should be required.

Quoted 3 lines

Sure, the DP phy is technically always there, but does a particular platform have an actual DP output connected to the phy? If not, why bother describing something that isn't even used?

If the DP phy isn't connected then having it be marked as status = "disabled" is the typical approach to the problem. I agree it may not be used on some particular board using the SoC, but this is an SoC that is made once so we should be able to describe it regardless of how it's used by some board.

Quoted 16 lines

From a more practical sense its undefined how to actually get the DP
clocks - the DP binding is implicitly a clock provider since it has #clock-cells, but it doesn't specify how to actually get the clocks. The DSI binding tells you which index is the dsi clock, and which is the byte clock.

The HDMI binding is not a clock provider at all. Needs to be revised, which didn't appear trivial when I took a quick look while working on mmcc.

I want to do the right thing here by specifying all the external clocks up front, and not have to worry about backwards compatibility with pre-existing DTs later on, but I also would like to focus on one problem at a time, and not go dig into all the problems with DP/HDMI before landing this, particularly as those components also rely on the mmcc.

Quoted 4 lines

Is that justification enough for you? If not, how would you like to proceed? Make them required in the binding, and just have an invalid (per the binding) DT until all the problems get sorted out?

If we can make the clks 'required' and not cause the DTS checker system to blow up then I'll be happy.

I hope we can have a property like:

	clocks = <&gcc KNOWN_CLK>, <0>, <0>, <&dp_phy 1>;

where <0> means "I don't know right now", and that will be enough to please the checker and can be filled in later on when we sort out the HDMI and DP bindings. If this doesn't work then I guess I'll just have to get over it and complain to Rob Herring.