Error enabling SPI overlay

Hi, I am having trouble enabling SPI on renegrade for quite a while now. I followed this guide and have errors in dmesg and nothing shows up under /dev/. I also posted the errors in that guide but didn’t get any help so I’m creating a new thread there.

Output of sudo ldto list:

i2c0 
pps-gpio-j1-28 
pwm2 
saradc 
spi0-cs1-ili9486-xpt2046 
spi0-cs1-mhs3528 
spi0-cs1-mpi3501 
spi0-cs1-spidev 
spi0-cs1 
spi0 
uart1 
uart2 

Output of sudo ldto enable spi0-cs1 spi0-cs1-spidev:

Overlay spi0-cs1: applied
Overlay spi0-cs1-spidev: applied

Output of dmesg:

[  514.686423] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /aliases/spi0
[  514.686480] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /spi@ff190000/status
[  514.686508] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /spi@ff190000/num-cs
[  514.686533] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /spi@ff190000/pinctrl-names
[  514.686559] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /spi@ff190000/pinctrl-1
[  514.686584] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /spi@ff190000/cs-gpios
[  514.708512] rockchip-spi ff190000.spi: chipselect 0 already in use
[  514.708549] spi_master spi0: spi_device register error /spi@ff190000/spidev@0
[  514.708581] of_spi_notify: failed to create for '/spi@ff190000/spidev@0'
[  514.708602] OF: changeset notifier error @/spi@ff190000/spidev@0
[  514.708637] rockchip-spi ff190000.spi: cs1 >= max 1
[  514.708653] spi_master spi0: spi_device register error /spi@ff190000/spidev@1
[  514.708676] of_spi_notify: failed to create for '/spi@ff190000/spidev@1'
[  514.708697] OF: changeset notifier error @/spi@ff190000/spidev@1
[  514.708719] OF: overlay: overlay apply changeset entry notify error -22
[  514.708734] create_overlay: Failed to create overlay (err=-22)

I would really appreciate any help.

Thank you.

There was a bug in the bootloader when the images were generated. You can flash the latest bootloader using the libretech-flash-tool onto the image and it should fix the issues.

Hi. Thanks for the reply. I did the following:

  1. Removed the SD card from renegrade and inserted into my laptop.
  2. Downloaded the libretech-fash-tool and installed the bootloader for roc-rk3328-cc following the guide. This is the output and the update seem to be successful.
BOOTLOADER_get: downloading roc-rk3328-cc bootloader to /tmp/tmp.BvaT8addBd.

--2024-04-21 13:53:03--  https://boot.libre.computer/ci//roc-rk3328-cc
Resolving boot.libre.computer (boot.libre.computer)... 192.53.162.101, 2600:3c00::f03c:93ff:fea1:358c
Connecting to boot.libre.computer (boot.libre.computer)|192.53.162.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 847360 (828K) [application/octet-stream]
Saving to: ‘/tmp/tmp.BvaT8addBd’

/tmp/tmp.BvaT8addBd                100%[================================================================>] 827.50K  3.39MB/s    in 0.2s    

2024-04-21 13:53:04 (3.39 MB/s) - ‘/tmp/tmp.BvaT8addBd’ saved [847360/847360]

BOOTLOADER_get: downloaded roc-rk3328-cc bootloader to /tmp/tmp.BvaT8addBd.
BOOTLOADER_flash: !!!WARNING!!! DEVICE mmcblk0 is mounted.
BOOTLOADER_flash: dd if=/tmp/tmp.BvaT8addBd of=/dev/mmcblk0 bs=512 seek=64 status=progress
BOOTLOADER_flash: run the above command to flash the target device?
(y/n)
dd if=/tmp/tmp.BvaT8addBd of=/dev/mmcblk0 bs=512 seek=64 status=progress
1655+0 records in
1655+0 records out
847360 bytes (847 kB, 828 KiB) copied, 0.487827 s, 1.7 MB/s
BOOTLOADER_flash: bootloader written to mmcblk0 successfully.

Then I put the SD card back on the renegrade. Booted and logged in. When I enabled the SPI, the outcome is the same. The same errors appear on the dmesg. Also, please note that there is no spi0-spidev in the ltdo list output. I’m not sure if this is ok or if there is a problem with my board.

I don’t know what I am doing wrong here. Should I also flash a fresh image with libretech-flash-tool after flashing the bootloader?

@saki92
We have just updated the bootloader to fix the SPI already enabled bug. Please update the bootloader on the image by using libretech-flash-tool.

sudo ./lft.sh bl-flash roc-rk3328-cc mmcblk1 force # mmcblk1 assumes sd card
sudo reboot
sudo ldto enable spi-0-2cs spi-0-2cs-mpi3501