Jump to content

OPZ+2 H5 enable SPi but no /dev/spi-dev


zhen8838

Recommended Posts

 I use the Armbian_5.45_Orangepizeroplus2-h5_Debian_stretch_next_4.14.44.img.

I want to use a sensor based on the spi protocol. In armbian-config i enable the spi ,the armbianEnv.txt like this:

verbosity=1
console=both
overlay_prefix=sun50i-h5
overlays=i2c0 i2c1 spdif-out spi-add-cs1 spi-jedec-nor spi-spidev uart1 uart2 usbhost2 usbhost3
rootdev=UUID=bb48b498-7bd1-4018-b77d-ba00fa61a33d
rootfstype=ext4
param_uart1_rtscts=1
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

But in /dev  on spi-dev

root@H5:~# ls /dev/s
shm/    snd/    stderr  stdin   stdout 

 

Is it because there is no code adaptation spi-dev?

if not ,I want to try to transplant the spi-dev code,Can give me some guiding advice?

Link to comment
Share on other sites

It seems that something broken in /boot/dtb/allwinner/overlay/sun50i-h5-fixup.scr script ... It doesn't turn on the status to "okay" ...

 

In the mean time we found a fix, use the DTBO attached and apply it with the following commands :

 

mkdir /sys/kernel/config/device-tree/overlays/spidev
cat spi1dev-fix.dtbo > /sys/kernel/config/device-tree/overlays/spidev/dtbo

BTW, @zador.blood.stained , did you know about this issue ? was it introduce when we switched to newer u-boot ?

 

spi1dev-fix.dtbo

Link to comment
Share on other sites

I get the source and find the linux-4.17-y/arm64/boot/dts/allwinner/overlay/sun50i-h5-spi-spidev.dts : the spi status is disable.

I modified “disable” to “okay”, then rebuild the .dts to .dtbo . and put the sun50i-h5-spi-spider.dtbo into the board. 

finally i insmod /lib/module/linux-4.17-y/kernel/drives/spi/spidev.ko But still can’t fix this problem … 

does anybody can help me?

 

99BA978E-7FA0-48B7-BFC5-7A8A74A55935.png

Link to comment
Share on other sites

7 minutes ago, zador.blood.stained said:

Which kernel version are we talking about - 4.14 or 4.17?

It is on a recent 4.17 on both OPiZ+2 and OPi+2E, but applying my above DTBO directly in /sys/kernel/config/device-tree/overlays is working, which only adding "okay", so I presume it is the fixup script in u-boot that doesn't apply the "okay".

I will try to see if in previous 4.14 the issue was present...

Link to comment
Share on other sites

5 minutes ago, zador.blood.stained said:

Which kernel version are we talking about - 4.14 or 4.17?

… i am noob .last month i build my board kernel version is 4.14 ,but now i don’t know how to build the last version kernel …

Link to comment
Share on other sites

2 minutes ago, martinayotte said:

It is on a recent 4.17 on both OPiZ+2 and OPi+2E, but applying my above DTBO directly in /sys/kernel/config/device-tree/overlays is working, which only adding "okay"

, so I presume it is the fixup script in u-boot that doesn't apply the "okay".

Not surprising given the number of DT changes between 4.14 and 4.17.  Almost all overlays need adjustments for newer kernel versions.

Link to comment
Share on other sites

7 minutes ago, zador.blood.stained said:

Not surprising given the number of DT changes between 4.14 and 4.17

I've tested on my Pine64 with 4.14 and the issue is still there : the overlay itself is loaded (since spidev appears in DT) but the "okay" of fixup script are not there ...

 

Link to comment
Share on other sites

18 minutes ago, martinayotte said:

@zhen8838 The "okay" are applied by the /boot/dtb/allwinner/overlay/sun50i-h5-fixup.scr script when the "param_spidev_spi_bus" is provided in armbianEnv.txt.

See the doc here : https://docs.armbian.com/Hardware_Allwinner_overlays/

 

In the mean time, did you try my own DTBO ?

thanks for  your reply. i will read the doc to learn more .I will try your dtbo tomorrow.

Link to comment
Share on other sites

1 minute ago, martinayotte said:

I've tested on my Pine64 with 4.14 and the issue is still there : the overlay itself is loaded (since spidev appears in DT) but the "okay" of fixup script are not there ...

A64 SPI was added upstream only in 4.15 so it's possible that there are some inconsistencies between SPI DT patches and overlay patches. But since people added several overlays directly to kernel patches I'm not even sure which sunxi-DT-overlays revision we had and have right now in sunxi-next and sunxi-dev trees.

Link to comment
Share on other sites

9 minutes ago, zador.blood.stained said:

it's possible that there are some inconsistencies between SPI DT patches and overlay patches.

I've edited the overlay itself to have status "okay" directly there, and it is working. So, it is really the "fixup" script that doesn't seems to execute the "fdt set /soc/spi@1c68000 status okay" and "fdt set /soc/spi@1c68000/spidev status okay" properly...

I'm doing a new build which will add a "fdt print /soc/spi@1c68000" while executing the "fixup", we will see ...

Link to comment
Share on other sites

The issue is question is missing spidev argument: param_spidev_spi_bus=0

 

I can confirm spi_spidev works in 4.17.11. 

 

But I could not get other user device tree overlays to work properly in 4.17.11.

Link to comment
Share on other sites

6 minutes ago, zador.blood.stained said:

It's more than just leading 0s, there are some node and label name changes too.

Right ! need more consistencies ...

I've just figured out on my Pine64 4.14 that it was the reverse : fixup script didn't have leading zero, but the board dtb had some for SPIs :(

Link to comment
Share on other sites

1 hour ago, martinayotte said:

@zador.blood.stained , I've found it ! It is already fixed 8 days ago by @5kft ! My builds were older than that ...

 

https://github.com/armbian/build/commit/8d092c22e06f2a105b957ff0bbed1f221ed4a688#diff-3e167ca28e6d1bc614dd30bc33eb7fab

 

But we still seeing some leading zeros on some of the fixups, such as A10/A13/A20 ...

 

@martinayotte, @zador.blood.stained - yes, apologies, I only fixed the entries for boards that I could test my changes against (i.e., H3/H5).  Unfortunately I don't have any A10/A13/A20-based boards, and I didn't feel comfortable making changes that I couldn't test...  (This would especially be a problem if some of the other nodes/labels changed as well, and I couldn't test them)

Link to comment
Share on other sites

19 hours ago, martinayotte said:

@zhen8838 The "okay" are applied by the /boot/dtb/allwinner/overlay/sun50i-h5-fixup.scr script when the "param_spidev_spi_bus" is provided in armbianEnv.txt.

See the doc here : https://docs.armbian.com/Hardware_Allwinner_overlays/

 

In the mean time, did you try my own DTBO ?

thank you very much . i have solved this problem.:D

Link to comment
Share on other sites

On 7/29/2018 at 7:29 PM, zhen8838 said:

 I use the Armbian_5.45_Orangepizeroplus2-h5_Debian_stretch_next_4.14.44.img.

I want to use a sensor based on the spi protocol. In armbian-config i enable the spi ,the armbianEnv.txt like this:


verbosity=1
console=both
overlay_prefix=sun50i-h5
overlays=i2c0 i2c1 spdif-out spi-add-cs1 spi-jedec-nor spi-spidev uart1 uart2 usbhost2 usbhost3
rootdev=UUID=bb48b498-7bd1-4018-b77d-ba00fa61a33d
rootfstype=ext4
param_uart1_rtscts=1
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

But in /dev  on spi-dev


root@H5:~# ls /dev/s
shm/    snd/    stderr  stdin   stdout 

 

Is it because there is no code adaptation spi-dev?

if not ,I want to try to transplant the spi-dev code,Can give me some guiding advice?

 I am having the same issue with Banana PI M2+ H3 board 
i don't see any spi devices under /dev/

Link to comment
Share on other sites

34 minutes ago, vivekpk said:

you mean without i2c0 and w1-gpio

It depends : are you using those ?

33 minutes ago, vivekpk said:

how will i do that

Simply edit again /boot/armbianEnv.txt and add "param_spidev_spi_bus=0" or "param_spidev_spi_bus=1" depending which bus you want to activate... and then reboot ...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines