[PATCH 02/10] cpm2: Fix off-by-one error in setbrg().

Kumar Gala galak at kernel.crashing.org
Tue Sep 11 05:46:21 EST 2007


On Sep 5, 2007, at 2:29 PM, Scott Wood wrote:

> The hardware adds one to the BRG value to get the divider, so it must
> be subtracted by software.  Without this patch, characters will  
> occasionally
> be corrupted.
>
> Signed-off-by: Scott Wood <scottwood at freescale.com>
> ---
>  arch/powerpc/sysdev/cpm2_common.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

What was this patch against?

I ended up applying it by hand for 2.6.23 since its fixing a bug..   
But, I'm wondering if there was a base set of changes this patchset  
was against?

- k

> diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/ 
> sysdev/cpm2_common.c
> index dbef50c..99ad1ed 100644
> --- a/arch/powerpc/sysdev/cpm2_common.c
> +++ b/arch/powerpc/sysdev/cpm2_common.c
> @@ -102,7 +102,7 @@ cpm_setbrg(uint brg, uint rate)
>  		brg -= 4;
>  	}
>  	bp += brg;
> -	out_be32(bp, ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN);
> +	out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN);
>
>  	cpm2_unmap(bp);
>  }
> -- 
> 1.5.3




More information about the Linuxppc-dev mailing list