summaryrefslogtreecommitdiff
path: root/common/cmd_date.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-12-17 16:53:07 +0100
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-12-17 16:53:07 +0100
commitcb5473205206c7f14cbb1e747f28ec75b48826e2 (patch)
tree8f4808d60917100b18a10b05230f7638a0a9bbcc /common/cmd_date.c
parentbaf449fc5ff96f071bb0e3789fd3265f6d4fd9a0 (diff)
parent92c78a3bbcb2ce508b4bf1c4a1e0940406a024bb (diff)
downloadu-boot-imx-cb5473205206c7f14cbb1e747f28ec75b48826e2.zip
u-boot-imx-cb5473205206c7f14cbb1e747f28ec75b48826e2.tar.gz
u-boot-imx-cb5473205206c7f14cbb1e747f28ec75b48826e2.tar.bz2
Merge branch 'fixes' into cleanups
Conflicts: board/atmel/atngw100/atngw100.c board/atmel/atstk1000/atstk1000.c cpu/at32ap/at32ap700x/gpio.c include/asm-avr32/arch-at32ap700x/clk.h include/configs/atngw100.h include/configs/atstk1002.h include/configs/atstk1003.h include/configs/atstk1004.h include/configs/atstk1006.h include/configs/favr-32-ezkit.h include/configs/hammerhead.h include/configs/mimc200.h
Diffstat (limited to 'common/cmd_date.c')
-rw-r--r--common/cmd_date.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/common/cmd_date.c b/common/cmd_date.c
index 7511598..b4d9649 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -47,7 +47,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* switch to correct I2C bus */
old_bus = I2C_GET_BUS();
- I2C_SET_BUS(CFG_RTC_BUS_NUM);
+ I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM);
switch (argc) {
case 2: /* set date & time */
@@ -56,18 +56,30 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
rtc_reset ();
} else {
/* initialize tm with current time */
- rtc_get (&tm);
- /* insert new date & time */
- if (mk_date (argv[1], &tm) != 0) {
- puts ("## Bad date format\n");
- break;
+ rcode = rtc_get (&tm);
+
+ if(!rcode) {
+ /* insert new date & time */
+ if (mk_date (argv[1], &tm) != 0) {
+ puts ("## Bad date format\n");
+ break;
+ }
+ /* and write to RTC */
+ rcode = rtc_set (&tm);
+ if(rcode)
+ puts("## Set date failled\n");
+ } else {
+ puts("## Get date failled\n");
}
- /* and write to RTC */
- rtc_set (&tm);
}
/* FALL TROUGH */
case 1: /* get date & time */
- rtc_get (&tm);
+ rcode = rtc_get (&tm);
+
+ if (rcode) {
+ puts("## Get date failled\n");
+ break;
+ }
printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n",
tm.tm_year, tm.tm_mon, tm.tm_mday,