-
Notifications
You must be signed in to change notification settings - Fork 5.4k
serial: amba-pl011: Fix RTS handling in RS485 mode #7180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rpi-6.12.y
Are you sure you want to change the base?
Conversation
is missing in |
commit 2c1fd53 upstream. Data loss on serial line was observed during communication through serial ports ttyAMA1 and ttyAMA2 interconnected via RS485 transcievers. Both ports are in one BCM2711 (Compute Module CM40) and they share the same interrupt line. The problem is caused by long waiting for tx queue flush in the function pl011_rs485_tx_stop. Udelay or mdelay are used to wait. The function is called from the interrupt handler. If multiple devices share a single interrupt line, late processing of pending interrupts and data loss may occur. When operation of both devices are synchronous, collisions are quite often. This rework is based on the method used in tty/serial/imx.c Use hrtimer instead of udelay and mdelay calls. Replace simple bool variable rs485_tx_started by 4-state variable rs485_tx_state. Tested-by: Lino Sanfilippo <[email protected]> Signed-off-by: Miroslav Ondra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
pl011_axi_probe was missing the equivlent hrtimer initialisation from commit 2c1fd53 ("serial: amba-pl011: Fix RTS handling in RS485 mode") and commit 8cb4418 ("serial: amba-pl011: Switch to use hrtimer_setup()") resulting in the kernel blowing up as soon as pl011_rs485_stop_tx tried to use them. Add the hrtimer initialisation. Fixes: 120c89e ("serial: pl011: rp1 uart support") Signed-off-by: Dave Stevenson <[email protected]>
|
Like this? |
|
Yes, that's the same as what I tested here. There is still a significant performance regression (essentially unusable) with our RS485-based backplane driver. I would really appreciate holding off on the merge until we have investigated this further. Otherwise, we would need to revert this downstream. |
|
It's going nowhere for now. |
|
I've put together a workaround that brings back stable functionality for our serdev-based backplane driver: https://gitlab.com/revolutionpi/linux/-/commit/c3cae2df785ea604b49addfd2f7d75159e91475a Since we'd like to get as much as possible into upstream, I'm still figuring out how to frame this in a way that makes sense for mainline. Before posting to the mailing list, I wanted to check if you or Jonathan have any thoughts on this. |
commit 2c1fd53 upstream.
Data loss on serial line was observed during communication through serial ports ttyAMA1 and ttyAMA2 interconnected via RS485 transcievers. Both ports are in one BCM2711 (Compute Module CM40) and they share the same interrupt line.
The problem is caused by long waiting for tx queue flush in the function pl011_rs485_tx_stop. Udelay or mdelay are used to wait. The function is called from the interrupt handler. If multiple devices share a single interrupt line, late processing of pending interrupts and data loss may occur. When operation of both devices are synchronous, collisions are quite often.
This rework is based on the method used in tty/serial/imx.c Use hrtimer instead of udelay and mdelay calls.
Replace simple bool variable rs485_tx_started by 4-state variable rs485_tx_state.
Tested-by: Lino Sanfilippo [email protected]
Link: https://lore.kernel.org/r/[email protected]