]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/intel: Introduce Intel Elkhart Lake PSE I/O
authorRaag Jadav <raag.jadav@intel.com>
Wed, 12 Nov 2025 03:40:10 +0000 (09:10 +0530)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 19 Nov 2025 13:08:51 +0000 (14:08 +0100)
Intel Elkhart Lake Programmable Service Engine (PSE) includes two PCI
devices that expose two different capabilities of GPIO and Timed I/O
as a single PCI function through shared MMIO with below layout.

GPIO: 0x0000 - 0x1000
TIO:  0x1000 - 0x2000

This driver enumerates the PCI parent device and creates auxiliary child
devices for these capabilities. The actual functionalities are provided
by their respective auxiliary drivers.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20251112034040.457801-2-raag.jadav@intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
MAINTAINERS
drivers/platform/x86/intel/Kconfig
drivers/platform/x86/intel/Makefile
drivers/platform/x86/intel/ehl_pse_io.c [new file with mode: 0644]
include/linux/ehl_pse_io_aux.h [new file with mode: 0644]

index 3da2c26a796b82b9de4143c1591a9b1d44d42194..00e2cb65ddecf62f6fe4207f30ff166cddd32b79 100644 (file)
@@ -12505,6 +12505,13 @@ F:     drivers/gpu/drm/xe/
 F:     include/drm/intel/
 F:     include/uapi/drm/xe_drm.h
 
+INTEL ELKHART LAKE PSE I/O DRIVER
+M:     Raag Jadav <raag.jadav@intel.com>
+L:     platform-driver-x86@vger.kernel.org
+S:     Supported
+F:     drivers/platform/x86/intel/ehl_pse_io.c
+F:     include/linux/ehl_pse_io_aux.h
+
 INTEL ETHERNET DRIVERS
 M:     Tony Nguyen <anthony.l.nguyen@intel.com>
 M:     Przemek Kitszel <przemyslaw.kitszel@intel.com>
index 19a2246f2770240d4eb470442303251e0f142e3f..2900407d60955a54d6bb444a0d68f534f41c9908 100644 (file)
@@ -41,6 +41,19 @@ config INTEL_VBTN
          To compile this driver as a module, choose M here: the module will
          be called intel_vbtn.
 
+config INTEL_EHL_PSE_IO
+       tristate "Intel Elkhart Lake PSE I/O driver"
+       depends on PCI
+       select AUXILIARY_BUS
+       help
+         Select this option to enable Intel Elkhart Lake PSE GPIO and Timed
+         I/O support. This driver enumerates the PCI parent device and
+         creates auxiliary child devices for these capabilities. The actual
+         functionalities are provided by their respective auxiliary drivers.
+
+         To compile this driver as a module, choose M here: the module will
+         be called intel_ehl_pse_io.
+
 config INTEL_INT0002_VGPIO
        tristate "Intel ACPI INT0002 Virtual GPIO driver"
        depends on GPIOLIB && ACPI && PM_SLEEP
index 78acb414e1540da98eac5f020a3b6ad342ce25ec..138b137561583320af58377c65fe68020544d09c 100644 (file)
@@ -21,6 +21,7 @@ intel-target-$(CONFIG_INTEL_HID_EVENT)                += hid.o
 intel-target-$(CONFIG_INTEL_VBTN)              += vbtn.o
 
 # Intel miscellaneous drivers
+intel-target-$(CONFIG_INTEL_EHL_PSE_IO)                += ehl_pse_io.o
 intel-target-$(CONFIG_INTEL_INT0002_VGPIO)     += int0002_vgpio.o
 intel-target-$(CONFIG_INTEL_ISHTP_ECLITE)      += ishtp_eclite.o
 intel-target-$(CONFIG_INTEL_OAKTRAIL)          += oaktrail.o
diff --git a/drivers/platform/x86/intel/ehl_pse_io.c b/drivers/platform/x86/intel/ehl_pse_io.c
new file mode 100644 (file)
index 0000000..861e148
--- /dev/null
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Intel Elkhart Lake Programmable Service Engine (PSE) I/O
+ *
+ * Copyright (c) 2025 Intel Corporation.
+ *
+ * Author: Raag Jadav <raag.jadav@intel.com>
+ */
+
+#include <linux/auxiliary_bus.h>
+#include <linux/device/devres.h>
+#include <linux/errno.h>
+#include <linux/gfp_types.h>
+#include <linux/ioport.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/sizes.h>
+#include <linux/types.h>
+
+#include <linux/ehl_pse_io_aux.h>
+
+#define EHL_PSE_IO_DEV_SIZE    SZ_4K
+
+static int ehl_pse_io_dev_create(struct pci_dev *pci, const char *name, int idx)
+{
+       struct device *dev = &pci->dev;
+       struct auxiliary_device *adev;
+       struct ehl_pse_io_data *data;
+       resource_size_t start, offset;
+       u32 id;
+
+       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci);
+       start = pci_resource_start(pci, 0);
+       offset = EHL_PSE_IO_DEV_SIZE * idx;
+
+       data->mem = DEFINE_RES_MEM(start + offset, EHL_PSE_IO_DEV_SIZE);
+       data->irq = pci_irq_vector(pci, idx);
+
+       adev = __devm_auxiliary_device_create(dev, EHL_PSE_IO_NAME, name, data, id);
+
+       return adev ? 0 : -ENODEV;
+}
+
+static int ehl_pse_io_probe(struct pci_dev *pci, const struct pci_device_id *id)
+{
+       int ret;
+
+       ret = pcim_enable_device(pci);
+       if (ret)
+               return ret;
+
+       pci_set_master(pci);
+
+       ret = pci_alloc_irq_vectors(pci, 2, 2, PCI_IRQ_MSI);
+       if (ret < 0)
+               return ret;
+
+       ret = ehl_pse_io_dev_create(pci, EHL_PSE_GPIO_NAME, 0);
+       if (ret)
+               return ret;
+
+       return ehl_pse_io_dev_create(pci, EHL_PSE_TIO_NAME, 1);
+}
+
+static const struct pci_device_id ehl_pse_io_ids[] = {
+       { PCI_VDEVICE(INTEL, 0x4b88) },
+       { PCI_VDEVICE(INTEL, 0x4b89) },
+       { }
+};
+MODULE_DEVICE_TABLE(pci, ehl_pse_io_ids);
+
+static struct pci_driver ehl_pse_io_driver = {
+       .name           = EHL_PSE_IO_NAME,
+       .id_table       = ehl_pse_io_ids,
+       .probe          = ehl_pse_io_probe,
+};
+module_pci_driver(ehl_pse_io_driver);
+
+MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
+MODULE_DESCRIPTION("Intel Elkhart Lake PSE I/O driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/ehl_pse_io_aux.h b/include/linux/ehl_pse_io_aux.h
new file mode 100644 (file)
index 0000000..afb8587
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Intel Elkhart Lake PSE I/O Auxiliary Device
+ *
+ * Copyright (c) 2025 Intel Corporation.
+ *
+ * Author: Raag Jadav <raag.jadav@intel.com>
+ */
+
+#ifndef _EHL_PSE_IO_AUX_H_
+#define _EHL_PSE_IO_AUX_H_
+
+#include <linux/ioport.h>
+
+#define EHL_PSE_IO_NAME                "ehl_pse_io"
+#define EHL_PSE_GPIO_NAME      "gpio"
+#define EHL_PSE_TIO_NAME       "pps_tio"
+
+struct ehl_pse_io_data {
+       struct resource mem;
+       int irq;
+};
+
+#endif /* _EHL_PSE_IO_AUX_H_ */