Patchwork [v1,2/3] RTC: rtc-cmos.c: enable RTC_DM_BINARY of RTC_LIB for fuloong2e and fuloong2f

login
register
mail settings
Submitter Zhangjin Wu
Date Nov. 5, 2009, 1:22 a.m.
Message ID <f05318584db5160d73af2cfb36b4e3e481a7e7a4.1257383766.git.wuzhangjin@gmail.com>
Download mbox | patch
Permalink /patch/37715/
State RFC
Headers show

Comments

Zhangjin Wu - Nov. 5, 2009, 1:22 a.m.
This patch enables the RTC_DM_BINARY support for RTC_LIB of fuloong2e
and fuloong2f. without it, RTC_LIB not work on those machines.

The platform RTC device driver is coming in the next patch.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/rtc/rtc-cmos.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
Alessandro Zummo - Dec. 3, 2009, 4:27 p.m.
On Thu,  5 Nov 2009 09:22:09 +0800
Wu Zhangjin <wuzhangjin@gmail.com> wrote:

>  	 */
> -	if (is_valid_irq(rtc_irq) &&
> -	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
> -		dev_dbg(dev, "only 24-hr BCD mode supported\n");
> +	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
> +		dev_dbg(dev, "only 24-hr supported\n");

 If this check was there it's probably because there are problems
 in some other parts of the driver. I'm not keen to add this without
 some feedback by the original author or porter.
Zhangjin Wu - Dec. 3, 2009, 4:44 p.m.
On Thu, 2009-12-03 at 17:27 +0100, Alessandro Zummo wrote:
> On Thu,  5 Nov 2009 09:22:09 +0800
> Wu Zhangjin <wuzhangjin@gmail.com> wrote:
> 
> >  	 */
> > -	if (is_valid_irq(rtc_irq) &&
> > -	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
> > -		dev_dbg(dev, "only 24-hr BCD mode supported\n");
> > +	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
> > +		dev_dbg(dev, "only 24-hr supported\n");
> 
>  If this check was there it's probably because there are problems
>  in some other parts of the driver. I'm not keen to add this without
>  some feedback by the original author or porter.
> 

Just found two authors or porters from the file: drivers/rtc/rtc-cmos.c

/*
 * RTC class driver for "CMOS RTC":  PCs, ACPI, etc
 *
 * Copyright (C) 1996 Paul Gortmaker (drivers/char/rtc.c)
 * Copyright (C) 2006 David Brownell (convert to new framework)
[...]

and found out their names in MAINTAINERS and put them in the CC list ;)

Regards,
	Wu Zhangjin
David Brownell - Jan. 26, 2010, 2:03 a.m.
On Thursday 03 December 2009, Wu Zhangjin wrote:
> On Thu, 2009-12-03 at 17:27 +0100, Alessandro Zummo wrote:
> > On Thu,  5 Nov 2009 09:22:09 +0800
> > Wu Zhangjin <wuzhangjin@gmail.com> wrote:
> > 
> > >  	 */
> > > -	if (is_valid_irq(rtc_irq) &&
> > > -	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
> > > -		dev_dbg(dev, "only 24-hr BCD mode supported\n");
> > > +	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
> > > +		dev_dbg(dev, "only 24-hr supported\n");
> > 
> >  If this check was there it's probably because there are problems
> >  in some other parts of the driver. I'm not keen to add this without
> >  some feedback by the original author or porter.

As *already* noted in the code:  <asm-generic/rtc.h> only handles BCD.
And that's what's used to access most of those registers.

Patch

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 21e48f7..820bdad 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -757,9 +757,8 @@  cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
 	/* FIXME teach the alarm code how to handle binary mode;
 	 * <asm-generic/rtc.h> doesn't know 12-hour mode either.
 	 */
-	if (is_valid_irq(rtc_irq) &&
-	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
-		dev_dbg(dev, "only 24-hr BCD mode supported\n");
+	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
+		dev_dbg(dev, "only 24-hr supported\n");
 		retval = -ENXIO;
 		goto cleanup1;
 	}