From: Xiubo Li <Li.Xiubo@freescale.com>
To: <tglx@linutronix.de>, <daniel.lezcano@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading.
Date: Wed, 10 Sep 2014 17:20:19 +0800 [thread overview]
Message-ID: <1410340819-35110-1-git-send-email-Li.Xiubo@freescale.com> (raw)
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
drivers/clocksource/mmio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index 1593ade..ddc5214 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -20,21 +20,65 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
return container_of(c, struct clocksource_mmio, clksrc);
}
+cycle_t clocksource_mmio_readl_up_be(struct clocksource *c)
+{
+ return (cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
+}
+
+cycle_t clocksource_mmio_readl_up_le(struct clocksource *c)
+{
+ return (cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
+}
+
cycle_t clocksource_mmio_readl_up(struct clocksource *c)
{
return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
}
+cycle_t clocksource_mmio_readl_down_be(struct clocksource *c)
+{
+ return ~(cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg))
+ & c->mask;
+}
+
+cycle_t clocksource_mmio_readl_down_le(struct clocksource *c)
+{
+ return ~(cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg))
+ & c->mask;
+}
+
cycle_t clocksource_mmio_readl_down(struct clocksource *c)
{
return ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
}
+cycle_t clocksource_mmio_readw_up_be(struct clocksource *c)
+{
+ return (cycle_t)be16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg));
+}
+
+cycle_t clocksource_mmio_readw_up_le(struct clocksource *c)
+{
+ return (cycle_t)le16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg));
+}
+
cycle_t clocksource_mmio_readw_up(struct clocksource *c)
{
return (cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg);
}
+cycle_t clocksource_mmio_readw_down_be(struct clocksource *c)
+{
+ return ~(cycle_t)be16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg))
+ & c->mask;
+}
+
+cycle_t clocksource_mmio_readw_down_le(struct clocksource *c)
+{
+ return ~(cycle_t)le16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg))
+ & c->mask;
+}
+
cycle_t clocksource_mmio_readw_down(struct clocksource *c)
{
return ~(cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
--
2.1.0.27.g96db324
next reply other threads:[~2014-09-10 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 9:20 Xiubo Li [this message]
2014-09-10 20:33 ` Thomas Gleixner
2014-09-11 2:32 ` Li.Xiubo
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=1410340819-35110-1-git-send-email-Li.Xiubo@freescale.com \
--to=li.xiubo@freescale.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®