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 E71F7C19F2D for ; Sat, 6 Aug 2022 19:54:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E53584030; Sat, 6 Aug 2022 21:54:22 +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="rAx57w24"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="gkuwOWxt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3BF0F8415E; Sat, 6 Aug 2022 21:54:20 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (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 E3B8E8402F for ; Sat, 6 Aug 2022 21:54:17 +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-out2.suse.de (Postfix) with ESMTP id A5D811F982; Sat, 6 Aug 2022 19:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659815657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HgFak6EZXRkqroTum+GZM/RitKWYP8HeYraXf3GoBI=; b=rAx57w24n0hFUwJCm4cs5Ist1ucdOFOfBbl15M/f8VOAKj/UIYHfw71PO5bGxAVbVrqiYw GrTDq6MW2Zl8RR3rG1kWFmomdB8uASxoA9W4Rl2jrRr26geSLcCD/VqQgB4XgRmyMDo8Uo 9m9eLTqj7ssWZPjd8V9Wq2Rd6T0o0Ts= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659815657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HgFak6EZXRkqroTum+GZM/RitKWYP8HeYraXf3GoBI=; b=gkuwOWxtJXQz3dfkPmgzNufr3Y60XC0GP1TA7dbNQhhhWxgxU5F1pYFMVQnw+rlw9DdFAx D9mfae1TG91siWBA== 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 0F8472C141; Sat, 6 Aug 2022 19:54:17 +0000 (UTC) Date: Sat, 6 Aug 2022 21:54:15 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Simon Glass Cc: U-Boot Mailing List , Jaehoon Chung , Chris Morgan , Kever Yang Subject: Re: [PATCH] power: pmic: rk8xx: Workaround pmic failure when probed before relocation Message-ID: <20220806195415.GI17705@kitsune.suse.cz> References: <20220805113219.7316-1-msuchanek@suse.de> <20220805200656.GH17705@kitsune.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 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 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 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 > > > > --- > > > > 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