linux_dsm_epyc7002/drivers/tty/serial/8250
Marek Vasut f6aa5beb45 serial: 8250: Fix clearing FIFOs in RS485 mode again
The 8250 FIFOs indeed need to be cleared after stopping transmission in
RS485 mode without SER_RS485_RX_DURING_TX flag set. But there are two
problems with the approach taken by the previous patch from Fixes tag.

First, serial8250_clear_fifos() should clear fifos, but what it really
does is it enables the FIFOs unconditionally if present, clears them
and then sets the FCR register to zero, which effectively disables the
FIFOs. In case the FIFO is disabled, enabling it and clearing it makes
no sense and in fact can trigger misbehavior of the 8250 core. Moreover,
the FCR register may contain other FIFO configuration bits which may not
be writable unconditionally and writing them incorrectly can trigger
misbehavior of the 8250 core too. (ie. AM335x UART swallows the first
byte and retransmits the last byte twice because of this FCR write).

Second, serial8250_clear_and_reinit_fifos() completely reloads the FCR,
but what really has to happen at the end of the RS485 transmission is
clearing of the FIFOs and nothing else.

This patch repairs serial8250_clear_fifos() so that it really only
clears the FIFOs by operating on FCR[2:1] bits and leaves all the
other bits alone. It also undoes serial8250_clear_and_reinit_fifos()
from __do_stop_tx_rs485() as serial8250_clear_fifos() is sufficient.

Signed-off-by: Marek Vasut <marex@denx.de>
Fixes: 2bed8a8e70 ("Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break")
Cc: Daniel Jedrychowski <avistel@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable <stable@vger.kernel.org> # let it bake a bit before merging
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 16:07:25 +02:00
..
8250_accent.c
8250_acorn.c
8250_aspeed_vuart.c serial/aspeed-vuart: fix a couple mod_timer() calls 2018-05-14 13:51:11 +02:00
8250_bcm2835aux.c
8250_boca.c
8250_core.c serial: 8250: drop the printk from serial8250_interrupt() 2018-09-18 16:07:23 +02:00
8250_dma.c
8250_dw.c serial: 8250_dw: Add ACPI support for uart on Broadcom SoC 2018-08-02 10:11:32 +02:00
8250_early.c
8250_em.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
8250_exar_st16c554.c
8250_exar.c serial: 8250_exar: Read INT0 from slave device, too 2018-08-02 10:11:35 +02:00
8250_fintek.c
8250_fourport.c
8250_fsl.c
8250_gsc.c
8250_hp300.c
8250_hub6.c
8250_ingenic.c
8250_lpc18xx.c
8250_lpss.c
8250_men_mcb.c
8250_mid.c
8250_moxa.c
8250_mtk.c
8250_of.c serial: 8250_of: Fix for lack of interrupt support 2018-09-18 16:07:25 +02:00
8250_omap.c serial: 8250_omap: Add support for AM654 UART controller 2018-06-28 21:23:44 +09:00
8250_pci.c serial: 8250_pci: Remove stalled entries in blacklist 2018-06-28 21:34:39 +09:00
8250_pnp.c
8250_port.c serial: 8250: Fix clearing FIFOs in RS485 mode again 2018-09-18 16:07:25 +02:00
8250_pxa.c
8250_uniphier.c
8250.h
Kconfig serial: 8250_omap: Make 8250_omap driver driver depend on ARCH_K3 2018-09-18 16:07:24 +02:00
Makefile
serial_cs.c drivers/tty: add error handling for pcmcia_loop_config 2018-06-28 21:23:44 +09:00