Skip to content

Commit a1467fa

Browse files
pH5Shawn Guo
authored andcommitted
ARM: imx: register reset controller from a platform driver
Starting with commit 6b2117a ("of: property: fw_devlink: Add support for "resets" and "pwms""), the imx-drm driver fails to load due to forever dormant devlinks to the reset-controller node. This node was never associated with a struct device. Add a platform device to allow fw_devnode to activate the devlinks. Fixes: 6b2117a ("of: property: fw_devlink: Add support for "resets" and "pwms"") Signed-off-by: Philipp Zabel <[email protected]> Tested-by: Fabio Estevam <[email protected]> Reviewed-by: Saravana Kannan <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 3518441 commit a1467fa

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

arch/arm/mach-imx/src.c

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/iopoll.h>
1010
#include <linux/of.h>
1111
#include <linux/of_address.h>
12+
#include <linux/platform_device.h>
1213
#include <linux/reset-controller.h>
1314
#include <linux/smp.h>
1415
#include <asm/smp_plat.h>
@@ -81,11 +82,6 @@ static const struct reset_control_ops imx_src_ops = {
8182
.reset = imx_src_reset_module,
8283
};
8384

84-
static struct reset_controller_dev imx_reset_controller = {
85-
.ops = &imx_src_ops,
86-
.nr_resets = ARRAY_SIZE(sw_reset_bits),
87-
};
88-
8985
static void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
9086
{
9187
writel_relaxed(enable, gpc_base + offset);
@@ -177,10 +173,6 @@ void __init imx_src_init(void)
177173
src_base = of_iomap(np, 0);
178174
WARN_ON(!src_base);
179175

180-
imx_reset_controller.of_node = np;
181-
if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
182-
reset_controller_register(&imx_reset_controller);
183-
184176
/*
185177
* force warm reset sources to generate cold reset
186178
* for a more reliable restart
@@ -214,3 +206,33 @@ void __init imx7_src_init(void)
214206
if (!gpc_base)
215207
return;
216208
}
209+
210+
static const struct of_device_id imx_src_dt_ids[] = {
211+
{ .compatible = "fsl,imx51-src" },
212+
{ /* sentinel */ }
213+
};
214+
215+
static int imx_src_probe(struct platform_device *pdev)
216+
{
217+
struct reset_controller_dev *rcdev;
218+
219+
rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL);
220+
if (!rcdev)
221+
return -ENOMEM;
222+
223+
rcdev->ops = &imx_src_ops;
224+
rcdev->dev = &pdev->dev;
225+
rcdev->of_node = pdev->dev.of_node;
226+
rcdev->nr_resets = ARRAY_SIZE(sw_reset_bits);
227+
228+
return devm_reset_controller_register(&pdev->dev, rcdev);
229+
}
230+
231+
static struct platform_driver imx_src_driver = {
232+
.driver = {
233+
.name = "imx-src",
234+
.of_match_table = imx_src_dt_ids,
235+
},
236+
.probe = imx_src_probe,
237+
};
238+
builtin_platform_driver(imx_src_driver);

0 commit comments

Comments
 (0)