Re: [PATCH 2/9] cpm2: Fix off-by-one error in setbrg().

2007-08-30 Thread Vitaly Bordug
On Tue, 28 Aug 2007 15:19:21 -0500
Scott Wood wrote:

 The hardware adds one to the BRG value to get the divider, so it must
 be subtracted by software.

Prolly a note why it used to work, or what exactly this is resulting in the 
code. IIRC this was
just fw-ported so arch/ppc should have this as well.
 
 Signed-off-by: Scott Wood [EMAIL PROTECTED]
 ---
  arch/powerpc/sysdev/cpm2_common.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 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);
  }


-- 
Sincerely, Vitaly
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/9] cpm2: Fix off-by-one error in setbrg().

2007-08-30 Thread Vitaly Bordug
On Thu, 30 Aug 2007 15:13:12 -0500
Scott Wood wrote:

 On Thu, Aug 30, 2007 at 02:09:07AM +0400, Vitaly Bordug wrote:
  On Tue, 28 Aug 2007 15:19:21 -0500
  Scott Wood wrote:
  
   The hardware adds one to the BRG value to get the divider, so it
   must be subtracted by software.
  
  Prolly a note why it used to work, or what exactly this is
  resulting in the code. IIRC this was just fw-ported so arch/ppc
  should have this as well.
 
 It *didn't* work before -- hence the fix.
 
It used to work at least at the time I did initial port, but I am not going to 
argue.

 The failure mode from being off by just one isn't total
 nonfunctionality, but rather a corrupted character now and then,
 which could explain why it wasn't fixed before.
Can this be added to description please? Someone may be grepping for such a 
weirdness in some custom code forked off
some kernel.org revision, and will be happy to know it is addressed.

 
 As for arch/ppc, I'm just trying to not break it more than it already
 is.
I mean, when powerpc/ was nearly empty, same issue in ppc/ went unnoticed for 
years...

-- 
Sincerely, Vitaly
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


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

2007-08-28 Thread Scott Wood
The hardware adds one to the BRG value to get the divider, so it must
be subtracted by software.

Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/sysdev/cpm2_common.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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.0.3

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev