Skip to contentSkip to conversation

Introduce support for AM62 DSS VP0 Divider Clock

PATCH In review Aradhya Bhatia 3 participants 5 messages Feb 13, 2023 – Mar 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Introduce support for AM62 DSS VP0 Divider Clock

Introduce clock divider driver and bindings for AM62 DSS (VP0).

The OLDI transmitters in AM62 SoC, require a serial clock, which is 7 times the pixel clock required by the Video Port 0 (VP0) of the DSS.

The clock architecture is such that the relevant PLL is connected to the DSS VP0 through a clock divider (by-7). The DSS requests the pixel clock to the clock divider, which forwards the request to parent PLL. The PLL, in turn, is supposed to generate a 7x pixel-clock (serial clock) to feed the OLDI transmitters directly, and the DSS through the said divider. This ensures that both the OLDI TXes and DSS get their required clocks.

Change Log:
v2:
- Create separate devicetree binding and driver for the clock. The previous version of the series added the compatible inside the fixed-factor clock driver, and explicitly set the flag CLK_SET_RATE_PARENT to have the set clock rate request propagate to the parent PLL. The driver is referenced from the fixed-factor clock driver and modified specifically to support AM62 DSS requirements.

Links:
V1: https://lore.kernel.org/all/[email protected]/

Aradhya Bhatia (2):
dt-bindings: clock: Add binding documentation for TI AM62 DSS Clock
clk: keystone: Add support AM62 DSS clock divider

 .../clock/ti,am62-dss-vp0-div-clk.yaml        |  44 +++++
 drivers/clk/keystone/Kconfig                  |   9 +
 drivers/clk/keystone/Makefile                 |   1 +
 drivers/clk/keystone/clk-am62-dss.c           | 164 ++++++++++++++++++
 4 files changed, 218 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml
 create mode 100644 drivers/clk/keystone/clk-am62-dss.c
Signature · 1 line
2.39.1
#1 lore raw

PATCH v2 1/2 dt-bindings: clock: Add binding documentation for TI AM62 DSS Clock

Add DT bindings for DSS clock divider of TI's AM62 family of SoCs.

---
 .../clock/ti,am62-dss-vp0-div-clk.yaml        | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml
Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml new file +44 -0
new file mode 100644
index 000000000000..310d2a989d5b
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/ti,am62-dss-vp0-div-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI AM62 DSS - OLDI Divider Clock
+
+maintainers:
+  - Aradhya Bhatia <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: ti,am62-dss-vp0-div-clk
+
+  "#clock-cells":
+    const: 0
+
+  clocks:
+    maxItems: 1
+
+  clock-div:
+    description: Fixed divider
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+
+required:
+  - compatible
+  - clocks
+  - "#clock-cells"
+  - clock-div
+
+additionalProperties: false
+
+examples:
+  - |
+    clock {
+      compatible = "ti,am62-dss-vp0-div-clk";
+      clocks = <&parent_clock>;
+      #clock-cells = <0>;
+      clock-div = <7>;
+    };
+...
Signature · 1 line
2.39.1
maintainer
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: clock: Add binding documentation for TI AM62 DSS Clock

Quoted 1 line · Aradhya Bhatia

Add DT bindings for DSS clock divider of TI's AM62 family of SoCs.

Subject: Drop 'binding documentation for '

Quoted 18 lines
---
 .../clock/ti,am62-dss-vp0-div-clk.yaml        | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml
Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml new file +5 -0
new file mode 100644
index 000000000000..310d2a989d5b
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/ti,am62-dss-vp0-div-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml new file +10 -0
+
+title: TI AM62 DSS - OLDI Divider Clock
+
+maintainers:
+  - Aradhya Bhatia <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: ti,am62-dss-vp0-div-clk

What's wrong with 'fixed-factor-clock' binding?

Quoted 32 lines
Documentation/devicetree/bindings/clock/ti,am62-dss-vp0-div-clk.yaml new file +29 -0
+
+  "#clock-cells":
+    const: 0
+
+  clocks:
+    maxItems: 1
+
+  clock-div:
+    description: Fixed divider
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+
+required:
+  - compatible
+  - clocks
+  - "#clock-cells"
+  - clock-div
+
+additionalProperties: false
+
+examples:
+  - |
+    clock {
+      compatible = "ti,am62-dss-vp0-div-clk";
+      clocks = <&parent_clock>;
+      #clock-cells = <0>;
+      clock-div = <7>;
+    };
+...
Signature · 1 line
2.39.1
#3 lore raw

PATCH v2 2/2 clk: keystone: Add support AM62 DSS clock divider

In reply to Aradhya Bhatia

On TI's AM62 Family of SoCs, the pixel frequency of the DSS Video Port 0 comes from a by-7 clock divider. This is done to support the clock for OLDI transmitters that need serial clock 7 times the pixel frequency.

A clock set request on this clock, is forwarded to its parent clock by default, using the SET_RATE_PARENT flag. The PLL (in this case the parent) generates serial clock for OLDI, which is then also fed to DSS using this clock divider.

---
 drivers/clk/keystone/Kconfig        |   9 ++
 drivers/clk/keystone/Makefile       |   1 +
 drivers/clk/keystone/clk-am62-dss.c | 164 ++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)
 create mode 100644 drivers/clk/keystone/clk-am62-dss.c
drivers/clk/keystone/Kconfig +9 -0
index e64d6726048f..543314ddfd2c 100644
@@ -34,3 +34,12 @@ config TI_SYSCON_CLK
 	help
 	  This adds clock driver support for syscon based gate
 	  clocks on TI's K2 and K3 SoCs.
+
+config TI_AM62_DSS_CLK
+	tristate "Clock Divider for DSS VP0 of AM62 Family of SoCs"
+	depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
+	default TI_SCI_CLK
+	help
+	  This adds clock divider driver support for Video Port 0 of Display
+	  SubSystems (DSS) under AM62 Family of SoCs. This clock divider
+	  forwards a seventh (1/7) of the incoming clock.
drivers/clk/keystone/Makefile +1 -0
index 0e426e648f7c..3a683d622a60 100644
@@ -2,3 +2,4 @@
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)	+= pll.o gate.o
 obj-$(CONFIG_TI_SCI_CLK)		+= sci-clk.o
 obj-$(CONFIG_TI_SYSCON_CLK)		+= syscon-clk.o
+obj-$(CONFIG_TI_AM62_DSS_CLK)		+= clk-am62-dss.o
drivers/clk/keystone/clk-am62-dss.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.39.1
#4 lore raw

Re: [PATCH v2 2/2] clk: keystone: Add support AM62 DSS clock divider

Thank you for the patch! Yet something to improve:

Hi Aradhya,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on linus/master v6.2 next-20230303] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aradhya-Bhatia/dt-bindings-clock-Add-binding-documentation-for-TI-AM62-DSS-Clock/20230213-200203
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link:    https://lore.kernel.org/r/20230213115954.553-3-a-bhatia1%40ti.com
patch subject: [PATCH v2 2/2] clk: keystone: Add support AM62 DSS clock divider
config: arm-randconfig-r046-20230302 (https://download.01.org/0day-ci/archive/20230304/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2ddb7301b11092b73d4a16af06362954f3d5f714
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Aradhya-Bhatia/dt-bindings-clock-Add-binding-documentation-for-TI-AM62-DSS-Clock/20230213-200203 git checkout 2ddb7301b11092b73d4a16af06362954f3d5f714
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/clk/ mm// net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/arm/include/asm/div64.h:107,

                    from include/linux/math.h:6,
                    from include/linux/math64.h:6,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/clk/keystone/clk-am62-dss.c:5:
   drivers/clk/keystone/clk-am62-dss.c: In function 'ti_am62_dss_clk_recalc_rate':
   include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   drivers/clk/keystone/clk-am62-dss.c:24:9: note: in expansion of macro 'do_div'
      24 |         do_div(rate, priv->div);
         |         ^~~~~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/module.h:12:
   include/asm-generic/div64.h:234:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:77:45: note: in definition of macro 'likely'
      77 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   drivers/clk/keystone/clk-am62-dss.c:24:9: note: in expansion of macro 'do_div'
      24 |         do_div(rate, priv->div);
         |         ^~~~~~
   include/asm-generic/div64.h:238:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types]
     238 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    long unsigned int *
   drivers/clk/keystone/clk-am62-dss.c:24:9: note: in expansion of macro 'do_div'
      24 |         do_div(rate, priv->div);
         |         ^~~~~~
   arch/arm/include/asm/div64.h:24:45: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'long unsigned int *'
      24 | static inline uint32_t __div64_32(uint64_t *n, uint32_t base)
         |                                   ~~~~~~~~~~^
   drivers/clk/keystone/clk-am62-dss.c: In function 'clk_hw_unregister_am62_dss_clk':
>> drivers/clk/keystone/clk-am62-dss.c:99:9: error: implicit declaration of function 'kfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
      99 |         kfree(priv);
         |         ^~~~~
         |         kvfree

cc1: some warnings being treated as errors

vim +99 drivers/clk/keystone/clk-am62-dss.c

    91	
    92	static void clk_hw_unregister_am62_dss_clk(struct clk_hw *hw)
    93	{
    94		struct ti_am62_dss_clk *priv;
    95	
    96		priv = to_ti_am62_dss_clk(hw);
    97	
    98		clk_hw_unregister(hw);
  > 99		kfree(priv);

100 }
101

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests