* [PATCH] ARM: imx: register reset controller from a platform driver
@ 2021-10-05 10:06 Philipp Zabel
2021-10-05 11:54 ` Fabio Estevam
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Philipp Zabel @ 2021-10-05 10:06 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Shawn Guo, kernel, Saravana Kannan, Fabio Estevam
Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
arch/arm/mach-imx/src.c | 40 +++++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index 95fd1fbb0826..59a8e8cc4469 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -9,6 +9,7 @@
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/platform_device.h>
#include <linux/reset-controller.h>
#include <linux/smp.h>
#include <asm/smp_plat.h>
@@ -81,11 +82,6 @@ static const struct reset_control_ops imx_src_ops = {
.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)
{
writel_relaxed(enable, gpc_base + offset);
@@ -177,10 +173,6 @@ void __init imx_src_init(void)
src_base = of_iomap(np, 0);
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
* for a more reliable restart
@@ -214,3 +206,33 @@ void __init imx7_src_init(void)
if (!gpc_base)
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);
base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx: register reset controller from a platform driver
2021-10-05 10:06 [PATCH] ARM: imx: register reset controller from a platform driver Philipp Zabel
@ 2021-10-05 11:54 ` Fabio Estevam
2021-10-05 17:33 ` Saravana Kannan
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2021-10-05 11:54 UTC (permalink / raw)
To: Philipp Zabel
Cc: moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
Shawn Guo, Sascha Hauer, Saravana Kannan
Hi Philipp,
On Tue, Oct 5, 2021 at 7:06 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
imx-drm can probe again after applying your patch, thanks:
Tested-by: Fabio Estevam <festevam@gmail.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx: register reset controller from a platform driver
2021-10-05 10:06 [PATCH] ARM: imx: register reset controller from a platform driver Philipp Zabel
2021-10-05 11:54 ` Fabio Estevam
@ 2021-10-05 17:33 ` Saravana Kannan
2021-10-06 7:23 ` Geert Uytterhoeven
2021-10-15 1:39 ` Shawn Guo
3 siblings, 0 replies; 6+ messages in thread
From: Saravana Kannan @ 2021-10-05 17:33 UTC (permalink / raw)
To: Philipp Zabel; +Cc: linux-arm-kernel, Shawn Guo, kernel, Fabio Estevam
On Tue, Oct 5, 2021 at 3:06 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> arch/arm/mach-imx/src.c | 40 +++++++++++++++++++++++++++++++---------
> 1 file changed, 31 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
> index 95fd1fbb0826..59a8e8cc4469 100644
> --- a/arch/arm/mach-imx/src.c
> +++ b/arch/arm/mach-imx/src.c
> @@ -9,6 +9,7 @@
> #include <linux/iopoll.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> +#include <linux/platform_device.h>
> #include <linux/reset-controller.h>
> #include <linux/smp.h>
> #include <asm/smp_plat.h>
> @@ -81,11 +82,6 @@ static const struct reset_control_ops imx_src_ops = {
> .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)
> {
> writel_relaxed(enable, gpc_base + offset);
> @@ -177,10 +173,6 @@ void __init imx_src_init(void)
> src_base = of_iomap(np, 0);
> 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
> * for a more reliable restart
> @@ -214,3 +206,33 @@ void __init imx7_src_init(void)
> if (!gpc_base)
> 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);
>
> base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
Reviewed-by: Saravana Kannan <saravanak@google.com>
-Saravana
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx: register reset controller from a platform driver
2021-10-05 10:06 [PATCH] ARM: imx: register reset controller from a platform driver Philipp Zabel
2021-10-05 11:54 ` Fabio Estevam
2021-10-05 17:33 ` Saravana Kannan
@ 2021-10-06 7:23 ` Geert Uytterhoeven
2021-10-06 8:11 ` Philipp Zabel
2021-10-15 1:39 ` Shawn Guo
3 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-10-06 7:23 UTC (permalink / raw)
To: Philipp Zabel
Cc: Linux ARM, Shawn Guo, Sascha Hauer, Saravana Kannan, Fabio Estevam
Hi Philipp,
On Tue, Oct 5, 2021 at 12:12 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
> Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Thanks for your patch!
Do you also need a "select RESET_CONTROLLER" somewhere for
this to work?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx: register reset controller from a platform driver
2021-10-06 7:23 ` Geert Uytterhoeven
@ 2021-10-06 8:11 ` Philipp Zabel
0 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2021-10-06 8:11 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux ARM, Shawn Guo, Sascha Hauer, Saravana Kannan, Fabio Estevam
Hi Geert,
On Wed, 2021-10-06 at 09:23 +0200, Geert Uytterhoeven wrote:
> Hi Philipp,
>
> On Tue, Oct 5, 2021 at 12:12 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>
> Thanks for your patch!
>
> Do you also need a "select RESET_CONTROLLER" somewhere for
> this to work?
Right now we have this:
config SOC_IMX...
select HAVE_IMX_SRC
config HAVE_IMX_SRC
select ARCH_HAS_RESET_CONTROLLER
config ARCH_HAS_RESET_CONTROLLER
bool
config RESET_CONTROLLER
default y if ARCH_HAS_RESET_CONTROLLER
So it is possible to manually disable RESET_CONTROLLER if the drivers
using those resets are not required.
regards
Philipp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx: register reset controller from a platform driver
2021-10-05 10:06 [PATCH] ARM: imx: register reset controller from a platform driver Philipp Zabel
` (2 preceding siblings ...)
2021-10-06 7:23 ` Geert Uytterhoeven
@ 2021-10-15 1:39 ` Shawn Guo
3 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2021-10-15 1:39 UTC (permalink / raw)
To: Philipp Zabel; +Cc: linux-arm-kernel, kernel, Saravana Kannan, Fabio Estevam
On Tue, Oct 05, 2021 at 12:06:18PM +0200, Philipp Zabel wrote:
> Starting with commit 6b2117ad65f1 ("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: 6b2117ad65f1 ("of: property: fw_devlink: Add support for "resets" and "pwms"")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Applied for 5.15 as a fix, thanks!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-15 1:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 10:06 [PATCH] ARM: imx: register reset controller from a platform driver Philipp Zabel
2021-10-05 11:54 ` Fabio Estevam
2021-10-05 17:33 ` Saravana Kannan
2021-10-06 7:23 ` Geert Uytterhoeven
2021-10-06 8:11 ` Philipp Zabel
2021-10-15 1:39 ` Shawn Guo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.