[PATCH v2 1/2] power: pmic: rk8xx: Support sysreset shutdown method
Michal Suchánek
msuchanek at suse.de
Sat Jul 16 16:34:12 CEST 2022
On Fri, Jul 15, 2022 at 07:18:07PM +0200, Michal Suchánek wrote:
> On Fri, Jul 15, 2022 at 12:10:47PM -0500, Chris Morgan wrote:
> > On Thu, Jul 07, 2022 at 10:41:34AM +0200, Michal Suchánek wrote:
> > > Hello,
> > >
> > > this causes regression on pinebook pro:
> > >
> > > resetting ...
> > > System reset not supported on this platform
> > > ### ERROR ### Please RESET the board ###
> > >
> > > Is there something missing in the DT for this board?
> > >
> > > Or perhaps a fallback should be provided in absence of the PMIC?
> > >
> > > Thanks
> > >
> > > Michal
> >
> > Sorry Michal, I was busy traveling and then came down with a pretty bad
> > cold, so I've been a bit away from things. Are you getting this error
> > when you attempt to reset or to poweroff the Pinebook Pro from U-Boot?
> >
> > I tested the code on my RK817, but a cursory reading of the datasheet
> > suggests every rk8xx known so far should be able to shutdown using the
> > two methods added here. I'm wondering if there is perhaps a configuration
> > issue we need to account for, as this routine is only shutting down the
> > PMIC and not restarting it.
>
> This is trying to restart the system from u-boot.
>
> The walk function *seems* to try all methods of all reset providers but
> maybe there is some catch there.
After adding debug prints it looks like no sysreset uclass is found
anymore after the patch:
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index 279b087d16..4a144e517f 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -5,6 +5,7 @@
*/
#define LOG_CATEGORY UCLASS_SYSRESET
+#define DEBUG
#include <common.h>
#include <command.h>
@@ -53,6 +54,18 @@ int sysreset_get_last(struct udevice *dev)
return ops->get_last(dev);
}
+static inline const char * sysreset_to_str(enum sysreset_t reset)
+{
+ switch (reset) {
+ case SYSRESET_WARM: return "warm restart";
+ case SYSRESET_COLD: return "cold restart";
+ case SYSRESET_POWER: return "power cycle";
+ case SYSRESET_POWER_OFF: return "power off";
+ case SYSRESET_COUNT: break;
+ }
+ return "unknown";
+}
+
int sysreset_walk(enum sysreset_t type)
{
struct udevice *dev;
@@ -62,9 +75,14 @@ int sysreset_walk(enum sysreset_t type)
for (uclass_first_device(UCLASS_SYSRESET, &dev);
dev;
uclass_next_device(&dev)) {
+ debug("trying reset %s on %s...", dev->name,
+ sysreset_to_str(type));
ret = sysreset_request(dev, type);
- if (ret == -EINPROGRESS)
+ if (ret == -EINPROGRESS) {
+ debug("done\n");
break;
+ }
+ debug("\n");
}
type++;
}
--
2.36.1
With sysreset patch reverted
Hit any key to stop autoboot: 0
=> reset
resetting ...
trying reset sysreset on cold restart...
U-Boot TPL 2022.07-00027-gd9cc607b5e-dirty (Jul 16 2022 - 16:15:27)
With sysreset support included
Hit any key to stop autoboot: 0
=> reset
resetting ...
System reset not supported on this platform
### ERROR ### Please RESET the board ###
The error is printed here:
void sysreset_walk_halt(enum sysreset_t type)
{
int ret;
ret = sysreset_walk(type);
/* Wait for the reset to take effect */
if (ret == -EINPROGRESS)
mdelay(100);
/* Still no reset? Give up */
if (spl_phase() <= PHASE_SPL)
log_err("no sysreset\n");
else
log_err("System reset not supported on this platform\n");
hang();
}
More information about the U-Boot
mailing list