Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264469
b: refs/heads/master
c: 75a2385
h: refs/heads/master
i:
  264467: 7c22ad8
v: v3
  • Loading branch information
Finn Thain authored and Geert Uytterhoeven committed Oct 24, 2011
1 parent 4244a4b commit ed75f1d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 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: d996e9dc453a5f327961f19d274c6481b3bf4f34
refs/heads/master: 75a23850cd282eeafbe23d6a9ade4eaf23babd51
40 changes: 23 additions & 17 deletions trunk/arch/m68k/mac/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,35 +304,41 @@ static void via_write_pram(int offset, __u8 data)
static long via_read_time(void)
{
union {
__u8 cdata[4];
long idata;
__u8 cdata[4];
long idata;
} result, last_result;
int ct;
int count = 1;

via_pram_command(0x81, &last_result.cdata[3]);
via_pram_command(0x85, &last_result.cdata[2]);
via_pram_command(0x89, &last_result.cdata[1]);
via_pram_command(0x8D, &last_result.cdata[0]);

/*
* The NetBSD guys say to loop until you get the same reading
* twice in a row.
*/

ct = 0;
do {
if (++ct > 10) {
printk("via_read_time: couldn't get valid time, "
"last read = 0x%08lx and 0x%08lx\n",
last_result.idata, result.idata);
break;
}

last_result.idata = result.idata;
result.idata = 0;

while (1) {
via_pram_command(0x81, &result.cdata[3]);
via_pram_command(0x85, &result.cdata[2]);
via_pram_command(0x89, &result.cdata[1]);
via_pram_command(0x8D, &result.cdata[0]);
} while (result.idata != last_result.idata);

return result.idata - RTC_OFFSET;
if (result.idata == last_result.idata)
return result.idata - RTC_OFFSET;

if (++count > 10)
break;

last_result.idata = result.idata;
}

pr_err("via_read_time: failed to read a stable value; "
"got 0x%08lx then 0x%08lx\n",
last_result.idata, result.idata);

return 0;
}

/*
Expand Down

0 comments on commit ed75f1d

Please sign in to comment.