[PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading.

From: Xiubo Li
Date: Wed Sep 10 2014 - 05:21:41 EST


Signed-off-by: Xiubo Li <Li.Xiubo@xxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/