{"id":2226530,"url":"http://patchwork.ozlabs.org/api/patches/2226530/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260422140538.1730608-1-happycpu@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260422140538.1730608-1-happycpu@gmail.com>","list_archive_url":null,"date":"2026-04-22T14:05:38","name":"[v2] gpio: 74x164: use dev_read_* APIs for live-tree compatibility","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5acdf1f0aacc688bdb1ceb845f84d417e74dc154","submitter":{"id":93205,"url":"http://patchwork.ozlabs.org/api/people/93205/?format=json","name":"Chanhong Jung","email":"happycpu@gmail.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260422140538.1730608-1-happycpu@gmail.com/mbox/","series":[{"id":501025,"url":"http://patchwork.ozlabs.org/api/series/501025/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=501025","date":"2026-04-22T14:05:38","name":"[v2] gpio: 74x164: use dev_read_* APIs for live-tree compatibility","version":2,"mbox":"http://patchwork.ozlabs.org/series/501025/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226530/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2226530/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=najfCk+m;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.b=\"najfCk+m\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com","phobos.denx.de;\n spf=pass smtp.mailfrom=happycpu@gmail.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g128C6R0yz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 00:45:31 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 2D16F843C1;\n\tWed, 22 Apr 2026 16:45:07 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id BF6778423E; Wed, 22 Apr 2026 16:05:49 +0200 (CEST)","from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n [IPv6:2607:f8b0:4864:20::633])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id CA59F83BC8\n for <u-boot@lists.denx.de>; Wed, 22 Apr 2026 16:05:44 +0200 (CEST)","by mail-pl1-x633.google.com with SMTP id\n d9443c01a7336-2b24fede2acso35182425ad.3\n for <u-boot@lists.denx.de>; Wed, 22 Apr 2026 07:05:44 -0700 (PDT)","from happycpu-p1.. ([121.160.151.7])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5faa2e5cesm200037215ad.25.2026.04.22.07.05.41\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 22 Apr 2026 07:05:42 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD,FREEMAIL_FROM,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776866743; x=1777471543; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=ml/bsnAFQ5Lz4giXYNMqlsd69NRZTKmQ2CDHoyiM1vA=;\n b=najfCk+mdVpVh7CcsUK1u2+UuYj2YqGVRIiX+D8eUGNABq7vMuJ4Pp7ypMXIqSfylF\n v9J/5if5lmtlS3XWcGBwokuk2Or6k6B2DW9hggo8oxxgHR5s30BnnKzpeXOKn3HJdRp6\n 4W5ttk7NfRf0H6RIgYEug/kMBjrQmHUfG03alR3LNVStgum3RThOncSWGWAyefQnLicI\n ZdA6fTR2pYGyhVl/oZ+3H2zBS8bQHwSCMQq6WXVvwhVqbCUiU2vVmBGkHYu10pMvo2W7\n 3eUsirOJdfPIFJsMpfygC3aWixk5crfgAUA4Ty4hLY1PNRUBoazF7e+S8i7ld8KFMNBj\n 5fvA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776866743; x=1777471543;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=ml/bsnAFQ5Lz4giXYNMqlsd69NRZTKmQ2CDHoyiM1vA=;\n b=fT/8/oQKKmhx51/aoq9sjIXzz2EPWZxihH6cqHOcDcIslb9+EpxGCSHGQGaEOy3AU3\n oFYWNKO17Igqh91WmXr1FXxIVmPN824ROvN4J+KDyJOmnySbWe5PkUd+iXtH1LvHVO53\n 1c4DTYNMizhdWXsDqPDHKJrHD6sLRJQSltrqnJ7cu7t7MazbN24eoEZFNiKZpZbRmPai\n 3rVv51fIvhw5+QNKPKIY9jYTPXJ6tw3CiPTHWNfIDfc1x2iyd7mJEjZhrN2Y7GgliHD4\n NhLENgYPATO9fy8MBfnoQqgVDCEMMMNSAB1UY+4zWnqxUZVGR39QnGiX4QgSweUkWmVV\n b7sg==","X-Gm-Message-State":"AOJu0YydUkHRBYp45EduCcs3/jmu37rhHY9DXiN0NpCBLbY/WNzz67Gx\n 2jOtyTrYoesF08G5SqCkFDHjsNnwP83OZDWURspHX2GBQ8Jrzd6jSoYcU8N4Tw==","X-Gm-Gg":"AeBDieugIf+aRqVa+ZczokUBvFmTYMoHXxk7MJpBWNyzBJ7wu4f4FdcEAxShq+6J8/1\n prm+zDyiFyejRSefDH6ydMfjdybKBOxZjn9LHDaySOgfP05ctPsvrn4aVLK2c+Fdhc5lu3dMYfC\n fC6F6eToetOZ5fwGTRrEdeI+63gFNcx/tW6Myr39ysjrOPTeCwu/olmahjTXTjDyhJTsFjEXohH\n uw6jsvkokuSKL7bTAm2i7EAjdo/zNqUDD8QKgEt8VUXauEhD298j9DZS7buWQU39m4xzDmyBGIV\n BidTBAs6rPNEvJiHYSHELOrs2G+iKE3uvnIwaQ90cJsDcrIR9IuvPcRyRLk48QXmNvrpjyITDw4\n fHISqXn4RlgAc9RErDkNqlgmlV011NGPh96bP/aHCADRlv6TVbmCOof3rKst12KKg6cP9s7PVjN\n je7OJPwQonpzagePxz0Snm3vKL43+WrXMxxFKSgqf1a4/hBe1Hz+CdD2ctx6/z0aRw","X-Received":"by 2002:a17:903:1103:b0:2b0:6b98:59ec with SMTP id\n d9443c01a7336-2b5f9f7abacmr230550145ad.34.1776866742808;\n Wed, 22 Apr 2026 07:05:42 -0700 (PDT)","From":"Chanhong Jung <happycpu@gmail.com>","To":"u-boot@lists.denx.de","Cc":"Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,\n Peng Fan <peng.fan@nxp.com>","Subject":"[PATCH v2] gpio: 74x164: use dev_read_* APIs for live-tree\n compatibility","Date":"Wed, 22 Apr 2026 23:05:38 +0900","Message-Id":"<20260422140538.1730608-1-happycpu@gmail.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260421080847.235789-1-happycpu@gmail.com>","References":"<20260421080847.235789-1-happycpu@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Approved-At":"Wed, 22 Apr 2026 16:44:59 +0200","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"With CONFIG_OF_LIVE=y, dev_of_offset(dev) does not return a valid\nflat-FDT offset, so fdtdec_get_int(gd->fdt_blob, offset, ...) inside\ngen_74x164_probe() fails to locate the \"registers-number\" property and\nalways falls back to the default value of 1. This results in a 4-chip\n74HC595 daisy chain being exposed as only 8 GPIOs instead of 32, and\nany consumer referencing offsets >= 8 fails to bind with -ENOENT\n(\"GPIO ... not found\" / Error -22).\n\nThe \"registers-default\" property is ignored for the same reason, so\nany configured power-on output pattern is silently discarded.\n\nReplace the flat-FDT helpers with dev_read_u32_default() and\ndev_read_u8_array_ptr(), which correctly walk both live and flat\ntrees. This matches how other DM GPIO drivers (e.g. pca953x_gpio.c)\nread their per-device properties.\n\nWith gd->fdt_blob no longer referenced, also drop the now-unused\nDECLARE_GLOBAL_DATA_PTR and <asm/global_data.h> include.\n\nTested on stm32mp153d-ssonic (CONFIG_OF_LIVE=y) with a 4-chip 74HC595\nchain: all 32 GPIOs are now exposed, and 16 consumer LED nodes at\noffsets 0..31 bind successfully.\n\nFixes: 9300f711baac (\"dm: gpio: introduce 74x164 driver\")\nSigned-off-by: Chanhong Jung <happycpu@gmail.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n drivers/gpio/74x164_gpio.c | 17 ++++++-----------\n 1 file changed, 6 insertions(+), 11 deletions(-)","diff":"diff --git a/drivers/gpio/74x164_gpio.c b/drivers/gpio/74x164_gpio.c\nindex 331428ccd..de2926894 100644\n--- a/drivers/gpio/74x164_gpio.c\n+++ b/drivers/gpio/74x164_gpio.c\n@@ -10,17 +10,13 @@\n \n #include <errno.h>\n #include <dm.h>\n-#include <fdtdec.h>\n #include <malloc.h>\n-#include <asm/global_data.h>\n #include <asm/gpio.h>\n #include <asm/io.h>\n #include <dm/device_compat.h>\n #include <dt-bindings/gpio/gpio.h>\n #include <spi.h>\n \n-DECLARE_GLOBAL_DATA_PTR;\n-\n /*\n  * struct gen_74x164_chip - Data for 74Hx164\n  *\n@@ -127,11 +123,9 @@ static int gen_74x164_probe(struct udevice *dev)\n {\n \tstruct gen_74x164_priv *priv = dev_get_priv(dev);\n \tstruct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);\n+\tconst u8 *defaults;\n \tchar *str, name[32];\n \tint ret;\n-\tconst void *fdt = gd->fdt_blob;\n-\tint node = dev_of_offset(dev);\n-\n \tsnprintf(name, sizeof(name), \"%s_\", dev->name);\n \tstr = strdup(name);\n \tif (!str)\n@@ -141,16 +135,17 @@ static int gen_74x164_probe(struct udevice *dev)\n \t * See Linux kernel:\n \t * Documentation/devicetree/bindings/gpio/gpio-74x164.txt\n \t */\n-\tpriv->nregs = fdtdec_get_int(fdt, node, \"registers-number\", 1);\n+\tpriv->nregs = dev_read_u32_default(dev, \"registers-number\", 1);\n \tpriv->buffer = calloc(priv->nregs, sizeof(u8));\n \tif (!priv->buffer) {\n \t\tret = -ENOMEM;\n \t\tgoto free_str;\n \t}\n \n-\tret = fdtdec_get_byte_array(fdt, node, \"registers-default\",\n-\t\t\t\t    priv->buffer, priv->nregs);\n-\tif (ret)\n+\tdefaults = dev_read_u8_array_ptr(dev, \"registers-default\", priv->nregs);\n+\tif (defaults)\n+\t\tmemcpy(priv->buffer, defaults, priv->nregs);\n+\telse\n \t\tdev_dbg(dev, \"No registers-default property\\n\");\n \n \tret = gpio_request_by_name(dev, \"oe-gpios\", 0, &priv->oe,\n","prefixes":["v2"]}