From: Frank Wunderlich <linux@fw-web.de>
To: linux-rockchip@lists.infradead.org
Cc: Frank Wunderlich <frank-w@public-files.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Heiko Stuebner <heiko@sntech.de>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org,
Peter Geis <pgwipeout@gmail.com>
Subject: [PATCH 1/2] rtc: hym8563: try multiple times to init device
Date: Wed, 8 Jun 2022 18:11:48 +0200 [thread overview]
Message-ID: <20220608161150.58919-2-linux@fw-web.de> (raw)
In-Reply-To: <20220608161150.58919-1-linux@fw-web.de>
From: Peter Geis <pgwipeout@gmail.com>
RTC sometimes does not respond the first time in init.
Try multiple times to get a response.
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Frank Wunderlich <frank-w@public-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;
--
2.34.1
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Frank Wunderlich <linux@fw-web.de>
To: linux-rockchip@lists.infradead.org
Cc: Frank Wunderlich <frank-w@public-files.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Heiko Stuebner <heiko@sntech.de>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org,
Peter Geis <pgwipeout@gmail.com>
Subject: [PATCH 1/2] rtc: hym8563: try multiple times to init device
Date: Wed, 8 Jun 2022 18:11:48 +0200 [thread overview]
Message-ID: <20220608161150.58919-2-linux@fw-web.de> (raw)
In-Reply-To: <20220608161150.58919-1-linux@fw-web.de>
From: Peter Geis <pgwipeout@gmail.com>
RTC sometimes does not respond the first time in init.
Try multiple times to get a response.
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Frank Wunderlich <frank-w@public-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;
--
2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Frank Wunderlich <linux@fw-web.de>
To: linux-rockchip@lists.infradead.org
Cc: Frank Wunderlich <frank-w@public-files.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Heiko Stuebner <heiko@sntech.de>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org,
Peter Geis <pgwipeout@gmail.com>
Subject: [PATCH 1/2] rtc: hym8563: try multiple times to init device
Date: Wed, 8 Jun 2022 18:11:48 +0200 [thread overview]
Message-ID: <20220608161150.58919-2-linux@fw-web.de> (raw)
In-Reply-To: <20220608161150.58919-1-linux@fw-web.de>
From: Peter Geis <pgwipeout@gmail.com>
RTC sometimes does not respond the first time in init.
Try multiple times to get a response.
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Frank Wunderlich <frank-w@public-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;
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-08 16:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 16:11 [PATCH 0/2] Support RTC on BPI-R2 Pro Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich [this message]
2022-06-08 16:11 ` [PATCH 1/2] rtc: hym8563: try multiple times to init device Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich
2022-07-08 15:42 ` Aw: " Frank Wunderlich
2022-07-08 15:42 ` Frank Wunderlich
2022-07-08 15:42 ` Frank Wunderlich
2022-07-08 16:17 ` Robin Murphy
2022-07-08 16:17 ` Robin Murphy
2022-07-08 16:17 ` Robin Murphy
2022-07-08 18:41 ` Peter Geis
2022-07-08 18:41 ` Peter Geis
2022-07-08 18:41 ` Peter Geis
2022-06-08 16:11 ` [PATCH 2/2] arm64: dts: rockchip: add RTC to BPI-R2 Pro Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich
2022-06-08 16:11 ` Frank Wunderlich
2022-06-11 15:15 ` (subset) [PATCH 0/2] Support RTC on " Heiko Stuebner
2022-06-11 15:15 ` Heiko Stuebner
2022-06-11 15:15 ` Heiko Stuebner
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=20220608161150.58919-2-linux@fw-web.de \
--to=linux@fw-web.de \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=frank-w@public-files.de \
--cc=heiko@sntech.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=pgwipeout@gmail.com \
--cc=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.