[PATCH] rtc: ds1307: Handle oscillator stop flag set on ds1339 chip

Simon Glass sjg at chromium.org
Thu May 7 23:10:54 CEST 2026


On 2026-05-05T04:25:31, Ronan Dalton <ronan.dalton at alliedtelesis.co.nz> wrote:
> rtc: ds1307: Handle oscillator stop flag set on ds1339 chip
>
> Currently the oscillator stop flag (OSF) bit is never checked or cleared
> on the DS1339 RTC chip.
>
> On getting the time from the RTC, check if the OSF bit is set, log a
> warning, and clear the flag. This matches the behavior of the DS1337
> chip.
>
> Note that the date command always reads from the RTC even when
> setting or resetting the date, so the OSF flag is cleared in those cases
> as well.
>
> Signed-off-by: Ronan Dalton <ronan.dalton at alliedtelesis.co.nz>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Francesco Dolcini <francesco.dolcini at toradex.com>
> Cc: Mark Tomlinson <mark.tomlinson at alliedtelesis.co.nz>
> Cc: Chris Packham <chris.packham at alliedtelesis.co.nz>
>
> drivers/rtc/ds1307.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

> diff --git a/drivers/rtc/ds1307.c b/drivers/rtc/ds1307.c
> @@ -116,9 +116,9 @@ static int ds1307_rtc_get(struct udevice *dev, struct rtc_time *tm)
> -     if (type == ds_1337 || type == ds_1340) {
> -             uint reg = (type == ds_1337) ? DS1337_STAT_REG_ADDR :
> -                                            DS1340_STAT_REG_ADDR;
> +     if (type == ds_1337 || type == ds_1339 || type == ds_1340) {
> +             uint reg = (type == ds_1340) ? DS1340_STAT_REG_ADDR :
> +                                            DS1337_STAT_REG_ADDR;

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list