[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241023202855.1571188-3-tharvey@gateworks.com>
Date: Wed, 23 Oct 2024 13:28:54 -0700
From: Tim Harvey <tharvey@...eworks.com>
To: Heiko Schocher <hs@...x.de>,
Tom Rini <trini@...sulko.com>,
Peng Fan <peng.fan@....com>,
Jaehoon Chung <jh80.chung@...sung.com>,
u-boot@...ts.denx.de
Cc: linux-kernel@...r.kernel.org,
Tim Harvey <tharvey@...eworks.com>
Subject: [PATCH 3/4] i2c: mxc_i2c: Convert to use livetree API for fdt access
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@...eworks.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
Powered by blists - more mailing lists