Odyssey X86J4125 enabling spidev on arch linux

I am using Arch linux on the Odyssey X86J4125 and would like to use the python-spidev library, but the seeed wiki only shows how to enable userspace SPI for ubuntu and debian.

I have installed the iasl tool and was able to generate spidev1.*.aml files using the command:
$: iasl spidev1.0.asl
$: cp spidev.1.0.asl /usr/lib/firmware/acpi-upgrades/

Then I need to use the mckinitcpio command instead of update-initramfs to update the initram, so I tried this:
$: sudo mkinitcpio -p linux513

It succesfully generates the new image but after rebooting and running the command:
$: ls /dev/spidev*

I don’t see anything, and spidev.1.0 and spidev.1.1 are not available.

I think maybe when I run the mkinitcpio command it isn’t finding the .aml files in /lib/firmware/acpi-upgrades

Has anyone setup SPI on arch linux and know how to enable userspace SPI for arch linux?

Hi,
Actually, you need to put the aml file in the initramfs directory kernel/firmware/acpi. Our guide was written based on using update-initramfs, which places /lib/firmware/acpi into the directory mentioned in the procedure. So if you are not using this tool, then it does not work. You can refer to the following link that.
linux/initrd_table_override.rst at master · torvalds/linux (github.com)

Ok thanks @lht856 the link was really helpful, it is working now!

Here are the steps for Manjaro or Arch linux users:

Download the spi-enable.zip from the seeed wiki

Install iasl and cpio:
pacman -Syu iasl cpio

Unzip spi-enable.zip and generate .aml files using iasl:

$: cd ~/Downloads
$: unzip spi-enable.zip
$: cd spi-enable
$: iasl spidev1.0.asl
$: iasl spidev1.1.asl

Change to root user and change to /tmp directory to work in:

$: su -
$: cd /tmp

Make a directory to patch the acpi tables:
$: mkdir -p kernel/firmware/acpi

Move the generated .aml files into the directory (replace USER with your username):
$: mv /home/USER/Downloads/spi-enable/*.aml /tmp/kernel/firmware/acpi/

Now create a new cpio image with the directory and .aml files:
$: find kernel | cpio -H newc --create > /boot/initramfs-custom.img

Append your current initramfs image to the end of the custom image:
note: your initramfs image might have a different name depending on the kernel, so do ls /boot and replace the .img name in the following commands with one that matches your kernel.

$: cat /boot/initramfs-5.13-x86_64.img >> /boot/initramfs-custom.img

Backup your current initramfs image:
$: cp /boot/initramfs-5.13-x86_64.img /boot/initramfs-5.13-x86_64.img.backup

Now replace your original initramfs image with the custom image:
$: mv /boot/initramfs-custom.img /boot/initramfs-5.13-x86_64.img

Verify that the .aml files have been added:
$: lsinitcpio /boot/initramfs-5.13-x86_64.img | head

The output should be:

kernel
kernel/firmware
kernel/firmware/acpi
kernel/firmware/acpi/spidev1.1.aml
kernel/firmware/acpi/spidev1.0.aml

now reboot and do ls /dev/spi* you should see the ports now!

I don’t know how to automate this on Arch linux so it will be written over the next time a kernel updates.

1 Like