Skip to contentSkip to conversation

Use reg instead of ti,bit-shift for clksel

PATCH In review Tony Lindgren 4 participants 14 messages Feb 13, 2024 – Sep 5, 2024

Subsystems (4)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Use reg instead of ti,bit-shift for clksel

Hi all,

This series updates the clksel clocks to use the standard reg property instead of ti,bit-shift.

I'd like to apply these before we make further use of the clksel clocks to reduce the dtb check warnings.

Regards,

Tony

Tony Lindgren (4):
clk: ti: Handle possible address in the node name
clk: ti: Improve clksel clock bit parsing for reg property
ARM: dts: am3: Update clksel clocks to use reg instead of ti,bit-shift
ARM: dts: omap3: Update clksel clocks to use reg instead of
ti,bit-shift

 arch/arm/boot/dts/ti/omap/am33xx-clocks.dtsi  |  39 +-
 arch/arm/boot/dts/ti/omap/am35xx-clocks.dtsi  |  18 +-
 .../boot/dts/ti/omap/omap3430es1-clocks.dtsi  |  52 +-
 .../dts/ti/omap/omap34xx-omap36xx-clocks.dtsi |  86 +--
 ...map36xx-am35xx-omap3430es2plus-clocks.dtsi |  28 +-
 .../arm/boot/dts/ti/omap/omap36xx-clocks.dtsi |   7 +-
 .../omap/omap36xx-omap3430es2plus-clocks.dtsi |  46 +-
 .../arm/boot/dts/ti/omap/omap3xxx-clocks.dtsi | 510 +++++++++---------
 drivers/clk/ti/apll.c                         |  11 +-
 drivers/clk/ti/clk.c                          |  71 ++-
 drivers/clk/ti/clock.h                        |   1 +
 drivers/clk/ti/divider.c                      |   5 +-
 drivers/clk/ti/gate.c                         |   9 +-
 drivers/clk/ti/interface.c                    |   4 +-
 drivers/clk/ti/mux.c                          |   6 +-
 include/linux/clk/ti.h                        |   3 +
 16 files changed, 491 insertions(+), 405 deletions(-)
Signature · 1 line
2.43.1
author maintainer
#1 lore raw

PATCH 1/4 clk: ti: Handle possible address in the node name

In order to use #address-cells = <1> and start making use of the standard reg property, let's prepare things to ignore the possible address in the clock node name.

Unless the clock-output-names property is used, the legacy clocks still fall back to matching the clock data based on the node name.

We use cleanup.h to simplify the return path for freeing tmp.

---
 drivers/clk/ti/clk.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/clk/ti/clk.c +10 -4
@@ -7,6 +7,7 @@
  * Tero Kristo <[email protected]>
  */
 
+#include <linux/cleanup.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
@@ -114,20 +115,26 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops)
 
 /*
  * Eventually we could standardize to using '_' for clk-*.c files to follow the
- * TRM naming and leave out the tmp name here.
+ * TRM naming.
  */
 static struct device_node *ti_find_clock_provider(struct device_node *from,
 						  const char *name)
 {
+	char *tmp __free(kfree) = NULL;
 	struct device_node *np;
 	bool found = false;
 	const char *n;
-	char *tmp;
+	char *p;
 
 	tmp = kstrdup_and_replace(name, '-', '_', GFP_KERNEL);
 	if (!tmp)
 		return NULL;
 
+	/* Ignore a possible address for the node name */
+	p = strchr(tmp, '@');
+	if (p)
+		*p = '\0';
+
 	/* Node named "clock" with "clock-output-names" */
 	for_each_of_allnodes_from(from, np) {
 		if (of_property_read_string_index(np, "clock-output-names",
@@ -140,7 +147,6 @@ static struct device_node *ti_find_clock_provider(struct device_node *from,
 			break;
 		}
 	}
-	kfree(tmp);
 
 	if (found) {
 		of_node_put(from);
@@ -148,7 +154,7 @@ static struct device_node *ti_find_clock_provider(struct device_node *from,
 	}
 
 	/* Fall back to using old node name base provider name */
-	return of_find_node_by_name(from, name);
+	return of_find_node_by_name(from, tmp);
 }
 
 /**
Signature · 1 line
2.43.1
maintainer Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] clk: ti: Handle possible address in the node name

Quoting Tony Lindgren (2024-02-13 02:56:41)

Quoted 11 lines

In order to use #address-cells = <1> and start making use of the standard reg property, let's prepare things to ignore the possible address in the clock node name.

Unless the clock-output-names property is used, the legacy clocks still fall back to matching the clock data based on the node name.

We use cleanup.h to simplify the return path for freeing tmp.

---

#3 lore raw

Re: [PATCH 1/4] clk: ti: Handle possible address in the node name

In reply to Tony Lindgren

Hi Tony,

Quoted 10 lines · Tony Lindgren

In order to use #address-cells = <1> and start making use of the standard reg property, let's prepare things to ignore the possible address in the clock node name.

Unless the clock-output-names property is used, the legacy clocks still fall back to matching the clock data based on the node name.

We use cleanup.h to simplify the return path for freeing tmp.

Thanks for your patch, which is now commit 3516338543cafb65 ("clk: ti:
Handle possible address in the node name") in v6.9-rc1. This causes an early boot crash on BeagleBone Black:

ti_dt_clocks_register: failed to lookup clock node
clk-24mhz-clkctrl:0000:0, ret=-517
ti_dt_clocks_register: failed to lookup clock node
clk-24mhz-clkctrl:0000:0, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:30, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:19, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l4-wkup-clkctrl:0008:18, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l4ls-clkctrl:0074:18, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l4ls-clkctrl:0078:18, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l4ls-clkctrl:007c:18, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:27, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:22, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:24, ret=-517
ti_dt_clocks_register: failed to lookup clock node
l3-aon-clkctrl:0000:20, ret=-517
8<--- cut here ---
Unable to handle kernel paging request at virtual address fffffffe when read [fffffffe] *pgd=9fdf6841, *pte=00000000, *ppte=00000000 Internal error: Oops: 27 [#1] SMP ARM
CPU: 0 PID: 0 Comm: swapper/0 Not tainted
6.8.0-rc1-boneblack-00001-g3516338543ca #119

    Hardware name: Generic AM33XX (Flattened Device Tree)
    PC is at clk_set_parent+0x2c/0x6c
    LR is at __lock_acquire+0x3f8/0x29d4
    pc : [<c06ecd4c>]    lr : [<c01b2b14>]    psr: a0000093
    sp : c1001fb0  ip : 00000000  fp : 00000000
    r10: c0f5da88  r9 : 00000000  r8 : 00000078
    r7 : ffffffff  r6 : c11ba000  r5 : fffffffe  r4 : c20a0700
    r3 : 00000000  r2 : c100c580  r1 : 00000001  r0 : c209ac00
    Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
    Control: 10c5387d  Table: 80004019  DAC: 00000051
    Register r0 information: slab kmalloc-192 start c209ac00 pointer

offset 0 size 192
Register r1 information: non-paged memory
Register r2 information: non-slab/vmalloc memory Register r3 information: NULL pointer
Register r4 information: slab kmalloc-64 start c20a0700 pointer
offset 0 size 64
Register r5 information: non-paged memory
Register r6 information: non-slab/vmalloc memory Register r7 information: non-paged memory
Register r8 information: non-paged memory
Register r9 information: NULL pointer
Register r10 information: non-slab/vmalloc memory Register r11 information: NULL pointer
Register r12 information: NULL pointer
Process swapper/0 (pid: 0, stack limit = 0x(ptrval))
Stack: (0xc1001fb0 to 0xc1002000)
1fa0: c20a0700 c10093c0
c11ba000 c0f2ebdc

    1fc0: dfdffc40 c0f11380 dfdffc40 c0f01074 ffffffff ffffffff
00000000 c0f006f0
    1fe0: 00000000 c0f5da88 00000000 00000e05 00000000 00000000
00000000 00000000
     clk_set_parent from am33xx_dt_clk_init+0x84/0xa4
     am33xx_dt_clk_init from omap_init_time_of+0x8/0x10
     omap_init_time_of from start_kernel+0x430/0x638
     start_kernel from 0x0
    Code: e3530000 1a00000e e3550000 e5940000 (15955000)
    ---[ end trace 0000000000000000 ]---
    Kernel panic - not syncing: Attempted to kill the idle task!
    ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---

Reverting the commit on top of a recent v6.11-rcX-based tree fixes the issue.

BTW, bisecting this took a while as:
1. The OMAP serial driver locks up when booted with "earlycon keep_bootcon",
2. The TI SYSC sometimes crashes during early boot, too:

    Unhandled fault: external abort on non-linefetch (0x1008) at 0xe036d010
    [e036d010] *pgd=8276e811, *pte=47400653, *ppte=47400453
    Internal error: : 1008 [#1] SMP ARM
    Modules linked in:
    CPU: 0 PID: 33 Comm: kworker/u4:3 Not tainted
6.8.0-boneblack-05567-gaa7d6513d68b #78
    Hardware name: Generic AM33XX (Flattened Device Tree)
    Workqueue: events_unbound deferred_probe_work_func
    PC is at sysc_reset+0x118/0x210
    LR is at sysc_probe+0xe08/0x1440
    pc : [<c06d0ba8>]    lr : [<c06d1cd8>]    psr: 60000013
Quoted 48 lines
drivers/clk/ti/clk.c +9 -3
@@ -7,6 +7,7 @@
  * Tero Kristo <[email protected]>
  */
 
+#include <linux/cleanup.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
@@ -114,20 +115,26 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops)
 
 /*
  * Eventually we could standardize to using '_' for clk-*.c files to follow the
- * TRM naming and leave out the tmp name here.
+ * TRM naming.
  */
 static struct device_node *ti_find_clock_provider(struct device_node *from,
                                                  const char *name)
 {
+       char *tmp __free(kfree) = NULL;
        struct device_node *np;
        bool found = false;
        const char *n;
-       char *tmp;
+       char *p;
 
        tmp = kstrdup_and_replace(name, '-', '_', GFP_KERNEL);
        if (!tmp)
                return NULL;
 
+       /* Ignore a possible address for the node name */
+       p = strchr(tmp, '@');
+       if (p)
+               *p = '\0';
+
        /* Node named "clock" with "clock-output-names" */
        for_each_of_allnodes_from(from, np) {
                if (of_property_read_string_index(np, "clock-output-names",
@@ -140,7 +147,6 @@ static struct device_node *ti_find_clock_provider(struct device_node *from,
                        break;
                }
        }
-       kfree(tmp);
 
        if (found) {
                of_node_put(from);

drivers/clk/ti/clk.c static struct device_node *ti_find_clock_provider(struct device_node *from, · line 160

Quoted 8 lines
drivers/clk/ti/clk.c +1 -1
@@ -148,7 +154,7 @@ static struct device_node *ti_find_clock_provider(struct device_node *from,
        }
 
        /* Fall back to using old node name base provider name */
-       return of_find_node_by_name(from, name);
+       return of_find_node_by_name(from, tmp);
 }
 
 /**

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw

Re: [PATCH 1/4] clk: ti: Handle possible address in the node name

Quoted 10 lines · Geert Uytterhoeven
Quoted 9 lines · Tony Lindgren

In order to use #address-cells = <1> and start making use of the standard reg property, let's prepare things to ignore the possible address in the clock node name.

Unless the clock-output-names property is used, the legacy clocks still fall back to matching the clock data based on the node name.

We use cleanup.h to simplify the return path for freeing tmp.

Quoted 8 lines
Quoted 1 line

Thanks for your patch, which is now commit 3516338543cafb65 ("clk: ti:
Handle possible address in the node name") in v6.9-rc1. This causes an early boot crash on BeagleBone Black:

ti_dt_clocks_register: failed to lookup clock node
clk-24mhz-clkctrl:0000:0, ret=-517

I found the culprit: after the move of .dts files to vendor sub-directories, I had updated my boot script to:

    DTB=arch/arm/boot/dts/ti/am335x-boneblack.dtb
    if [ ! -e $DTB ]; then
        DTB=arch/arm/boot/dts/am335x-boneblack.dtb
    fi

I.e. I missed the "/omap" part, causing the install to fall back to an old DTB file that no longer works with modern kernels.

Sorry for the noise.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#5 lore raw

PATCH 2/4 clk: ti: Improve clksel clock bit parsing for reg property

In reply to Tony Lindgren

Because of legacy reasons, the TI clksel composite clocks can have overlapping reg properties, and use a custom ti,bit-shift property.

For the clksel clocks we can start using of the standard reg property instead of the custom ti,bit-shift property.

To do this, let's add a ti_clk_get_legacy_bit_shift() helper, and make ti_clk_get_reg_addr() populate the clock bit offset.

This makes it possible to update the devicetree files to use the reg property one clock at a time.

---
 drivers/clk/ti/apll.c      | 11 ++------
 drivers/clk/ti/clk.c       | 57 +++++++++++++++++++++++++++++++++-----
 drivers/clk/ti/clock.h     |  1 +
 drivers/clk/ti/divider.c   |  5 +---
 drivers/clk/ti/gate.c      |  9 ++----
 drivers/clk/ti/interface.c |  4 +--
 drivers/clk/ti/mux.c       |  6 ++--
 include/linux/clk/ti.h     |  3 ++
 8 files changed, 63 insertions(+), 33 deletions(-)
drivers/clk/ti/apll.c +3 -8
@@ -376,14 +376,9 @@ static void __init of_omap2_apll_setup(struct device_node *node)
 	}
 	clk_hw->fixed_rate = val;
 
-	if (of_property_read_u32(node, "ti,bit-shift", &val)) {
-		pr_err("%pOFn missing bit-shift\n", node);
-		goto cleanup;
-	}
-
-	clk_hw->enable_bit = val;
-	ad->enable_mask = 0x3 << val;
-	ad->autoidle_mask = 0x3 << val;
+	clk_hw->enable_bit = ti_clk_get_legacy_bit_shift(node);
+	ad->enable_mask = 0x3 << clk_hw->enable_bit;
+	ad->autoidle_mask = 0x3 << clk_hw->enable_bit;
 
 	if (of_property_read_u32(node, "ti,idlest-shift", &val)) {
 		pr_err("%pOFn missing idlest-shift\n", node);
drivers/clk/ti/clk.c +50 -7

85 lines not on this page · raw message

drivers/clk/ti/clock.h +1 -0
@@ -216,6 +216,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
 
 int ti_clk_get_reg_addr(struct device_node *node, int index,
 			struct clk_omap_reg *reg);
+int ti_clk_get_legacy_bit_shift(struct device_node *node);
 void ti_dt_clocks_register(struct ti_dt_clk *oclks);
 int ti_clk_retry_init(struct device_node *node, void *user,
 		      ti_of_clk_init_cb_t func);
drivers/clk/ti/divider.c +1 -4
@@ -477,10 +477,7 @@ static int __init ti_clk_divider_populate(struct device_node *node,
 	if (ret)
 		return ret;
 
-	if (!of_property_read_u32(node, "ti,bit-shift", &val))
-		div->shift = val;
-	else
-		div->shift = 0;
+	div->shift = div->reg.bit;
 
 	if (!of_property_read_u32(node, "ti,latch-bit", &val))
 		div->latch = val;
drivers/clk/ti/gate.c +2 -7
@@ -132,7 +132,6 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 	struct clk_omap_reg reg;
 	const char *name;
 	u8 enable_bit = 0;
-	u32 val;
 	u32 flags = 0;
 	u8 clk_gate_flags = 0;
 
@@ -140,8 +139,7 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 		if (ti_clk_get_reg_addr(node, 0, &reg))
 			return;
 
-		if (!of_property_read_u32(node, "ti,bit-shift", &val))
-			enable_bit = val;
+		enable_bit = reg.bit;
 	}
 
 	if (of_clk_get_parent_count(node) != 1) {
@@ -170,7 +168,6 @@ _of_ti_composite_gate_clk_setup(struct device_node *node,
 				const struct clk_hw_omap_ops *hw_ops)
 {
 	struct clk_hw_omap *gate;
-	u32 val = 0;
 
 	gate = kzalloc(sizeof(*gate), GFP_KERNEL);
 	if (!gate)
@@ -179,9 +176,7 @@ _of_ti_composite_gate_clk_setup(struct device_node *node,
 	if (ti_clk_get_reg_addr(node, 0, &gate->enable_reg))
 		goto cleanup;
 
-	of_property_read_u32(node, "ti,bit-shift", &val);
-
-	gate->enable_bit = val;
+	gate->enable_bit = gate->enable_reg.bit;
 	gate->ops = hw_ops;
 
 	if (!ti_clk_add_component(node, &gate->hw, CLK_COMPONENT_TYPE_GATE))
drivers/clk/ti/interface.c +1 -3
@@ -66,13 +66,11 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
 	struct clk_omap_reg reg;
 	u8 enable_bit = 0;
 	const char *name;
-	u32 val;
 
 	if (ti_clk_get_reg_addr(node, 0, &reg))
 		return;
 
-	if (!of_property_read_u32(node, "ti,bit-shift", &val))
-		enable_bit = val;
+	enable_bit = reg.bit;
 
 	parent_name = of_clk_get_parent_name(node, 0);
 	if (!parent_name) {
drivers/clk/ti/mux.c +2 -4
@@ -189,7 +189,7 @@ static void of_mux_clk_setup(struct device_node *node)
 	if (ti_clk_get_reg_addr(node, 0, &reg))
 		goto cleanup;
 
-	of_property_read_u32(node, "ti,bit-shift", &shift);
+	shift = reg.bit;
 
 	of_property_read_u32(node, "ti,latch-bit", &latch);
 
@@ -252,7 +252,6 @@ static void __init of_ti_composite_mux_clk_setup(struct device_node *node)
 {
 	struct clk_omap_mux *mux;
 	unsigned int num_parents;
-	u32 val;
 
 	mux = kzalloc(sizeof(*mux), GFP_KERNEL);
 	if (!mux)
@@ -261,8 +260,7 @@ static void __init of_ti_composite_mux_clk_setup(struct device_node *node)
 	if (ti_clk_get_reg_addr(node, 0, &mux->reg))
 		goto cleanup;
 
-	if (!of_property_read_u32(node, "ti,bit-shift", &val))
-		mux->shift = val;
+	mux->shift = mux->reg.bit;
 
 	if (of_property_read_bool(node, "ti,index-starts-at-one"))
 		mux->flags |= CLK_MUX_INDEX_ONE;
include/linux/clk/ti.h +3 -0
@@ -13,11 +13,14 @@
 /**
  * struct clk_omap_reg - OMAP register declaration
  * @offset: offset from the master IP module base address
+ * @bit: register bit offset
  * @index: index of the master IP module
+ * @flags: flags
  */
 struct clk_omap_reg {
 	void __iomem *ptr;
 	u16 offset;
+	u8 bit;
 	u8 index;
 	u8 flags;
 };
Signature · 1 line
2.43.1
maintainer Acked-by on v1 2/4
#6 lore raw

Re: [PATCH 2/4] clk: ti: Improve clksel clock bit parsing for reg property

Quoting Tony Lindgren (2024-02-13 02:56:42)

Quoted 6 lines

Because of legacy reasons, the TI clksel composite clocks can have overlapping reg properties, and use a custom ti,bit-shift property.

For the clksel clocks we can start using of the standard reg property instead of the custom ti,bit-shift property.

Quoted 8 lines

To do this, let's add a ti_clk_get_legacy_bit_shift() helper, and make ti_clk_get_reg_addr() populate the clock bit offset.

This makes it possible to update the devicetree files to use the reg property one clock at a time.

---

author maintainer
#7 lore raw

PATCH 3/4 ARM: dts: am3: Update clksel clocks to use reg instead of ti,bit-shift

In reply to Tony Lindgren

For the clksel clocks we are still using the legacy ti,bit-shift property instead of the standard reg property. We can now use the reg property, so let's do that for the clksel clocks.

To add the reg property, we switch to use #address-cells = <1>.

---
 arch/arm/boot/dts/ti/omap/am33xx-clocks.dtsi | 39 +++++++++++---------
 1 file changed, 22 insertions(+), 17 deletions(-)
arch/arm/boot/dts/ti/omap/am33xx-clocks.dtsi +22 -17
@@ -108,30 +108,31 @@ clock@664 {
 		compatible = "ti,clksel";
 		reg = <0x664>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		ehrpwm0_tbclk: clock-ehrpwm0-tbclk {
+		ehrpwm0_tbclk: clock-ehrpwm0-tbclk@0 {
+			reg = <0>;
 			#clock-cells = <0>;
 			compatible = "ti,gate-clock";
 			clock-output-names = "ehrpwm0_tbclk";
 			clocks = <&l4ls_gclk>;
-			ti,bit-shift = <0>;
 		};
 
-		ehrpwm1_tbclk: clock-ehrpwm1-tbclk {
+		ehrpwm1_tbclk: clock-ehrpwm1-tbclk@1 {
+			reg = <1>;
 			#clock-cells = <0>;
 			compatible = "ti,gate-clock";
 			clock-output-names = "ehrpwm1_tbclk";
 			clocks = <&l4ls_gclk>;
-			ti,bit-shift = <1>;
 		};
 
-		ehrpwm2_tbclk: clock-ehrpwm2-tbclk {
+		ehrpwm2_tbclk: clock-ehrpwm2-tbclk@2 {
+			reg = <2>;
 			#clock-cells = <0>;
 			compatible = "ti,gate-clock";
 			clock-output-names = "ehrpwm2_tbclk";
 			clocks = <&l4ls_gclk>;
-			ti,bit-shift = <2>;
 		};
 	};
 };
@@ -566,17 +567,19 @@ clock@52c {
 		compatible = "ti,clksel";
 		reg = <0x52c>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		gfx_fclk_clksel_ck: clock-gfx-fclk-clksel {
+		gfx_fclk_clksel_ck: clock-gfx-fclk-clksel@1 {
+			reg = <1>;
 			#clock-cells = <0>;
 			compatible = "ti,mux-clock";
 			clock-output-names = "gfx_fclk_clksel_ck";
 			clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
-			ti,bit-shift = <1>;
 		};
 
-		gfx_fck_div_ck: clock-gfx-fck-div {
+		gfx_fck_div_ck: clock-gfx-fck-div@0 {
+			reg = <0>;
 			#clock-cells = <0>;
 			compatible = "ti,divider-clock";
 			clock-output-names = "gfx_fck_div_ck";
@@ -589,30 +592,32 @@ clock@700 {
 		compatible = "ti,clksel";
 		reg = <0x700>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		sysclkout_pre_ck: clock-sysclkout-pre {
+		sysclkout_pre_ck: clock-sysclkout-pre@0 {
+			reg = <0>;
 			#clock-cells = <0>;
 			compatible = "ti,mux-clock";
 			clock-output-names = "sysclkout_pre_ck";
 			clocks = <&clk_32768_ck>, <&l3_gclk>, <&dpll_ddr_m2_ck>, <&dpll_per_m2_ck>, <&lcd_gclk>;
 		};
 
-		clkout2_div_ck: clock-clkout2-div {
+		clkout2_div_ck: clock-clkout2-div@3 {
+			reg = <3>;
 			#clock-cells = <0>;
 			compatible = "ti,divider-clock";
 			clock-output-names = "clkout2_div_ck";
 			clocks = <&sysclkout_pre_ck>;
-			ti,bit-shift = <3>;
 			ti,max-div = <8>;
 		};
 
-		clkout2_ck: clock-clkout2 {
+		clkout2_ck: clock-clkout2@7 {
+			reg = <7>;
 			#clock-cells = <0>;
 			compatible = "ti,gate-clock";
 			clock-output-names = "clkout2_ck";
 			clocks = <&clkout2_div_ck>;
-			ti,bit-shift = <7>;
 		};
 	};
 };
Signature · 1 line
2.43.1
author maintainer
#8 lore raw

PATCH 4/4 ARM: dts: omap3: Update clksel clocks to use reg instead of ti,bit-shift

In reply to Tony Lindgren

For the clksel clocks we are still using the legacy ti,bit-shift property instead of the standard reg property. We can now use the reg property, so let's do that for the clksel clocks.

To add the reg property, we switch to use #address-cells = <1>.

For now let's not update the clock-dss-tv-fck as it seems to share the same register bit as the clock-dss-96m-fck and would introduce more warnings.

Cc Andreas Kemnade <[email protected]>
---
 arch/arm/boot/dts/ti/omap/am35xx-clocks.dtsi  |  18 +-
 .../boot/dts/ti/omap/omap3430es1-clocks.dtsi  |  52 +-
 .../dts/ti/omap/omap34xx-omap36xx-clocks.dtsi |  86 +--
 ...map36xx-am35xx-omap3430es2plus-clocks.dtsi |  28 +-
 .../arm/boot/dts/ti/omap/omap36xx-clocks.dtsi |   7 +-
 .../omap/omap36xx-omap3430es2plus-clocks.dtsi |  46 +-
 .../arm/boot/dts/ti/omap/omap3xxx-clocks.dtsi | 510 +++++++++---------
 7 files changed, 396 insertions(+), 351 deletions(-)
arch/arm/boot/dts/ti/omap/am35xx-clocks.dtsi +10 -8
@@ -66,22 +66,23 @@ clock@a10 {
 		compatible = "ti,clksel";
 		reg = <0xa10>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		ipss_ick: clock-ipss-ick {
+		ipss_ick: clock-ipss-ick@4 {
+			reg = <4>;
 			#clock-cells = <0>;
 			compatible = "ti,am35xx-interface-clock";
 			clock-output-names = "ipss_ick";
 			clocks = <&core_l3_ick>;
-			ti,bit-shift = <4>;
 		};
 
-		uart4_ick_am35xx: clock-uart4-ick-am35xx {
+		uart4_ick_am35xx: clock-uart4-ick-am35xx@23 {
+			reg = <23>;
 			#clock-cells = <0>;
 			compatible = "ti,omap3-interface-clock";
 			clock-output-names = "uart4_ick_am35xx";
 			clocks = <&core_l4_ick>;
-			ti,bit-shift = <23>;
 		};
 	};
 
@@ -101,14 +102,15 @@ clock@a00 {
 		compatible = "ti,clksel";
 		reg = <0xa00>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		uart4_fck_am35xx: clock-uart4-fck-am35xx {
+		uart4_fck_am35xx: clock-uart4-fck-am35xx@23 {
+			reg = <23>;
 			#clock-cells = <0>;
 			compatible = "ti,wait-gate-clock";
 			clock-output-names = "uart4_fck_am35xx";
 			clocks = <&core_48m_fck>;
-			ti,bit-shift = <23>;
 		};
 	};
 };
arch/arm/boot/dts/ti/omap/omap3430es1-clocks.dtsi +28 -24

133 lines not on this page · raw message

arch/arm/boot/dts/ti/omap/omap34xx-omap36xx-clocks.dtsi +46 -40

219 lines not on this page · raw message

arch/arm/boot/dts/ti/omap/omap36xx-am35xx-omap3430es2plus-clocks.dtsi +16 -12
@@ -138,14 +138,15 @@ clock@a18 {
 		compatible = "ti,clksel";
 		reg = <0xa18>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		usbtll_ick: clock-usbtll-ick {
+		usbtll_ick: clock-usbtll-ick@2 {
+			reg = <2>;
 			#clock-cells = <0>;
 			compatible = "ti,omap3-interface-clock";
 			clock-output-names = "usbtll_ick";
 			clocks = <&core_l4_ick>;
-			ti,bit-shift = <2>;
 		};
 	};
 
@@ -153,14 +154,15 @@ clock@a10 {
 		compatible = "ti,clksel";
 		reg = <0xa10>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		mmchs3_ick: clock-mmchs3-ick {
+		mmchs3_ick: clock-mmchs3-ick@30 {
+			reg = <30>;
 			#clock-cells = <0>;
 			compatible = "ti,omap3-interface-clock";
 			clock-output-names = "mmchs3_ick";
 			clocks = <&core_l4_ick>;
-			ti,bit-shift = <30>;
 		};
 	};
 
@@ -168,14 +170,15 @@ clock@a00 {
 		compatible = "ti,clksel";
 		reg = <0xa00>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		mmchs3_fck: clock-mmchs3-fck {
+		mmchs3_fck: clock-mmchs3-fck@30 {
+			reg = <30>;
 			#clock-cells = <0>;
 			compatible = "ti,wait-gate-clock";
 			clock-output-names = "mmchs3_fck";
 			clocks = <&core_96m_fck>;
-			ti,bit-shift = <30>;
 		};
 	};
 
@@ -183,14 +186,15 @@ clock@e00 {
 		compatible = "ti,clksel";
 		reg = <0xe00>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		dss1_alwon_fck: clock-dss1-alwon-fck-3430es2 {
+		dss1_alwon_fck: clock-dss1-alwon-fck-3430es2@0 {
+			reg = <0>;
 			#clock-cells = <0>;
 			compatible = "ti,dss-gate-clock";
 			clock-output-names = "dss1_alwon_fck_3430es2";
 			clocks = <&dpll4_m4x2_ck>;
-			ti,bit-shift = <0>;
 			ti,set-rate-parent;
 		};
 	};
arch/arm/boot/dts/ti/omap/omap36xx-clocks.dtsi +4 -3
@@ -62,14 +62,15 @@ clock@1000 {
 		compatible = "ti,clksel";
 		reg = <0x1000>;
 		#clock-cells = <2>;
-		#address-cells = <0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-		uart4_fck: clock-uart4-fck {
+		uart4_fck: clock-uart4-fck@18 {
+			reg = <18>;
 			#clock-cells = <0>;
 			compatible = "ti,wait-gate-clock";
 			clock-output-names = "uart4_fck";
 			clocks = <&per_48m_fck>;
-			ti,bit-shift = <18>;
 		};
 	};
 };
arch/arm/boot/dts/ti/omap/omap36xx-omap3430es2plus-clocks.dtsi +26 -20

118 lines not on this page · raw message

arch/arm/boot/dts/ti/omap/omap3xxx-clocks.dtsi +266 -244

1,303 lines not on this page · raw message

Signature · 1 line
2.43.1
maintainer
#9 lore raw
In reply to Tony Lindgren
Quoted 8 lines · On Tue, 13 Feb 2024 12:56:40 +0200 Tony Lindgren <[email protected]> wrote:

Hi all,

This series updates the clksel clocks to use the standard reg property instead of ti,bit-shift.

I'd like to apply these before we make further use of the clksel clocks to reduce the dtb check warnings.

hmm, we still have ti,bit-shift if these clocks are not used below a ti,clksel. Just wondering, can we completely deorbit ti,bit-shift if we used #address-cells = <2>; in those cases? I wait a bit with further txt->yaml conversions until this is settled.

Regards,
Andreas

author maintainer
#10 lore raw
Quoted 8 lines · Andreas Kemnade
Quoted 5 lines · On Tue, 13 Feb 2024 12:56:40 +0200 Tony Lindgren <[email protected]> wrote:

Hi all,

This series updates the clksel clocks to use the standard reg property instead of ti,bit-shift.

Quoted 8 lines
Quoted 3 lines

I'd like to apply these before we make further use of the clksel clocks to reduce the dtb check warnings.

hmm, we still have ti,bit-shift if these clocks are not used below a ti,clksel. Just wondering, can we completely deorbit ti,bit-shift if we used #address-cells = <2>; in those cases? I wait a bit with further txt->yaml conversions until this is settled.

No need to wait on the yaml conversion I think :) How about just tag the ti,bit-shift property as deprecated? And add a comment saying it is only needed for the remaining unconnected clocks.

Eventually we can move all the component clocks under clksel clocks, or the related clock such as the dpll clock for the clkdcoldo clocks.

Regards,

Tony

author maintainer
#11 lore raw
Quoted 18 lines · Tony Lindgren
Quoted 8 lines · Andreas Kemnade
Quoted 5 lines · On Tue, 13 Feb 2024 12:56:40 +0200 Tony Lindgren <[email protected]> wrote:

Hi all,

This series updates the clksel clocks to use the standard reg property instead of ti,bit-shift.

Quoted 8 lines
Quoted 3 lines

I'd like to apply these before we make further use of the clksel clocks to reduce the dtb check warnings.

hmm, we still have ti,bit-shift if these clocks are not used below a ti,clksel. Just wondering, can we completely deorbit ti,bit-shift if we used #address-cells = <2>; in those cases? I wait a bit with further txt->yaml conversions until this is settled.

Quoted 6 lines

No need to wait on the yaml conversion I think :) How about just tag the ti,bit-shift property as deprecated? And add a comment saying it is only needed for the remaining unconnected clocks.

Eventually we can move all the component clocks under clksel clocks, or the related clock such as the dpll clock for the clkdcoldo clocks.

Oh and yes, using #clock-cells = <2> would be nice eventually :) I think the clkcel binding already supports that. But that still leaves the issue of unconnected composite clocks.. I'm pretty sure they all have some real parent like clksel for dpll though.

If you had some good idea in mind for the #address-cells = <2> for the remaining unconnected composite clocks maybe clarify it a bit.

Regards,

Tony

maintainer
#12 lore raw

Hi Tony,

Quoted 26 lines · On Thu, 29 Feb 2024 09:06:26 +0200 Tony Lindgren <[email protected]> wrote:
Quoted 18 lines · Tony Lindgren
Quoted 8 lines · Andreas Kemnade
Quoted 5 lines · On Tue, 13 Feb 2024 12:56:40 +0200 Tony Lindgren <[email protected]> wrote:

Hi all,

This series updates the clksel clocks to use the standard reg property instead of ti,bit-shift.

Quoted 8 lines
Quoted 3 lines

I'd like to apply these before we make further use of the clksel clocks to reduce the dtb check warnings.

hmm, we still have ti,bit-shift if these clocks are not used below a ti,clksel. Just wondering, can we completely deorbit ti,bit-shift if we used #address-cells = <2>; in those cases? I wait a bit with further txt->yaml conversions until this is settled.

Quoted 6 lines

No need to wait on the yaml conversion I think :) How about just tag the ti,bit-shift property as deprecated? And add a comment saying it is only needed for the remaining unconnected clocks.

Eventually we can move all the component clocks under clksel clocks, or the related clock such as the dpll clock for the clkdcoldo clocks.

Quoted 8 lines

Oh and yes, using #clock-cells = <2> would be nice eventually :) I think the clkcel binding already supports that. But that still leaves the issue of unconnected composite clocks.. I'm pretty sure they all have some real parent like clksel for dpll though.

If you had some good idea in mind for the #address-cells = <2> for the remaining unconnected composite clocks maybe clarify it a bit.

I was just wondering whether we could do reg = <register bit> then.

Regards,
Andreas

author maintainer
#13 lore raw
Quoted 5 lines · Andreas Kemnade
Quoted 3 lines · Tony Lindgren

If you had some good idea in mind for the #address-cells = <2> for the remaining unconnected composite clocks maybe clarify it a bit.

I was just wondering whether we could do reg = <register bit> then.

Yeah sure nothing stopping us from doing that too if it helps :)

Regards,

Tony