mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-21 13:51:29 +02:00
rtc: davinci: fix date loaded on reset
On reset, the RTC loads the 2000-01-01 date with a wrong day of the week (Sunday instead of Saturday). Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-9-dariobin@libero.it
This commit is contained in:
parent
9ec8b8b4ca
commit
08ea87a6de
@ -290,6 +290,7 @@ static int omap_rtc_remove(struct udevice *dev)
|
|||||||
static int omap_rtc_probe(struct udevice *dev)
|
static int omap_rtc_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct omap_rtc_priv *priv = dev_get_priv(dev);
|
struct omap_rtc_priv *priv = dev_get_priv(dev);
|
||||||
|
struct rtc_time tm;
|
||||||
u8 reg, mask, new_ctrl;
|
u8 reg, mask, new_ctrl;
|
||||||
|
|
||||||
priv->dev = dev;
|
priv->dev = dev;
|
||||||
@ -380,6 +381,15 @@ static int omap_rtc_probe(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
omap_rtc_lock(priv);
|
omap_rtc_lock(priv);
|
||||||
|
|
||||||
|
if (omap_rtc_get(dev, &tm)) {
|
||||||
|
dev_err(dev, "failed to get datetime\n");
|
||||||
|
} else if (tm.tm_year == 2000 && tm.tm_mon == 1 && tm.tm_mday == 1 &&
|
||||||
|
tm.tm_wday == 0) {
|
||||||
|
tm.tm_wday = 6;
|
||||||
|
omap_rtc_set(dev, &tm);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user