mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
ARM: imx: register reset controller from a platform driver
Starting with commit6b2117ad65
("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:6b2117ad65
("of: property: fw_devlink: Add support for "resets" and "pwms"") Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Saravana Kannan <saravanak@google.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
This commit is contained in:
parent
3518441dda
commit
a1467faa10
1 changed files with 31 additions and 9 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <linux/iopoll.h>
|
#include <linux/iopoll.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
#include <linux/reset-controller.h>
|
#include <linux/reset-controller.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <asm/smp_plat.h>
|
#include <asm/smp_plat.h>
|
||||||
|
@ -81,11 +82,6 @@ static const struct reset_control_ops imx_src_ops = {
|
||||||
.reset = imx_src_reset_module,
|
.reset = imx_src_reset_module,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct reset_controller_dev imx_reset_controller = {
|
|
||||||
.ops = &imx_src_ops,
|
|
||||||
.nr_resets = ARRAY_SIZE(sw_reset_bits),
|
|
||||||
};
|
|
||||||
|
|
||||||
static void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
|
static void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
|
||||||
{
|
{
|
||||||
writel_relaxed(enable, gpc_base + offset);
|
writel_relaxed(enable, gpc_base + offset);
|
||||||
|
@ -177,10 +173,6 @@ void __init imx_src_init(void)
|
||||||
src_base = of_iomap(np, 0);
|
src_base = of_iomap(np, 0);
|
||||||
WARN_ON(!src_base);
|
WARN_ON(!src_base);
|
||||||
|
|
||||||
imx_reset_controller.of_node = np;
|
|
||||||
if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
|
|
||||||
reset_controller_register(&imx_reset_controller);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* force warm reset sources to generate cold reset
|
* force warm reset sources to generate cold reset
|
||||||
* for a more reliable restart
|
* for a more reliable restart
|
||||||
|
@ -214,3 +206,33 @@ void __init imx7_src_init(void)
|
||||||
if (!gpc_base)
|
if (!gpc_base)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id imx_src_dt_ids[] = {
|
||||||
|
{ .compatible = "fsl,imx51-src" },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
static int imx_src_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct reset_controller_dev *rcdev;
|
||||||
|
|
||||||
|
rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL);
|
||||||
|
if (!rcdev)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
rcdev->ops = &imx_src_ops;
|
||||||
|
rcdev->dev = &pdev->dev;
|
||||||
|
rcdev->of_node = pdev->dev.of_node;
|
||||||
|
rcdev->nr_resets = ARRAY_SIZE(sw_reset_bits);
|
||||||
|
|
||||||
|
return devm_reset_controller_register(&pdev->dev, rcdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct platform_driver imx_src_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "imx-src",
|
||||||
|
.of_match_table = imx_src_dt_ids,
|
||||||
|
},
|
||||||
|
.probe = imx_src_probe,
|
||||||
|
};
|
||||||
|
builtin_platform_driver(imx_src_driver);
|
||||||
|
|
Loading…
Add table
Reference in a new issue