All of lore.kernel.org
 help / color / mirror / Atom feed
From: carlo.caione@gmail.com (Carlo Caione)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] ARM: sun4i/sun7i: RTC driver
Date: Wed, 6 Nov 2013 22:07:36 +0100	[thread overview]
Message-ID: <CAOQ7t2b4WpH2fpSMC9DbczVSZMSQ=WNyQzoKiJi=r1JD9os-7Q@mail.gmail.com> (raw)
In-Reply-To: <20131106141357.GQ26440@lukather>

On Wed, Nov 6, 2013 at 3:13 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi Carlo,
[cut]

> So this means that whenever the time actually has a number of seconds
> = 0, you just loop over, adding a 500ms delay? That seems pretty
> inefficient to me.

I agree. Any suggestion is welcome.

> Also, what happens if you get two times in a row a number of seconds
> equals to 0?

in that case I think that using t <= 2 in the for cycle will solve the problem.

> This kind of construct seems really really odd, and doesn't the issue
> you were trying to address.
>
> However, this looks like a common issue. Have you looked at the other
> drivers to see how they are handling it? Maybe Alessandro will have
> some suggestions as well.

This portion of the code is taken from the original RTC driver leaked
from Allwinner.
Otherwise a better solution could be something like in
http://lxr.linux.no/linux+v3.12/drivers/rtc/rtc-at91rm9200.c#L114

> So, that means that the A10 RTC starts a year 1900, and the A20 at
> year 2010? Why not just put those in your year_offset field directly?

Agree

> Why not just busy-wait ? (with a timeout if you really want to).

because if it fails after 150ms you are almost certainly screwed and
something is wrong

> Isn't the write operation supposed to be done already?

In theory yes, in practice you cannot be sure. This is also a legacy
of the old AW's code. I'll investigate more to check if this is really
useful.

Thanks,

--
Carlo Caione

  reply	other threads:[~2013-11-06 21:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 22:38 [PATCH v3 1/2] ARM: sun4i/sun7i: RTC driver Carlo Caione
2013-10-30 22:38 ` [PATCH v3 2/2] ARM: sun4i/sun7i: DT documentation for " Carlo Caione
2013-11-06 14:14   ` Maxime Ripard
2013-11-06 10:01 ` [PATCH v3 1/2] ARM: sun4i/sun7i: " Carlo Caione
2013-11-06 14:13 ` Maxime Ripard
2013-11-06 21:07   ` Carlo Caione [this message]
2013-11-08  9:43     ` Maxime Ripard
2013-11-15 22:50   ` Carlo Caione
2013-11-16  8:51     ` Maxime Ripard
2013-11-16 12:58       ` Carlo Caione
2013-11-19 11:28         ` Maxime Ripard

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='CAOQ7t2b4WpH2fpSMC9DbczVSZMSQ=WNyQzoKiJi=r1JD9os-7Q@mail.gmail.com' \
    --to=carlo.caione@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.