Skip to content

Commit 59983c7

Browse files
stephan-ghandersson
authored andcommitted
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
1 parent 358b586 commit 59983c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/remoteproc/qcom_q6v5_mss.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ struct q6v5 {
218218
struct qcom_rproc_subdev smd_subdev;
219219
struct qcom_rproc_ssr ssr_subdev;
220220
struct qcom_sysmon *sysmon;
221+
struct platform_device *bam_dmux;
221222
bool need_mem_protection;
222223
bool has_alt_reset;
223224
bool has_mba_logs;
@@ -1849,6 +1850,7 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc)
18491850
static int q6v5_probe(struct platform_device *pdev)
18501851
{
18511852
const struct rproc_hexagon_res *desc;
1853+
struct device_node *node;
18521854
struct q6v5 *qproc;
18531855
struct rproc *rproc;
18541856
const char *mba_image;
@@ -1992,6 +1994,10 @@ static int q6v5_probe(struct platform_device *pdev)
19921994
if (ret)
19931995
goto remove_sysmon_subdev;
19941996

1997+
node = of_get_compatible_child(pdev->dev.of_node, "qcom,bam-dmux");
1998+
qproc->bam_dmux = of_platform_device_create(node, NULL, &pdev->dev);
1999+
of_node_put(node);
2000+
19952001
return 0;
19962002

19972003
remove_sysmon_subdev:
@@ -2013,6 +2019,8 @@ static int q6v5_remove(struct platform_device *pdev)
20132019
struct q6v5 *qproc = platform_get_drvdata(pdev);
20142020
struct rproc *rproc = qproc->rproc;
20152021

2022+
if (qproc->bam_dmux)
2023+
of_platform_device_destroy(&qproc->bam_dmux->dev, NULL);
20162024
rproc_del(rproc);
20172025

20182026
qcom_q6v5_deinit(&qproc->q6v5);

0 commit comments

Comments
 (0)