Enabling SPI on the RB5

Would there be an RB5 version of instructions for enabling the SPI driver similar to this one: Enabling SPI on Dragonboard 410c with SPIDEV - 96Boards? The repository the instructions point to (https://github.com/96boards/dt-update) has directories for the 410 and 820, but nothing for the RB5.

I managed to get somewhere by adding the following to qrb5165-rb5.dts:

&spi17 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&qup_spi17_data_clk>, <&qup_spi17_cs_gpio>;
	cs-gpios = <&tlmm 55 GPIO_ACTIVE_LOW>;

	array@0 {
		compatible = "spidev";
		spi-max-frequency = <50000000>;
		reg = <0>;
	};
};

This is exactly the same way that the spi0 block is formatted for CAN, however, when I run dmesg | grep spi, I see: geni_spi 88c000.spi: Fifo and dma mode disabled!! can't xfer. Why would it be saying this?

I have spent many hours over the past few weeks attempting to get SPI to work on the RB5. Reaching out to Thundercomm and the authors of qrb5165-rb5.dts (qrb5165-rb5.dts « qcom « dts « boot « arm64 « arch - working/qualcomm/kernel.git - Qualcomm Landing Team kernel) has yielded little progress.

I want to take a moment to say that Thundercomm’s support is terrible. They couldn’t even provide me useful information on the Ubuntu build they provide via their SDK manager. If your project has SPI communication as a requirement, I strongly advise against using the RB5.

Which branch are you building? look like upstream is a bit different and fallback to FiFo when DMA is not enabled for SPI. So maybe replace your driver with the upstream driver instead: https://github.com/torvalds/linux/blob/master/drivers/spi/spi-geni-qcom.c

Thanks for the reply. Your suggestion helped a little, but I believe there’s still issues. I see the following now:

[    0.309377] geni_spi 88c000.spi: FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode
[    6.601448] Error: Driver 'geni_spi' is already registered, aborting...
[    6.672083] Error: Driver 'geni_spi' is already registered, aborting...
[  230.465601] /soc@0/geniqup@8c0000/spi@88c000/array@0: buggy DT: spidev listed directly in DT
[  230.474496] WARNING: CPU: 0 PID: 859 at drivers/spi/spidev.c:754 spidev_probe+0x1e8/0x250 [spidev]
[  230.483734] Modules linked in: rfcomm af_alg bnep snd_soc_hdmi_codec venus_dec venus_enc apr videobuf2_dma_contig videobuf2_memops fastrpc qrtr_smd rpmsg_char qcom_spmi_adc5 qcom_pmic_typec hci_uart qcom_pon mcp251xfd qcom_spmi_adc_tm5 btqca qcom_spmi_temp_alarm qcom_vadc_common can_dev btbcm venus_core lontium_lt9611uxc bluetooth v4l2_mem2mem videobuf2_v4l2 ecdh_generic videobuf2_common ecc videodev crct10dif_ce snd_soc_sm8250 snd_soc_qcom_common mc msm gpu_sched ath11k_pci drm_kms_helper slim_qcom_ngd_ctrl mhi qcom_rng pdr_interface ath11k mac80211 qrtr libarc4 ns soundwire_qcom qcom_q6v5_pas qcom_pil_info soundwire_bus qcom_q6v5 snd_soc_lpass_wsa_macro slimbus cfg80211 snd_soc_lpass_va_macro qcom_sysmon qcom_common qcom_glink_smem qmi_helpers socinfo mdt_loader icc_osm_l3 qcom_wdt qnoc_sm8250 display_connector drm fuse ip_tables x_tables spidev qcom_usb_vbus_regulator rtc_pm8xxx i2c_qcom_geni pinctrl_lpass_lpi
[  230.587840] pc : spidev_probe+0x1e8/0x250 [spidev]
[  230.592771] lr : spidev_probe+0x1e8/0x250 [spidev]
[  230.676928]  spidev_probe+0x1e8/0x250 [spidev]
[  230.681495]  spi_probe+0x84/0xe8
[  532.332553] spidev spi17.0: SPI transfer timed out
[  533.356550] spi_master spi17: failed to transfer one message from queue

It seems that FIFO mode is also disabled. I can’t get DMA mode to work either even though I enabled the DMA controllers. Emails between myself and the kernel developers suggest that Thundercomm needs to update their firmware, but I don’t know this for sure.

I probed the pins on LS1, and it appears the CS is at least being toggled, but I don’t know this for sure since I still need to find the pinout for this board. I do not see any data/clock lines being toggled.

Documentation on this seems to be all over the place. Is there additional configuration of the QUP device that needs to be done? There’s Qualcomm specific documentation discussing that, but it does not seem to translate to the Linaro builds (i.e., references to /trustzone and firmware updates are made).

After many more attempts, still no luck. I will reaffirm my original statement about Thundercomm - they are still terrible to deal with.

None of the Linaro developers have proven to me that they are able to get SPI to work on version 21.12, so I will simply assume that SPI is broken for this release.

I’m not sure what audience the RB5 is supposed to be marketed for, but if you decide to buy it, beware.