From: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
To: linusw@kernel.org, brgl@kernel.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Jose Javier Rodriguez Barbarin
<dev-josejavier.rodriguez@duagon.com>
Subject: [RFC PATCH 1/5] gpio: generic: add a generic register wrapper for MMIO and PMIO
Date: Tue, 7 Apr 2026 20:48:01 +0200 [thread overview]
Message-ID: <20260407184805.807328-2-dev-josejavier.rodriguez@duagon.com> (raw)
In-Reply-To: <20260407184805.807328-1-dev-josejavier.rodriguez@duagon.com>
For adding support to port-mapped devices within gpio_generic_chip, a new
data type is required for passing to read_reg() and write_reg()
callbacks as I/O port-mapped and memory-mapped registers use different
data types.
Introduce a new struct gpio_chip_reg to encapsulate mmio addresses and
I/O port numbers.
Signed-off-by: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
---
include/linux/gpio/generic.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/gpio/generic.h b/include/linux/gpio/generic.h
index ff566dc9c3cb..87c624070901 100644
--- a/include/linux/gpio/generic.h
+++ b/include/linux/gpio/generic.h
@@ -18,6 +18,7 @@ struct device;
#define GPIO_GENERIC_NO_SET_ON_INPUT BIT(6)
#define GPIO_GENERIC_PINCTRL_BACKEND BIT(7) /* Call pinctrl direction setters */
#define GPIO_GENERIC_NO_INPUT BIT(8) /* only output */
+#define GPIO_GENERIC_PORT_MAPPED BIT(9) /* port-mapped */
/**
* struct gpio_generic_chip_config - Generic GPIO chip configuration data
@@ -56,6 +57,19 @@ struct gpio_generic_chip_config {
unsigned long flags;
};
+/**
+ * struct gpio_chip_reg - Generic GPIO chip register descriptor for MMIO or port-mapped I/O
+ * @mmio: MMIO register address.
+ * @port: I/O Port register address.
+ *
+ * Describes a GPIO chip register located either in MMIO space or in
+ * port-mapped I/O space.
+ */
+struct gpio_chip_reg {
+ void __iomem *mmio;
+ unsigned long port;
+};
+
/**
* struct gpio_generic_chip - Generic GPIO chip implementation.
* @gc: The underlying struct gpio_chip object, implementing low-level GPIO
--
2.53.0
next prev parent reply other threads:[~2026-04-07 18:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 18:48 [RFC PATCH 0/5] gpio: add PMIO support to gpio-mmio Jose Javier Rodriguez Barbarin
2026-04-07 18:48 ` Jose Javier Rodriguez Barbarin [this message]
2026-04-09 7:53 ` [RFC PATCH 1/5] gpio: generic: add a generic register wrapper for MMIO and PMIO Linus Walleij
2026-04-07 18:48 ` [RFC PATCH 2/5] gpio: generic: extend gpio_generic_chip_config with PMIO register fields Jose Javier Rodriguez Barbarin
2026-04-09 7:59 ` Linus Walleij
2026-04-07 18:48 ` [RFC PATCH 3/5] gpio: generic: add io_port to struct gpio_generic_chip Jose Javier Rodriguez Barbarin
2026-04-09 8:04 ` Linus Walleij
2026-04-09 8:21 ` Linus Walleij
2026-04-07 18:48 ` [RFC PATCH 4/5] gpio: mmio: convert accessors to generic register descriptors Jose Javier Rodriguez Barbarin
2026-04-09 8:07 ` Linus Walleij
2026-04-10 7:10 ` Jose Javier Rodriguez Barbarin
2026-04-07 18:48 ` [RFC PATCH 5/5] gpio: mmio: add port-mapped read/write callbacks Jose Javier Rodriguez Barbarin
2026-04-09 8:08 ` Linus Walleij
2026-04-09 8:14 ` [RFC PATCH 0/5] gpio: add PMIO support to gpio-mmio Linus Walleij
2026-04-10 7:44 ` Jose Javier Rodriguez Barbarin
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=20260407184805.807328-2-dev-josejavier.rodriguez@duagon.com \
--to=dev-josejavier.rodriguez@duagon.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®