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]
Message-ID: <5611d1c5-44db-4144-3c46-256323d39fe3@arm.com>
Date:   Fri, 8 Jul 2022 17:17:22 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Frank Wunderlich <linux@...web.de>,
        linux-rockchip@...ts.infradead.org
Cc:     Frank Wunderlich <frank-w@...lic-files.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Heiko Stuebner <heiko@...ech.de>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, linux-rtc@...r.kernel.org,
        Peter Geis <pgwipeout@...il.com>
Subject: Re: [PATCH 1/2] rtc: hym8563: try multiple times to init device

On 2022-06-08 17:11, Frank Wunderlich wrote:
> From: Peter Geis <pgwipeout@...il.com>
> 
> RTC sometimes does not respond the first time in init.
> Try multiple times to get a response.

FWIW, given that HYM8563 is fairly common on RK3288 boards - I can't say 
I've ever noticed an issue with mine, for instance - it seems dubious 
that this would be a general issue of the chip itself. Are you sure it's 
not a SoC or board-level issue with the I2C bus being in a funny initial 
state, timings being marginal, or suchlike?

Robin.

> Signed-off-by: Peter Geis <pgwipeout@...il.com>
> Signed-off-by: Frank Wunderlich <frank-w@...lic-files.de>
> ---
>   drivers/rtc/rtc-hym8563.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
> index 90e602e99d03..9adcedaa4613 100644
> --- a/drivers/rtc/rtc-hym8563.c
> +++ b/drivers/rtc/rtc-hym8563.c
> @@ -13,6 +13,7 @@
>   #include <linux/clk-provider.h>
>   #include <linux/i2c.h>
>   #include <linux/bcd.h>
> +#include <linux/delay.h>
>   #include <linux/rtc.h>
>   
>   #define HYM8563_CTL1		0x00
> @@ -438,10 +439,16 @@ static irqreturn_t hym8563_irq(int irq, void *dev_id)
>   
>   static int hym8563_init_device(struct i2c_client *client)
>   {
> -	int ret;
> +	int ret, i;
>   
>   	/* Clear stop flag if present */
> -	ret = i2c_smbus_write_byte_data(client, HYM8563_CTL1, 0);
> +	for (i = 0; i < 3; i++) {
> +		ret = i2c_smbus_write_byte_data(client, HYM8563_CTL1, 0);
> +		if (ret == 0)
> +			break;
> +		msleep(20);
> +	}
> +
>   	if (ret < 0)
>   		return ret;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ