Message ID | 20230201143431.863784-1-frieder@fris.de |
---|---|
Headers | show |
Series | Enable backup switch mode on RTCs via devicetree | expand |
On 01/02/2023 15:34, Frieder Schrempf wrote: > From: Frieder Schrempf <frieder.schrempf@kontron.de> > > The RV3028 driver uses properties that are not covered by the > trivial-rtc bindings. Use custom bindings for it. > > Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de> > --- > .../bindings/rtc/microcrystal,rv3028.yaml | 56 +++++++++++++++++++ > .../devicetree/bindings/rtc/trivial-rtc.yaml | 2 - > 2 files changed, 56 insertions(+), 2 deletions(-) > create mode 100644 Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml > > diff --git a/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml > new file mode 100644 > index 000000000000..4667ba86fd0c > --- /dev/null > +++ b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml > @@ -0,0 +1,56 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/rtc/microcrystal,rv3028.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Microchip RV-3028 RTC > + > +allOf: > + - $ref: "rtc.yaml#" Drop quotes > + > +maintainers: > + - Alexandre Belloni <alexandre.belloni@bootlin.com> > + > +properties: > + compatible: > + const: microcrystal,rv3028 > + > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + start-year: true This should be dropped as well and then... > + > + trickle-resistor-ohms: > + enum: > + - 3000 > + - 5000 > + - 9000 > + - 15000 > + > +required: > + - compatible > + - reg > + > +additionalProperties: false ...switch to unevaluatedProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + rtc@51 { Rob's pointed missing testing. But more important - please rebase your patches on current tree. Looks like all the changes are already done... Best regards, Krzysztof
On 02.02.23 10:10, Krzysztof Kozlowski wrote: > On 01/02/2023 15:34, Frieder Schrempf wrote: >> From: Frieder Schrempf <frieder.schrempf@kontron.de> >> >> The RV3028 driver uses properties that are not covered by the >> trivial-rtc bindings. Use custom bindings for it. >> >> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de> >> --- >> .../bindings/rtc/microcrystal,rv3028.yaml | 56 +++++++++++++++++++ >> .../devicetree/bindings/rtc/trivial-rtc.yaml | 2 - >> 2 files changed, 56 insertions(+), 2 deletions(-) >> create mode 100644 Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml >> >> diff --git a/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml >> new file mode 100644 >> index 000000000000..4667ba86fd0c >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml >> @@ -0,0 +1,56 @@ >> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause >> +%YAML 1.2 >> +--- >> +$id: https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevicetree.org%2Fschemas%2Frtc%2Fmicrocrystal%2Crv3028.yaml%23&data=05%7C01%7Cfrieder.schrempf%40kontron.de%7Ca99c626bce484657aee508db04fd470f%7C8c9d3c973fd941c8a2b1646f3942daf1%7C0%7C0%7C638109258107205830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=z8nsgRaxC3AcIoXteA7Xj7EpCKrA%2FkRPyrYeS1fig8I%3D&reserved=0 >> +$schema: https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevicetree.org%2Fmeta-schemas%2Fcore.yaml%23&data=05%7C01%7Cfrieder.schrempf%40kontron.de%7Ca99c626bce484657aee508db04fd470f%7C8c9d3c973fd941c8a2b1646f3942daf1%7C0%7C0%7C638109258107205830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1RPGw%2FEf7UUNrJZPAHDw7BHnuroLg1oVR4xLq2%2FgIHU%3D&reserved=0 >> + >> +title: Microchip RV-3028 RTC >> + >> +allOf: >> + - $ref: "rtc.yaml#" > > Drop quotes > >> + >> +maintainers: >> + - Alexandre Belloni <alexandre.belloni@bootlin.com> >> + >> +properties: >> + compatible: >> + const: microcrystal,rv3028 >> + >> + reg: >> + maxItems: 1 >> + >> + interrupts: >> + maxItems: 1 >> + >> + start-year: true > > This should be dropped as well and then... > >> + >> + trickle-resistor-ohms: >> + enum: >> + - 3000 >> + - 5000 >> + - 9000 >> + - 15000 >> + >> +required: >> + - compatible >> + - reg >> + >> +additionalProperties: false > > ...switch to unevaluatedProperties: false > >> + >> +examples: >> + - | >> + #include <dt-bindings/interrupt-controller/irq.h> >> + i2c { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + rtc@51 { > > Rob's pointed missing testing. > > But more important - please rebase your patches on current tree. Looks > like all the changes are already done... Oops, I need to remember to check patchwork/linux-next. Thanks anyway!
Hi Alexandre, On 01.02.23 17:26, Frieder Schrempf wrote: > On 01.02.23 17:15, Alexandre Belloni wrote: >> Hello, >> >> You can't do that, this breaks an important use case and it is the >> reason why I didn't use device tree in the beginning. What is wrong with >> setting BSM from userspace? You will anyway have to set the time and >> date from userspace for it to be saved. > > Ok, I was already afraid there is something I missed. Can you give a > short explanation of what use case this would break? > > There is nothing wrong with setting BSM from userspace. It's just the > fact that users expect BSM to be enabled in any case as there is a > battery on the board. It is much more effort to ensure that production, > user, etc. are aware of an extra step required than to let the kernel > deal with it behind the scenes. Would you mind elaborating on your argument that this would break stuff? I currently don't see how an additional optional devicetree property would break anything. Thanks Frieder
On 13.02.23 10:18, Frieder Schrempf wrote: > Hi Alexandre, > > On 01.02.23 17:26, Frieder Schrempf wrote: >> On 01.02.23 17:15, Alexandre Belloni wrote: >>> Hello, >>> >>> You can't do that, this breaks an important use case and it is the >>> reason why I didn't use device tree in the beginning. What is wrong with >>> setting BSM from userspace? You will anyway have to set the time and >>> date from userspace for it to be saved. >> >> Ok, I was already afraid there is something I missed. Can you give a >> short explanation of what use case this would break? >> >> There is nothing wrong with setting BSM from userspace. It's just the >> fact that users expect BSM to be enabled in any case as there is a >> battery on the board. It is much more effort to ensure that production, >> user, etc. are aware of an extra step required than to let the kernel >> deal with it behind the scenes. > > Would you mind elaborating on your argument that this would break stuff? > I currently don't see how an additional optional devicetree property > would break anything. Ping!?
From: Frieder Schrempf <frieder.schrempf@kontron.de> Some RTC devices like the RV3028 have BSM disabled as factory default. This makes the RTC quite useless if it is expected to preserve the time on hardware that has a battery-buffered supply for the RTC. Let boards that have a buffered supply for the RTC force the BSM to the desired value via devicetree by setting the 'backup-switch-mode' property. That way the RTC on the boards work as one would expect them to do without any per-board intervention through userspace tools to enable BSM. Frieder Schrempf (7): dt-bindings: rtc: Move RV3028 to separate binding file dt-bindings: rtc: Add backup-switch-mode property dt-bindings: rtc: microcrystal,rv3032: Add backup-switch-mode property rtc: Move BSM defines to separate header for DT usage rtc: class: Support setting backup switch mode from devicetree arm64: dts: imx8mm-kontron: Remove useless trickle-diode-disable from RTC node arm64: dts: imx8mm-kontron: Enable backup switch mode for RTC on OSM-S module .../bindings/rtc/microcrystal,rv3028.yaml | 60 +++++++++++++++++++ .../devicetree/bindings/rtc/rtc.yaml | 7 +++ .../devicetree/bindings/rtc/trivial-rtc.yaml | 2 - .../dts/freescale/imx8mm-kontron-osm-s.dtsi | 3 +- drivers/rtc/class.c | 14 +++++ include/dt-bindings/rtc/rtc.h | 11 ++++ include/uapi/linux/rtc.h | 6 +- 7 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml create mode 100644 include/dt-bindings/rtc/rtc.h