Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

remoteproc: qcom_q6v5_mss: Create platform device for BAM-DMUX

The modem remoteproc on older Qualcomm SoCs (e.g. MSM8916 and MSM8974)
implements the BAM-DMUX protocol to allow access to the network data
channels of the modem. The hardware/firmware resources required to
implement the BAM-DMUX driver are described in an extra node in the
device tree (with the compatible "qcom,bam-dmux").

This node logically belongs below the modem remoteproc, so that both
control interfaces (rpmsg_wwan_ctrl) and network interfaces (bam_dmux)
have a common parent.

Unlike other child devices of the modem remoteproc, the bam-dmux device
currently does not follow the state of the remoteproc (i.e. it is not
added/removed when the remoteproc is started/stopped). However, this is
an implementation detail of the bam_dmux driver in Linux that might
change in the future.

To be flexible for future changes, create a standard platform device
specifically only for "qcom,bam-dmux", rather than populating all child
nodes. This is also more consistent with the way the other child nodes
are handled in the driver.

Note: of_platform_device_create() and of_node_put() have NULL-checks
internally, so there is no need to check if the "qcom,bam-dmux" node
actually exists in the device tree.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220228225400.146555-2-stephan@gerhold.net

authored by

Stephan Gerhold and committed by
Bjorn Andersson
59983c74 358b586f

+8
+8
drivers/remoteproc/qcom_q6v5_mss.c
··· 218 218 struct qcom_rproc_subdev smd_subdev; 219 219 struct qcom_rproc_ssr ssr_subdev; 220 220 struct qcom_sysmon *sysmon; 221 + struct platform_device *bam_dmux; 221 222 bool need_mem_protection; 222 223 bool has_alt_reset; 223 224 bool has_mba_logs; ··· 1850 1849 static int q6v5_probe(struct platform_device *pdev) 1851 1850 { 1852 1851 const struct rproc_hexagon_res *desc; 1852 + struct device_node *node; 1853 1853 struct q6v5 *qproc; 1854 1854 struct rproc *rproc; 1855 1855 const char *mba_image; ··· 1994 1992 if (ret) 1995 1993 goto remove_sysmon_subdev; 1996 1994 1995 + node = of_get_compatible_child(pdev->dev.of_node, "qcom,bam-dmux"); 1996 + qproc->bam_dmux = of_platform_device_create(node, NULL, &pdev->dev); 1997 + of_node_put(node); 1998 + 1997 1999 return 0; 1998 2000 1999 2001 remove_sysmon_subdev: ··· 2019 2013 struct q6v5 *qproc = platform_get_drvdata(pdev); 2020 2014 struct rproc *rproc = qproc->rproc; 2021 2015 2016 + if (qproc->bam_dmux) 2017 + of_platform_device_destroy(&qproc->bam_dmux->dev, NULL); 2022 2018 rproc_del(rproc); 2023 2019 2024 2020 qcom_q6v5_deinit(&qproc->q6v5);