Jump to content

5.15.25 breaks SPI on NanoPi Neo and does not create /dev/spidev0.0


Go to solution Solved by Falcounet,

Recommended Posts

Posted
vor 14 Stunden schrieb going:

Please publish information about your current working operating system:

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?

 

OS infos are attached.

 

All OS files are part of the Armbian official provided packages. So I did not change any individual files.

Currently installed (and on hold) is:

 

Nano$ dpkg --get-selections | grep sunxi
linux-dtb-current-sunxi             hold
linux-image-current-sunxi           hold

 

Connected is a CC1101 868MHz wireless module. See attached picture with the special NanoPi GPIO header. This acts as a gateway for a differential temperature sensor.

nano_cc1101.jpg

nano_info.txt

Posted

Must those 3 links point to the new installed files/directories?

And can I always return to 5.10 by changing the links back as shown below?

 

dtb -> dtb-5.10.98-sunxi
uInitrd -> uInitrd-5.10.98-sunxi
zImage -> vmlinuz-5.10.98-sunxi

 

Posted
19 hours ago, going said:

Also please provide information about your OS.

 

I can try  on my Orange Pi One. System info below.

 

orangepione:~:% cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=3ac82cc2-4039-4e2f-9d3c-1da77eb887ff
rootfstype=ext4
overlays=spi-add-cs1 spi-jedec-nor spi-spidev
param_spidev_spi_bus=1
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

orangepione:~:%  lsb_release -rc
Release:        11
Codename:       bullseye

orangepione:~:% find /sys/ -name '*spi*'
find: ‘/sys/kernel/tracing’: Permission denied
find: ‘/sys/kernel/debug’: Permission denied
/sys/devices/platform/soc/1c69000.spi
/sys/devices/platform/soc/1c69000.spi/spi_master
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_sync
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_async
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_sync
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_async
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c20800.pinctrl/consumer:platform:1c69000.spi
/sys/devices/virtual/devlink/platform:1c20800.pinctrl--platform:1c69000.spi
/sys/class/spidev
/sys/class/devlink/platform:1c20800.pinctrl--platform:1c69000.spi
/sys/class/spi_master
/sys/class/spi_master/spi1
/sys/firmware/devicetree/base/__symbols__/spi0_cs1
/sys/firmware/devicetree/base/__symbols__/spi0
/sys/firmware/devicetree/base/__symbols__/spi1_cs1
/sys/firmware/devicetree/base/__symbols__/spi1_pins
/sys/firmware/devicetree/base/__symbols__/spi0_pins
/sys/firmware/devicetree/base/__symbols__/spi1
/sys/firmware/devicetree/base/soc/spi@1c69000
/sys/firmware/devicetree/base/soc/spi@1c69000/spiflash@0
/sys/firmware/devicetree/base/soc/spi@1c69000/spiflash@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/spi@1c69000/spidev@0
/sys/firmware/devicetree/base/soc/spi@1c69000/spidev@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi0_cs1
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi1_cs1
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi1-pins
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi0-pins
/sys/firmware/devicetree/base/soc/spi@1c68000
/sys/firmware/devicetree/base/soc/spi@1c68000/spiflash@0
/sys/firmware/devicetree/base/soc/spi@1c68000/spiflash@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/spi@1c68000/spidev@0
/sys/firmware/devicetree/base/soc/spi@1c68000/spidev@0/spi-max-frequency
/sys/firmware/devicetree/base/aliases/spi0
/sys/firmware/devicetree/base/aliases/spi1
find: ‘/sys/fs/pstore’: Permission denied
find: ‘/sys/fs/bpf’: Permission denied
/sys/bus/platform/devices/1c69000.spi
/sys/bus/platform/drivers/sun6i-spi
/sys/bus/platform/drivers/sun6i-spi/1c69000.spi
/sys/bus/platform/drivers/sun4i-spi
/sys/bus/spi
/sys/bus/spi/devices/spi1.0
/sys/bus/spi/drivers/spi-nor
/sys/bus/spi/drivers/spidev
/sys/module/spidev
/sys/module/spidev/drivers/spi:spidev

orangepione:~:% df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            431M     0  431M   0% /dev
tmpfs           100M  4.4M   96M   5% /run
/dev/mmcblk0p1   15G  2.9G   12G  21% /
tmpfs           500M     0  500M   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           500M     0  500M   0% /tmp
/dev/zram1       49M  7.7M   38M  18% /var/log
tmpfs           100M     0  100M   0% /run/user/1000

 

Posted

Seems to work 😀

 

/dev/spidev0.0 is created. The SPI device CC1101 and therefore the Homegear gateway initializes fine.

What else information do you need? dmesg output? Logfiles?

 

Small change in your instructions: cd deb must be cd deb/nanopineo

Posted
2 часа назад, mdrmdr сказал:

What else information do you need?

Just test the operation of the equipment for a few days. And tell me if everything is okay.

 

3 часа назад, mdrmdr сказал:

cd deb must be cd deb/nanopineo

Fixed it

Posted
vor 3 Stunden schrieb going:

Just test the operation of the equipment for a few days. And tell me if everything is okay.

Ok, will do. So far everything fine

Posted
On 4/29/2022 at 7:37 PM, going said:

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.

Yes, `compatible = "spidev"` is normally not allowed but armbian is applying a patch to allow it again but that doesn't work anymore.

 

On 4/29/2022 at 7:37 PM, going said:

I have discovered this and will fix it in the 5.17 kernel soon.

What did you discovered exactly ?

 

On 4/29/2022 at 7:37 PM, going said:

And I need someone to test the fixes on real hardware.
Anyone interested?

Sure.

 

EDIT : I didn't figured out there was a 2nd page before replying.
Looks like you got it. Nice done !

Posted

Still works fine. Also with some reboots.

 

What needs to be done to return to the standard kernel upgrade path to upgrade from current installed 5.10.98 (linux-image-current-sunxi) to 5.17.*?

Uninstall the .deb and then just run apt-get update?

 

 

Posted
13 часов назад, mdrmdr сказал:

What needs to be done to return to the standard kernel upgrade

@mdrmdr You need to wait for this change to be accepted.

 

See what this command tells you right now.

apt list --upgradable | grep '^linux'

 

Posted
23 часа назад, Falcounet сказал:

Yes, `compatible = "spidev"` is normally not allowed but armbian is applying a patch to allow it again but that doesn't work anymore.

In the latest versions of the kernel, the recommended mechanism for loading and initializing kernel modules is to call its alias,

which are contained in the **_device_id structure. At the same time, there remains a mechanism that is contained in

the of_device_id structure for compatibility with old software that should work.
Thus, we do not need to change or fix anything in the kernel. We'll just use the recommendation, add our alias and call this module

by matching it with this alias. It will be right from the point of view of support in the long run.

 

@Falcounet If you can test the 5.15 kernel, I will build packages for sunxi64 and also upload them for download.

Please publish your OS and the name of the equipment that is connected via the SPI.

Posted
vor 2 Stunden schrieb going:

See what this command tells you right now.

apt list --upgradable | grep '^linux'

 

 

Command returns:

 

linux-dtb-current-sunxi/buster 22.02.1 armhf [upgradable from: 22.02.0-trunk.0029]
linux-image-current-sunxi/buster 22.02.1 armhf [upgradable from: 22.02.0-trunk.0029]
linux-image-edge-sunxi/buster 22.05.0-trunk.0038 armhf [upgradable from: 22.05.0-trunk]

 

So I would upgrade package linux-image-edge-sunxi and install linux-dtb-edge-sunxi.
And optionally remove linux-dtb-current-sunxi and linux-image-current-sunxi (which is 5.10.98; both on hold currently).

Correct?

Posted

@mdrmdr You will need to remove the linux-dtb-current-sunxi package and update the linux-image-current-sunxi package.

This should be done after these changes are included in the update package.

 

You don't need to touch what is working now.

Posted

@mdrmdr The dtb files are already contained in the kernel package and installed in this location: /usr/lib/linux-image-$version

This script, which currently exists on your system, copies them to the /boot folder.

You don't need the dtb package, but you will have to fix the links in the /boot folder every time after updating the kernel.
If you delete this script, then you will need a dtb package, that is, the system will return to the state it was before this experiment.

 

Posted

@going Ok, I still do not have a complete picture how to properly return to the standard way of kernel updates (which requires the dtb package) once the fix is included in the update packages.

 

I assume this:

  • Uninstall linux-image-edge-sunxi (which is the test kernel fixing the SPI bug)
    • Does this remove also the zz-sync-dtb script?
    • Does this remove also the /usr/lib/linux-image-5.17.5-sunxi directory with the test dtb files which are synced to /boot/dtb-5.17.5-sunxi with the above script?
    • Does this remove also the /boot/dtb-5.17.5-sunxi? directory with also dtb files?
  • Check if the links in /boot correctly point to still installed linux-(image|dtb)-current-sunxi (5.10.98) files
  • Un-hold the linux-(image|dtb)-current-sunxi packages
  • Reboot
  • Now:
    • How do I find out when the SPI fix is included into the "current" or the "edge" packages?
    • Is the fix automatically included once the "current" version reaches at least 5.17.5?
    • Or should/must I change to the "edge" packages

Available packages are:

Nano$ apt-cache search linux-image-.*-sunxi
linux-image-current-sunxi - Linux kernel, armbian version 5.15.25-sunxi current
linux-image-edge-sunxi - Linux kernel, armbian version 5.17.5-sunxi edge
linux-image-legacy-sunxi - Linux kernel, version 5.4.88-sunxi

 

I'm pretty new to this kernel things and still learning... 😉

Posted
11 часов назад, mdrmdr сказал:
  • Does this remove also the zz-sync-dtb script?
  • Does this remove also the /usr/lib/linux-image-5.17.5-sunxi directory with the test dtb files which are synced to /boot/dtb-5.17.5-sunxi with the above script?
  • Does this remove also the /boot/dtb-5.17.5-sunxi? directory with also dtb files?

Good questions. Don't worry.

We will return your system to its original state after the changes are accepted and updates are released.

11 часов назад, mdrmdr сказал:

How do I find out when the SPI fix is included into the "current" or the "edge" packages?

I'll report here.

Posted

@Igor I checked for kernel 5.15. Interfaces are being created. If we accept these changes today, will they have time to enter the release?

 

leo@orangepipc2:~$ uname -r
5.15.35-sunxi64

leo@orangepipc2:~$ find /sys/ -name '*spi*'       
find: ‘/sys/kernel/debug’: Permission denied
/sys/class/devlink/platform:1c20800.pinctrl--platform:1c68000.spi
/sys/class/devlink/platform:1c20800.pinctrl--platform:1c69000.spi
/sys/class/devlink/regulator:regulator.0--spi:spi2.0
/sys/class/spidev
/sys/class/spidev/spidev1.0
/sys/class/spi_slave
/sys/class/spi_master
/sys/class/spi_master/spi2
/sys/class/spi_master/spi1
/sys/devices/platform/reg-dummy/regulator/regulator.0/consumer:spi:spi2.0
/sys/devices/platform/reg-dummy/regulator/regulator.0/spi2.0-vdd
/sys/devices/platform/soc/1c68000.spi
/sys/devices/platform/soc/1c68000.spi/spi_master
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/statistics/spi_async
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/statistics/spi_sync
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/spi2.0
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/spi2.0/statistics/spi_async
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/spi2.0/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/spi2.0/statistics/spi_sync
/sys/devices/platform/soc/1c68000.spi/spi_master/spi2/spi2.0/spi-nor
/sys/devices/platform/soc/1c69000.spi
/sys/devices/platform/soc/1c69000.spi/spi_master
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_async
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/statistics/spi_sync
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_async
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_sync_immediate
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/statistics/spi_sync
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/spidev
/sys/devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.0/spidev/spidev1.0
/sys/devices/platform/soc/1c20800.pinctrl/consumer:platform:1c68000.spi
/sys/devices/platform/soc/1c20800.pinctrl/consumer:platform:1c69000.spi
/sys/devices/virtual/devlink/platform:1c20800.pinctrl--platform:1c68000.spi
/sys/devices/virtual/devlink/platform:1c20800.pinctrl--platform:1c69000.spi
/sys/devices/virtual/devlink/regulator:regulator.0--spi:spi2.0
find: ‘/sys/fs/pstore’: Permission denied
find: ‘/sys/fs/bpf’: Permission denied
/sys/bus/platform/devices/1c68000.spi
/sys/bus/platform/devices/1c69000.spi
/sys/bus/platform/drivers/sun6i-spi
/sys/bus/platform/drivers/sun6i-spi/1c68000.spi
/sys/bus/platform/drivers/sun6i-spi/1c69000.spi
/sys/bus/platform/drivers/sun4i-spi
/sys/bus/spi
/sys/bus/spi/devices/spi2.0
/sys/bus/spi/devices/spi1.0
/sys/bus/spi/drivers/spidev
/sys/bus/spi/drivers/spidev/spi1.0
/sys/bus/spi/drivers/mmc_spi
/sys/bus/spi/drivers/spi-nor
/sys/bus/spi/drivers/spi-nor/spi2.0
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi1-pins
/sys/firmware/devicetree/base/soc/pinctrl@1c20800/spi0-pins
/sys/firmware/devicetree/base/soc/spi@1c69000
/sys/firmware/devicetree/base/soc/spi@1c69000/spidev@0
/sys/firmware/devicetree/base/soc/spi@1c69000/spidev@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/spi@1c68000
/sys/firmware/devicetree/base/soc/spi@1c68000/flash@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/spi@1c68000/spi-flash@0
/sys/firmware/devicetree/base/soc/spi@1c68000/spi-flash@0/spi-max-frequency
/sys/firmware/devicetree/base/aliases/spi1
/sys/firmware/devicetree/base/__symbols__/spi0
/sys/firmware/devicetree/base/__symbols__/spi1
/sys/firmware/devicetree/base/__symbols__/spi1_pins
/sys/firmware/devicetree/base/__symbols__/spi0_pins
/sys/module/spidev
/sys/module/spidev/drivers/spi:spidev

leo@orangepipc2:~$ ls /dev/spi*
/dev/spidev1.0

 

Posted
3 минуты назад, Igor сказал:

Yes, it can go into release.

Wrote on mobile

Good. Thanks. Users will be grateful.

Posted
4 часа назад, mdrmdr сказал:

I will, but maybe not until the weekend...

To return the system to its original state, you need to delete this file:

sudo rm /etc/kernel/postinst.d/zz-sync-dtb

Then update the repository with test packages and install the two packages.

cd deb
git pull
cd nanopineo

sudo dpkg -i linux-dtb-current-sunxi_22.05.0-trunk_armhf.deb linux-image-current-sunxi_22.05.0-trunk_armhf.deb

This will update (install with replacement) your kernel and dtb.

Don't do anything with the 5.17 kernel. It works and will be a backup in case something goes wrong in the future.

You can switch to it by simply correcting the links.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines