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 1/4] pinctrl: imx: Convert to use livetree API for fdt access
Date: Wed, 23 Oct 2024 13:28:52 -0700 [thread overview]
Message-ID: <20241023202855.1571188-1-tharvey@gateworks.com> (raw)
Convert to using livetree API functions.
Without this if livetree is enabled (OF_LIVE) the imx8mq-pinctrl
driver will (silently) fail to probe causing issues with multiple
devices.
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
drivers/pinctrl/nxp/pinctrl-imx.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c
index ff466c491041..b1960c56b512 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx.c
@@ -22,7 +22,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
{
struct imx_pinctrl_priv *priv = dev_get_priv(dev);
struct imx_pinctrl_soc_info *info = priv->info;
- int node = dev_of_offset(config);
+ ofnode node = dev_ofnode(config);
const struct fdt_property *prop;
u32 *pin_data;
int npins, size, pin_size;
@@ -40,7 +40,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
else
pin_size = FSL_PIN_SIZE;
- prop = fdt_getprop(gd->fdt_blob, node, "fsl,pins", &size);
+ prop = ofnode_get_property(node, "fsl,pins", &size);
if (!prop) {
dev_err(dev, "No fsl,pins property in node %s\n", config->name);
return -EINVAL;
@@ -56,8 +56,8 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
if (!pin_data)
return -ENOMEM;
- if (fdtdec_get_int_array(gd->fdt_blob, node, "fsl,pins",
- pin_data, size >> 2)) {
+ if (ofnode_read_u32_array(node, "fsl,pins",
+ pin_data, size >> 2)) {
dev_err(dev, "Error reading pin data.\n");
devm_kfree(dev, pin_data);
return -EINVAL;
@@ -202,10 +202,11 @@ int imx_pinctrl_probe(struct udevice *dev,
struct imx_pinctrl_soc_info *info)
{
struct imx_pinctrl_priv *priv = dev_get_priv(dev);
- int node = dev_of_offset(dev), ret;
- struct fdtdec_phandle_args arg;
+ struct ofnode_phandle_args arg;
+ ofnode node = dev_ofnode(dev);
fdt_addr_t addr;
fdt_size_t size;
+ int ret;
if (!info) {
dev_err(dev, "wrong pinctrl info\n");
@@ -218,7 +219,7 @@ int imx_pinctrl_probe(struct udevice *dev,
if (info->flags & IMX8_USE_SCU)
return 0;
- addr = devfdt_get_addr_size_index(dev, 0, &size);
+ addr = ofnode_get_addr_size_index(dev_ofnode(dev), 0, &size);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
@@ -227,22 +228,20 @@ int imx_pinctrl_probe(struct udevice *dev,
return -ENOMEM;
priv->info = info;
- info->mux_mask = fdtdec_get_int(gd->fdt_blob, node, "fsl,mux_mask", 0);
+ info->mux_mask = ofnode_read_u32(node, "fsl,mux_mask", 0);
/*
* Refer to linux documentation for details:
* Documentation/devicetree/bindings/pinctrl/fsl,imx7d-pinctrl.txt
*/
- if (fdtdec_get_bool(gd->fdt_blob, node, "fsl,input-sel")) {
- ret = fdtdec_parse_phandle_with_args(gd->fdt_blob,
- node, "fsl,input-sel",
+ if (ofnode_read_bool(node, "fsl,input-sel")) {
+ ret = ofnode_parse_phandle_with_args(node, "fsl,input-sel",
NULL, 0, 0, &arg);
if (ret) {
dev_err(dev, "iomuxc fsl,input-sel property not found\n");
return -EINVAL;
}
- addr = fdtdec_get_addr_size(gd->fdt_blob, arg.node, "reg",
- &size);
+ addr = ofnode_get_addr_size(arg.node, "reg", &size);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
--
2.25.1
next 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 Tim Harvey [this message]
2024-10-23 20:28 ` [PATCH 2/4] imx: power-domain: " Tim Harvey
2024-10-24 3:14 ` 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-1-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®