Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIDEV ABI change on mainline Linux kernel #263

Open
pdp7 opened this issue Jun 26, 2018 · 4 comments
Open

SPIDEV ABI change on mainline Linux kernel #263

pdp7 opened this issue Jun 26, 2018 · 4 comments

Comments

@pdp7
Copy link
Collaborator

pdp7 commented Jun 26, 2018

FYI - a solution will need to be decided upon for libraries like Adafruit_BBIO

---------- Forwarded message ----------
From: Robert Nelson 
Date: Tue, Jun 26, 2018 at 11:03 AM
Subject: [beagle-alpha] SPIDEV abi change on mainline

Mainline:

debian@beaglebone:~$ ls /sys/devices/platform/ocp/48030000.spi/spi_master/spi*/
device  of_node  power  spi0.0  spi0.1  statistics  subsystem  uevent
debian@beaglebone:~$ ls /sys/devices/platform/ocp/481a0000.spi/spi_master/spi*/
device  of_node  power  spi1.0  spi1.1  statistics  subsystem  uevent
debian@beaglebone:~$ ls /dev/spidev*
/dev/spidev0.0  /dev/spidev0.1  /dev/spidev1.0  /dev/spidev1.1

v4.1.x -> v4.9.x

debian@beaglebone:~$ ls /sys/devices/platform/ocp/48030000.spi/spi_master/spi*/
device  of_node  power  spi1.0  spi1.1  statistics  subsystem  uevent
debian@beaglebone:~$ ls /sys/devices/platform/ocp/481a0000.spi/spi_master/spi*/
device  of_node  power  spi2.0  spi2.1  statistics  subsystem  uevent
debian@beaglebone:/sys/devices/platform/ocp$ ls /dev/spi*
/dev/spidev1.0  /dev/spidev1.1  /dev/spidev2.0  /dev/spidev2.1

v3.8.13:

debian@beaglebone:~$ ls /sys/devices/ocp.*/48030000.spi/spi_master/spi*/
device    power  spi1.0  spi1.1  subsystem  uevent
debian@beaglebone:~$ ls /sys/devices/ocp.*/481a0000.spi/spi_master/spi*/
device  power  spi2.0  spi2.1  subsystem  uevent
debian@beaglebone:~$ ls /dev/spidev*
/dev/spidev1.0  /dev/spidev1.1  /dev/spidev2.0  /dev/spidev2.1


What to Do:

In v4.14.x i'm patching things so it's v4.1.x > v4.9.x compabile..

But, we should change all the libr's to use the "ocp" directory
lookup's shown above..

cc @RobertCNelson

@pdp7 pdp7 self-assigned this Jun 26, 2018
@pdp7
Copy link
Collaborator Author

pdp7 commented Oct 9, 2018

For example:
/sys/devices/platform/ocp/48030000.spi/spi_master/spi1/spi1.0/
who do I get to the actual character device file that I would open?

@RobertCNelson wrote:
spi1.0 -> /dev/spidev1.0
/sys/devices/platform/ocp/*.spi/spi_master/spiX/spiX.Y/ = /dev/spidevX.Y

@pdp7
Copy link
Collaborator Author

pdp7 commented Apr 4, 2019

For reference, here is a commit to add the /dev/spi/X.Y properties to device tree:
SPIDEV: use symlink label to help udev
beagleboard/bb.org-overlays@d21b116

And udev script that create the corresponding symlinks:
https://github.com/mvduin/py-uio/blob/master/etc/udev/rules.d/10-of-symlink.rules

@pdp7
Copy link
Collaborator Author

pdp7 commented Dec 24, 2019

FYI - this will solve issues like this one:
SPI No such file or directory
#322

@matthijskooijman
Copy link

I also ran into this problem, which got me a bit by surprise.

However, it does seem the new names make more sense: Now it uses spidev0 and spidev1, which match the labels on the pinout and the overlays (e.g. BB-SPIDEV0-00A0.dtbo). However, it does seem that the /dev/spidev.x.x is rather arbitrary (e.g. like ethx labels used to be), so the new symlinks are probably the best way to target specific spi devices.

matthijskooijman added a commit to meetjestad/mjs_gateway_configuration that referenced this issue May 1, 2020
On newer Beagleboard images, this symlink provides a predictable and
stable way to access the SPI devices. This is needed since newer kernels
appear to number their SPI device files differently, so the originally
used /dev/spidev1.0 no longer works on recent (Buster) images.

See also:

    adafruit/adafruit-beaglebone-io-python#263
    beagleboard/bb.org-overlays@d21b116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants