St7789v tft display bring up on colibri imx7d

Hi @henrique.tx , I tried your suggestion to use drm panel driver without the port part, like here:

https://git.toradex.com/cgit/linux-toradex.git/tree/arch/riscv/boot/dts/canaan/sipeed_maixduino.dts?h=toradex_5.15-2.1.x-imx#n151

So the spi part in my devicetree is something like this:

&ecspi3 {
	// Enable the SPI controller
	status = "okay";
	
	// needed to avoid dtc warning
	#address-cells = <1>;
	#size-cells = <0>;

	mcp2515: can@0 {
		compatible = "microchip,mcp2515";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_can_int>;
		reg = <0>;
		clocks = <&clk16m>;
		interrupt-parent = <&gpio5>;
		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
		spi-max-frequency = <10000000>;
		status = "disabled";
	};

	spidev0: spidev@0 {
		compatible = "toradex,evalspi";
		reg = <0>;
		spi-max-frequency = <23000000>;
		status = "disabled";
	};
	
	panel@0 {
		compatible = "sitronix,st7789v";		
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_disp_gpio>;				
		reg = <0>;		
		reset-gpios = <&gpio4 23 1>;
		dc-gpios = <&gpio7 2 0>;				
		spi-max-frequency = <15000000>;		
		power-supply = <&reg_module_5v>;		
		spi-cpol;
		spi-cpha;		
		//bgr;
		debug = <0x4000000>;		
		status = "okay";		
	};	
};

but, unfortunately, the result is the same: I don’t have any fb0 interface under /dev.

When using the panel driver, have you ever checked the /sys/class/drm folder?

SCSFreedomX:/sys/class/drm# ls
version
SCSFreedomX:/sys/class/drm#
SCSFreedomX:/sys/class/drm# cat version
drm 1.1.0 20060810
SCSFreedomX:/sys/class/drm#

Thank you very much!

Valerio

Hi @vbardelli !

Sorry for the delay.

As I do not possess this SPI display, I have very limited actions I can take to help you.

Would you like to be introduced to some partner of Toradex that could help you to get it working? By going to some Toradex partner you most probably will get it working quickly (of course it depends on how easy it is to deal with this device).

Best regards,

Hi all,

thanks to your partner, Koan Software, we finally understand the two problems that we have with sitronix st7789v display.

First of all it’s impossible to use this display with DRM driver, because the SPI interface is not yet developed:

“The upstream driver is a panel only driver that is designed to allow ST7789V to be interfaced via a display controller (RGB/Parallel). It would need to be partnered with a suitable TinyDRM driver to operate in SPI only mode (and such a driver has not yet been written).”

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/gpu/drm/panel/panel-sitronix-st7789v.c?id=7142afb3a186ed2cd028318205a4852f04283380

So, the only solution is to use the staging driver.

Unfortunately the splash logo does not show: the driver initializes the display late in the boot process (after the rootfs mount) and the display shows only some of the boot logs.

After some analysis, this display initialization delay is due to the fact that SDMA peripheral is initialized late in the boot process because its driver is compiled as module.

If the SDMA driver was compiled builtin, it would initialize the SDMA peripheral early in the boot stage, allowing the SPI contoller (and hence the display) configured immediately and not deferred.

Unfortunately, the SDMA peripheral needs a binary firmware loaded from the outside to work properly. The binary firmware is in the rootfs (under /lib/firmware/imx/sdma/sdma-imx7d.bin), but rootfs is not available in the early boot stages. In that situation, the SDMA initializazion would be deferred again after the rootfs mount.

Two different solutions has been found to have the display initialized early in the boot and showing the Linux logo:

  • disable the DMA for the SPI controller driver: the SPI controller does not wait the DMA anymore and initializes the display early. As a consequence of the DMA disabled, the display performances could be poor and system could have the CPU load increased.

  • build the SDMA driver as builtin and bundle the SDMA firmware in the Linux zImage: the SDMA gets ready in earlier boot stage because the firmware is attached to zImage and then loaded from memory (no more need to access the rootfs), then the SPI controller can initialize itself (and the attached display) early in the boot sequence.
    Please note that this solution could produce license issues because a non-GPL binary (the firmware) is bundled with a GPL binary (the kernel)

The Linux logo is shown early in the boot process with each of the two above solutions.

All these solutions and descriptions come thanks to Koan Software.

Valerio

2 Likes

Glad to help :slightly_smiling_face:

2 Likes

Hi @vbardelli ,

Glad that it works now and thanks for sharing the solution here.

Also big thanks to @koan for helping out here.

Best Regards
Kevin