linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-rtc@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe
Date: Wed, 2 Dec 2020 14:38:31 +0200	[thread overview]
Message-ID: <20201202123831.GA36340@kozik-lap> (raw)
In-Reply-To: <20201202111318.5353-1-m.szyprowski@samsung.com>

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

  parent reply	other threads:[~2020-12-02 12:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201202111328eucas1p25b7a68b4fe94addf6088cc3ad4bedcf1@eucas1p2.samsung.com>
2020-12-02 11:13 ` [PATCH 1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe Marek Szyprowski
2020-12-02 11:13   ` [PATCH 2/2] rtc: s3c: Remove dead code related to periodic tick handling Marek Szyprowski
2020-12-02 12:49     ` Krzysztof Kozlowski
2020-12-02 12:54       ` Marek Szyprowski
2020-12-02 12:56         ` Krzysztof Kozlowski
2020-12-02 12:38   ` Krzysztof Kozlowski [this message]
2020-12-03 22:52   ` [PATCH 1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe Alexandre Belloni

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=20201202123831.GA36340@kozik-lap \
    --to=krzk@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /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 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).