From 0e4c345ecf653aab7684ef6ab0a9e794e8659f5f Mon Sep 17 00:00:00 2001 From: Mark Tomlinson Date: Mon, 20 Jan 2025 14:59:41 +1300 Subject: [PATCH] drivers: rtc: max313xx: Ensure correct date is read after setting When setting the time on the MAX31343, the time is not updated for one second, and reading the time in this interval will give the old time. Wait one second after writing so that the date command will show the correct time when setting the clock. Signed-off-by: Mark Tomlinson Cc: Chris Packham Reviewed-by: Chris Packham --- drivers/rtc/max313xx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/rtc/max313xx.c b/drivers/rtc/max313xx.c index ccfd6b6d0e2..2cb3f245041 100644 --- a/drivers/rtc/max313xx.c +++ b/drivers/rtc/max313xx.c @@ -307,6 +307,11 @@ static int max313xx_set_time(struct udevice *dev, const struct rtc_time *t) if (ret) return ret; + break; + case ID_MAX31343: + /* Time is not updated for 1 second after writing */ + /* Sleep here so the date command shows the new time */ + mdelay(1000); break; default: break; -- 2.39.5