]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: ge: pass rtc_status via device tree
authorIan Ray <ian.ray@ge.com>
Tue, 12 Nov 2019 19:15:18 +0000 (19:15 +0000)
committerStefano Babic <sbabic@denx.de>
Tue, 7 Jan 2020 09:26:56 +0000 (10:26 +0100)
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>
board/ge/bx50v3/bx50v3.c
board/ge/common/ge_common.c
board/ge/mx53ppd/mx53ppd.c
include/configs/ge_bx50v3.h
include/configs/mx53ppd.h

index d3aaa2d96f4cb014a96bb25ae1ac8c9b05bd4161..89607cf0568d4ab214afabca6c39e8de36b890e8 100644 (file)
@@ -649,8 +649,13 @@ int checkboard(void)
 #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
index 501c8b2daf2aa0b5426f1f3f323844d5f5dcc9d6..d7e21deca74d5212159cd177a480f1a62dc34614 100644 (file)
@@ -17,8 +17,10 @@ void check_time(void)
        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();
 
@@ -28,10 +30,7 @@ void check_time(void)
                        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;
@@ -46,10 +45,17 @@ void check_time(void)
                                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);
 }
 
index 51b5d8996d6f1f85c62be9b1125fc29d540e1ddc..bfcee441c506acfaf77dd06d8de07dd7b20c7f22 100644 (file)
@@ -314,8 +314,13 @@ int checkboard(void)
 #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
index 1c7ba36c8aeb66db4d99438ab22f354bccccd4e0..dad906d494e75adc9683c379c6a02d3ab263efce 100644 (file)
@@ -93,7 +93,7 @@
        "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; " \
index f7667eca7c09c46600c7a572e0153bc56ec52a9e..9361507a55b8262da3acc099865dfc4042e7ea95 100644 (file)
        "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; " \