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.