[PATCH v2 02/15] dt-bindings: pinctrl: stm32: use strings for enum property 'st,package'

Antonio Borneo posted 15 patches 1 week, 6 days ago
[PATCH v2 02/15] dt-bindings: pinctrl: stm32: use strings for enum property 'st,package'
Posted by Antonio Borneo 1 week, 6 days ago
The property 'st,package' reports the SoC package used in the
board DT and is used to inform the driver about which pins are
available for use by the pinctrl driver.
It has historically been declared as an uint32 enum, where each
value is a power of 2.

Deprecate the use of the numeric value and replace it with more
readable string values.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 .../bindings/pinctrl/st,stm32-pinctrl.yaml     | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
index 76d956b4a5372..73277f515a8fe 100644
--- a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
@@ -58,11 +58,19 @@ properties:
           - description: The field mask of IRQ mux, needed if different of 0xf
 
   st,package:
-    description:
-      Indicates the SOC package used.
-      More details in include/dt-bindings/pinctrl/stm32-pinfunc.h
-    $ref: /schemas/types.yaml#/definitions/uint32
-    enum: [0x1, 0x2, 0x4, 0x8, 0x100, 0x400, 0x800]
+    description: Indicates the SOC package used.
+    oneOf:
+      - enum:
+          [0x1, 0x2, 0x4, 0x8, 0x100, 0x400, 0x800]
+        deprecated: true
+      - enum:
+          - AA
+          - AB
+          - AC
+          - AD
+          - AI
+          - AK
+          - AL
 
 patternProperties:
   '^gpio@[0-9a-f]*$':
-- 
2.34.1
Re: [PATCH v2 02/15] dt-bindings: pinctrl: stm32: use strings for enum property 'st,package'
Posted by Linus Walleij 1 week, 5 days ago
On Tue, Nov 18, 2025 at 5:20 PM Antonio Borneo
<antonio.borneo@foss.st.com> wrote:

> The property 'st,package' reports the SoC package used in the
> board DT and is used to inform the driver about which pins are
> available for use by the pinctrl driver.
> It has historically been declared as an uint32 enum, where each
> value is a power of 2.
>
> Deprecate the use of the numeric value and replace it with more
> readable string values.
>
> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>

I think Krzysztof is right about this, deprecate the property and
(re-)introduce it on the top level in:
Documentation/devicetree/bindings/arm/stm32/stm32.yaml

It may be a bit quirky to get to this property from the pin control
Linux driver, but it is the right thing to do.

The Vexpress has some inspirational top-level custom properties:
Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml

Yours,
Linus Walleij
Re: [PATCH v2 02/15] dt-bindings: pinctrl: stm32: use strings for enum property 'st,package'
Posted by Antonio Borneo 1 week, 4 days ago
On Wed, 2025-11-19 at 15:16 +0100, Linus Walleij wrote:
> On Tue, Nov 18, 2025 at 5:20 PM Antonio Borneo
> <antonio.borneo@foss.st.com> wrote:
> 
> > The property 'st,package' reports the SoC package used in the
> > board DT and is used to inform the driver about which pins are
> > available for use by the pinctrl driver.
> > It has historically been declared as an uint32 enum, where each
> > value is a power of 2.
> > 
> > Deprecate the use of the numeric value and replace it with more
> > readable string values.
> > 
> > Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> 
> I think Krzysztof is right about this, deprecate the property and
> (re-)introduce it on the top level in:
> Documentation/devicetree/bindings/arm/stm32/stm32.yaml
> 

Yes, I agree with Krzysztof comment. This is not a property that belongs to pinctrl.
I will deprecate it in the existing bindings.


> It may be a bit quirky to get to this property from the pin control
> Linux driver, but it is the right thing to do.
> 
> The Vexpress has some inspirational top-level custom properties:
> Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml

I was looking for some top-level custom property, but I've missed this. Thanks for the hint.

Best Regards,
Antonio
Re: [PATCH v2 02/15] dt-bindings: pinctrl: stm32: use strings for enum property 'st,package'
Posted by Krzysztof Kozlowski 1 week, 5 days ago
On Tue, Nov 18, 2025 at 05:19:23PM +0100, Antonio Borneo wrote:
> The property 'st,package' reports the SoC package used in the
> board DT and is used to inform the driver about which pins are
> available for use by the pinctrl driver.
> It has historically been declared as an uint32 enum, where each
> value is a power of 2.
> 
> Deprecate the use of the numeric value and replace it with more
> readable string values.

The "SoC package" is defined by top-level compatible or by soc info
driver. It is not the property of pinctrl, therefore if ever touching
this, you should deprecate entire property instead of growing it.

Best regards,
Krzysztof