[PATCH] Revert "power: pmic: rk8xx: Support sysreset shutdown method"

Michal Suchánek msuchanek at suse.de
Mon Jul 25 09:48:22 CEST 2022


Hello,

On Sat, Jul 23, 2022 at 10:42:36AM -0600, Simon Glass wrote:
> Hi Chris,
> 
> On Fri, 22 Jul 2022 at 11:32, Chris Morgan <macroalpha82 at gmail.com> wrote:
> >
> > From: Chris Morgan <macromorgan at hotmail.com>
> >
> > This reverts commit ad607512f5757f4485968efd5bcf2c0245a8a235.
> >
> > It was found during extensive testing that this causes problems
> > on certain boards. I was able to test this patch on a second
> 
> Please can you describe the problem in the commit message?
> 
> > device (an Anbernic RG353) and it resulted in similar failures.
> >
> > Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
> > ---
> >  drivers/power/pmic/rk8xx.c | 50 +-------------------------------------
> >  1 file changed, 1 insertion(+), 49 deletions(-)
> >

I would like to know what's wrrong with the code, actually.

I replaced the registration with this code:

        debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);

        if (CONFIG_IS_ENABLED(SYSRESET)) {
                struct udevice *udev = NULL;

                printf("sysresets:");
                for (uclass_first_device(UCLASS_SYSRESET, &udev);
                                udev;
                                uclass_next_device(&udev)) {
                printf(" %s", udev->name);
                }
                printf("\n");

                device_bind_driver(dev, "rk8xx_sysreset", "rk8xx_sysreset", NULL);

                printf("sysresets:");
                for (uclass_first_device(UCLASS_SYSRESET, &udev);
                                udev;
                                uclass_next_device(&udev)) {
                printf(" %s", udev->name);
                }
                printf("\n");
        }

        children = pmic_bind_children(dev, regulators_node, pmic_children_info);

And added soem debug code to uclass:

 int uclass_bind_device(struct udevice *dev)
 {
        struct uclass *uc;
+       struct udevice *ud;
        int ret;
 
        uc = dev->uclass;
+       debug("Binding %s to %s", dev->name, uc->uc_drv->name);
+       list_for_each_entry(ud, &uc->dev_head, uclass_node)
+               debug(" %s", ud->name);
+       debug("\n");
        list_add_tail(&dev->uclass_node, &uc->dev_head);
+       debug("Bound %s to %s", dev->name, uc->uc_drv->name);
+       list_for_each_entry(ud, &uc->dev_head, uclass_node)
+               debug(" %s", ud->name);
+       debug("\n");
 


With this I get this output:

Binding pmic at 1b to pmic
Bound pmic at 1b to pmic pmic at 1b
sysresets:
Binding rk8xx_sysreset to sysreset
Bound rk8xx_sysreset to sysreset rk8xx_sysreset
sysresets:Looking for pmu-clock-controller at ff750000
Looking for pmu-clock-controller at ff750000
   - result for pmu-clock-controller at ff750000: (none) (ret=-19)
   - result for pmu-clock-controller at ff750000: (none) (ret=-19)

Binding DCDC_REG1 to regulator

So the sysreset is actually bound to the class, and then unbound again.
When does this happen?

Can also other devices get removed from their class and then failing to
get located by code that walks class lists?

Also how does the "Looking for pmu-clock-controller at ff750000" get
printed in the middle of the debug print?

Note that the debug print is sysresets:, then emty list of sysresets,
and then newline which is printed after the messages about pmu-clock.

Thanks

Michal


More information about the U-Boot mailing list