Skip to content

Commit 5080cf6

Browse files
LaurentiuM1234Shawn Guo
authored andcommitted
bus: imx-aipstz: allow creating pdevs for child buses
devm_of_platform_populate() passes a NULL as the bus OF match table to the underlying of_platform_populate(), meaning child bus devices of the AIPSTZ bridge will not have its children devices created. Since some SoCs (e.g. i.MX8MP) use this particular setup (e.g. SPBA bus, which is a child of AIPSTZ5 and has multiple child nodes), the driver needs to support it. Therefore, replace devm_of_platform_populate() with of_platform_populate() and pass a reference to the bus OF match table to it. For now, the only possible child buses are simple buses. Since the usage of devres is dropped, the complementary operation of of_platform_populate() needs to be called during the driver's removal. Signed-off-by: Laurentiu Mihalcea <[email protected]> Fixes: 796cba2 ("bus: add driver for IMX AIPSTZ bridge") Reported-by: Alexander Stein <[email protected]> Closes: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t Tested-by: Alexander Stein <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 486225f commit 5080cf6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/bus/imx-aipstz.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
2626
writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
2727
}
2828

29+
static const struct of_device_id imx_aipstz_match_table[] = {
30+
{ .compatible = "simple-bus", },
31+
{ }
32+
};
33+
2934
static int imx_aipstz_probe(struct platform_device *pdev)
3035
{
3136
struct imx_aipstz_data *data;
@@ -49,7 +54,13 @@ static int imx_aipstz_probe(struct platform_device *pdev)
4954
pm_runtime_set_active(&pdev->dev);
5055
devm_pm_runtime_enable(&pdev->dev);
5156

52-
return devm_of_platform_populate(&pdev->dev);
57+
return of_platform_populate(pdev->dev.of_node, imx_aipstz_match_table,
58+
NULL, &pdev->dev);
59+
}
60+
61+
static void imx_aipstz_remove(struct platform_device *pdev)
62+
{
63+
of_platform_depopulate(&pdev->dev);
5364
}
5465

5566
static int imx_aipstz_runtime_resume(struct device *dev)
@@ -83,6 +94,7 @@ MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
8394

8495
static struct platform_driver imx_aipstz_of_driver = {
8596
.probe = imx_aipstz_probe,
97+
.remove = imx_aipstz_remove,
8698
.driver = {
8799
.name = "imx-aipstz",
88100
.of_match_table = imx_aipstz_of_ids,

0 commit comments

Comments
 (0)