From: Tim Harvey <tharvey@gateworks.com>
To: Heiko Schocher <hs@denx.de>, Tom Rini <trini@konsulko.com>,
Peng Fan <peng.fan@nxp.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
u-boot@lists.denx.de
Cc: linux-kernel@vger.kernel.org, Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH 2/4] imx: power-domain: Convert to use livetree API for fdt access
Date: Wed, 23 Oct 2024 13:28:53 -0700 [thread overview]
Message-ID: <20241023202855.1571188-2-tharvey@gateworks.com> (raw)
In-Reply-To: <20241023202855.1571188-1-tharvey@gateworks.com>
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 <tharvey@gateworks.com>
---
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);
--
2.25.1
next prev parent reply other threads:[~2024-10-23 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 20:28 [PATCH 1/4] pinctrl: imx: " Tim Harvey
2024-10-23 20:28 ` Tim Harvey [this message]
2024-10-24 3:14 ` [PATCH 2/4] imx: power-domain: " Jaehoon Chung
2024-10-23 20:28 ` [PATCH 3/4] i2c: mxc_i2c: " Tim Harvey
2024-10-28 8:44 ` Heiko Schocher
2024-10-23 20:28 ` [PATCH 4/4] mmc: fsl_esdhc: " Tim Harvey
2024-10-24 0:06 ` Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241023202855.1571188-2-tharvey@gateworks.com \
--to=tharvey@gateworks.com \
--cc=hs@denx.de \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®