cancel
Showing results for 
Search instead for 
Did you mean: 

RPMSG SDB driver allocates buffers in reserved memory

mishuk
Associate III

We have been using RPMSG_SDB driver from LogicAnalyzer example. By default, RPMSG_SDB uses common CMA area for allocating buffers via

dma_alloc_coherent()

We want to allocate SDB personal buffers from reserved memory regions. We adapted both device-tree and SDB driver. Device-tree snippet:

reserved-memory {
    shared_buffers: shared_buffers@D2000000 {
	compatible = "shared-dma-pool";
	reg = <0xD2000000 0x400000>;
	no-map;
    };		
};	
rpmsg-sdb@0 {
        compatible = "fmx,rpmsg-sdb";
      	memory-region = <&shared_buffers>;
};

SDB driver compatible string:

static struct rpmsg_device_id rpmsg_driver_sdb_id_table[] = {
	{ .name	= "rpmsg-sdb-channel" },
	{ },
};
 
static struct of_device_id rpmsg_driver_sdb_dt[] = {
      { .name	= "rpmsg-sdb-channel",
        .compatible = "fmx,rpmsg-sdb" },
      { },
};
 
MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sdb_id_table);
 
static struct rpmsg_driver rpmsg_sdb_rmpsg_drv = {
	.drv.name	= KBUILD_MODNAME,
	.drv.owner	= THIS_MODULE,
	.drv.of_match_table = rpmsg_driver_sdb_dt,
	.id_table	= rpmsg_driver_sdb_id_table,
	.probe		= rpmsg_sdb_drv_probe,
	.callback	= rpmsg_sdb_drv_cb,
	.remove		= rpmsg_sdb_drv_remove,
};

SDB driver memory allocation inside rpmsg_sdb_drv_init(void):

ret = of_reserved_mem_device_init(rpmsg_sdb_dev);

It fails with error -22 (EINVAL). What might be the culprit ?

0 REPLIES 0