Skip to content

Commit d0b497d

Browse files
stephan-ghJassi Brar
authored andcommitted
mailbox: qcom-apcs-ipc: Assign OF node to clock controller child device
Currently, the child device for the clock controller inside the APCS block is created without any OF node assigned, so the drivers need to rely on the parent device for obtaining any resources. Add support for defining the clock controller inside a "clock-controller" subnode to break up circular dependencies between the mailbox and required parent clocks of the clock controller. For backwards compatibility, if the subnode is not defined, reuse the OF node from the parent device. Signed-off-by: Stephan Gerhold <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent c3c5138 commit d0b497d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/mailbox/qcom-apcs-ipc-mailbox.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,18 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
116116
}
117117

118118
if (apcs_data->clk_name) {
119-
apcs->clk = platform_device_register_data(&pdev->dev,
120-
apcs_data->clk_name,
121-
PLATFORM_DEVID_AUTO,
122-
NULL, 0);
119+
struct device_node *np = of_get_child_by_name(pdev->dev.of_node,
120+
"clock-controller");
121+
struct platform_device_info pdevinfo = {
122+
.parent = &pdev->dev,
123+
.name = apcs_data->clk_name,
124+
.id = PLATFORM_DEVID_AUTO,
125+
.fwnode = of_fwnode_handle(np) ?: pdev->dev.fwnode,
126+
.of_node_reused = !np,
127+
};
128+
129+
apcs->clk = platform_device_register_full(&pdevinfo);
130+
of_node_put(np);
123131
if (IS_ERR(apcs->clk))
124132
dev_err(&pdev->dev, "failed to register APCS clk\n");
125133
}

0 commit comments

Comments
 (0)