mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 3/4] i2c: mxc_i2c: Convert to use livetree API for fdt access
Date: Wed, 23 Oct 2024 13:28:54 -0700	[thread overview]
Message-ID: <20241023202855.1571188-3-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 mxc-i2c
driver will fail to support scl-gpios and sda-gpios for
i2c bus recovery.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/i2c/mxc_i2c.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 2f3cb5908c91..2dfc1c4eab5d 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -29,7 +29,6 @@
 #include <watchdog.h>
 #include <dm.h>
 #include <dm/pinctrl.h>
-#include <fdtdec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -867,8 +866,7 @@ static int mxc_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
 static int mxc_i2c_probe(struct udevice *bus)
 {
 	struct mxc_i2c_bus *i2c_bus = dev_get_priv(bus);
-	const void *fdt = gd->fdt_blob;
-	int node = dev_of_offset(bus);
+	ofnode node = dev_ofnode(bus);
 	fdt_addr_t addr;
 	int ret, ret2;
 
@@ -912,17 +910,15 @@ static int mxc_i2c_probe(struct udevice *bus)
 	 * See Documentation/devicetree/bindings/i2c/i2c-imx.txt
 	 * Use gpio to force bus idle when necessary.
 	 */
-	ret = fdt_stringlist_search(fdt, node, "pinctrl-names", "gpio");
+	ret = ofnode_stringlist_search(node, "pinctrl-names", "gpio");
 	if (ret < 0) {
 		debug("i2c bus %d at 0x%2lx, no gpio pinctrl state.\n",
 		      dev_seq(bus), i2c_bus->base);
 	} else {
-		ret = gpio_request_by_name_nodev(offset_to_ofnode(node),
-				"scl-gpios", 0, &i2c_bus->scl_gpio,
-				GPIOD_IS_OUT);
-		ret2 = gpio_request_by_name_nodev(offset_to_ofnode(node),
-				"sda-gpios", 0, &i2c_bus->sda_gpio,
-				GPIOD_IS_OUT);
+		ret = gpio_request_by_name(bus, "scl-gpios", 0, &i2c_bus->scl_gpio,
+					   GPIOD_IS_OUT);
+		ret2 = gpio_request_by_name(bus, "sda-gpios", 0, &i2c_bus->sda_gpio,
+					    GPIOD_IS_OUT);
 		if (!dm_gpio_is_valid(&i2c_bus->sda_gpio) ||
 		    !dm_gpio_is_valid(&i2c_bus->scl_gpio) ||
 		    ret || ret2) {
-- 
2.25.1


  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 ` [PATCH 2/4] imx: power-domain: " Tim Harvey
2024-10-24  3:14   ` Jaehoon Chung
2024-10-23 20:28 ` Tim Harvey [this message]
2024-10-28  8:44   ` [PATCH 3/4] i2c: mxc_i2c: " 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-3-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®