* Re: [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231
2026-05-08 3:24 [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231 Ronan Dalton
@ 2026-05-08 15:00 ` Tyler Hicks
2026-05-11 20:21 ` Meagan Lloyd
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tyler Hicks @ 2026-05-08 15:00 UTC (permalink / raw)
To: Ronan Dalton
Cc: alexandre.belloni, linux-rtc, linux-kernel, Sasha Levin,
Meagan Lloyd, Rodolfo Giometti, Chris Packham
On 2026-05-08 15:24:49, Ronan Dalton wrote:
> Prior to commit 48458654659c ("rtc: ds1307: remove clear of oscillator
> stop flag (OSF) in probe"), the oscillator stop flag (OSF) bit was
> checked during device probe for the ds1337, ds1339, ds1341, and ds3231
> chips; if it was set, it would be cleared and a warning would be logged
> saying "SET TIME!". Since that commit, the OSF bit is no longer cleared,
> but the warning is still printed.
>
> Directly following that commit, there was no way to get rid of this
> warning because nothing cleared the OSF bit on these chips.
>
> The commit associated with the previous commit, 523923cfd5d6 ("rtc:
> ds1307: handle oscillator stop flag (OSF) for ds1341"), made proper use
> of the OSF when getting and setting the time in the RTC. However, the
> other RTC variants ds1337, ds1339 and ds3231 didn't have a corresponding
> change made.
>
> Given that the OSF bit is no longer cleared at probe time when it is
> set, the remaining three chips should have the same handling as the
> ds1341 chip has for the OSF bit.
>
> Fix the issue on the ds1337, ds1339 and ds3231 chips by applying the
> same logic as the ds1341 has to these chips.
>
> Note that any devices brought up between the first referenced commit and
> this one may begin mistrusting the time reported by the RTC until it is
> set again, if the bit was never explicitly cleared.
>
> Note that only the ds1339 was tested with this change, but the
> datasheets for the other chips contain essentially identical
> descriptions of the OSF bit so the same change should work.
>
> Signed-off-by: Ronan Dalton <ronan.dalton@alliedtelesis.co.nz>
> Cc: linux-rtc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Tyler Hicks <code@tyhicks.com>
> Cc: Sasha Levin <sashal@kernel.org>
> Cc: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
> Cc: Rodolfo Giometti <giometti@enneenne.com>
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Fixes: 48458654659c ("rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe")
> ---
> Changes in v3:
> - Remove paragraph mentioning alternative fix from commit message
>
> Changes in v2:
> - Fix hashes of referenced commits
Reviewed-by: Tyler Hicks <code@tyhicks.com>
Thanks again!
Tyler
>
> drivers/rtc/rtc-ds1307.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 7205c59ff729..edf81b975dec 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -269,6 +269,16 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
> if (tmp & DS1338_BIT_OSF)
> return -EINVAL;
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS, &tmp);
> + if (ret)
> + return ret;
> + if (tmp & DS1337_BIT_OSF)
> + return -EINVAL;
> + break;
> case ds_1340:
> if (tmp & DS1340_BIT_nEOSC)
> return -EINVAL;
> @@ -279,13 +289,6 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
> if (tmp & DS1340_BIT_OSF)
> return -EINVAL;
> break;
> - case ds_1341:
> - ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS, &tmp);
> - if (ret)
> - return ret;
> - if (tmp & DS1337_BIT_OSF)
> - return -EINVAL;
> - break;
> case ds_1388:
> ret = regmap_read(ds1307->regmap, DS1388_REG_FLAG, &tmp);
> if (ret)
> @@ -380,14 +383,17 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)
> regmap_update_bits(ds1307->regmap, DS1307_REG_CONTROL,
> DS1338_BIT_OSF, 0);
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + regmap_update_bits(ds1307->regmap, DS1337_REG_STATUS,
> + DS1337_BIT_OSF, 0);
> + break;
> case ds_1340:
> regmap_update_bits(ds1307->regmap, DS1340_REG_FLAG,
> DS1340_BIT_OSF, 0);
> break;
> - case ds_1341:
> - regmap_update_bits(ds1307->regmap, DS1337_REG_STATUS,
> - DS1337_BIT_OSF, 0);
> - break;
> case ds_1388:
> regmap_update_bits(ds1307->regmap, DS1388_REG_FLAG,
> DS1388_BIT_OSF, 0);
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231
2026-05-08 3:24 [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231 Ronan Dalton
2026-05-08 15:00 ` Tyler Hicks
@ 2026-05-11 20:21 ` Meagan Lloyd
2026-06-17 3:34 ` Ronan Dalton
2026-06-24 21:16 ` Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Meagan Lloyd @ 2026-05-11 20:21 UTC (permalink / raw)
To: Ronan Dalton
Cc: alexandre.belloni, linux-rtc, linux-kernel, Tyler Hicks,
Sasha Levin, Meagan Lloyd, Rodolfo Giometti, Chris Packham
On Fri, May 08, 2026 at 03:24:49PM +1200, Ronan Dalton wrote:
> Prior to commit 48458654659c ("rtc: ds1307: remove clear of oscillator
> stop flag (OSF) in probe"), the oscillator stop flag (OSF) bit was
> checked during device probe for the ds1337, ds1339, ds1341, and ds3231
> chips; if it was set, it would be cleared and a warning would be logged
> saying "SET TIME!". Since that commit, the OSF bit is no longer cleared,
> but the warning is still printed.
>
> Directly following that commit, there was no way to get rid of this
> warning because nothing cleared the OSF bit on these chips.
>
> The commit associated with the previous commit, 523923cfd5d6 ("rtc:
> ds1307: handle oscillator stop flag (OSF) for ds1341"), made proper use
> of the OSF when getting and setting the time in the RTC. However, the
> other RTC variants ds1337, ds1339 and ds3231 didn't have a corresponding
> change made.
>
> Given that the OSF bit is no longer cleared at probe time when it is
> set, the remaining three chips should have the same handling as the
> ds1341 chip has for the OSF bit.
>
> Fix the issue on the ds1337, ds1339 and ds3231 chips by applying the
> same logic as the ds1341 has to these chips.
>
> Note that any devices brought up between the first referenced commit and
> this one may begin mistrusting the time reported by the RTC until it is
> set again, if the bit was never explicitly cleared.
>
> Note that only the ds1339 was tested with this change, but the
> datasheets for the other chips contain essentially identical
> descriptions of the OSF bit so the same change should work.
>
> Signed-off-by: Ronan Dalton <ronan.dalton@alliedtelesis.co.nz>
> Cc: linux-rtc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Tyler Hicks <code@tyhicks.com>
> Cc: Sasha Levin <sashal@kernel.org>
> Cc: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
> Cc: Rodolfo Giometti <giometti@enneenne.com>
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Fixes: 48458654659c ("rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe")
> ---
> Changes in v3:
> - Remove paragraph mentioning alternative fix from commit message
>
> Changes in v2:
> - Fix hashes of referenced commits
Reviewed-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
>
> drivers/rtc/rtc-ds1307.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 7205c59ff729..edf81b975dec 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -269,6 +269,16 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
> if (tmp & DS1338_BIT_OSF)
> return -EINVAL;
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS, &tmp);
> + if (ret)
> + return ret;
> + if (tmp & DS1337_BIT_OSF)
> + return -EINVAL;
> + break;
> case ds_1340:
> if (tmp & DS1340_BIT_nEOSC)
> return -EINVAL;
> @@ -279,13 +289,6 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
> if (tmp & DS1340_BIT_OSF)
> return -EINVAL;
> break;
> - case ds_1341:
> - ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS, &tmp);
> - if (ret)
> - return ret;
> - if (tmp & DS1337_BIT_OSF)
> - return -EINVAL;
> - break;
> case ds_1388:
> ret = regmap_read(ds1307->regmap, DS1388_REG_FLAG, &tmp);
> if (ret)
> @@ -380,14 +383,17 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)
> regmap_update_bits(ds1307->regmap, DS1307_REG_CONTROL,
> DS1338_BIT_OSF, 0);
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + regmap_update_bits(ds1307->regmap, DS1337_REG_STATUS,
> + DS1337_BIT_OSF, 0);
> + break;
> case ds_1340:
> regmap_update_bits(ds1307->regmap, DS1340_REG_FLAG,
> DS1340_BIT_OSF, 0);
> break;
> - case ds_1341:
> - regmap_update_bits(ds1307->regmap, DS1337_REG_STATUS,
> - DS1337_BIT_OSF, 0);
> - break;
> case ds_1388:
> regmap_update_bits(ds1307->regmap, DS1388_REG_FLAG,
> DS1388_BIT_OSF, 0);
> --
> 2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231
2026-05-08 3:24 [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231 Ronan Dalton
2026-05-08 15:00 ` Tyler Hicks
2026-05-11 20:21 ` Meagan Lloyd
@ 2026-06-17 3:34 ` Ronan Dalton
2026-06-24 21:16 ` Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Ronan Dalton @ 2026-06-17 3:34 UTC (permalink / raw)
To: alexandre.belloni@bootlin.com
Cc: sashal@kernel.org, code@tyhicks.com, giometti@enneenne.com,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
meaganlloyd@linux.microsoft.com, Chris Packham
Hi Alexandre,
I just wanted to follow up on this patch because I think it may have
been missed by accident. I'm still interested in getting it merged.
Could you give it a look?
Thanks,
Ronan.
On Fri, 2026-05-08 at 15:24 +1200, Ronan Dalton wrote:
> Prior to commit 48458654659c ("rtc: ds1307: remove clear of
> oscillator
> stop flag (OSF) in probe"), the oscillator stop flag (OSF) bit was
> checked during device probe for the ds1337, ds1339, ds1341, and
> ds3231
> chips; if it was set, it would be cleared and a warning would be
> logged
> saying "SET TIME!". Since that commit, the OSF bit is no longer
> cleared,
> but the warning is still printed.
>
> Directly following that commit, there was no way to get rid of this
> warning because nothing cleared the OSF bit on these chips.
>
> The commit associated with the previous commit, 523923cfd5d6 ("rtc:
> ds1307: handle oscillator stop flag (OSF) for ds1341"), made proper
> use
> of the OSF when getting and setting the time in the RTC. However, the
> other RTC variants ds1337, ds1339 and ds3231 didn't have a
> corresponding
> change made.
>
> Given that the OSF bit is no longer cleared at probe time when it is
> set, the remaining three chips should have the same handling as the
> ds1341 chip has for the OSF bit.
>
> Fix the issue on the ds1337, ds1339 and ds3231 chips by applying the
> same logic as the ds1341 has to these chips.
>
> Note that any devices brought up between the first referenced commit
> and
> this one may begin mistrusting the time reported by the RTC until it
> is
> set again, if the bit was never explicitly cleared.
>
> Note that only the ds1339 was tested with this change, but the
> datasheets for the other chips contain essentially identical
> descriptions of the OSF bit so the same change should work.
>
> Signed-off-by: Ronan Dalton <ronan.dalton@alliedtelesis.co.nz>
> Cc: linux-rtc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Tyler Hicks <code@tyhicks.com>
> Cc: Sasha Levin <sashal@kernel.org>
> Cc: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
> Cc: Rodolfo Giometti <giometti@enneenne.com>
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Fixes: 48458654659c ("rtc: ds1307: remove clear of oscillator stop
> flag (OSF) in probe")
> ---
> Changes in v3:
> - Remove paragraph mentioning alternative fix from commit message
>
> Changes in v2:
> - Fix hashes of referenced commits
>
> drivers/rtc/rtc-ds1307.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 7205c59ff729..edf81b975dec 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -269,6 +269,16 @@ static int ds1307_get_time(struct device *dev,
> struct rtc_time *t)
> if (tmp & DS1338_BIT_OSF)
> return -EINVAL;
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS,
> &tmp);
> + if (ret)
> + return ret;
> + if (tmp & DS1337_BIT_OSF)
> + return -EINVAL;
> + break;
> case ds_1340:
> if (tmp & DS1340_BIT_nEOSC)
> return -EINVAL;
> @@ -279,13 +289,6 @@ static int ds1307_get_time(struct device *dev,
> struct rtc_time *t)
> if (tmp & DS1340_BIT_OSF)
> return -EINVAL;
> break;
> - case ds_1341:
> - ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS,
> &tmp);
> - if (ret)
> - return ret;
> - if (tmp & DS1337_BIT_OSF)
> - return -EINVAL;
> - break;
> case ds_1388:
> ret = regmap_read(ds1307->regmap, DS1388_REG_FLAG,
> &tmp);
> if (ret)
> @@ -380,14 +383,17 @@ static int ds1307_set_time(struct device *dev,
> struct rtc_time *t)
> regmap_update_bits(ds1307->regmap,
> DS1307_REG_CONTROL,
> DS1338_BIT_OSF, 0);
> break;
> + case ds_1337:
> + case ds_1339:
> + case ds_1341:
> + case ds_3231:
> + regmap_update_bits(ds1307->regmap,
> DS1337_REG_STATUS,
> + DS1337_BIT_OSF, 0);
> + break;
> case ds_1340:
> regmap_update_bits(ds1307->regmap, DS1340_REG_FLAG,
> DS1340_BIT_OSF, 0);
> break;
> - case ds_1341:
> - regmap_update_bits(ds1307->regmap,
> DS1337_REG_STATUS,
> - DS1337_BIT_OSF, 0);
> - break;
> case ds_1388:
> regmap_update_bits(ds1307->regmap, DS1388_REG_FLAG,
> DS1388_BIT_OSF, 0);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231
2026-05-08 3:24 [PATCH v3] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231 Ronan Dalton
` (2 preceding siblings ...)
2026-06-17 3:34 ` Ronan Dalton
@ 2026-06-24 21:16 ` Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2026-06-24 21:16 UTC (permalink / raw)
To: Ronan Dalton
Cc: linux-rtc, linux-kernel, Tyler Hicks, Sasha Levin, Meagan Lloyd,
Rodolfo Giometti, Chris Packham
On Fri, 08 May 2026 15:24:49 +1200, Ronan Dalton wrote:
> Prior to commit 48458654659c ("rtc: ds1307: remove clear of oscillator
> stop flag (OSF) in probe"), the oscillator stop flag (OSF) bit was
> checked during device probe for the ds1337, ds1339, ds1341, and ds3231
> chips; if it was set, it would be cleared and a warning would be logged
> saying "SET TIME!". Since that commit, the OSF bit is no longer cleared,
> but the warning is still printed.
>
> [...]
Applied, thanks!
[1/1] rtc: ds1307: handle oscillator stop flag for ds1337/ds1339/ds3231
https://git.kernel.org/abelloni/c/a091e1ba3b68
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread