linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG
@ 2021-04-25 14:59 Dario Binacchi
  2021-04-29 21:29 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Dario Binacchi @ 2021-04-25 14:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dario Binacchi, Alessandro Zummo, Alexandre Belloni, linux-rtc

The RTC_OSC_REG register is 32-bit, but the useful information is found
in the 7 least significant bits (bits 7-31 are reserved). And in fact,
as you can see from the code, all read accesses are 8-bit, as well as
some writes. Let's make sure all writes are 8-bit. Moreover, in contexts
where consecutive reads / writes after the busy check must take place
within 15 us, it is better not to waste time on useless accesses.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/rtc/rtc-omap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index dc7db2477f88..d46e0f0cc502 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -786,8 +786,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
 	/* enable RTC functional clock */
 	if (rtc->type->has_32kclk_en) {
 		reg = rtc_read(rtc, OMAP_RTC_OSC_REG);
-		rtc_writel(rtc, OMAP_RTC_OSC_REG,
-				reg | OMAP_RTC_OSC_32KCLK_EN);
+		rtc_write(rtc, OMAP_RTC_OSC_REG, reg | OMAP_RTC_OSC_32KCLK_EN);
 	}
 
 	/* clear old status */
@@ -845,7 +844,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
 		reg = rtc_read(rtc, OMAP_RTC_OSC_REG);
 		reg &= ~OMAP_RTC_OSC_OSC32K_GZ_DISABLE;
 		reg |= OMAP_RTC_OSC_32KCLK_EN | OMAP_RTC_OSC_SEL_32KCLK_SRC;
-		rtc_writel(rtc, OMAP_RTC_OSC_REG, reg);
+		rtc_write(rtc, OMAP_RTC_OSC_REG, reg);
 	}
 
 	rtc->type->lock(rtc);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG
  2021-04-25 14:59 [PATCH] rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG Dario Binacchi
@ 2021-04-29 21:29 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2021-04-29 21:29 UTC (permalink / raw)
  To: Dario Binacchi, linux-kernel
  Cc: Alexandre Belloni, Alessandro Zummo, linux-rtc

On Sun, 25 Apr 2021 16:59:23 +0200, Dario Binacchi wrote:
> The RTC_OSC_REG register is 32-bit, but the useful information is found
> in the 7 least significant bits (bits 7-31 are reserved). And in fact,
> as you can see from the code, all read accesses are 8-bit, as well as
> some writes. Let's make sure all writes are 8-bit. Moreover, in contexts
> where consecutive reads / writes after the busy check must take place
> within 15 us, it is better not to waste time on useless accesses.

I really doubt writeb versus writel actually make a difference as the bus will
probably still do a 32bit access.

Applied, thanks!

[1/1] rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG
      commit: 50f2cc7f758cdbc7c8f928edc25b1c7bc09ef3e2

Best regards,
-- 
Alexandre Belloni <alexandre.belloni@bootlin.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-29 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 14:59 [PATCH] rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG Dario Binacchi
2021-04-29 21:29 ` Alexandre Belloni

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).