Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 421CEC43334 for ; Thu, 7 Jul 2022 08:41:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1ED7A8447E; Thu, 7 Jul 2022 10:41:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="gohJnTUH"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="92VCilR+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC3588447A; Thu, 7 Jul 2022 10:41:42 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0C8BD843E3 for ; Thu, 7 Jul 2022 10:41:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C729F2213A; Thu, 7 Jul 2022 08:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657183296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LcgMnA03mP9q45HO5II5y0BPR7DOPiIsbowVGjnFnVo=; b=gohJnTUHO9kAjqJd6EtHpup2ljvRBCELayQD4FJW0Ks/ysYtbdzsrZyoplY0NYZlnPRrCl YmS/Ediy+6aQtUUkTTJjdsUCDDRlMC20JLGt7xFIR9lJ38MJRk3BEvzR09PzoG58pEV7QD aUq9s3up+KddL6Cbhx9jGIdykOwk1ok= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657183296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LcgMnA03mP9q45HO5II5y0BPR7DOPiIsbowVGjnFnVo=; b=92VCilR+qHTrEpZ3q1RqrxqvAXlwUD34hNOAuqzh+EKuOkrBT4/PTZuULbd/xld3vy4RyC lxprs5Vapes0cxDA== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 12C082C141; Thu, 7 Jul 2022 08:41:36 +0000 (UTC) Date: Thu, 7 Jul 2022 10:41:34 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Chris Morgan Cc: u-boot@lists.denx.de, jh80.chung@samsung.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, Chris Morgan Subject: Re: [PATCH v2 1/2] power: pmic: rk8xx: Support sysreset shutdown method Message-ID: <20220707084134.GN17705@kitsune.suse.cz> References: <20220527181820.24948-1-macroalpha82@gmail.com> <20220527181820.24948-2-macroalpha82@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527181820.24948-2-macroalpha82@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 On Fri, May 27, 2022 at 01:18:19PM -0500, Chris Morgan wrote: > From: Chris Morgan > > Add support for sysreset shutdown for this PMIC. The values were pulled > from the various datasheets, but for now it has only been tested on > the rk817 (for an Odroid Go Advance). > > Signed-off-by: Chris Morgan > Reviewed-by: Jaehoon Chung > Reviewed-by: Kever Yang > --- > drivers/power/pmic/rk8xx.c | 50 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 49 insertions(+), 1 deletion(-) > > diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c > index 5f442fea68..1ffbecc02a 100644 > --- a/drivers/power/pmic/rk8xx.c > +++ b/drivers/power/pmic/rk8xx.c > @@ -6,10 +6,50 @@ > > #include > #include > +#include > #include > #include > #include > #include > +#include > + > +static int rk8xx_sysreset_request(struct udevice *dev, enum sysreset_t type) > +{ > + struct rk8xx_priv *priv = dev_get_priv(dev->parent); > + > + if (type != SYSRESET_POWER_OFF) > + return -EPROTONOSUPPORT; > + > + switch (priv->variant) { > + case RK805_ID: > + case RK808_ID: > + case RK816_ID: > + case RK818_ID: > + pmic_clrsetbits(dev->parent, REG_DEVCTRL, 0, BIT(0)); > + break; > + case RK809_ID: > + case RK817_ID: > + pmic_clrsetbits(dev->parent, RK817_REG_SYS_CFG3, 0, > + BIT(0)); > + break; > + default: > + printf("Unknown PMIC RK%x: Cannot shutdown\n", > + priv->variant); > + return -EPROTONOSUPPORT; > + }; > + > + return -EINPROGRESS; > +} > + > +static struct sysreset_ops rk8xx_sysreset_ops = { > + .request = rk8xx_sysreset_request, > +}; > + > +U_BOOT_DRIVER(rk8xx_sysreset) = { > + .name = "rk8xx_sysreset", > + .id = UCLASS_SYSRESET, > + .ops = &rk8xx_sysreset_ops, > +}; > > static struct reg_data rk817_init_reg[] = { > /* enable the under-voltage protection, > @@ -61,7 +101,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len) > static int rk8xx_bind(struct udevice *dev) > { > ofnode regulators_node; > - int children; > + int children, ret; > > regulators_node = dev_read_subnode(dev, "regulators"); > if (!ofnode_valid(regulators_node)) { > @@ -72,6 +112,14 @@ static int rk8xx_bind(struct udevice *dev) > > debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); > > + if (CONFIG_IS_ENABLED(SYSRESET)) { > + ret = device_bind_driver_to_node(dev, "rk8xx_sysreset", > + "rk8xx_sysreset", > + dev_ofnode(dev), NULL); > + if (ret) > + return ret; > + } > + > children = pmic_bind_children(dev, regulators_node, pmic_children_info); > if (!children) > debug("%s: %s - no child found\n", __func__, dev->name); > -- > 2.25.1 >