public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Cc: u-boot@lists.denx.de, sjg@chromium.org
Subject: Re: [PATCH v2] rtc: ds1307: Handle oscillator-stop bit correctly
Date: Wed, 13 Oct 2021 10:16:33 -0400	[thread overview]
Message-ID: <20211013141633.GS7964@bill-the-cat> (raw)
In-Reply-To: <20210927211041.2079-1-mark.tomlinson@alliedtelesis.co.nz>

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

On Tue, Sep 28, 2021 at 10:10:42AM +1300, Mark Tomlinson wrote:

> The DS1307 driver was originally based on the DS1337 driver. However,
> the functionality of the clock set/get functions has diverged. In the
> original DS1337 driver, the set/get functions did the following:
>   1) Setting the clock ensured the oscillator was enabled.
>   2) Getting the clock checked and reset the oscillator-stop flag.
> The DS1307 does not have an oscillator-stop flag, but the driver tried
> (incorrectly) to emulate this by ensuring the oscillator was running. It
> really makes no sense to start a stopped clock without setting it.
> 
> This patch makes the DS1307 driver behave like the original DS1337
> driver again. For the DS1307 itself, this is just a removal of code,
> since there is no oscillator-fail bit to check or reset, and the clock
> is started when it is set. Since the DS1307 driver can now also be used
> for the DS1337 and DS1340 which do have this bit, add code to handle the
> oscillator-stop bit in the same was the original DS1337 driver did --
> i.e. report that the oscillator had stopped and clear the flag.
> 
> This means that setting the date using the date command (which does both
> a get and a set) will now clear the oscillator-stop flag in addition to
> setting and starting the clock.
> 
> The old-style (non-DM) code has not been updated and will be removed in
> a future patch. Note that this older code does not support the DS1337,
> as there is a separate driver for this. Also note that the original (DM)
> code used the wrong control-register address for the DS1337.
> 
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

      reply	other threads:[~2021-10-13 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 21:10 [PATCH v2] rtc: ds1307: Handle oscillator-stop bit correctly Mark Tomlinson
2021-10-13 14:16 ` Tom Rini [this message]

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=20211013141633.GS7964@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=mark.tomlinson@alliedtelesis.co.nz \
    --cc=sjg@chromium.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox