From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: linux-kernel-dev@beckhoff.com
Cc: "Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <kernel@pengutronix.de>,
"Alessandro Zummo" <a.zummo@towertech.it>,
"Patrick Bruenn" <p.bruenn@beckhoff.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"open list:REAL TIME CLOCK (RTC) SUBSYSTEM"
<linux-rtc@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"Fabio Estevam" <fabio.estevam@nxp.com>,
"Juergen Borleis" <jbe@pengutronix.de>,
"Noel Vellemans" <Noel.Vellemans@visionbms.com>,
"Russell King" <linux@armlinux.org.uk>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
"Philippe Ombredanne" <pombredanne@nexb.com>,
"Lothar Waßmann" <LW@KARO-electronics.de>
Subject: Re: [PATCH v2 5/5] rtc: add mxc driver for i.MX53 SRTC
Date: Wed, 6 Dec 2017 12:05:03 +0100 [thread overview]
Message-ID: <20171206110503.GO21780@piout.net> (raw)
In-Reply-To: <20171205140646.30367-6-linux-kernel-dev@beckhoff.com>
On 05/12/2017 at 15:06:46 +0100, linux-kernel-dev@beckhoff.com wrote:
> +/* This function is the RTC interrupt service routine. */
> +static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id)
> +{
> + struct platform_device *pdev = dev_id;
> + struct mxc_rtc_data *pdata = platform_get_drvdata(pdev);
> + void __iomem *ioaddr = pdata->ioaddr;
> + unsigned long flags;
> + u32 events = 0;
> + u32 lp_status;
> + u32 lp_cr;
> +
> + spin_lock_irqsave(&pdata->lock, flags);
> + if (clk_prepare_enable(pdata->clk)) {
> + spin_unlock_irqrestore(&pdata->lock, flags);
> + return IRQ_NONE;
> + }
> +
> + lp_status = readl(ioaddr + SRTC_LPSR);
> + lp_cr = readl(ioaddr + SRTC_LPCR);
> +
> + /* update irq data & counter */
> + if (lp_status & SRTC_LPSR_ALP) {
> + if (lp_cr & SRTC_LPCR_ALP)
> + events = (RTC_AF | RTC_IRQF);
I would just call rtc_update_irq here...
> +
> + /* disable further lp alarm interrupts */
> + lp_cr &= ~(SRTC_LPCR_ALP | SRTC_LPCR_WAE);
> + }
> +
> + /* Update interrupt enables */
> + writel(lp_cr, ioaddr + SRTC_LPCR);
> +
> + /* clear interrupt status */
> + writel(lp_status, ioaddr + SRTC_LPSR);
> +
> + mxc_rtc_sync_lp_locked(ioaddr);
> + rtc_update_irq(pdata->rtc, 1, events);
... because calling it here with events == 0 will result in a lot of
work for nothing (the core will walk through the timers and set the
alarm again).
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
prev parent reply other threads:[~2017-12-06 11:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 14:06 [PATCH v2 0/5] add mxc driver for i.MX53 SRTC linux-kernel-dev
2017-12-05 14:06 ` [PATCH v2 1/5] dt-bindings: rtc: add bindings " linux-kernel-dev
2017-12-06 21:54 ` Rob Herring
2017-12-11 7:08 ` Patrick Brünn
2017-12-11 23:08 ` Fabio Estevam
2017-12-12 5:05 ` Patrick Brünn
2017-12-15 21:58 ` Rob Herring
2017-12-05 14:06 ` [PATCH v2 2/5] ARM: dts: imx53: add srtc node linux-kernel-dev
2017-12-05 14:13 ` Fabio Estevam
2017-12-05 14:20 ` Patrick Brünn
2017-12-10 19:03 ` Fabio Estevam
2017-12-05 14:06 ` [PATCH v2 3/5] rtc: mxc_v2: add driver for i.MX53 SRTC linux-kernel-dev
2017-12-05 14:12 ` Fabio Estevam
2017-12-05 14:06 ` [PATCH v2 4/5] ARM: imx_v4_v5_defconfig: enable RTC_DRV_MXC_V2 linux-kernel-dev
2017-12-05 14:10 ` Fabio Estevam
2017-12-05 14:06 ` [PATCH v2 5/5] rtc: add mxc driver for i.MX53 SRTC linux-kernel-dev
2017-12-06 8:36 ` Sascha Hauer
2017-12-06 8:58 ` Alexandre Belloni
2017-12-06 9:28 ` Patrick Brünn
2017-12-06 10:17 ` Patrick Brünn
2017-12-06 14:40 ` Sascha Hauer
2017-12-06 11:05 ` Alexandre Belloni [this message]
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=20171206110503.GO21780@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=LW@KARO-electronics.de \
--cc=Noel.Vellemans@visionbms.com \
--cc=a.zummo@towertech.it \
--cc=devicetree@vger.kernel.org \
--cc=fabio.estevam@nxp.com \
--cc=jbe@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel-dev@beckhoff.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=p.bruenn@beckhoff.com \
--cc=pombredanne@nexb.com \
--cc=robh+dt@kernel.org \
--cc=shawnguo@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).