Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SPI on OlinuXino-A20-Micro with Device-Tree Kernel

Featured Replies

Hello,

I'm using an SPI device with my board and kernel 3.4. It works like a charm, except that in the bin/fex file I had to add the following lines :

 

[spi_devices]
spi_dev_num = 2

[spi_board0]
modalias = "spidev"
max_speed_hz = 1000000
bus_num = 2
chip_select = 0
mode = 3
full_duplex = 0
manual_cs = 0

[spi_board1]
modalias = "spidev"
max_speed_hz = 1000000
bus_num = 1
chip_select = 0
mode = 3
full_duplex = 0
manual_cs = 0
 

without those lines, no /dev/spidevX.Y

 

Now I'm testing new kernels (Jessie Kernel 3.19 / 4.0.4 mainline) and it seems that the bin/fex is ignored now. It uses the device tree files. (/boot/dtb/) but I don't know what I have to do to get my /dev/spidevX.Y.

 

Do you know what to do to get de device files /dev/spidevX.Y with these new kernels ?

 

Thank you

 

 

  • Author

Hi all,

ok I finally found how to enable my /dev/spidevX.Y using the DTB/DTS files :

  • convert /boot/dtb/sun7i-a20-olinuxino-micro.dtb to source file
dtc -I dtb -O dts -o /boot/dtb/sun7i-a20-olinuxino-micro.dts /boot/dtb/sun7i-a20-olinuxino-micro.dtb
  • edit the dts file to get that :

spi@01c06000 {
                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c06000 0x1000>;
                        interrupts = <0x0 0xb 0x4>;
                        clocks = <0x3 0x15 0x15>;
                        clock-names = "ahb", "mod";
                        dmas = <0x14 0x1 0x9 0x14 0x1 0x8>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x16>;
                        spidev1: spidev@0 {
                                compatible = "linux,spidev";
                                spi-max-frequency = <1000000>;
                                reg = <0>;
                        };

                };
....

spi@01c17000 {
                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c17000 0x1000>;
                        interrupts = <0x0 0xc 0x4>;
                        clocks = <0x3 0x16 0x25>;
                        clock-names = "ahb", "mod";
                        dmas = <0x14 0x1 0x1d 0x14 0x1 0x1c>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x26>;
                        spidev2: spidev@0 {
                                compatible = "linux,spidev";
                                spi-max-frequency = <1000000>;
                                reg = <0>;
                        };

                };
 

  • recompile your dtb file :
scripts/dtc/dtc -I dts -O dtb -o /boot/dtb/sun7i-a20-olinuxino-micro.dtb /boot/dtb/sun7i-a20-olinuxino-micro.dts
  • then reboot

Hope this will help others !

shug

 

 

Hi there,

 

I'm trying to get SPI working on an Micro running a 3.19 kernel too... I have /dev/spidev* devices now but no output from dmesg... any idea what's missing?

 

Thanks!

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.