From patchwork Wed Oct 23 20:28:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 2001275 X-Patchwork-Delegate: festevam@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XYgdM5K3lz1xw8 for ; Thu, 24 Oct 2024 07:29:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B45398919C; Wed, 23 Oct 2024 22:29:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 36A538919D; Wed, 23 Oct 2024 22:29:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) (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 F1CFD891A5 for ; Wed, 23 Oct 2024 22:29:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tharvey@gateworks.com Received: from syn-068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.95) (envelope-from ) id 1t3hya-001CNZ-09; Wed, 23 Oct 2024 20:29:04 +0000 From: Tim Harvey To: Heiko Schocher , Tom Rini , Peng Fan , Jaehoon Chung , u-boot@lists.denx.de Cc: linux-kernel@vger.kernel.org, Tim Harvey Subject: [PATCH 2/4] imx: power-domain: Convert to use livetree API for fdt access Date: Wed, 23 Oct 2024 13:28:53 -0700 Message-Id: <20241023202855.1571188-2-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241023202855.1571188-1-tharvey@gateworks.com> References: <20241023202855.1571188-1-tharvey@gateworks.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Convert to using livetree API functions. Without this if livetree is enabled (OF_LIVE) the imx8m-power-domain driver will (silently) fail to probe its children leaving you with no power domain support causing issues with certain devices. Signed-off-by: Tim Harvey Reviewed-by: Jaehoon Chung --- drivers/power/domain/imx8m-power-domain.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c index 8b6870c86463..c22fbe60675e 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -456,25 +456,22 @@ static int imx8m_power_domain_of_xlate(struct power_domain *power_domain, static int imx8m_power_domain_bind(struct udevice *dev) { - int offset; + ofnode subnode; const char *name; int ret = 0; - offset = dev_of_offset(dev); - for (offset = fdt_first_subnode(gd->fdt_blob, offset); offset > 0; - offset = fdt_next_subnode(gd->fdt_blob, offset)) { + ofnode_for_each_subnode(subnode, dev_ofnode(dev)) { /* Bind the subnode to this driver */ - name = fdt_get_name(gd->fdt_blob, offset, NULL); + name = ofnode_get_name(subnode); /* Descend into 'pgc' subnode */ if (!strstr(name, "power-domain")) { - offset = fdt_first_subnode(gd->fdt_blob, offset); - name = fdt_get_name(gd->fdt_blob, offset, NULL); + subnode = ofnode_first_subnode(subnode); + name = ofnode_get_name(subnode); } - ret = device_bind_with_driver_data(dev, dev->driver, name, dev->driver_data, - offset_to_ofnode(offset), + subnode, NULL); if (ret == -ENODEV) @@ -514,8 +511,7 @@ static int imx8m_power_domain_of_to_plat(struct udevice *dev) struct imx_pgc_domain_data *domain_data = (struct imx_pgc_domain_data *)dev_get_driver_data(dev); - pdata->resource_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "reg", -1); + pdata->resource_id = ofnode_read_u32_default(dev_ofnode(dev), "reg", -1); pdata->domain = &domain_data->domains[pdata->resource_id]; pdata->regs = domain_data->pgc_regs; pdata->base = dev_read_addr_ptr(dev->parent);