Skip to contentSkip to conversation

dt-bindings: serial: 8250: allow "main" and "uart" as clock names

PATCH Superseded Alex Elder 3 participants 6 messages Jul 28, 2025 – Jul 29, 2025

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 dt-bindings: serial: 8250: allow "main" and "uart" as clock names

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
 .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +14 -5
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
             - const: uartclk
             - const: reg
     else:
-      properties:
-        clock-names:
-          items:
-            - const: core
-            - const: bus
+      if:
+        properties:
+          compatible:
+            contains:
+              const: spacemit,k1-uart
+      then:
+        properties:
+          clock-names:
+            items:
+              - const: core
+              - const: bus
 
 properties:
   compatible:
@@ -162,6 +168,9 @@ properties:
     minItems: 1
     maxItems: 2
     oneOf:
+      - enum:
+          - main
+          - uart
       - items:
           - const: core
           - const: bus

base-commit: 0b90c3b6d76ea512dc3dac8fb30215e175b0019a

Signature · 1 line
2.48.1
#1 lore raw

Hi Alex,

Quoted 35 lines · Alex Elder

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
 .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +0 -0
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
             - const: uartclk
             - const: reg

..

Quoted 1 line

else:

would it be better to drop this 'else', and moving following 'if' block to the same level with "nxp,lpc1850-uart"?

the reason here would avoid too many indentions if add more constraint in the future if other SoC uart need different clock-names..

Quoted 34 lines
Documentation/devicetree/bindings/serial/8250.yaml +14 -5
-      properties:
-        clock-names:
-          items:
-            - const: core
-            - const: bus
+      if:
+        properties:
+          compatible:
+            contains:
+              const: spacemit,k1-uart
+      then:
+        properties:
+          clock-names:
+            items:
+              - const: core
+              - const: bus
 
 properties:
   compatible:
@@ -162,6 +168,9 @@ properties:
     minItems: 1
     maxItems: 2
     oneOf:
+      - enum:
+          - main
+          - uart
       - items:
           - const: core
           - const: bus

base-commit: 0b90c3b6d76ea512dc3dac8fb30215e175b0019a

Signature · 1 line
2.48.1
Signature · 1 line
Yixun Lan (dlan)
#2 lore raw
Quoted 39 lines · Yixun Lan

Hi Alex,

Quoted 35 lines · Alex Elder

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
 .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +0 -0
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
             - const: uartclk
             - const: reg

..

Quoted 6 lines
Quoted 1 line

else:

would it be better to drop this 'else', and moving following 'if' block to the same level with "nxp,lpc1850-uart"?

the reason here would avoid too many indentions if add more constraint in the future if other SoC uart need different clock-names..

I agree, it's more typical to do it that way I think to boot.

Also, why is there a k1/lpc conditional bit that is not part of the allOf in addition to the bits in the allOf? Can that get merged with the allOf please?

author
#3 lore raw
Quoted 44 lines · Conor Dooley
Quoted 43 lines · Yixun Lan

Hi Alex,

Quoted 35 lines · Alex Elder

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
  .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
  1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +0 -0
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
              - const: uartclk
              - const: reg

..

Quoted 1 line

else:

would it be better to drop this 'else', and moving following 'if' block to the same level with "nxp,lpc1850-uart"?

Quoted 8 lines
Quoted 2 lines

the reason here would avoid too many indentions if add more constraint in the future if other SoC uart need different clock-names..

I agree, it's more typical to do it that way I think to boot.

Also, why is there a k1/lpc conditional bit that is not part of the allOf in addition to the bits in the allOf? Can that get merged with the allOf please?

Are you talking about the blank line here?

then:
oneOf:
- required: [ clock-frequency ]
- required: [ clocks ]
<------ this blank line
- if:

      properties:
        compatible:
          contains:
            const: nxp,lpc1850-uart
    then:

I didn't notice that before. It got inserted with commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart").

If so, yes I'll remove that as well when I update the patch to get rid of the else as Yixun suggests.

Greg won't take this for a couple weeks so I'll hold off sending v2 for a while.

-Alex

#4 lore raw
Quoted 48 lines · Alex Elder
Quoted 47 lines · Conor Dooley
Quoted 45 lines · Yixun Lan

Hi Alex,

Quoted 35 lines · Alex Elder

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
  .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
  1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +0 -0
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
              - const: uartclk
              - const: reg

..

Quoted 1 line

else:

would it be better to drop this 'else', and moving following 'if' block to the same level with "nxp,lpc1850-uart"?

the reason here would avoid too many indentions if add more constraint in the future if other SoC uart need different clock-names..

Quoted 7 lines
Quoted 5 lines

I agree, it's more typical to do it that way I think to boot.

Also, why is there a k1/lpc conditional bit that is not part of the allOf in addition to the bits in the allOf? Can that get merged with the allOf please?

Are you talking about the blank line here?

No, I'm talking about what's down around line 270 in the binding.

Quoted 25 lines

then:
oneOf:
- required: [ clock-frequency ]
- required: [ clocks ]
<------ this blank line
- if:

      properties:
        compatible:
          contains:
            const: nxp,lpc1850-uart
    then:

I didn't notice that before. It got inserted with commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart").

If so, yes I'll remove that as well when I update the patch to get rid of the else as Yixun suggests.

Greg won't take this for a couple weeks so I'll hold off sending v2 for a while.

-Alex

author
#5 lore raw
Quoted 51 lines · Conor Dooley
Quoted 50 lines · Alex Elder
Quoted 49 lines · Conor Dooley
Quoted 39 lines · Yixun Lan

Hi Alex,

Quoted 35 lines · Alex Elder

There are two compatible strings defined in "8250.yaml" that require two clocks to be specified, along with their names:
- "spacemit,k1-uart", used in "spacemit/k1.dtsi"
- "nxp,lpc1850-uart", used in "lpc/lpc18xx.dtsi"

When only one clock is used, the name is not required. However there are two places that do specify a name:
- In "mediatek/mt7623.dtsi", the clock for the "mediatek,mtk-btif" compatible serial device is named "main"
- In "qca/ar9132.dtsi", the clock for the "ns8250" compatible serial device is named "uart"

In commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart"), Frank Li added the restriction that two named clocks be used for the NXP platform mentioned above. Extend that so that the two named clocks used by the SpacemiT platform are similarly restricted.

Add "main" and "uart" as allowed names when a single clock is specified.

Fixes 2c0594f9f0629 ("dt-bindings: serial: 8250: support an optional second clock")
---
   .../devicetree/bindings/serial/8250.yaml      | 19 ++++++++++++++-----
   1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/serial/8250.yaml +0 -0
index e46bee8d25bf0..cef52ebd8f7da 100644
@@ -61,11 +61,17 @@ allOf:
               - const: uartclk
               - const: reg

..

Quoted 6 lines
Quoted 1 line

else:

would it be better to drop this 'else', and moving following 'if' block to the same level with "nxp,lpc1850-uart"?

the reason here would avoid too many indentions if add more constraint in the future if other SoC uart need different clock-names..

I agree, it's more typical to do it that way I think to boot.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Also, why is there a k1/lpc conditional bit that is not part of the allOf in addition to the bits in the allOf? Can that get merged with the allOf please?

Are you talking about the blank line here?

No, I'm talking about what's down around line 270 in the binding.

Oh wow that's in a weird spot, and it might be redundant?

Anyway I'll work on getting that fixed too before I send my next version.

-Alex

Quoted 25 lines
Quoted 25 lines

then:
oneOf:
- required: [ clock-frequency ]
- required: [ clocks ]
<------ this blank line
- if:

       properties:
         compatible:
           contains:
             const: nxp,lpc1850-uart
     then:

I didn't notice that before. It got inserted with commit d2db0d7815444 ("dt-bindings: serial: 8250: allow clock 'uartclk' and 'reg' for nxp,lpc1850-uart").

If so, yes I'll remove that as well when I update the patch to get rid of the else as Yixun suggests.

Greg won't take this for a couple weeks so I'll hold off sending v2 for a while.

-Alex