Message ID | 20220504130617.331290-1-valentin.caron@foss.st.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | rtc: stm32: add alarm out and LSCO features. | expand |
On Wed, May 04, 2022 at 03:06:13PM +0200, Valentin Caron wrote: > STM32 RTC can pulse some SOC pins when an alarm of RTC expires. > > This patch adds property to activate alarm A output. The pulse can > output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP > (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). > > Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> > --- > .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > index 56d46ea35c5d..71e02604e8de 100644 > --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > @@ -59,6 +59,13 @@ properties: > Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. > Pinctrl state named "default" may be defined to reserve pin for RTC output. > > + st,alarm: > + $ref: "/schemas/types.yaml#/definitions/uint32" > + description: | > + To select and enable RTC Alarm A output. > + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. No, sorry, you need to define the allowed values as a schema here. > + Pinctrl state named "default" may be defined to reserve pin for RTC output. > + > allOf: > - if: > properties: > @@ -75,6 +82,9 @@ allOf: > st,lsco: > maxItems: 0 > > + st,alarm: > + maxItems: 0 st,alarm: false or: not: required: [ st,alarm ] is how you disallow a property. This should cause a warning, but this patch didn't apply for me. > + > clock-names: false > > required: > @@ -95,6 +105,9 @@ allOf: > st,lsco: > maxItems: 0 > > + st,alarm: > + maxItems: 0 > + > required: > - clock-names > - st,syscfg > @@ -117,6 +130,9 @@ allOf: > st,lsco: > maxItems: 1 > > + st,alarm: > + maxItems: 1 maxItems applies to arrays, but this is a scalar value. I don't think you need this hunk. > + > required: > - clock-names > > @@ -153,8 +169,9 @@ examples: > clocks = <&rcc RTCAPB>, <&rcc RTC>; > clock-names = "pclk", "rtc_ck"; > interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; > + st,alarm = <RTC_OUT1>; > st,lsco = <RTC_OUT2_RMP>; > - pinctrl-0 = <&rtc_out2_rmp_pins_a>; > + pinctrl-0 = <&rtc_out1_pins_a &rtc_out2_rmp_pins_a>; > pinctrl-names = "default"; > }; > > -- > 2.25.1 > >
Hello, On 04/05/2022 15:06:13+0200, Valentin Caron wrote: > STM32 RTC can pulse some SOC pins when an alarm of RTC expires. > > This patch adds property to activate alarm A output. The pulse can > output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP > (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). > > Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> > --- > .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > index 56d46ea35c5d..71e02604e8de 100644 > --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > @@ -59,6 +59,13 @@ properties: > Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. > Pinctrl state named "default" may be defined to reserve pin for RTC output. > > + st,alarm: > + $ref: "/schemas/types.yaml#/definitions/uint32" > + description: | > + To select and enable RTC Alarm A output. > + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. > + Pinctrl state named "default" may be defined to reserve pin for RTC output. > + > allOf: > - if: > properties: > @@ -75,6 +82,9 @@ allOf: > st,lsco: > maxItems: 0 > > + st,alarm: > + maxItems: 0 > + > clock-names: false > > required: > @@ -95,6 +105,9 @@ allOf: > st,lsco: > maxItems: 0 > > + st,alarm: > + maxItems: 0 > + > required: > - clock-names > - st,syscfg > @@ -117,6 +130,9 @@ allOf: > st,lsco: > maxItems: 1 > > + st,alarm: > + maxItems: 1 > + > required: > - clock-names > > @@ -153,8 +169,9 @@ examples: > clocks = <&rcc RTCAPB>, <&rcc RTC>; > clock-names = "pclk", "rtc_ck"; > interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; > + st,alarm = <RTC_OUT1>; > st,lsco = <RTC_OUT2_RMP>; Shouldn't that be exactly the opposite? You have two pins that can output different functions. The property should be the pin and the value the function. I'd go even further and I would say this is actually pinmuxing.
Hi Alexandre, On 5/4/22 22:27, Alexandre Belloni wrote: > Hello, > > On 04/05/2022 15:06:13+0200, Valentin Caron wrote: >> STM32 RTC can pulse some SOC pins when an alarm of RTC expires. >> >> This patch adds property to activate alarm A output. The pulse can >> output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP >> (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). >> >> Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> >> --- >> .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 ++++++++++++++++++- >> 1 file changed, 18 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >> index 56d46ea35c5d..71e02604e8de 100644 >> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >> @@ -59,6 +59,13 @@ properties: >> Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. >> Pinctrl state named "default" may be defined to reserve pin for RTC output. >> >> + st,alarm: >> + $ref: "/schemas/types.yaml#/definitions/uint32" >> + description: | >> + To select and enable RTC Alarm A output. >> + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. >> + Pinctrl state named "default" may be defined to reserve pin for RTC output. >> + >> allOf: >> - if: >> properties: >> @@ -75,6 +82,9 @@ allOf: >> st,lsco: >> maxItems: 0 >> >> + st,alarm: >> + maxItems: 0 >> + >> clock-names: false >> >> required: >> @@ -95,6 +105,9 @@ allOf: >> st,lsco: >> maxItems: 0 >> >> + st,alarm: >> + maxItems: 0 >> + >> required: >> - clock-names >> - st,syscfg >> @@ -117,6 +130,9 @@ allOf: >> st,lsco: >> maxItems: 1 >> >> + st,alarm: >> + maxItems: 1 >> + >> required: >> - clock-names >> >> @@ -153,8 +169,9 @@ examples: >> clocks = <&rcc RTCAPB>, <&rcc RTC>; >> clock-names = "pclk", "rtc_ck"; >> interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; >> + st,alarm = <RTC_OUT1>; >> st,lsco = <RTC_OUT2_RMP>; > Shouldn't that be exactly the opposite? You have two pins that can > output different functions. The property should be the pin and the value > the function. I'd go even further and I would say this is actually > pinmuxing. > You're right, if the property is the pin and the value the function, this looks like a pinctrl node. We choose to develop theses functionalities in the reverse order, to avoid the complexity of adding the pinctrl framework to our driver. Moreover, LSCO and AlarmA may haven't a peripheral client and this would probably require to also implement pinctrl hogging. Is the implementation that we have proposed is acceptable regarding theses elements ? Thank you, Valentin
Hi Alexandre, May I have your view regarding these new elements ? Thank you, Valentin On 5/23/22 14:34, Valentin CARON wrote: > Hi Alexandre, > > On 5/4/22 22:27, Alexandre Belloni wrote: >> Hello, >> >> On 04/05/2022 15:06:13+0200, Valentin Caron wrote: >>> STM32 RTC can pulse some SOC pins when an alarm of RTC expires. >>> >>> This patch adds property to activate alarm A output. The pulse can >>> output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP >>> (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). >>> >>> Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> >>> --- >>> .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 >>> ++++++++++++++++++- >>> 1 file changed, 18 insertions(+), 1 deletion(-) >>> >>> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >>> b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >>> index 56d46ea35c5d..71e02604e8de 100644 >>> --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >>> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml >>> @@ -59,6 +59,13 @@ properties: >>> Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the >>> supported values. >>> Pinctrl state named "default" may be defined to reserve pin >>> for RTC output. >>> + st,alarm: >>> + $ref: "/schemas/types.yaml#/definitions/uint32" >>> + description: | >>> + To select and enable RTC Alarm A output. >>> + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the >>> supported values. >>> + Pinctrl state named "default" may be defined to reserve pin >>> for RTC output. >>> + >>> allOf: >>> - if: >>> properties: >>> @@ -75,6 +82,9 @@ allOf: >>> st,lsco: >>> maxItems: 0 >>> + st,alarm: >>> + maxItems: 0 >>> + >>> clock-names: false >>> required: >>> @@ -95,6 +105,9 @@ allOf: >>> st,lsco: >>> maxItems: 0 >>> + st,alarm: >>> + maxItems: 0 >>> + >>> required: >>> - clock-names >>> - st,syscfg >>> @@ -117,6 +130,9 @@ allOf: >>> st,lsco: >>> maxItems: 1 >>> + st,alarm: >>> + maxItems: 1 >>> + >>> required: >>> - clock-names >>> @@ -153,8 +169,9 @@ examples: >>> clocks = <&rcc RTCAPB>, <&rcc RTC>; >>> clock-names = "pclk", "rtc_ck"; >>> interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; >>> + st,alarm = <RTC_OUT1>; >>> st,lsco = <RTC_OUT2_RMP>; >> Shouldn't that be exactly the opposite? You have two pins that can >> output different functions. The property should be the pin and the value >> the function. I'd go even further and I would say this is actually >> pinmuxing. >> > You're right, if the property is the pin and the value the function, > this looks like a pinctrl node. > We choose to develop theses functionalities in the reverse order, to > avoid the complexity of adding > the pinctrl framework to our driver. Moreover, LSCO and AlarmA may > haven't a peripheral client and > this would probably require to also implement pinctrl hogging. > > Is the implementation that we have proposed is acceptable regarding > theses elements ? > > Thank you, > Valentin >
On 23/05/2022 14:34:22+0200, Valentin CARON wrote: > Hi Alexandre, > > On 5/4/22 22:27, Alexandre Belloni wrote: > > Hello, > > > > On 04/05/2022 15:06:13+0200, Valentin Caron wrote: > > > STM32 RTC can pulse some SOC pins when an alarm of RTC expires. > > > > > > This patch adds property to activate alarm A output. The pulse can > > > output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP > > > (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). > > > > > > Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> > > > --- > > > .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 ++++++++++++++++++- > > > 1 file changed, 18 insertions(+), 1 deletion(-) > > > > > > diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > > > index 56d46ea35c5d..71e02604e8de 100644 > > > --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > > > +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml > > > @@ -59,6 +59,13 @@ properties: > > > Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. > > > Pinctrl state named "default" may be defined to reserve pin for RTC output. > > > + st,alarm: > > > + $ref: "/schemas/types.yaml#/definitions/uint32" > > > + description: | > > > + To select and enable RTC Alarm A output. > > > + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. > > > + Pinctrl state named "default" may be defined to reserve pin for RTC output. > > > + > > > allOf: > > > - if: > > > properties: > > > @@ -75,6 +82,9 @@ allOf: > > > st,lsco: > > > maxItems: 0 > > > + st,alarm: > > > + maxItems: 0 > > > + > > > clock-names: false > > > required: > > > @@ -95,6 +105,9 @@ allOf: > > > st,lsco: > > > maxItems: 0 > > > + st,alarm: > > > + maxItems: 0 > > > + > > > required: > > > - clock-names > > > - st,syscfg > > > @@ -117,6 +130,9 @@ allOf: > > > st,lsco: > > > maxItems: 1 > > > + st,alarm: > > > + maxItems: 1 > > > + > > > required: > > > - clock-names > > > @@ -153,8 +169,9 @@ examples: > > > clocks = <&rcc RTCAPB>, <&rcc RTC>; > > > clock-names = "pclk", "rtc_ck"; > > > interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; > > > + st,alarm = <RTC_OUT1>; > > > st,lsco = <RTC_OUT2_RMP>; > > Shouldn't that be exactly the opposite? You have two pins that can > > output different functions. The property should be the pin and the value > > the function. I'd go even further and I would say this is actually > > pinmuxing. > > > You're right, if the property is the pin and the value the function, this > looks like a pinctrl node. > We choose to develop theses functionalities in the reverse order, to avoid > the complexity of adding > the pinctrl framework to our driver. Moreover, LSCO and AlarmA may haven't a > peripheral client and > this would probably require to also implement pinctrl hogging. > > Is the implementation that we have proposed is acceptable regarding theses > elements ? > I still think that the pin has to be the property and the function the value. Or we could find a generic name and provide an array of pin, function pair Or, go for pinmuxing My point here is that this is a common feature an RTCs and I don't want every vendor to come up with their own properties. Regards,
diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml index 56d46ea35c5d..71e02604e8de 100644 --- a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml @@ -59,6 +59,13 @@ properties: Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. Pinctrl state named "default" may be defined to reserve pin for RTC output. + st,alarm: + $ref: "/schemas/types.yaml#/definitions/uint32" + description: | + To select and enable RTC Alarm A output. + Refer to <include/dt-bindings/rtc/rtc-stm32.h> for the supported values. + Pinctrl state named "default" may be defined to reserve pin for RTC output. + allOf: - if: properties: @@ -75,6 +82,9 @@ allOf: st,lsco: maxItems: 0 + st,alarm: + maxItems: 0 + clock-names: false required: @@ -95,6 +105,9 @@ allOf: st,lsco: maxItems: 0 + st,alarm: + maxItems: 0 + required: - clock-names - st,syscfg @@ -117,6 +130,9 @@ allOf: st,lsco: maxItems: 1 + st,alarm: + maxItems: 1 + required: - clock-names @@ -153,8 +169,9 @@ examples: clocks = <&rcc RTCAPB>, <&rcc RTC>; clock-names = "pclk", "rtc_ck"; interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + st,alarm = <RTC_OUT1>; st,lsco = <RTC_OUT2_RMP>; - pinctrl-0 = <&rtc_out2_rmp_pins_a>; + pinctrl-0 = <&rtc_out1_pins_a &rtc_out2_rmp_pins_a>; pinctrl-names = "default"; };
STM32 RTC can pulse some SOC pins when an alarm of RTC expires. This patch adds property to activate alarm A output. The pulse can output on three pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP (PC13, PB2, PI8 on stm32mp15) (PC13, PB2, PI1 on stm32mp13). Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> --- .../devicetree/bindings/rtc/st,stm32-rtc.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)