[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1412053408-21751-3-git-send-email-Li.Xiubo@freescale.com>
Date: Tue, 30 Sep 2014 13:03:28 +0800
From: Xiubo Li <Li.Xiubo@...escale.com>
To: <tglx@...utronix.de>, <daniel.lezcano@...aro.org>
CC: <linux-kernel@...r.kernel.org>, <john.stultz@...aro.org>,
Xiubo Li <Li.Xiubo@...escale.com>
Subject: [PATCH v3 2/2] clocksource: Add BE APIs support for clocksource counter reading.
Signed-off-by: Xiubo Li <Li.Xiubo@...escale.com>
---
drivers/clocksource/mmio.c | 20 ++++++++++++++++++++
include/linux/clocksource.h | 4 ++++
2 files changed, 24 insertions(+)
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index d3cbf70..d35a407 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -20,21 +20,41 @@ 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)ioread32be(to_mmio_clksrc(c)->reg);
+}
+
cycle_t clocksource_mmio_readl_up(struct clocksource *c)
{
return (cycle_t)ioread32(to_mmio_clksrc(c)->reg);
}
+cycle_t clocksource_mmio_readl_down_be(struct clocksource *c)
+{
+ return ~(cycle_t)ioread32be(to_mmio_clksrc(c)->reg) & c->mask;
+}
+
cycle_t clocksource_mmio_readl_down(struct clocksource *c)
{
return ~(cycle_t)ioread32(to_mmio_clksrc(c)->reg) & c->mask;
}
+cycle_t clocksource_mmio_readw_up_be(struct clocksource *c)
+{
+ return (cycle_t)ioread16be(to_mmio_clksrc(c)->reg);
+}
+
cycle_t clocksource_mmio_readw_up(struct clocksource *c)
{
return (cycle_t)ioread16(to_mmio_clksrc(c)->reg);
}
+cycle_t clocksource_mmio_readw_down_be(struct clocksource *c)
+{
+ return ~(cycle_t)ioread16be(to_mmio_clksrc(c)->reg) & c->mask;
+}
+
cycle_t clocksource_mmio_readw_down(struct clocksource *c)
{
return ~(cycle_t)ioread16(to_mmio_clksrc(c)->reg) & c->mask;
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 653f0e2..931a037 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -327,9 +327,13 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
extern int timekeeping_notify(struct clocksource *clock);
+extern cycle_t clocksource_mmio_readl_up_be(struct clocksource *);
extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readl_down_be(struct clocksource *);
extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_up_be(struct clocksource *);
extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_down_be(struct clocksource *);
extern cycle_t clocksource_mmio_readw_down(struct clocksource *);
extern int clocksource_mmio_init(void __iomem *, const char *,
--
2.1.0.27.g96db324
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists