diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2008-03-27 14:36:12 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2008-03-27 14:36:12 +0000 |
commit | a6cd2e431462eef8f28d7d33fd708c001272a3d4 (patch) | |
tree | 02b1b3e7dc323fc36a31144cf5683ee0db99758c /sys/arch/sgi | |
parent | d90634f0d4f05fd259cae2194a91ae28e95102b0 (diff) |
Data mode can only be changed when updating the clock, so don't bother
trying to change to BCD mode before reading. Also, don't assume that the
clock is in 24 hour mode when updating.
tested jasper@, ok miod@
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r-- | sys/arch/sgi/sgi/clock_md.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/arch/sgi/sgi/clock_md.c b/sys/arch/sgi/sgi/clock_md.c index 33908b98c61..95b6626f4e9 100644 --- a/sys/arch/sgi/sgi/clock_md.c +++ b/sys/arch/sgi/sgi/clock_md.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock_md.c,v 1.11 2008/02/20 18:46:20 miod Exp $ */ +/* $OpenBSD: clock_md.c,v 1.12 2008/03/27 14:36:11 jsing Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -102,7 +102,6 @@ md_clk_attach(struct device *parent, struct device *self, void *aux) } } - /* * Dallas clock driver. */ @@ -117,10 +116,6 @@ ds1687_get(struct clock_softc *sc, time_t base, struct tod_time *ct) ctrl = bus_space_read_1(clk_t, clk_h, DS1687_CTRL_A); bus_space_write_1(clk_t, clk_h, DS1687_CTRL_A, ctrl | DS1687_BANK_1); - /* Select data mode 0 (BCD). */ - ctrl = bus_space_read_1(clk_t, clk_h, DS1687_CTRL_B); - bus_space_write_1(clk_t, clk_h, DS1687_CTRL_B, ctrl & ~DS1687_DM_1); - /* Wait for no update in progress. */ while (bus_space_read_1(clk_t, clk_h, DS1687_CTRL_A) & DS1687_UIP) /* Do nothing. */; @@ -151,9 +146,10 @@ ds1687_set(struct clock_softc *sc, struct tod_time *ct) ctrl = bus_space_read_1(clk_t, clk_h, DS1687_CTRL_A); bus_space_write_1(clk_t, clk_h, DS1687_CTRL_A, ctrl | DS1687_BANK_1); - /* Select data mode 0 (BCD). */ + /* Select data mode 0 (BCD) and 24 hour time. */ ctrl = bus_space_read_1(clk_t, clk_h, DS1687_CTRL_B); - bus_space_write_1(clk_t, clk_h, DS1687_CTRL_B, ctrl & ~DS1687_DM_1); + bus_space_write_1(clk_t, clk_h, DS1687_CTRL_B, + (ctrl & ~DS1687_DM_1) | DS1687_24_HR); /* Prevent updates. */ ctrl = bus_space_read_1(clk_t, clk_h, DS1687_CTRL_B); |