Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/2] UFS: Add reference clock support for AMD Versal2
@ 2026-11-25  9:23 Ajay Neeli
  2026-11-25  9:23 ` [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name Ajay Neeli
  2026-11-25  9:23 ` [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock Ajay Neeli
  0 siblings, 2 replies; 5+ messages in thread
From: Ajay Neeli @ 2026-11-25  9:23 UTC (permalink / raw)
  To: James.Bottomley, mkp, robh, krzk+dt, conor+dt
  Cc: sai.krishna.potthuri, alim.akhtar, can.guo, geert+renesas, mani,
	bvanassche, beanhuo, linux-scsi, devicetree, git, michal.simek,
	srinivas.goud, radhey.shyam.pandey, Ajay Neeli

This series adds reference clock support for AMD Versal2 UFS.

The first patch updates the common UFS platform code to recognize "ref"
as the reference clock name while retaining support for "ref_clk" for
existing devicetree users.

The second patch adds the reference clock to the AMD Versal2 UFS
devicetree binding.

Link: https://lore.kernel.org/all/20261111043840.906301-1-ajay.neeli@amd.com/

---
Changes in v2:
- Add descriptions for individual clocks.
- Use "ref" instead of "ref_clk" for the AMD binding.
- Update the common UFS platform code to support "ref" while retaining
  compatibility with existing "ref_clk" users.
---

Ajay Neeli (2):
  scsi: ufs: core: Support "ref" clock name
  dt-bindings: ufs: amd,versal2-ufs: Add reference clock

 .../devicetree/bindings/ufs/amd,versal2-ufs.yaml      | 11 +++++++----
 drivers/ufs/host/ufshcd-pltfrm.c                      |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.43.7


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name
  2026-11-25  9:23 [PATCH v2 0/2] UFS: Add reference clock support for AMD Versal2 Ajay Neeli
@ 2026-11-25  9:23 ` Ajay Neeli
  2026-11-25  9:32   ` sashiko-bot
  2026-11-25  9:23 ` [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock Ajay Neeli
  1 sibling, 1 reply; 5+ messages in thread
From: Ajay Neeli @ 2026-11-25  9:23 UTC (permalink / raw)
  To: James.Bottomley, mkp, robh, krzk+dt, conor+dt
  Cc: sai.krishna.potthuri, alim.akhtar, can.guo, geert+renesas, mani,
	bvanassche, beanhuo, linux-scsi, devicetree, git, michal.simek,
	srinivas.goud, radhey.shyam.pandey, Ajay Neeli

The UFS platform code identifies the reference clock by the "ref_clk"
clock name and marks it to keep the link active.

Allow "ref" to be used as the reference clock name, while retaining
support for "ref_clk" for compatibility with existing devicetree
bindings.

Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
---
 drivers/ufs/host/ufshcd-pltfrm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c
index 169dbc1a75fe..947edcd88668 100644
--- a/drivers/ufs/host/ufshcd-pltfrm.c
+++ b/drivers/ufs/host/ufshcd-pltfrm.c
@@ -96,7 +96,7 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
 			goto out;
 		}
 
-		if (!strcmp(name, "ref_clk"))
+		if (!strcmp(name, "ref") || !strcmp(name, "ref_clk"))
 			clki->keep_link_active = true;
 		dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz",
 				clki->min_freq, clki->max_freq, clki->name);
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock
  2026-11-25  9:23 [PATCH v2 0/2] UFS: Add reference clock support for AMD Versal2 Ajay Neeli
  2026-11-25  9:23 ` [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name Ajay Neeli
@ 2026-11-25  9:23 ` Ajay Neeli
  2026-11-25  9:35   ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Ajay Neeli @ 2026-11-25  9:23 UTC (permalink / raw)
  To: James.Bottomley, mkp, robh, krzk+dt, conor+dt
  Cc: sai.krishna.potthuri, alim.akhtar, can.guo, geert+renesas, mani,
	bvanassche, beanhuo, linux-scsi, devicetree, git, michal.simek,
	srinivas.goud, radhey.shyam.pandey, Ajay Neeli

Add the reference clock supplied to the UFS device.

The AMD Versal2 UFS controller operates with a 26 MHz reference clock.
UFS 3.x devices default their bRefClkFreq attribute to 26 MHz, matching
the controller, so no explicit configuration is needed. However, UFS 4.0
and later devices default bRefClkFreq to 52 MHz, expecting a 52 MHz
reference clock. This mismatch causes timing violations and link
instability.

Add the reference clock to allow the UFS driver to obtain its frequency
from devicetree and program the device bRefClkFreq attribute accordingly
during initialization.

Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
---
 .../devicetree/bindings/ufs/amd,versal2-ufs.yaml      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml b/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
index c00ec342d574..11138578975f 100644
--- a/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
+++ b/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
@@ -20,11 +20,14 @@ properties:
     maxItems: 1
 
   clocks:
-    maxItems: 1
+    items:
+      - description: UFS core clock
+      - description: UFS reference clock
 
   clock-names:
     items:
       - const: core
+      - const: ref
 
   power-domains:
     maxItems: 1
@@ -52,10 +55,10 @@ examples:
     ufs@f10b0000 {
         compatible = "amd,versal2-ufs";
         reg = <0xf10b0000 0x1000>;
-        clocks = <&ufs_core_clk>;
-        clock-names = "core";
+        clocks = <&ufs_core_clk>, <&ufs_ref_clk>;
+        clock-names = "core", "ref";
         resets = <&scmi_reset 4>, <&scmi_reset 35>;
         reset-names = "host", "phy";
         interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH>;
-        freq-table-hz = <0 0>;
+        freq-table-hz = <0 0>, <26000000 26000000>;
     };
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name
  2026-11-25  9:23 ` [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name Ajay Neeli
@ 2026-11-25  9:32   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-25  9:32 UTC (permalink / raw)
  To: Ajay Neeli; +Cc: linux-scsi, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] scsi: ufs: missing ref clock name check in ufshcd_init_clocks()
- [Medium] scsi: ufs: missing ref clock name check in
  ufshcd_parse_operating_points()
--

commit 4196a48351e8b590f1bfcc4bbd914e822554236d
Author: Ajay Neeli <ajay.neeli@amd.com>

scsi: ufs: core: Support "ref" clock name

This commit updates ufshcd_parse_clock_info() to also match the "ref"
clock name when setting keep_link_active on the reference clock.

> diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c
> index 169dbc1a75fe5..947edcd886680 100644
> --- a/drivers/ufs/host/ufshcd-pltfrm.c
> +++ b/drivers/ufs/host/ufshcd-pltfrm.c
> @@ -96,7 +96,7 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
>  			goto out;
>  		}
>  
> -		if (!strcmp(name, "ref_clk"))
> +		if (!strcmp(name, "ref") || !strcmp(name, "ref_clk"))
>  			clki->keep_link_active = true;
>  		dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz",
>  				clki->min_freq, clki->max_freq, clki->name);

[Severity: High]
Should ufshcd_init_clocks() also check for "ref" when detecting the
device reference clock frequency?

drivers/ufs/core/ufshcd.c:ufshcd_init_clocks() {
    ...
		if (!strcmp(clki->name, "ref_clk"))
			ufshcd_parse_dev_ref_clk_freq(hba, clki->clk);
    ...
}

When the clock is named "ref", ufshcd_parse_dev_ref_clk_freq() is skipped
and hba->dev_ref_clk_freq remains REF_CLK_FREQ_INVAL unless a separate
ref-clk-freq property is present, so ufshcd_set_dev_ref_clk() will not
program the UFS device bRefClkFreq attribute before switching to
High-Speed mode.

[Severity: Medium]
Does ufshcd_parse_operating_points() in this file need the same "ref"
check?

drivers/ufs/host/ufshcd-pltfrm.c:ufshcd_parse_operating_points() {
    ...
		if (!strcmp(clk_names[i], "ref_clk"))
			clki->keep_link_active = true;
    ...
}

On platforms that use operating-points-v2 instead of freq-table-hz,
ufshcd_parse_clock_info() exits early and ufshcd_parse_operating_points()
populates hba->clk_list_head, leaving keep_link_active false for a "ref"
clock and allowing __ufshcd_setup_clocks() to disable the reference clock
while the link is active.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125092351.2807658-1-ajay.neeli@amd.com?part=1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock
  2026-11-25  9:23 ` [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock Ajay Neeli
@ 2026-11-25  9:35   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-25  9:35 UTC (permalink / raw)
  To: Ajay Neeli; +Cc: linux-scsi, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dt-bindings: ufs: amd,versal2-ufs: ref clock name ignored by
  ufshcd_init_clocks()
--

commit 533c5c18f1ac18e00d180f090ca93237f628f615
Author: Ajay Neeli <ajay.neeli@amd.com>

dt-bindings: ufs: amd,versal2-ufs: Add reference clock

This commit adds the reference clock and its "ref" clock-names entry to the
AMD Versal Gen 2 UFS devicetree binding schema so the driver can program the
device bRefClkFreq attribute.

> diff --git a/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml b/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
> index c00ec342d5743..11138578975f5 100644
> --- a/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
> +++ b/Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
> @@ -20,11 +20,14 @@ properties:
>      maxItems: 1
>  
>    clocks:
> -    maxItems: 1
> +    items:
> +      - description: UFS core clock
> +      - description: UFS reference clock
>  
>    clock-names:
>      items:
>        - const: core
> +      - const: ref

[Severity: Medium]
Will naming this clock "ref" actually allow the UFS core to parse the
reference clock frequency and program bRefClkFreq?

Earlier commit "scsi: ufs: core: Support "ref" clock name" updated
ufshcd_parse_clock_info() to set clki->keep_link_active for "ref", but
ufshcd_init_clocks() still only checks for "ref_clk":

drivers/ufs/core/ufshcd.c:ufshcd_init_clocks() {
    ...
		if (!strcmp(clki->name, "ref_clk"))
			ufshcd_parse_dev_ref_clk_freq(hba, clki->clk);
    ...
}

With clock-names set to "ref", hba->dev_ref_clk_freq remains
REF_CLK_FREQ_INVAL, so ufshcd_post_device_init() skips
ufshcd_set_dev_ref_clk() and leaves UFS 4.0+ devices at their 52 MHz default.
ufshcd_parse_operating_points() in drivers/ufs/host/ufshcd-pltfrm.c also
checks only for "ref_clk" when setting clki->keep_link_active.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125092351.2807658-1-ajay.neeli@amd.com?part=2

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-25  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  9:23 [PATCH v2 0/2] UFS: Add reference clock support for AMD Versal2 Ajay Neeli
2026-11-25  9:23 ` [PATCH v2 1/2] scsi: ufs: core: Support "ref" clock name Ajay Neeli
2026-11-25  9:32   ` sashiko-bot
2026-11-25  9:23 ` [PATCH v2 2/2] dt-bindings: ufs: amd,versal2-ufs: Add reference clock Ajay Neeli
2026-11-25  9:35   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox