On Thursday 20 November 2008 17:00:54 Kumar Gala wrote: > On Nov 20, 2008, at 9:57 AM, Laurent Pinchart wrote: > > On Thursday 20 November 2008 16:32:21 Kumar Gala wrote: > >> On Nov 20, 2008, at 6:32 AM, Laurent Pinchart wrote: > >>> Instead of rounding the divider down, improve the baud-rate > >>> generators > >>> accuracy by rounding to the nearest integer. > >>> > >>> Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]> > >>> --- > >>> arch/powerpc/sysdev/cpm2.c | 3 ++- > >>> 1 files changed, 2 insertions(+), 1 deletions(-) > >> > >> is this fixing a bug or just making things better? > > > > I guess it depends on your definition of bug :-) The problem has > > always been present in the kernel sources, and people seem to have coped > > with it until today. It is still a bug in my opinion, but I suppose the > > patch can wait until 2.6.29 especially if we want to get it tested (it > > slightly changes baud rates after all). > > Ok. I'll put this in the .29 queue. Can you provide a bit more detail > on the issue this is resolving.
Sure. Let's assume a 25 MHz BRG clock. When setting a 115200 bds baud rate for an SMC port in UART mode (16x oversampling), the divisor should be 25e6/(16*115200) ~= 13.563368 The current code rounds this down. The resulting baud rate is 25e6/(16*13) ~= 120192 bds The relative error is thus (115200 - 120192)/115200 ~= 4.33% With the new code, the divisor is rounded to the nearest integer (14). The resulting baud rate is 25e6/(16*14) ~= 111607 bds and the relative error becomes (115200 - 111607)/115200 ~= 3.12% -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev