linux-stable/drivers/tty/serial
Frank Benkert e0955acecf mpc5200b/uart: select more tolerant uart prescaler on low baudrates
In addition to the /32 prescaler, the MPC5200B supports a second
baudrate prescaler /4 to reach higher baudrates.

The current calculation (introduced with commit 0d1f22e4) in the kernel
preferes this low prescaler as often as possible, but with some
imprecise counterparts the communication on low baudrates fails.

According a support-mail from freescale the low prescaler (/4) allows
just 1% tolerance in bittiming in contrast to 4% of the high prescaler
(/32).  The prescaler not only affects the baudrate-calculation, but
also the sampling of the bits on the wire.

With this patch, we use the slightly less precise, but higher tolerant
prescaler calculation on low baudrates up to (and including) 115200 baud
and the more precise calculation above.

Tested on a custom MPC5200B board with "fsl,mpc5200b-psc-uart".

Calculation Examples with prescaler (PS) 4 and 32 and divisor (DIV) on
various baudrates. Real stands for the real baudrate generated and Diff
for the differences between:
     50 Baud PS 32 DIV 0xa122 Real      50 Diff   0.00%
     75 Baud PS 32 DIV 0x6b6c Real      75 Diff   0.00%
    110 Baud PS 32 DIV 0x493e Real     110 Diff   0.00%
    134 Baud PS 32 DIV 0x3c20 Real     133 Diff   0.75%
    150 Baud PS 32 DIV 0x35b6 Real     150 Diff   0.00%
    200 Baud PS 32 DIV 0x2849 Real     199 Diff   0.50%
    300 Baud PS  4 DIV 0xd6d8 Real     300 Diff   0.00%
             PS 32 DIV 0x1adb Real     300 Diff   0.00%
    600 Baud PS  4 DIV 0x6b6c Real     600 Diff   0.00%
             PS 32 DIV 0x0d6e Real     599 Diff   0.17%
   1200 Baud PS  4 DIV 0x35b6 Real    1200 Diff   0.00%
             PS 32 DIV 0x06b7 Real    1199 Diff   0.08%
   1800 Baud PS  4 DIV 0x23cf Real    1799 Diff   0.06%
             PS 32 DIV 0x047a Real    1799 Diff   0.06%
   2400 Baud PS  4 DIV 0x1adb Real    2400 Diff   0.00%
             PS 32 DIV 0x035b Real    2401 Diff - 0.04%
   4800 Baud PS  4 DIV 0x0d6e Real    4799 Diff   0.02%
             PS 32 DIV 0x01ae Real    4796 Diff   0.08%
   9600 Baud PS  4 DIV 0x06b7 Real    9598 Diff   0.02%
             PS 32 DIV 0x00d7 Real    9593 Diff   0.07%
  19200 Baud PS  4 DIV 0x035b Real   19208 Diff - 0.04%
             PS 32 DIV 0x006b Real   19275 Diff - 0.39%
  38400 Baud PS  4 DIV 0x01ae Real   38372 Diff   0.07%
             PS 32 DIV 0x0036 Real   38194 Diff   0.54%
  57600 Baud PS  4 DIV 0x011e Real   57692 Diff - 0.16%
             PS 32 DIV 0x0024 Real   57291 Diff   0.54%
  76800 Baud PS  4 DIV 0x00d7 Real   76744 Diff   0.07%
             PS 32 DIV 0x001b Real   76388 Diff   0.54%
 115200 Baud PS  4 DIV 0x008f Real  115384 Diff - 0.16%
             PS 32 DIV 0x0012 Real  114583 Diff   0.54%
 153600 Baud PS  4 DIV 0x006b Real  154205 Diff - 0.39%
             PS 32 DIV 0x000d Real  158653 Diff - 3.29%
 230400 Baud PS  4 DIV 0x0048 Real  229166 Diff   0.54%
             PS 32 DIV 0x0009 Real  229166 Diff   0.54%
 307200 Baud PS  4 DIV 0x0036 Real  305555 Diff   0.54%
             PS 32 DIV 0x0007 Real  294642 Diff   4.09%
 460800 Baud PS  4 DIV 0x0024 Real  458333 Diff   0.54%
             PS 32 DIV 0x0005 Real  412500 Diff  10.48%
 500000 Baud PS  4 DIV 0x0021 Real  500000 Diff   0.00%
             PS 32 DIV 0x0004 Real  515625 Diff - 3.13%
 576000 Baud PS  4 DIV 0x001d Real  568965 Diff   1.22%
             PS 32 DIV 0x0004 Real  515625 Diff  10.48%
 614400 Baud PS  4 DIV 0x001b Real  611111 Diff   0.54%
             PS 32 DIV 0x0003 Real  687500 Diff -11.90%
 921600 Baud PS  4 DIV 0x0012 Real  916666 Diff   0.54%
             PS 32 DIV 0x0002 Real 1031250 Diff -11.90%
1000000 Baud PS  4 DIV 0x0011 Real  970588 Diff   2.94%
             PS 32 DIV 0x0002 Real 1031250 Diff - 3.13%
1152000 Baud PS  4 DIV 0x000e Real 1178571 Diff - 2.31%
             PS 32 DIV 0x0002 Real 1031250 Diff  10.48%
1500000 Baud PS  4 DIV 0x000b Real 1500000 Diff   0.00%
             PS 32 DIV 0x0001 Real 2062500 Diff -37.50%
2000000 Baud PS  4 DIV 0x0008 Real 2062500 Diff - 3.13%
             PS 32 DIV 0x0001 Real 2062500 Diff - 3.13%
2500000 Baud PS  4 DIV 0x0007 Real 2357142 Diff   5.71%
             PS 32 DIV 0x0001 Real 2062500 Diff  17.50%
3000000 Baud PS  4 DIV 0x0006 Real 2750000 Diff   8.33%
             PS 32 DIV 0x0001 Real 2062500 Diff  31.25%
3500000 Baud PS  4 DIV 0x0005 Real 3300000 Diff   5.71%
             PS 32 DIV 0x0001 Real 2062500 Diff  41.07%
4000000 Baud PS  4 DIV 0x0004 Real 4125000 Diff - 3.13%
             PS 32 DIV 0x0001 Real 2062500 Diff  48.44%

Signed-off-by: Frank Benkert <frank.benkert@avat.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-08 13:15:50 -08:00
..
8250 tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
cpm_uart TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
jsm jsm: Fixed EEH recovery error 2012-01-24 12:55:36 -08:00
21285.c serial: Kill off NO_IRQ 2012-01-26 17:14:50 -08:00
68328serial.c TTY: remove unneeded tty->index checks 2012-03-08 11:42:21 -08:00
68328serial.h TTY: serial, remove dead code from 68328 2011-09-22 15:47:54 -07:00
altera_jtaguart.c Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6 2011-10-27 08:35:41 +02:00
altera_uart.c tty: serial: altera_uart: Add CONSOLE_POLL support 2012-02-09 09:04:24 -08:00
amba-pl010.c serial: pl010: Enable module alias autogeneration for AMBA drivers 2011-11-22 10:58:32 +00:00
amba-pl011.c amba-pl011​/dma: Add check for the residue in DMA callback 2012-02-24 13:50:47 -08:00
apbuart.c apbuart: fix section mismatch warning 2011-12-27 16:33:13 -05:00
apbuart.h
ar933x_uart.c SERIAL: AR933X: Add driver for the built-in UART of the SoC 2011-12-07 22:02:46 +00:00
atmel_serial.c atmel_serial: fix spinlock lockup in RS485 code 2012-01-04 16:19:34 -08:00
bcm63xx_uart.c
bfin_sport_uart.c serial: bfin-sport-uart: Add tty ASYNC_CTS_FLOW flag to do CTS flow control. 2011-12-09 19:05:33 -08:00
bfin_sport_uart.h tty: bfin-sport-uart: Rx interrupt is not called always with irq disabled. 2011-12-09 19:05:33 -08:00
bfin_uart.c serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS. 2011-12-13 09:50:15 -08:00
clps711x.c
crisv10.c TTY: remove unneeded tty->index checks 2012-03-08 11:42:21 -08:00
crisv10.h
dz.c TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
dz.h
efm32-uart.c serial/efm32: add new driver 2012-01-26 11:29:47 -08:00
icom.c TTY: irq: Remove IRQF_DISABLED 2011-09-22 16:08:57 -07:00
icom.h
ifx6x60.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
ifx6x60.h
imx.c tty: serial: imx: move del_timer_sync() to avoid potential deadlock 2012-01-04 16:30:36 -08:00
ioc3_serial.c TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
ioc4_serial.c TTY: remove serialP.h inclusion from some files 2012-03-08 11:47:02 -08:00
ip22zilog.c
ip22zilog.h
Kconfig Merge tag 'tty-3.3-rc3' tty-next 2012-02-10 10:25:27 -08:00
kgdboc.c tty: Add module.h to drivers/tty users who just expect it there. 2011-10-31 19:31:27 -04:00
lantiq.c Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty 2011-10-26 15:11:09 +02:00
m32r_sio.c TTY: remove serialP.h inclusion from some files 2012-03-08 11:47:02 -08:00
m32r_sio.h TTY: serial, include pci.h in m32r_sio 2012-03-08 11:47:02 -08:00
m32r_sio_reg.h m32r: relocate drivers back out of 8250 dir 2012-02-08 15:04:32 -08:00
Makefile Merge tag 'tty-3.3-rc3' tty-next 2012-02-10 10:25:27 -08:00
max3100.c TTY: Remove redundant spi driver bus initialization 2011-11-26 20:19:21 -08:00
max3107.c TTY: Remove redundant spi driver bus initialization 2011-11-26 20:19:21 -08:00
max3107.h
mcf.c TTY: irq: Remove IRQF_DISABLED 2011-09-22 16:08:57 -07:00
mfd.c Merge 3.2-rc3 into tty-next to handle merge conflict in tty_ldisc.c 2011-11-26 20:07:25 -08:00
mpc52xx_uart.c mpc5200b/uart: select more tolerant uart prescaler on low baudrates 2012-03-08 13:15:50 -08:00
mpsc.c
mrst_max3110.c TTY: Remove redundant spi driver bus initialization 2011-11-26 20:19:21 -08:00
mrst_max3110.h max3110: add sysrq support 2011-08-26 11:01:15 -07:00
msm_serial.c Merge branch 'next/dt' of git://git.linaro.org/people/arnd/arm-soc 2011-11-01 21:02:35 -07:00
msm_serial.h
msm_serial_hs.c msm_serial_hs: Fix spinlock recursion in handling CTS 2011-12-09 19:10:04 -08:00
msm_smd_tty.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
mux.c tty/serial/mux.c: linux/tty.h included twice 2012-02-24 13:50:45 -08:00
mxs-auart.c clock management changes for i.MX 2012-01-09 14:44:15 -08:00
netx-serial.c
nwpserial.c tty: Add export.h for EXPORT_SYMBOL/THIS_MODULE to exporters 2011-10-31 19:31:28 -04:00
of_serial.c drivercore: Add helper macro for platform_driver boilerplate 2011-10-25 00:35:47 +02:00
omap-serial.c tty: serial: OMAP: Fix oops due to NULL pdata in DT boot 2012-03-08 10:56:44 -08:00
pch_uart.c serial: pch_uart: trivail cleanup by removing the pch_uart_hal_request() 2012-02-09 09:02:26 -08:00
pmac_zilog.c serial: Kill off NO_IRQ 2012-01-26 17:14:50 -08:00
pmac_zilog.h tty/serial/pmac_zilog: Fix suspend & resume 2011-12-16 11:10:01 +11:00
pnx8xxx_uart.c
pxa.c serial: pxa: work around for errata #20 2011-09-22 15:47:53 -07:00
sa1100.c
samsung.c serial: samsung: fix s3c2442 platform data 2012-02-24 13:50:46 -08:00
samsung.h serial: samsung: merge probe() function from all SoC specific extensions 2011-12-23 10:07:00 +09:00
sb1250-duart.c TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
sc26xx.c TTY: serial: convert drivers/tty/serial/* to use module_platform_driver() 2011-11-30 20:11:46 +09:00
serial_core.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
serial_ks8695.c TTY: irq: Remove IRQF_DISABLED 2011-09-22 16:08:57 -07:00
serial_txx9.c TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
sh-sci.c Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2012-01-17 18:40:24 -08:00
sh-sci.h ARM: mach-shmobile: R-Mobile A1 support. 2011-11-11 16:55:31 +09:00
sirfsoc_uart.c UART: add CSR SiRFprimaII SoC on-chip uart drivers 2011-11-17 11:46:04 -08:00
sirfsoc_uart.h UART: add CSR SiRFprimaII SoC on-chip uart drivers 2011-11-17 11:46:04 -08:00
sn_console.c serial: Fix typo in sn_console.c 2012-02-24 13:50:45 -08:00
suncore.c tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
sunhv.c tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
sunsab.c tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
sunsab.h
sunsu.c tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
sunzilog.c tty: sparc: rename drivers/tty/serial/suncore.h -> include/linux/sunserialcore.h 2012-02-10 10:44:35 -08:00
sunzilog.h
timbuart.c TTY: serial: convert drivers/tty/serial/* to use module_platform_driver() 2011-11-30 20:11:46 +09:00
timbuart.h
uartlite.c Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6 2011-10-27 08:35:41 +02:00
ucc_uart.c serial: Kill off NO_IRQ 2012-01-26 17:14:50 -08:00
vr41xx_siu.c serial: Kill off NO_IRQ 2012-01-26 17:14:50 -08:00
vt8500_serial.c
xilinx_uartps.c tty: Add module.h to drivers/tty users who just expect it there. 2011-10-31 19:31:27 -04:00
zs.c TTY: serial, fix includes in some drivers 2011-09-22 15:49:26 -07:00
zs.h