Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: omap: use rtc_write to access OMAP_RTC_OSC_REG

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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210425145924.23353-1-dariobin@libero.it

authored by

Dario Binacchi and committed by
Alexandre Belloni
e463786f fefbec3a

+2 -3
+2 -3
drivers/rtc/rtc-omap.c
··· 786 786 /* enable RTC functional clock */ 787 787 if (rtc->type->has_32kclk_en) { 788 788 reg = rtc_read(rtc, OMAP_RTC_OSC_REG); 789 - rtc_writel(rtc, OMAP_RTC_OSC_REG, 790 - reg | OMAP_RTC_OSC_32KCLK_EN); 789 + rtc_write(rtc, OMAP_RTC_OSC_REG, reg | OMAP_RTC_OSC_32KCLK_EN); 791 790 } 792 791 793 792 /* clear old status */ ··· 844 845 reg = rtc_read(rtc, OMAP_RTC_OSC_REG); 845 846 reg &= ~OMAP_RTC_OSC_OSC32K_GZ_DISABLE; 846 847 reg |= OMAP_RTC_OSC_32KCLK_EN | OMAP_RTC_OSC_SEL_32KCLK_SRC; 847 - rtc_writel(rtc, OMAP_RTC_OSC_REG, reg); 848 + rtc_write(rtc, OMAP_RTC_OSC_REG, reg); 848 849 } 849 850 850 851 rtc->type->lock(rtc);