Skip to contentSkip to conversation

gpio: Add Intel Granite Rapids-D vGPIO driver

PATCH In review Aapo Vienamo 2 participants 3 messages Apr 23, 2024 – Apr 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gpio: Add Intel Granite Rapids-D vGPIO driver

This driver provides a basic GPIO driver for the Intel Granite Rapids-D virtual GPIOs. On SoCs with limited physical pins on the package, the physical pins controlled by this driver would be exposed on an external device such as a BMC or CPLD. The virtual GPIO registers are an interface to firmware, which communicates with the external device that implements the GPIO hardware functionality.

---
v2 changes:
- Add more detail to commit message and Kconfig help
- Rename gnr_gpio_configure_pad() to gnr_gpio_configure_line()
- Use GENMASK() and FIELD_PREP() for register definitions

---
 MAINTAINERS                       |   1 +
 drivers/gpio/Kconfig              |  18 ++
 drivers/gpio/Makefile             |   1 +
 drivers/gpio/gpio-graniterapids.c | 384 ++++++++++++++++++++++++++++++
 4 files changed, 404 insertions(+)
 create mode 100644 drivers/gpio/gpio-graniterapids.c
MAINTAINERS +1 -0
index 7c5760f4484f..cd97f6fcc3c0 100644
@@ -10995,6 +10995,7 @@ L:	[email protected]
 S:	Supported
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
 F:	drivers/gpio/gpio-elkhartlake.c
+F:	drivers/gpio/gpio-graniterapids.c
 F:	drivers/gpio/gpio-ich.c
 F:	drivers/gpio/gpio-merrifield.c
 F:	drivers/gpio/gpio-ml-ioh.c
drivers/gpio/Kconfig +18 -0
index 00b5c007a2bb..3dbddec07028 100644
@@ -321,6 +321,24 @@ config GPIO_GENERIC_PLATFORM
 	help
 	  Say yes here to support basic platform_device memory-mapped GPIO controllers.
 
+config GPIO_GRANITERAPIDS
+	tristate "Intel Granite Rapids-D vGPIO support"
+	depends on X86 || COMPILE_TEST
+	select GPIOLIB_IRQCHIP
+	help
+	  Select this to enable virtual GPIO support on platforms with the
+	  following SoCs:
+
+	  - Intel Granite Rapids-D
+
+	  The driver enables basic GPIO functionality and implements interrupt
+	  support. The virtual GPIO driver controls GPIO lines via a firmware
+	  interface. The physical GPIO pins reside on device that is external
+	  from the main SoC package, such as a BMC or a CPLD.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called gpio-graniterapids.
+
 config GPIO_GRGPIO
 	tristate "Aeroflex Gaisler GRGPIO support"
 	depends on OF_GPIO
drivers/gpio/Makefile +1 -0
index fdd28c58d890..e2a53013780e 100644
@@ -66,6 +66,7 @@ obj-$(CONFIG_GPIO_FTGPIO010)		+= gpio-ftgpio010.o
 obj-$(CONFIG_GPIO_FXL6408)		+= gpio-fxl6408.o
 obj-$(CONFIG_GPIO_GE_FPGA)		+= gpio-ge.o
 obj-$(CONFIG_GPIO_GPIO_MM)		+= gpio-gpio-mm.o
+obj-$(CONFIG_GPIO_GRANITERAPIDS)	+= gpio-graniterapids.o
 obj-$(CONFIG_GPIO_GRGPIO)		+= gpio-grgpio.o
 obj-$(CONFIG_GPIO_GW_PLD)		+= gpio-gw-pld.o
 obj-$(CONFIG_GPIO_HISI)                 += gpio-hisi.o
drivers/gpio/gpio-graniterapids.c new file +384 -0

384 lines not on this page · raw message

Signature · 1 line
2.44.0
maintainer
#1 lore raw
Quoted 6 lines · Aapo Vienamo

This driver provides a basic GPIO driver for the Intel Granite Rapids-D virtual GPIOs. On SoCs with limited physical pins on the package, the physical pins controlled by this driver would be exposed on an external device such as a BMC or CPLD. The virtual GPIO registers are an interface to firmware, which communicates with the external device that implements the GPIO hardware functionality.

...

drivers/gpio/gpio-graniterapids.c line 13

Quoted 2 lines
drivers/gpio/gpio-graniterapids.c new file +2 -0
+#include <linux/bitmap.h>
+#include <linux/bits.h>

The latter is guaranteed to be included by the former. I can amend this when applying.

...

I'll wait for others to review for a while. I want to send my PR to Bart at the end of this week.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
In reply to Aapo Vienamo
Quoted 6 lines · Aapo Vienamo

This driver provides a basic GPIO driver for the Intel Granite Rapids-D virtual GPIOs. On SoCs with limited physical pins on the package, the physical pins controlled by this driver would be exposed on an external device such as a BMC or CPLD. The virtual GPIO registers are an interface to firmware, which communicates with the external device that implements the GPIO hardware functionality.

Pushed to my review and testing queue, thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko