From 36e3e7deb25773cf8ef2533612361490d175967f Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Wed, 2 Sep 2020 19:31:43 +0200 Subject: board: ge: common: rename ge_common.c to ge_rtc.c The file only contains RTC related code, so let's name it accordingly. Signed-off-by: Sebastian Reichel --- board/ge/bx50v3/bx50v3.c | 2 +- board/ge/common/Makefile | 2 +- board/ge/common/ge_common.c | 56 --------------------------------------------- board/ge/common/ge_common.h | 6 ----- board/ge/common/ge_rtc.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ board/ge/common/ge_rtc.h | 6 +++++ board/ge/mx53ppd/mx53ppd.c | 2 +- 7 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 board/ge/common/ge_common.c delete mode 100644 board/ge/common/ge_common.h create mode 100644 board/ge/common/ge_rtc.c create mode 100644 board/ge/common/ge_rtc.h (limited to 'board/ge') diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index cf76cf7a33..c6b0af8c77 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -35,7 +35,7 @@ #include #include #include -#include "../common/ge_common.h" +#include "../common/ge_rtc.h" #include "../common/vpd_reader.h" #include "../../../drivers/net/e1000.h" #include diff --git a/board/ge/common/Makefile b/board/ge/common/Makefile index 8a21dcb8b5..36bedb1980 100644 --- a/board/ge/common/Makefile +++ b/board/ge/common/Makefile @@ -2,4 +2,4 @@ # # Copyright 2017 General Electric Company -obj-y := vpd_reader.o ge_common.o +obj-y := vpd_reader.o ge_rtc.o diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c deleted file mode 100644 index 48c3778046..0000000000 --- a/board/ge/common/ge_common.c +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2017 General Electric Company - */ - -#include -#include -#include -#include - -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"); -} - diff --git a/board/ge/common/ge_common.h b/board/ge/common/ge_common.h deleted file mode 100644 index d33486d082..0000000000 --- a/board/ge/common/ge_common.h +++ /dev/null @@ -1,6 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright 2017 General Electric Company - */ - -void check_time(void); diff --git a/board/ge/common/ge_rtc.c b/board/ge/common/ge_rtc.c new file mode 100644 index 0000000000..48c3778046 --- /dev/null +++ b/board/ge/common/ge_rtc.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2017 General Electric Company + */ + +#include +#include +#include +#include + +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"); +} + diff --git a/board/ge/common/ge_rtc.h b/board/ge/common/ge_rtc.h new file mode 100644 index 0000000000..d33486d082 --- /dev/null +++ b/board/ge/common/ge_rtc.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2017 General Electric Company + */ + +void check_time(void); diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c index 7627e9c370..2e9d389850 100644 --- a/board/ge/mx53ppd/mx53ppd.c +++ b/board/ge/mx53ppd/mx53ppd.c @@ -36,7 +36,7 @@ #include #include "ppd_gpio.h" #include -#include "../../ge/common/ge_common.h" +#include "../../ge/common/ge_rtc.h" #include "../../ge/common/vpd_reader.h" DECLARE_GLOBAL_DATA_PTR; -- cgit v1.2.1