VIM3 Android P SPI device

I am wondering how to add a SPI device in device tree and where is the correct DTS file.

In the past I made it on Hikey96 board by modifying kernel/arch/arm64/boot/dts/hisilicon/hi6220.dtsi like this way:

spi_0: spi@f7106000 {
compatible = "arm,pl022", "arm,primecell";
reg = <0x0 0xf7106000 0x0 0x1000>;
interrupts = <0 50 4>;
bus-id = <0>;
enable-dma = <0>;
clocks = <&sys_ctrl HI6220_SPI_CLK>;
clock-names = "apb_pclk";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pmx_func &spi0_cfg_func>;
num-cs = <1>;
cs-gpios = <&gpio6 2 0>;
status = "disabled";

};

change to be like:

spi_0: spi@f7106000 {
    compatible = "arm,pl022", "arm,primecell";
    reg = <0x0 0xf7106000 0x0 0x1000>;
    #address-cells = <1>;
    #size-cells = <0>;
    interrupts = <0 50 4>;
    bus-id = <0>;
    enable-dma = <0>;
    dmas = <&dma0 12 &dma0 13>;
    dma-names = "rx", "tx";
    clocks = <&sys_ctrl HI6220_SPI_CLK>;
    clock-names = "apb_pclk";
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pmx_func &spi0_cfg_func>;
    num-cs = <1>;
    cs-gpios = <&gpio6 2 0>;
    status = "ok";

    my_dev@0 {
        compatible = "my,dev";
        reg = <0>;
        spi-max-frequency = <10000000>;
        spi-cpol = <1>;
        spi-cpha = <1>;
        my_dev,reset-gpio = <&gpio2 1 0>;
        my_dev,irq-gpio = <&gpio2 0 0>;
        my_dev,frame_ready-gpio = <&gpio2 3 0>;
    };

};

Now I am using VIM3 and just finished repo sync and make.
But I have not found any .dts or .dtsi file defining spi node like “spidev@0” or like:

&spicc1 {
status = “disabled”;
pinctrl-names = “default”;
pinctrl-0 = <&spicc1_pins>;
cs-gpios = <&gpio GPIOH_6 0>;
...
}

I downloaded the source code by running:

repo init -u https://github.com/khadas/android_manifest.git -b khadas-vims-pie
repo sync -j4

And checked the git log at /common/arch/arm64/boot/dts/amlogic and git log shown as below:

commit 6c1d052602d2b89ff296ce78c8678ef8651d9528 (HEAD, tag: Vims-Pie-V201113, m/khadas-vims-pie, github/khadas-vims-pie)
Author: Terry <terry@khadas.com>
Date:   Fri Nov 13 17:39:46 2020 +0800
PDM: disable alsaPORT-pdm [VIM3L]

Thank you all.

I think you will find what you are looking for in common/arch/arm/boot/dts/amlogic/mesong12b.dtsi at line 677, but there are also entries in mesongg12b_a.dtsi of the same folder as well as in the arm64/boot/dts/amlogic folder with files of the same name. Hope this helps.

3 Likes

Wise suggestion :slight_smile: I saw kvim3.dts has three includes:

 `#include "partition_mbox_normal.dtsi"
  #include "mesong12b.dtsi"
  #include "mesong12b_skt-panel.dtsi"`

Believe it’s a great start with trying to modify the “mesong12b.dtsi” to put a device node into device tree.

Thank you @zonggestsu

For having a brief summary.
I guess we could do 4 steps to have an updated bootimage for my vim3 running Android pie.

1st step:
Build DTSfile:
Example:
common/arch/arm/boot/dts/amlogic/mesong12b.dtsi

2nd step:
Build U-Boot:
Example:
amo@ubuntu:~/workspace/vim3/bsp/bootloader/uboot$ ./mk kvim3

3rd step:
Build U-Boot:
Example:
amo@ubuntu:~/workspace/vim3/bsp$ make bootimage

4th step:
Flash:
Example:
fastboot flash boot /path/to/boot.img

May I know if these four steps are making sense? @Frank @numbqq @Terry

On the other hand fenix is really a good choice to make life easier.
And I’ve succeeded to make and saw there is an updated kvim3_linux.dtb
Gratefully fenix works well on my Ubuntu 20.4 virtual machine.
It means at the same time I can try to use fenix to make kernel and dtb to have updated dtb files.

Have NOT sure if those updated dtb files generated by fenix could be used in vim3 Androd pie AOSP.

Thanks.

1 Like