From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
linux-rtc@vger.kernel.org,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Gareth Williams <gareth.williams.jx@renesas.com>,
Milan Stevanovic <milan.stevanovic@se.com>,
Jimmy Lalande <jimmy.lalande@se.com>,
Pascal Eberhard <pascal.eberhard@se.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Herve Codina <herve.codina@bootlin.com>,
Clement Leger <clement.leger@bootlin.com>,
Michel Pollet <michel.pollet@bp.renesas.com>
Subject: Re: [PATCH v3 2/6] rtc: rzn1: Add new RTC driver
Date: Mon, 2 May 2022 16:41:20 +0200 [thread overview]
Message-ID: <CAMuHMdVU2RDmPC014LjdB=L_b=Kn+htHnC0v4wAAUESbhWTA5w@mail.gmail.com> (raw)
In-Reply-To: <20220429104602.368055-3-miquel.raynal@bootlin.com>
Hi Miquel,
On Fri, Apr 29, 2022 at 12:46 PM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
> From: Michel Pollet <michel.pollet@bp.renesas.com>
>
> Add a basic RTC driver for the RZ/N1.
>
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> Co-developed-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks for your patch!
> --- /dev/null
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -0,0 +1,246 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Renesas RZN1 Real Time Clock interface for Linux
RZ/N1
> +static int rzn1_rtc_probe(struct platform_device *pdev)
> +{
> + struct rzn1_rtc *rtc;
> + int ret;
> +
> + rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> + if (!rtc)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, rtc);
> +
> + rtc->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(rtc->base))
> + return dev_err_probe(&pdev->dev, PTR_ERR(rtc->base), "Missing reg\n");
> +
> + rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
> + if (IS_ERR(rtc->rtcdev))
> + return PTR_ERR(rtc);
> +
> + rtc->rtcdev->range_min = RTC_TIMESTAMP_BEGIN_2000;
> + rtc->rtcdev->range_max = RTC_TIMESTAMP_END_2099;
> + rtc->rtcdev->ops = &rzn1_rtc_ops;
> + clear_bit(RTC_FEATURE_ALARM, rtc->rtcdev->features);
> + clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtcdev->features);
> +
> + pm_runtime_enable(&pdev->dev);
> + pm_runtime_get_sync(&pdev->dev);
While this call cannot really fail on this platform, you may want to
call pm_runtime_resume_and_get() instead, and check its return
value (else the janitors will make that change later ;-)
> +
> + /*
> + * Ensure the clock counter is enabled.
> + * Set 24-hour mode and possible oscillator offset compensation in SUBU mode.
> + */
> + writel(RZN1_RTC_CTL0_CE | RZN1_RTC_CTL0_AMPM | RZN1_RTC_CTL0_SLSB_SUBU,
> + rtc->base + RZN1_RTC_CTL0);
> +
> + /* Disable all interrupts */
> + writel(0, rtc->base + RZN1_RTC_CTL1);
> +
> + ret = devm_rtc_register_device(rtc->rtcdev);
> + if (ret)
> + goto dis_runtime_pm;
> +
> + return 0;
> +
> +dis_runtime_pm:
> + pm_runtime_put_sync(&pdev->dev);
pm_runtime_put() should be fine, no need for the synchronous version.
> + pm_runtime_disable(&pdev->dev);
> +
> + return ret;
> +}
> +
> +static int rzn1_rtc_remove(struct platform_device *pdev)
> +{
> + pm_runtime_put_sync(&pdev->dev);
pm_runtime_put().
> + pm_runtime_disable(&pdev->dev);
> +
> + return 0;
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2022-05-02 14:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 10:45 [PATCH v3 0/6] RZN1 RTC support Miquel Raynal
2022-04-29 10:45 ` [PATCH v3 1/6] dt-bindings: rtc: rzn1: Describe the RZN1 RTC Miquel Raynal
2022-04-29 10:45 ` [PATCH v3 2/6] rtc: rzn1: Add new RTC driver Miquel Raynal
2022-05-02 14:41 ` Geert Uytterhoeven [this message]
2022-05-09 14:59 ` Miquel Raynal
2022-04-29 10:45 ` [PATCH v3 3/6] rtc: rzn1: Add alarm support Miquel Raynal
2022-05-02 14:45 ` Geert Uytterhoeven
2022-04-29 10:46 ` [PATCH v3 4/6] rtc: rzn1: Add oscillator offset support Miquel Raynal
2022-04-29 10:46 ` [PATCH v3 5/6] MAINTAINERS: Add myself as maintainer of the RZN1 RTC driver Miquel Raynal
2022-04-29 10:46 ` [PATCH v3 6/6] ARM: dts: r9a06g032: Describe the RTC Miquel Raynal
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='CAMuHMdVU2RDmPC014LjdB=L_b=Kn+htHnC0v4wAAUESbhWTA5w@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=clement.leger@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=gareth.williams.jx@renesas.com \
--cc=herve.codina@bootlin.com \
--cc=jimmy.lalande@se.com \
--cc=krzk+dt@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=michel.pollet@bp.renesas.com \
--cc=milan.stevanovic@se.com \
--cc=miquel.raynal@bootlin.com \
--cc=pascal.eberhard@se.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.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).