linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Option to disable mapping genrtc calls to ppc_md calls
@ 2005-01-17 21:10 Mark A. Greer
  2005-01-18  9:20 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Mark A. Greer @ 2005-01-17 21:10 UTC (permalink / raw)
  To: linuxppc-dev

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

All,

I have a platform with an i2c rtc chip.  Since much of the code for an 
rtc driver is already in drivers/char/genrtc.c, I would like to reuse 
that code and directly implement get_rtc_time(), et. al. in the rtc 
driver.  The problem is that include/asm-ppc/rtc.h assumes that 
get_rtc_time(), et. al. should be mapped to ppc_md.get_rtc_time() et. 
al.  To work around this, I made an option to turn off that assumption.  
The patch is included.

There are 2 reasons to not use the ppc_md.get_rtc_time() et. al. interfaces:
1) They are called before the i2c driver is initialized and even loaded 
if its a module.
2) Its ppc-specific.  Implementing get_rtc_time() et. al. directly makes 
it generic across all architectures.

Is there a better way to do this?

Comments welcome.

Mark

[-- Attachment #2: rtc.patch --]
[-- Type: text/plain, Size: 1635 bytes --]

===== drivers/char/Kconfig 1.60 vs edited =====
--- 1.60/drivers/char/Kconfig	2005-01-15 15:31:07 -07:00
+++ edited/drivers/char/Kconfig	2005-01-17 13:49:52 -07:00
@@ -777,6 +777,17 @@
 	  Provides an emulation for RTC_UIE which is required by some programs
 	  and may improve precision of the generic RTC support in some cases.
 
+config GEN_RTC_DISABLE_RTC_MAPPING
+	bool "Disable mapping genrtc interface to ppc-specific calls"
+	depends on GEN_RTC && PPC32
+	default n
+	help
+	  PPC systems typically map genrtc calls to PPC specific routines.
+	  However, this needs to be disabled when using an RTC chip whose
+	  driver implements the genrtc calls.
+
+	  To disable the mapping to PPC specific routines, chose Y here.
+
 config EFI_RTC
 	bool "EFI Real Time Clock Services"
 	depends on IA64
===== include/asm-ppc/rtc.h 1.7 vs edited =====
--- 1.7/include/asm-ppc/rtc.h	2003-09-12 09:26:56 -07:00
+++ edited/include/asm-ppc/rtc.h	2005-01-17 13:52:52 -07:00
@@ -42,6 +42,7 @@
 #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 */
 
+#if !defined(CONFIG_GEN_RTC_DISABLE_RTC_MAPPING)
 static inline unsigned int get_rtc_time(struct rtc_time *time)
 {
 	if (ppc_md.get_rtc_time) {
@@ -91,5 +92,12 @@
 	return -EINVAL;
 }
 
+#else
+extern unsigned int get_rtc_time(struct rtc_time *time);
+extern int set_rtc_time(struct rtc_time *time);
+extern unsigned int get_rtc_ss(void);
+extern int get_rtc_pll(struct rtc_pll_info *pll);
+extern int set_rtc_pll(struct rtc_pll_info *pll);
+#endif
 #endif /* __KERNEL__ */
 #endif /* __ASM_RTC_H__ */

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

end of thread, other threads:[~2005-01-21 22:03 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-17 21:10 [RFC] Option to disable mapping genrtc calls to ppc_md calls Mark A. Greer
2005-01-18  9:20 ` Geert Uytterhoeven
2005-01-18 18:40   ` Mark A. Greer
2005-01-18 19:01     ` Eugene Surovegin
2005-01-18 16:15 ` Tom Rini
2005-01-18 16:25   ` Dan Malek
2005-01-18 17:39     ` Tolunay Orkun
2005-01-18 18:33       ` Tom Rini
2005-01-18 18:13     ` Tom Rini
2005-01-18 18:58       ` Mark A. Greer
2005-01-18 19:08         ` Tom Rini
2005-01-18 19:43           ` Mark A. Greer
2005-01-19 18:08             ` Tom Rini
2005-01-20 20:52               ` Mark A. Greer
2005-01-20 22:53                 ` Tom Rini
2005-01-20 23:21                   ` Mark A. Greer
2005-01-20 23:47                     ` Tom Rini
2005-01-20 23:56                       ` Mark A. Greer
2005-01-18 18:54     ` Eugene Surovegin
2005-01-20 22:27     ` Benjamin Herrenschmidt
2005-01-18 18:55   ` Mark A. Greer
2005-01-18 19:05     ` Tom Rini
2005-01-18 19:33       ` Mark A. Greer
2005-01-20 22:25 ` Benjamin Herrenschmidt
2005-01-20 23:54   ` Mark A. Greer
2005-01-21  0:01     ` Benjamin Herrenschmidt
2005-01-21  0:09       ` Mark A. Greer
2005-01-21  0:12         ` Benjamin Herrenschmidt
2005-01-21  9:14           ` Geert Uytterhoeven
2005-01-21 14:39             ` Corey Minyard
2005-01-21 22:01             ` Benjamin Herrenschmidt
2005-01-21  9:44         ` Christoph Hellwig

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).