Allow disabling FIFOs on PL011 UART #5794
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The BCM2835 PL011 implementation assumes that Rx/Tx FIFOs should be always enabled. Although this is desirable for most of the time, there are rare occasions when FIFOs introduce unwanted delay on the line. The delay is unnoticeable for the common UART use cases but it can lead to communication failures in UART-based protocols expecting fast responses, such as eBUS.
The solution is to add a new
disable-fifos
property to Pi DTBs and use the presence of that property to forcefully set FIFOs size to 1, and prevent FIFOs from being enabled in the PL011 driver.Example issues that might be originating from the delay introduced by FIFO buffering:
Tested with ebusd on Raspberry Pi Zero W v1.1. I was able to communicate with eBUS's participants after adding
dtoverlay=uart0,disable_fifos
toconfig.txt
. If it's not appropriate to keep this flag in the "uart0" overlay, a dedicated overlay for the flag can be created instead.Results on logic analyzer
For a simple test I tied TX and RX pins together, and I ran a simple program written in C in which I'm writing a single character, reading it back, and then writing and reading it again. This way I can test if there are any delays in both write and read queues.
The first screenshot shows that when FIFOs are enabled, the gap between consecutive write/read/write operations is roughly 13 milliseconds.
The same test repeated when FIFOs are disabled shows that the gap is now only 30 microseconds. This is 430 times smaller than when FIFOs were enabled.
The code I used for testing: