From patchwork Tue Nov 10 09:05:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 1397439 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=gd99CTb6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CVhqS6CqFz9sTv for ; Tue, 10 Nov 2020 20:08:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3DB37825C9; Tue, 10 Nov 2020 10:07:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com 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=ti.com header.i=@ti.com header.b="gd99CTb6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EAE2D8255A; Tue, 10 Nov 2020 10:06:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 827EC82523 for ; Tue, 10 Nov 2020 10:06:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=t-kristo@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AA96JiN078149; Tue, 10 Nov 2020 03:06:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1604999179; bh=AY0hfh03Q/7TKPn9ww6BcxgIOzW40DC1HZLhOtPtSb8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gd99CTb6RRQnJGnyrXf6n5xneOgW0PAsya/1sThiJhhV4ptOYrajV0YXBctjVw3R9 2y7o7zQx/nX9VntN+IR0SHGkrPCPAD8eiubqATcp1x1zg2U4gylBrrs5cfJ6nRBFZW l6dM7qa3xajqcK3dRlB1XmA4hUPnmK64P4EfVeis= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AA96Jii109562 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 10 Nov 2020 03:06:19 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 10 Nov 2020 03:06:19 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 10 Nov 2020 03:06:19 -0600 Received: from sokoban.bb.dnainternet.fi (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AA967ut079548; Tue, 10 Nov 2020 03:06:17 -0600 From: Tero Kristo To: , , CC: , Subject: [PATCH 06/26] clk: fix clock tree dump to properly dump out every registered clock Date: Tue, 10 Nov 2020 11:05:42 +0200 Message-ID: <20201110090602.2255-7-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110090602.2255-1-t-kristo@ti.com> References: <20201110090602.2255-1-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Some clocks are not associated to a DM node, so just parsing the DM is not enough. This is especially true for root clocks, which typically don't have any parents. Instead, fetch every registered UCLASS_CLK instance, and dump these out. Signed-off-by: Tero Kristo --- cmd/clk.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/cmd/clk.c b/cmd/clk.c index e3c3d2f9bb..0245b97136 100644 --- a/cmd/clk.c +++ b/cmd/clk.c @@ -18,11 +18,14 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) { int i, is_last; struct udevice *child; - struct clk *clkp; + struct clk *clkp, *parent; u32 rate; clkp = dev_get_clk_ptr(dev); if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) { + parent = clk_get_parent(clkp); + if (!IS_ERR(parent) && depth == -1) + return; depth++; rate = clk_get_rate(clkp); @@ -47,6 +50,9 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) } list_for_each_entry(child, &dev->child_head, sibling_node) { + if (child == dev) + continue; + is_last = list_is_last(&child->sibling_node, &dev->child_head); show_clks(child, depth, (last_flag << 1) | is_last); } @@ -54,14 +60,19 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) int __weak soc_clk_dump(void) { - struct udevice *root; + struct udevice *dev; + struct uclass *uc; + int ret; - root = dm_root(); - if (root) { - printf(" Rate Usecnt Name\n"); - printf("------------------------------------------\n"); - show_clks(root, -1, 0); - } + ret = uclass_get(UCLASS_CLK, &uc); + if (ret) + return ret; + + printf(" Rate Usecnt Name\n"); + printf("------------------------------------------\n"); + + uclass_foreach_dev(dev, uc) + show_clks(dev, -1, 0); return 0; }