Jump to content

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


shug

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines