Message ID | 20201202111318.5353-1-m.szyprowski@samsung.com |
---|---|
State | New |
Headers | show |
Series | [1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe | expand |
On Wed, Dec 02, 2020 at 12:13:17PM +0100, Marek Szyprowski wrote: > Bootloader might use RTC hardware and leave it in the enabled state. Ensure > that the potentially enabled periodic tick interrupts are disabled before > enabling the driver, because they might cause lockup if tick interrupt > happens after disabling RTC gate clock. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > drivers/rtc/rtc-s3c.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c > index 24a41909f049..16a326e95d46 100644 > --- a/drivers/rtc/rtc-s3c.c > +++ b/drivers/rtc/rtc-s3c.c > @@ -503,6 +503,10 @@ static int s3c_rtc_probe(struct platform_device *pdev) > goto err_src_clk; > } > > + /* disable RTC enable bits potentially set by the bootloader */ > + if (info->data->disable) > + info->data->disable(info); > + It took me some time to figure out why this makes sense: disable followed immediately by enable. :) You could add in commit msg that enable() callback does not enable the tick interrupt. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Best regards, Krzysztof
On Wed, 2 Dec 2020 12:13:17 +0100, Marek Szyprowski wrote: > Bootloader might use RTC hardware and leave it in the enabled state. Ensure > that the potentially enabled periodic tick interrupts are disabled before > enabling the driver, because they might cause lockup if tick interrupt > happens after disabling RTC gate clock. Applied, thanks! [1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe commit: 31b16d978f902bd9ac7fdc20738f67e39959cd5c [2/2] rtc: s3c: Remove dead code related to periodic tick handling commit: ce9af89392024f57247187afc345991b784f9bae Best regards, -- Alexandre Belloni <alexandre.belloni@bootlin.com>
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 24a41909f049..16a326e95d46 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -503,6 +503,10 @@ static int s3c_rtc_probe(struct platform_device *pdev) goto err_src_clk; } + /* disable RTC enable bits potentially set by the bootloader */ + if (info->data->disable) + info->data->disable(info); + /* check to see if everything is setup correctly */ if (info->data->enable) info->data->enable(info);
Bootloader might use RTC hardware and leave it in the enabled state. Ensure that the potentially enabled periodic tick interrupts are disabled before enabling the driver, because they might cause lockup if tick interrupt happens after disabling RTC gate clock. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/rtc/rtc-s3c.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1