mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
1dec7fa797
Remove old (pre-DM) i2c setup code. Enable DM i2c. Convert common code to use DM rtc. Convert common code to read VPD from eeprom partition. Convert the generic i2c PMIC init code to use the new da9063 driver. mx53ppd only: Correct RTC compatible in device tree. Enable MXC DM i2c driver. Define CONFIG_SYS_MALLOC_F_LEN so that DM is available in pre-reloc. Make GPIO banks available during preloc, since initialisation is done in board_early_init_f(). Add gpio_request() calls to satisfy the DM_GPIO compatibility API. Remove unused power configuration. Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Signed-off-by: Ian Ray <ian.ray@ge.com>
56 lines
907 B
C
56 lines
907 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2017 General Electric Company
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <env.h>
|
|
#include <dm/uclass.h>
|
|
#include <rtc.h>
|
|
|
|
void check_time(void)
|
|
{
|
|
struct udevice *dev;
|
|
int ret, i;
|
|
struct rtc_time tm;
|
|
u8 retry = 3;
|
|
|
|
ret = uclass_get_device(UCLASS_RTC, 0, &dev);
|
|
if (ret) {
|
|
env_set("rtc_status", "FAIL");
|
|
return;
|
|
}
|
|
|
|
for (i = 0; i < retry; i++) {
|
|
ret = dm_rtc_get(dev, &tm);
|
|
if (!ret || ret == -EINVAL)
|
|
break;
|
|
}
|
|
|
|
if (!ret && tm.tm_year > 2037) {
|
|
tm.tm_sec = 0;
|
|
tm.tm_min = 0;
|
|
tm.tm_hour = 0;
|
|
tm.tm_mday = 1;
|
|
tm.tm_wday = 2;
|
|
tm.tm_mon = 1;
|
|
tm.tm_year = 2036;
|
|
|
|
for (i = 0; i < retry; i++) {
|
|
ret = dm_rtc_set(dev, &tm);
|
|
if (!ret)
|
|
break;
|
|
}
|
|
|
|
if (ret >= 0)
|
|
ret = 2038;
|
|
}
|
|
|
|
if (ret < 0)
|
|
env_set("rtc_status", "FAIL");
|
|
else if (ret == 2038)
|
|
env_set("rtc_status", "2038");
|
|
else
|
|
env_set("rtc_status", "OK");
|
|
}
|
|
|