linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Generic RTC driver in 2.4.x
       [not found] <200301112050.46194.deller@gmx.de>
@ 2003-01-12 11:33 ` Geert Uytterhoeven
  2003-01-12 12:35   ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2003-01-12 11:33 UTC (permalink / raw)
  To: Helge Deller; +Cc: Alan Cox, parisc-linux, Linux/PPC Development, Linux/m68k


On Sat, 11 Jan 2003, Helge Deller wrote:
> On Friday 10 January 2003 21:05, Geert Uytterhoeven wrote:
> > Unfortunately I didn't receive any feedback from the pa-risc and ppc people
> > after my previous posting last Sunday.
>
> It took me some time, but here are the PA-RISC specific patches vs. your
> latest genrtc driver.
>
> Please consider applying,

Thanks! Applied.

I made some more changes afterwards:
  - Remove unnecessary forward declaration of gen_rtc_ioctl()
  - Add forward declaration for gen_rtc_interrupt()
  - Remove obsolete extern declaration for gen_rtc_interrupt() on m68k
  - Change `unsigned' to `unsigned int'
  - Change value of RTC_BATT_BAD to 0x100 (0x10 conflicted with RTC_UIE, and
    0x01 is already used in <linux/mc146818rtc.h>)
  - Update m68k get_rtc_time() to return flags

BTW, perhaps we should move the global RTC_* definitions in <asm/rtc.h> to
<linux/genrtc.h>, or merge them with the ones in <linux/mc146818rtc.h> and move
them to <linux/rtc.h>?

--- linux-genrtc-parisc-2.4.20/drivers/char/genrtc.c	Sun Jan 12 12:01:23 2003
+++ linux-m68k-2.4.20/drivers/char/genrtc.c	Sun Jan 12 12:18:21 2003
@@ -66,8 +66,8 @@

 static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait);

-static int gen_rtc_ioctl(struct inode *inode, struct file *file,
-		     unsigned int cmd, unsigned long arg);
+static void gen_rtc_interrupt(unsigned long arg);
+

 /*
  *	Bits in gen_rtc_status.
@@ -446,7 +446,7 @@
 {
 	char *p;
 	struct rtc_time tm;
-	unsigned flags;
+	unsigned int flags;
 	struct rtc_pll_info pll;

 	p = buf;
--- linux-genrtc-parisc-2.4.20/include/asm-parisc/rtc.h	Sun Jan 12 12:01:23 2003
+++ linux-m68k-2.4.20/include/asm-parisc/rtc.h	Sun Jan 12 11:05:53 2003
@@ -12,8 +12,9 @@
 #define RTC_AIE 0x20		/* alarm interrupt enable */
 #define RTC_UIE 0x10		/* update-finished interrupt enable */

+#define RTC_BATT_BAD 0x100	/* battery bad */
+
 /* some dummy definitions */
-#define RTC_BATT_BAD 0x10	/* battery bad */
 #define RTC_SQWE 0x08		/* enable square-wave output */
 #define RTC_DM_BINARY 0x04	/* all time/date values are BCD if clear */
 #define RTC_24H 0x02		/* 24 hour mode - else hours bit 7 means pm */
@@ -37,7 +38,7 @@
 	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
 };

-static inline unsigned get_rtc_time(struct rtc_time *wtime)
+static inline unsigned int get_rtc_time(struct rtc_time *wtime)
 {
 	/*
 	 * Only the values that we read from the RTC are set. We leave
--- linux-genrtc-parisc-2.4.20/include/asm-m68k/rtc.h	Fri Jan 10 20:54:25 2003
+++ linux-m68k-2.4.20/include/asm-m68k/rtc.h	Sun Jan 12 12:18:29 2003
@@ -21,15 +21,14 @@
 #define RTC_AIE 0x20		/* alarm interrupt enable */
 #define RTC_UIE 0x10		/* update-finished interrupt enable */

-extern void gen_rtc_interrupt(unsigned long);
-
 /* some dummy definitions */
+#define RTC_BATT_BAD 0x100	/* battery bad */
 #define RTC_SQWE 0x08		/* enable square-wave output */
 #define RTC_DM_BINARY 0x04	/* all time/date values are BCD if clear */
 #define RTC_24H 0x02		/* 24 hour mode - else hours bit 7 means pm */
 #define RTC_DST_EN 0x01	        /* auto switch DST - works f. USA only */

-static inline void get_rtc_time(struct rtc_time *time)
+static inline unsigned int get_rtc_time(struct rtc_time *time)
 {
 	/*
 	 * Only the values that we read from the RTC are set. We leave
@@ -38,6 +37,7 @@
 	 * by the RTC when initially set to a non-zero value.
 	 */
 	mach_hwclk(0, time);
+	return RTC_24H;
 }

 static inline int set_rtc_time(struct rtc_time *time)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Generic RTC driver in 2.4.x
  2003-01-12 11:33 ` Generic RTC driver in 2.4.x Geert Uytterhoeven
@ 2003-01-12 12:35   ` Helge Deller
  2003-01-12 21:49     ` Richard Zidlicky
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2003-01-12 12:35 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Alan Cox, parisc-linux, Linux/PPC Development, Linux/m68k

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On Sunday 12 January 2003 12:33, Geert Uytterhoeven wrote:
> I made some more changes afterwards:
>   - Add forward declaration for gen_rtc_interrupt()

This one should be moved inside the #ifdef CONFIG_GEN_RTC_X section to
avoid "genrtc.c:69: warning: `gen_rtc_interrupt' declared `static' but never defined"
warnings. Please see attached patch.

Or, you could just move the declaration of gen_rtc_interrupt() above the one
from genrtc_troutine(), in which case we wouldn't need the forward declaration at all.

> BTW, perhaps we should move the global RTC_* definitions in <asm/rtc.h> to
> <linux/genrtc.h>, or merge them with the ones in <linux/mc146818rtc.h> and
> move them to <linux/rtc.h>?

IMHO leaving them architecture specific in <asm/rtc.h> seems best to me, and it
leaves the most possibilities to make them later more dependend on the hardware.

Helge


[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 571 bytes --]

--- ./genrtc.c.geert	Sun Jan 12 13:16:40 2003
+++ ./genrtc.c	Sun Jan 12 13:15:18 2003
@@ -66,9 +66,6 @@

 static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait);

-static void gen_rtc_interrupt(unsigned long arg);
-
-
 /*
  *	Bits in gen_rtc_status.
  */
@@ -99,6 +96,8 @@
 static int stop_rtc_timers;                    /* don't requeue tasks */
 static spinlock_t gen_rtc_lock = SPIN_LOCK_UNLOCKED;

+static void gen_rtc_interrupt(unsigned long arg);
+
 /*
  * Routine to poll RTC seconds field for change as often as posible,
  * after first RTC_UIE use timer to reduce polling

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Generic RTC driver in 2.4.x
  2003-01-12 12:35   ` Helge Deller
@ 2003-01-12 21:49     ` Richard Zidlicky
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Zidlicky @ 2003-01-12 21:49 UTC (permalink / raw)
  To: Helge Deller
  Cc: Geert Uytterhoeven, Alan Cox, parisc-linux, Linux/PPC Development,
	Linux/m68k


On Sun, Jan 12, 2003 at 01:35:33PM +0100, Helge Deller wrote:

> > BTW, perhaps we should move the global RTC_* definitions in <asm/rtc.h> to
> > <linux/genrtc.h>, or merge them with the ones in <linux/mc146818rtc.h> and
> > move them to <linux/rtc.h>?
>
> IMHO leaving them architecture specific in <asm/rtc.h> seems best to me, and it
> leaves the most possibilities to make them later more dependend on the hardware.

in genrtc the RTC_* defs should be used only for interface definition,
unlike rtc.c where they are 1:1 with some obscure bits in the rtc chip
and also happen to be the interface..
It would make sense to merge them into <linux/rtc.h>, whether it is
a good idea to do it in 2.4 is another question.
Stuff that is really hw dependent should use different naming (and stay
in asm/rtc.h of course).

Richard


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-12 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200301112050.46194.deller@gmx.de>
2003-01-12 11:33 ` Generic RTC driver in 2.4.x Geert Uytterhoeven
2003-01-12 12:35   ` Helge Deller
2003-01-12 21:49     ` Richard Zidlicky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).