public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] gpio: add PMIO support to gpio-mmio
@ 2026-04-07 18:48 Jose Javier Rodriguez Barbarin
  2026-04-07 18:48 ` [RFC PATCH 1/5] gpio: generic: add a generic register wrapper for MMIO and PMIO Jose Javier Rodriguez Barbarin
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Jose Javier Rodriguez Barbarin @ 2026-04-07 18:48 UTC (permalink / raw)
  To: linusw, brgl; +Cc: linux-gpio, linux-kernel, Jose Javier Rodriguez Barbarin

This series is an RFC for adding port-mapped I/O (PMIO) support to
gpio-mmio.

The initial motivation was to add PMIO support to gpio-menz127, as we
plan to support this across MCB client drivers. Since gpio-menz127
currently relies on the gpio_generic_chip API, adding PMIO support only
in that driver would require a significant refactoring, including
separate callbacks for memory-mapped and port-mapped accesses.

While looking into this, I noticed a TODO item added by Linus Walleij
about extending gpio-mmio to support port-mapped devices. Based on that,
this series explores adding PMIO support to gpio-mmio instead of
handling it in individual drivers.

The main goal of this approach is to preserve compatibility with
existing MMIO drivers using gpio_generic_chip while extending the API to
also describe PMIO-backed registers. To achieve that, the series extends
struct gpio_generic_chip_config with dedicated fields for port-mapped
registers.

To handle the different register address types used by MMIO
(void __iomem *) and PMIO (unsigned long), this series introduces a
small wrapper structure that can represent both. The read_reg() and
write_reg() callbacks are then updated to operate on this common
representation.

This series has been tested with gpio-menz127, and the driver worked
correctly with both MMIO and PMIO devices.

This is being sent as RFC because I would like feedback on the overall
approach before proceeding further.

In particular, feedback would be appreciated on:
- whether extending gpio_generic_chip_config is the right direction;
- whether introducing a common MMIO/PMIO register descriptor is
  acceptable;
- whether PMIO support should instead be implemented differently in
  gpio-mmio.

Jose Javier Rodriguez Barbarin (5):
  gpio: generic: add a generic register wrapper for MMIO and PMIO
  gpio: generic: extend gpio_generic_chip_config with PMIO register
    fields
  gpio: generic: add io_port to struct gpio_generic_chip
  gpio: mmio: convert accessors to generic register descriptors
  gpio: mmio: add port-mapped read/write callbacks

 drivers/gpio/gpio-mmio.c     | 277 +++++++++++++++++++++++++----------
 include/linux/gpio/generic.h |  49 +++++--
 2 files changed, 243 insertions(+), 83 deletions(-)

-- 
2.53.0

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-04-10  7:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [RFC PATCH 1/5] gpio: generic: add a generic register wrapper for MMIO and PMIO Jose Javier Rodriguez Barbarin
2026-04-09  7:53   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox