[PATCH v5 2/5] remoteproc: imx_rproc: Populate devices under "rpmsg" subnode
Shenwei Wang
shenwei.wang at nxp.com
Mon Dec 1 07:50:40 PST 2025
> -----Original Message-----
> From: Mathieu Poirier <mathieu.poirier at linaro.org>
> Sent: Thursday, November 27, 2025 10:23 AM
> To: Shenwei Wang <shenwei.wang at nxp.com>
> Cc: Bjorn Andersson <andersson at kernel.org>; Rob Herring <robh at kernel.org>;
> Krzysztof Kozlowski <krzk+dt at kernel.org>; Conor Dooley
> <conor+dt at kernel.org>; Shawn Guo <shawnguo at kernel.org>; Sascha Hauer
> <s.hauer at pengutronix.de>; Jonathan Corbet <corbet at lwn.net>; Linus Walleij
> <linus.walleij at linaro.org>; Bartosz Golaszewski <brgl at bgdev.pl>; Pengutronix
> Kernel Team <kernel at pengutronix.de>; Fabio Estevam <festevam at gmail.com>;
> Peng Fan <peng.fan at nxp.com>; linux-remoteproc at vger.kernel.org;
> devicetree at vger.kernel.org; imx at lists.linux.dev; linux-arm-
> kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linux-
> doc at vger.kernel.org; dl-linux-imx <linux-imx at nxp.com>
> Subject: [EXT] Re: [PATCH v5 2/5] remoteproc: imx_rproc: Populate devices
> under "rpmsg" subnode
> > > > +static void imx_rpmsg_endpoint_remove(struct rpmsg_device *rpdev) {
> > > > + of_platform_depopulate(&rpdev->dev);
> > > > +}
> > > > +
> > > > +static int imx_rpmsg_endpoint_probe(struct rpmsg_device *rpdev) {
> > >
> > > Where does the rpmsg_device come from? Usually there is a call to
> > > rpmsg_register_device() and I don't see it anywhere in this
> > > patchset. I also don't see a link to the remote processor. I can't
> > > continue with this set for as long as I don't have this information.
> > >
> >
> > It is in the function below named imx_of_rpmsg_register_rpdriver.
> >
>
> The function below calls register_rpmsg_driver(), not rpmsg_register_device().
> I still don't know where @rpdev comes from.
>
The rpdev device is created by the rpmsg bus driver. On i.MX platforms, this is handled by the virtio_rpmsg_bus driver.
When the remote firmware sends a channel announcement, the bus driver creates the corresponding rpdev device.
This patch implements the driver for the interested rpdev device.
Thanks,
Shenwei
> > Thanks,
> > Shenwei
> >
> > > > +
> > > > +static int imx_of_rpmsg_register_rpdriver(struct device_node *channel,
> > > > + struct device *dev, int idx) {
> > > > + struct imx_rpmsg_driver_data *driver_data;
> > > > + struct imx_rpmsg_driver *rp_driver;
> > > > + struct rpmsg_device_id *rpdev_id;
> > > > +
> > > > + rpdev_id = devm_kzalloc(dev, sizeof(*rpdev_id) * 2, GFP_KERNEL);
> > > > + if (!rpdev_id)
> > > > + return -ENOMEM;
> > > > +
> > > > + strscpy(rpdev_id[0].name, channel_device_map[idx][0],
> > > > + RPMSG_NAME_SIZE);
> > > > +
> > > > + rp_driver = devm_kzalloc(dev, sizeof(*rp_driver), GFP_KERNEL);
> > > > + if (!rp_driver)
> > > > + return -ENOMEM;
> > > > +
> > > > + driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL);
> > > > + if (!driver_data)
> > > > + return -ENOMEM;
> > > > +
> > > > + driver_data->rproc_name = dev->of_node->name;
> > > > + driver_data->channel_node = channel;
> > > > + driver_data->map_idx = idx;
> > > > +
> > > > + rp_driver->rpdrv.drv.name = channel_device_map[idx][0];
> > > > + rp_driver->rpdrv.id_table = rpdev_id;
> > > > + rp_driver->rpdrv.probe = imx_rpmsg_endpoint_probe;
> > > > + rp_driver->rpdrv.remove = imx_rpmsg_endpoint_remove;
> > > > + rp_driver->rpdrv.callback = imx_rpmsg_endpoint_cb;
> > > > + rp_driver->driver_data = driver_data;
> > > > +
> > > > + register_rpmsg_driver(&rp_driver->rpdrv);
> > > > +
> > > > + return 0;
> > > > +}
More information about the linux-arm-kernel
mailing list