On 30/03/2017 at 14:21:30 -0700, Paul Burton wrote:
> The oscillator failure bit of the flags register defaults to 1 when the
> m41t80 RTC device is powered up. If we don't clear it as the manual says
> we should then the bit remains set permanently and since commit
> 05a7f27a889f ("rtc: m41t80: handle oscillator failure bit") we spam the
> kernel console with an error message on every attempt to read the RTC,
> for example:
>
> Welcome to Buildroot
> mips64r6-n32-le-hf-soak login: [ 15.534459] rtc-m41t80 0-0068:
> Oscillator failure, data is invalid.
> [ 16.526308] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
> [ 19.534342] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
> [ 20.526327] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
>
That is the expected behavior. If power failed at some point you
shouldn't read the RTC until you set time again.
I would agree that the message is kind of overkill but I usually let the
decision to the driver author.
> Fix this by clearing the OF flag during probe, as the m41t80 manual
> says we ought to.
>
No, clearing this bit in probe destroys valuable information.
> Signed-off-by: Paul Burton <[email protected]>
> Fixes: 05a7f27a889f ("rtc: m41t80: handle oscillator failure bit")
> Cc: Alessandro Zummo <[email protected]>
> Cc: Alexandre Belloni <[email protected]>
> Cc: Mylčne Josserand <[email protected]>
> Cc: [email protected]
> Cc: <[email protected]> # v4.7+
>
> ---
>
> drivers/rtc/rtc-m41t80.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
> index 58698d21c2c3..33be6e4694f6 100644
> --- a/drivers/rtc/rtc-m41t80.c
> +++ b/drivers/rtc/rtc-m41t80.c
> @@ -813,6 +813,17 @@ static int m41t80_probe(struct i2c_client *client,
>
> m41t80_data->rtc = rtc;
>
> + /* Clear the OF (Oscillator failure) bit, which is 1 on power up */
> + rc = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS);
> + if (rc < 0) {
> + dev_warn(&client->dev, "unable to read flags");
> + } else if (rc & M41T80_FLAGS_OF) {
> + rc &= ~M41T80_FLAGS_OF;
> + rc = i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS, rc);
> + if (rc)
> + dev_warn(&client->dev, "unable to clear OF flag");
> + }
> +
> /* Make sure HT (Halt Update) bit is cleared */
> rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_HOUR);
>
> --
> 2.12.1
>
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups
"rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.