mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
rtc: rzn1: Disable controller before initialization
Datasheet says that the controller must be disabled before setting up either SUBU or SCMP. This did not matter so far because the driver only supported SUBU which was the default, too. It is good practice to follow datasheet recommendations, though. It will also be needed because SCMP mode will be added in a later patch. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20250526095801.35781-7-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
committed by
Alexandre Belloni
parent
ae95a7e321
commit
a50f00cb87
@@ -25,6 +25,7 @@
|
||||
#define RZN1_RTC_CTL0_SLSB_SUBU 0
|
||||
#define RZN1_RTC_CTL0_SLSB_SCMP BIT(4)
|
||||
#define RZN1_RTC_CTL0_AMPM BIT(5)
|
||||
#define RZN1_RTC_CTL0_CEST BIT(6)
|
||||
#define RZN1_RTC_CTL0_CE BIT(7)
|
||||
|
||||
#define RZN1_RTC_CTL1 0x04
|
||||
@@ -369,6 +370,7 @@ static const struct rtc_class_ops rzn1_rtc_ops = {
|
||||
static int rzn1_rtc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct rzn1_rtc *rtc;
|
||||
u32 val;
|
||||
int irq;
|
||||
int ret;
|
||||
|
||||
@@ -406,6 +408,14 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
|
||||
* Ensure the clock counter is enabled.
|
||||
* Set 24-hour mode and possible oscillator offset compensation in SUBU mode.
|
||||
*/
|
||||
val = readl(rtc->base + RZN1_RTC_CTL0) & ~RZN1_RTC_CTL0_CE;
|
||||
writel(val, rtc->base + RZN1_RTC_CTL0);
|
||||
/* Wait 2-4 32k clock cycles for the disabled controller */
|
||||
ret = readl_poll_timeout(rtc->base + RZN1_RTC_CTL0, val,
|
||||
!(val & RZN1_RTC_CTL0_CEST), 62, 123);
|
||||
if (ret)
|
||||
goto dis_runtime_pm;
|
||||
|
||||
writel(RZN1_RTC_CTL0_CE | RZN1_RTC_CTL0_AMPM | RZN1_RTC_CTL0_SLSB_SUBU,
|
||||
rtc->base + RZN1_RTC_CTL0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user