Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55915
b: refs/heads/master
c: 4ac24b3
h: refs/heads/master
i:
  55913: 55bb865
  55911: 56d7247
v: v3
  • Loading branch information
kogiidena authored and Linus Torvalds committed May 11, 2007
1 parent d9fe45c commit e1e1b3a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a6a078950d769ff211c1cbd9468e31162481f8d
refs/heads/master: 4ac24b3ba9016881b11646114bb5cd12cf23edd9
19 changes: 18 additions & 1 deletion trunk/drivers/rtc/rtc-rs5c313.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ static inline void rs5c313_write_intintvreg(unsigned char data)
static int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
int data;
int cnt;

cnt = 0;
while (1) {
RS5C313_CEENABLE; /* CE:H */

Expand All @@ -225,6 +227,10 @@ static int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm)
RS5C313_CEDISABLE;
ndelay(700); /* CE:L */

if (cnt++ > 100) {
dev_err(dev, "%s: timeout error\n", __FUNCTION__);
return -EIO;
}
}

data = rs5c313_read_reg(RS5C313_ADDR_SEC);
Expand Down Expand Up @@ -266,7 +272,9 @@ static int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
int data;
int cnt;

cnt = 0;
/* busy check. */
while (1) {
RS5C313_CEENABLE; /* CE:H */
Expand All @@ -279,6 +287,11 @@ static int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm)
RS5C313_MISCOP;
RS5C313_CEDISABLE;
ndelay(700); /* CE:L */

if (cnt++ > 100) {
dev_err(dev, "%s: timeout error\n", __FUNCTION__);
return -EIO;
}
}

data = BIN2BCD(tm->tm_sec);
Expand Down Expand Up @@ -317,6 +330,7 @@ static int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm)
static void rs5c313_check_xstp_bit(void)
{
struct rtc_time tm;
int cnt;

RS5C313_CEENABLE; /* CE:H */
if (rs5c313_read_cntreg() & RS5C313_CNTREG_WTEN_XSTP) {
Expand All @@ -326,8 +340,11 @@ static void rs5c313_check_xstp_bit(void)
rs5c313_write_cntreg(0x07);

/* busy check. */
while (rs5c313_read_cntreg() & RS5C313_CNTREG_ADJ_BSY)
for (cnt = 0; cnt < 100; cnt++) {
if (!(rs5c313_read_cntreg() & RS5C313_CNTREG_ADJ_BSY))
break;
RS5C313_MISCOP;
}

memset(&tm, 0, sizeof(struct rtc_time));
tm.tm_mday = 1;
Expand Down

0 comments on commit e1e1b3a

Please sign in to comment.