From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller
Date: Sat, 04 Jul 2026 22:04:37 -0700 [thread overview]
Message-ID: <20260704-sh-x3proto-swnode-v1-1-0c039549dc46@gmail.com> (raw)
In-Reply-To: <20260704-sh-x3proto-swnode-v1-0-0c039549dc46@gmail.com>
We want to convert the legacy gpio-keys platform device on the SH-X3
Prototype board to use software nodes. To do this properly and allow
referencing the GPIO controller by address rather than relying on
name-based matching (which is being removed from the gpiolib core),
we need to associate the GPIO controller with a software node.
Introduce x3proto_gpiochip_node, register it, and associate it with
x3proto_gpio_chip.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/sh/boards/mach-x3proto/gpio.c | 15 ++++++++++++++-
arch/sh/include/mach-x3proto/mach/hardware.h | 2 ++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
index c13d51b29702..a09cafc782b4 100644
--- a/arch/sh/boards/mach-x3proto/gpio.c
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -18,6 +18,7 @@
#include <linux/io.h>
#include <mach/ilsel.h>
#include <mach/hardware.h>
+#include <linux/property.h>
#define KEYCTLR 0xb81c0000
#define KEYOUTR 0xb81c0002
@@ -73,6 +74,10 @@ static void x3proto_gpio_irq_handler(struct irq_desc *desc)
chip->irq_unmask(data);
}
+const struct software_node x3proto_gpiochip_node = {
+ .name = "x3proto-gpio",
+};
+
struct gpio_chip x3proto_gpio_chip = {
.label = "x3proto-gpio",
.direction_input = x3proto_gpio_direction_input,
@@ -104,9 +109,15 @@ int __init x3proto_gpio_setup(void)
if (unlikely(ilsel < 0))
return ilsel;
+ ret = software_node_register(&x3proto_gpiochip_node);
+ if (ret)
+ goto err_gpio;
+
+ x3proto_gpio_chip.fwnode = software_node_fwnode(&x3proto_gpiochip_node);
+
ret = gpiochip_add_data(&x3proto_gpio_chip, NULL);
if (unlikely(ret))
- goto err_gpio;
+ goto err_swnode;
x3proto_irq_domain = irq_domain_create_linear(NULL, NR_BASEBOARD_GPIOS,
&x3proto_gpio_irq_ops, NULL);
@@ -127,6 +138,8 @@ int __init x3proto_gpio_setup(void)
err_irq:
gpiochip_remove(&x3proto_gpio_chip);
ret = 0;
+err_swnode:
+ software_node_unregister(&x3proto_gpiochip_node);
err_gpio:
synchronize_irq(ilsel);
diff --git a/arch/sh/include/mach-x3proto/mach/hardware.h b/arch/sh/include/mach-x3proto/mach/hardware.h
index 57ea4a5cca35..1ee5a404973c 100644
--- a/arch/sh/include/mach-x3proto/mach/hardware.h
+++ b/arch/sh/include/mach-x3proto/mach/hardware.h
@@ -3,10 +3,12 @@
#define __MACH_X3PROTO_HARDWARE_H
struct gpio_chip;
+struct software_node;
/* arch/sh/boards/mach-x3proto/gpio.c */
int x3proto_gpio_setup(void);
extern struct gpio_chip x3proto_gpio_chip;
+extern const struct software_node x3proto_gpiochip_node;
#define NR_BASEBOARD_GPIOS 16
--
2.55.0.rc0.799.gd6f94ed593-goog
next prev parent reply other threads:[~2026-07-05 5:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov
2026-07-05 5:04 ` Dmitry Torokhov [this message]
2026-09-17 12:28 ` [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller John Paul Adrian Glaubitz
2026-07-05 5:04 ` [PATCH 2/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov
2026-09-17 18:49 ` John Paul Adrian Glaubitz
2026-09-28 5:28 ` Dmitry Torokhov
2026-09-28 5:56 ` John Paul Adrian Glaubitz
2026-09-29 7:31 ` John Paul Adrian Glaubitz
2026-09-30 5:03 ` Dmitry Torokhov
2026-09-30 5:34 ` John Paul Adrian Glaubitz
2026-07-06 9:47 ` [PATCH 0/2] " Bartosz Golaszewski
2026-07-10 18:50 ` Linus Walleij
2026-09-09 17:00 ` Dmitry Torokhov
2026-09-09 18:06 ` John Paul Adrian Glaubitz
2026-09-12 11:14 ` John Paul Adrian Glaubitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260704-sh-x3proto-swnode-v1-1-0c039549dc46@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=arnd@arndb.de \
--cc=brgl@kernel.org \
--cc=dalias@libc.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®