lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Mar 2023 15:59:58 +0200
From:   "Esteban Blanc" <eblanc@...libre.com>
To:     "Alexandre Belloni" <alexandre.belloni@...tlin.com>
Cc:     <linus.walleij@...aro.org>, <lgirdwood@...il.com>,
        <broonie@...nel.org>, <a.zummo@...ertech.it>,
        <linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
        <linux-rtc@...r.kernel.org>, <jpanis@...libre.com>,
        <jneanne@...libre.com>, <sterzik@...com>, <u-kumar1@...com>
Subject: Re: [PATCH v2 1/3] rtc: tps6594: add driver for TPS6594 PMIC RTC

On Tue Mar 28, 2023 at 3:34 PM CEST, Alexandre Belloni wrote:
> On 28/03/2023 15:01:05+0200, Esteban Blanc wrote:
> > On Tue Mar 28, 2023 at 11:29 AM CEST, Alexandre Belloni wrote:
> > > Hello,
> > >
> > > On 28/03/2023 11:14:46+0200, Esteban Blanc wrote:
> > > > +	/* Start rtc */
> > > > +	ret = regmap_set_bits(tps->regmap, TPS6594_REG_RTC_CTRL_1,
> > > > +			      TPS6594_BIT_STOP_RTC);
> > > > +	if (ret < 0)
> > > > +		return ret;
> > > > +
> > > > +	mdelay(100);
> > > > +
> > > > +	/*
> > > > +	 * RTC should be running now. Check if this is the case.
> > > > +	 * If not it might be a missing oscillator.
> > > > +	 */
> > > > +	ret = regmap_test_bits(tps->regmap, TPS6594_REG_RTC_STATUS,
> > > > +			       TPS6594_BIT_RUN);
> > > > +	if (ret < 0)
> > > > +		return ret;
> > > > +	if (ret == 0)
> > > > +		return -ENODEV;
> > > > +
> > > > +	/* Stop RTC until first call to `tps6594_rtc_set_time */
> > > > +	ret = regmap_clear_bits(tps->regmap, TPS6594_REG_RTC_CTRL_1,
> > > > +				TPS6594_BIT_STOP_RTC);
> > > > +	if (ret < 0)
> > > > +		return ret;
> > > > +
> > >
> > > This whole block must not be executed when the RTC is already running,
> > > else, you are stopping a perfectly running RTC.
> > 
> > I'm not sure to get your point. You mean that during probe, the driver
> > might encounter an RTC device that is already running with a correct
> > timestamp? How would this be possible? A previous bootstage or the
> > driver was removed then re-inserted again?
> > 
>
> The whole point of having an RTC is that the time tracking survives a
> reboot so yes, I would expect the RTC to have a valid timestamp at probe
> time.

Oh. Oh I see. I did not think of that. I will add a check for that.

Thanks again,

-- 
Esteban Blanc
BayLibre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ