[PATCH] gpio: 74x164: use dev_read_* APIs for live-tree compatibility
Simon Glass
sjg at chromium.org
Wed Apr 22 00:50:01 CEST 2026
Hi Chanhong,
On 2026-04-21T08:08:47, Chanhong Jung <happycpu at gmail.com> wrote:
> gpio: 74x164: use dev_read_* APIs for live-tree compatibility
>
> With CONFIG_OF_LIVE=y, dev_of_offset(dev) does not return a valid
> flat-FDT offset, so fdtdec_get_int(gd->fdt_blob, offset, ...) inside
> gen_74x164_probe() fails to locate the 'registers-number' property and
> always falls back to the default value of 1. This results in a 4-chip
> 74HC595 daisy chain being exposed as only 8 GPIOs instead of 32, and
> any consumer referencing offsets >= 8 fails to bind with -ENOENT
> ("GPIO ... not found" / Error -22).
>
> The 'registers-default' property is ignored for the same reason, so
> any configured power-on output pattern is silently discarded.
>
> Replace the flat-FDT helpers with dev_read_u32_default() and
> dev_read_u8_array_ptr(), which correctly walk both live and flat
> trees. This matches how other DM GPIO drivers (e.g. pca953x_gpio.c)
> read their per-device properties.
>
> Tested on stm32mp153d-ssonic (CONFIG_OF_LIVE=y) with a 4-chip 74HC595
> chain: all 32 GPIOs are now exposed, and 16 consumer LED nodes at
> [...]
>
> drivers/gpio/74x164_gpio.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
> diff --git a/drivers/gpio/74x164_gpio.c b/drivers/gpio/74x164_gpio.c
> @@ -10,7 +10,6 @@
> -#include <fdtdec.h>
It looks like gd->fdt_blob is no longer used, so please can you also
remove DECLARE_GLOBAL_DATA_PTR and the <asm/global_data.h> include?
Reviewed-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list