From 683e4de867224dc4c47a5626f7789650d74dedac Mon Sep 17 00:00:00 2001 From: Jon Lin Date: Mon, 14 Apr 2025 15:58:00 +0800 Subject: [PATCH] misc: rockchip: pcie-rkep: Support function drivers version Change-Id: I84a241f9860b9ccd910e74392d77b2a11a8e09ac Signed-off-by: Jon Lin --- drivers/misc/rockchip/pcie-rkep.c | 8 ++++++++ include/uapi/linux/rk-pcie-ep.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/misc/rockchip/pcie-rkep.c b/drivers/misc/rockchip/pcie-rkep.c index d3b0c8baa772..4dbe0653f006 100644 --- a/drivers/misc/rockchip/pcie-rkep.c +++ b/drivers/misc/rockchip/pcie-rkep.c @@ -31,6 +31,7 @@ #endif #define DRV_NAME "pcie-rkep" +#define DRV_VERSION 0x00030000 #ifndef PCI_VENDOR_ID_ROCKCHIP #define PCI_VENDOR_ID_ROCKCHIP 0x1d87 @@ -638,6 +639,7 @@ static long pcie_rkep_ioctl(struct file *file, unsigned int cmd, unsigned long a int ret; int index; u64 addr; + u32 val; argp = (void __user *)args; @@ -767,6 +769,11 @@ static long pcie_rkep_ioctl(struct file *file, unsigned int cmd, unsigned long a pcie_rkep->cur_mmap_res = mmap_res; break; + case PCIE_EP_GET_FUNC_DRV_VERSION: + val = DRV_VERSION; + if (copy_to_user(argp, &val, sizeof(val))) + return -EFAULT; + break; default: break; } @@ -1344,6 +1351,7 @@ static int pcie_rkep_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_info(&pdev->dev, "did=%x\n", val); dev_info(&pdev->dev, "obj_info magic=%x, ver=%x\n", pcie_rkep->obj_info->magic, pcie_rkep->obj_info->version); + dev_info(&pdev->dev, "func_ver=%x\n", DRV_VERSION); pci_save_state(pdev); diff --git a/include/uapi/linux/rk-pcie-ep.h b/include/uapi/linux/rk-pcie-ep.h index 64d83c0ab5c9..881e752a3a58 100644 --- a/include/uapi/linux/rk-pcie-ep.h +++ b/include/uapi/linux/rk-pcie-ep.h @@ -109,6 +109,7 @@ struct pcie_ep_obj_poll_virtual_id_cfg { }; #define PCIE_BASE 'P' +#define PCIE_EP_GET_FUNC_DRV_VERSION _IOR(PCIE_BASE, 0, unsigned int) #define PCIE_DMA_CACHE_INVALIDE _IOW(PCIE_BASE, 1, struct pcie_ep_dma_cache_cfg) #define PCIE_DMA_CACHE_FLUSH _IOW(PCIE_BASE, 2, struct pcie_ep_dma_cache_cfg) #define PCIE_DMA_IRQ_MASK_ALL _IOW(PCIE_BASE, 3, int)