From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Amelie Delaunay <amelie.delaunay@st.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] rtc: stm32: rework register management to prepare other version of RTC
Date: Wed, 16 May 2018 22:25:52 +0200 [thread overview]
Message-ID: <20180516202552.GA24496@piout.net> (raw)
In-Reply-To: <1525880770-22263-2-git-send-email-amelie.delaunay@st.com>
Hi,
On 09/05/2018 17:46:08+0200, Amelie Delaunay wrote:
> static void stm32_rtc_wpr_unlock(struct stm32_rtc *rtc)
> {
> - writel_relaxed(RTC_WPR_1ST_KEY, rtc->base + STM32_RTC_WPR);
> - writel_relaxed(RTC_WPR_2ND_KEY, rtc->base + STM32_RTC_WPR);
> + struct stm32_rtc_registers regs = rtc->data->regs;
regs should probably be a pointer to ensure that no copy is made. I've
actually checked and it doesn't make a difference because gcc is smart
enough to not make the copy.
> +
> + writel_relaxed(RTC_WPR_1ST_KEY, rtc->base + regs.wpr);
> + writel_relaxed(RTC_WPR_2ND_KEY, rtc->base + regs.wpr);
> }
>
...
> static irqreturn_t stm32_rtc_alarm_irq(int irq, void *dev_id)
> {
> struct stm32_rtc *rtc = (struct stm32_rtc *)dev_id;
> - unsigned int isr, cr;
> + struct stm32_rtc_registers regs = rtc->data->regs;
> + struct stm32_rtc_events evts = rtc->data->events;
Ditto for evts.
> + unsigned int status, cr;
>
> mutex_lock(&rtc->rtc_dev->ops_lock);
>
> - isr = readl_relaxed(rtc->base + STM32_RTC_ISR);
> - cr = readl_relaxed(rtc->base + STM32_RTC_CR);
> + status = readl_relaxed(rtc->base + regs.isr);
> + cr = readl_relaxed(rtc->base + regs.cr);
>
> - if ((isr & STM32_RTC_ISR_ALRAF) &&
> + if ((status & evts.alra) &&
> (cr & STM32_RTC_CR_ALRAIE)) {
> /* Alarm A flag - Alarm interrupt */
> dev_dbg(&rtc->rtc_dev->dev, "Alarm occurred\n");
...
> @@ -641,7 +710,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
>
> /*
> * After a system reset, RTC_ISR.INITS flag can be read to check if
> - * the calendar has been initalized or not. INITS flag is reset by a
> + * the calendar has been initialized or not. INITS flag is reset by a
> * power-on reset (no vbat, no power-supply). It is not reset if
> * rtc_ck parent clock has changed (so RTC prescalers need to be
> * changed). That's why we cannot rely on this flag to know if RTC
> @@ -666,7 +735,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
> "alarm won't be able to wake up the system");
>
> rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
> - &stm32_rtc_ops, THIS_MODULE);
> + &stm32_rtc_ops, THIS_MODULE);
> if (IS_ERR(rtc->rtc_dev)) {
> ret = PTR_ERR(rtc->rtc_dev);
> dev_err(&pdev->dev, "rtc device registration failed, err=%d\n",
Those two changes should go into a separate cleanup patch.
--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-05-16 20:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 15:46 [PATCH v2 0/3] Introduce STM32MP1 RTC Amelie Delaunay
2018-05-09 15:46 ` [PATCH v2 1/3] rtc: stm32: rework register management to prepare other version of RTC Amelie Delaunay
2018-05-16 20:25 ` Alexandre Belloni [this message]
2018-05-17 10:01 ` Amelie DELAUNAY
2018-05-09 15:46 ` [PATCH v2 2/3] dt-bindings: rtc: update stm32-rtc documentation for stm32mp1 rtc Amelie Delaunay
2018-05-09 15:46 ` [PATCH v2 3/3] rtc: stm32: add stm32mp1 rtc support Amelie Delaunay
2018-05-10 11:40 ` kbuild test robot
2018-05-16 20:32 ` Alexandre Belloni
2018-05-17 10:03 ` Amelie DELAUNAY
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=20180516202552.GA24496@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.torgue@st.com \
--cc=amelie.delaunay@st.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh+dt@kernel.org \
/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).