PATCH: add headers for upd4990a rtc/clock driver

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Fri Mar 21 2003 - 14:57:39 EST


diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.65/include/asm-i386/upd4990a.h linux-2.5.65-ac2/include/asm-i386/upd4990a.h
--- linux-2.5.65/include/asm-i386/upd4990a.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.5.65-ac2/include/asm-i386/upd4990a.h 2003-02-20 16:30:58.000000000 +0000
@@ -0,0 +1,52 @@
+/*
+ * Architecture dependent definitions
+ * for NEC uPD4990A serial I/O real-time clock.
+ *
+ * Copyright 2001 TAKAI Kousuke <tak@kmc.kyoto-u.ac.jp>
+ * Kyoto University Microcomputer Club (KMC).
+ *
+ * References:
+ * uPD4990A serial I/O real-time clock users' manual (Japanese)
+ * No. S12828JJ4V0UM00 (4th revision), NEC Corporation, 1999.
+ */
+
+#ifndef _ASM_I386_uPD4990A_H
+#define _ASM_I386_uPD4990A_H
+
+#include <asm/io.h>
+
+#define UPD4990A_IO (0x0020)
+#define UPD4990A_IO_DATAOUT (0x0033)
+
+#define UPD4990A_OUTPUT_DATA_CLK(data, clk) \
+ outb((((data) & 1) << 5) | (((clk) & 1) << 4) \
+ | UPD4990A_PAR_SERIAL_MODE, UPD4990A_IO)
+
+#define UPD4990A_OUTPUT_CLK(clk) UPD4990A_OUTPUT_DATA_CLK(0, (clk))
+
+#define UPD4990A_OUTPUT_STROBE(stb) \
+ outb(((stb) << 3) | UPD4990A_PAR_SERIAL_MODE, UPD4990A_IO)
+
+/*
+ * Note: udelay() is *not* usable for UPD4990A_DELAY because
+ * the Linux kernel reads uPD4990A to set up system clock
+ * before calibrating delay...
+ */
+#define UPD4990A_DELAY(usec) \
+ do { \
+ if (__builtin_constant_p((usec)) && (usec) < 5) \
+ __asm__ (".rept %c1\n\toutb %%al,%0\n\t.endr" \
+ : : "N" (0x5F), \
+ "i" (((usec) * 10 + 5) / 6)); \
+ else { \
+ int _count = ((usec) * 10 + 5) / 6; \
+ __asm__ volatile ("1: outb %%al,%1\n\tloop 1b" \
+ : "=c" (_count) \
+ : "N" (0x5F), "0" (_count)); \
+ } \
+ } while (0)
+
+/* Caller should ignore all bits except bit0 */
+#define UPD4990A_READ_DATA() inb(UPD4990A_IO_DATAOUT)
+
+#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:38 EST