[PATCH v2 0/5] gpiolib / reset: resolve GPIO specifiers via gpiolib
From: Pufan Jin
Date: Sat Dec 05 2026 - 01:44:10 EST
As discussed on v1, drivers/reset/core.c should not call
gpio_device_get_chip() or chip->of_xlate() to parse reset-gpios
phandles.
This series moves fwnode GPIO specifier lookup and translation into
gpiolib:
- Patch 1 adds gpio_device_find_by_fwnode_args() for OF and software
nodes, translating specifiers and flags in gpiolib.
- Patch 2 makes swnode_find_gpio() match a consumer's parent
gpio_device when its fwnode matches, so multi-bank controllers sharing
one fwnode resolve the bank selected by of_xlate().
- Patch 3 updates gpio_shared_dev_is_reset_gpio() to match the
reset-gpio software node offset against entry->offset.
- Patch 4 makes reset-gpio read fwnode_reset_n_cells from platform_data.
- Patch 5 converts __reset_add_reset_gpio_device() to use
gpio_device_find_by_fwnode_args(), removing the #gpio-cells == 2
restriction for devicetree providers and the flag check in
drivers/reset/core.c.
Changes since v1:
- Moved specifier translation from drivers/reset/core.c into gpiolib.
- Added support for non-2-cell devicetree GPIO bindings, multi-bank
single-fwnode controllers, and OF flag conversion.
- Updated gpiolib-shared reset-gpio matching to use entry->offset.
- Derived fwnode_reset_n_cells from platform_data in reset-gpio.c.
Tested on NVIDIA Jetson TX2 with tegra186-gpio and BCM4354 Wi-Fi
reset-gpios, resolving to PN.00 / offset 85 with ACTIVE_LOW, and with
KUnit covering 2-cell of_xlate, multi-bank 3-cell reset-gpio,
invalid specifiers, and software node lookups.
Pufan Jin (5):
gpiolib: add gpio_device_find_by_fwnode_args()
gpiolib: swnode: prefer matching parent gpio_device
gpiolib: shared: match reset-gpio against translated entry offset
reset: gpio: derive fwnode_reset_n_cells from platform data
reset: core: translate GPIO specifier via
gpio_device_find_by_fwnode_args()
drivers/gpio/gpiolib-of.c | 93 +++++++++++++++++++++++++++++++++--
drivers/gpio/gpiolib-of.h | 10 ++++
drivers/gpio/gpiolib-shared.c | 70 ++++++--------------------
drivers/gpio/gpiolib-swnode.c | 39 +++++++++++++--
drivers/gpio/gpiolib-swnode.h | 10 +++-
drivers/gpio/gpiolib.c | 80 +++++++++++++++++++++++++++---
drivers/gpio/gpiolib.h | 5 ++
drivers/reset/core.c | 37 ++------------
drivers/reset/reset-gpio.c | 6 ++-
include/linux/gpio/driver.h | 12 +++++
10 files changed, 258 insertions(+), 104 deletions(-)
--
2.56.1