Verdin Mini RPMSG imx_rpmsg_tty Issue

Hi @swiss,

I apologize for the long delay. I could finally take a deeper look into this and it wasn’t quite easy, that’s why it took more time. Here is the overlay to enable rpmsg on the verdin iMX8M Mini:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2022 Toradex
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "toradex,verdin-imx8mm";
};

&{/} {

    reserved-memory {

		#address-cells = <2>;
		#size-cells = <2>;
		ranges;
        
        vdev0vring0: vdev0vring0@B8000000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8000000 0 0x8000>;
			no-map;
		};

		vdev0vring1: vdev0vring1@B8008000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8008000 0 0x8000>;
			no-map;
		};

		vdevbuffer: vdevbuffer@b8400000 {
			compatible = "shared-dma-pool";
			reg = <0 0xb8400000 0 0x100000>;
			no-map;
		};
        
        rsc_table: rsc_table@B80FF000 {
			reg = <0 0xb80ff000 0 0x1000>;
			no-map;
		};
    };
};

&rpmsg {
	/*
	 * 64K for one rpmsg instance:
	 * --0xb8000000~0xb800ffff: pingpong
	 */
	vdev-nums = <1>;
	reg = <0x0 0xb8000000 0x0 0x10000>;
	memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, <&rsc_table>;
    status = "okay";
};

Here is the compiled binary for you: Download - Toradex File Sharing Platform

Here I applied this overlay:

# cat /boot/ostree/torizon-197df9985ed050833c45da3c9f71a61d0ff961f710a005c4fbb8bb090a5b2ca4/dtb/overlays.txt
fdt_overlays=verdin-imx8mm_rpmsg.dtbo

And loaded the rpmsg_lite_str_echo_rtos.bin demo from NXP SDK. Then, after the module has been rebooted, run the command below:

#  sudo modprobe imx_rpmsg_tty

You should see the hello world on the m4 side. Now, to send messages, you can run:

# echo hello > /dev/ttyRPMSG30

And you should see the message in the m4 core.

This overlay will work but you will probably see a warning like this one in the dmesg:

[    0.000000] OF: reserved mem: OVERLAP DETECTED!
[    0.000000] vdev0vring0@B8000000 (0x00000000b8000000--0x00000000b8008000) overlaps with rpmsg@b8000000 (0x00000000b8000000--0x00000000b8400000)
[    0.000000] OF: reserved mem: OVERLAP DETECTED!

It should be a problem for you, however, if you want to get rid of this warning, you will need to patch the verdin device tree and compile it again. Here is the patch:

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
index eb9cf2576bf7..b1c7923deb9c 100755
--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
@@ -126,20 +126,6 @@
 		startup-delay-us = <2000>;
 		off-on-delay = <100000>;
 	};
-
-	reserved-memory {
-		#address-cells = <2>;
-		#size-cells = <2>;
-		ranges;
-
-		/* use the kernel configuration settings instead */
-		/delete-node/ linux,cma;
-
-		rpmsg_reserved: rpmsg@b8000000 {
-			no-map;
-			reg = <0 0xb8000000 0 0x400000>;
-		};
-	};
 };
 
 &A53_0 {
@@ -664,7 +650,6 @@
 	l1ss-disabled;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_pcie0>;
-	reserved-region = <&rpmsg_reserved>;
 	/* PCIE_1_RESET# (SODIMM 244) */
 	reset-gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
 };

From what I tested here, there is no need for this patch now, you should be fine with the overlay.

Let me know if you have any questions about that. I’ll also mark this answer as a solution so others can benefit from it, but you can ask any questions here.

Hope this helps!

Best Regards,
Hiago.