All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: sh_cmt 16-bit fixes
@ 2009-04-29 14:50 Magnus Damm
  0 siblings, 0 replies; only message in thread
From: Magnus Damm @ 2009-04-29 14:50 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@igel.co.jp>

This patch contains various fixes for 16-bit cmt hardware.
With this applied periodic clockevents work fine on sh7203.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 drivers/clocksource/sh_cmt.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- 0001/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c	2009-04-21 21:58:39.000000000 +0900
@@ -153,16 +153,18 @@ static int sh_cmt_enable(struct sh_cmt_p
 		pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk);
 		return ret;
 	}
-	*rate = clk_get_rate(p->clk) / 8;
 
 	/* make sure channel is disabled */
 	sh_cmt_start_stop_ch(p, 0);
 
 	/* configure channel, periodic mode and maximum timeout */
-	if (p->width = 16)
-		sh_cmt_write(p, CMCSR, 0);
-	else
+	if (p->width = 16) {
+		*rate = clk_get_rate(p->clk) / 512;
+		sh_cmt_write(p, CMCSR, 0x43);
+	} else {
+		*rate = clk_get_rate(p->clk) / 8;
 		sh_cmt_write(p, CMCSR, 0x01a4);
+	}
 
 	sh_cmt_write(p, CMCOR, 0xffffffff);
 	sh_cmt_write(p, CMCNT, 0);
@@ -545,7 +547,7 @@ static int sh_cmt_setup(struct sh_cmt_pr
 	if (resource_size(res) = 6) {
 		p->width = 16;
 		p->overflow_bit = 0x80;
-		p->clear_bits = ~0xc0;
+		p->clear_bits = ~0x80;
 	} else {
 		p->width = 32;
 		p->overflow_bit = 0x8000;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-29 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29 14:50 [PATCH] clocksource: sh_cmt 16-bit fixes Magnus Damm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.