[PATCH] power: pmic: rk8xx: Workaround pmic failure when probed before relocation

Michal Suchánek msuchanek at suse.de
Sat Aug 6 21:54:15 CEST 2022


On Sat, Aug 06, 2022 at 12:21:29PM -0600, Simon Glass wrote:
> Hi Michal,
> 
> On Fri, 5 Aug 2022 at 14:07, Michal Suchánek <msuchanek at suse.de> wrote:
> >
> > On Fri, Aug 05, 2022 at 10:48:26AM -0600, Simon Glass wrote:
> > > Hi Michal,
> > >
> > > On Fri, 5 Aug 2022 at 05:32, Michal Suchanek <msuchanek at suse.de> wrote:
> > > >
> > > > When the sysreset is added as child of the pmic the pmic is probed
> > > > before relocation. That probe fails, and subsequent attempts to probe
> > > > after reloaction fail as well.
> > > >
> > > > As a workaround do not bind the sysreset before relocation.
> > > >
> > > > Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> > > > ---
> > > >  drivers/power/pmic/rk8xx.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
> > > > index a239a18674..d12263c4f2 100644
> > > > --- a/drivers/power/pmic/rk8xx.c
> > > > +++ b/drivers/power/pmic/rk8xx.c
> > > > @@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
> > > >
> > > >  static int rk8xx_bind(struct udevice *dev)
> > > >  {
> > > > -       if (CONFIG_IS_ENABLED(SYSRESET)) {
> > > > +       if (CONFIG_IS_ENABLED(SYSRESET) && (gd->flags & GD_FLG_RELOC)) {
> > > >                 device_bind_driver(dev, "rk8xx_sysreset",
> > > >                                    "rk8xx_sysreset", NULL);
> > > >         }
> > > > --
> > > > 2.37.1
> > > >
> > >
> > > I think it is OK to avoid starting a device before relocation, or make
> > > that device do something different. I really don't like the binding
> > > being optional though...we have the 'u-boot,dm-pre-reloc' for that.
> >
> > So perhaps the flag should be dropped from rk8xx then.
> >
> > >
> > > But missing from your commit message is exactly what fails?
> >
> > The pmic is an i2c device, all i2c tranferss fail if initialized
> > pre-relocation. I supect it's the i2c bus that fails if initialized
> > before reloc - the regulatorss that share the i2c bus also report i2c
> > transfer failure.
> 
> OK, I wonder why i2c fails? It works OK on the rockchip devices I'm
> familiar with, e.g. chromebooks.

It worksss fine here as well - so long as it is not initialized before
relocation.

Thanks

Michal


More information about the U-Boot mailing list