jayanta525 / rk3308-rock-pi-s

OpenWrt/Linux/u-boot for ROCK Pi S by Radxa
https://wiki.radxa.com/RockpiS
Other
24 stars 10 forks source link

how to link pins to spi lcd and i2c touch? #5

Open myamoroso opened 1 year ago

myamoroso commented 1 year ago

Describe the bug

how to update device tree to support spi lcd and i2c touch ? which pins to link?

thanks !!!

OpenWrt version

r14622-7da6ae78b3

OpenWrt target/subtarget

rockchip/armv8

Device

Radxa ROCK Pi S

Image kind

Self-built image

Steps to reproduce

No response

Actual behaviour

No response

Expected behaviour

No response

Additional info

No response

Diffconfig

No response

Terms

jayanta525 commented 1 year ago

which controller is the SPI display using?

myamoroso commented 1 year ago

spi : st7789v / ili9341 i2c: gt911

jayanta525 commented 1 year ago

@myamoroso , for SPI display with ILI9341 controller, you can hookup with the SPI2 bus on the ROCK Pi S, pinouts here - RADXA For Linux, Linux has native support for ILI9341 with DTS support - docs here

DTS modifications

&spi2 {
    status = "okay";

        display9341@0{
        compatible = "ilitek,ili9341";
        reg = <0>;

        spi-max-frequency = <32000000>;
        rotate = <0>;
        bgr;
        fps = <50>;
        buswidth = <8>;
        reset-gpios = <&gpio 17 0>;
        dc-gpios = <&gpio 16 0>;
        led-gpios = <&gpio 15 1>;
        debug = <0>;
    };
};
myamoroso commented 1 year ago

@jayanta525
Thanks for your reply. Unforturnatlly, i didn't get the /dev/fb0 device, and get the log:

[ 0.239304] SPI driver fb_ili9341 has no spi_device_id for ilitek,ili9341

Following is repro steps:

1) Add the &spi2{} node to the bottom of the following dtsi and dts files:

./rk3308-rock-pi-s/build_dir/host/u-boot-2023.04/arch/arm/dts/rk3308-u-boot.dtsi ./rk3308-rock-pi-s/build_dir/target-aarch64_generic_musl/u-boot-2023.07.02/arch/arm/dts/rk3308-u-boot.dtsi ./rk3308-rock-pi-s/build_dir/target-aarch64_generic_musl/u-boot-rock-pi-s-rk3308/u-boot-2023.10-rc2/arch/arm/dts/rk3308-u-boot.dtsi

./rk3308-rock-pi-s/build_dir/host/u-boot-2023.04/arch/arm/dts/rk3308-rock-pi-s.dts ./rk3308-rock-pi-s/build_dir/toolchain-aarch64_generic_gcc-12.3.0_musl/linux-6.1.46/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ./rk3308-rock-pi-s/build_dir/target-aarch64_generic_musl/u-boot-2023.07.02/arch/arm/dts/rk3308-rock-pi-s.dts ./rk3308-rock-pi-s/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-6.1.46/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ./rk3308-rock-pi-s/build_dir/target-aarch64_generic_musl/u-boot-rock-pi-s-rk3308/u-boot-2023.10-rc2/arch/arm/dts/rk3308-rock-pi-s.dts

2) Apply pins the board: According SPI2(RADXA) and &spi2{} node, link the lcd pins to the board.

3) enable the "FB_TFT_ILI9341" in the kernel menuconfig

where is missing or lost?

jayanta525 commented 1 year ago

@myamoroso, add only

&spi2 {
    status = "okay";
};

in uboot. (rk3308-rock-pi-s.dts)

and full node on (linux....rk3308-rock-pi-s.dts)

jayanta525 commented 1 year ago

@myamoroso

try with a lower spi speed -

&spi2 {
    status = "okay";
        max-freq = <48000000>;

        display9341@0{
        compatible = "ilitek,ili9341";
                status = "okay";
        reg = <0>;

        spi-max-frequency = <15000000>;
        rotate = <0>;
        bgr;
        fps = <30>;
        buswidth = <8>;
        reset-gpios = <&gpio 17 0>;
        dc-gpios = <&gpio 16 0>;
        led-gpios = <&gpio 15 1>;
        debug = <0>;
    };
};