Commit Graph
3 Commits
Author SHA1 Message Date
Xiubo Li 95c19a06ec clocksource: Fix clocksource_mmio_readX_down
For some clocksource devices, for example, the registers are 32-bit, while
the lower 16-bit is used for timer counting(And reading the upper 16-bit
will return 0).

For example, when the counter value is 0x00001111, and then the
~readl_relaxed(to_mmio_clksrc(c)->reg) will return the value of 0xFFFFEEEE,
but it should be 0x0000EEEE.

So just using the c->mask to mask the unused bits.

Signed-off-by: Xiubo Li <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
2014-05-23 09:19:40 +02:00
Xiubo Li 4a3ae07413 clocksource: Fix type confusion for clocksource_mmio_readX_Y
The types' definations are:
   o  cycle_t       -> u64
   o  readl_relaxed -> u32
   o  readw_relaxed -> u16

So let clocksource_mmio_readX_Ys return a cast to cycle_t, though
this maybe look reduntant sometimes, it make sense and they will be
more readable and less confusion...

This patch clarifies the functions type and fix it.

Signed-off-by: Xiubo Li <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
2014-05-23 09:19:39 +02:00
Russell King 442c8176d2 clocksource: add common mmio clocksource
Add a generic mmio clocksource, covering both 32-bit and 16-bit register
access sizes, for up or down counters.  This can be used to easily
create clocksources for simple counter-based implementations.

Cc: Alessandro Rubini <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Eric Miao <[email protected]>
Cc: Erik Gilling <[email protected]>
Acked-by: "Hans J. Koch" <[email protected]>
Cc: Imre Kaloz <[email protected]>
Cc: Krzysztof Halasa <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: Lennert Buytenhek <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: [email protected]
Acked-by: Nicolas Pitre <[email protected]>
Cc: Olof Johansson <[email protected]>
Tested-by: Sascha Hauer <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Tested-by: Tony Lindgren <[email protected]>
Reviewed-by: Viresh Kumar <[email protected]>
Cc: Wan ZongShun <[email protected]>
Signed-off-by: Russell King <[email protected]>
2011-05-23 18:04:51 +01:00