linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node
@ 2020-10-21 10:28 Ahmad Fatoum
  2020-10-21 10:28 ` [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon Ahmad Fatoum
  2020-10-26 14:36 ` [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Rob Herring
  0 siblings, 2 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2020-10-21 10:28 UTC (permalink / raw)
  To: Maxime Coquelin, Alexandre Torgue, Christophe Roullier
  Cc: kernel, Arnaud Pouliquen, Ahmad Fatoum, Rob Herring, devicetree,
	linux-stm32, linux-arm-kernel, linux-kernel

The stm32mp1 TAMP (Tamper and backup registers) does tamper detection
and features 32 backup registers that, being in the RTC domain, may
survive even with Vdd switched off.

This makes it suitable for use to communicate a reboot mode from OS
to bootloader via the syscon-reboot-mode binding. Add a "simple-mfd"
to support probing such a child node. The actual reboot mode
node could then be defined in a board.dts or fixed up by the bootloader.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 available here:
https://lore.kernel.org/linux-arm-kernel/20200916142216.25142-1-a.fatoum@pengutronix.de/

v1 -> v2:
 - new patch, rebased on top of
   https://lore.kernel.org/r/20201014125441.2457-1-arnaud.pouliquen@st.com
---
 .../devicetree/bindings/arm/stm32/st,stm32-syscon.yaml       | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
index 6634b3e0853e..4684017a42e4 100644
--- a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
+++ b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
@@ -19,8 +19,11 @@ properties:
               - st,stm32mp151-pwr-mcu
               - st,stm32-syscfg
               - st,stm32-power-config
-              - st,stm32-tamp
           - const: syscon
+      - items:
+          - const: st,stm32-tamp
+          - const: syscon
+          - const: simple-mfd
 
   reg:
     maxItems: 1
-- 
2.28.0


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

* [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon
  2020-10-21 10:28 [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Ahmad Fatoum
@ 2020-10-21 10:28 ` Ahmad Fatoum
  2020-11-17 11:18   ` Alexandre Torgue
  2020-10-26 14:36 ` [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Rob Herring
  1 sibling, 1 reply; 7+ messages in thread
From: Ahmad Fatoum @ 2020-10-21 10:28 UTC (permalink / raw)
  To: Rob Herring, Maxime Coquelin, Alexandre Torgue
  Cc: kernel, Arnaud Pouliquen, Ahmad Fatoum, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel

The stm32mp1 TAMP peripheral has 32 backup registers that survive
a warm reset. This makes them suitable for storing a reboot
mode, which the vendor's kernel tree is already doing[0].

The actual syscon-reboot-mode child node can be added by a board.dts or
fixed up by the bootloader. For the child node to be probed, the
compatible needs to include simple-mfd. The binding now specifies this,
so have the SoC dtsi adhere to it.

[0]: https://github.com/STMicroelectronics/linux/commit/2e9bfc29dd

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - Dropped simple-bus. simple-mfd is all that's needed
  - reworded commit message
---
 arch/arm/boot/dts/stm32mp151.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
index 842ecffae73a..662c2408d41b 100644
--- a/arch/arm/boot/dts/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/stm32mp151.dtsi
@@ -1542,7 +1542,7 @@ i2c6: i2c@5c009000 {
 		};
 
 		tamp: tamp@5c00a000 {
-			compatible = "st,stm32-tamp", "syscon";
+			compatible = "st,stm32-tamp", "syscon", "simple-mfd";
 			reg = <0x5c00a000 0x400>;
 		};
 
-- 
2.28.0


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

* Re: [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node
  2020-10-21 10:28 [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Ahmad Fatoum
  2020-10-21 10:28 ` [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon Ahmad Fatoum
@ 2020-10-26 14:36 ` Rob Herring
  2020-10-26 21:30   ` Ahmad Fatoum
  1 sibling, 1 reply; 7+ messages in thread
From: Rob Herring @ 2020-10-26 14:36 UTC (permalink / raw)
  To: Ahmad Fatoum
  Cc: Maxime Coquelin, Alexandre Torgue, Christophe Roullier, kernel,
	Arnaud Pouliquen, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel

On Wed, Oct 21, 2020 at 12:28:55PM +0200, Ahmad Fatoum wrote:
> The stm32mp1 TAMP (Tamper and backup registers) does tamper detection
> and features 32 backup registers that, being in the RTC domain, may
> survive even with Vdd switched off.
> 
> This makes it suitable for use to communicate a reboot mode from OS
> to bootloader via the syscon-reboot-mode binding. Add a "simple-mfd"
> to support probing such a child node. The actual reboot mode
> node could then be defined in a board.dts or fixed up by the bootloader.

'simple-mfd' implies there is no dependency on the parent node for the 
child (such as the regmap perhaps). Is that the case here?

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 available here:
> https://lore.kernel.org/linux-arm-kernel/20200916142216.25142-1-a.fatoum@pengutronix.de/
> 
> v1 -> v2:
>  - new patch, rebased on top of
>    https://lore.kernel.org/r/20201014125441.2457-1-arnaud.pouliquen@st.com
> ---
>  .../devicetree/bindings/arm/stm32/st,stm32-syscon.yaml       | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> index 6634b3e0853e..4684017a42e4 100644
> --- a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> +++ b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> @@ -19,8 +19,11 @@ properties:
>                - st,stm32mp151-pwr-mcu
>                - st,stm32-syscfg
>                - st,stm32-power-config
> -              - st,stm32-tamp
>            - const: syscon
> +      - items:
> +          - const: st,stm32-tamp
> +          - const: syscon
> +          - const: simple-mfd
>  
>    reg:
>      maxItems: 1
> -- 
> 2.28.0
> 

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

* Re: [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node
  2020-10-26 14:36 ` [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Rob Herring
@ 2020-10-26 21:30   ` Ahmad Fatoum
  2020-10-27 12:15     ` Rob Herring
  0 siblings, 1 reply; 7+ messages in thread
From: Ahmad Fatoum @ 2020-10-26 21:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: Maxime Coquelin, Alexandre Torgue, Christophe Roullier, kernel,
	Arnaud Pouliquen, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel

Hello Rob,

On 10/26/20 3:36 PM, Rob Herring wrote:
> On Wed, Oct 21, 2020 at 12:28:55PM +0200, Ahmad Fatoum wrote:
>> The stm32mp1 TAMP (Tamper and backup registers) does tamper detection
>> and features 32 backup registers that, being in the RTC domain, may
>> survive even with Vdd switched off.
>>
>> This makes it suitable for use to communicate a reboot mode from OS
>> to bootloader via the syscon-reboot-mode binding. Add a "simple-mfd"
>> to support probing such a child node. The actual reboot mode
>> node could then be defined in a board.dts or fixed up by the bootloader.
> 
> 'simple-mfd' implies there is no dependency on the parent node for the 
> child (such as the regmap perhaps). Is that the case here?

No, there's a dependency and the Linux driver does syscon_node_to_regmap
on the device tree node's parent but that's how the syscon-reboot-mode binding
is documented:

  The SYSCON mapped register is retrieved from the
  parental dt-node plus the offset. So the SYSCON reboot-mode node
  should be represented as a sub-node of a "syscon", "simple-mfd" node.

How would you prefer this being done instead?

Cheers,
Ahmad

> 
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> v1 available here:
>> https://lore.kernel.org/linux-arm-kernel/20200916142216.25142-1-a.fatoum@pengutronix.de/
>>
>> v1 -> v2:
>>  - new patch, rebased on top of
>>    https://lore.kernel.org/r/20201014125441.2457-1-arnaud.pouliquen@st.com
>> ---
>>  .../devicetree/bindings/arm/stm32/st,stm32-syscon.yaml       | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
>> index 6634b3e0853e..4684017a42e4 100644
>> --- a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
>> +++ b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
>> @@ -19,8 +19,11 @@ properties:
>>                - st,stm32mp151-pwr-mcu
>>                - st,stm32-syscfg
>>                - st,stm32-power-config
>> -              - st,stm32-tamp
>>            - const: syscon
>> +      - items:
>> +          - const: st,stm32-tamp
>> +          - const: syscon
>> +          - const: simple-mfd
>>  
>>    reg:
>>      maxItems: 1
>> -- 
>> 2.28.0
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node
  2020-10-26 21:30   ` Ahmad Fatoum
@ 2020-10-27 12:15     ` Rob Herring
  2020-11-10 10:27       ` Ahmad Fatoum
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2020-10-27 12:15 UTC (permalink / raw)
  To: Ahmad Fatoum
  Cc: Maxime Coquelin, Alexandre Torgue, Christophe Roullier,
	Sascha Hauer, Arnaud Pouliquen, devicetree,
	moderated list:ARM/STM32 ARCHITECTURE, linux-arm-kernel,
	linux-kernel

On Mon, Oct 26, 2020 at 4:30 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> Hello Rob,
>
> On 10/26/20 3:36 PM, Rob Herring wrote:
> > On Wed, Oct 21, 2020 at 12:28:55PM +0200, Ahmad Fatoum wrote:
> >> The stm32mp1 TAMP (Tamper and backup registers) does tamper detection
> >> and features 32 backup registers that, being in the RTC domain, may
> >> survive even with Vdd switched off.
> >>
> >> This makes it suitable for use to communicate a reboot mode from OS
> >> to bootloader via the syscon-reboot-mode binding. Add a "simple-mfd"
> >> to support probing such a child node. The actual reboot mode
> >> node could then be defined in a board.dts or fixed up by the bootloader.
> >
> > 'simple-mfd' implies there is no dependency on the parent node for the
> > child (such as the regmap perhaps). Is that the case here?
>
> No, there's a dependency and the Linux driver does syscon_node_to_regmap
> on the device tree node's parent but that's how the syscon-reboot-mode binding
> is documented:
>
>   The SYSCON mapped register is retrieved from the
>   parental dt-node plus the offset. So the SYSCON reboot-mode node
>   should be represented as a sub-node of a "syscon", "simple-mfd" node.
>
> How would you prefer this being done instead?

Well, probably the syscon driver could just probe any children, but
I'm not sure if that would break anyone. So I guess fine as-is.

Reviewed-by: Rob Herring <robh@kernel.org>

Rob

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

* Re: [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node
  2020-10-27 12:15     ` Rob Herring
@ 2020-11-10 10:27       ` Ahmad Fatoum
  0 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2020-11-10 10:27 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: Maxime Coquelin, Alexandre Torgue, Christophe Roullier,
	Sascha Hauer, Arnaud Pouliquen, devicetree,
	moderated list:ARM/STM32 ARCHITECTURE, linux-arm-kernel,
	linux-kernel, Rob Herring

Hello Alex,

On 10/27/20 1:15 PM, Rob Herring wrote:
> On Mon, Oct 26, 2020 at 4:30 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>>
>> Hello Rob,
>>
>> On 10/26/20 3:36 PM, Rob Herring wrote:
>>> On Wed, Oct 21, 2020 at 12:28:55PM +0200, Ahmad Fatoum wrote:
>>>> The stm32mp1 TAMP (Tamper and backup registers) does tamper detection
>>>> and features 32 backup registers that, being in the RTC domain, may
>>>> survive even with Vdd switched off.
>>>>
>>>> This makes it suitable for use to communicate a reboot mode from OS
>>>> to bootloader via the syscon-reboot-mode binding. Add a "simple-mfd"
>>>> to support probing such a child node. The actual reboot mode
>>>> node could then be defined in a board.dts or fixed up by the bootloader.
>>>
>>> 'simple-mfd' implies there is no dependency on the parent node for the
>>> child (such as the regmap perhaps). Is that the case here?
>>
>> No, there's a dependency and the Linux driver does syscon_node_to_regmap
>> on the device tree node's parent but that's how the syscon-reboot-mode binding
>> is documented:
>>
>>   The SYSCON mapped register is retrieved from the
>>   parental dt-node plus the offset. So the SYSCON reboot-mode node
>>   should be represented as a sub-node of a "syscon", "simple-mfd" node.
>>
>> How would you prefer this being done instead?
> 
> Well, probably the syscon driver could just probe any children, but
> I'm not sure if that would break anyone. So I guess fine as-is.
> 
> Reviewed-by: Rob Herring <robh@kernel.org>

Gentle ping.

> 
> Rob
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon
  2020-10-21 10:28 ` [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon Ahmad Fatoum
@ 2020-11-17 11:18   ` Alexandre Torgue
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Torgue @ 2020-11-17 11:18 UTC (permalink / raw)
  To: Ahmad Fatoum, Rob Herring, Maxime Coquelin
  Cc: kernel, Arnaud Pouliquen, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel

Hi Ahmad

On 10/21/20 12:28 PM, Ahmad Fatoum wrote:
> The stm32mp1 TAMP peripheral has 32 backup registers that survive
> a warm reset. This makes them suitable for storing a reboot
> mode, which the vendor's kernel tree is already doing[0].
> 
> The actual syscon-reboot-mode child node can be added by a board.dts or
> fixed up by the bootloader. For the child node to be probed, the
> compatible needs to include simple-mfd. The binding now specifies this,
> so have the SoC dtsi adhere to it.
> 
> [0]: https://github.com/STMicroelectronics/linux/commit/2e9bfc29dd
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 -> v2:
>    - Dropped simple-bus. simple-mfd is all that's needed
>    - reworded commit message
> ---
>   arch/arm/boot/dts/stm32mp151.dtsi | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
> index 842ecffae73a..662c2408d41b 100644
> --- a/arch/arm/boot/dts/stm32mp151.dtsi
> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> @@ -1542,7 +1542,7 @@ i2c6: i2c@5c009000 {
>   		};
>   
>   		tamp: tamp@5c00a000 {
> -			compatible = "st,stm32-tamp", "syscon";
> +			compatible = "st,stm32-tamp", "syscon", "simple-mfd";
>   			reg = <0x5c00a000 0x400>;
>   		};
>   
> 

Series applied on stm32-next.

Regards
Alex

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

end of thread, other threads:[~2020-11-17 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 10:28 [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Ahmad Fatoum
2020-10-21 10:28 ` [PATCH v2 2/2] ARM: dts: stm32: support child mfd cells for the stm32mp1 TAMP syscon Ahmad Fatoum
2020-11-17 11:18   ` Alexandre Torgue
2020-10-26 14:36 ` [PATCH v2 1/2] dt-bindings: arm: stm32: add simple-mfd compatible for tamp node Rob Herring
2020-10-26 21:30   ` Ahmad Fatoum
2020-10-27 12:15     ` Rob Herring
2020-11-10 10:27       ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).