Hi @swiss,
Well, since you moved to RRPMSG Lite, you may have as many /dev/ttyRPMSG’s as you wish, you may as weel implement some other RPMSG devices. Some modifications are required in device tree and M4 side.
It is not easy to come back to something non-trivial like subject to do it from scratch. Since it is working on my side, I may miss some details.
You need two or more VDEV’s with their own VDEV VRING’s. See on M4 rpmsg_platform.h, or perhaps some other h file. Starting from default VRING allocation for iMX7D, which was 0x8FFf0000, add next VRING at +64k:
#define VDEV0_VRING_BASE 0x8FFf0000
#define VDEV1_VRING_BASE 0x90000000
64k is hard coded in Linux imx_rpmsg driver.
In *.c files on M4 side you should have multiple calls to rpmsg_lite_remote_init() like
rpmsgtty0 = rpmsg_lite_remote_init((void *)RPMSG_0_VRING, RPMSG_0_LINK_ID, RL_NO_FLAGS);
There should be no mismatch betweem VRING and LINK_ID. LINK_ID for VRING0 is 0, LINK_ID for next VRING1 is 1 and so on. Thay can’t be flipped AFAIK.
Then for each rpmsgtty on M4 you call corresponding rpmsg_queue_create(), rpmsg_lite_create_ept() and rpmsg_ns_announce().
2nd argument to rpmsg_lite_create_ept() will match your /dev/ttyRPMSGx number on Linux.
3rd argument to rpmsg_ns_announce() is RPMSG announce string, which should be recognised by imx_rpmsg_tty.c driver. Only 3 strings are defined in that driver. So you would need to add there more for more /dev/ttyRPMSG devices
static struct rpmsg_device_id rpmsg_driver_tty_id_table[] = {
{ .name = "rpmsg-virtual-tty-channel-1" },
{ .name = "rpmsg-virtual-tty-channel" },
{ .name = "rpmsg-openamp-demo-channel" },
{ },
}
In device tree you shoud change vdev-nums and reg of your rpmsg node. Taking first imx8 related dts file I found, changes could be like this:
&rpmsg1{
/*
* 64K for one rpmsg instance:
*/
/* was
vdev-nums = <1>;
reg = <0x0 0x90100000 0x0 0x10000>;
*/
vdev-nums = <2>;
reg = <0x0 0x90100000 0x0 0x20000>;
status = "okay";
};
As well you need to check size of memory reserved for RPMSG in your DT. If only 64k are reserved, you need to resize it accordingly to N*64k.
Hope it helps
Edward