linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Mastro Gippo <gipmad@gmail.com>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org
Subject: Re: Infinite loop on edge cases
Date: Tue, 9 Apr 2019 13:27:54 +0200	[thread overview]
Message-ID: <20190409112754.GU7480@piout.net> (raw)
In-Reply-To: <CADjOgT-BK2SyoZD76iLj-fYG-7-2G0SvkFC4M6zakQc+7Q3g_w@mail.gmail.com>

On 09/04/2019 12:46:20+0200, Mastro Gippo wrote:
> Hi Alexandre,
> thank you for your comments.
> Since failure behaviour is not specified in the Maxim datasheet, the
> gracious way to handle this would be a retry counter, as that would
> also solve the problem of a DS1307 that for some reason doesn't set
> the CH bit (maybe an internal oscillator failure?). A similar erratic
> behavior happened to me once, due to an unstable power supply to the
> RTC.

Ok, I had a closer look at the tissue, the solution here is to not
bother and simply not handle DS1307_BIT_CH, DS1338_BIT_OSF,
DS1340_BIT_nEOSC, DS1340_BIT_OSF, MCP794XX_BIT_VBATEN or
MCP794XX_BIT_ST. they should only be handled in the read_time and
set_time callbacks, were they really matters. I'll send a patch for
that.

> IMHO, I think that a hardware failure and/or a problematic I2C driver
> should not produce an infinite loop - be it fatal or not.

This is correct and this has to be fixed. I must admit I was too quick
and didn't see this was in the probe function.

> I already solved my boot issue with this patch, and I will ship it
> with the devices I sell, but may I ask you what approach would you
> recommend instead of hctosys? I tried looking online for solutions but
> couldn't find an "official" one. I will gladly investigate better
> approaches if available.
> 

Many distributions have initscripts that are using hwclock to set the
system time at boot and save it at shutdown. The kernel is not doing a
good job at setting the system time and saving it for technical and
historical reasons. hctosys and systohc should not be used.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-04-09 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADjOgT97-8PM1=Nm+Mk4jw_8vzt3i9KXUohDAkUsptxS7JuU6Q@mail.gmail.com>
2019-04-09  9:01 ` Infinite loop on edge cases Alexandre Belloni
2019-04-09 10:46   ` Mastro Gippo
2019-04-09 11:27     ` Alexandre Belloni [this message]
2019-04-09 14:35       ` Mastro Gippo
2019-04-15 15:34         ` Alexandre Belloni
2019-04-09  8:46 Mastro Gippo

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=20190409112754.GU7480@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=gipmad@gmail.com \
    --cc=linux-rtc@vger.kernel.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 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).