[PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function

Antonio Borneo posted 14 patches 1 month ago
[PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function
Posted by Antonio Borneo 1 month ago
From: Fabien Dessenne <fabien.dessenne@foss.st.com>

Document the RSVD (Reserved) mux function, used to reserve pins
for a coprocessor not running Linux.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 .../devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml     | 8 ++++++++
 include/dt-bindings/pinctrl/stm32-pinfunc.h               | 1 +
 2 files changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
index a28d77748095a..5d17d6487ae9c 100644
--- a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
@@ -160,9 +160,13 @@ patternProperties:
               * ...
               * 16 : Alternate Function 15
               * 17 : Analog
+              * 18 : Reserved
               To simplify the usage, macro is available to generate "pinmux" field.
               This macro is available here:
                 - include/dt-bindings/pinctrl/stm32-pinfunc.h
+              Setting the pinmux's function to the Reserved (RSVD) value is used to inform
+              the driver that it shall not apply the mux setting. This can be used to
+              reserve some pins, for example to a co-processor not running Linux.
               Some examples of using macro:
                /* GPIO A9 set as alternate function 2 */
                ... {
@@ -176,6 +180,10 @@ patternProperties:
                ... {
                           pinmux = <STM32_PINMUX('A', 9, ANALOG)>;
                };
+               /* GPIO A9 reserved for co-processor */
+               ... {
+                          pinmux = <STM32_PINMUX('A', 9, RSVD)>;
+               };
 
           bias-disable:
             type: boolean
diff --git a/include/dt-bindings/pinctrl/stm32-pinfunc.h b/include/dt-bindings/pinctrl/stm32-pinfunc.h
index 28ad0235086a6..af3fd388329a0 100644
--- a/include/dt-bindings/pinctrl/stm32-pinfunc.h
+++ b/include/dt-bindings/pinctrl/stm32-pinfunc.h
@@ -26,6 +26,7 @@
 #define AF14	0xf
 #define AF15	0x10
 #define ANALOG	0x11
+#define RSVD	0x12
 
 /* define Pins number*/
 #define PIN_NO(port, line)	(((port) - 'A') * 0x10 + (line))
-- 
2.34.1
Re: [PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function
Posted by Krzysztof Kozlowski 1 month ago
On Tue, Oct 22, 2024 at 05:56:48PM +0200, Antonio Borneo wrote:
> From: Fabien Dessenne <fabien.dessenne@foss.st.com>
> 
> Document the RSVD (Reserved) mux function, used to reserve pins
> for a coprocessor not running Linux.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> ---
>  .../devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml     | 8 ++++++++
>  include/dt-bindings/pinctrl/stm32-pinfunc.h               | 1 +
>  2 files changed, 9 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Re: [PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function
Posted by Krzysztof Kozlowski 1 month ago
On Tue, Oct 22, 2024 at 05:56:48PM +0200, Antonio Borneo wrote:
> From: Fabien Dessenne <fabien.dessenne@foss.st.com>
> 
> Document the RSVD (Reserved) mux function, used to reserve pins
> for a coprocessor not running Linux.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> ---
>  .../devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml     | 8 ++++++++
>  include/dt-bindings/pinctrl/stm32-pinfunc.h               | 1 +
>  2 files changed, 9 insertions(+)
> 

BTW, which *existing* SoCs use it? Aren't you adding it for the new
platform?

Best regards,
Krzysztof
Re: [PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function
Posted by Antonio Borneo 1 month ago
On Wed, 2024-10-23 at 10:47 +0200, Krzysztof Kozlowski wrote:
> On Tue, Oct 22, 2024 at 05:56:48PM +0200, Antonio Borneo wrote:
> > From: Fabien Dessenne <fabien.dessenne@foss.st.com>
> > 
> > Document the RSVD (Reserved) mux function, used to reserve pins
> > for a coprocessor not running Linux.
> > 
> > Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
> > Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> > ---
> >  .../devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml     | 8 ++++++++
> >  include/dt-bindings/pinctrl/stm32-pinfunc.h               | 1 +
> >  2 files changed, 9 insertions(+)
> > 
> 
> BTW, which *existing* SoCs use it? Aren't you adding it for the new
> platform?
> 

This is already used in ST downstream kernel for STM32MP15x
In this example
https://github.com/STMicroelectronics/linux/blob/v6.1-stm32mp/arch/arm/boot/dts/stm32mp157f-dk2-m4-examples.dts#L112

the GPIOs for LED and for PWM are assigned to the Cortex-M4 and Linux (on Cortex-A7) is not supposed to touch them.

Regards,
Antonio
Re: [PATCH 04/14] dt-bindings: pinctrl: stm32: add RSVD mux function
Posted by Krzysztof Kozlowski 1 month ago
On 23/10/2024 10:56, Antonio Borneo wrote:
> On Wed, 2024-10-23 at 10:47 +0200, Krzysztof Kozlowski wrote:
>> On Tue, Oct 22, 2024 at 05:56:48PM +0200, Antonio Borneo wrote:
>>> From: Fabien Dessenne <fabien.dessenne@foss.st.com>
>>>
>>> Document the RSVD (Reserved) mux function, used to reserve pins
>>> for a coprocessor not running Linux.
>>>
>>> Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
>>> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
>>> ---
>>>  .../devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml     | 8 ++++++++
>>>  include/dt-bindings/pinctrl/stm32-pinfunc.h               | 1 +
>>>  2 files changed, 9 insertions(+)
>>>
>>
>> BTW, which *existing* SoCs use it? Aren't you adding it for the new
>> platform?
>>
> 
> This is already used in ST downstream kernel for STM32MP15x
> In this example
> https://github.com/STMicroelectronics/linux/blob/v6.1-stm32mp/arch/arm/boot/dts/stm32mp157f-dk2-m4-examples.dts#L112
> 
> the GPIOs for LED and for PWM are assigned to the Cortex-M4 and Linux (on Cortex-A7) is not supposed to touch them.

I wasn't clear. Which upstream uses it? We really could not care less
about downstream vendor code.

Best regards,
Krzysztof