linux-stable/drivers/tty/serial/8250
Maciej W. Rozycki 78bcae8616 serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates
Support for magic baud rate divisors of 32770 and 32769 used with SMSC
Super I/O chips for extra baud rates of 230400 and 460800 respectively
where base rate is 115200[1] has been added around Linux 2.5.64, which
predates our repo history, but the origin could be identified as commit
2a717aad772f ("Merge with Linux 2.5.64.") with the old MIPS/Linux repo
also at: <git://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git>.

Code that is now in `serial8250_do_get_divisor' was added back then to
`serial8250_get_divisor', but that code would only ever trigger if one
of the higher baud rates was actually requested, and that cannot ever
happen, because the earlier call to `serial8250_get_baud_rate' never
returns them.  This is because it calls `uart_get_baud_rate' with the
maximum requested being the base rate, that is clk/16 or 115200 for SMSC
chips at their nominal clock rate.

Fix it then and allow UPF_MAGIC_MULTIPLIER baud rates to be selected, by
requesting the maximum baud rate of clk/4 rather than clk/16 if the flag
has been set.  Also correct the minimum baud rate, observing that these
ports only support actual (non-magic) divisors of up to 32767 only.

References:

[1] "FDC37M81x, PC98/99 Compliant Enhanced Super I/O Controller with
    Keyboard/Mouse Wake-Up", Standard Microsystems Corporation, Rev.
    03/27/2000, Table 31 - "Baud Rates", p. 77

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2105190412280.29169@angie.orcam.me.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-16 09:20:29 +02:00
..
8250.h serial: 8250: Use BIT(x) for UART_{CAP,BUG}_* 2021-05-20 17:14:50 +02:00
8250_accent.c
8250_acorn.c
8250_aspeed_vuart.c Merge 5.13-rc4 into tty-next 2021-05-31 09:44:28 +02:00
8250_bcm2835aux.c
8250_bcm7271.c serial: 8250: Make symbol 'brcmuart_debugfs_root' static 2021-04-02 16:12:27 +02:00
8250_boca.c
8250_core.c tty/serial: make port of serial8250_register_8250_port const 2021-05-20 16:59:14 +02:00
8250_dma.c
8250_dw.c serial: 8250_dw: Add device HID for new AMD UART controller 2021-05-13 17:08:42 +02:00
8250_dwlib.c
8250_dwlib.h
8250_early.c
8250_em.c
8250_exar.c Linux 5.13-rc6 2021-06-14 09:14:43 +02:00
8250_exar_st16c554.c
8250_fintek.c
8250_fourport.c
8250_fsl.c serial: do not restore interrupt state in sysrq helper 2021-04-22 12:04:26 +02:00
8250_gsc.c
8250_hp300.c
8250_hub6.c
8250_ingenic.c
8250_ioc3.c
8250_lpc18xx.c
8250_lpss.c
8250_men_mcb.c
8250_mid.c
8250_mtk.c
8250_of.c serial: 8250: of: Check for CONFIG_SERIAL_8250_BCM7271 2021-05-13 16:22:48 +02:00
8250_omap.c Revert "serial: 8250: 8250_omap: Fix possible interrupt storm" 2021-05-28 10:58:49 +02:00
8250_pci.c serial: 8250: Correct the clock for OxSemi PCIe devices 2021-06-16 09:20:29 +02:00
8250_pnp.c
8250_port.c serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates 2021-06-16 09:20:29 +02:00
8250_pxa.c
8250_tegra.c
8250_uniphier.c
Kconfig serial: extend compile-test coverage 2021-04-22 13:12:13 +02:00
Makefile serial: 8250: Add new 8250-core based Broadcom STB driver 2021-03-26 15:18:30 +01:00
serial_cs.c tty: serial: 8250: serial_cs: Fix a memory leak in error handling path 2021-05-27 15:20:05 +02:00