linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Bug in arch/powerpc/sysdev/fsl_gtm.c
@ 2011-02-16 14:59 Jean-Denis Boyer
  2011-03-15 15:53 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Denis Boyer @ 2011-02-16 14:59 UTC (permalink / raw)
  To: 'Anton Vorontsov', 'linuxppc-dev@lists.ozlabs.org'

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

Hi.
There is a bug in the function gtm_set_ref_timer16.
When called, it correctly sets the requested timer,
but the other timer that shares the register GTCFR is reset.

The parameter 'clear' passed to macro clrsetbits_8 should not be
a bitwise complement, since the macro already complements it.

Here is a patch that should fix this issue.

--- linux-2.6.35.11/arch/powerpc/sysdev/fsl_gtm.c
+++ linux/arch/powerpc/sysdev/fsl_gtm.c
@@ -203,13 +203,10 @@
 	spin_lock_irqsave(&gtm->lock, flags);
 
 	/*
-	 * Properly reset timers: stop, reset, set up prescalers, reference
+	 * Properly set timers: stop, set up prescalers, reference
 	 * value and clear event register.
 	 */
-	clrsetbits_8(tmr->gtcfr, ~(GTCFR_STP(num) | GTCFR_RST(num)),
-				 GTCFR_STP(num) | GTCFR_RST(num));
-
-	setbits8(tmr->gtcfr, GTCFR_STP(num));
+	setbits8(tmr->gtcfr, GTCFR_STP(num) | GTCFR_RST(num));
 
 	if (tmr->gtpsr)
 		out_be16(tmr->gtpsr, psr);

Regards,

Jean-Denis Boyer, Eng.
Media5 Corporation - Mediatrix, M5T, Media5Boss
4229 Garlock Street, Sherbrooke (Québec), J1L 2C8, CANADA
(819)829-8749 x5241


[-- Attachment #2: fsl_gtm.patch --]
[-- Type: application/octet-stream, Size: 585 bytes --]

--- linux-2.6.35.11/arch/powerpc/sysdev/fsl_gtm.c
+++ linux/arch/powerpc/sysdev/fsl_gtm.c
@@ -203,13 +203,10 @@
 	spin_lock_irqsave(&gtm->lock, flags);
 
 	/*
-	 * Properly reset timers: stop, reset, set up prescalers, reference
+	 * Properly set timers: stop, set up prescalers, reference
 	 * value and clear event register.
 	 */
-	clrsetbits_8(tmr->gtcfr, ~(GTCFR_STP(num) | GTCFR_RST(num)),
-				 GTCFR_STP(num) | GTCFR_RST(num));
-
-	setbits8(tmr->gtcfr, GTCFR_STP(num));
+	setbits8(tmr->gtcfr, GTCFR_STP(num) | GTCFR_RST(num));
 
 	if (tmr->gtpsr)
 		out_be16(tmr->gtpsr, psr);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug in arch/powerpc/sysdev/fsl_gtm.c
  2011-02-16 14:59 Bug in arch/powerpc/sysdev/fsl_gtm.c Jean-Denis Boyer
@ 2011-03-15 15:53 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2011-03-15 15:53 UTC (permalink / raw)
  To: Jean-Denis Boyer
  Cc: 'Anton Vorontsov', 'linuxppc-dev@lists.ozlabs.org'


On Feb 16, 2011, at 8:59 AM, Jean-Denis Boyer wrote:

> Hi.
> There is a bug in the function gtm_set_ref_timer16.
> When called, it correctly sets the requested timer,
> but the other timer that shares the register GTCFR is reset.
> 
> The parameter 'clear' passed to macro clrsetbits_8 should not be
> a bitwise complement, since the macro already complements it.
> 
> Here is a patch that should fix this issue.
> 
> --- linux-2.6.35.11/arch/powerpc/sysdev/fsl_gtm.c
> +++ linux/arch/powerpc/sysdev/fsl_gtm.c
> @@ -203,13 +203,10 @@
> 	spin_lock_irqsave(&gtm->lock, flags);
> 
> 	/*
> -	 * Properly reset timers: stop, reset, set up prescalers, reference
> +	 * Properly set timers: stop, set up prescalers, reference
> 	 * value and clear event register.
> 	 */
> -	clrsetbits_8(tmr->gtcfr, ~(GTCFR_STP(num) | GTCFR_RST(num)),
> -				 GTCFR_STP(num) | GTCFR_RST(num));
> -
> -	setbits8(tmr->gtcfr, GTCFR_STP(num));
> +	setbits8(tmr->gtcfr, GTCFR_STP(num) | GTCFR_RST(num));
> 
> 	if (tmr->gtpsr)
> 		out_be16(tmr->gtpsr, psr);

If you'd like this applied please re-send w/proper signed-off-by

- k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-15 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 14:59 Bug in arch/powerpc/sysdev/fsl_gtm.c Jean-Denis Boyer
2011-03-15 15:53 ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).