diff mbox series

pmdomain: imx: Make imx pgc power domain also set the fwnode

Message ID 20231020185949.537083-1-pengfei.li_1@nxp.com (mailing list archive)
State New, archived
Headers show
Series pmdomain: imx: Make imx pgc power domain also set the fwnode | expand

Commit Message

Pengfei Li Oct. 20, 2023, 6:59 p.m. UTC
Currently, The imx pgc power domain doesn't set the fwnode
pointer, which results in supply regulator device can't get
consumer imx pgc power domain device from fwnode when creating
a link.

This causes the driver core to instead try to create a link
between the parent gpc device of imx pgc power domain device and
supply regulator device. However, at this point, the gpc device
has already been bound, and the link creation will fail. So adding
the fwnode pointer to the imx pgc power domain device will fix
this issue.

Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>
---
 drivers/pmdomain/imx/gpc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Fabio Estevam Oct. 20, 2023, 3:07 a.m. UTC | #1
Hi Pengfei,

On Fri, Oct 20, 2023 at 12:00 AM Pengfei Li <pengfei.li_1@nxp.com> wrote:
>
> Currently, The imx pgc power domain doesn't set the fwnode
> pointer, which results in supply regulator device can't get
> consumer imx pgc power domain device from fwnode when creating
> a link.
>
> This causes the driver core to instead try to create a link
> between the parent gpc device of imx pgc power domain device and
> supply regulator device. However, at this point, the gpc device
> has already been bound, and the link creation will fail. So adding
> the fwnode pointer to the imx pgc power domain device will fix
> this issue.
>
> Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>

Please see this thread:
https://lore.kernel.org/linux-arm-kernel/CAPDyKFrSzepC0c7-XGeGcHSsfpEGpF0a9ATGpemxvcc8mtL86g@mail.gmail.com/T/
Emil Kronborg Andersen Oct. 26, 2023, 7:53 a.m. UTC | #2
On Sat, Oct 21, 2023 at 02:59 +0800, Pengfei Li wrote:
> Currently, The imx pgc power domain doesn't set the fwnode
> pointer, which results in supply regulator device can't get
> consumer imx pgc power domain device from fwnode when creating
> a link.
> 
> This causes the driver core to instead try to create a link
> between the parent gpc device of imx pgc power domain device and
> supply regulator device. However, at this point, the gpc device
> has already been bound, and the link creation will fail. So adding
> the fwnode pointer to the imx pgc power domain device will fix
> this issue.
> 
> Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>
> ---
>  drivers/pmdomain/imx/gpc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
> index 114f44ca07dd..7d81e3171d39 100644
> --- a/drivers/pmdomain/imx/gpc.c
> +++ b/drivers/pmdomain/imx/gpc.c
> @@ -497,6 +497,7 @@ static int imx_gpc_probe(struct platform_device *pdev)
>  
>  			pd_pdev->dev.parent = &pdev->dev;
>  			pd_pdev->dev.of_node = np;
> +			pd_pdev->dev.fwnode = of_fwnode_handle(np);
>  
>  			ret = platform_device_add(pd_pdev);
>  			if (ret) {
> -- 
> 2.34.1

I originally proposed [1] to address errors like the one below:

[    1.039830] imx-gpc 20dc000.gpc: Failed to create device link (0x180) with 20c8000.anatop:regulator-vddpu

I tested this patch on an i.MX 6Quad board, and it also fixes these
errors.

Tested-by: Emil Kronborg <emil.kronborg@protonmail.com>

[1]
https://lore.kernel.org/linux-arm-kernel/20231012132214.257207-1-emkan@prevas.dk/T/

Best regards,
Emil
Ulf Hansson Oct. 26, 2023, 2:26 p.m. UTC | #3
On Thu, 26 Oct 2023 at 09:54, Emil Kronborg Andersen <emkan@prevas.dk> wrote:
>
> On Sat, Oct 21, 2023 at 02:59 +0800, Pengfei Li wrote:
> > Currently, The imx pgc power domain doesn't set the fwnode
> > pointer, which results in supply regulator device can't get
> > consumer imx pgc power domain device from fwnode when creating
> > a link.
> >
> > This causes the driver core to instead try to create a link
> > between the parent gpc device of imx pgc power domain device and
> > supply regulator device. However, at this point, the gpc device
> > has already been bound, and the link creation will fail. So adding
> > the fwnode pointer to the imx pgc power domain device will fix
> > this issue.
> >
> > Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>
> > ---
> >  drivers/pmdomain/imx/gpc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
> > index 114f44ca07dd..7d81e3171d39 100644
> > --- a/drivers/pmdomain/imx/gpc.c
> > +++ b/drivers/pmdomain/imx/gpc.c
> > @@ -497,6 +497,7 @@ static int imx_gpc_probe(struct platform_device *pdev)
> >
> >                       pd_pdev->dev.parent = &pdev->dev;
> >                       pd_pdev->dev.of_node = np;
> > +                     pd_pdev->dev.fwnode = of_fwnode_handle(np);
> >
> >                       ret = platform_device_add(pd_pdev);
> >                       if (ret) {
> > --
> > 2.34.1
>
> I originally proposed [1] to address errors like the one below:
>
> [    1.039830] imx-gpc 20dc000.gpc: Failed to create device link (0x180) with 20c8000.anatop:regulator-vddpu
>
> I tested this patch on an i.MX 6Quad board, and it also fixes these
> errors.
>
> Tested-by: Emil Kronborg <emil.kronborg@protonmail.com>
>
> [1]
> https://lore.kernel.org/linux-arm-kernel/20231012132214.257207-1-emkan@prevas.dk/T/
>
> Best regards,
> Emil

Okay, so I decided to pick this one for fixes, instead of [1] as it
looks like it's ready to be applied as is. I added a fixes/stable tag
to it too.

Kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
index 114f44ca07dd..7d81e3171d39 100644
--- a/drivers/pmdomain/imx/gpc.c
+++ b/drivers/pmdomain/imx/gpc.c
@@ -497,6 +497,7 @@  static int imx_gpc_probe(struct platform_device *pdev)
 
 			pd_pdev->dev.parent = &pdev->dev;
 			pd_pdev->dev.of_node = np;
+			pd_pdev->dev.fwnode = of_fwnode_handle(np);
 
 			ret = platform_device_add(pd_pdev);
 			if (ret) {