1

I have configured and compiled the Linux kernel using buildroot. I want to have access to spi buses on this board in user mode. Here are the steps I've take to compile the kernel.

1- clone the buildroot repo : version 2023.02-rc1

$ git clone https://github.com/buildroot/buildroot.git && cd buildroot

2- load defconfig for the board

$ make beagleboardx15_defconfig

3- Changes made to the menuconfig

$ make menuconfig

Toolchain ---> A) Toolchain Type ---> External Toolchain
               B) Toolchain ---> Linaro ARM 2018.05 

Kernel ---> A) Kernel version ---> Custom version (4.20.17)
            B) Out-of-tree Device Tree Source file paths (path/to/my/am57xx-beagle-x15.dts)

This path/to/my/am57xx-beagle-x15.dts file will be copy to linux source and compile from there. I have changed the status property of mcspi1-4 nodes to "okay" in this file like this:

&mcspi1 {
          status = "okay";
};

# also did this for other mcspi nodes...

These node are defined in dra7.dtsi file which by default are disabled.

4- Changes made to the linux-menuconfig

$ make linux-menuconfig

Device Drivers ---> SPI support ---> <*> User mode SPI driver support

5- compile the kernel and write the sdcard.img to my sd card.

$ make
$ sudo dd if=images/sdcard.img of=/dev/sdc

After these steps I expected to see some spidev in the /dev directory, but there is nothing related to spi there.

Mohammad
  • 11
  • 1
  • You're confusing SPI (master) controllers with (slave) devices. The changes you've made so far to the Device Tree (the **.dts** file) only enable four SPI (master) controllers. The **spidev** driver/device is for an SPI (slave) device. Such a slave device has to be defined as a subnode of an SPI (master) controller in the DT. IOW the device nodes in the **/dev** directory would refer to SPI devices rather than any SPI interface. – sawdust Mar 05 '23 at 08:31
  • @sawdust Yes, that's correct. As you said, I realized that I should add subnode to this SPI master controller. And for that I should configure some properties like `pinctrl-#` and `pinctrl-single,pins` which I find them in [this](https://e2e.ti.com/support/processors/f/791/t/600285) example. But I don't know how these properties work. Is there any documentation or something for that? – Mohammad Mar 05 '23 at 09:42
  • Documentation is in the Linux kernel source. E.G. **Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml** and **Documentation/devicetree/bindings/spi/spi-controller.yaml**. Properties for pinctrl is a broad topic, try starting with **Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt**. I've only pointed out some generic files; refer also to the SoC-specific files in each subdir. And look for examples of DT usage in the kernel source. Try to distinguish what is board specific and/or SoC specific, versus what is generic. – sawdust Mar 06 '23 at 00:35

0 Answers0