Pass rtc_status via the device tree, instead of on kernel command line.
Additionally, the 2038 mitigation is reported, if applied successfully.
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
#ifdef CONFIG_OF_BOARD_SETUP
int ft_board_setup(void *blob, bd_t *bd)
{
+ char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
- strlen(version_string) + 1);
+ strlen(version_string) + 1);
+
+ fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+ strlen(rtc_status) + 1);
return 0;
}
#endif
unsigned int current_i2c_bus = i2c_get_bus_num();
ret = i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
- if (ret < 0)
+ if (ret < 0) {
+ env_set("rtc_status", "FAIL");
return;
+ }
rtc_init();
break;
}
- if (ret < 0)
- env_set("rtc_status", "RTC_ERROR");
-
- if (tm.tm_year > 2037) {
+ if (!ret && tm.tm_year > 2037) {
tm.tm_sec = 0;
tm.tm_min = 0;
tm.tm_hour = 0;
break;
}
- if (ret < 0)
- env_set("rtc_status", "RTC_ERROR");
+ 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");
+
i2c_set_bus_num(current_i2c_bus);
}
#ifdef CONFIG_OF_BOARD_SETUP
int ft_board_setup(void *blob, bd_t *bd)
{
+ char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
- strlen(version_string) + 1);
+ strlen(version_string) + 1);
+
+ fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+ strlen(rtc_status) + 1);
return 0;
}
#endif
"setargs=setenv bootargs root=/dev/${rootdev}${partnum} " \
"ro rootwait cma=128M " \
"bootcause=${bootcause} " \
- "${quiet} console=${console} ${rtc_status} " \
+ "${quiet} console=${console} " \
"${videoargs}" "\0" \
"doquiet=" \
"if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
"lvds=ldb\0" \
"setargs=setenv bootargs ${lvds} jtag=on mem=2G " \
"vt.global_cursor_default=0 bootcause=${bootcause} ${quiet} " \
- "console=${console} ${rtc_status}\0" \
+ "console=${console}\0" \
"bootargs_emmc=setenv bootargs root=/dev/${rootdev}${partnum} ro " \
"rootwait ${bootargs}\0" \
"doquiet=if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \