Skip to content
Advertisement

Diolan DLN-2 SPI controller on x86_64 platform

I am attempting to utilize the DLN-2 in an x86_64 Linux environment (kernel version 4.18) to provide SPI and I2C bus controllers to the userspace, in a similar manner you would using an ARM platform with DTS/DTB file modifications. I am having trouble identifying the proper method to attach a SPI slave device or mount the device to userspace with the spidev driver.

The kernel modules are loading successfully and the SPI bus is mounted as a spi_master. I am certain the chip itself is working because the I2C (/dev/i2c-#) and GPIO (/dev/gpiochip#) interfaces can be successfully manipulated. For reference, here is a list of all references in the Linux system tree for “dln”:

JavaScript

Here is the matching portion of the boot log:

JavaScript

And the relevant portion of the usb device tree:

JavaScript

At this point, I am assuming that an ACPI patch is the correct method. however, the device does not appear in the ACPI device tree, or I am not searching with the correct string. I am assuming it will be similar to the following, which I pulled from a kernel patch (https://lore.kernel.org/patchwork/patch/527210/) that appears to have since been removed from the current kernel.

JavaScript

I have also tried udev rules, but my knowledge of udev is slim so they are likely incorrect. None of these appeared to have done the trick:

JavaScript

Advertisement

Answer

Okay, now I’m able to answer to the question.

First of all, assume that DSDT on the host machine, i.e. USB host controller excerpt, looks like this (some names maybe different, some methods may or may not be provided, just interesting us part):

JavaScript

Important thing above is that port devices (HS01, SS01, etc) does not have _UPC() or _PLD() methods. If they are, you will need to override complete DSDT or upgrade it and ACPI SSDT overlays won’t work.

Assume that Diolan device is connected to HS02 USB port. In this case we have to provide the following ACPI excerpt, either in DSDT or as SSDT overlay (Note, method GPLD(), if not present, should be copied from above excerpt):

JavaScript

Note, this example now is a part of meta-acpi project.

After loading these tables we will get everything enumerated like:

JavaScript

This gets us the device object we can attach our slave devices to. So, more detailed this part has been answered in the following SO posts:

Note, there are two patches to make it possible in Linux. One is a599a0fb629a (“Add ACPI support for USB interface devices”) and one is pending e3fadb35bc1b (“Allow to be enumerated via ACPI”). Both will be in v5.7-rc1.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement