summaryrefslogtreecommitdiff
path: root/rtc/ds12887.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-26 22:04:09 +0000
committerwdenk <wdenk>2003-06-26 22:04:09 +0000
commit993cad9364c6b87ae429d1ed1130d8153f6f027e (patch)
tree43faaa643caeaacec331db78850a5a4834bad354 /rtc/ds12887.c
parentb783edaee8252bfdba3f7b3fd29519a81ce71e42 (diff)
* Patches by Robert Schwebel, 26 Jun 2003:U-Boot-0_4_0
- logdl - csb226 - innokom * Patch by Pantelis Antoniou, 25 Jun 2003: update NetVia with V2 board support
Diffstat (limited to 'rtc/ds12887.c')
-rw-r--r--rtc/ds12887.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/rtc/ds12887.c b/rtc/ds12887.c
index 5d9c5dd1390..cf572ccdb41 100644
--- a/rtc/ds12887.c
+++ b/rtc/ds12887.c
@@ -45,7 +45,7 @@
#define RTC_CONTROL_C 0x0C
#define RTC_CONTROL_D 0x0D
-#define RTC_CA_UIP 0x80
+#define RTC_CA_UIP 0x80
#define RTC_CB_DM 0x04
#define RTC_CB_24_12 0x02
#define RTC_CB_SET 0x80
@@ -55,10 +55,10 @@
static uchar rtc_read (uchar reg)
{
uchar val;
-
+
*(volatile unsigned char*)(RTC_PORT_ADDR) = reg;
__asm__ __volatile__ ("sync");
-
+
val = *(volatile unsigned char*)(RTC_PORT_DATA);
return (val);
}
@@ -95,7 +95,7 @@ void rtc_get (struct rtc_time *tmp)
/* check if rtc is available for access */
while( rtc_read(RTC_CONTROL_A) & RTC_CA_UIP)
;
-
+
sec = rtc_read(RTC_SECONDS);
min = rtc_read(RTC_MINUTES);
hour = rtc_read(RTC_HOURS);
@@ -183,11 +183,11 @@ void rtc_set (struct rtc_time *tmp)
min = tmp->tm_min;
sec = tmp->tm_sec;
}
-
+
/* disables the RTC to update the regs */
save_ctrl_b = rtc_read(RTC_CONTROL_B);
save_ctrl_b |= RTC_CB_SET;
- rtc_write(RTC_CONTROL_B, save_ctrl_b);
+ rtc_write(RTC_CONTROL_B, save_ctrl_b);
rtc_write (RTC_YEAR, year);
rtc_write (RTC_MONTH, mon);
@@ -199,24 +199,24 @@ void rtc_set (struct rtc_time *tmp)
/* enables the RTC to update the regs */
save_ctrl_b &= ~RTC_CB_SET;
- rtc_write(RTC_CONTROL_B, save_ctrl_b);
+ rtc_write(RTC_CONTROL_B, save_ctrl_b);
}
void rtc_reset (void)
{
struct rtc_time tmp;
uchar ctrl_rg;
-
+
ctrl_rg = RTC_CB_SET;
- rtc_write(RTC_CONTROL_B,ctrl_rg);
-
+ rtc_write(RTC_CONTROL_B,ctrl_rg);
+
tmp.tm_year = 1970 % 100;
tmp.tm_mon = 1;
tmp.tm_mday= 1;
tmp.tm_hour = 0;
tmp.tm_min = 0;
tmp.tm_sec = 0;
-
+
#ifdef RTC_DEBUG
printf ( "RTC: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
tmp.tm_year, tmp.tm_mon, tmp.tm_mday,
@@ -224,15 +224,15 @@ void rtc_reset (void)
#endif
ctrl_rg = RTC_CB_SET | RTC_CB_24_12 | RTC_CB_DM;
- rtc_write(RTC_CONTROL_B,ctrl_rg);
+ rtc_write(RTC_CONTROL_B,ctrl_rg);
rtc_set(&tmp);
rtc_write(RTC_HOURS_ALARM, 0),
- rtc_write(RTC_MINUTES_ALARM, 0),
+ rtc_write(RTC_MINUTES_ALARM, 0),
rtc_write(RTC_SECONDS_ALARM, 0);
-
+
ctrl_rg = RTC_CB_24_12 | RTC_CB_DM;
- rtc_write(RTC_CONTROL_B,ctrl_rg);
+ rtc_write(RTC_CONTROL_B,ctrl_rg);
}
#endif /* (CONFIG_RTC_DS12887) && (CONFIG_COMMANDS & CFG_CMD_DATE) */