Message ID | 20220414122140.6114-3-allen-kh.cheng@mediatek.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | remoteproc: mediatek: allow different SCP firmware names | expand |
On Thu, 2022-04-14 at 20:21 +0800, Allen-KH Cheng wrote: > The SCP firmware blob differs between platforms and SoCs. We add > support in the SCP driver for reading the path of firmware file from > DT in order to allow these files to live in a generic file system > (or linux-firmware). > > The firmware-name property is optional and the code falls back to the > old filename if the property isn't present. > > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com> > Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Il 14/04/22 14:21, Allen-KH Cheng ha scritto: > The SCP firmware blob differs between platforms and SoCs. We add > support in the SCP driver for reading the path of firmware file from > DT in order to allow these files to live in a generic file system > (or linux-firmware). > > The firmware-name property is optional and the code falls back to the > old filename if the property isn't present. > > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com> > Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com> > --- > drivers/remoteproc/mtk_scp.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c > index ee6c4009586e..82813d74e829 100644 > --- a/drivers/remoteproc/mtk_scp.c > +++ b/drivers/remoteproc/mtk_scp.c > @@ -809,9 +809,14 @@ static int scp_probe(struct platform_device *pdev) > struct mtk_scp *scp; > struct rproc *rproc; > struct resource *res; > - char *fw_name = "scp.img"; > + const char *fw_name = "scp.img"; > int ret, i; > > + ret = of_property_read_string(pdev->dev.of_node, "firmware-name", > + &fw_name); Hello Allen, the remoteproc subsystem provides a helper for that, please use it: ret = rproc_of_parse_firmware(&pdev->dev, 0, &fw_name); > + if (ret < 0 && ret != -EINVAL) > + return ret; ... this check is necessary, so you can keep this one. Thanks, Angelo
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index ee6c4009586e..82813d74e829 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -809,9 +809,14 @@ static int scp_probe(struct platform_device *pdev) struct mtk_scp *scp; struct rproc *rproc; struct resource *res; - char *fw_name = "scp.img"; + const char *fw_name = "scp.img"; int ret, i; + ret = of_property_read_string(pdev->dev.of_node, "firmware-name", + &fw_name); + if (ret < 0 && ret != -EINVAL) + return ret; + rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp)); if (!rproc) return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
The SCP firmware blob differs between platforms and SoCs. We add support in the SCP driver for reading the path of firmware file from DT in order to allow these files to live in a generic file system (or linux-firmware). The firmware-name property is optional and the code falls back to the old filename if the property isn't present. Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com> --- drivers/remoteproc/mtk_scp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)