android_kernel_msm-6.1_noth.../drivers/tty/serial
Hugo Villeneuve b736642962 serial: sc16is7xx: fix bug when first setting GPIO direction
commit 9baeea723c0fb9c3ba9a336369f758ed9bc6831d upstream.

When configuring a pin as an output pin with a value of logic 0, we
end up as having a value of logic 1 on the output pin. Setting a
logic 0 a second time (or more) after that will correctly output a
logic 0 on the output pin.

By default, all GPIO pins are configured as inputs. When we enter
sc16is7xx_gpio_direction_output() for the first time, we first set the
desired value in IOSTATE, and then we configure the pin as an output.
The datasheet states that writing to IOSTATE register will trigger a
transfer of the value to the I/O pin configured as output, so if the
pin is configured as an input, nothing will be transferred.

Therefore, set the direction first in IODIR, and then set the desired
value in IOSTATE.

This is what is done in NXP application note AN10587.

Fixes: dfeae619d7 ("serial: sc16is7xx")
Cc: stable@vger.kernel.org
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com>
Tested-by: Lech Perczak <lech.perczak@camlingroup.com>
Link: https://lore.kernel.org/r/20230807214556.540627-6-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-06 21:27:02 +01:00
..
8250 serial: 8250: Fix oops for port->pm on uart_change_pm() 2023-08-23 17:52:38 +02:00
cpm_uart serial: cpm_uart: Fix a COMPILE_TEST dependency 2023-06-09 10:34:26 +02:00
jsm drivers: serial: jsm: fix some leaks in probe 2022-09-22 16:11:43 +02:00
21285.c TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
altera_jtaguart.c tty: serial: do unlock on a common path in altera_jtaguart_console_putc() 2022-09-30 14:58:46 +02:00
altera_uart.c serial: altera_uart: fix locking in polling mode 2022-12-31 13:32:40 +01:00
amba-pl010.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
amba-pl011.c serial: amba-pl011: fix high priority character transmission in rs486 mode 2023-01-24 07:24:39 +01:00
apbuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
apbuart.h
ar933x_uart.c serial: ar933x: Deassert Transmit Enable on ->rs485_config() 2022-09-22 16:43:05 +02:00
arc_uart.c serial: arc_uart: fix of_iomap leak in arc_serial_probe 2023-05-24 17:32:44 +01:00
atmel_serial.c serial: atmel: don't enable IRQs prematurely 2023-07-23 13:49:40 +02:00
atmel_serial.h tty: serial: atmel: Use FIELD_PREP/FIELD_GET 2022-09-22 16:32:25 +02:00
bcm63xx_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
clps711x.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
digicolor-usart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
dz.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
dz.h
earlycon-arm-semihost.c
earlycon-riscv-sbi.c
earlycon.c tty: move from strlcpy with unused retval to strscpy 2022-08-30 14:21:59 +02:00
fsl_linflexuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
fsl_lpuart.c tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms 2023-08-23 17:52:31 +02:00
icom.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
imx.c tty: serial: imx: fix rs485 rx after tx 2023-07-23 13:49:41 +02:00
imx_earlycon.c
ip22zilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ip22zilog.h
Kconfig serial: cpm_uart: Fix a COMPILE_TEST dependency 2023-06-09 10:34:26 +02:00
kgdb_nmi.c
kgdboc.c serial: kgdboc: Fix typo in comment 2022-06-27 14:37:09 +02:00
lantiq.c serial: lantiq: add missing interrupt ack 2023-06-21 16:00:57 +02:00
liteuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
lpc32xx_hs.c tty: serial: extract tx_ready() from __serial_lpc32xx_tx() 2022-09-22 16:14:08 +02:00
Makefile serial: remove VR41XX serial driver 2022-07-16 08:16:01 +02:00
max310x.c serial: max310x: fix IO data corruption in batched operations 2023-05-11 23:03:01 +09:00
max3100.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mcf.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
men_z135_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
meson_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
milbeaut_usio.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mpc52xx_uart.c tty: serial: switch mpc52xx_uart_int_{r,t}x_chars() to bool 2022-09-22 16:14:08 +02:00
mps2-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
msm_serial.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mux.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mvebu-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mxs-auart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
omap-serial.c tty: serial: extract serial_omap_put_char() from transmit_chars() 2022-09-22 16:14:08 +02:00
owl-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pch_uart.c tty: pcn_uart: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:39 +01:00
pic32_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pmac_zilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pmac_zilog.h
pxa.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
qcom_geni_serial.c serial: qcom-geni: fix opp vote on shutdown 2023-09-06 21:27:01 +01:00
rda-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
rp2.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sa1100.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
samsung_tty.c tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk 2023-07-23 13:49:41 +02:00
sb1250-duart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sc16is7xx.c serial: sc16is7xx: fix bug when first setting GPIO direction 2023-09-06 21:27:02 +01:00
sccnxp.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
serial-tegra.c serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init() 2023-03-10 09:33:32 +01:00
serial_core.c serial: core: lock port for start_rx() in uart_resume_port() 2023-07-19 16:21:53 +02:00
serial_mctrl_gpio.c Documentation: serial: move GPIO kernel-doc to the functions 2022-07-28 10:37:42 +02:00
serial_mctrl_gpio.h
serial_txx9.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sh-sci.c tty: serial: sh-sci: Fix Rx on RZ/G2L SCI 2023-04-13 16:55:28 +02:00
sh-sci.h
sifive.c serial: sifive: Fix sifive_serial_console_setup() section 2023-08-03 10:24:08 +02:00
sprd_serial.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
st-asc.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
stm32-usart.c serial: stm32: Ignore return value of uart_remove_one_port() in .remove() 2023-08-23 17:52:23 +02:00
stm32-usart.h serial: stm32: make info structs static to avoid sparse warnings 2022-07-28 10:35:23 +02:00
suncore.c
sunhv.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunplus-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunsab.c serial: sunsab: Fix error handling in sunsab_init() 2022-12-31 13:32:40 +01:00
sunsab.h
sunsu.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunzilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunzilog.h
tegra-tcu.c Merge 7e2cd21e02 ("Merge tag 'tty-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into tty-next 2022-09-25 09:22:13 +02:00
timbuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
timbuart.h
uartlite.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ucc_uart.c serial: ucc_uart: Remove custom frame size calculation 2022-08-30 14:28:33 +02:00
vt8500_serial.c tty: serial: move and cleanup vt8500_tx_empty() 2022-09-22 16:14:07 +02:00
xilinx_uartps.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
zs.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
zs.h