All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Miguel Gonçalves" <jose.goncalves@inov.pt>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] S3C24XX: Add RTC driver
Date: Thu, 13 Sep 2012 00:28:32 +0100	[thread overview]
Message-ID: <50511AA0.3030104@inov.pt> (raw)
In-Reply-To: <201209122303.35665.marex@denx.de>

Hi Marek,

On 09/12/2012 10:03 PM, Marek Vasut wrote:
> Dear Jos? Miguel Gon?alves,
>
>> +static inline void rtc_access_disable(void)
>> +{
>> +	s3c24xx_rtc *const rtc = s3c24xx_get_base_rtc();
>> +	uchar rtccon;
>> +
>> +	rtccon = readb(&rtc->rtccon);
>> +	rtccon &= ~0x01;
> Magic numbers, fix globally in the patchset

OK.

>> +	writeb(rtccon, &rtc->rtccon);
>> +}
>> +
>> +/*
>> -------------------------------------------------------------------------
>> */ +
>> +int rtc_get(struct rtc_time *tmp)
>> +{
>> +	s3c24xx_rtc *const rtc = s3c24xx_get_base_rtc();
>> +	uchar sec, min, hour, mday, wday, mon, year;
>> +	int have_retried = 0;
>> +
>> +	rtc_access_enable();
>> +
>> +	/* Read RTC registers */
>> +retry_get_time:
>> +	min = readb(&rtc->bcdmin);
>> +	hour = readb(&rtc->bcdhour);
>> +	mday = readb(&rtc->bcddate);
>> +	wday = readb(&rtc->bcdday);
>> +	mon = readb(&rtc->bcdmon);
>> +	year = readb(&rtc->bcdyear);
>> +	sec = readb(&rtc->bcdsec);
>> +
>> +	/* The only way to work out whether the RTC was mid-update
>> +	 * when we read it is to check the seconds counter.
>> +	 * If it's zero, then we re-try the entire read.
>> +	 */
> Wrong multiline comment style ... use ./tools/checkpatch.pl before resending

OK.

>
>> +	if (rtc->bcdsec == 0 && !have_retried) {
> I'm sure you can avoid the goto here ...besides, this rtc->bcdsec doesn't make
> much sense

I could do it with a do..while loop instead... this part was copied from 
the linux driver.
And there is a bug... instead of 'rtc->bcdsec' it should be 'sec'!


Regards,
Jos? Gon?alves

  reply	other threads:[~2012-09-12 23:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 11:15 [U-Boot] [PATCH 0/7] Add support to MINI2416 board José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 1/7] ARM: fix relocation on ARM926EJS José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 2/7] S3C24XX: Add core support for Samsung's S3C24XX SoCs José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 3/7] S3C24XX: Add serial driver José Miguel Gonçalves
2012-09-12 21:01   ` Marek Vasut
2012-09-13  0:54     ` José Miguel Gonçalves
2012-09-13  9:17       ` Marek Vasut
2012-09-13  9:30         ` José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 4/7] S3C24XX: Add RTC driver José Miguel Gonçalves
2012-09-12 21:03   ` Marek Vasut
2012-09-12 23:28     ` José Miguel Gonçalves [this message]
2012-09-12 11:15 ` [U-Boot] [PATCH 5/7] S3C24XX: Add NAND Flash driver José Miguel Gonçalves
2012-09-12 21:11   ` Marek Vasut
2012-09-12 23:16     ` José Miguel Gonçalves
2012-09-12 23:20       ` Scott Wood
2012-09-13  0:18         ` José Miguel Gonçalves
2012-09-13  0:24           ` Marek Vasut
2012-09-13  0:40             ` José Miguel Gonçalves
2012-09-13  0:44               ` Marek Vasut
2012-09-12 23:45       ` Marek Vasut
2012-09-12 23:55         ` José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 6/7] Add u-boot-ubl.bin target to the Makefile José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 7/7] S3C24XX: Add support to MINI2416 board José Miguel Gonçalves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50511AA0.3030104@inov.pt \
    --to=jose.goncalves@inov.pt \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.