diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-03-27 16:28:04 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-03-27 16:28:04 +0100 |
commit | d2479f889557ea6d14f08954fdfca96c814ac80e (patch) | |
tree | 97cfe5ddc910ad25b954e4cfd18ccf331a84781a /queue-6.7/tty-serial-imx-fix-broken-rs485.patch | |
parent | d4bd1db699647d6f71d0dac4af0706b178859eb9 (diff) | |
download | stable-queue-d2479f889557ea6d14f08954fdfca96c814ac80e.tar.gz |
6.7-stable patches
added patches:
alsa-hda-realtek-add-headset-mic-supported-acer-nb-platform.patch
alsa-hda-realtek-fix-headset-mic-no-show-at-resume-back-for-lenovo-alc897-platform.patch
alsa-hda-realtek-fix-mute-micmute-leds-for-hp-elitebook.patch
arm-imx_v6_v7_defconfig-restore-config_backlight_class_device.patch
arm64-dts-qcom-sc8280xp-x13s-limit-pcie4-link-speed.patch
drm-amd-display-handle-range-offsets-in-vrr-ranges.patch
drm-amd-swsmu-modify-the-gfx-activity-scaling.patch
drm-amdgpu-pm-fix-the-error-of-pwm1_enable-setting.patch
drm-i915-check-before-removing-mm-notifier.patch
drm-i915-don-t-explode-when-the-dig-port-we-don-t-have-an-aux-ch.patch
fs-aio-check-iocb_aio_rw-before-the-struct-aio_kiocb-conversion.patch
i2c-i801-avoid-potential-double-call-to-gpiod_remove_lookup_table.patch
i2c-i801-fix-using-mux_pdev-before-it-s-set.patch
iio-accel-adxl367-fix-devid-read-after-reset.patch
iio-accel-adxl367-fix-i2c-fifo-data-register.patch
iio-imu-inv_mpu6050-fix-fifo-parsing-when-empty.patch
iio-imu-inv_mpu6050-fix-frequency-setting-when-chip-is-off.patch
iio-pressure-fixes-bmp38x-and-bmp390-spi-support.patch
mei-me-add-arrow-lake-point-h-did.patch
mei-me-add-arrow-lake-point-s-did.patch
misc-fastrpc-pass-proper-arguments-to-scm-call.patch
misc-lis3lv02d_i2c-fix-regulators-getting-en-dis-abled-twice-on-suspend-resume.patch
mm-vmscan-prevent-infinite-loop-for-costly-gfp_noio-__gfp_retry_mayfail-allocations.patch
revert-tty-serial-simplify-qcom_geni_serial_send_chunk_fifo.patch
serial-8250_dw-do-not-reclock-if-already-at-correct-rate.patch
serial-port-don-t-suspend-if-the-port-is-still-busy.patch
sev-disable-sev-es-debugswap-by-default.patch
tee-optee-fix-kernel-panic-caused-by-incorrect-error-handling.patch
tracing-use-.flush-call-to-wake-up-readers.patch
tty-serial-fsl_lpuart-avoid-idle-preamble-pending-if-cts-is-enabled.patch
tty-serial-imx-fix-broken-rs485.patch
usb-gadget-ncm-fix-handling-of-zero-block-length-packets.patch
usb-port-don-t-try-to-peer-unused-usb-ports-based-on-location.patch
usb-typec-altmodes-displayport-create-sysfs-nodes-as-driver-s-default-device-attribute-group.patch
usb-usb-storage-prevent-divide-by-0-error-in-isd200_ata_command.patch
vt-fix-unicode-buffer-corruption-when-deleting-characters.patch
xhci-fix-failure-to-detect-ring-expansion-need.patch
Diffstat (limited to 'queue-6.7/tty-serial-imx-fix-broken-rs485.patch')
-rw-r--r-- | queue-6.7/tty-serial-imx-fix-broken-rs485.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/queue-6.7/tty-serial-imx-fix-broken-rs485.patch b/queue-6.7/tty-serial-imx-fix-broken-rs485.patch new file mode 100644 index 0000000000..255b477fe0 --- /dev/null +++ b/queue-6.7/tty-serial-imx-fix-broken-rs485.patch @@ -0,0 +1,85 @@ +From 672448ccf9b6a676f96f9352cbf91f4d35f4084a Mon Sep 17 00:00:00 2001 +From: Rickard x Andersson <rickaran@axis.com> +Date: Wed, 21 Feb 2024 12:53:04 +0100 +Subject: tty: serial: imx: Fix broken RS485 + +From: Rickard x Andersson <rickaran@axis.com> + +commit 672448ccf9b6a676f96f9352cbf91f4d35f4084a upstream. + +When about to transmit the function imx_uart_start_tx is called and in +some RS485 configurations this function will call imx_uart_stop_rx. The +problem is that imx_uart_stop_rx will enable loopback in order to +release the RS485 bus, but when loopback is enabled transmitted data +will just be looped to RX. + +This patch fixes the above problem by not enabling loopback when about +to transmit. + +This driver now works well when used for RS485 half duplex master +configurations. + +Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high") +Cc: stable <stable@kernel.org> +Signed-off-by: Rickard x Andersson <rickaran@axis.com> +Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> +Link: https://lore.kernel.org/r/20240221115304.509811-1-rickaran@axis.com +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/tty/serial/imx.c | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) + +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -462,8 +462,7 @@ static void imx_uart_stop_tx(struct uart + } + } + +-/* called with port.lock taken and irqs off */ +-static void imx_uart_stop_rx(struct uart_port *port) ++static void imx_uart_stop_rx_with_loopback_ctrl(struct uart_port *port, bool loopback) + { + struct imx_port *sport = (struct imx_port *)port; + u32 ucr1, ucr2, ucr4, uts; +@@ -485,7 +484,7 @@ static void imx_uart_stop_rx(struct uart + /* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */ + if (port->rs485.flags & SER_RS485_ENABLED && + port->rs485.flags & SER_RS485_RTS_ON_SEND && +- sport->have_rtscts && !sport->have_rtsgpio) { ++ sport->have_rtscts && !sport->have_rtsgpio && loopback) { + uts = imx_uart_readl(sport, imx_uart_uts_reg(sport)); + uts |= UTS_LOOP; + imx_uart_writel(sport, uts, imx_uart_uts_reg(sport)); +@@ -498,6 +497,16 @@ static void imx_uart_stop_rx(struct uart + } + + /* called with port.lock taken and irqs off */ ++static void imx_uart_stop_rx(struct uart_port *port) ++{ ++ /* ++ * Stop RX and enable loopback in order to make sure RS485 bus ++ * is not blocked. Se comment in imx_uart_probe(). ++ */ ++ imx_uart_stop_rx_with_loopback_ctrl(port, true); ++} ++ ++/* called with port.lock taken and irqs off */ + static void imx_uart_enable_ms(struct uart_port *port) + { + struct imx_port *sport = (struct imx_port *)port; +@@ -682,9 +691,14 @@ static void imx_uart_start_tx(struct uar + imx_uart_rts_inactive(sport, &ucr2); + imx_uart_writel(sport, ucr2, UCR2); + ++ /* ++ * Since we are about to transmit we can not stop RX ++ * with loopback enabled because that will make our ++ * transmitted data being just looped to RX. ++ */ + if (!(port->rs485.flags & SER_RS485_RX_DURING_TX) && + !port->rs485_rx_during_tx_gpio) +- imx_uart_stop_rx(port); ++ imx_uart_stop_rx_with_loopback_ctrl(port, false); + + sport->tx_state = WAIT_AFTER_RTS; + |