From: Arnd Bergmann <arnd@arndb.de>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-kernel@vger.kernel.org, robh+dt@kernel.org,
pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
rdunlap@infradead.org, linux@arm.linux.org.uk,
daniel.lezcano@linaro.org, tglx@linutronix.de,
thierry.reding@gmail.com, florian.vaussard@epfl.ch,
jic23@kernel.org, jason@lakedaemon.net, andrew@lunn.ch,
silvio.fricke@gmail.com, heiko.stuebner@bq.com, olof@lixom.net,
sebastian.hesselbarth@gmail.com, sboyd@codeaurora.org,
gregory.clement@free-electrons.com, robherring2@gmail.com,
marc.zyngier@arm.com, maxime.ripard@free-electrons.com,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/4] clocksource: Add support for the Mediatek SoCs
Date: Mon, 12 May 2014 11:37:27 +0200 [thread overview]
Message-ID: <4169260.qB0vPmmJCY@wuerfel> (raw)
In-Reply-To: <1399772463-859-2-git-send-email-matthias.bgg@gmail.com>
On Sunday 11 May 2014 03:41:00 Matthias Brugger wrote:
> +
> +static void __iomem *gpt_base;
> +static u32 ticks_per_jiffy;
> +
This is not wrong, because there will only be one timer, but the
preferred way to express this in general would be to add it to the
clock_event_device pointer:
struct mtk_clock_event_device {
void __iomem *gpt_base;
u32 ticks_per_jiffy;
struct clock_event_device dev;
};
static inline struct mtk_clock_event_device *to_mtk_clock(struct clock_event_device *c)
{
return container_of(c, struct mtk_clock_event_device, dev);
}
static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
{
struct mtk_clock_event_device *evt = dev_id;
/* Acknowledge timer0 irq */
writel(GPT_IRQ_ACK(GPT_CLK_EVT), evt->gpt_base + GPT_IRQ_ACK_REG);
evt->dev.event_handler(evt);
return IRQ_HANDLED;
}
static void mtk_clkevt_mode(enum clock_event_mode mode,
struct clock_event_device *clk)
{
struct mtk_clock_event_device *evt = to_mtk_clock(clk);
mtk_clkevt_time_stop(GPT_CLK_EVT);
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
mtk_clkevt_time_setup(evt->ticks_per_jiffy, GPT_CLK_EVT);
mtk_clkevt_time_start(true, GPT_CLK_EVT);
break;
case CLOCK_EVT_MODE_ONESHOT:
mtk_clkevt_time_start(false, GPT_CLK_EVT);
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
default:
/* No more interrupts will occur as source is disabled */
break;
}
}
Arnd
next prev parent reply other threads:[~2014-05-12 9:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-11 1:40 [PATCH v2 0/4] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
2014-05-11 1:41 ` [PATCH v2 1/4] clocksource: Add support for the Mediatek SoCs Matthias Brugger
2014-05-11 4:45 ` Maxime Ripard
2014-05-12 9:37 ` Arnd Bergmann [this message]
2014-05-11 1:41 ` [PATCH v2 2/4] dt-bindings: add mtk-timer bindings Matthias Brugger
2014-05-11 4:49 ` Maxime Ripard
2014-05-11 1:41 ` [PATCH v2 3/4] arm: add basic support for Mediatek MT6589 boards Matthias Brugger
2014-05-11 4:56 ` Maxime Ripard
2014-05-12 9:30 ` Arnd Bergmann
2014-05-11 1:41 ` [PATCH v2 4/4] arm: mediatek: add dts for Aquaris5 mobile phone Matthias Brugger
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=4169260.qB0vPmmJCY@wuerfel \
--to=arnd@arndb.de \
--cc=andrew@lunn.ch \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.vaussard@epfl.ch \
--cc=galak@codeaurora.org \
--cc=gregory.clement@free-electrons.com \
--cc=heiko.stuebner@bq.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jason@lakedaemon.net \
--cc=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=maxime.ripard@free-electrons.com \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=robherring2@gmail.com \
--cc=sboyd@codeaurora.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=silvio.fricke@gmail.com \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.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