-
Notifications
You must be signed in to change notification settings - Fork 5.2k
SPI: merge upstream patches for spi-bcm2835 that went into mainline (for 4.1) #930
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
Comments
Are you more interested in 3.18 or 4.0 tree? |
Well - I do not know your timelines for your next kernel releases. If the move to 4.0 is further off, then 3.18 if 4.0 is coming in shortly, then that. 4.0 already comes with the improvement for spi_sync (in case of an idle queue), so this would be another thing that is beneficial. |
4.0 seems to work fine (it's in latest OpenELEC builds). We can pull it into 3.18 as well. Do you believe existing SPI users will have any issues, or need to change any setup after the merge? |
No change is needed anywhere. It will even alter the GPIO 7 and 8 (chip-selects) from ALT0 to OUT on the fly. There are immediate advantages (unlimited - that means < 56) number of CS, less interrupts and context switches for big transfers, latency improvements), but not as much as with 4.0. Also on to spi-bcm2835 is still not used as the default, but spi-bcm2708 is - you still have to enable it via the device-tree-overlay... What is still missing is DMA mode, but that shall arrive as well... Please note again this one issue that is left open that can have side-effects until fixed. This is the submitted fix (no feedback yet if it gets merged) for the issue:
|
There is the following patch scheduled to go upstream by the spi-maintainer: 145367b - spi: bcm2835: change timeout of polling driver to 1s That completes the first set of improvements for the spi driver. |
I've added your patches to rpi-4.0.y tree. It builds okay. |
I will build 4.0.y on a rpi2 today and then run my torture test and will let you know... |
I tried to build 4.0.y, but it is stuck during boot - see: #934 |
But the patch is OK in principle, so it should also apply to 3.18.y, which I am just rebuilding now... |
OK - now that the Devicetree was also changed 4.0.y works and the driver does what it is expected to do - even with the torture test! Lots of those interrupts actually come from:
when the torture-load is running. I need to investigate the missmatch with a logic analyzer to maybe come to an understanding why it is also not using polling-mode... |
Ah - just after send the explanation comes to my mind: the spi_sync optimization only came with 4.1. |
but I can now confirm it works as expected for rpi-3.18.y (copying) and rpi-4.0.y (in tree)... |
To get the latest improvements early it might also be beneficial to apply those to 3.18.y, so cherry-pick: But note that there is something strange on the rpi-kernels - at least when using 3.18.y on a rpi2:
I will try the same with rpi-4.0.y (which contains the above patches already) to see if we see the same issue there as well... |
kernel: smsc95xx: Disable turbo mode by default See: raspberrypi/linux#837 kernel: SPI: merge upstream patches for spi-bcm2835 See: raspberrypi/linux#930 firmware: jpegdec: Fix memory corruption issue caused by repeated exif tags See: OpenELEC/OpenELEC.tv#4089 firmware: lcd: Updated pi lcd support firmware: arm_display: Avoid overscan for lcd displays
kernel: smsc95xx: Disable turbo mode by default See: raspberrypi/linux#837 kernel: SPI: merge upstream patches for spi-bcm2835 See: raspberrypi/linux#930 firmware: jpegdec: Fix memory corruption issue caused by repeated exif tags See: OpenELEC/OpenELEC.tv#4089 firmware: lcd: Updated pi lcd support firmware: arm_display: Avoid overscan for lcd displays
kernel: smsc95xx: Disable turbo mode by default See: raspberrypi/linux#837 kernel: SPI: merge upstream patches for spi-bcm2835 See: raspberrypi/linux#930 firmware: jpegdec: Fix memory corruption issue caused by repeated exif tags See: OpenELEC/OpenELEC.tv#4089 firmware: lcd: Updated pi lcd support firmware: arm_display: Avoid overscan for lcd displays
ci: reduce frequency
Hi!
Can you merge the following patches from upstream into your kernel to improve the spi-bcm2835 driver ahead of 4.1?
torvalds/linux@342f948 - spi: bcm2835: fix all checkpath --strict messages
torvalds/linux@4adf312 - spi: bcm2835: fill/drain SPI-fifo as much as possible during interrupt
torvalds/linux@210b492 - spi: bcm2835: clock divider can be a multiple of 2
torvalds/linux@6935224 - spi: bcm2835: enable support of 3-wire mode
torvalds/linux@e34ff01 - spi: bcm2835: move to the transfer_one driver model
torvalds/linux@1e4df62 - spi: bcm2835: fix code formatting issue
torvalds/linux@e3a2be3 - spi: bcm2835: fill FIFO before enabling interrupts to reduce interrupt latencies
torvalds/linux@a30a555 - spi: bcm2835: transform native-cs to gpio-cs on first spi_setup
torvalds/linux@704f32d - spi: bcm2835: enabling polling mode for transfers shorter than 30us
The driver also makes use of a new interface in 4.1, but we can disable that by commenting this line out:
master->handle_err = bcm2835_spi_handle_err;
Note that there is still one issue that can result in -ETIMEDOUT during HEAVY load on the system with short transfers (>70%system, 0%idle).
A solution for that is in the pipeline - I will amend that to the ticket as soon as it has gone in.
Also note that in 4.1 the spi-framework contains some patches that greatly improve latencies for kernel modules that use spi_sync et.al, so maybe it is better to target 4.1 as a whole as soon as it comes out. But that is at least 2 month away...
The text was updated successfully, but these errors were encountered: