Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86/intel: Introduce Intel Elkhart Lake PSE I/O

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>

authored by

Raag Jadav and committed by
Bartosz Golaszewski
a0c83150 5ef5f3c2

+131
+7
MAINTAINERS
··· 12505 12505 F: include/drm/intel/ 12506 12506 F: include/uapi/drm/xe_drm.h 12507 12507 12508 + INTEL ELKHART LAKE PSE I/O DRIVER 12509 + M: Raag Jadav <raag.jadav@intel.com> 12510 + L: platform-driver-x86@vger.kernel.org 12511 + S: Supported 12512 + F: drivers/platform/x86/intel/ehl_pse_io.c 12513 + F: include/linux/ehl_pse_io_aux.h 12514 + 12508 12515 INTEL ETHERNET DRIVERS 12509 12516 M: Tony Nguyen <anthony.l.nguyen@intel.com> 12510 12517 M: Przemek Kitszel <przemyslaw.kitszel@intel.com>
+13
drivers/platform/x86/intel/Kconfig
··· 41 41 To compile this driver as a module, choose M here: the module will 42 42 be called intel_vbtn. 43 43 44 + config INTEL_EHL_PSE_IO 45 + tristate "Intel Elkhart Lake PSE I/O driver" 46 + depends on PCI 47 + select AUXILIARY_BUS 48 + help 49 + Select this option to enable Intel Elkhart Lake PSE GPIO and Timed 50 + I/O support. This driver enumerates the PCI parent device and 51 + creates auxiliary child devices for these capabilities. The actual 52 + functionalities are provided by their respective auxiliary drivers. 53 + 54 + To compile this driver as a module, choose M here: the module will 55 + be called intel_ehl_pse_io. 56 + 44 57 config INTEL_INT0002_VGPIO 45 58 tristate "Intel ACPI INT0002 Virtual GPIO driver" 46 59 depends on GPIOLIB && ACPI && PM_SLEEP
+1
drivers/platform/x86/intel/Makefile
··· 21 21 intel-target-$(CONFIG_INTEL_VBTN) += vbtn.o 22 22 23 23 # Intel miscellaneous drivers 24 + intel-target-$(CONFIG_INTEL_EHL_PSE_IO) += ehl_pse_io.o 24 25 intel-target-$(CONFIG_INTEL_INT0002_VGPIO) += int0002_vgpio.o 25 26 intel-target-$(CONFIG_INTEL_ISHTP_ECLITE) += ishtp_eclite.o 26 27 intel-target-$(CONFIG_INTEL_OAKTRAIL) += oaktrail.o
+86
drivers/platform/x86/intel/ehl_pse_io.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Intel Elkhart Lake Programmable Service Engine (PSE) I/O 4 + * 5 + * Copyright (c) 2025 Intel Corporation. 6 + * 7 + * Author: Raag Jadav <raag.jadav@intel.com> 8 + */ 9 + 10 + #include <linux/auxiliary_bus.h> 11 + #include <linux/device/devres.h> 12 + #include <linux/errno.h> 13 + #include <linux/gfp_types.h> 14 + #include <linux/ioport.h> 15 + #include <linux/mod_devicetable.h> 16 + #include <linux/module.h> 17 + #include <linux/pci.h> 18 + #include <linux/sizes.h> 19 + #include <linux/types.h> 20 + 21 + #include <linux/ehl_pse_io_aux.h> 22 + 23 + #define EHL_PSE_IO_DEV_SIZE SZ_4K 24 + 25 + static int ehl_pse_io_dev_create(struct pci_dev *pci, const char *name, int idx) 26 + { 27 + struct device *dev = &pci->dev; 28 + struct auxiliary_device *adev; 29 + struct ehl_pse_io_data *data; 30 + resource_size_t start, offset; 31 + u32 id; 32 + 33 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 34 + if (!data) 35 + return -ENOMEM; 36 + 37 + id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci); 38 + start = pci_resource_start(pci, 0); 39 + offset = EHL_PSE_IO_DEV_SIZE * idx; 40 + 41 + data->mem = DEFINE_RES_MEM(start + offset, EHL_PSE_IO_DEV_SIZE); 42 + data->irq = pci_irq_vector(pci, idx); 43 + 44 + adev = __devm_auxiliary_device_create(dev, EHL_PSE_IO_NAME, name, data, id); 45 + 46 + return adev ? 0 : -ENODEV; 47 + } 48 + 49 + static int ehl_pse_io_probe(struct pci_dev *pci, const struct pci_device_id *id) 50 + { 51 + int ret; 52 + 53 + ret = pcim_enable_device(pci); 54 + if (ret) 55 + return ret; 56 + 57 + pci_set_master(pci); 58 + 59 + ret = pci_alloc_irq_vectors(pci, 2, 2, PCI_IRQ_MSI); 60 + if (ret < 0) 61 + return ret; 62 + 63 + ret = ehl_pse_io_dev_create(pci, EHL_PSE_GPIO_NAME, 0); 64 + if (ret) 65 + return ret; 66 + 67 + return ehl_pse_io_dev_create(pci, EHL_PSE_TIO_NAME, 1); 68 + } 69 + 70 + static const struct pci_device_id ehl_pse_io_ids[] = { 71 + { PCI_VDEVICE(INTEL, 0x4b88) }, 72 + { PCI_VDEVICE(INTEL, 0x4b89) }, 73 + { } 74 + }; 75 + MODULE_DEVICE_TABLE(pci, ehl_pse_io_ids); 76 + 77 + static struct pci_driver ehl_pse_io_driver = { 78 + .name = EHL_PSE_IO_NAME, 79 + .id_table = ehl_pse_io_ids, 80 + .probe = ehl_pse_io_probe, 81 + }; 82 + module_pci_driver(ehl_pse_io_driver); 83 + 84 + MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>"); 85 + MODULE_DESCRIPTION("Intel Elkhart Lake PSE I/O driver"); 86 + MODULE_LICENSE("GPL");
+24
include/linux/ehl_pse_io_aux.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Intel Elkhart Lake PSE I/O Auxiliary Device 4 + * 5 + * Copyright (c) 2025 Intel Corporation. 6 + * 7 + * Author: Raag Jadav <raag.jadav@intel.com> 8 + */ 9 + 10 + #ifndef _EHL_PSE_IO_AUX_H_ 11 + #define _EHL_PSE_IO_AUX_H_ 12 + 13 + #include <linux/ioport.h> 14 + 15 + #define EHL_PSE_IO_NAME "ehl_pse_io" 16 + #define EHL_PSE_GPIO_NAME "gpio" 17 + #define EHL_PSE_TIO_NAME "pps_tio" 18 + 19 + struct ehl_pse_io_data { 20 + struct resource mem; 21 + int irq; 22 + }; 23 + 24 + #endif /* _EHL_PSE_IO_AUX_H_ */