* [PATCH 0/2] enable PCF85063 RTC support for S32G274A-RDB2 and S32G399A-RDB3 boards @ 2025-04-10 8:25 Ciprian Costea 2025-04-10 8:25 ` [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property Ciprian Costea 2025-04-10 8:25 ` [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup Ciprian Costea 0 siblings, 2 replies; 7+ messages in thread From: Ciprian Costea @ 2025-04-10 8:25 UTC (permalink / raw) To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein Cc: linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Ciprian Marian Costea From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> This patch series handles PCF85063 RTC support for boards which do not have the PCF85063 RTC battery backed. In this case, the PCF85063 RTC oscillator is manually started during startup. Ciprian Marian Costea (2): dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property rtc: pcf85063: handle stopped oscillator at startup Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml | 5 +++++ drivers/rtc/rtc-pcf85063.c | 8 ++++++++ 2 files changed, 13 insertions(+) -- 2.45.2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property 2025-04-10 8:25 [PATCH 0/2] enable PCF85063 RTC support for S32G274A-RDB2 and S32G399A-RDB3 boards Ciprian Costea @ 2025-04-10 8:25 ` Ciprian Costea 2025-04-10 14:46 ` Frank Li 2025-04-10 8:25 ` [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup Ciprian Costea 1 sibling, 1 reply; 7+ messages in thread From: Ciprian Costea @ 2025-04-10 8:25 UTC (permalink / raw) To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein Cc: linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Ciprian Marian Costea, Larisa Grigore From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> In case the RTC is not linked to any battery, the oscillator will be stopped at startup, triggering a SW reset command for the PCF85063 RTC. For this setup, introduce 'no-battery' property which can be used to manually start the oscillator. Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> --- Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml index 2f892f8640d1..b342eb13fb2e 100644 --- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml @@ -36,6 +36,11 @@ properties: enum: [7000, 12500] default: 7000 + no-battery: + description: Used in case the RTC is not linked to any battery so the + oscillator is stopped at startup. + type: boolean + clock: $ref: /schemas/clock/fixed-clock.yaml description: -- 2.45.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property 2025-04-10 8:25 ` [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property Ciprian Costea @ 2025-04-10 14:46 ` Frank Li 2025-04-10 14:51 ` Ciprian Marian Costea 0 siblings, 1 reply; 7+ messages in thread From: Frank Li @ 2025-04-10 14:46 UTC (permalink / raw) To: Ciprian Costea Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein, linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Larisa Grigore On Thu, Apr 10, 2025 at 11:25:47AM +0300, Ciprian Costea wrote: > From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> > > In case the RTC is not linked to any battery, the oscillator will > be stopped at startup, triggering a SW reset command for the PCF85063 RTC. > For this setup, introduce 'no-battery' property which can be used to > manually start the oscillator. > > Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> > Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> > Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> > --- > Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml > index 2f892f8640d1..b342eb13fb2e 100644 > --- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml > +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml > @@ -36,6 +36,11 @@ properties: > enum: [7000, 12500] > default: 7000 > > + no-battery: > + description: Used in case the RTC is not linked to any battery so the > + oscillator is stopped at startup. > + type: boolean Can you use optional regulator such as, vbat-supply? Frank > + > clock: > $ref: /schemas/clock/fixed-clock.yaml > description: > -- > 2.45.2 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property 2025-04-10 14:46 ` Frank Li @ 2025-04-10 14:51 ` Ciprian Marian Costea 0 siblings, 0 replies; 7+ messages in thread From: Ciprian Marian Costea @ 2025-04-10 14:51 UTC (permalink / raw) To: Frank Li Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein, linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Larisa Grigore On 4/10/2025 5:46 PM, Frank Li wrote: > On Thu, Apr 10, 2025 at 11:25:47AM +0300, Ciprian Costea wrote: >> From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> >> >> In case the RTC is not linked to any battery, the oscillator will >> be stopped at startup, triggering a SW reset command for the PCF85063 RTC. >> For this setup, introduce 'no-battery' property which can be used to >> manually start the oscillator. >> >> Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> >> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> >> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> >> --- >> Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml >> index 2f892f8640d1..b342eb13fb2e 100644 >> --- a/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml >> +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf85063.yaml >> @@ -36,6 +36,11 @@ properties: >> enum: [7000, 12500] >> default: 7000 >> >> + no-battery: >> + description: Used in case the RTC is not linked to any battery so the >> + oscillator is stopped at startup. >> + type: boolean > > Can you use optional regulator such as, vbat-supply? > > Frank > Hello Frank, Please disregard this patchset, as stated in the next patch review [1] [1] https://lore.kernel.org/all/e64083ee-3374-4bdf-92a3-ce91e1402b13@oss.nxp.com/ Regards, Ciprian >> + >> clock: >> $ref: /schemas/clock/fixed-clock.yaml >> description: >> -- >> 2.45.2 >> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup 2025-04-10 8:25 [PATCH 0/2] enable PCF85063 RTC support for S32G274A-RDB2 and S32G399A-RDB3 boards Ciprian Costea 2025-04-10 8:25 ` [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property Ciprian Costea @ 2025-04-10 8:25 ` Ciprian Costea 2025-04-10 9:17 ` Alexandre Belloni 1 sibling, 1 reply; 7+ messages in thread From: Ciprian Costea @ 2025-04-10 8:25 UTC (permalink / raw) To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein Cc: linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Ciprian Marian Costea, Larisa Grigore From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> If the RTC is not linked to any battery, the oscillator is stopped at startup and a SW reset command is generated to the PCF85063 RTC. Manually start the oscillator in case the PCF85063 RTC is not battery backed. Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> --- drivers/rtc/rtc-pcf85063.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c index 4fa5c4ecdd5a..6de7344d2469 100644 --- a/drivers/rtc/rtc-pcf85063.c +++ b/drivers/rtc/rtc-pcf85063.c @@ -590,6 +590,14 @@ static int pcf85063_probe(struct i2c_client *client) i2c_set_clientdata(client, pcf85063); + if (of_property_read_bool(client->dev.of_node, "no-battery")) { + err = regmap_update_bits(pcf85063->regmap, PCF85063_REG_SC, + PCF85063_REG_SC_OS, 0); + if (err) + return dev_err_probe(&client->dev, err, + "Failed to start the oscillator\n"); + } + err = regmap_read(pcf85063->regmap, PCF85063_REG_SC, &tmp); if (err) return dev_err_probe(&client->dev, err, "RTC chip is not present\n"); -- 2.45.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup 2025-04-10 8:25 ` [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup Ciprian Costea @ 2025-04-10 9:17 ` Alexandre Belloni 2025-04-10 12:56 ` Ciprian Marian Costea 0 siblings, 1 reply; 7+ messages in thread From: Alexandre Belloni @ 2025-04-10 9:17 UTC (permalink / raw) To: Ciprian Costea Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein, linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Larisa Grigore On 10/04/2025 11:25:48+0300, Ciprian Costea wrote: > From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> > > If the RTC is not linked to any battery, the oscillator is stopped at > startup and a SW reset command is generated to the PCF85063 RTC. > Manually start the oscillator in case the PCF85063 RTC is not battery > backed. > No, there is no point in starting the oscillator with a know wrong time/date. The oscillator must only be started once the time is known good, that is in .set_time > Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> > Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> > Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> > --- > drivers/rtc/rtc-pcf85063.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c > index 4fa5c4ecdd5a..6de7344d2469 100644 > --- a/drivers/rtc/rtc-pcf85063.c > +++ b/drivers/rtc/rtc-pcf85063.c > @@ -590,6 +590,14 @@ static int pcf85063_probe(struct i2c_client *client) > > i2c_set_clientdata(client, pcf85063); > > + if (of_property_read_bool(client->dev.of_node, "no-battery")) { > + err = regmap_update_bits(pcf85063->regmap, PCF85063_REG_SC, > + PCF85063_REG_SC_OS, 0); > + if (err) > + return dev_err_probe(&client->dev, err, > + "Failed to start the oscillator\n"); > + } > + > err = regmap_read(pcf85063->regmap, PCF85063_REG_SC, &tmp); > if (err) > return dev_err_probe(&client->dev, err, "RTC chip is not present\n"); > -- > 2.45.2 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup 2025-04-10 9:17 ` Alexandre Belloni @ 2025-04-10 12:56 ` Ciprian Marian Costea 0 siblings, 0 replies; 7+ messages in thread From: Ciprian Marian Costea @ 2025-04-10 12:56 UTC (permalink / raw) To: Alexandre Belloni Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alexander Stein, linux-rtc, devicetree, linux-kernel, s32, imx, Christophe Lizzi, Alberto Ruiz, Enric Balletbo, Eric Chanudet, Larisa Grigore On 4/10/2025 12:17 PM, Alexandre Belloni wrote: > On 10/04/2025 11:25:48+0300, Ciprian Costea wrote: >> From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> >> >> If the RTC is not linked to any battery, the oscillator is stopped at >> startup and a SW reset command is generated to the PCF85063 RTC. >> Manually start the oscillator in case the PCF85063 RTC is not battery >> backed. >> > > No, there is no point in starting the oscillator with a know wrong > time/date. The oscillator must only be started once the time is known > good, that is in .set_time > Hello Alexandre, Thanks for your review. You are correct, please disregard this patchset. I've looked into the 'set_time' callback and indeed the oscillator is being started here [1]. I've tested, so even with no battery provided for the PCF85036 RTC, after setting the hardware clock from userspace, the RTC works as expected because of the manual starting of the oscillator from 'set_time'. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/rtc/rtc-pcf85063.c#n129 Ciprian >> Co-developed-by: Larisa Grigore <larisa.grigore@nxp.com> >> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> >> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> >> --- >> drivers/rtc/rtc-pcf85063.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c >> index 4fa5c4ecdd5a..6de7344d2469 100644 >> --- a/drivers/rtc/rtc-pcf85063.c >> +++ b/drivers/rtc/rtc-pcf85063.c >> @@ -590,6 +590,14 @@ static int pcf85063_probe(struct i2c_client *client) >> >> i2c_set_clientdata(client, pcf85063); >> >> + if (of_property_read_bool(client->dev.of_node, "no-battery")) { >> + err = regmap_update_bits(pcf85063->regmap, PCF85063_REG_SC, >> + PCF85063_REG_SC_OS, 0); >> + if (err) >> + return dev_err_probe(&client->dev, err, >> + "Failed to start the oscillator\n"); >> + } >> + >> err = regmap_read(pcf85063->regmap, PCF85063_REG_SC, &tmp); >> if (err) >> return dev_err_probe(&client->dev, err, "RTC chip is not present\n"); >> -- >> 2.45.2 >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-04-10 14:51 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-10 8:25 [PATCH 0/2] enable PCF85063 RTC support for S32G274A-RDB2 and S32G399A-RDB3 boards Ciprian Costea 2025-04-10 8:25 ` [PATCH 1/2] dt-bindings: rtc: nxp,pcf85063: add 'no-battery' property Ciprian Costea 2025-04-10 14:46 ` Frank Li 2025-04-10 14:51 ` Ciprian Marian Costea 2025-04-10 8:25 ` [PATCH 2/2] rtc: pcf85063: handle stopped oscillator at startup Ciprian Costea 2025-04-10 9:17 ` Alexandre Belloni 2025-04-10 12:56 ` Ciprian Marian Costea
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox