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 C0C3EC43334 for ; Mon, 25 Jul 2022 07:48:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4E9D8414F; Mon, 25 Jul 2022 09:48:27 +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="z2mE231A"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="uXmexYvI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D10A28413F; Mon, 25 Jul 2022 09:48:26 +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 5287084072 for ; Mon, 25 Jul 2022 09:48:24 +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 1F21B34BC6; Mon, 25 Jul 2022 07:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658735304; 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=5/Lwsr/FHx7X7+2FCrncArYRMlZGaMsobflHGhQdHAw=; b=z2mE231AqFDqdi2n5N6uaBP9g+VwKVvtnmmlsykxkAwIXc4j0dEFnAsmmnARU/3+PaXk43 kOErDSN5FKbnXKGbyRfG10aUJcBjtPX21SEc6DhLGxN5WXRaWVJ/thOorw/axM4Zk8pABf NNsd7PVt4vMAISGynlTyRYhIWBdKYtM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658735304; 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=5/Lwsr/FHx7X7+2FCrncArYRMlZGaMsobflHGhQdHAw=; b=uXmexYvIqusZFrhuhyiP4TmDpSUm/GfsqJyPc/w1bOPC1L9p4ehEqL1f+SlXM82jrncZ0j XZ0UAoeh4HLdAMBA== 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 784782C14F; Mon, 25 Jul 2022 07:48:23 +0000 (UTC) Date: Mon, 25 Jul 2022 09:48:22 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Simon Glass Cc: Chris Morgan , U-Boot Mailing List , Kever Yang , Jaehoon Chung , Chris Morgan Subject: Re: [PATCH] Revert "power: pmic: rk8xx: Support sysreset shutdown method" Message-ID: <20220725074822.GK17705@kitsune.suse.cz> References: <20220722172421.30099-1-macroalpha82@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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 wrote: > > > > From: Chris Morgan > > > > 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 > > --- > > 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@1b to pmic Bound pmic@1b to pmic pmic@1b sysresets: Binding rk8xx_sysreset to sysreset Bound rk8xx_sysreset to sysreset rk8xx_sysreset sysresets:Looking for pmu-clock-controller@ff750000 Looking for pmu-clock-controller@ff750000 - result for pmu-clock-controller@ff750000: (none) (ret=-19) - result for pmu-clock-controller@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@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