summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-08-13watchdog: imx8_wdt: improve help and loggingOleksandr Suvorov
Improve module help messages and logging operations in debug mode. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> (cherry picked from commit 912e48ef088c1f39e8534ecbdb4d1342baa733a8) Conflicts: drivers/watchdog/imx8_wdt.c Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13gitlab-ci: Move git settings to the right spot and use shallow checkoutPhilippe Schenker
(cherry picked from commit 8b950bec2bd3dc55b8b807b6d64818dca0530377)
2020-08-13gitlab-ci: build kernel and all devicetreesPhilippe Schenker
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> (cherry picked from commit f132aef62b57559022ea9f8c5ef7f4267e7ccbbc)
2020-08-13rpmsg: virtio rpmsg: compilation error and warningsIgor Opaniuk
1. Fix this compilation error: /workdir/oe/tmp-glibc/work-shared/verdin-imx8mm/kernel-source/drivers/ rpmsg/virtio_rpmsg_bus.c:1106:23: error: redeclaration of 'newch' with no linkage struct rpmsg_device *newch; ^~~~~ /workdir/oe/tmp-glibc/work-shared/verdin-imx8mm/kernel-source/drivers/ rpmsg/virtio_rpmsg_bus.c:1101:23: note: previous declaration of 'newch' was here struct rpmsg_device *newch; 2. Fix warnings that are reproduced when RPMsg char device support is disabled. Fixes: 1172ee2e ("rpmsg: virtio rpmsg: Add RPMsg char driver support") Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> (cherry picked from commit 1f734be74f1d17ac072edbb6d333cd5041157ef0)
2020-08-13spi: fsl-lpspi: register spi controller earlier in probePhilippe Schenker
Ordering of stuff in lpspi probe was a little off. - num_chipselect gets set with devm_spi_register_controller. - devm_spi_register_controller needs data that gets set into controller variable Order stuff appropriate so num_chipselect gets set before it is used. Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> (cherry picked from commit a22e9000e304c75472c294abf5ba17a66d399fba)
2020-08-13arm64: defconfig: add RTL8188EUS driverOleksandr Suvorov
Toradex USB WiFi module LM816 uses RTL8188EUS wi-fi chip. There is staging working driver in kernel for this chip. Enabling it makes one able to use LM816 wifi usb dongle "from the box" w/o installing additional software. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> (cherry picked from commit 42d91989c70d8e4a7bbc3f3dee7d3165846a3c2e) Conflicts: arch/arm64/configs/defconfig Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13rpmsg: virtio rpmsg: Add RPMsg char driver supportIgor Opaniuk
virtio rpmsg was not implemented to use RPMsg char driver. Each virtio ns announcement will create a new RPMsg device which is supposed to bound to a RPMsg driver. It doesn't support dynamic endpoints with name service per RPMsg device. With RPMsg char driver, you can have multiple endpoints per RPMsg device. Here is the change from this patch: * Introduce a macro to indicate if want to use RPMsg char driver for virtio RPMsg. The RPMsg device can either be bounded to a simple RPMsg driver or the RPMsg char driver. * Create Virtio RPMsg char device when the virtio RPMsg driver is probed. * when there is a remote service announced, keep it in the virtio proc remote services list. * when there is an endpoint created, bind it to a remote service from the remote services list. If the service doesn't exist yet, create one and mark the service address as ANY. That patch ported to our 4.14 kernel + additional fixes added [1]. Example of usage from userspace app: ``` char data_buf [] = {'a', 'b', 'c', 'd', '\0'}; struct rpmsg_endpoint_info ept_info = {"rpmsg-openamp-demo-channel", 0x2, 0x1}; int fd = open("/dev/rpmsg_ctrl0", O_RDWR); /* create endpoint interface */ ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &ept_info); /* create endpoint */ int fd_ept = open("/dev/rpmsg0", O_RDWR); /* receive data from remote device */ read(fd_ept, &data_buf, sizeof(data_buf)); /* send data to remote device */ write(fd_ept, &data_buf, sizeof(data_buf)); /* destroy endpoint */ ioctl(fd_ept, RPMSG_DESTROY_EPT_IOCTL); close(fd_ept); close(fd); ``` [1] https://patchwork.kernel.org/patch/10145779/ Signed-off-by: Wendy Liang <jliang@xilinx.com> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> (cherry picked from commit 06ab53a559eddc27d0c45e4935a65a19820714a2)
2020-08-13ASoC: wm8904: assume mclk as the clk_id for simple-audio-cardMax Krummenacher
The simple-audio-card driver sets clk_id to a constant 0. Assume that we want to derive the sysclk from the MCLK in that case rather than error out with -EINVAL. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 333c14961b18abad74cf7bd0aeb2929e58cc308a)
2020-08-13dt-bindings: pinctrl: imx8mm: add alternative uart muxingsMax Krummenacher
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 8bf4e547cd40271e2378219a45f9f54e96bc5fe0) Conflicts: include/dt-bindings/pinctrl/pins-imx8mm.h Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13arm64: defconfig: add max1363 supportMax Krummenacher
On Verdin iMX8MM ADC is provided by a MAX11607. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 8ceb06c6e347281e96cf44dccbb353ff66258365)
2020-08-13arm64: defconfig: add mcp25xxfd supportMax Krummenacher
On Verdin iMX8MM Development board the CAN-FD controller Microchip MCP2518FD is used. Enable the driver which got backported from linux-can-next.git, branch mcp25xxfd-rpi. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit b978a68df02e5310d8298cac18fb3a4360acc464) Conflicts: arch/arm64/configs/defconfig Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13arm64: defconfig: make imx_sdma a moduleMax Krummenacher
Remove firmware kobject uevent fallback mechanism and make imx_sdma a module so it gets loaded when rootfs is mounted. This prevents the error, that firmware can't be loaded from rootfs Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 162332b63296ea4f06cd920204989e82763b7897) Conflicts: arch/arm64/configs/defconfig Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13arm64: defconfig: add marvell wi-fi supportMax Krummenacher
On Verdin iMX8MM the Wi-Fi module is connected through SDIO. Add this driver variant. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 22a713643448fa65365e8b9a2182ee2139939ffb) Conflicts: arch/arm64/configs/defconfig Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13arm64: defconfig: add wm8904 codec driverMax Krummenacher
On Verdin iMX8MM Development board this codec is used. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit efca3aed2c3a3e25b93dfcca65d4f01ed70aa553) Conflicts: arch/arm64/configs/defconfig Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13regulator: bd71837: add enable_time for all ldoMax Krummenacher
The LDO have a Soft-Start feature. Add enable_time to all LDOs to account for that. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit b567a056ed74d8c9700f6dc5e838d3e22e7068bf) Conflicts: drivers/regulator/bd71837-regulator.c Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2020-08-13drm: bridge: lt8912: set bus_formatMax Krummenacher
Some CRTC drivers use and evaluate this information and if missing print a warning. | [ 248.956112] imx_sec_dsim_drv 32e10000.mipi_dsi: no bus formats assigned by connector Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 17e26f89a107a2844b9091bd937225b8b06fa4d0)
2020-08-13can: mcp25xxfd: allow to keep the clock allways onMax Krummenacher
This allows to have a clock on clko even if the controller is disabled. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 417c1031677a958c5c936c243a83fc933c0cfda3)
2020-08-13can: mcp25xxfd: allow using clko as start of frameMax Krummenacher
The current implementation uses the clko pin always as a clock out. Implement the binding documentation and use the pin as a start of frame indication when microchip,clock-out-div is set to 0. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit ccf8ae1f467602baedd2b0c11022c00a6b2e4f8f)
2020-08-13can: mcp25xxfd: allow building without debugfs functionalityMax Krummenacher
If CONFIG_CAN_MCP25XXFD_DEBUG_FS is not defined but CONFIG_DEBUG_FS is then the code fails to compile. Fix this by conditionally compile on CONFIG_CAN_MCP25XXFD_DEBUG_FS. CONFIG_CAN_MCP25XXFD_DEBUG_FS depends on CONFIG_DEBUG_FS, there is no need to test for both. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit c6be3e002d9d878a5119bcaa31ff85a4dbf00301)
2020-08-13dt-binding: can: mcp25xxfd: document device tree bindingsMartin Sperl
Add device-tree bindings for Microcip CanFD Controller mcp2517fd -- Changelog: V1 -> V2: new more generic name based on feedback from microchip cleanup of dt custom properties removing (most) gpio functions V2 -> V3: added vendor-prefix for gpio-opendrain s/_/-/ added gpio-controller V3 -> V4: resend added: Reviewed-by: Rob Herring <robh@kernel.org> V7 -> V8: added support for mcp2518fd added microchip,gpio0-xstandby removed Reviewed-by because of changes Signed-off-by: Martin Sperl <kernel@martin.sperl.org> (cherry picked from commit ca3c427d353bafffa51d38da57e49f61ba16dbbf) (cherry picked from commit 1b9c8b6a5c778c0be58b9877834afa1320b2a0f0)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_fifo_clear(): fix fifo initializationMarc Kleine-Budde
By masking the FIFO number in the MCP25XXFD_CAN_FLTCON macro, the mcp25xxfd_can_fifo_clear() function doesn't clear the filters at all, as the masking makes MCP25XXFD_CAN_FLTCON(32) equal MCP25XXFD_CAN_FLTCON(0). | mcp25xxfd_can_fifo_clear_regs(cpriv, MCP25XXFD_CAN_FLTCON(0), | MCP25XXFD_CAN_FLTCON(32)); Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 265153724aa0339bae525d22511377380fa45af5) (cherry picked from commit 8db84b98f1d4c27c943d98ab0ebb17d966585a1d)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_int(): do not reschedule after inital loopMarc Kleine-Budde
The interrupt handler thread mcp25xxfd_can_int() will reschedule, if "loops % reschedule_int_thread_after" equals 0. This is the case for the initial loop. Change the code to match what the module parameter suggests to do. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit d4f9db41f6db9c233dd8847171c82c7f2ba0ec2e) (cherry picked from commit 907cf9a34059e621dfbf3ad77c30eab5014de5b3)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_queue_frame(): change argument "ts" to u32Marc Kleine-Budde
The timestamp is an u32, so don't cap to upper 16 bit. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 6546a196615cae17d1e4c52f5135b02469adc15f) (cherry picked from commit 1736603794d37359ce180fc0a2819adc701e8099)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_tx_start_xmit() fix possible race conditionMarc Kleine-Budde
Put sbk into echo queue before triggering send. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 2c1df7da765455d86f5630e050905aa3b599ed97) (cherry picked from commit 670deff1f2c9e20a3073bcf2af309e042b893bf6)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_int_send_error_skb(): use correct function to ↵Marc Kleine-Budde
push skb into networking stack in interrupt handler Use netif_rx() instead of netif_receive_skb() to push skb into networking stack from interrupt handler. Reported-by: Tom Prohaszka <tprohaszka@capp-tech.com> Tested-by: Tom Prohaszka <tprohaszka@capp-tech.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 62f9531af8e7f470830d3d285b39570b361e6473) (cherry picked from commit 7623274a7a1b87a879e08eb339ebac1580b42579)
2020-08-13can: mcp25xxfd: remove struct mcp25xxfd_tx_spi_message_queue::spi_lockMarc Kleine-Budde
The xmit callback is serialized by the network stack, no need for locking. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 8d59059d2098ef612fad460e0e9f832ec36d5fbd) (cherry picked from commit dda94b4f004fd92d8534b6c8b6c4bc0854569fc6)
2020-08-13can: mcp25xxfd: only build GPIOLIB support if enabledMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 6f267fd90b21536d3dcb3b4549dbf800357cd944) (cherry picked from commit abfc29bd48224618fed077c3a3ca5aaf89b04886)
2020-08-13can: mcp25xxfd: fix building without CONFIG_GPIOLIBMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 4dc124bd4f631ff0f83a43a2ae9bfafd664b0e34) (cherry picked from commit 3cc268978d684815b222ad47fc321c3dcd70d23a)
2020-08-13can: mcp25xxfd: gpio: remove unused enum mcp25xxfd_gpio_pinsMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 9781ee8b4dc9feb1809e864bbbbe0bd2001aed59) (cherry picked from commit 67fbdce642e12c3a2626b378932d14f31afb5243)
2020-08-13can: mcp25xxfd: make debugfs support a separate optionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 6cf806f542afb974470f29324fcfa76539539c8b) (cherry picked from commit a6b68b69cf6ae66d72074ca2284592f30b353c80)
2020-08-13can: mcp25xxfd: only build DEBUG_FS code if enabledMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit d8a864d5eab58cfb0e4deb137359f80a828dc050) (cherry picked from commit 82094b7384832058d8c53ff8df8ac7a0ee9b3531)
2020-08-13can: mcp25xxfd: fix building without CONFIG_DEBUG_FSMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 5a142c75c22d38f7166e2e3ac8b08b3f834b61bc) (cherry picked from commit 78ee9b42516d73a6363a4482c6fdc319c81b0241)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_queue_frame: always increment the ↵Marc Kleine-Budde
submit_queue_count otherwise with switched off DEBUGFS support the driver will not work anymore. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 3d566db75ce8a954c0a4ad67b23d9069e7851175) (cherry picked from commit 4f0a5324eaa82c33e88165d99bc793b0a3d29b2b)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_tx_handle_int_tefif(): simplyfy function and ↵Marc Kleine-Budde
add comments Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit bd0713e14f8665ffaff2f17f6e0ac0b7fcaef902) (cherry picked from commit e4e4be66ec3cbcee3a5d68de507d679b6b2dda19)
2020-08-13can: mcp25xxfd: mcp25xxfd_cmd_sync_write(): use C99 initializersMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 252e80b4deb8cc90c723d64eac22b2ccdb699234) (cherry picked from commit 6dbc7444ef7a686cb064f845a326ddd03786382b)
2020-08-13can: mcp25xxfd: mcp25xxfd_cmd_sync_write(): make argument tx_len an "unsigned"Marc Kleine-Budde
... to match struct spi_transfer::len Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 39254b601f7f8b96772b2e5438f246b3222aa394) (cherry picked from commit 67553a4d94e207b489139009926d0357b1c50f27)
2020-08-13can: mcp25xxfd: mcp25xxfd_cmd_writen(): simplify functionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 6aea7d2725f280dba39fdaef0c44ad44e3e6ac28) (cherry picked from commit d62107d6f16e83454eb24297cdeac524ef623a32)
2020-08-13can: mcp25xxfd: mcp25xxfd_cmd_readn(): simplify functionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 50eb980ed7a5ce26e282bbbb1a9967e8eeb90103) (cherry picked from commit 3fcd5e431aaca6800bf3020b689bd4124b27bf83)
2020-08-13can: mcp25xxfd: mcp25xxfd_cmd_calc(): simplify functionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 9aad623041c9f51dbbfdabdb06105c2418250a58) (cherry picked from commit 1893ad574867391df738709558bdeb8139a74ec8)
2020-08-13can: mcp25xxfd: remove return of int in void functionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 8cbcb26c1b0b5b3651b1b8ad3b45108ade0a3520) (cherry picked from commit e0181dd273d69e2731b5324cbaacba163c70ff55)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_int: sort include alphabeticallyMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 94cb09bb6940af90e070b35795700eebd80de944) (cherry picked from commit 786ce0ae18ab7a90bbf244a46e4f679273ad3ecb)
2020-08-13can: mcp25xxfd: mcp25xxfd_priv: struct mcp25xxfd_priv: fix typoMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 07b342ed30c877fa5c80a12e2ebc00912991cafb) (cherry picked from commit e5139bd1a2c5ef0f0aee51ccf80def78c6dbdddd)
2020-08-13can: mcp25xxfd: mcp25xxfd_can_rx: mcp25xxfd_can_rx_predict_prefetch(): fix typoMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 0471451da27026b16091e2eeb5e23a642c730202) (cherry picked from commit d6e19af21417ca13d392364ec34c534b56150fc5)
2020-08-13can: mcp25xxfd: Makefile: fix indentionMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit e777dddeaa081a0384c20b079844e3216bfb5dc9) (cherry picked from commit 763b1a1ee532cb075ae627ed6d7e8801bf3395ea)
2020-08-13can: mcp25xxfd: Kconfig/Makefile: add SPDX identifiersMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit 045e9e8c3dfa53b0cc47ea7e514a0d5b10a79ec1) (cherry picked from commit be81ee3cc51729f2a683530ba91016e688473be8)
2020-08-13can: mcp25xxfd: fix checkpatch warningsMarc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit ed57b613fa490cc9c85ddfc8ff00c2ff951581d3) (cherry picked from commit edab6033d7d7e77a60d69d96b09ed2b7060c3c23)
2020-08-13can: mcp25xxfd: fix register definitions, cleanup names to match DSThomas Kopp
Fixing a couple MCP25xxFD reg/bit definitions, switching to the names used in the DS. Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> (cherry picked from commit bc37d9df4543a47703fa876d8a283d7db23ab2c9) (cherry picked from commit f512b45cf5684dff2c2ba0936215c52e5bfec809)
2020-08-13can: mcp25xxfd: optimize reception of big CanFD frame reception with BRSMartin Sperl
In case of predicted DLC=15 and in case at least 33% of those are sent via BRS be aggressive and use bulk fifo reads to avoid missing any frames due to releasing FIFOs not as fast as possible. This would be of most impact when having a 1MHz Can Bus with a 8MHz data bitrate. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> (cherry picked from commit c23b97d9301f0683d0064f446cc2116109b03b6b) (cherry picked from commit 35b27ceff48808ea3876a1840c62c81b0c7f52e9)
2020-08-13can: mcp25xxfd: add prediction of CanFD frames sizes based on historyMartin Sperl
Allow prediction of can frame sizes based on the last 32 Can Frames received. Naive histogram approach hast been taken for now. Some simple stats based on 1000 frames received with DLC=6: ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads_prefetched_too_few 16 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads_prefetched_too_few_bytes 96 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads_prefetched_too_many 0 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads_prefetched_too_many_bytes 0 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads_prefetch_predicted 6 The first 16 frames are predicted as 0, but after that the prediction is 6. It should be possible to take this prediction to use bulk reads for CanFD as well when we have a prediction of length of 48 or 64. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> (cherry picked from commit f355fdaa97c026ad70882a0cb11943cccefad81b) (cherry picked from commit 0c0a804cb53c699d61f13aa9904c3d9cc249dd3a)
2020-08-13can: mcp25xxfd: optimize SPI reads of FIFOs in can2.0 modeMartin Sperl
To reduce the amount of spi_messages send this patch optimizes the read of RX fifos so that multiple Fifos are read together. This only works well in CAN2.0 mode where the overhead of prefetching 8 bytes (even if the actual length is 0) is negligable compared to the SPI-framework overhead. Statistics in debugfs show for 1000000 DLC=0 can messages received: ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads <== 355411 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_1 <== 92778 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_2 <== 7133 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_3 <== 130390 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_4 <== 123807 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_5 <== 1266 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_6 <== 34 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_7 <== 1 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_bulk_reads_8+ <== 0 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/rx_reads <== 999999 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/int_system_error <== 1 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/int_system_error_rx <== 1 ==> /sys/kernel/debug/mcp25xxfd-spi0.0/can/stats/int_system_error_tx <== 0 There was one SERR error where we lost one can frame during the handling of the error condition. So to read all of those 999999 RX fifos we formerly have scheduled 999999 spi_messages. With this patch we have only scheduled 355411 spi_messages, so only 35.5% of the former value. This also means we have not been transferring 1289176 (=2*(999999-355411)) unnecessary command bytes over the SPI bus. As we have been issuing less SPI transfers reading SRAM this also has reduced the likleyhood of SERR happening - it does not solve the complete issue as seen above. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> (cherry picked from commit 0f869f3a7c36805b1b64c54ebf654a94e81735c1) (cherry picked from commit 2908eda0a54b696379a4aec213e3a2883eebe51e)