Fix handling of the reset GPIO. Drop the _nodev() suffix from the
gpio_request_by_name() call as there is now a proper DM capable
GPIO driver. Also check if the GPIO is valid before freeing it in
remove path, otherwise U-Boot will crash.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
if (ret < 0)
goto err_mdio_alloc;
- gpio_request_by_name_nodev(dev_ofnode(dev), "reset-gpios", 0,
- ð->reset_gpio, GPIOD_IS_OUT);
+ gpio_request_by_name(dev, "reset-gpios", 0, ð->reset_gpio,
+ GPIOD_IS_OUT);
mdiodev = mdio_alloc();
if (!mdiodev) {
free(eth->phydev);
mdio_unregister(eth->bus);
mdio_free(eth->bus);
- dm_gpio_free(dev, ð->reset_gpio);
+ if (dm_gpio_is_valid(ð->reset_gpio))
+ dm_gpio_free(dev, ð->reset_gpio);
unmap_physmem(eth->iobase, MAP_NOCACHE);
return 0;