From nobody Sun May 24 21:38:46 2026 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BEE5340DB0 for ; Thu, 21 May 2026 05:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340429; cv=none; b=pEt8b1cL4H4xrm6sabqV6lCMvzUPhhkKZqUWrKPQEwg4KB5ksM7//rN5VZYm0gHNP5KpLoCNazDFKMxQ9I76HFgjymEhw03uUVixweV6xkzAphuMVhwDGlLCHWIPp5e7TR/YebizTHT7TLOl22Eg+LxEUiUrGACCHRWNoEcclhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340429; c=relaxed/simple; bh=V98m1+0octd7GZV73B+kVvkgTFXAFAq4EIFfr2kWVpM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jy7oNveGzfBnTYSI7KveYVYLWHyZXaNbCb492d4MkKl7cSP8VZNgP1DLTs1HNXce/SGCu9YrhusPjBzSwtAYRqyaHc5xQzq4yhF6aOwDNe+IHDTOyOXeevEDiMvmgQwoi3pvNr5JxpOvAHq/ljRvoi8FWCFuQOnAtAOE2mKANVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MKCAnqrD; arc=none smtp.client-ip=74.125.82.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MKCAnqrD" Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-1363fe80fe8so80221c88.0 for ; Wed, 20 May 2026 22:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779340427; x=1779945227; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=15uEAzMKA+H+ojfSPLhPEYofIvVWsChvdMIoi7uyS4E=; b=MKCAnqrDQumeqPf4dUOm7UyA6t7soduqP0W8TOu6ifpHPQcL7HTheY6B2DwCoJw7El fuFkg2izs1bl7oou0tZkHA++ESd+r+BWHiv/UkxQeio/jeGYEE+cIDKKvpBeG+Q7FL1r /F+oyaxM7YldPdQkmAEIYEJl+dRUUVAK0/QKArcJ2uqsnKNTUOOx+BRKjbUvlKds7jg2 01t2zB8M57xQXaomVRiMucRFY83LM5u8utNh0W/ZhaSAPXK/doG0VOtL7wloJwqV5eQX wfL6omkbl8RgBYD7ke50m/HB2sLi8IEY7br+bSIu1u6X2M4bYpxjXMQpiK/Gu6Ao3/9N lBgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779340427; x=1779945227; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=15uEAzMKA+H+ojfSPLhPEYofIvVWsChvdMIoi7uyS4E=; b=GZJqnLwkVrG+Muvg4U2rJwZbbT36U1KDMjEhREUkcH40dwOJgKDcZK3DI7ld3gGzYL wVHcEuUHQ/D2tfRpGllC8VNrdLizqJOU+CMFVA9iKVnfhAA4M7+RyMtQZWgu+LRb034v hht/H9jmTp59E9nDk+B+WuB5BU/1NGiJvVIzOlKMWkTMaSrb6A6xJd+FlOthSdKN+fGR 6hN+gySxTa9KOfhWLOQpXxpMUTrja0Fyvxggm/xigJ8mdGt+4YWBsDebNMUYHIjJa6Fo l6/21vxEAdqFH7T9zMX2H1eBHqe7QqzTC1bIxI8tHB0LdhClXkqsA+Aj+Z1x2ut1fO1L G3rQ== X-Forwarded-Encrypted: i=1; AFNElJ8Ri3qMO3jgAG/Vvho3zQzwlk7/0idIvDNaUVo2yYyZySCnSermCX4Ekw+4YO5PxeRfx1ZULJaMDRqWk7s=@vger.kernel.org X-Gm-Message-State: AOJu0YwKYo3GEiXcbjZKsR0KFxGnggfwvSKodak1+pt4gPk+s8kt9Ucs d45CNgQUFxFwkKs1RvfBcxLx8XOReazJOEo4o/Lq5nLEdIj+YdsguaT6 X-Gm-Gg: Acq92OE3cJ5sHpk+Wqo74o6gVC9MnhyOB95UBZ0ma7f7wK4ctZorBrb/GLdPcdn7Rdg ePGg7Bq/hjAk4sMobNHOPR4zrrj2QbyZmirC8WCCWmdZpRifksQZMjZSgs8sphRoLVyd21u+rfx Up94OyOkvv0IWWI/mBhu1xE8eUBELb/Eh7srQRLCMeOCsNhCkkRJHA8T5n4bwLGHmAmMTalyi8S NImwwVPOAFgeEsph+XcxS81glbBGAgjFk3IvmhNl2nDrDphcWY+BqOLe84+iLHRHsRgIn1IXXfM Hga1m6e/bOIg9aqWKQVt/250XWwm6EIGyvw7K9dIIhpt1j3+OQf2Ciu3xNTdi1HlfPHtox0cnAB ZnoBbXABYhe6Ih4XwWQxRRUmRYmNcf1+Vbk19ak/wKvx1CysfnvPG9HcUOSagsL8py0Gt3TZeRf pLv0kHlt3ldnZoOiN8R42B557ZJER/oSir/NzfzQsAeLXEdZXYqgiatvpgs6ecy0g5cj1eosfxG ik9lI6xy/EuTw== X-Received: by 2002:a05:7022:f305:b0:12a:6c7e:bef2 with SMTP id a92af1059eb24-136327e4b6amr342425c88.7.1779340422089; Wed, 20 May 2026 22:13:42 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d457:597:d576:1eb8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-135e5c0a918sm6231360c88.14.2026.05.20.22.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 22:13:41 -0700 (PDT) From: Dmitry Torokhov Date: Wed, 20 May 2026 22:13:17 -0700 Subject: [PATCH v2 1/5] pinctrl: renesas: gpio: isolate function gpiochip from parent fwnode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-rsk7203-properties-v2-1-465f3308021b@gmail.com> References: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> In-Reply-To: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> To: Rich Felker , John Paul Adrian Glaubitz Cc: Yoshinori Sato , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org X-Mailer: b4 0.16-dev-6911d The sh-pfc driver registers two separate gpiochip instances: one for real GPIOs and another for function GPIOs. Since both share the same parent platform device, gpiolib's fallback logic causes both chips to share the same firmware node (fwnode). This causes ambiguity when using software nodes to describe GPIOs, as gpiolib may apply hogs meant for one chip to the other if they share the same node. Explicitly set gc->fwnode to ERR_PTR(-ENODEV) for the function GPIO chip. This satisfies gpiolib's check for an existing fwnode and prevents it from falling back to the parent device's node, while ensuring that no actual properties or hogs are found on the function chip unless explicitly assigned later. Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov Acked-by: Bartosz Golaszewski --- drivers/pinctrl/renesas/gpio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c index 2293af642849..4e59dadb7364 100644 --- a/drivers/pinctrl/renesas/gpio.c +++ b/drivers/pinctrl/renesas/gpio.c @@ -278,6 +278,12 @@ static int gpio_function_setup(struct sh_pfc_chip *chi= p) =20 gc->request =3D gpio_function_request; =20 + /* + * Explicitly mask the parent's fwnode to prevent gpiolib from + * reusing it for function GPIOs. + */ + gc->fwnode =3D ERR_PTR(-ENODEV); + gc->label =3D pfc->info->name; gc->owner =3D THIS_MODULE; gc->base =3D pfc->nr_gpio_pins; --=20 2.54.0.669.g59709faab0-goog From nobody Sun May 24 21:38:46 2026 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E1AE34CFCD for ; Thu, 21 May 2026 05:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340425; cv=none; b=ZkhtVBz/o41Wd+LX/oyS38Cm3q6iHc/C8oQ4xcKC2rRPDiYqaak5JC4A8MUZcQOfMF+zSE2F6sJ3lzCCXE4BxDA1WBHH5moT4VqLcsO8J9cDboDC3U2EiLrpX+DaJulWIEcc0JwUYDGnaU8JtjoXuvpzPj4ma77dTXQNGEPHjok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340425; c=relaxed/simple; bh=an2XKnw/6oNRYjivHk/fQLnrkcFYlk+CGyiYpwsGnhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RlhSW8yYjlx2uoqqM8p+R+mhAJhm4Fnglf3BCdoHMjA9XlHy9P9FMf3J4v/u6WlUrqXgkREQmoT8pjKRC2+9hO5bzhdsyntfNeD/HLVsnXkmtiVO/VlJta9nCWsdjKlPUpCjPnxwy1rGS11JfSHG5V5WpvFl3oodn8Vpl8fQYbM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KezolyL+; arc=none smtp.client-ip=74.125.82.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KezolyL+" Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-135e88b8e55so5933612c88.0 for ; Wed, 20 May 2026 22:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779340423; x=1779945223; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pXtisoK8i0cyvAoaHE4OQcmxs5XHz2jUEn0crM4CfGY=; b=KezolyL+vcKcS0eaIMl9nVTayU0vlKDWYQzWJSUqrlkQYefXHEWVu6Az4W+gq2njSz E+mK3BZA9DLp+bpJg+AbWc7o82rCzuIkoNrj3RtaMm0Yp753kn0XJ3DFsdVTj8Hw+e7z n4Vd8T7kZC89snFgCjMtiNrnk644CM1gf7WWPI4yvs+VVkNiF3t/biR7Rbozw0EaHNfz Ge7aWvxCiViZLkKOafU5ZZHLWfuGIuqsVvFuDdMN6oCYo8QMPRoeJCPlzr+FvRRyahEp lBEKI5YoUyncn3q+QE0h9NeVdtCIQy7NkimmBT6lK3KzN/9H0jBYqZtxEsAYOvY9s3mS o/Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779340423; x=1779945223; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=pXtisoK8i0cyvAoaHE4OQcmxs5XHz2jUEn0crM4CfGY=; b=RgH9PpfehSUfBHVgpuNhm0IFhqomQtDJR2XXPwO7COJoZk3Kxg/l4m0QK/nlqCpLKx I81IpT+ZpbE5aP+f98sgsN75yI4CZzXblU7NkslzZc7pkOSgR+XQ9tYRb18FL2E33yY6 x3SPpzKQnlXZS55jj+CLcF8hVn4cbXFTsOP1C3EhUsLW/9IX9akrLev9B5DXRej6wu6F rA9qxu9rvfmiA/swNNtxS5e4rexYm9coIK9jZcMjQA0eNjltmaHWsMuyjlrgT9qFzmph 8lCB+WtqglHl/9IxuvY37ZbAo68VO+nhTAGk/lrqKo3YhOwfU2kC0eP/8QGukflYtPJg QmqQ== X-Forwarded-Encrypted: i=1; AFNElJ/yTndq8xcpiHpRo+oTsfEARQLNL2WdrYJdxD8WsEeknPAABqFc0vNXf0itjX3/5fcS8Wko+xv+iVyFe/s=@vger.kernel.org X-Gm-Message-State: AOJu0YxQ72rzYMjk2agdPuGYwQB0z2/6Cz55LdOb+BemHYwgnt8rs+/y q4s7dOxGDa237OMMPxzH6xBBedyWZ7+5JBq/5PBP0TkVAlo/VwKkbT05 X-Gm-Gg: Acq92OGJmXcGvRwRv3IbI+mFqTbN4FtcXkcXs0Gpd6rVXhoLJLWkYCZupxoS3pxXLms +n4cYsxoWnNOc4EihTQmeXffxI2OEjGDUOr9qhVRmxV1V1zoFoiL+QXnthvlNzOfuAxKfg3SJUO /4GPorO6NaMVZluI4RJ0R/0lJ1aDyTZ6dqbrRc8uzDuTXuhdBDsDeEMjqSXGqLpE/VudDjI/d/8 BSmqmN/dQTpEEUOsw/y219GIPOUl484JUsVqJoB8NNm4VZ20vSxMvjl7Oup6jmVrjCWs3n+EZqy l7TInKWKuXxF4h6dStB9D1LqQ2MsusJOmz0Vt6VQLP65Mp9vQfqfJvOU8wtfVYPYGOBGvvqpt7f xNglcNj9NDux6gUJtkx8t//nv4YeuU+30idmNnlXkGLAoLvvhUOsMfclhlTWJ1PnXsMeD1vwXjh 64/j38wquQ9+Yw2ecJ4vToRmOwdwGbx5wAV25Mfs5/kLa2Ajp34RM7QQy388aoR8R6PZDWwgDCa dMyqZgIt6fhrQ== X-Received: by 2002:a05:7022:61a1:b0:12d:b26f:cafd with SMTP id a92af1059eb24-13632a02cf3mr857042c88.5.1779340423478; Wed, 20 May 2026 22:13:43 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d457:597:d576:1eb8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-135e5c0a918sm6231360c88.14.2026.05.20.22.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 22:13:42 -0700 (PDT) From: Dmitry Torokhov Date: Wed, 20 May 2026 22:13:18 -0700 Subject: [PATCH v2 2/5] sh: pfc: attach software node to the GPIO chip Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-rsk7203-properties-v2-2-465f3308021b@gmail.com> References: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> In-Reply-To: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> To: Rich Felker , John Paul Adrian Glaubitz Cc: Yoshinori Sato , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org X-Mailer: b4 0.16-dev-6911d With commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") gpiolib requires that firmware nodes from the GPIO references to match firmware node in gpiochip structure. Define a software node for the pfc gpiochip so that it can be referenced by boards using static device properties. Signed-off-by: Dmitry Torokhov Reviewed-by: Bartosz Golaszewski --- arch/sh/include/cpu-common/cpu/pfc.h | 3 +++ arch/sh/kernel/cpu/pfc.c | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/sh/include/cpu-common/cpu/pfc.h b/arch/sh/include/cpu-com= mon/cpu/pfc.h index 879d2c9da537..d57e38c05bdb 100644 --- a/arch/sh/include/cpu-common/cpu/pfc.h +++ b/arch/sh/include/cpu-common/cpu/pfc.h @@ -11,6 +11,9 @@ #include =20 struct resource; +struct software_node; + +extern const struct software_node pfc_gpiochip_node; =20 int sh_pfc_register(const char *name, struct resource *resource, u32 num_resources); diff --git a/arch/sh/kernel/cpu/pfc.c b/arch/sh/kernel/cpu/pfc.c index 062056ede88d..5a8d804d607b 100644 --- a/arch/sh/kernel/cpu/pfc.c +++ b/arch/sh/kernel/cpu/pfc.c @@ -5,21 +5,29 @@ * Copyright (C) 2012 Renesas Solutions Corp. */ =20 +#include #include #include +#include =20 #include =20 -static struct platform_device sh_pfc_device =3D { - .id =3D -1, +const struct software_node pfc_gpiochip_node =3D { + .name =3D "sh-pfc", }; =20 int __init sh_pfc_register(const char *name, struct resource *resource, u32 num_resources) { - sh_pfc_device.name =3D name; - sh_pfc_device.num_resources =3D num_resources; - sh_pfc_device.resource =3D resource; + struct platform_device_info pdev_info =3D { + .name =3D name, + .id =3D PLATFORM_DEVID_NONE, + .res =3D resource, + .num_res =3D num_resources, + .swnode =3D &pfc_gpiochip_node, + }; + struct platform_device *pdev; =20 - return platform_device_register(&sh_pfc_device); + pdev =3D platform_device_register_full(&pdev_info); + return PTR_ERR_OR_ZERO(pdev); } --=20 2.54.0.669.g59709faab0-goog From nobody Sun May 24 21:38:46 2026 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1A2C348896 for ; Thu, 21 May 2026 05:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340427; cv=none; b=GwarH6wIh+rQTZr4P2o16V0pE4KPjZB4Kn0ad/6As4XR/vAMOTCEvnusxMcgH77IukOpnNL8GYlTAmR2EK/RhLY45Y0XsnMXEgJEDNvKDBBx+cV9deym4o1ffgg9BnNnWmjORtdgqOlktB2bZ+mNlND7+2c79uLv4yyaz2c4Hps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340427; c=relaxed/simple; bh=sqigRYMe9Ei/euDhl7m0Dt51zXJI7/WmeHuh6kLpDkk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EVdCaNPK1WRMEVq+Cp+N16uxvsb7oh+lAbI8F51py+QSLYfK4uDpbBAC7P2BPN6AIRMT+rBclH/bzYVftvGFQw2Hu+QWTvV+0tWhN/oF07AFGDQwYjzGKkdiJNW/3/pBB3TDny7m3nYXYBzprQAK7k/EdazrEB/LJKh2+OjHXBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=r5uo/TcK; arc=none smtp.client-ip=74.125.82.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r5uo/TcK" Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-1331e851faaso2979506c88.1 for ; Wed, 20 May 2026 22:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779340425; x=1779945225; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=f+AeVt9B3IyF1WrSPsCMEkGadYjuCmhfMkRPmef3xtU=; b=r5uo/TcK1qi0shN1gb4pqRbrKFPp0VZNn125tjyCzudBg2OSKCUF0XoKlm0GZ6OQTJ u7/WIKwFoizQRhAKNOsS2ouSsh/UTfmrgpmaG1YS0D6fCWuDQcyp4A+6ve4k9KNnOi4y unJZnAL1ZAKuQDn5M3gUsTj66nVBoS7bCiNF4gAMr5ymkYGEOVclIOBQY3TxcOrA3qyh zxCo2dwdJz6JJQBTXGM48H7s1OvU4G4aLiqUODNe2DLjcLdRocZOBb1SaPBxOE0OY416 zujro/m+0FIfKp6kWDCfpacjypLxMMu2kAacNDSqHFV3FIALfCh/Sd4/GEIRF42OxB9D IDwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779340425; x=1779945225; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=f+AeVt9B3IyF1WrSPsCMEkGadYjuCmhfMkRPmef3xtU=; b=dhkou0GN305VT93feAfUl14Zu4mAVJfgWxWrHX1iCudoqe+FsX9BukAOOwtQaUzNnH Dsg/U/0ISVT6Ce4oy1HohDIFTYusll5bSqog8vV9soPAvO5mOICfg5oO2GIHBYdfmzDt wa/weRzmWDJsdIP/QDLmRevQKyyfRLVuDz9pV0/Oa/mdQAvfKeNtBRgjexo9yfumeRAR 5gRl99xPghIAeds1Gn7iDlfGqGs4NPGBgF+5mi85HXOEEGzleub3JuaUKgmOm/o31289 zGb7/ywG9Ekt0KaPG9nK7SLrkooDCFlADS+v2uv4kku5S59W2gpR1nIKuML8b8td7PM5 lZpQ== X-Forwarded-Encrypted: i=1; AFNElJ+K5SoWbtSi5u7mVOGlwZ8QRsY2uhV94Rrtqgb2pYGEcxHPnteSCO5oZoC9gaiCIR8bngqGLHEN5iXAeeI=@vger.kernel.org X-Gm-Message-State: AOJu0YxQw/J+p2afRd63Ss5mGZU4sRwHMmy+UPiqtZMpVLL5OqpWj3dl phzK97tzakRtGrTGVVyAYK25TrUXSkpfBZYyIiACSQApZsZDy5uHr18q X-Gm-Gg: Acq92OHwwz746Vym8a6CBkWecLoELc3VY2Pg/bItOaaKgVzqPfJyhPAK0frmNZ6Aj+h l1SEDg2+7nUScUy03PXD2m7KoxG6qdq0r0nWfWg95oowkoxC2CBkpoa923fSDn7GR9C6yRuD94q r4FOLjOdqTTV/d5+v8Q7kyrOf/dDczOoGfUJ15W7dR4IHsCKXNiIO4aeo5yOIzsKvurFHx+2/sX lseN0BwxTxG+6MGIFr95OOaTHHLKgS00ZnGwD0QeWLSbJnGVzz5otWhtWDD9C237gjRPXv/qSPG x9mLrFEWFzXcvzZFK9b8xsjxedDB4TwJfkSDKw/LTxKXde1l+JAI7hvthZg4+7Tkf7ylKHRMp6u ir1iRexkM1rqhJ5DXPrThjCqgNkLn1cx1vyKYG05ojpYVdBLcaD+6LDcRceo+O+bDFVZ+HfUF26 tx2Hh3YTtAM83fGzJL/J6nmZdcCbKS/qm7lY0P/aAkkmDpBFhT1dtCOGS6XpIHOCob32MirAoLF iJREsry79e0Ww== X-Received: by 2002:a05:7022:609c:b0:11a:fb0a:ceca with SMTP id a92af1059eb24-13633eb60b4mr545331c88.16.1779340425118; Wed, 20 May 2026 22:13:45 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d457:597:d576:1eb8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-135e5c0a918sm6231360c88.14.2026.05.20.22.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 22:13:44 -0700 (PDT) From: Dmitry Torokhov Date: Wed, 20 May 2026 22:13:19 -0700 Subject: [PATCH v2 3/5] sh: mach-rsk: rsk7203: use static device properties for LEDs and GPIO buttons Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-rsk7203-properties-v2-3-465f3308021b@gmail.com> References: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> In-Reply-To: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> To: Rich Felker , John Paul Adrian Glaubitz Cc: Yoshinori Sato , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org X-Mailer: b4 0.16-dev-6911d Convert the board to use static device properties instead of platform data to describe LEDs and GPIO-connected buttons on the board, so that support for platform data can be removed from gpio-keys and other drivers, unifying their behavior. Signed-off-by: Dmitry Torokhov Reviewed-by: Bartosz Golaszewski --- arch/sh/boards/mach-rsk/devices-rsk7203.c | 199 ++++++++++++++++++++------= ---- 1 file changed, 131 insertions(+), 68 deletions(-) diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mac= h-rsk/devices-rsk7203.c index e6b05d4588b7..f8760a91e2f1 100644 --- a/arch/sh/boards/mach-rsk/devices-rsk7203.c +++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c @@ -4,17 +4,19 @@ * * Copyright (C) 2008 - 2010 Paul Mundt */ +#include #include #include #include #include #include #include +#include #include -#include -#include +#include +#include #include -#include +#include #include =20 static struct smsc911x_platform_config smsc911x_config =3D { @@ -37,92 +39,138 @@ static struct resource smsc911x_resources[] =3D { }, }; =20 -static struct platform_device smsc911x_device =3D { - .name =3D "smsc911x", - .id =3D -1, - .num_resources =3D ARRAY_SIZE(smsc911x_resources), - .resource =3D smsc911x_resources, - .dev =3D { - .platform_data =3D &smsc911x_config, +static const struct software_node rsk7203_gpio_leds_node =3D { + .name =3D "rsk7203-gpio-leds", +}; + +static const struct software_node rsk7203_green_led_node =3D { + .name =3D "green", + .parent =3D &rsk7203_gpio_leds_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_STRING("label", "green"), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PE10, GPIO_ACTIVE_LOW), + { } }, }; =20 -static struct gpio_led rsk7203_gpio_leds[] =3D { - { - .name =3D "green", - .gpio =3D GPIO_PE10, - .active_low =3D 1, - }, { - .name =3D "orange", - .default_trigger =3D "nand-disk", - .gpio =3D GPIO_PE12, - .active_low =3D 1, - }, { - .name =3D "red:timer", - .default_trigger =3D "timer", - .gpio =3D GPIO_PC14, - .active_low =3D 1, - }, { - .name =3D "red:heartbeat", - .default_trigger =3D "heartbeat", - .gpio =3D GPIO_PE11, - .active_low =3D 1, +static const struct software_node rsk7203_orange_led_node =3D { + .name =3D "orange", + .parent =3D &rsk7203_gpio_leds_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_STRING("label", "orange"), + PROPERTY_ENTRY_STRING("linux,default-trigger", "nand-disk"), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PE12, GPIO_ACTIVE_LOW), + { } }, }; =20 -static struct gpio_led_platform_data rsk7203_gpio_leds_info =3D { - .leds =3D rsk7203_gpio_leds, - .num_leds =3D ARRAY_SIZE(rsk7203_gpio_leds), +static const struct software_node rsk7203_red1_led_node =3D { + .name =3D "red:timer", + .parent =3D &rsk7203_gpio_leds_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_STRING("label", "red:timer"), + PROPERTY_ENTRY_STRING("linux,default-trigger", "timer"), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PC14, GPIO_ACTIVE_LOW), + { } + }, }; =20 -static struct platform_device led_device =3D { - .name =3D "leds-gpio", - .id =3D -1, - .dev =3D { - .platform_data =3D &rsk7203_gpio_leds_info, +static const struct software_node rsk7203_red2_led_node =3D { + .name =3D "red:heartbeat", + .parent =3D &rsk7203_gpio_leds_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_STRING("label", "red:heartbeat"), + PROPERTY_ENTRY_STRING("linux,default-trigger", "heartbeat"), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PE11, GPIO_ACTIVE_LOW), + { } }, }; =20 -static struct gpio_keys_button rsk7203_gpio_keys_table[] =3D { - { - .code =3D BTN_0, - .gpio =3D GPIO_PB0, - .active_low =3D 1, - .desc =3D "SW1", - }, { - .code =3D BTN_1, - .gpio =3D GPIO_PB1, - .active_low =3D 1, - .desc =3D "SW2", - }, { - .code =3D BTN_2, - .gpio =3D GPIO_PB2, - .active_low =3D 1, - .desc =3D "SW3", +static const struct software_node rsk7203_gpio_keys_node =3D { + .name =3D "rsk7203-gpio-keys", + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_U32("poll-interval", 50), + { } }, }; =20 -static struct gpio_keys_platform_data rsk7203_gpio_keys_info =3D { - .buttons =3D rsk7203_gpio_keys_table, - .nbuttons =3D ARRAY_SIZE(rsk7203_gpio_keys_table), - .poll_interval =3D 50, /* default to 50ms */ +static const struct software_node rsk7203_sw1_key_node =3D { + .parent =3D &rsk7203_gpio_keys_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_U32("linux,code", BTN_0), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PB0, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_STRING("label", "SW1"), + { } + }, }; =20 -static struct platform_device keys_device =3D { - .name =3D "gpio-keys-polled", - .dev =3D { - .platform_data =3D &rsk7203_gpio_keys_info, +static const struct software_node rsk7203_sw2_key_node =3D { + .parent =3D &rsk7203_gpio_keys_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_U32("linux,code", BTN_1), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PB1, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_STRING("label", "SW2"), + { } }, }; =20 -static struct platform_device *rsk7203_devices[] __initdata =3D { - &smsc911x_device, - &led_device, - &keys_device, +static const struct software_node rsk7203_sw3_key_node =3D { + .parent =3D &rsk7203_gpio_keys_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_U32("linux,code", BTN_2), + PROPERTY_ENTRY_GPIO("gpios", &pfc_gpiochip_node, + GPIO_PB2, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_STRING("label", "SW3"), + { } + }, +}; + +static const struct software_node * const rsk7203_swnodes[] __initconst = =3D { + &rsk7203_gpio_leds_node, + &rsk7203_green_led_node, + &rsk7203_orange_led_node, + &rsk7203_red1_led_node, + &rsk7203_red2_led_node, + &rsk7203_gpio_keys_node, + &rsk7203_sw1_key_node, + &rsk7203_sw2_key_node, + &rsk7203_sw3_key_node, + NULL +}; + +static const struct platform_device_info rsk7203_devices[] __initconst =3D= { + { + .name =3D "smsc911x", + .id =3D PLATFORM_DEVID_NONE, + .res =3D smsc911x_resources, + .num_res =3D ARRAY_SIZE(smsc911x_resources), + .data =3D &smsc911x_config, + .size_data =3D sizeof(smsc911x_config), + }, + { + .name =3D "leds-gpio", + .id =3D PLATFORM_DEVID_NONE, + .swnode =3D &rsk7203_gpio_leds_node, + }, + { + .name =3D "gpio-keys-polled", + .id =3D PLATFORM_DEVID_NONE, + .swnode =3D &rsk7203_gpio_keys_node, + }, }; =20 static int __init rsk7203_devices_setup(void) { + struct platform_device *pd; + int error; + int i; + /* Select pins for SCIF0 */ gpio_request(GPIO_FN_TXD0, NULL); gpio_request(GPIO_FN_RXD0, NULL); @@ -131,7 +179,22 @@ static int __init rsk7203_devices_setup(void) __raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */ gpio_request(GPIO_FN_IRQ0_PB, NULL); =20 - return platform_add_devices(rsk7203_devices, - ARRAY_SIZE(rsk7203_devices)); + error =3D software_node_register_node_group(rsk7203_swnodes); + if (error) { + pr_err("failed to register software nodes: %d\n", error); + return error; + } + + for (i =3D 0; i < ARRAY_SIZE(rsk7203_devices); i++) { + pd =3D platform_device_register_full(&rsk7203_devices[i]); + error =3D PTR_ERR_OR_ZERO(pd); + if (error) { + pr_err("failed to create platform device %s: %d\n", + rsk7203_devices[i].name, error); + return error; + } + } + + return 0; } device_initcall(rsk7203_devices_setup); --=20 2.54.0.669.g59709faab0-goog From nobody Sun May 24 21:38:46 2026 Received: from mail-dy1-f177.google.com (mail-dy1-f177.google.com [74.125.82.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBA313358D6 for ; Thu, 21 May 2026 05:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340429; cv=none; b=Buy4PgprzedrCKU8hrlkMkYAehz2yoAzDrhJVxQdt66oTwnA4NCrjy8CyV3ZP1UOvH7eBwgSVme3DTmuU2NpgfkMMk6/06EmIr6NhTGqWDtgKe4+9KdTd5FnN9cAfj0mQYUWgMCby9G35JUqnNhHQ29c0xbF7pGI2PhqKD64SQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340429; c=relaxed/simple; bh=a7LlH6SOmxH0p4iNAX3qrUusbYFuA/lKO8UCM5Mh+y0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N39k9tYFHERPBVOTa1YLj9je/3Iy3nY2K4XegYAaqB44OosvL51LPsKLm2fJ907tcFd0/s4e49yj4sZWo9te6GYeG4/ExhSQVS9kEqLM7wLr1hXYR2cONTvG/HyrKSZq9zeqD6PNlFDx3bX58/KPUCEu18tMLtBZcJKOfI+glzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AKhrjeO3; arc=none smtp.client-ip=74.125.82.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AKhrjeO3" Received: by mail-dy1-f177.google.com with SMTP id 5a478bee46e88-2f00a567cfaso3446959eec.0 for ; Wed, 20 May 2026 22:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779340427; x=1779945227; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7YPZxWestxZ6ZeoppNL4aB518UjR8C+o/ws24cKnfpM=; b=AKhrjeO3oWo3pW7+XGNc8WEgP/k6/fsJlceeHmT0JIHBANdMvdcP+6fa1aUfysrC9J wGdddDCExUc58mZV41UnZXpzz0k7DySu8idWofIDSS9LYgAd/6VOO9YW6ho9jI15i4hO XCkwZDvGFJGzOGYyUmmXCrG4fKn1QsQkeHparjLgXEgsc7jAg00ulnkbeYn+YPRdc0K5 UF8Rq2m9TNDbv6DoqXf0To4Y4E9HFa+BaCrHlDVsp8ihqicQyYpeKwd/tod+krYIpW+A dDb/VsCFSbgO5PQCovYI+0/rD5CUYRxjNb24bK5K9nR8gjVfpKUkS4rTsy7MMkY834SA nIxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779340427; x=1779945227; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7YPZxWestxZ6ZeoppNL4aB518UjR8C+o/ws24cKnfpM=; b=BEj/3fRsQ2pfhdTYRLqa+r9evJPOhv4EfcBvx+ZCCnKOLM1dg0UwSZWb4ekGKeyRNF c8FaDNXgP/PYR9iPOk9GLmoAmaV2ex1AUHUlzIjL4REePzO+mHFqdz3t0sUP8TSUMrcp 41Q9qVII3nLUqkA2wBHdq1JGQDEF38P0pjTuMLnnULLvT3GJXWFWA8zk8wkA1UKcPZPH ENnAxxDD+vw2/58gCAdWeyhJ2+pvknWRcFSmM7WqBYQr6EAwZtlac9NaEM793i4qy0Jg e9Nt9pDzsOaXPtptmv7T/mgdONIwmfwbbihjtBL6ovJ1jbSJfXJg8zxp3oljpv2ehz8Z j23g== X-Forwarded-Encrypted: i=1; AFNElJ82gAvHfVTd4gcJQFKmrxiZe7JU+q6p9NOy4pjR9LcHauvwMKSzevjRuVKuVgp7yDLsD9ZSdXPNoLZbuyI=@vger.kernel.org X-Gm-Message-State: AOJu0Ywy4TL3nWfm2WvjoLOkuHvnrdYxvYMh4ZERAxSaISvNTT+dRl0J CSVZgLwfd+fWG+cuCc3UM/EoNF/YuZSBxDmCqxmaIj61hDB0jW35Mq8X X-Gm-Gg: Acq92OEdIGsfrAEJuVot5A6EgFQKuCwIzaYHteYUAo+RLMwxQRggstMKao8+kdChfja 12oYgge0mMqe3DdcvW8cqoo7ktoG6i+Or+EbRkz1EFpt0qgCZSKs/4YhMj/lTFqbqE9/Ahfzo82 MIlopLA2adhNYTFA5FWYvjoK5qx87A01np9gQosnEBvb2eUvPVp3StZPXmuDHSM4ynydYdQBNZW 0vD58pIqtEzOJS+iaFIf+3YcUZk8wBJCLXHjmfHDDhoMugXx/fKt9DBORO/6D3Ukua+yFyuNhIZ sxxPkqqqi1/oDS/gluXrqS6izqZrrLss0qMgv+s4WWh3/wpaKXfpTJ/lh7oos/TuM6DdsW8dH04 lWwzD3em+b5fXF/HwS1whChi0A0UqgzIwXnzs7Pbg+RCe+5kQ80XdeDdQFE+BGoAZ3o/2Dkof99 bF7i8A1GkwcYlnEXo/2bgT7z054QZD0vvHq1exyuw+K9MpLv90rhY5kXbBR9t3ANV0e4o9uMnkj 4rk6nxDONJKnF4piRoBZsFi X-Received: by 2002:a05:7022:f91:b0:129:1d25:f1da with SMTP id a92af1059eb24-13633a69b63mr617788c88.3.1779340426708; Wed, 20 May 2026 22:13:46 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d457:597:d576:1eb8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-135e5c0a918sm6231360c88.14.2026.05.20.22.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 22:13:45 -0700 (PDT) From: Dmitry Torokhov Date: Wed, 20 May 2026 22:13:20 -0700 Subject: [PATCH v2 4/5] pinctrl: renesas: gpio: support software nodes for function GPIOs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-rsk7203-properties-v2-4-465f3308021b@gmail.com> References: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> In-Reply-To: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> To: Rich Felker , John Paul Adrian Glaubitz Cc: Yoshinori Sato , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org X-Mailer: b4 0.16-dev-6911d This patch extends the sh-pfc GPIO driver to support software-node-based configuration for the secondary 'function' GPIO chip. While the primary GPIO chip typically uses the firmware node attached to the parent platform device, the secondary chip should target a specific child node to avoid ambiguity when defining GPIO hogs or properties. Update gpio_function_setup() to look for a child node named 'functions', but only when the parent is a software node. This ensures the behavior is restricted to legacy platforms being migrated to software nodes. Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov Reviewed-by: Bartosz Golaszewski --- drivers/pinctrl/renesas/gpio.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c index 4e59dadb7364..b49a3e14da91 100644 --- a/drivers/pinctrl/renesas/gpio.c +++ b/drivers/pinctrl/renesas/gpio.c @@ -271,18 +271,40 @@ static int gpio_function_request(struct gpio_chip *gc= , unsigned offset) return ret; } =20 +static void sh_pfc_fwnode_put(void *data) +{ + fwnode_handle_put(data); +} + static int gpio_function_setup(struct sh_pfc_chip *chip) { struct sh_pfc *pfc =3D chip->pfc; struct gpio_chip *gc =3D &chip->gpio_chip; + struct fwnode_handle *fwnode =3D dev_fwnode(pfc->dev); =20 gc->request =3D gpio_function_request; =20 + if (is_software_node(fwnode)) { + fwnode =3D fwnode_get_named_child_node(fwnode, "functions"); + if (fwnode) { + int ret; + + ret =3D devm_add_action_or_reset(pfc->dev, + sh_pfc_fwnode_put, + fwnode); + if (ret) + return ret; + + gc->fwnode =3D fwnode; + } + } + /* - * Explicitly mask the parent's fwnode to prevent gpiolib from - * reusing it for function GPIOs. + * If we did not find 'functions' node, explicitly mask the parent's + * fwnode to prevent gpiolib from reusing it for function GPIOs. */ - gc->fwnode =3D ERR_PTR(-ENODEV); + if (!gc->fwnode) + gc->fwnode =3D ERR_PTR(-ENODEV); =20 gc->label =3D pfc->info->name; gc->owner =3D THIS_MODULE; --=20 2.54.0.669.g59709faab0-goog From nobody Sun May 24 21:38:46 2026 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CC9733DEE1 for ; Thu, 21 May 2026 05:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340443; cv=none; b=oCZO03sf7A9cqwBq5J2nbH6Dj7l9il7IDwaiMn2Plzr04O2UNXOdyIEW8v2m2bXsb27L7UYaVhXbTEoQ4ql/1EMYj2qypj2Y8ybKLGEE4razR6084RCU41d2P0kJiWsYrXP000f1/C64/xm7PF/Zfsv5AoW6uMNYQI9/n5k5/Io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779340443; c=relaxed/simple; bh=84IYOUDRqLdOZnUza+I5M9XOglV9RpLSILXCdsenQOo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XAQD+DeqJ7omR4NQaT8y85hs9tW2OGX2j8uK8ufjyMVShb+ZJMhbV1QZGFjVJvA/9EnNP4uzd+wIKBYSaTPJox4LxrPKclliB8xz4S99SuRipNB3tT+1lOOFwNh+LGkFNGKjhB8HU7Xq1jUNQdk/u1YRh4Z/DW4vgY/fUef7HHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gqgccGcL; arc=none smtp.client-ip=74.125.82.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gqgccGcL" Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-12c19d23b19so7778293c88.0 for ; Wed, 20 May 2026 22:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779340428; x=1779945228; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dC01VeKjcCopxQgK4IvKVGSUYqXlRoKtYIJqUaE3G8s=; b=gqgccGcL7ikNdfUlba6O0OKe01h8wGXTVdhJwTJjWMeGH+B/tPkwxhkSSNjmbONHn8 kG9VeCsGByrR0XeiCjydp+FaObjJbw1b4BHhbrrxHHlrN3cGrwYPCi8f2EA1Bl7WUzzL zHsCl6wMaAPHfHo/72B8i/Ia1VuLkfiuWoD22WMwrI0lhkGCtFnQ86uJ7hg28Xzs2ZDn X7WOiM4aWQg+ztNGr7t01adly3kMGAGAlPvkUNphStKMq1RCnGBCWKZ71vtmtHyunPes NSARwOfNTRxzmKH/EpRlufEPXTXYHNXN6QiQJ0XQW+uwZVoCpn+J87xs4XwOZMQZNtH1 KbJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779340428; x=1779945228; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=dC01VeKjcCopxQgK4IvKVGSUYqXlRoKtYIJqUaE3G8s=; b=cCHQCKsmbXFeGRGcloVEKUal7EnNY5wHfW9GEk12+CehhhhgH1zMupGIAJV8Uy4bAe 6TX4xUol+c9UxJ3egUu3VkmqxN4kZQOt0hm3d352c5OA4wVvMat23jdSLiqngbmgZzrm xiHsm9L/VrJ612JM17IP6fsML5Q+gmKmsMblSSPDnZcc8szXgbLO9wyh1tSYvbto3JzL VM2UhrWm+zXby9CP6IiMaSJ71AGgzTAYQfCuvKSkIDde/nj08JL/DSpeMh5vMMzoAO9n E83PehD8VaTdIi5wkUA5zu57qeYCmvZ0En8LhsPxbqyQtdAp+GPhgZ0o/qlRfXgZO6ba lrhQ== X-Forwarded-Encrypted: i=1; AFNElJ+2Oas6z0HEdwia2wYXKeti8FjPcBTytj+KYtzB5PJauObtivpt2RrR+tMxP7qaaIQvLR+zHC27mB8hCKM=@vger.kernel.org X-Gm-Message-State: AOJu0YzOUtMFLy5a2T5kBVbkM3FmFsoKXGfmtjbs1wyVNXXc6sBHffuU HAWl5KU8FCwVH9iGhXoDDsW4jtIQSRKcgrxFGzr8s8RMw2K5R0x+HGyN X-Gm-Gg: Acq92OEmSqTRPzFTJVp1hDiipkw6acFrP39/6yiKZXS3MGshlLz2oL6E8M79IkQV5ma NVbvl1Z8M+OKEPy5yGEnvXcyOTwMQcX1YLS1lyqd0wM4OCYopJPtaoAIo56R7Zk8GEu/T93BSU4 1pDytLloQNQFUkSHTKVMj5I3RraM77amzyVOkqIRpPqGH2FCsK5uE9qU3pZ4Em2qm8XO/34lFNw OEMJ7SaxqiDsoNhPYj9UdHqitIQsdEOidNl5Qe+4ZoonxyTv9j52XPcerpREPDrpA/r9qTQlSAt wfoRxwh/U24IWR1MashR+xef1YTgrvyQcDn6URVXiMjnrl3kwuH5PufvPhwmXi+IlPCMcLeOhxm /pSMz3ih+294z5SOmpQ4yZRELs/mqS1Otlug408ll5wi8rnFxATXDK8ygoEZ4L9+4vlewwYEk9R 689fn2tpQQ3DIapNqEhJ2czj5nVh7QDtVVwbigWcnn8j9p7iYdQ8hQyiVZi8oiMr0fKR6xvMucf Yi1opyr2d05OA== X-Received: by 2002:a05:7022:438c:b0:134:a6f0:6f08 with SMTP id a92af1059eb24-13632f60d3amr652796c88.39.1779340428152; Wed, 20 May 2026 22:13:48 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d457:597:d576:1eb8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-135e5c0a918sm6231360c88.14.2026.05.20.22.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 22:13:47 -0700 (PDT) From: Dmitry Torokhov Date: Wed, 20 May 2026 22:13:21 -0700 Subject: [PATCH v2 5/5] sh: mach-rsk: rsk7203: convert pin configuration to using software nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-rsk7203-properties-v2-5-465f3308021b@gmail.com> References: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> In-Reply-To: <20260520-rsk7203-properties-v2-0-465f3308021b@gmail.com> To: Rich Felker , John Paul Adrian Glaubitz Cc: Yoshinori Sato , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org X-Mailer: b4 0.16-dev-6911d Replace legacy gpio_request() calls used to configure function pins (SCIF0 TXD/RXD and LAN9118 IRQ) with software nodes describing GPIO hogs. These hogs are attached to the PFC gpiochip node, allowing the GPIO subsystem to automatically configure these pins when the driver is registered. Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov Reviewed-by: Bartosz Golaszewski --- arch/sh/boards/mach-rsk/devices-rsk7203.c | 97 +++++++++++++++++++++++++++= ---- 1 file changed, 85 insertions(+), 12 deletions(-) diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mac= h-rsk/devices-rsk7203.c index f8760a91e2f1..e8a8fc1d2ca9 100644 --- a/arch/sh/boards/mach-rsk/devices-rsk7203.c +++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -131,6 +130,56 @@ static const struct software_node rsk7203_sw3_key_node= =3D { }, }; =20 +/* The base of the function GPIOs in the flat enum */ +#define SH7203_FN_BASE GPIO_FN_PINT7_PB + +static const struct software_node rsk7203_pfc_functions_node =3D { + .name =3D "functions", + .parent =3D &pfc_gpiochip_node, +}; + +static const struct software_node rsk7203_txd0_hog_node =3D { + .name =3D "txd0-hog", + .parent =3D &rsk7203_pfc_functions_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_BOOL("gpio-hog"), + PROPERTY_ENTRY_U32_ARRAY("gpios", ((u32[]){ + GPIO_FN_TXD0 - SH7203_FN_BASE, GPIO_ACTIVE_HIGH + })), + PROPERTY_ENTRY_BOOL("input"), + PROPERTY_ENTRY_STRING("line-name", "TXD0"), + { } + }, +}; + +static const struct software_node rsk7203_rxd0_hog_node =3D { + .name =3D "rxd0-hog", + .parent =3D &rsk7203_pfc_functions_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_BOOL("gpio-hog"), + PROPERTY_ENTRY_U32_ARRAY("gpios", ((u32[]){ + GPIO_FN_RXD0 - SH7203_FN_BASE, GPIO_ACTIVE_HIGH + })), + PROPERTY_ENTRY_BOOL("input"), + PROPERTY_ENTRY_STRING("line-name", "RXD0"), + { } + }, +}; + +static const struct software_node rsk7203_irq0_hog_node =3D { + .name =3D "irq0-hog", + .parent =3D &rsk7203_pfc_functions_node, + .properties =3D (const struct property_entry[]) { + PROPERTY_ENTRY_BOOL("gpio-hog"), + PROPERTY_ENTRY_U32_ARRAY("gpios", ((u32[]){ + GPIO_FN_IRQ0_PB - SH7203_FN_BASE, GPIO_ACTIVE_HIGH + })), + PROPERTY_ENTRY_BOOL("input"), + PROPERTY_ENTRY_STRING("line-name", "IRQ0_PB"), + { } + }, +}; + static const struct software_node * const rsk7203_swnodes[] __initconst = =3D { &rsk7203_gpio_leds_node, &rsk7203_green_led_node, @@ -141,6 +190,10 @@ static const struct software_node * const rsk7203_swno= des[] __initconst =3D { &rsk7203_sw1_key_node, &rsk7203_sw2_key_node, &rsk7203_sw3_key_node, + &rsk7203_pfc_functions_node, + &rsk7203_txd0_hog_node, + &rsk7203_rxd0_hog_node, + &rsk7203_irq0_hog_node, NULL }; =20 @@ -165,26 +218,46 @@ static const struct platform_device_info rsk7203_devi= ces[] __initconst =3D { }, }; =20 -static int __init rsk7203_devices_setup(void) +/* + * The pfc-sh7203 device is registered at arch_initcall level, and the + * sh-pfc driver (registered at postcore_initcall level) probes as soon + * as the device is created. + * + * We need to register our software nodes at postcore_initcall level so + * they are already present in the system when the driver probes and + * tries to apply GPIO hogs. + */ +static int __init rsk7203_sw_nodes_setup(void) { - struct platform_device *pd; int error; - int i; =20 - /* Select pins for SCIF0 */ - gpio_request(GPIO_FN_TXD0, NULL); - gpio_request(GPIO_FN_RXD0, NULL); - - /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */ - __raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */ - gpio_request(GPIO_FN_IRQ0_PB, NULL); + error =3D software_node_register(&pfc_gpiochip_node); + if (error && error !=3D -EEXIST) { + pr_err("RSK7203: failed to register PFC software node: %d\n", + error); + return error; + } =20 error =3D software_node_register_node_group(rsk7203_swnodes); if (error) { - pr_err("failed to register software nodes: %d\n", error); + pr_err("RSK7203: failed to register board software nodes: %d\n", + error); return error; } =20 + return 0; +} +postcore_initcall(rsk7203_sw_nodes_setup); + +static int __init rsk7203_devices_setup(void) +{ + struct platform_device *pd; + int error; + int i; + + /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */ + __raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */ + for (i =3D 0; i < ARRAY_SIZE(rsk7203_devices); i++) { pd =3D platform_device_register_full(&rsk7203_devices[i]); error =3D PTR_ERR_OR_ZERO(pd); --=20 2.54.0.669.g59709faab0-goog