mdrmdr Posted March 11, 2022 Share Posted March 11, 2022 Armbianmonitor: http://ix.io/3RW0 I'm using a NanoPi Neo as Homegear gateway. This requires the SPI interface (/dev/spidev0.0). Yesterday I ran apt-get upgrade, which bumped my kernel from 5.10.60 to 5.15.25. No other changes have been done, Since then no SPI devices are created anymore and the gateway fails! I tried to downgrade the kernel already using armbian-config to 21.08 5.10.60-sunxi. But that reported an error (do not remember the text; was very late) and left the Nano unbootable. I could restore the 5.15.25 kernel by manually editing the zImage symbolic link in /boot. Using param_spidev_spi_bus=1 instead of 0 does not help. What can I do now to re-enable SPI? Downgrade the kernel manually? But 5.10.60 is not offered in the repos... 0 Quote Link to comment Share on other sites More sharing options...
arclight Posted March 11, 2022 Share Posted March 11, 2022 i have encountered the same problem as yours. i have downloaded the latest armbian from release page(my board is OrangePi Zero),flash it into sd card,and wrote this overlay: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target-path = "/aliases"; __overlay__ { spi0 = "/soc/spi@1c68000"; }; }; fragment@1 { target = <&spi0>; __overlay__ { #address-cells = <0>; #size-cells = <0>; status = "okay"; spidev { compatible = "spidev"; status = "okay"; reg = <0>; spi-max-frequency = <1000000>; }; }; }; }; after applying it using `sudo armbian-add-overlay spi0.dts`,it *seems* to be loaded correctly(i use a usb-serial wire to observe console log from on-board debugging serial,it shows "Applying user provided DT overlay spi1.dtbo" and no errors occurred),but when i logged in system,there were no /dev/spidev* show up. also, i have noticed there are some spi error in kernel log: [ 1.928114] sun6i-spi 1c68000.spi: chipselect 0 already in use [ 1.928149] spi_master spi0: spi_device register error /soc/spi@1c68000/flash@0 [ 1.928200] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/flash@0 when i change the spi0 to spi1 , the whole spi thing will not work,even if i have checked the `/proc/device-tree/soc/spi@1c690000/spidev/status` file is "okay"(and dmesg shows nothing related to spi). doesn't know what kinda thing happened. sorry for my pool English,i'm not a native English speaker. i wish these infomations will help the developer. 1 Quote Link to comment Share on other sites More sharing options...
Igor Posted March 11, 2022 Share Posted March 11, 2022 10 hours ago, mdrmdr said: Downgrade the kernel manually? Yes, until we don't find time to fix switching and then when life permits check why SPI doesn't work. Sadly we are not in a position (far away) to check if all functions doesn't break on upgrade ... 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted March 11, 2022 Author Share Posted March 11, 2022 vor 1 Stunde schrieb Igor: ...Sadly we are not in a position... No problem at all. I'm glad and thankful that you guys spend your time delivering all that good stuff :-) Can you give me a hint how to install an arbitrary kernel version which is not directly offered in the repos? I only can select between Legacy (5.4.88), Current (5.15.25) and Edge (5.16.13). Since I know that 5.10.60 works, I'd like to install this one. And I always need image and headers, right? 0 Quote Link to comment Share on other sites More sharing options...
Igor Posted March 11, 2022 Share Posted March 11, 2022 28 minutes ago, mdrmdr said: Can you give me a hint how to install an arbitrary kernel version which is not directly offered in the repos? workaround: download file from https://imola.armbian.com/beta/pool/main/l/ install with sudo dpkg -i FILE.deb 28 minutes ago, mdrmdr said: And I always need image and headers, right? and DTB package. Headers are optional - if you need to build modules. 1 Quote Link to comment Share on other sites More sharing options...
TCB13 Posted March 12, 2022 Share Posted March 12, 2022 Seems like I'm having the same issue with a NanoPi M4v2 but unfortunately in my case it breaks the system even more. 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted March 12, 2022 Author Share Posted March 12, 2022 vor 10 Stunden schrieb Igor: workaround: download file from https://imola.armbian.com/beta/pool/main/l/ Installed 5.10.98 and everything works again as expected. Now I have to make sure not to accidentally upgrade again until proven that a new kernel version does not break SPI. Did that for the time being with: apt-mark hold linux-dtb-current-sunxi linux-image-current-sunxi. Thanks Igor for all the informations. 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted March 13, 2022 Author Share Posted March 13, 2022 How would one find out or get informed if Armbian has (probably) fixed the above SPI issue? Try & error with new versions is not very effective ;-) 0 Quote Link to comment Share on other sites More sharing options...
Werner Posted March 13, 2022 Share Posted March 13, 2022 I suggest watching here to stay up to date what has changed: https://github.com/armbian/build/commits/master 2 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted March 13, 2022 Author Share Posted March 13, 2022 Great! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Reto2 Posted March 15, 2022 Share Posted March 15, 2022 Hello, Also having the same issue. I am using Orange Pi PC. Last working version: Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster Kernel: 5.10.60-sunxi #21.08.2 Breaks on: Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster Kernel: 5.15.25-sunxi #22.02.1 0 Quote Link to comment Share on other sites More sharing options...
Erol Posted March 25, 2022 Share Posted March 25, 2022 It breaks SPI also on Pine64 board. Reverting back to 5.10.60-sunxi64 solves the issue. Also edge versions are broken too. 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted April 1, 2022 Author Share Posted April 1, 2022 Am 13.3.2022 um 16:54 schrieb Werner: I suggest watching here to stay up to date what has changed: https://github.com/armbian/build/commits/master I watched now for a while the Armbian commits. But to tell the truth, i can't see from the commit title and the source details, if the SPI bug has been fixed. Any further help is much appreciated 0 Quote Link to comment Share on other sites More sharing options...
Werner Posted April 1, 2022 Share Posted April 1, 2022 7 minutes ago, mdrmdr said: I watched now for a while the Armbian commits. But to tell the truth, i can't see from the commit title and the source details, if the SPI bug has been fixed. Any further help is much appreciated Because it probably hasn't due to lack of (human) resources.https://docs.armbian.com/User-Guide_FAQ/#development-time 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted April 1, 2022 Author Share Posted April 1, 2022 No problem. Of course I don't want to rush and I am very happy about your great work. How would I spot the fix? Will "SPI" be in the commit title? 0 Quote Link to comment Share on other sites More sharing options...
Falcounet Posted April 1, 2022 Share Posted April 1, 2022 On 3/11/2022 at 8:05 PM, Igor said: Yes, until we don't find time to fix switching and then when life permits check why SPI doesn't work. Sadly we are not in a position (far away) to check if all functions doesn't break on upgrade ... Do you have any hint on what to look at to try to fix that issue ? I might invest some time on it (and hopefully also get some more knowledge about these things) 2 Quote Link to comment Share on other sites More sharing options...
Solution Falcounet Posted April 2, 2022 Solution Share Posted April 2, 2022 Doing what is explained in this post make it to work but spidev isn't anymore controlled through /boot/armbianEnv.conf file but the DT. I used the "quick and dirty" fix for now by using "rohm,dh2228fv" which is already in the spidev_dt_ids[] list and avoid me creating a new build with a patch to modify drivers/spi/spidev.c So basically, I used armian-config to edit the Device Tree (System => Dtc), Browse the DT over soc => spi@1c68000 And I added these lines : spi@1c68000 { ... spidev@0x00 { compatible = "rohm,dh2228fv"; spi-max-frequency = <100000000>; reg = <0x00>; }; } And the same for the second SPI controller : spi@1c69000 { ... spidev@0x00 { compatible = "rohm,dh2228fv"; spi-max-frequency = <100000000>; reg = <0x00>; }; } I also had to remove the spidev stuff from /boot/armbianEnv.conf (No spi-spidev overlay) This way, I get two SPI devices and the SBC is working again with 5.15 kernel : # ls /dev/ | grep spi spidev0.0 spidev1.0 4 Quote Link to comment Share on other sites More sharing options...
Falcounet Posted April 3, 2022 Share Posted April 3, 2022 I actually found a better fix for this by only modifying the spidev overlay (/boot/dts/allwinner/overlays/sun50i-h5-spi-spidev.dtbo in my case). compatible = "spidev"; seems to not work anymore while compatible = "rohm,dh2228fv"; works. I have a board with an Allwinner H5 SoC so I dig a bit more and found there is spi-sun4i.c and spi-sun6i.c drivers. I found out that none of these drivers seems to be used (There are no spi-sun*i.ko in /lib/modules/5.15.32-sunxi64/kernel/drivers/spi ) while CONFIG_SPI_SUN4I and CONFIG_SPI_SUN6I are set to y, is this normal ? I also found out of_device_id are defined there (See here and here ). Should we add these IDs in the spidev_dt_ids[] list of spidev.c ? 0 Quote Link to comment Share on other sites More sharing options...
nagaudio Posted April 13, 2022 Share Posted April 13, 2022 03.04.2022 в 01:56, Falcounet сказал: So basically, I used armian-config to edit the Device Tree (System => Dtc), Browse the DT over soc => spi@1c68000 And I added these lines : spi@1c68000 { ... spidev@0x00 { compatible = "rohm,dh2228fv"; spi-max-frequency = <100000000>; reg = <0x00>; }; } And the same for the second SPI controller : spi@1c69000 { ... spidev@0x00 { compatible = "rohm,dh2228fv"; spi-max-frequency = <100000000>; reg = <0x00>; }; } I also had to remove the spidev stuff from /boot/armbianEnv.conf (No spi-spidev overlay) This way, I get two SPI devices and the SBC is working again with 5.15 kernel : # ls /dev/ | grep spi spidev0.0 spidev1.0 this one really works! thank you! 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted April 14, 2022 Author Share Posted April 14, 2022 So this means: - Upgrade to 5.15 - Reboot - Do above change with armbian-config to section "DT over soc => spi@1c68000" - Remove "spi-spidev" from "overlays=" from "/boot/armbianEnv.txt" - Reboot - Should work Right? And this procedure needs to applied whenever the kernel gets updated? 0 Quote Link to comment Share on other sites More sharing options...
Falcounet Posted April 14, 2022 Share Posted April 14, 2022 5 hours ago, mdrmdr said: So this means: - Upgrade to 5.15 - Reboot - Do above change with armbian-config to section "DT over soc => spi@1c68000" - Remove "spi-spidev" from "overlays=" from "/boot/armbianEnv.txt" - Reboot - Should work Right? And this procedure needs to applied whenever the kernel gets updated? I think it's just a workaround for now. Something seems to be broken with kernel 5.15 but I couldn't understand what. It is still better to only modify the spidev overlay, I think. This way you could still control spidev using /boot/armbianEnv.txt 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted April 14, 2022 Author Share Posted April 14, 2022 I decided to stick with my current kernel 5.10.98 until I'm confident that the SPI issue in 5.15+ is fixed... Thanks a lot for your investigations into the above solution. 0 Quote Link to comment Share on other sites More sharing options...
lport3 Posted April 23, 2022 Share Posted April 23, 2022 Make new build.Dont update/upgrade. Go- '/etc/apt/sources.list.d/armbian.list' and comment out the lines. Now you can update/upgrade without the danger of losing spidev. 0 Quote Link to comment Share on other sites More sharing options...
going Posted April 26, 2022 Share Posted April 26, 2022 11.03.2022 в 17:36, arclight сказал: spidev { compatible = "spidev" This no longer works in version v5.15 and above. All we can do for the user is to expand the warning to a more detailed one if the kernel receives such an outdated way of overlaying the device tree from the user. @IgorIgor, should we delete the files of outdated overlays for the device tree from the corresponding patches? 11.03.2022 в 17:36, arclight сказал: i have noticed there are some spi error in kernel log: [ 1.928114] sun6i-spi 1c68000.spi: chipselect 0 already in use If this SPI channel is already in use, why are you trying to use it in another way? 0 Quote Link to comment Share on other sites More sharing options...
Igor Posted April 26, 2022 Share Posted April 26, 2022 51 minutes ago, going said: This no longer works in version v5.15 and above. I have noticed ... 52 minutes ago, going said: should we delete the files of outdated overlays for the device tree from the corresponding patches? I assume there is nothing wrong with overlay? Why would we remove it? Recording a bug into Jira is all what we can do. Unless someone has so much time to dig in and understand why it broke down. 0 Quote Link to comment Share on other sites More sharing options...
going Posted April 26, 2022 Share Posted April 26, 2022 2 минуты назад, Igor сказал: I assume there is nothing wrong with overlay? Why would we remove it? Recording a bug into Jira is all what we can do. Unless someone has so much time to dig in and understand why it broke down. https://lore.kernel.org/all/20210921192149.50740-1-broonie@kernel.org/ In other words, the core has become smarter. If it is correctly spelled out in the device tree, then the kernel does the mapping and the mapped driver is used. For example in orangepi-pc2 &spi0 { status = "okay"; spi-flash@0 { #address-cells = <1>; #size-cells = <0>; compatible = "jedec,spi-nor"; reg = <0>; /* Chip select 0 */ spi-max-frequency = <10000000>; status = "okay"; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "uboot"; reg = <0x0 0x100000>; }; partition@100000 { label = "env"; reg = <0x100000 0x100000>; }; }; }; }; compatible = "jedec,spi-nor"; The kernel uses a mapped driver (spi-nor) and creates the corresponding device, not /dev/spidevX.X 0 Quote Link to comment Share on other sites More sharing options...
going Posted April 29, 2022 Share Posted April 29, 2022 14.04.2022 в 15:55, Falcounet сказал: I think it's just a workaround for now. A little wrong. This is the official way to load this kernel module. You can write complete nonsense, as I did for the test. diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 852dcbb2d..2c53e2b5a 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -682,6 +682,7 @@ static const struct spi_device_id spidev_spi_ids[] = { { .name = "m53cpld" }, { .name = "spi-petra" }, { .name = "spi-authenta" }, + { .name = "elephant" }, {}, }; MODULE_DEVICE_TABLE(spi, spidev_spi_ids); @@ -696,6 +697,7 @@ static const struct of_device_id spidev_dt_ids[] = { { .compatible = "menlo,m53cpld" }, { .compatible = "cisco,spi-petra" }, { .compatible = "micron,spi-authenta" }, + { .compatible = "hello,elephant" }, {}, }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); And call this module to load and initialize by replacing the compatible = "spidev"; string with compatible = "hello,elephant"; in the dts file. 14.04.2022 в 15:55, Falcounet сказал: Something seems to be broken with kernel 5.15 but I couldn't understand what. I have discovered this and will fix it in the 5.17 kernel soon. And I need someone to test the fixes on real hardware. Anyone interested? 0 Quote Link to comment Share on other sites More sharing options...
mdrmdr Posted April 30, 2022 Author Share Posted April 30, 2022 I would test it on my NanoPi Neo. But I'd need instructions how to keep 5.10.98, thus installing 5.17 additionally and being able to switch back to 5.10.98 best case just by editing files or links in "/boot". 0 Quote Link to comment Share on other sites More sharing options...
Erol Posted April 30, 2022 Share Posted April 30, 2022 I can test on Pine64. 0 Quote Link to comment Share on other sites More sharing options...
going Posted April 30, 2022 Share Posted April 30, 2022 11.03.2022 в 11:53, mdrmdr сказал: Armbianmonitor: http://ix.io/3RW0 I'm using a NanoPi Neo as Homegear gateway. This requires the SPI interface (/dev/spidev0.0). Please publish information about your current working operating system: cat /boot/armbianEnv.txt lsb_release -rc find /sys/ -name '*spi*' df -h Are the overlay files that you use files that are part of the dtb system package? And simple curiosity. Which device do you connect via SPI? 9 часов назад, mdrmdr сказал: But I'd need instructions I will make all the packages and provide a download link. There will be instructions. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.