Intel IPU7 PCI and input system device drivers
Subsystems (4)
cover Intel IPU7 PCI and input system device drivers
From: Bingbu Cao <[email protected]>
This patch series adds a driver for Intel IPU7 input system. IPU7 is the seventh generation of Imaging Processing Unit, it is a PCI device which can be found in some Intel Client Platforms such as Intel Lunar Lake and Panther Lake, etc.
User can use IPU7 to capture images from MIPI camera sensors, support both MIPI CSI DPHY and CPHY.
IPU7 input system driver uses MC and V4L2 sub-device APIs besides V4L2.
- ipu7.c: the IPU7 PCI device driver probe, basic hardware configuration and initialization
- ipu7-bus: Initialise and register the auxiliary device for IS
- ipu7-buttress: Hardware buttress interfaces to allow driver to program to enable the power, firmware authentication and interrupt handling.
- ipu7-mmu and ipu7-dma: IPU MMU table setup and IPU DMA mapping APIs
- ipu7-cpd and ipu7-boot: firmware format parse and firmware boot flow
- abi: a series of ABI headers used by driver and firmware
- ipu7-syscom: syscom communication interfaces used by driver to queue commands to firmware
- ipu7-isys: main IPU7 input system driver, it registers CSI2 as v4l2 sub-devices and the capture as video devices.
TODO list:
1. ABI headers cleanup (currently a copy from firmware as it is still in development and updating regularly, need cleanup to unifiy the headers)
2. add metadata capture support
3. add multiple virtual-channels capture support
4. remove unsecure mode code as secure mode is force to enabled in product
Bingbu Cao (7):
media: Rename the IPU PCI device table header and add IPU7 PCI IDs
media: ipu7: add Intel IPU7 PCI device driver
media: ipu7: add IPU7 DMA APIs and MMU mapping
media: ipu7: add firmware parse, syscom interface and boot sequence
media: ipu7: add IPU7 firmware ABI headers
media: ipu7: add IPU7 input system device driver
media: ipu7: add Makefile and Kconfig for IPU7
drivers/media/pci/intel/Kconfig | 1 +
drivers/media/pci/intel/Makefile | 1 +
drivers/media/pci/intel/ipu6/ipu6.c | 2 +-
drivers/media/pci/intel/ipu7/Kconfig | 18 +
drivers/media/pci/intel/ipu7/Makefile | 23 +
.../pci/intel/ipu7/abi/ipu7_fw_boot_abi.h | 164 +
.../pci/intel/ipu7/abi/ipu7_fw_common_abi.h | 243 ++
.../pci/intel/ipu7/abi/ipu7_fw_config_abi.h | 19 +
.../intel/ipu7/abi/ipu7_fw_insys_config_abi.h | 19 +
.../pci/intel/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++
.../pci/intel/ipu7/abi/ipu7_fw_msg_abi.h | 509 +++
.../intel/ipu7/abi/ipu7_fw_psys_config_abi.h | 22 +
.../pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h | 60 +
drivers/media/pci/intel/ipu7/ipu7-boot.c | 434 +++
drivers/media/pci/intel/ipu7/ipu7-boot.h | 21 +
drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 +
drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 +
.../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++
drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++
drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 +
drivers/media/pci/intel/ipu7/ipu7-cpd.c | 230 ++
drivers/media/pci/intel/ipu7/ipu7-cpd.h | 62 +
drivers/media/pci/intel/ipu7/ipu7-dma.c | 509 +++
drivers/media/pci/intel/ipu7/ipu7-dma.h | 50 +
drivers/media/pci/intel/ipu7/ipu7-fw-isys.c | 300 ++
drivers/media/pci/intel/ipu7/ipu7-fw-isys.h | 39 +
.../media/pci/intel/ipu7/ipu7-isys-csi-phy.c | 1051 +++++++
.../media/pci/intel/ipu7/ipu7-isys-csi-phy.h | 16 +
.../pci/intel/ipu7/ipu7-isys-csi2-regs.h | 1197 +++++++
drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c | 565 ++++
drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h | 73 +
.../media/pci/intel/ipu7/ipu7-isys-queue.c | 836 +++++
.../media/pci/intel/ipu7/ipu7-isys-queue.h | 79 +
.../media/pci/intel/ipu7/ipu7-isys-subdev.c | 381 +++
.../media/pci/intel/ipu7/ipu7-isys-subdev.h | 55 +
.../media/pci/intel/ipu7/ipu7-isys-video.c | 1130 +++++++
.../media/pci/intel/ipu7/ipu7-isys-video.h | 117 +
drivers/media/pci/intel/ipu7/ipu7-isys.c | 1170 +++++++
drivers/media/pci/intel/ipu7/ipu7-isys.h | 150 +
drivers/media/pci/intel/ipu7/ipu7-mmu.c | 853 +++++
drivers/media/pci/intel/ipu7/ipu7-mmu.h | 414 +++
.../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 +
drivers/media/pci/intel/ipu7/ipu7-syscom.c | 79 +
drivers/media/pci/intel/ipu7/ipu7-syscom.h | 36 +
drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++
drivers/media/pci/intel/ipu7/ipu7.h | 244 ++
drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
.../{ipu6-pci-table.h => ipu-pci-table.h} | 14 +-
48 files changed, 16578 insertions(+), 5 deletions(-)
create mode 100644 drivers/media/pci/intel/ipu7/Kconfig
create mode 100644 drivers/media/pci/intel/ipu7/Makefile
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_boot_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_common_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_config_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_insys_config_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_isys_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_msg_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_psys_config_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2-regs.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.h
create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c
create mode 100644 drivers/media/pci/intel/ipu7/ipu7.h
rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)Signature · 1 line
2.34.1
RFC PATCH 1/7 media: Rename the IPU PCI device table header and add IPU7 PCI IDs
From: Bingbu Cao <[email protected]>
Rename the IPU PCI device table header file and add the IPU7 PCI device IDs.
---
drivers/media/pci/intel/ipu6/ipu6.c | 2 +-
drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
.../media/{ipu6-pci-table.h => ipu-pci-table.h} | 14 +++++++++++---
3 files changed, 13 insertions(+), 5 deletions(-)
rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)drivers/media/pci/intel/ipu6/ipu6.c +1 -1
@@ -21,7 +21,7 @@#include <linux/types.h> #include <media/ipu-bridge.h> -#include <media/ipu6-pci-table.h> +#include <media/ipu-pci-table.h> #include "ipu6.h" #include "ipu6-bus.h"
drivers/media/pci/intel/ivsc/mei_csi.c +1 -1
@@ -27,7 +27,7 @@#include <linux/workqueue.h> #include <media/ipu-bridge.h> -#include <media/ipu6-pci-table.h> +#include <media/ipu-pci-table.h> #include <media/v4l2-async.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-fwnode.h>
include/media/ipu-pci-table.h renamed from include/media/ipu6-pci-table.h +11 -3
@@ -3,8 +3,8 @@* Copyright (C) 2024 Intel Corporation */ -#ifndef __IPU6_PCI_TBL_H__ -#define __IPU6_PCI_TBL_H__ +#ifndef __IPU_PCI_TBL_H__ +#define __IPU_PCI_TBL_H__#include <linux/pci.h>
@@ -15,6 +15,9 @@#define PCI_DEVICE_ID_INTEL_IPU6EP_RPLP 0xa75d#define PCI_DEVICE_ID_INTEL_IPU6EP_MTL 0x7d19 +#define PCI_DEVICE_ID_INTEL_IPU7_PCI_ID 0x645d +#define PCI_DEVICE_ID_INTEL_IPU7P5_PCI_ID 0xb05d +static const struct pci_device_id ipu6_pci_tbl[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_IPU6 ) }, {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_IPU6SE ) },
@@ -25,4 +28,9 @@ static const struct pci_device_id ipu6_pci_tbl[] = { { } }; -#endif /* __IPU6_PCI_TBL_H__ */ +static const struct pci_device_id ipu7_pci_tbl[] = { + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_IPU7_PCI_ID )}, + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_IPU7P5_PCI_ID )}, + { } +}; +#endif /* __IPU_PCI_TBL_H__ */
Signature · 1 line
2.34.1
RFC PATCH 2/7 media: ipu7: add Intel IPU7 PCI device driver
In reply to [email protected]From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing systems and the hardware presents itself as a single PCI device in system same as IPU6.
The IPU7 PCI device driver basically does PCI configurations, basic hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the ISYS device driver.
--- drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 + .../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 + .../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7.h | 244 ++ 8 files changed, 5144 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7.h
drivers/media/pci/intel/ipu7/ipu7-bus.c new file +158 -0
@@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/auxiliary_bus.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/list.h> +#include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/pm_domain.h> +#include <linux/pm_runtime.h> +#include <linux/slab.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-boot.h" +#include "ipu7-dma.h" + +static int bus_pm_runtime_suspend (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =pm_generic_runtime_suspend (dev); +if (ret) +return ret; + + ret =ipu_buttress_powerdown (dev, adev->ctrl); +if (!ret) +return 0 ; + +dev_err (dev,"power down failed!\n" ); + +/* Powering down failed, attempt to resume device now */ + ret =pm_generic_runtime_resume (dev); +if (!ret) +return -EBUSY ; + +return -EIO ; +} + +static int bus_pm_runtime_resume (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =ipu_buttress_powerup (dev, adev->ctrl); +if (ret) +return ret; + + ret =pm_generic_runtime_resume (dev); +if (ret) + goto out_err; + +return 0 ; + +out_err: +ipu_buttress_powerdown (dev, adev->ctrl); + +return -EBUSY ; +} + +static struct dev_pm_domain ipu7_bus_pm_domain = { + .ops = { + .runtime_suspend = bus_pm_runtime_suspend, + .runtime_resume = bus_pm_runtime_resume, + }, +}; + +static DEFINE_MUTEX (ipu7_bus_mutex); +static void ipu7_bus_release (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); + +kfree (adev->pdata); +kfree (adev); +} + +struct ipu7_bus_device * +ipu7_bus_initialize_device (struct pci_dev *pdev,struct device *parent, +void *pdata,const struct ipu_buttress_ctrl *ctrl, +char *name) +{ +struct auxiliary_device *auxdev; +struct ipu7_bus_device *adev; +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + + adev =kzalloc (sizeof (*adev),GFP_KERNEL ); +if (!adev) +return ERR_PTR (-ENOMEM ); + + adev->isp = isp; + adev->ctrl = ctrl; + adev->pdata = pdata; + auxdev = &adev->auxdev; + auxdev->name = name; + auxdev->id = (pci_domain_nr (pdev->bus) <<16 ) | +PCI_DEVID (pdev->bus->number, pdev->devfn); + + auxdev->dev.parent = parent; + auxdev->dev.release = ipu7_bus_release; + + ret =auxiliary_device_init (auxdev); +if (ret <0 ) { +dev_err (&isp->pdev->dev,"auxiliary device init failed (%d)\n" , + ret); +kfree (adev); +return ERR_PTR (ret); + } + +dev_pm_domain_set (&auxdev->dev, &ipu7_bus_pm_domain); + +pm_runtime_forbid (&adev->auxdev.dev); +pm_runtime_enable (&adev->auxdev.dev); + +return adev; +} + +int ipu7_bus_add_device (struct ipu7_bus_device *adev) +{ +struct auxiliary_device *auxdev = &adev->auxdev; +int ret; + + ret =auxiliary_device_add (auxdev); +if (ret) { +auxiliary_device_uninit (auxdev); +return ret; + } + +mutex_lock (&ipu7_bus_mutex); +list_add (&adev->list, &adev->isp->devices); +mutex_unlock (&ipu7_bus_mutex); + +pm_runtime_allow (&auxdev->dev); + +return 0 ; +} + +void ipu7_bus_del_devices (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu7_bus_device *adev, *save; + +mutex_lock (&ipu7_bus_mutex); + +list_for_each_entry_safe (adev, save, &isp->devices, list) { +pm_runtime_disable (&adev->auxdev.dev); +list_del (&adev->list); +auxiliary_device_delete (&adev->auxdev); +auxiliary_device_uninit (&adev->auxdev); + } + +mutex_unlock (&ipu7_bus_mutex); +}
drivers/media/pci/intel/ipu7/ipu7-bus.h new file +69 -0
69 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +465 -0
465 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1187 -0
1,187 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +84 -0
84 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +146 -0
146 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +2791 -0
891 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +244 -0
244 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
Hi,
see below
drivers/media/pci/intel/ipu7/ipu7.c
Quoted 5,297 lines · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing systems
and the hardware presents itself as a single PCI device in system same
as IPU6.The IPU7 PCI device driver basically does PCI configurations, basic hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the ISYS
device driver.Signed-off-by Bingbu Cao <[email protected]>---
drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 +.../media/pci/intel/ipu7/ipu7-buttress-regs.h| 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 +.../media/pci/intel/ipu7/ipu7-platform-regs.h| 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791
+++++++++++++++++
drivers/media/pci/intel/ipu7/ipu7.h | 244 ++8 files changed, 5144 insertions(+)create mode 100644
drivers/media/pci/intel/ipu7/ipu7-bus.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7-bus.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress-regs.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-platform-regs.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7.hdrivers/media/pci/intel/ipu7/ipu7-bus.c new file +83
-0@@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/auxiliary_bus.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/list.h> +#include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/pm_domain.h> +#include <linux/pm_runtime.h> +#include <linux/slab.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-boot.h" +#include "ipu7-dma.h" + +static int bus_pm_runtime_suspend (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =pm_generic_runtime_suspend (dev); +if (ret) +return ret; + + ret =ipu_buttress_powerdown (dev, adev->ctrl); +if (!ret) +return 0 ; + +dev_err (dev,"power down failed!\n" ); + +/* Powering down failed, attempt to resume device now */ + ret =pm_generic_runtime_resume (dev); +if (!ret) +return -EBUSY ; + +return -EIO ; +} + +static int bus_pm_runtime_resume (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =ipu_buttress_powerup (dev, adev->ctrl); +if (ret) +return ret; + + ret =pm_generic_runtime_resume (dev); +if (ret) + goto out_err; + +return 0 ; + +out_err: +ipu_buttress_powerdown (dev, adev->ctrl); + +return -EBUSY ; +} + +static struct dev_pm_domain ipu7_bus_pm_domain = { + .ops = { + .runtime_suspend = bus_pm_runtime_suspend, + .runtime_resume = bus_pm_runtime_resume, + }, +}; + +static DEFINE_MUTEX (ipu7_bus_mutex); +static void ipu7_bus_release (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); + +kfree (adev->pdata); +kfree (adev); +} + +struct ipu7_bus_device * +ipu7_bus_initialize_device(struct pci_dev *pdev, struct device*parent,
drivers/media/pci/intel/ipu7/ipu7-bus.c new file +1
-0+ void *pdata, const struct
ipu_buttress_ctrl*ctrl,drivers/media/pci/intel/ipu7/ipu7-bus.c new file +25
-0+ char *name) +{ +struct auxiliary_device *auxdev; +struct ipu7_bus_device *adev; +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + + adev =kzalloc (sizeof (*adev),GFP_KERNEL ); +if (!adev) +return ERR_PTR (-ENOMEM ); + + adev->isp = isp; + adev->ctrl = ctrl; + adev->pdata = pdata; + auxdev = &adev->auxdev; + auxdev->name = name; + auxdev->id = (pci_domain_nr (pdev->bus) <<16 ) | +PCI_DEVID (pdev->bus->number, pdev->devfn); + + auxdev->dev.parent = parent; + auxdev->dev.release = ipu7_bus_release; + + ret =auxiliary_device_init (auxdev); +if (ret <0 ) { + dev_err(&isp->pdev->dev, "auxiliary device initfailed (%d)\n",
drivers/media/pci/intel/ipu7/ipu7-bus.c new file +49
-0+ ret); +kfree (adev); +return ERR_PTR (ret); + } + +dev_pm_domain_set (&auxdev->dev, &ipu7_bus_pm_domain); + +pm_runtime_forbid (&adev->auxdev.dev); +pm_runtime_enable (&adev->auxdev.dev); + +return adev; +} + +int ipu7_bus_add_device (struct ipu7_bus_device *adev) +{ +struct auxiliary_device *auxdev = &adev->auxdev; +int ret; + + ret =auxiliary_device_add (auxdev); +if (ret) { +auxiliary_device_uninit (auxdev); +return ret; + } + +mutex_lock (&ipu7_bus_mutex); +list_add (&adev->list, &adev->isp->devices); +mutex_unlock (&ipu7_bus_mutex); + +pm_runtime_allow (&auxdev->dev); + +return 0 ; +} + +void ipu7_bus_del_devices (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu7_bus_device *adev, *save; + +mutex_lock (&ipu7_bus_mutex); + +list_for_each_entry_safe (adev, save, &isp->devices, list) { +pm_runtime_disable (&adev->auxdev.dev); +list_del (&adev->list); +auxiliary_device_delete (&adev->auxdev); +auxiliary_device_uninit (&adev->auxdev); + } + +mutex_unlock (&ipu7_bus_mutex); +}drivers/media/pci/intel/ipu7/ipu7-bus.h new file +57
-0@@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUS_H +#define IPU7_BUS_H + +#include <linux/auxiliary_bus.h> +#include <linux/container_of.h> +#include <linux/device.h> +#include <linux/irqreturn.h> +#include <linux/list.h> +#include <linux/scatterlist.h> +#include <linux/types.h> + +#include "abi/ipu7_fw_boot_abi.h" + +#include "ipu7-syscom.h" + +struct pci_dev ; +struct ipu_buttress_ctrl ; +struct ipu7_mmu ; +struct ipu7_device ; + +enum ipu7_subsys { +IPU_IS =0 , +IPU_PS =1 , +IPU_SUBSYS_NUM =2 , +}; + +struct ipu7_bus_device { +struct auxiliary_device auxdev; +const struct auxiliary_driver *auxdrv; +const struct ipu7_auxdrv_data *auxdrv_data; +struct list_head list; +enum ipu7_subsys subsys; +void *pdata; +struct ipu7_mmu *mmu; +struct ipu7_device *isp; +const struct ipu_buttress_ctrl *ctrl; +u64 dma_mask; +struct sg_table fw_sgt; +u32 fw_entry; +struct ipu7_syscom_context *syscom; +struct ia_gofo_boot_config *boot_config; +dma_addr_t boot_config_dma_addr; +u32 boot_config_size; +}; + +struct ipu7_auxdrv_data { +irqreturn_t (*isr)(struct ipu7_bus_device *adev); +irqreturn_t (*isr_threaded)(struct ipu7_bus_device *adev); +bool wake_isr_thread; +}; + +#define
to_ipu7_bus_device(_dev)\drivers/media/pci/intel/ipu7/ipu7-bus.h new file +1
-0+ container_of(to_auxiliary_dev(_dev), struct ipu7_bus_device,auxdev)
+#defineauxdev_to_adev(_auxdev)\drivers/media/pci/intel/ipu7/ipu7-bus.h new file +2
-0+ container_of(_auxdev, struct ipu7_bus_device, auxdev) +#define ipu7_bus_get_drvdata (adev) dev_get_drvdata(&(adev)-Quoted 1 line
auxdev.dev)
drivers/media/pci/intel/ipu7/ipu7-bus.h new file +3
-0+ +struct ipu7_bus_device * +ipu7_bus_initialize_device(struct pci_dev *pdev, struct device*parent,
drivers/media/pci/intel/ipu7/ipu7-bus.h new file +1
-0+ void *pdata, const struct
ipu_buttress_ctrl*ctrl,drivers/media/pci/intel/ipu7/ipu7-bus.h new file +4
-0+ char *name); +int ipu7_bus_add_device (struct ipu7_bus_device *adev); +void ipu7_bus_del_devices (struct pci_dev *pdev); +#endif drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +9
-0@@ -0,0 +1,465 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2020 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUTTRESS_REGS_H +#define IPU7_BUTTRESS_REGS_H + +#define
BUTTRESS_REG_IRQ_STATUS0x2000
+#defineBUTTRESS_REG_IRQ_STATUS_UNMASKED0x2004
+#defineBUTTRESS_REG_IRQ_ENABLE0x2008
+#defineBUTTRESS_REG_IRQ_CLEAR0x200c
+#defineBUTTRESS_REG_IRQ_MASK0x2010
+#defineBUTTRESS_REG_TSC_CMD0x2014
+#defineBUTTRESS_REG_TSC_CTL0x2018
+#defineBUTTRESS_REG_TSC_LO0x201c
+#defineBUTTRESS_REG_TSC_HI0x2020drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* valid for PTL */ +#define
BUTTRESS_REG_PB_TIMESTAMP_LO0x2030
+#defineBUTTRESS_REG_PB_TIMESTAMP_HI0x2034
+#defineBUTTRESS_REG_PB_TIMESTAMP_VALID0x2038drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_PS_WORKPOINT_REQ0x2100
+#defineBUTTRESS_REG_IS_WORKPOINT_REQ0x2104
+#defineBUTTRESS_REG_PS_WORKPOINT_DOMAIN_REQ0x2108
+#defineBUTTRESS_REG_PS_DOMAINS_STATUS0x2110
+#defineBUTTRESS_REG_PWR_STATUS0x2114
+#defineBUTTRESS_REG_PS_WORKPOINT_REQ_SHADOW0x2120
+#defineBUTTRESS_REG_IS_WORKPOINT_REQ_SHADOW0x2124
+#defineBUTTRESS_REG_PS_WORKPOINT_DOMAIN_REQ_SHADOW0x2128
+#defineBUTTRESS_REG_ISPS_WORKPOINT_DOWNLOAD0x212c
+#defineBUTTRESS_REG_PG_FLOW_OVERRIDE0x2180
+#defineBUTTRESS_REG_GLOBAL_OVERRIDE_UNGATE_CTL0x2184
+#defineBUTTRESS_REG_PWR_FSM_CTL0x2188
+#defineBUTTRESS_REG_IDLE_WDT0x218c
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_EN0x2190
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_ADDR0x2194
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_DATA0x2198
+#defineBUTTRESS_REG_POWER_EN_DELAY0x219c
+#defineIPU7_BUTTRESS_REG_LTR_CONTROL0x21a0
+#defineIPU7_BUTTRESS_REG_NDE_CONTROL0x21a4
+#defineIPU7_BUTTRESS_REG_INT_FRM_PUNIT0x21a8
+#defineIPU8_BUTTRESS_REG_LTR_CONTROL0x21a4
+#defineIPU8_BUTTRESS_REG_NDE_CONTROL0x21a8
+#defineIPU8_BUTTRESS_REG_INT_FRM_PUNIT0x21ac
+#defineBUTTRESS_REG_SLEEP_LEVEL_CFG0x21b0
+#defineBUTTRESS_REG_SLEEP_LEVEL_STS0x21b4
+#defineBUTTRESS_REG_DVFS_FSM_STATUS0x21b8
+#defineBUTTRESS_REG_PS_PLL_ENABLE0x21bc
+#defineBUTTRESS_REG_D2D_CTL0x21d4
+#defineBUTTRESS_REG_IB_CLK_CTL0x21d8
+#defineBUTTRESS_REG_IB_CRO_CLK_CTL0x21dc
+#defineBUTTRESS_REG_FUNC_FUSES0x21e0
+#defineBUTTRESS_REG_ISOCH_CTL0x21e4
+#defineBUTTRESS_REG_WORKPOINT_CTL0x21f0
+#defineBUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS0x2200
+#defineBUTTRESS_REG_DRV_IS_UCX_START_ADDR0x2204
+#defineBUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS0x2208
+#defineBUTTRESS_REG_DRV_PS_UCX_START_ADDR0x220c
+#defineBUTTRESS_REG_DRV_UCX_RESET_CFG0x2210drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* configured by CSE */ +#define
BUTTRESS_REG_CSE_IS_UCX_CONTROL_STATUS0x2300
+#defineBUTTRESS_REG_CSE_IS_UCX_START_ADDR0x2304
+#defineBUTTRESS_REG_CSE_PS_UCX_CONTROL_STATUS0x2308
+#defineBUTTRESS_REG_CSE_PS_UCX_START_ADDR0x230cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_CAMERA_MASK0x2310
+#defineBUTTRESS_REG_FW_CTL0x2314
+#defineBUTTRESS_REG_SECURITY_CTL0x2318
+#defineBUTTRESS_REG_FUNCTIONAL_FW_SETUP0x231c
+#defineBUTTRESS_REG_FW_BASE0x2320
+#defineBUTTRESS_REG_FW_BASE_LIMIT0x2324
+#defineBUTTRESS_REG_FW_SCRATCH_BASE0x2328
+#defineBUTTRESS_REG_FW_SCRATCH_LIMIT0x232c
+#defineBUTTRESS_REG_CSE_ACTION0x2330drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* configured by SW */ +#define
BUTTRESS_REG_FW_RESET_CTL0x2334
+#defineBUTTRESS_REG_FW_SOURCE_SIZE0x2338
+#defineBUTTRESS_REG_FW_SOURCE_BASE0x233cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_IPU_SEC_CP_LSB0x2400
+#defineBUTTRESS_REG_IPU_SEC_CP_MSB0x2404
+#defineBUTTRESS_REG_IPU_SEC_WAC_LSB0x2408
+#defineBUTTRESS_REG_IPU_SEC_WAC_MSB0x240c
+#defineBUTTRESS_REG_IPU_SEC_RAC_LSB0x2410
+#defineBUTTRESS_REG_IPU_SEC_RAC_MSB0x2414
+#defineBUTTRESS_REG_IPU_DRV_CP_LSB0x2418
+#defineBUTTRESS_REG_IPU_DRV_CP_MSB0x241c
+#defineBUTTRESS_REG_IPU_DRV_WAC_LSB0x2420
+#defineBUTTRESS_REG_IPU_DRV_WAC_MSB0x2424
+#defineBUTTRESS_REG_IPU_DRV_RAC_LSB0x2428
+#defineBUTTRESS_REG_IPU_DRV_RAC_MSB0x242c
+#defineBUTTRESS_REG_IPU_FW_CP_LSB0x2430
+#defineBUTTRESS_REG_IPU_FW_CP_MSB0x2434
+#defineBUTTRESS_REG_IPU_FW_WAC_LSB0x2438
+#defineBUTTRESS_REG_IPU_FW_WAC_MSB0x243c
+#defineBUTTRESS_REG_IPU_FW_RAC_LSB0x2440
+#defineBUTTRESS_REG_IPU_FW_RAC_MSB0x2444
+#defineBUTTRESS_REG_IPU_BIOS_SEC_CP_LSB0x2448
+#defineBUTTRESS_REG_IPU_BIOS_SEC_CP_MSB0x244c
+#defineBUTTRESS_REG_IPU_BIOS_SEC_WAC_LSB0x2450
+#defineBUTTRESS_REG_IPU_BIOS_SEC_WAC_MSB0x2454
+#defineBUTTRESS_REG_IPU_BIOS_SEC_RAC_LSB0x2458
+#defineBUTTRESS_REG_IPU_BIOS_SEC_RAC_MSB0x245c
+#defineBUTTRESS_REG_IPU_DFD_CP_LSB0x2460
+#defineBUTTRESS_REG_IPU_DFD_CP_MSB0x2464
+#defineBUTTRESS_REG_IPU_DFD_WAC_LSB0x2468
+#defineBUTTRESS_REG_IPU_DFD_WAC_MSB0x246c
+#defineBUTTRESS_REG_IPU_DFD_RAC_LSB0x2470
+#defineBUTTRESS_REG_IPU_DFD_RAC_MSB0x2474
+#defineBUTTRESS_REG_CSE2IUDB00x2500
+#defineBUTTRESS_REG_CSE2IUDATA00x2504
+#defineBUTTRESS_REG_CSE2IUCSR0x2508
+#defineBUTTRESS_REG_IU2CSEDB00x250c
+#defineBUTTRESS_REG_IU2CSEDATA00x2510
+#defineBUTTRESS_REG_IU2CSECSR0x2514
+#defineBUTTRESS_REG_CSE2IUDB0_CR_SHADOW0x2520
+#defineBUTTRESS_REG_CSE2IUDATA0_CR_SHADOW0x2524
+#defineBUTTRESS_REG_CSE2IUCSR_CR_SHADOW0x2528
+#defineBUTTRESS_REG_IU2CSEDB0_CR_SHADOW0x252c
+#defineBUTTRESS_REG_DVFS_FSM_SURVIVABILITY0x2900
+#defineBUTTRESS_REG_FLOWS_FSM_SURVIVABILITY0x2904
+#defineBUTTRESS_REG_FABRICS_FSM_SURVIVABILITY0x2908
+#defineBUTTRESS_REG_PS_SUB1_PM_FSM_SURVIVABILITY0x290c
+#defineBUTTRESS_REG_PS_SUB0_PM_FSM_SURVIVABILITY0x2910
+#defineBUTTRESS_REG_PS_PM_FSM_SURVIVABILITY0x2914
+#defineBUTTRESS_REG_IS_PM_FSM_SURVIVABILITY0x2918
+#defineBUTTRESS_REG_FLR_RST_FSM_SURVIVABILITY0x291c
+#defineBUTTRESS_REG_FW_RST_FSM_SURVIVABILITY0x2920
+#defineBUTTRESS_REG_RESETPREP_FSM_SURVIVABILITY0x2924
+#defineBUTTRESS_REG_POWER_FSM_DOMAIN_STATUS0x3000
+#defineBUTTRESS_REG_IDLEREQ_STATUS10x3004
+#defineBUTTRESS_REG_POWER_FSM_STATUS_IS_PS0x3008
+#defineBUTTRESS_REG_POWER_ACK_B_STATUS0x300c
+#defineBUTTRESS_REG_DOMAIN_RETENTION_CTL0x3010
+#defineBUTTRESS_REG_CG_CTRL_BITS0x3014
+#defineBUTTRESS_REG_IS_IFC_STATUS00x3018
+#defineBUTTRESS_REG_IS_IFC_STATUS10x301c
+#defineBUTTRESS_REG_PS_IFC_STATUS00x3020
+#defineBUTTRESS_REG_PS_IFC_STATUS10x3024
+#defineBUTTRESS_REG_BTRS_IFC_STATUS00x3028
+#defineBUTTRESS_REG_BTRS_IFC_STATUS10x302c
+#defineBUTTRESS_REG_IPU_SKU0x3030
+#defineBUTTRESS_REG_PS_IDLEACK0x3034
+#defineBUTTRESS_REG_IS_IDLEACK0x3038
+#defineBUTTRESS_REG_SPARE_REGS_00x303c
+#defineBUTTRESS_REG_SPARE_REGS_10x3040
+#defineBUTTRESS_REG_SPARE_REGS_20x3044
+#defineBUTTRESS_REG_SPARE_REGS_30x3048
+#defineBUTTRESS_REG_IUNIT_ACV0x304c
+#defineBUTTRESS_REG_CHICKEN_BITS0x3050
+#defineBUTTRESS_REG_SBENDPOINT_CFG0x3054
+#defineBUTTRESS_REG_ECC_ERR_LOG0x3058
+#defineBUTTRESS_REG_POWER_FSM_STATUS0x3070
+#defineBUTTRESS_REG_RESET_FSM_STATUS0x3074
+#defineBUTTRESS_REG_IDLE_STATUS0x3078
+#defineBUTTRESS_REG_IDLEACK_STATUS0x307c
+#defineBUTTRESS_REG_IPU_DEBUG0x3080drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_FW_BOOT_PARAMS00x4000
+#defineBUTTRESS_REG_FW_BOOT_PARAMS10x4004
+#defineBUTTRESS_REG_FW_BOOT_PARAMS20x4008
+#defineBUTTRESS_REG_FW_BOOT_PARAMS30x400c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS40x4010
+#defineBUTTRESS_REG_FW_BOOT_PARAMS50x4014
+#defineBUTTRESS_REG_FW_BOOT_PARAMS60x4018
+#defineBUTTRESS_REG_FW_BOOT_PARAMS70x401c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS80x4020
+#defineBUTTRESS_REG_FW_BOOT_PARAMS90x4024
+#defineBUTTRESS_REG_FW_BOOT_PARAMS100x4028
+#defineBUTTRESS_REG_FW_BOOT_PARAMS110x402c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS120x4030
+#defineBUTTRESS_REG_FW_BOOT_PARAMS130x4034
+#defineBUTTRESS_REG_FW_BOOT_PARAMS140x4038
+#defineBUTTRESS_REG_FW_BOOT_PARAMS150x403cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +4
-0+ +#define BUTTRESS_FW_BOOT_PARAMS_ENTRY (i) \ + (BUTTRESS_REG_FW_BOOT_PARAMS0 + ((i) * 4U)) +#define BUTTRESS_REG_FW_GP (i) (0x4040 +
0x4* (i))
+#defineBUTTRESS_REG_FPGA_SUPPORT(i)(0x40c0+0x4* (i))drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_FW_GP80x4060
+#defineBUTTRESS_REG_FW_GP240x40a0drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_GPIO_0_PADCFG_ADDR_CR0x4100
+#defineBUTTRESS_REG_GPIO_1_PADCFG_ADDR_CR0x4104
+#defineBUTTRESS_REG_GPIO_2_PADCFG_ADDR_CR0x4108
+#defineBUTTRESS_REG_GPIO_3_PADCFG_ADDR_CR0x410c
+#defineBUTTRESS_REG_GPIO_4_PADCFG_ADDR_CR0x4110
+#defineBUTTRESS_REG_GPIO_5_PADCFG_ADDR_CR0x4114
+#defineBUTTRESS_REG_GPIO_6_PADCFG_ADDR_CR0x4118
+#defineBUTTRESS_REG_GPIO_7_PADCFG_ADDR_CR0x411c
+#defineBUTTRESS_REG_GPIO_ENABLE0x4140
+#defineBUTTRESS_REG_GPIO_VALUE_CR0x4144drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_IS_MEM_CORRECTABLE_ERROR_STATUS0x5000
+#defineBUTTRESS_REG_IS_MEM_FATAL_ERROR_STATUS0x5004
+#defineBUTTRESS_REG_IS_MEM_NON_FATAL_ERROR_STATUS0x5008
+#defineBUTTRESS_REG_IS_MEM_CHECK_PASSED0x500c
+#defineBUTTRESS_REG_IS_MEM_ERROR_INJECT0x5010
+#defineBUTTRESS_REG_IS_MEM_ERROR_CLEAR0x5014
+#defineBUTTRESS_REG_PS_MEM_CORRECTABLE_ERROR_STATUS0x5040
+#defineBUTTRESS_REG_PS_MEM_FATAL_ERROR_STATUS0x5044
+#defineBUTTRESS_REG_PS_MEM_NON_FATAL_ERROR_STATUS0x5048
+#defineBUTTRESS_REG_PS_MEM_CHECK_PASSED0x504c
+#defineBUTTRESS_REG_PS_MEM_ERROR_INJECT0x5050
+#defineBUTTRESS_REG_PS_MEM_ERROR_CLEAR0x5054drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define BUTTRESS_REG_IS_AB_REGION_MIN_ADDRESS (i) (0x6000 +
0x8* (i))
+#defineBUTTRESS_REG_IS_AB_REGION_MAX_ADDRESS(i)(0x6004+0x8* (i))
+#defineBUTTRESS_REG_IS_AB_VIOLATION_LOG00x6080
+#defineBUTTRESS_REG_IS_AB_VIOLATION_LOG10x6084
+#defineBUTTRESS_REG_PS_AB_REGION_MIN_ADDRESS(i)(0x6100+0x8* (i))
+#defineBUTTRESS_REG_PS_AB_REGION_MAX_ADDRESS0(0x6104+0x8* (i))
+#defineBUTTRESS_REG_PS_AB_VIOLATION_LOG00x6180
+#defineBUTTRESS_REG_PS_AB_VIOLATION_LOG10x6184
+#defineBUTTRESS_REG_PS_DEBUG_AB_VIOLATION_LOG00x6200
+#defineBUTTRESS_REG_PS_DEBUG_AB_VIOLATION_LOG10x6204
+#defineBUTTRESS_REG_IS_DEBUG_AB_VIOLATION_LOG00x6208
+#defineBUTTRESS_REG_IS_DEBUG_AB_VIOLATION_LOG10x620c
+#defineBUTTRESS_REG_IB_DVP_AB_VIOLATION_LOG00x6210
+#defineBUTTRESS_REG_IB_DVP_AB_VIOLATION_LOG10x6214
+#defineBUTTRESS_REG_IB_ATB2DTF_AB_VIOLATION_LOG00x6218
+#defineBUTTRESS_REG_IB_ATB2DTF_AB_VIOLATION_LOG10x621c
+#defineBUTTRESS_REG_AB_ENABLE0x6220
+#defineBUTTRESS_REG_AB_DEFAULT_ACCESS0x6230drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +10
-0+ +/* Indicates CSE has received an IPU driver IPC transaction */ +#define BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE BIT(0) +/* Indicates an IPC transaction from CSE has arrived */ +#define BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING BIT(1) +/* Indicates a CSR update from CSE has arrived */ +#define BUTTRESS_IRQ_CSE_CSR_SET BIT(2) +/* Indicates an interrupt set by Punit (not in use at this time) */ +#define BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ BIT(3) +/* Indicates an SAI violation was detected on access to IB registers */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_SAI_VIOLATION BIT(4) +/* Indicates a transaction to IS was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IS_AB_VIOLATION BIT(5) +/* Indicates a transaction to PS was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+#define BUTTRESS_IRQ_PS_AB_VIOLATION BIT(6) +/* Indicates an error response was detected by the IB config NoC */ +#define
BUTTRESS_IRQ_IB_CFG_NOC_ERR_IRQBIT(7)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+/* Indicates an error response was detected by the IB data NoC */ +#define BUTTRESS_IRQ_IB_DATA_NOC_ERR_IRQ BIT(8) +/* Transaction to DVP regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IB_DVP_AB_VIOLATION BIT(9) +/* Transaction to ATB2DTF regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ATB2DTF_AB_VIOLATION BIT(10) +/* Transaction to IS debug regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IS_DEBUG_AB_VIOLATION BIT(11) +/* Transaction to PS debug regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_PS_DEBUG_AB_VIOLATION BIT(12) +/* Indicates timeout occurred waiting for a response from a target */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IB_CFG_NOC_TIMEOUT_IRQ BIT(13) +/* Set when any correctable ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ECC_CORRECTABLE BIT(14) +/* Any noncorrectable-nonfatal ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ECC_NONCORRECTABLE_NONFATAL BIT(15) +/* Set when any noncorrectable-fatal ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +7
-0+#define BUTTRESS_IRQ_ECC_NONCORRECTABLE_FATAL BIT(16) +/* Set when timeout occurred waiting for a response from a target */ +#define BUTTRESS_IRQ_IS_CFG_NOC_TIMEOUT_IRQ BIT(17) +#define BUTTRESS_IRQ_PS_CFG_NOC_TIMEOUT_IRQ BIT(18) +#define BUTTRESS_IRQ_LB_CFG_NOC_TIMEOUT_IRQ BIT(19) +/* IS FW double exception event */ +#define
BUTTRESS_IRQ_IS_UC_PFATAL_ERRORBIT(26)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+/* PS FW double exception event */ +#define
BUTTRESS_IRQ_PS_UC_PFATAL_ERRORBIT(27)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +26
-0+/* IS FW watchdog event */ +#define BUTTRESS_IRQ_IS_WATCHDOG BIT(28) +/* PS FW watchdog event */ +#define BUTTRESS_IRQ_PS_WATCHDOG BIT(29) +/* IS IRC irq out */ +#define BUTTRESS_IRQ_IS_IRQ BIT(30) +/* PS IRC irq out */ +#define BUTTRESS_IRQ_PS_IRQ BIT(31) + +/* buttress irq */ +enum { +BUTTRESS_PWR_STATUS_HH_STATE_IDLE , +BUTTRESS_PWR_STATUS_HH_STATE_IN_PRGS , +BUTTRESS_PWR_STATUS_HH_STATE_DONE , +BUTTRESS_PWR_STATUS_HH_STATE_ERR , +}; + +#define BUTTRESS_TSC_CMD_START_TSC_SYNC BIT(0) +#define BUTTRESS_PWR_STATUS_HH_STATUS_SHIFT 11 +#define BUTTRESS_PWR_STATUS_HH_STATUS_MASK (0x3 << 11) +#define BUTTRESS_TSW_WA_SOFT_RESET BIT(8) +/* new for PTL */ +#define BUTTRESS_SEL_PB_TIMESTAMP BIT(9) +#define BUTTRESS_IRQS (BUTTRESS_IRQ_IS_IRQ | \ + BUTTRESS_IRQ_PS_IRQ | \ +
BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING| \drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+BUTTRESS_IRQ_CSE_CSR_SET | \ + BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE |\
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +14
-0+ BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ) + +/* Iunit to CSE regs */ +#define BUTTRESS_IU2CSEDB0_BUSY BIT(31) +#define BUTTRESS_IU2CSEDB0_SHORT_FORMAT_SHIFT 27 +#define BUTTRESS_IU2CSEDB0_CLIENT_ID_SHIFT 10 +#define BUTTRESS_IU2CSEDB0_IPC_CLIENT_ID_VAL 2 + +#define BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD 1 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN 2 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_REPLACE 3 +#define BUTTRESS_IU2CSEDATA0_IPC_UPDATE_SECURE_TOUCH 16 + +#define
BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONEBIT(0)
+#defineBUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONEBIT(1)
+#defineBUTTRESS_CSE2IUDATA0_IPC_AUTH_REPLACE_DONEBIT(2)
+#defineBUTTRESS_CSE2IUDATA0_IPC_UPDATE_SECURE_TOUCH_DONEBIT(4)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE1BIT(0)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE2BIT(1)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASEBIT(
2)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQBIT(3)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALIDBIT(4)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQBIT(5)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +65
-0+ +/* 0x20 == NACK, 0xf == unknown command */ +#define BUTTRESS_CSE2IUDATA0_IPC_NACK 0xf20 +#define BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK 0xffff + +/* IS/PS freq control */ +#define BUTTRESS_IS_FREQ_CTL_RATIO_MASK 0xff +#define BUTTRESS_PS_FREQ_CTL_RATIO_MASK 0xff +#define BUTTRESS_IS_FREQ_CTL_CDYN_MASK 0xff +#define BUTTRESS_PS_FREQ_CTL_CDYN_MASK 0xff + +#define IPU7_IS_FREQ_MAX 450 +#define IPU7_IS_FREQ_MIN 50 +#define IPU7_PS_FREQ_MAX 750 +#define BUTTRESS_PS_FREQ_RATIO_STEP 25U +/* valid for IPU8 */ +#define BUTTRESS_IS_FREQ_RATIO_STEP 25U + +/* IS: 400mhz, PS: 500mhz */ +#define IPU7_IS_FREQ_CTL_DEFAULT_RATIO 0x1b +#define IPU7_PS_FREQ_CTL_DEFAULT_RATIO 0x14 +/* IS: 400mhz, PS: 400mhz */ +#define IPU8_IS_FREQ_CTL_DEFAULT_RATIO 0x10 +#define IPU8_PS_FREQ_CTL_DEFAULT_RATIO 0x10 + +#define IPU_FREQ_CTL_CDYN 0x80 +#define IPU_FREQ_CTL_RATIO_SHIFT 0x0 +#define IPU_FREQ_CTL_CDYN_SHIFT 0x8 + +/* buttree power status */ +#define IPU_BUTTRESS_PWR_STATE_IS_PWR_SHIFT 0 +#define IPU_BUTTRESS_PWR_STATE_IS_PWR_MASK \ + (0x3 << IPU_BUTTRESS_PWR_STATE_IS_PWR_SHIFT) + +#define IPU_BUTTRESS_PWR_STATE_PS_PWR_SHIFT 4 +#define IPU_BUTTRESS_PWR_STATE_PS_PWR_MASK \ + (0x3 << IPU_BUTTRESS_PWR_STATE_PS_PWR_SHIFT) + +#define IPU_BUTTRESS_PWR_STATE_DN_DONE 0x0 +#define IPU_BUTTRESS_PWR_STATE_UP_PROCESS 0x1 +#define IPU_BUTTRESS_PWR_STATE_DN_PROCESS 0x2 +#define IPU_BUTTRESS_PWR_STATE_UP_DONE 0x3 + +#define BUTTRESS_PWR_STATE_IS_PWR_SHIFT 3 +#define BUTTRESS_PWR_STATE_IS_PWR_MASK (0x3 << 3) + +#define BUTTRESS_PWR_STATE_PS_PWR_SHIFT 6 +#define BUTTRESS_PWR_STATE_PS_PWR_MASK (0x3 << 6) + +#define PS_FSM_CG BIT(3) + +#define BUTTRESS_OVERRIDE_IS_CLK BIT(1) +#define BUTTRESS_OVERRIDE_PS_CLK BIT(2) +/* ps_pll only valid for ipu8 */ +#define BUTTRESS_OWN_ACK_PS_PLL BIT(8) +#define BUTTRESS_OWN_ACK_IS_CLK BIT(9) +#define BUTTRESS_OWN_ACK_PS_CLK BIT(10) + +/* FW reset ctrl */ +#define BUTTRESS_FW_RESET_CTL_START BIT(0) +#define BUTTRESS_FW_RESET_CTL_DONE BIT(1) + +/* security */ +#define BUTTRESS_SECURITY_CTL_FW_SECURE_MODE BIT(16) +#define BUTTRESS_SECURITY_CTL_FW_SETUP_MASK GENMASK(4,0)
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +#define BUTTRESS_SECURITY_CTL_FW_SETUP_DONE BIT(0) +#define
BUTTRESS_SECURITY_CTL_AUTH_DONEBIT(1)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +11
-0+#define BUTTRESS_SECURITY_CTL_AUTH_FAILED BIT(3) + +/* D2D */ +#define BUTTRESS_D2D_PWR_EN BIT(0) +#define BUTTRESS_D2D_PWR_ACK BIT(4) + +/* NDE */ +#define NDE_VAL_MASK GENMASK(9, 0) +#define NDE_SCALE_MASK GENMASK(12, 10) +#define NDE_VALID_MASK BIT(13) +#define NDE_RESVEC_MASK GENMASK(19,16)
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +26
-0+#define NDE_IN_VBLANK_DIS_MASK BIT(31) + +#define BUTTRESS_NDE_VAL_ACTIVE 48 +#define BUTTRESS_NDE_SCALE_ACTIVE 2 +#define BUTTRESS_NDE_VALID_ACTIVE 1 + +#define BUTTRESS_NDE_VAL_DEFAULT 1023 +#define BUTTRESS_NDE_SCALE_DEFAULT 2 +#define BUTTRESS_NDE_VALID_DEFAULT 0 + +/* IS and PS UCX control */ +#define UCX_CTL_RESET BIT(0) +#define UCX_CTL_RUN BIT(1) +#define UCX_CTL_WAKEUP BIT(2) +#define UCX_CTL_SPARE GENMASK(7, 3) +#define UCX_STS_PWR GENMASK(17, 16) +#define UCX_STS_SLEEPING BIT(18) + +/* offset from PHY base */ +#define PHY_CSI_CFG 0xc0 +#define PHY_CSI_RCOMP_CONTROL 0xc8 +#define PHY_CSI_BSCAN_EXCLUDE 0xd8 + +#define PHY_CPHY_DLL_OVRD (x) (0x100 + 0x100 * (x)) +#define PHY_DPHY_DLL_OVRD (x) (0x14c + 0x100 * (x)) +#define PHY_CPHY_RX_CONTROL1 (x) (0x110 + 0x100 *(x))
+#definePHY_CPHY_RX_CONTROL2(x)(0x114+0x100*
(x))
+#definePHY_DPHY_CFG(x)(0x148+0x100*
(x))drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +34
-0+#define PHY_BB_AFE_CONFIG (x) (0x174 + 0x100 * (x)) + +/* PB registers */ +#define INTERRUPT_STATUS 0x0 +#define BTRS_LOCAL_INTERRUPT_MASK 0x4 +#define GLOBAL_INTERRUPT_MASK 0x8 +#define HM_ATS 0xc +#define ATS_ERROR_LOG1 0x10 +#define ATS_ERROR_LOG2 0x14 +#define ATS_ERROR_CLEAR 0x18 +#define CFI_0_ERROR_LOG 0x1c +#define CFI_0_ERROR_CLEAR 0x20 +#define HASH_CONFIG 0x2c +#define TLBID_HASH_ENABLE_31_0 0x30 +#define TLBID_HASH_ENABLE_63_32 0x34 +#define TLBID_HASH_ENABLE_95_64 0x38 +#define TLBID_HASH_ENABLE_127_96 0x3c +#define CFI_1_ERROR_LOGGING 0x40 +#define CFI_1_ERROR_CLEAR 0x44 +#define IMR_ERROR_LOGGING_LOW 0x48 +#define IMR_ERROR_LOGGING_HIGH 0x4c +#define IMR_ERROR_CLEAR 0x50 +#define PORT_ARBITRATION_WEIGHTS 0x54 +#define IMR_ERROR_LOGGING_CFI_1_LOW 0x58 +#define IMR_ERROR_LOGGING_CFI_1_HIGH 0x5c +#define IMR_ERROR_CLEAR_CFI_1 0x60 +#define BAR2_MISC_CONFIG 0x64 +#define RSP_ID_CONFIG_AXI2CFI_0 0x68 +#define RSP_ID_CONFIG_AXI2CFI_1 0x6c +#define PB_DRIVER_PCODE_MAILBOX_STATUS 0x70 +#define PB_DRIVER_PCODE_MAILBOX_INTERFACE 0x74 +#define PORT_ARBITRATION_WEIGHTS_ATS 0x78 + +#endif /* IPU7_BUTTRESS_REGS_H */ drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +35
-0@@ -0,0 +1,1187 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <asm/cpu_device_id.h> +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/completion.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/firmware.h> +#include <linux/interrupt.h> +#include <linux/iopoll.h> +#include <linux/math64.h> +#include <linux/mm.h> +#include <linux/mutex.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pm_runtime.h> +#include <linux/scatterlist.h> +#include <linux/types.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-buttress.h" +#include "ipu7-buttress-regs.h" + +#define BOOTLOADER_STATUS_OFFSET BUTTRESS_REG_FW_BOOT_PARAMS7 + +#define BOOTLOADER_MAGIC_KEY 0xb00710ad + +#define ENTRY BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE1 +#define EXIT BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE2 +#defineQUERY
BUTTRESS_IU2CSECSR_IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASEdrivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +#define BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX 10 + +#define BUTTRESS_POWER_TIMEOUT_US (200 *
USEC_PER_MSEC)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +#define BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US (5 * USEC_PER_SEC) +#define BUTTRESS_CSE_AUTHENTICATE_TIMEOUT_US (10 * USEC_PER_SEC) +#define BUTTRESS_CSE_FWRESET_TIMEOUT_US (100 *
USEC_PER_MSEC)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +25
-0+ +#define BUTTRESS_IPC_TX_TIMEOUT_MS MSEC_PER_SEC +#define BUTTRESS_IPC_RX_TIMEOUT_MS MSEC_PER_SEC +#define BUTTRESS_IPC_VALIDITY_TIMEOUT_US (1 * USEC_PER_SEC) +#define BUTTRESS_TSC_SYNC_TIMEOUT_US (5 * USEC_PER_MSEC) + +#define BUTTRESS_IPC_RESET_RETRY 2000 +#define BUTTRESS_CSE_IPC_RESET_RETRY 4 +#define BUTTRESS_IPC_CMD_SEND_RETRY 1 + +static const u32 ipu7_adev_irq_mask[2 ] = { +BUTTRESS_IRQ_IS_IRQ , +BUTTRESS_IRQ_PS_IRQ +}; + +int ipu_buttress_ipc_reset (struct ipu7_device *isp, + struct ipu_buttress_ipc *ipc) +{ +unsigned int retries =BUTTRESS_IPC_RESET_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 val =0 , csr_in_clr; + +if (!isp->secure_mode) { + dev_dbg(dev, "Skip IPC reset for non-securemode\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+return 0 ; + } + +mutex_lock (&b->ipc_mutex); + +/* Clear-by-1 CSR (all bits), corresponding internal states. */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +14
-0+ val =readl (isp->base + ipc->csr_in); +writel (val, isp->base + ipc->csr_in); + +/* Set peer CSR bit IPC_PEER_COMP_ACTIONS_RST_PHASE1 */ +writel (ENTRY , isp->base + ipc->csr_out); +/* +* Clear-by-1 all CSR bits EXCEPT following +* bits: +* A. IPC_PEER_COMP_ACTIONS_RST_PHASE1. +* B. IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* C. Possibly custom bits, depending on +* their role. +*/ + csr_in_clr =
BUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQ|drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+BUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALID | + BUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQ |QUERY;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ + do { + usleep_range(400, 500); + val = readl(isp->base + ipc->csr_in); + switch (val) { + case ENTRY | EXIT: + case ENTRY | EXIT | QUERY: + /* + * 1) Clear-by-1 CSR bits + * (IPC_PEER_COMP_ACTIONS_RST_PHASE1, + * IPC_PEER_COMP_ACTIONS_RST_PHASE2). + * 2) Set peer CSR bit + *
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+*/ + writel(ENTRY | EXIT, isp->base + ipc-Quoted 1 line
csr_in);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+writel (QUERY , isp->base + ipc->csr_out); +break ; +case ENTRY : +case ENTRY |QUERY : +/* +* 1) Clear-by-1 CSR bits +* (IPC_PEER_COMP_ACTIONS_RST_PHASE1, +*
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE).drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+* 2) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE1. +*/ + writel(ENTRY | QUERY, isp->base + ipc-Quoted 1 line
csr_in);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+writel (ENTRY , isp->base + ipc->csr_out); +break ; +case EXIT : +case EXIT |QUERY : +/* +* Clear-by-1 CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* 1) Clear incoming doorbell. +* 2) Clear-by-1 all CSR bits EXCEPT following
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +15
-0+* bits: +* A. IPC_PEER_COMP_ACTIONS_RST_PHASE1. +* B. IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* C. Possibly custom bits, depending on +* their role. +* 3) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE2. +*/ +writel (EXIT , isp->base + ipc->csr_in); +writel (0 , isp->base + ipc->db0_in); +writel (csr_in_clr, isp->base + ipc->csr_in); +writel (EXIT , isp->base + ipc->csr_out); + +/* +* Read csr_in again to make sure if
RST_PHASE2is done.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+* If csr_in is QUERY, it should be handled again.
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+*/ +usleep_range (200 ,300 ); + val =readl (isp->base + ipc->csr_in); +if (val &QUERY ) { + dev_dbg(dev, + "RST_PHASE2 retry csr_in =%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+break ; + } +mutex_unlock (&b->ipc_mutex); +return 0 ; +case QUERY : +/* +* 1) Clear-by-1 CSR bit +*
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+* 2) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE1 +*/ +writel (QUERY , isp->base + ipc->csr_in); +writel (ENTRY , isp->base + ipc->csr_out); +break ; +default : + dev_dbg_ratelimited(dev, "Unexpected CSR0x%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+break ; + } + }while (retries--); + +mutex_unlock (&b->ipc_mutex); +dev_err (dev,"Timed out while waiting for CSE\n" ); + +return -ETIMEDOUT ; +} + +static void ipu_buttress_ipc_validity_close (struct ipu7_device *isp, + struct ipu_buttress_ipc*ipc)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+{ +writel (BUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQ , + isp->base + ipc->csr_out); +} + +static int +ipu_buttress_ipc_validity_open (struct ipu7_device *isp, + struct ipu_buttress_ipc *ipc) +{ + unsigned int mask =
BUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALID;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+void __iomem *addr; +int ret; +u32 val; + +writel (BUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQ , + isp->base + ipc->csr_out); + + addr = isp->base + ipc->csr_in; + ret =readl_poll_timeout (addr, val, val & mask,200 , +BUTTRESS_IPC_VALIDITY_TIMEOUT_US ); +if (ret) { + dev_err(&isp->pdev->dev, "CSE validity timeout0x%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+ipu_buttress_ipc_validity_close (isp, ipc); + } + +return ret; +} + +static void ipu_buttress_ipc_recv (struct ipu7_device *isp, + struct ipu_buttress_ipc *ipc, u32
*ipc_msg)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+{ +if (ipc_msg) + *ipc_msg =readl (isp->base + ipc->data0_in); +writel (0 , isp->base + ipc->db0_in); +} + +static int ipu_buttress_ipc_send_bulk(struct ipu7_device *isp, + struct
ipu7_ipc_buttress_bulk_msg*msgs,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+ u32 size) +{ +unsigned long tx_timeout_jiffies, rx_timeout_jiffies; +unsigned int i, retry =BUTTRESS_IPC_CMD_SEND_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct ipu_buttress_ipc *ipc = &b->cse; +struct device *dev = &isp->pdev->dev; +int tout; +u32 val; +int ret; + +mutex_lock (&b->ipc_mutex); + + ret =ipu_buttress_ipc_validity_open (isp, ipc); +if (ret) { +dev_err (dev,"IPC validity open failed\n" ); + goto out; + } + + tx_timeout_jiffies =
msecs_to_jiffies(BUTTRESS_IPC_TX_TIMEOUT_MS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ rx_timeout_jiffies =
msecs_to_jiffies(BUTTRESS_IPC_RX_TIMEOUT_MS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ +for (i =0 ; i < size; i++) { +reinit_completion (&ipc->send_complete); +if (msgs[i].require_resp) +reinit_completion (&ipc->recv_complete); + + dev_dbg(dev, "bulk IPC command: 0x%x\n",msgs[i].cmd);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+writel (msgs[i].cmd, isp->base + ipc->data0_out); + val =BUTTRESS_IU2CSEDB0_BUSY | msgs[i].cmd_size; +writel (val, isp->base + ipc->db0_out); + + tout = wait_for_completion_timeout(&ipc-Quoted 1 line
send_complete,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+
tx_timeout_jiffies);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+if (!tout) { +dev_err (dev,"send IPC response timeout\n" ); +if (!retry--) { + ret = -ETIMEDOUT ; + goto out; + } + +/* Try again if CSE is not responding on first try */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +11
-0+writel (0 , isp->base + ipc->db0_out); + i--; +continue ; + } + + retry =BUTTRESS_IPC_CMD_SEND_RETRY ; + +if (!msgs[i].require_resp) +continue ; + + tout = wait_for_completion_timeout(&ipc-Quoted 1 line
recv_complete,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+
rx_timeout_jiffies);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+if (!tout) { +dev_err (dev,"recv IPC response timeout\n" ); + ret = -ETIMEDOUT ; + goto out; + } + +if (ipc->nack_mask && + (ipc->recv_data & ipc->nack_mask) == ipc->nack){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_err(dev, "IPC NACK for cmd 0x%x\n",msgs[i].cmd);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ ret = -EIO ; + goto out; + } + +if (ipc->recv_data != msgs[i].expected_resp) { + dev_err(dev, + "expected resp: 0x%x, IPC response:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ msgs[i].expected_resp, ipc-Quoted 1 line
recv_data);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +16
-0+ ret = -EIO ; + goto out; + } + } + +dev_dbg (dev,"bulk IPC commands done\n" ); + +out: +ipu_buttress_ipc_validity_close (isp, ipc); +mutex_unlock (&b->ipc_mutex); + +return ret; +} + +static int ipu_buttress_ipc_send (struct ipu7_device *isp, + u32 ipc_msg, u32 size, bool
require_resp,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ u32 expected_resp) +{ +struct ipu7_ipc_buttress_bulk_msg msg = { + .cmd = ipc_msg, + .cmd_size = size, + .require_resp = require_resp, + .expected_resp = expected_resp, + }; + +return ipu_buttress_ipc_send_bulk (isp, &msg,1 ); +} + +static irqreturn_t ipu_buttress_call_isr(struct ipu7_bus_device*adev)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+{ + irqreturn_t ret = IRQ_WAKE_THREAD; + + if (!adev || !adev->auxdrv || !adev->auxdrv_data) + return IRQ_NONE; + + if (adev->auxdrv_data->isr) + ret = adev->auxdrv_data->isr(adev); + + if (ret == IRQ_WAKE_THREAD && !adev->auxdrv_data-Quoted 1 line
isr_threaded)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +23
-0+ ret =IRQ_NONE ; + +return ret; +} + +irqreturn_t ipu_buttress_isr (int irq,void *isp_ptr) +{ +struct ipu7_device *isp = isp_ptr; +struct ipu7_bus_device *adev[] = { isp->isys, isp->psys }; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +irqreturn_t ret =IRQ_NONE ; +u32 pb_irq, pb_local_irq; +u32 disable_irqs =0 ; +u32 irq_status; +unsigned int i; + +pm_runtime_get_noresume (dev); + + pb_irq =readl (isp->pb_base +INTERRUPT_STATUS ); +writel (pb_irq, isp->pb_base +INTERRUPT_STATUS ); + +/* check btrs ATS, CFI and IMR errors, BIT(0) is unused for IPU */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ pb_local_irq = readl(isp->pb_base +
BTRS_LOCAL_INTERRUPT_MASK);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (pb_local_irq & ~BIT (0 )) { + dev_warn(dev, "PB interrupt status 0x%x local0x%x\n",
pb_irq,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ pb_local_irq); + dev_warn(dev, "Details: %x %x %x %x %x %x %x %x\n", + readl(isp->pb_base + ATS_ERROR_LOG1), + readl(isp->pb_base + ATS_ERROR_LOG2), + readl(isp->pb_base + CFI_0_ERROR_LOG), + readl(isp->pb_base + CFI_1_ERROR_LOGGING), + readl(isp->pb_base +
IMR_ERROR_LOGGING_LOW),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_HIGH),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_CFI_1_LOW),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_CFI_1_HIGH));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ } + + irq_status =readl (isp->base +BUTTRESS_REG_IRQ_STATUS ); +if (!irq_status) { +pm_runtime_put_noidle (dev); +return IRQ_NONE ; + } + + do { + writel(irq_status, isp->base +
BUTTRESS_REG_IRQ_CLEAR);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ +for (i =0 ; i <ARRAY_SIZE (ipu7_adev_irq_mask); i++){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ irqreturn_t r =
ipu_buttress_call_isr(adev[i]);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ +if (!(irq_status & ipu7_adev_irq_mask[i])) +continue ; + +if (r ==IRQ_WAKE_THREAD ) { + ret =IRQ_WAKE_THREAD ; + disable_irqs |=ipu7_adev_irq_mask[i];
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ } else if (ret == IRQ_NONE && r ==
IRQ_HANDLED) {drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+ ret =IRQ_HANDLED ; + } + } + + if (irq_status & (BUTTRESS_IRQS |
BUTTRESS_IRQ_SAI_VIOLATION) &&drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ ret == IRQ_NONE) + ret =IRQ_HANDLED ; + + if (irq_status &
BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING) {drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_dbg(dev,"BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ipu_buttress_ipc_recv(isp, &b->cse, &b-Quoted 1 line
cse.recv_data);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+complete (&b->cse.recv_complete); + } + +if (irq_status &BUTTRESS_IRQ_CSE_CSR_SET ) +dev_dbg (dev,"BUTTRESS_IRQ_CSE_CSR_SET\n" ); + +if (irq_status &BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE ){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_dbg(dev,"BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+complete (&b->cse.send_complete); + } + +if (irq_status &BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ ) + dev_dbg(dev,"BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +if (irq_status &BUTTRESS_IRQ_SAI_VIOLATION && + ipu_buttress_get_secure_mode(isp)) + dev_err(dev,"BUTTRESS_IRQ_SAI_VIOLATION\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ + irq_status = readl(isp->base +
BUTTRESS_REG_IRQ_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+ }while (irq_status); + +if (disable_irqs) +writel (BUTTRESS_IRQS & ~disable_irqs, + isp->base + BUTTRESS_REG_IRQ_ENABLE); + +pm_runtime_put (dev); + +return ret; +} + +irqreturn_t ipu_buttress_isr_threaded (int irq,void *isp_ptr) +{ +struct ipu7_device *isp = isp_ptr; +struct ipu7_bus_device *adev[] = { isp->isys, isp->psys }; +const struct ipu7_auxdrv_data *drv_data =NULL ; +irqreturn_t ret =IRQ_NONE ; +unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ipu7_adev_irq_mask) && adev[i];i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +29
-0+ drv_data = adev[i]->auxdrv_data; +if (!drv_data) +continue ; + +if (drv_data->wake_isr_thread && + drv_data->isr_threaded(adev[i]) == IRQ_HANDLED) + ret =IRQ_HANDLED ; + } + +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_ENABLE ); + +return ret; +} + +static int isys_d2d_power (struct device *dev,bool on) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +int ret =0 ; +u32 val; + +dev_dbg (dev,"power %s isys d2d.\n" , on ?"UP" :"DOWN" ); + val =readl (isp->base +BUTTRESS_REG_D2D_CTL ); +if (!(val &BUTTRESS_D2D_PWR_ACK ) ^ on) { +dev_info (dev,"d2d already in %s state.\n" , + on ?"UP" :"DOWN" ); +return 0 ; + } + + val = on ? val | BUTTRESS_D2D_PWR_EN : val &(~BUTTRESS_D2D_PWR_EN);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+writel (val, isp->base +BUTTRESS_REG_D2D_CTL ); + ret = readl_poll_timeout(isp->base + BUTTRESS_REG_D2D_CTL, + val, (!(val & BUTTRESS_D2D_PWR_ACK)^ on),
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +26
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) +dev_err (dev,"power %s d2d timeout. status: 0x%x\n" , + on ?"UP" :"DOWN" , val); + +return ret; +} + +static void isys_nde_control (struct device *dev,bool on) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, value, scale, valid, resvec; +u32 nde_reg; + +if (on) { + value =BUTTRESS_NDE_VAL_ACTIVE ; + scale =BUTTRESS_NDE_SCALE_ACTIVE ; + valid =BUTTRESS_NDE_VALID_ACTIVE ; + }else { + value =BUTTRESS_NDE_VAL_DEFAULT ; + scale =BUTTRESS_NDE_SCALE_DEFAULT ; + valid =BUTTRESS_NDE_VALID_DEFAULT ; + } + +/* only set the fabrics resource ownership for ipu8 */ + nde_reg = is_ipu8(isp->hw_ver) ?
IPU8_BUTTRESS_REG_NDE_CONTROL:drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+IPU7_BUTTRESS_REG_NDE_CONTROL ; + resvec =is_ipu8 (isp->hw_ver) ?0x2 :0xe ; + val =FIELD_PREP (NDE_VAL_MASK , value) | +FIELD_PREP (NDE_SCALE_MASK , scale) | +FIELD_PREP (NDE_VALID_MASK , valid) | +FIELD_PREP (NDE_RESVEC_MASK , resvec); + +writel (val, isp->base + nde_reg); +} + +static int ipu7_buttress_powerup (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +23
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + + exp_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; +if (ctrl->subsys_id ==IPU_IS ) { + ret =isys_d2d_power (dev, true); +if (ret) + goto out_power; +isys_nde_control (dev, true); + } + +/* request clock resource ownership */ + val =readl (isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + val |= ctrl->ovrd_clk; +writel (val, isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SLEEP_LEVEL_STS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ val, (val & ctrl->own_clk_ack), + 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) + dev_warn(dev, "request clk ownership timeout. status0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ val); + + val = ctrl->ratio << ctrl->ratio_shift | ctrl->cdyn << ctrl-Quoted 1 line
cdyn_shift;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+ +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power up timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +19
-0+ goto out_power; + } + +dev_dbg (dev,"%s power up successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); + +/* release clock resource ownership */ + val =readl (isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + val &= ~ctrl->ovrd_clk; +writel (val, isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + +out_power: +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu7_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +17
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + + exp_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; + val =0x8 << ctrl->ratio_shift; + +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power down timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +18
-0+ goto out_power; + } + +dev_dbg (dev,"%s power down successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +if (ctrl->subsys_id ==IPU_IS && !ret) { +isys_d2d_power (dev, false); +isys_nde_control (dev, false); + } + +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu8_buttress_powerup (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +22
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 sleep_level_reg =BUTTRESS_REG_SLEEP_LEVEL_STS ; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + exp_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; +if (ctrl->subsys_id ==IPU_IS ) { + ret =isys_d2d_power (dev, true); +if (ret) + goto out_power; +isys_nde_control (dev, true); + } + +/* request ps_pll when psys freq > 400Mhz */ +if (ctrl->subsys_id ==IPU_PS && ctrl->ratio >0x10 ) { +writel (1 , isp->base +BUTTRESS_REG_PS_PLL_ENABLE ); + ret = readl_poll_timeout(isp->base +
sleep_level_reg,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, (val & ctrl-Quoted 1 line
own_clk_ack),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ 100,
BUTTRESS_POWER_TIMEOUT_US);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (ret) + dev_warn(dev, "ps_pll req ack timeout.status 0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ val); + } + + val = ctrl->ratio << ctrl->ratio_shift | ctrl->cdyn << ctrl-Quoted 1 line
cdyn_shift;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power up timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ goto out_power; + } + +dev_dbg (dev,"%s power up successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu8_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + exp_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; + +if (ctrl->subsys_id ==IPU_PS ) + val =0x10 << ctrl->ratio_shift; +else + val =0x8 << ctrl->ratio_shift; + +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power down timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ goto out_power; + } + +dev_dbg (dev,"%s power down successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +if (ctrl->subsys_id ==IPU_IS && !ret) { +isys_d2d_power (dev, false); +isys_nde_control (dev, false); + } + +if (ctrl->subsys_id ==IPU_PS ) { + val = readl(isp->base +
BUTTRESS_REG_SLEEP_LEVEL_STS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (val & ctrl->own_clk_ack) + writel(0, isp->base +
BUTTRESS_REG_PS_PLL_ENABLE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +60
-0+ } +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +int ipu_buttress_powerup (struct device *dev, +const struct ipu_buttress_ctrl *ctrl) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; + +if (is_ipu8 (isp->hw_ver)) +return ipu8_buttress_powerup (dev, ctrl); + +return ipu7_buttress_powerup (dev, ctrl); +} + +int ipu_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl *ctrl) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; + +if (is_ipu8 (isp->hw_ver)) +return ipu8_buttress_powerdown (dev, ctrl); + +return ipu7_buttress_powerdown (dev, ctrl); +} + +bool ipu_buttress_get_secure_mode (struct ipu7_device *isp) +{ +u32 val; + + val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + +return val &BUTTRESS_SECURITY_CTL_FW_SECURE_MODE ; +} + +bool ipu_buttress_auth_done (struct ipu7_device *isp) +{ +u32 val; + +if (!isp->secure_mode) +return true; + + val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + val =FIELD_GET (BUTTRESS_SECURITY_CTL_FW_SETUP_MASK , val); + +return val ==BUTTRESS_SECURITY_CTL_AUTH_DONE ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_auth_done,"INTEL_IPU7" ); + +int ipu_buttress_get_isys_freq (struct ipu7_device *isp,u32 *freq) +{ +u32 reg_val; +int ret; + + ret =pm_runtime_get_sync (&isp->isys->auxdev.dev); +if (ret <0 ) { +pm_runtime_put (&isp->isys->auxdev.dev); + dev_err(&isp->pdev->dev, "Runtime PM failed (%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+return ret; + } + + reg_val =readl (isp->base +BUTTRESS_REG_IS_WORKPOINT_REQ ); + +pm_runtime_put (&isp->isys->auxdev.dev); + +if (is_ipu8 (isp->hw_ver)) + *freq = (reg_val &BUTTRESS_IS_FREQ_CTL_RATIO_MASK )* 25;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+else + *freq = (reg_val &BUTTRESS_IS_FREQ_CTL_RATIO_MASK )* 50 / 3;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +14
-0+ +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_get_isys_freq,"INTEL_IPU7" ); + +int ipu_buttress_get_psys_freq (struct ipu7_device *isp,u32 *freq) +{ +u32 reg_val; +int ret; + + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +pm_runtime_put (&isp->psys->auxdev.dev); + dev_err(&isp->pdev->dev, "Runtime PM failed (%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +29
-0+return ret; + } + + reg_val =readl (isp->base +BUTTRESS_REG_PS_WORKPOINT_REQ ); + +pm_runtime_put (&isp->psys->auxdev.dev); + + reg_val &=BUTTRESS_PS_FREQ_CTL_RATIO_MASK ; + *freq =BUTTRESS_PS_FREQ_RATIO_STEP * reg_val; + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_get_psys_freq,"INTEL_IPU7" ); + +int ipu_buttress_reset_authentication (struct ipu7_device *isp) +{ +struct device *dev = &isp->pdev->dev; +int ret; +u32 val; + +if (!isp->secure_mode) { +dev_dbg (dev,"Skip auth for non-secure mode\n" ); +return 0 ; + } + +writel (BUTTRESS_FW_RESET_CTL_START , isp->base + + BUTTRESS_REG_FW_RESET_CTL); + + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_FW_RESET_CTL, val,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val & BUTTRESS_FW_RESET_CTL_DONE,500,
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ BUTTRESS_CSE_FWRESET_TIMEOUT_US); +if (ret) { + dev_err(dev, "Time out while resettingauthentication state\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +36
-0+return ret; + } + +dev_dbg (dev,"FW reset for authentication done\n" ); +writel (0 , isp->base +BUTTRESS_REG_FW_RESET_CTL ); +/* leave some time for HW restore */ +usleep_range (800 ,1000 ); + +return 0 ; +} + +int ipu_buttress_authenticate (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 data, mask, done, fail; +int ret; + +if (!isp->secure_mode) { +dev_dbg (dev,"Skip auth for non-secure mode\n" ); +return 0 ; + } + +mutex_lock (&b->auth_mutex); + +if (ipu_buttress_auth_done (isp)) { + ret =0 ; + goto out_unlock; + } + +/* +* BUTTRESS_REG_FW_SOURCE_BASE needs to be set with FW CPD +* package address for secure mode. +*/ + + writel(isp->cpd_fw->size, isp->base +
BUTTRESS_REG_FW_SOURCE_SIZE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+writel (sg_dma_address (isp->psys->fw_sgt.sgl), + isp->base + BUTTRESS_REG_FW_SOURCE_BASE); + +/* +* Write boot_load into IU2CSEDATA0 +* Write sizeof(boot_load) | 0x2 << CLIENT_ID to +* IU2CSEDB.IU2CSECMD and set IU2CSEDB.IU2CSEBUSY as +*/ +dev_info (dev,"Sending BOOT_LOAD to CSE\n" ); + ret = ipu_buttress_ipc_send(isp,
BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ 1, true, +
BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+if (ret) { +dev_err (dev,"CSE boot_load failed\n" ); + goto out_unlock; + } + + mask =BUTTRESS_SECURITY_CTL_FW_SETUP_MASK ; + done =BUTTRESS_SECURITY_CTL_FW_SETUP_DONE ; + fail =BUTTRESS_SECURITY_CTL_AUTH_FAILED ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SECURITY_CTL, data,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +15
-0+ ((data & mask) == done || + (data & mask) == fail), 500, + BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US); +if (ret) { +dev_err (dev,"CSE boot_load timeout\n" ); + goto out_unlock; + } + +if ((data & mask) == fail) { +dev_err (dev,"CSE auth failed\n" ); + ret = -EINVAL ; + goto out_unlock; + } + + ret = readl_poll_timeout(isp->base +
BOOTLOADER_STATUS_OFFSET,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ data, data == BOOTLOADER_MAGIC_KEY,500,
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US); +if (ret) { + dev_err(dev, "Unexpected magic number 0x%x\n",data);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ goto out_unlock; + } + +/* +* Write authenticate_run into IU2CSEDATA0 +* Write sizeof(boot_load) | 0x2 << CLIENT_ID to +* IU2CSEDB.IU2CSECMD and set IU2CSEDB.IU2CSEBUSY as +*/ +dev_info (dev,"Sending AUTHENTICATE_RUN to CSE\n" ); + ret = ipu_buttress_ipc_send(isp,
BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ 1, true, +
BUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+if (ret) { +dev_err (dev,"CSE authenticate_run failed\n" ); + goto out_unlock; + } + + done =BUTTRESS_SECURITY_CTL_AUTH_DONE ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SECURITY_CTL, data,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ ((data & mask) == done || + (data & mask) == fail), 500, +
BUTTRESS_CSE_AUTHENTICATE_TIMEOUT_US);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +38
-0+if (ret) { +dev_err (dev,"CSE authenticate timeout\n" ); + goto out_unlock; + } + +if ((data & mask) == fail) { +dev_err (dev,"CSE boot_load failed\n" ); + ret = -EINVAL ; + goto out_unlock; + } + +dev_info (dev,"CSE authenticate_run done\n" ); + +out_unlock: +mutex_unlock (&b->auth_mutex); + +return ret; +} + +static int ipu_buttress_send_tsc_request (struct ipu7_device *isp) +{ +u32 val, mask, done; +int ret; + + mask =BUTTRESS_PWR_STATUS_HH_STATUS_MASK ; + +writel (BUTTRESS_TSC_CMD_START_TSC_SYNC , + isp->base + BUTTRESS_REG_TSC_CMD); + + val =readl (isp->base +BUTTRESS_REG_PWR_STATUS ); + val =FIELD_GET (mask, val); +if (val ==BUTTRESS_PWR_STATUS_HH_STATE_ERR ) { +dev_err (&isp->pdev->dev,"Start tsc sync failed\n" ); +return -EINVAL ; + } + + done =BUTTRESS_PWR_STATUS_HH_STATE_DONE ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS, val,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+FIELD_GET (mask, val) == done,500 , + BUTTRESS_TSC_SYNC_TIMEOUT_US); +if (ret) + dev_err(&isp->pdev->dev, "Start tsc synctimeout\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+ +return ret; +} + +int ipu_buttress_start_tsc_sync (struct ipu7_device *isp) +{ +void __iomem *base = isp->base; +unsigned int i; +u32 val; + +if (is_ipu8 (isp->hw_ver)) { + for (i = 0; i < BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX;i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val = readl(base +
BUTTRESS_REG_PB_TIMESTAMP_VALID);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+if (val ==1 ) +return 0 ; +usleep_range (40 ,50 ); + } + + dev_err(&isp->pdev->dev, "PB HH sync failed (valid%u)\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+return -ETIMEDOUT ; + } + +if (is_ipu7p5 (isp->hw_ver)) { + val =readl (base +BUTTRESS_REG_TSC_CTL ); + val |=BUTTRESS_SEL_PB_TIMESTAMP ; +writel (val, base +BUTTRESS_REG_TSC_CTL ); + + for (i = 0; i < BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX;i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val = readl(base +
BUTTRESS_REG_PB_TIMESTAMP_VALID);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+if (val ==1 ) +return 0 ; +usleep_range (40 ,50 ); + } + + dev_err(&isp->pdev->dev, "PB HH sync failed (valid%u)\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +35
-0+ +return -ETIMEDOUT ; + } + +for (i =0 ; i <BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX ; i++) { +int ret; + + ret =ipu_buttress_send_tsc_request (isp); +if (ret != -ETIMEDOUT ) +return ret; + + val =readl (base +BUTTRESS_REG_TSC_CTL ); + val = val |BUTTRESS_TSW_WA_SOFT_RESET ; +writel (val, base +BUTTRESS_REG_TSC_CTL ); + val = val & (~BUTTRESS_TSW_WA_SOFT_RESET ); +writel (val, base +BUTTRESS_REG_TSC_CTL ); + } + +dev_err (&isp->pdev->dev,"TSC sync failed (timeout)\n" ); + +return -ETIMEDOUT ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_start_tsc_sync,"INTEL_IPU7" ); + +void ipu_buttress_tsc_read (struct ipu7_device *isp,u64 *val) +{ +unsigned long flags; +u32 tsc_hi, tsc_lo; + +local_irq_save (flags); +if (is_ipu7 (isp->hw_ver)) { + tsc_lo =readl (isp->base +BUTTRESS_REG_TSC_LO ); + tsc_hi =readl (isp->base +BUTTRESS_REG_TSC_HI ); + }else { + tsc_lo = readl(isp->base +
BUTTRESS_REG_PB_TIMESTAMP_LO);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ tsc_hi = readl(isp->base +
BUTTRESS_REG_PB_TIMESTAMP_HI);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ } + *val = (u64 )tsc_hi <<32 | tsc_lo; +local_irq_restore (flags); +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_tsc_read,"INTEL_IPU7" ); + +u64 ipu_buttress_tsc_ticks_to_ns(u64 ticks, const struct ipu7_device*isp)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+{ +u64 ns = ticks *10000 ; + +/* +* converting TSC tick count to ns is calculated by: +* Example (TSC clock frequency is 19.2MHz): +* ns = ticks * 1000 000 000 / 19.2Mhz +* = ticks * 1000 000 000 / 19200000Hz +* = ticks * 10000 / 192 ns +*/ +return div_u64 (ns, isp->buttress.ref_clk); +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_tsc_ticks_to_ns,"INTEL_IPU7" ); + +/* trigger uc control to wakeup fw */ +void ipu_buttress_wakeup_is_uc (const struct ipu7_device *isp) +{ +u32 val; + + val = readl(isp->base +
BUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ val |=UCX_CTL_WAKEUP ; + writel(val, isp->base +
BUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_wakeup_is_uc,"INTEL_IPU7" ); + +void ipu_buttress_wakeup_ps_uc (const struct ipu7_device *isp) +{ +u32 val; + + val = readl(isp->base +
BUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ val |=UCX_CTL_WAKEUP ; + writel(val, isp->base +
BUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +18
-0+} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_wakeup_ps_uc,"INTEL_IPU7" ); + +static const struct x86_cpu_id ipu_misc_cfg_exclusion[] = { +X86_MATCH_VFM_STEPS (INTEL_PANTHERLAKE_L ,0x1 ,0x1 ,0 ), + {}, +}; + +static void ipu_buttress_setup (struct ipu7_device *isp) +{ +struct device *dev = &isp->pdev->dev; +u32 val; + +/* program PB BAR */ +#define WRXREQOP_OVRD_VAL_MASK GENMASK(22, 19) +writel (0 , isp->pb_base +GLOBAL_INTERRUPT_MASK ); + val =readl (isp->pb_base +BAR2_MISC_CONFIG ); + if (is_ipu7(isp->hw_ver) ||
x86_match_cpu(ipu_misc_cfg_exclusion))drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ val |=0x100U ; + else + val |= FIELD_PREP(WRXREQOP_OVRD_VAL_MASK, 0xf) | + BIT(18) | 0x100U; + +writel (val, isp->pb_base +BAR2_MISC_CONFIG ); + val =readl (isp->pb_base +BAR2_MISC_CONFIG ); + +if (is_ipu8 (isp->hw_ver)) { + writel(BIT(13), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(9), isp->pb_base +
TLBID_HASH_ENABLE_95_64);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "IPU8 TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_95_64));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ }else if (is_ipu7p5 (isp->hw_ver)) { + writel(BIT(14), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(9), isp->pb_base +
TLBID_HASH_ENABLE_95_64);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "IPU7P5 TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_95_64));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ }else { + writel(BIT(22), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(1), isp->pb_base +
TLBID_HASH_ENABLE_127_96);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_127_96));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+ } + +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_CLEAR ); +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_MASK ); +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_ENABLE ); +/* LNL SW workaround for PS PD hang when PS sub-domain during PD */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+writel (PS_FSM_CG , isp->base +BUTTRESS_REG_CG_CTRL_BITS ); +} + +void ipu_buttress_restore (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; + +ipu_buttress_setup (isp); + + writel(b->wdt_cached_value, isp->base +
BUTTRESS_REG_IDLE_WDT);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +28
-0+} + +int ipu_buttress_init (struct ipu7_device *isp) +{ +int ret, ipc_reset_retry =BUTTRESS_CSE_IPC_RESET_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 val; + +mutex_init (&b->power_mutex); +mutex_init (&b->auth_mutex); +mutex_init (&b->cons_mutex); +mutex_init (&b->ipc_mutex); +init_completion (&b->cse.send_complete); +init_completion (&b->cse.recv_complete); + + b->cse.nack =BUTTRESS_CSE2IUDATA0_IPC_NACK ; + b->cse.nack_mask =BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ; + b->cse.csr_in =BUTTRESS_REG_CSE2IUCSR ; + b->cse.csr_out =BUTTRESS_REG_IU2CSECSR ; + b->cse.db0_in =BUTTRESS_REG_CSE2IUDB0 ; + b->cse.db0_out =BUTTRESS_REG_IU2CSEDB0 ; + b->cse.data0_in =BUTTRESS_REG_CSE2IUDATA0 ; + b->cse.data0_out =BUTTRESS_REG_IU2CSEDATA0 ; + + isp->secure_mode =ipu_buttress_get_secure_mode (isp); + val =readl (isp->base +BUTTRESS_REG_IPU_SKU ); + dev_info(dev, "IPU%u SKU %u in %s mode mask 0x%x\n", val &
0xf,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ (val >> 4) & 0x7, isp->secure_mode ? "secure" :"non-secure",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ readl(isp->base + BUTTRESS_REG_CAMERA_MASK)); + b->wdt_cached_value = readl(isp->base +
BUTTRESS_REG_IDLE_WDT);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+ b->ref_clk =384 ; + +ipu_buttress_setup (isp); + +/* Retry couple of times in case of CSE initialization is delayed */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ do { + ret = ipu_buttress_ipc_reset(isp, &b->cse); + if (ret) { + dev_warn(dev, "IPC reset protocol failed,retrying\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +26
-0+ }else { +dev_dbg (dev,"IPC reset done\n" ); +return 0 ; + } + }while (ipc_reset_retry--); + +dev_err (dev,"IPC reset protocol failed\n" ); + +mutex_destroy (&b->power_mutex); +mutex_destroy (&b->auth_mutex); +mutex_destroy (&b->cons_mutex); +mutex_destroy (&b->ipc_mutex); + +return ret; +} + +void ipu_buttress_exit (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; + +writel (0 , isp->base +BUTTRESS_REG_IRQ_ENABLE ); +mutex_destroy (&b->power_mutex); +mutex_destroy (&b->auth_mutex); +mutex_destroy (&b->cons_mutex); +mutex_destroy (&b->ipc_mutex); +}drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +19
-0@@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUTTRESS_H +#define IPU7_BUTTRESS_H + +#include <linux/completion.h> +#include <linux/irqreturn.h> +#include <linux/list.h> +#include <linux/mutex.h> + +struct device; +struct ipu7_device; + +struct ipu_buttress_ctrl { + u32 subsys_id; + u32 freq_ctl, pwr_sts_shift, pwr_sts_mask, pwr_sts_on,
pwr_sts_off;drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +54
-0+u32 ratio; +u32 ratio_shift; +u32 cdyn; +u32 cdyn_shift; +u32 ovrd_clk; +u32 own_clk_ack; +}; + +struct ipu_buttress_ipc { +struct completion send_complete; +struct completion recv_complete; +u32 nack; +u32 nack_mask; +u32 recv_data; +u32 csr_out; +u32 csr_in; +u32 db0_in; +u32 db0_out; +u32 data0_out; +u32 data0_in; +}; + +struct ipu_buttress { +struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex; +struct ipu_buttress_ipc cse; +u32 psys_min_freq; +u32 wdt_cached_value; +u8 psys_force_ratio; +bool force_suspend; +u32 ref_clk; +}; + +struct ipu7_ipc_buttress_bulk_msg { +u32 cmd; +u32 expected_resp; +bool require_resp; +u8 cmd_size; +}; + +int ipu_buttress_ipc_reset (struct ipu7_device *isp, + struct ipu_buttress_ipc *ipc); +int ipu_buttress_powerup (struct device *dev, +const struct ipu_buttress_ctrl *ctrl); +int ipu_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl *ctrl); +bool ipu_buttress_get_secure_mode (struct ipu7_device *isp); +int ipu_buttress_authenticate (struct ipu7_device *isp); +int ipu_buttress_reset_authentication (struct ipu7_device *isp); +bool ipu_buttress_auth_done (struct ipu7_device *isp); +int ipu_buttress_get_isys_freq (struct ipu7_device *isp,u32 *freq); +int ipu_buttress_get_psys_freq (struct ipu7_device *isp,u32 *freq); +int ipu_buttress_start_tsc_sync (struct ipu7_device *isp); +void ipu_buttress_tsc_read (struct ipu7_device *isp,u64 *val); +u64 ipu_buttress_tsc_ticks_to_ns(u64 ticks, const struct ipu7_device*isp);
drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +11
-0+ +irqreturn_t ipu_buttress_isr (int irq,void *isp_ptr); +irqreturn_t ipu_buttress_isr_threaded (int irq,void *isp_ptr); +int ipu_buttress_init (struct ipu7_device *isp); +void ipu_buttress_exit (struct ipu7_device *isp); +void ipu_buttress_csi_port_config (struct ipu7_device *isp, + u32 legacy, u32 combo); +void ipu_buttress_restore (struct ipu7_device *isp); +void ipu_buttress_wakeup_is_uc (const struct ipu7_device *isp); +void ipu_buttress_wakeup_ps_uc (const struct ipu7_device *isp); +#endif /* IPU7_BUTTRESS_H */ drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +10
-0@@ -0,0 +1,146 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2018 - 2024 Intel Corporation +*/ + +#ifndef IPU7_PLATFORM_REGS_H +#define IPU7_PLATFORM_REGS_H + +#define IS_BASE 0x230000 +#define IS_UC_CTRL_BASE (IS_BASE +
0x0)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +3
-0+ +#define PS_BASE 0x130000 +#define PS_UC_CTRL_BASE (PS_BASE +
0x0)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +128
-0+ +/* +* bit 0: IRQ from FW, +* bit 1, 2 and 3: IRQ from HW +*/ +#define TO_SW_IRQ_MASK 0xf +#define TO_SW_IRQ_FW BIT(0) + +#define FW_CODE_BASE 0x0 +#define FW_DATA_BASE 0x4 +#define CPU_AXI_CNTL 0x8 +#define CPU_QOS_CNTL 0xc +#define IDMA_AXI_CNTL 0x10 +#define IDMA_QOS_CNTL 0x14 +#define MEF_SPLIT_SIZE 0x18 +#define FW_MSG_CONTROL 0x1c +#define FW_MSG_CREDITS_STATUS 0x20 +#define FW_MSG_CREDIT_TAKEN 0x24 +#define FW_MSG_CREDIT_RETURNED 0x28 +#define TRIG_IDMA_IN 0x2c +#define IDMA_DONE 0x30 +#define IDMA_DONE_CLEAR 0x34 +#define DMEM_CAPACITY 0x38 +#define NON_SECURE_CODE_OFFSET 0x3c +#define UC_CG_CTRL_BITS 0x40 +#define ALT_RESET_VEC 0x44 +#define WDT_NMI_DURATION 0x104 +#define WDT_RST_REQ_DURATION 0x108 +#define WDT_CNTL 0x10c +#define WDT_NMI_CURRENT_COUNT 0x110 +#define WDT_RST_CURRENT_COUNT 0x114 +#define WDT_HALT 0x118 +#define WDT_STATUS 0x11c +#define SPARE_REG_RW 0x120 +#define SPARE_REG_RO 0x124 +#define FW_TO_FW_IRQ_CNTL_EDGE 0x200 +#define FW_TO_FW_IRQ_CNTL_MASK_N 0x204 +#define FW_TO_FW_IRQ_CNTL_STATUS 0x208 +#define FW_TO_FW_IRQ_CNTL_CLEAR 0x20c +#define FW_TO_FW_IRQ_CNTL_ENABLE 0x210 +#define FW_TO_FW_IRQ_CNTL_LEVEL_NOT_PULSE 0x214 +#define CLK_GATE_DIS 0x218 +#define DEBUG_STATUS 0x1000 +#define DEBUG_EXCPETION 0x1004 +#define TIE_GENERAL_INPUT 0x1008 +#define ERR_STATUS 0x100c +#define UC_ERR_INFO 0x1010 +#define SPARE_CNTL 0x1014 +#define MEF_TRC_CNTL 0x1100 +#define DBG_MEF_LAST_PUSH 0x1104 +#define DBG_MEF_LAST_POP 0x1108 +#define DBG_MEF_COUNT_CNTL 0x110c +#define DBG_MEF_COUNT1 0x1110 +#define DBG_MEF_COUNT2 0x1114 +#define DBG_MEF_ACC_OCCUPANCY 0x1118 +#define DBG_MEF_MAX_IRQ_TO_POP 0x111c +#define DBG_IRQ_CNTL 0x1120 +#define DBG_IRQ_COUNT 0x1124 +#define DBG_CYC_COUNT 0x1128 +#define DBG_CNTL 0x1130 +#define DBG_RST_REG 0x1134 +#define DBG_MEF_STATUS0 0x1138 +#define DBG_MEF_STATUS1 0x113c +#define PDEBUG_CTL 0x1140 +#define PDEBUG_DATA 0x1144 +#define PDEBUG_INST 0x1148 +#define PDEBUG_LS0ADDR 0x114c +#define PDEBUG_LS0DATA 0x1150 +#define PDEBUG_LS0STAT 0x1154 +#define PDEBUG_PC 0x1158 +#define PDEBUG_MISC 0x115c +#define PDEBUG_PREF_STS 0x1160 +#define MEF0_ADDR 0x2000 +#define MEF1_ADDR 0x2020 +#define PRINTF_EN_THROUGH_TRACE 0x3004 +#define PRINTF_EN_DIRECTLY_TO_DDR 0x3008 +#define PRINTF_DDR_BASE_ADDR 0x300c +#define PRINTF_DDR_SIZE 0x3010 +#define PRINTF_DDR_NEXT_ADDR 0x3014 +#define PRINTF_STATUS 0x3018 +#define PRINTF_AXI_CNTL 0x301c +#define PRINTF_MSG_LENGTH 0x3020 +#define TO_SW_IRQ_CNTL_EDGE 0x4000 +#define TO_SW_IRQ_CNTL_MASK_N 0x4004 +#define TO_SW_IRQ_CNTL_STATUS 0x4008 +#define TO_SW_IRQ_CNTL_CLEAR 0x400c +#define TO_SW_IRQ_CNTL_ENABLE 0x4010 +#define TO_SW_IRQ_CNTL_LEVEL_NOT_PULSE 0x4014 +#define ERR_IRQ_CNTL_EDGE 0x4018 +#define ERR_IRQ_CNTL_MASK_N 0x401c +#define ERR_IRQ_CNTL_STATUS 0x4020 +#define ERR_IRQ_CNTL_CLEAR 0x4024 +#define ERR_IRQ_CNTL_ENABLE 0x4028 +#define ERR_IRQ_CNTL_LEVEL_NOT_PULSE 0x402c +#define LOCAL_DMEM_BASE_ADDR 0x1300000 + +/* +* IS_UC_TO_SW irqs +* bit 0: IRQ from local FW +* bit 1~3: IRQ from HW +*/ +#define IS_UC_TO_SW_IRQ_MASK 0xf + +#define IPU_ISYS_SPC_OFFSET 0x210000 +#define IPU7_PSYS_SPC_OFFSET 0x118000 +#define IPU_ISYS_DMEM_OFFSET 0x200000 +#define IPU_PSYS_DMEM_OFFSET 0x100000 + +#define IPU7_ISYS_CSI_PORT_NUM 4 + +/* IRQ-related registers in PSYS */ +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_EDGE 0x134000 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_MASK 0x134004 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_STATUS 0x134008 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_CLEAR 0x13400c +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_ENABLE 0x134010 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_LEVEL_NOT_PULSE 0x134014 +#define IRQ_FROM_LOCAL_FW BIT(0) + +/* +* psys subdomains power request regs +*/ +enum ipu7_device_buttress_psys_domain_pos { +IPU_PSYS_SUBDOMAIN_LB =0 , +IPU_PSYS_SUBDOMAIN_BB =1 , +}; + +#define
IPU7_PSYS_DOMAIN_POWER_MASK(BIT(IPU_PSYS_SUBDOMAIN_LB)| \drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +1
-0+
BIT(IPU_PSYS_SUBDOMAIN_BB))
+#defineIPU8_PSYS_DOMAIN_POWER_MASKBIT(IPU_PSYS_SUBDOMAIN_LB)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +3
-0+#define IPU_PSYS_DOMAIN_POWER_IN_PROGRESS BIT(31) + +#endif /* IPU7_PLATFORM_REGS_H */ drivers/media/pci/intel/ipu7/ipu7.c new file +60
-0@@ -0,0 +1,2791 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/acpi.h> +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/bug.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/firmware.h> +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/list.h> +#include <linux/module.h> +#include <linux/pm_runtime.h> +#include <linux/property.h> +#include <linux/scatterlist.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/vmalloc.h> +#include <linux/version.h> + +#include <media/ipu-bridge.h> + +#include "abi/ipu7_fw_common_abi.h" + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-buttress.h" +#include "ipu7-buttress-regs.h" +#include "ipu7-cpd.h" +#include "ipu7-dma.h" +#include "ipu7-isys-csi2-regs.h" +#include "ipu7-mmu.h" +#include "ipu7-platform-regs.h" + +#define IPU_PCI_BAR 0 +#define IPU_PCI_PBBAR 4 + +static unsigned int ipu7_csi_offsets[] = { +IPU_CSI_PORT_A_ADDR_OFFSET , +IPU_CSI_PORT_B_ADDR_OFFSET , +IPU_CSI_PORT_C_ADDR_OFFSET , +IPU_CSI_PORT_D_ADDR_OFFSET , +}; + +static struct ipu_isys_internal_pdata ipu7p5_isys_ipdata = { + .csi2 = { + .gpreg =IS_IO_CSI2_GPREGS_BASE , + }, + .hw_variant = { + .offset =IPU_UNIFIED_OFFSET , + .nr_mmus =IPU7P5_IS_MMU_NUM , + .mmu_hw = { + { + .name ="IS_FW_RD" , + .offset =
IPU7P5_IS_MMU_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20005101, + .refill = 0x00002726, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7P5_IS_ZLX_UC_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +0 ,1 ,0 ,0 + }, + .zlx_conf = { + 0x0, + }, + .uao_p_num =
IPU7P5_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ .uao_p2tlb = { +0x00000049 , +0x0000004c , +0x0000004d , + 0x00000000, + }, + }, + { + .name ="IS_FW_WR" , + .offset =
IPU7P5_IS_MMU_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20005001, + .refill = 0x00002524, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7P5_IS_ZLX_UC_WR_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { + 0, 1, 1, 0, + }, + .zlx_conf = { +0x0 , +0x00010101 , +0x00010101 , + 0x0, + }, + .uao_p_num =
IPU7P5_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0+ .uao_p2tlb = { +0x00000049 , +0x0000004a , +0x0000004b , + 0x00000000, + }, + }, + { + .name ="IS_DATA_WR_ISOC" , + .offset = IPU7P5_IS_MMU_M0_OFFSET, + .zlx_offset =
IPU7P5_IS_ZLX_M0_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004e01, + .refill = 0x00002120, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_M0_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_IS_ZLX_M0_NUM , + .zlx_axi_pool = { + 0x00000f10, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , + 0x00010103, + }, + .uao_p_num =
IPU7P5_IS_UAO_M0_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0+ .uao_p2tlb = { +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , + 0x00000044, + }, + }, + { + .name ="IS_DATA_WR_SNOOP" , + .offset = IPU7P5_IS_MMU_M1_OFFSET, + .zlx_offset =
IPU7P5_IS_ZLX_M1_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_M1_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004f01, + .refill = 0x00002322, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_M1_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_M1_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_IS_ZLX_M1_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , + 0x00010103, + }, + .uao_p_num =
IPU7P5_IS_UAO_M1_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0+ .uao_p2tlb = { + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + }, + }, + }, + .cdc_fifos = 3, + .cdc_fifo_threshold = {6, 8, 2}, + .dmem_offset = IPU_ISYS_DMEM_OFFSET, + .spc_offset = IPU_ISYS_SPC_OFFSET, + }, + .isys_dma_overshoot = IPU_ISYS_OVERALLOC_MIN, +}; + +static struct ipu_psys_internal_pdata ipu7p5_psys_ipdata = { + .hw_variant = { + .offset = IPU_UNIFIED_OFFSET, + .nr_mmus = IPU7P5_PS_MMU_NUM, + .mmu_hw = { + { + .name = "PS_FW_RD", + .offset =
IPU7P5_PS_MMU_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004001, + .refill = 0x00002726, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000d , +0x0000000f , +0x00000011 , +0x00000012 , +0x00000013 , +0x00000014 , +0x00000016 , +0x00000018 , +0x00000019 , +0x0000001a , +0x0000001a , + 0x0000001a, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_PS_ZLX_FW_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +0 ,1 ,0 ,0 ,1 ,1 ,0 ,0 , + 0, 1, 1, 0, 0, 0, 0, 0, + }, + .zlx_conf = { +0x00000000 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_FW_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +22
-0+ .uao_p2tlb = { +0x0000002e , +0x00000035 , +0x00000036 , +0x00000031 , +0x00000037 , +0x00000038 , +0x00000039 , +0x00000032 , +0x00000033 , +0x0000003a , +0x0000003b , +0x0000003c , +0x00000034 , +0x0 , +0x0 , + 0x0, + }, + }, + { + .name ="PS_FW_WR" , + .offset =
IPU7P5_PS_MMU_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003e01, + .refill = 0x00002322, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +30
-0+ .l1_block_sz = { +0x00000000 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000d , +0x0000000e , +0x0000000f , +0x00000010 , +0x00000010 , + 0x00000010, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , + 0x00000012, + }, + .zlx_nr =IPU7P5_PS_ZLX_FW_WR_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { + 0, 1, 1, 0, 0, 0, 0, 0, 0,0,
drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0+ }, + .zlx_conf = { +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_FW_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ .uao_p2tlb = { +0x0000002e , +0x0000002f , +0x00000030 , +0x00000031 , +0x00000032 , +0x00000033 , +0x00000034 , +0x0 , +0x0 , + 0x0, + }, + }, + { + .name ="PS_DATA_RD" , + .offset =
IPU7P5_PS_MMU_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_DATA_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003f01, + .refill = 0x00002524, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_SRT_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_SRT_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +82
-0+ .l1_block_sz = { +0x00000000 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000b , +0x0000000d , +0x0000000f , +0x00000013 , +0x00000017 , +0x00000019 , +0x0000001b , +0x0000001d , +0x0000001f , +0x0000002b , +0x00000033 , +0x0000003f , +0x00000047 , +0x00000049 , +0x0000004b , +0x0000004c , +0x0000004d , + 0x0000004e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , +0x0000001e , +0x00000020 , +0x00000022 , +0x00000024 , +0x00000026 , +0x00000028 , + 0x0000002a, + }, + .zlx_nr =IPU7P5_PS_ZLX_DATA_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 0, 0, 0, 0, + }, + .zlx_conf = { +0x00030303 , +0x00010101 , +0x00010101 , +0x00030202 , +0x00010101 , +0x00010101 , +0x00030303 , +0x00030303 , +0x00010101 , +0x00030800 , +0x00030500 , +0x00020101 , +0x00042000 , +0x00031000 , +0x00042000 , +0x00031000 , +0x00020400 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_SRT_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +28
-0+ .uao_p2tlb = { +0x0000001c , +0x0000001d , +0x0000001e , +0x0000001f , +0x00000020 , +0x00000021 , +0x00000022 , +0x00000023 , +0x00000024 , +0x00000025 , +0x00000026 , +0x00000027 , +0x00000028 , +0x00000029 , +0x0000002a , +0x0000002b , +0x0000002c , +0x0000002d , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + }, + { + .name ="PS_DATA_WR" , + .offset =
IPU7P5_PS_MMU_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_DATA_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003d01, + .refill = 0x00002120, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_SRT_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_SRT_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +113
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000006 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , +0x0000001e , +0x00000020 , +0x00000022 , + 0x00000024,Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7P5_PS_UAO_SRT_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +52
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M0_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0xc,0xe,0x10,drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0xa,0xc,0xe,drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_M0_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_M1_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M1_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M1_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x20,drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +29
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_IS_UAO_M1_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1a,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +22
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_DATA_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3f,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x46,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4b,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x50,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x57,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x61,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x30,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x44,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4e,drivers/media/pci/intel/ipu7/ipu7.c new file +30
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +18
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,0x0,0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,0x0,0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_DATA_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x20,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x58,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x86,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x90,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x98,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x30,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x44,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4e,drivers/media/pci/intel/ipu7/ipu7.c new file +46
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +24
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +27
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +51
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +15
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +76
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +33
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +95
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +92
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +18
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +21
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +26
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
626 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
Quoted 5,529 lines · Philipp Stanner
Hi,
see below
drivers/media/pci/intel/ipu7/ipu7.c
Quoted 5,297 lines · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing systems
and the hardware presents itself as a single PCI device in system same
as IPU6.The IPU7 PCI device driver basically does PCI configurations, basic hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the ISYS
device driver.Signed-off-by Bingbu Cao <[email protected]>--- drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 + .../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 + .../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7.h | 244 ++ 8 files changed, 5144 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7.hdrivers/media/pci/intel/ipu7/ipu7-bus.c new file +83
-0@@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/auxiliary_bus.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/list.h> +#include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/pm_domain.h> +#include <linux/pm_runtime.h> +#include <linux/slab.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-boot.h" +#include "ipu7-dma.h" + +static int bus_pm_runtime_suspend (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =pm_generic_runtime_suspend (dev); +if (ret) +return ret; + + ret =ipu_buttress_powerdown (dev, adev->ctrl); +if (!ret) +return 0 ; + +dev_err (dev,"power down failed!\n" ); + +/* Powering down failed, attempt to resume device now */ + ret =pm_generic_runtime_resume (dev); +if (!ret) +return -EBUSY ; + +return -EIO ; +} + +static int bus_pm_runtime_resume (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); +int ret; + + ret =ipu_buttress_powerup (dev, adev->ctrl); +if (ret) +return ret; + + ret =pm_generic_runtime_resume (dev); +if (ret) + goto out_err; + +return 0 ; + +out_err: +ipu_buttress_powerdown (dev, adev->ctrl); + +return -EBUSY ; +} + +static struct dev_pm_domain ipu7_bus_pm_domain = { + .ops = { + .runtime_suspend = bus_pm_runtime_suspend, + .runtime_resume = bus_pm_runtime_resume, + }, +}; + +static DEFINE_MUTEX (ipu7_bus_mutex); +static void ipu7_bus_release (struct device *dev) +{ +struct ipu7_bus_device *adev =to_ipu7_bus_device (dev); + +kfree (adev->pdata); +kfree (adev); +} + +struct ipu7_bus_device * +ipu7_bus_initialize_device(struct pci_dev *pdev, struct device*parent,
drivers/media/pci/intel/ipu7/ipu7-bus.c new file +1
-0+ void *pdata, const struct
ipu_buttress_ctrl*ctrl,drivers/media/pci/intel/ipu7/ipu7-bus.c new file +25
-0+ char *name) +{ +struct auxiliary_device *auxdev; +struct ipu7_bus_device *adev; +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + + adev =kzalloc (sizeof (*adev),GFP_KERNEL ); +if (!adev) +return ERR_PTR (-ENOMEM ); + + adev->isp = isp; + adev->ctrl = ctrl; + adev->pdata = pdata; + auxdev = &adev->auxdev; + auxdev->name = name; + auxdev->id = (pci_domain_nr (pdev->bus) <<16 ) | +PCI_DEVID (pdev->bus->number, pdev->devfn); + + auxdev->dev.parent = parent; + auxdev->dev.release = ipu7_bus_release; + + ret =auxiliary_device_init (auxdev); +if (ret <0 ) { + dev_err(&isp->pdev->dev, "auxiliary device initfailed (%d)\n",
drivers/media/pci/intel/ipu7/ipu7-bus.c new file +49
-0+ ret); +kfree (adev); +return ERR_PTR (ret); + } + +dev_pm_domain_set (&auxdev->dev, &ipu7_bus_pm_domain); + +pm_runtime_forbid (&adev->auxdev.dev); +pm_runtime_enable (&adev->auxdev.dev); + +return adev; +} + +int ipu7_bus_add_device (struct ipu7_bus_device *adev) +{ +struct auxiliary_device *auxdev = &adev->auxdev; +int ret; + + ret =auxiliary_device_add (auxdev); +if (ret) { +auxiliary_device_uninit (auxdev); +return ret; + } + +mutex_lock (&ipu7_bus_mutex); +list_add (&adev->list, &adev->isp->devices); +mutex_unlock (&ipu7_bus_mutex); + +pm_runtime_allow (&auxdev->dev); + +return 0 ; +} + +void ipu7_bus_del_devices (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu7_bus_device *adev, *save; + +mutex_lock (&ipu7_bus_mutex); + +list_for_each_entry_safe (adev, save, &isp->devices, list) { +pm_runtime_disable (&adev->auxdev.dev); +list_del (&adev->list); +auxiliary_device_delete (&adev->auxdev); +auxiliary_device_uninit (&adev->auxdev); + } + +mutex_unlock (&ipu7_bus_mutex); +}drivers/media/pci/intel/ipu7/ipu7-bus.h new file +57
-0@@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUS_H +#define IPU7_BUS_H + +#include <linux/auxiliary_bus.h> +#include <linux/container_of.h> +#include <linux/device.h> +#include <linux/irqreturn.h> +#include <linux/list.h> +#include <linux/scatterlist.h> +#include <linux/types.h> + +#include "abi/ipu7_fw_boot_abi.h" + +#include "ipu7-syscom.h" + +struct pci_dev ; +struct ipu_buttress_ctrl ; +struct ipu7_mmu ; +struct ipu7_device ; + +enum ipu7_subsys { +IPU_IS =0 , +IPU_PS =1 , +IPU_SUBSYS_NUM =2 , +}; + +struct ipu7_bus_device { +struct auxiliary_device auxdev; +const struct auxiliary_driver *auxdrv; +const struct ipu7_auxdrv_data *auxdrv_data; +struct list_head list; +enum ipu7_subsys subsys; +void *pdata; +struct ipu7_mmu *mmu; +struct ipu7_device *isp; +const struct ipu_buttress_ctrl *ctrl; +u64 dma_mask; +struct sg_table fw_sgt; +u32 fw_entry; +struct ipu7_syscom_context *syscom; +struct ia_gofo_boot_config *boot_config; +dma_addr_t boot_config_dma_addr; +u32 boot_config_size; +}; + +struct ipu7_auxdrv_data { +irqreturn_t (*isr)(struct ipu7_bus_device *adev); +irqreturn_t (*isr_threaded)(struct ipu7_bus_device *adev); +bool wake_isr_thread; +}; + +#define
to_ipu7_bus_device(_dev)\drivers/media/pci/intel/ipu7/ipu7-bus.h new file +1
-0+ container_of(to_auxiliary_dev(_dev), struct ipu7_bus_device,auxdev)
+#defineauxdev_to_adev(_auxdev)\drivers/media/pci/intel/ipu7/ipu7-bus.h new file +2
-0+ container_of(_auxdev, struct ipu7_bus_device, auxdev) +#define ipu7_bus_get_drvdata (adev) dev_get_drvdata(&(adev)-Quoted 1 line
auxdev.dev)
drivers/media/pci/intel/ipu7/ipu7-bus.h new file +3
-0+ +struct ipu7_bus_device * +ipu7_bus_initialize_device(struct pci_dev *pdev, struct device*parent,
drivers/media/pci/intel/ipu7/ipu7-bus.h new file +1
-0+ void *pdata, const struct
ipu_buttress_ctrl*ctrl,drivers/media/pci/intel/ipu7/ipu7-bus.h new file +4
-0+ char *name); +int ipu7_bus_add_device (struct ipu7_bus_device *adev); +void ipu7_bus_del_devices (struct pci_dev *pdev); +#endif drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +9
-0@@ -0,0 +1,465 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2020 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUTTRESS_REGS_H +#define IPU7_BUTTRESS_REGS_H + +#define
BUTTRESS_REG_IRQ_STATUS0x2000
+#defineBUTTRESS_REG_IRQ_STATUS_UNMASKED0x2004
+#defineBUTTRESS_REG_IRQ_ENABLE0x2008
+#defineBUTTRESS_REG_IRQ_CLEAR0x200c
+#defineBUTTRESS_REG_IRQ_MASK0x2010
+#defineBUTTRESS_REG_TSC_CMD0x2014
+#defineBUTTRESS_REG_TSC_CTL0x2018
+#defineBUTTRESS_REG_TSC_LO0x201c
+#defineBUTTRESS_REG_TSC_HI0x2020drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* valid for PTL */ +#define
BUTTRESS_REG_PB_TIMESTAMP_LO0x2030
+#defineBUTTRESS_REG_PB_TIMESTAMP_HI0x2034
+#defineBUTTRESS_REG_PB_TIMESTAMP_VALID0x2038drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_PS_WORKPOINT_REQ0x2100
+#defineBUTTRESS_REG_IS_WORKPOINT_REQ0x2104
+#defineBUTTRESS_REG_PS_WORKPOINT_DOMAIN_REQ0x2108
+#defineBUTTRESS_REG_PS_DOMAINS_STATUS0x2110
+#defineBUTTRESS_REG_PWR_STATUS0x2114
+#defineBUTTRESS_REG_PS_WORKPOINT_REQ_SHADOW0x2120
+#defineBUTTRESS_REG_IS_WORKPOINT_REQ_SHADOW0x2124
+#defineBUTTRESS_REG_PS_WORKPOINT_DOMAIN_REQ_SHADOW0x2128
+#defineBUTTRESS_REG_ISPS_WORKPOINT_DOWNLOAD0x212c
+#defineBUTTRESS_REG_PG_FLOW_OVERRIDE0x2180
+#defineBUTTRESS_REG_GLOBAL_OVERRIDE_UNGATE_CTL0x2184
+#defineBUTTRESS_REG_PWR_FSM_CTL0x2188
+#defineBUTTRESS_REG_IDLE_WDT0x218c
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_EN0x2190
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_ADDR0x2194
+#defineBUTTRESS_REG_PS_PWR_DOMAIN_EVENTQ_DATA0x2198
+#defineBUTTRESS_REG_POWER_EN_DELAY0x219c
+#defineIPU7_BUTTRESS_REG_LTR_CONTROL0x21a0
+#defineIPU7_BUTTRESS_REG_NDE_CONTROL0x21a4
+#defineIPU7_BUTTRESS_REG_INT_FRM_PUNIT0x21a8
+#defineIPU8_BUTTRESS_REG_LTR_CONTROL0x21a4
+#defineIPU8_BUTTRESS_REG_NDE_CONTROL0x21a8
+#defineIPU8_BUTTRESS_REG_INT_FRM_PUNIT0x21ac
+#defineBUTTRESS_REG_SLEEP_LEVEL_CFG0x21b0
+#defineBUTTRESS_REG_SLEEP_LEVEL_STS0x21b4
+#defineBUTTRESS_REG_DVFS_FSM_STATUS0x21b8
+#defineBUTTRESS_REG_PS_PLL_ENABLE0x21bc
+#defineBUTTRESS_REG_D2D_CTL0x21d4
+#defineBUTTRESS_REG_IB_CLK_CTL0x21d8
+#defineBUTTRESS_REG_IB_CRO_CLK_CTL0x21dc
+#defineBUTTRESS_REG_FUNC_FUSES0x21e0
+#defineBUTTRESS_REG_ISOCH_CTL0x21e4
+#defineBUTTRESS_REG_WORKPOINT_CTL0x21f0
+#defineBUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS0x2200
+#defineBUTTRESS_REG_DRV_IS_UCX_START_ADDR0x2204
+#defineBUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS0x2208
+#defineBUTTRESS_REG_DRV_PS_UCX_START_ADDR0x220c
+#defineBUTTRESS_REG_DRV_UCX_RESET_CFG0x2210drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* configured by CSE */ +#define
BUTTRESS_REG_CSE_IS_UCX_CONTROL_STATUS0x2300
+#defineBUTTRESS_REG_CSE_IS_UCX_START_ADDR0x2304
+#defineBUTTRESS_REG_CSE_PS_UCX_CONTROL_STATUS0x2308
+#defineBUTTRESS_REG_CSE_PS_UCX_START_ADDR0x230cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_CAMERA_MASK0x2310
+#defineBUTTRESS_REG_FW_CTL0x2314
+#defineBUTTRESS_REG_SECURITY_CTL0x2318
+#defineBUTTRESS_REG_FUNCTIONAL_FW_SETUP0x231c
+#defineBUTTRESS_REG_FW_BASE0x2320
+#defineBUTTRESS_REG_FW_BASE_LIMIT0x2324
+#defineBUTTRESS_REG_FW_SCRATCH_BASE0x2328
+#defineBUTTRESS_REG_FW_SCRATCH_LIMIT0x232c
+#defineBUTTRESS_REG_CSE_ACTION0x2330drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +/* configured by SW */ +#define
BUTTRESS_REG_FW_RESET_CTL0x2334
+#defineBUTTRESS_REG_FW_SOURCE_SIZE0x2338
+#defineBUTTRESS_REG_FW_SOURCE_BASE0x233cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_IPU_SEC_CP_LSB0x2400
+#defineBUTTRESS_REG_IPU_SEC_CP_MSB0x2404
+#defineBUTTRESS_REG_IPU_SEC_WAC_LSB0x2408
+#defineBUTTRESS_REG_IPU_SEC_WAC_MSB0x240c
+#defineBUTTRESS_REG_IPU_SEC_RAC_LSB0x2410
+#defineBUTTRESS_REG_IPU_SEC_RAC_MSB0x2414
+#defineBUTTRESS_REG_IPU_DRV_CP_LSB0x2418
+#defineBUTTRESS_REG_IPU_DRV_CP_MSB0x241c
+#defineBUTTRESS_REG_IPU_DRV_WAC_LSB0x2420
+#defineBUTTRESS_REG_IPU_DRV_WAC_MSB0x2424
+#defineBUTTRESS_REG_IPU_DRV_RAC_LSB0x2428
+#defineBUTTRESS_REG_IPU_DRV_RAC_MSB0x242c
+#defineBUTTRESS_REG_IPU_FW_CP_LSB0x2430
+#defineBUTTRESS_REG_IPU_FW_CP_MSB0x2434
+#defineBUTTRESS_REG_IPU_FW_WAC_LSB0x2438
+#defineBUTTRESS_REG_IPU_FW_WAC_MSB0x243c
+#defineBUTTRESS_REG_IPU_FW_RAC_LSB0x2440
+#defineBUTTRESS_REG_IPU_FW_RAC_MSB0x2444
+#defineBUTTRESS_REG_IPU_BIOS_SEC_CP_LSB0x2448
+#defineBUTTRESS_REG_IPU_BIOS_SEC_CP_MSB0x244c
+#defineBUTTRESS_REG_IPU_BIOS_SEC_WAC_LSB0x2450
+#defineBUTTRESS_REG_IPU_BIOS_SEC_WAC_MSB0x2454
+#defineBUTTRESS_REG_IPU_BIOS_SEC_RAC_LSB0x2458
+#defineBUTTRESS_REG_IPU_BIOS_SEC_RAC_MSB0x245c
+#defineBUTTRESS_REG_IPU_DFD_CP_LSB0x2460
+#defineBUTTRESS_REG_IPU_DFD_CP_MSB0x2464
+#defineBUTTRESS_REG_IPU_DFD_WAC_LSB0x2468
+#defineBUTTRESS_REG_IPU_DFD_WAC_MSB0x246c
+#defineBUTTRESS_REG_IPU_DFD_RAC_LSB0x2470
+#defineBUTTRESS_REG_IPU_DFD_RAC_MSB0x2474
+#defineBUTTRESS_REG_CSE2IUDB00x2500
+#defineBUTTRESS_REG_CSE2IUDATA00x2504
+#defineBUTTRESS_REG_CSE2IUCSR0x2508
+#defineBUTTRESS_REG_IU2CSEDB00x250c
+#defineBUTTRESS_REG_IU2CSEDATA00x2510
+#defineBUTTRESS_REG_IU2CSECSR0x2514
+#defineBUTTRESS_REG_CSE2IUDB0_CR_SHADOW0x2520
+#defineBUTTRESS_REG_CSE2IUDATA0_CR_SHADOW0x2524
+#defineBUTTRESS_REG_CSE2IUCSR_CR_SHADOW0x2528
+#defineBUTTRESS_REG_IU2CSEDB0_CR_SHADOW0x252c
+#defineBUTTRESS_REG_DVFS_FSM_SURVIVABILITY0x2900
+#defineBUTTRESS_REG_FLOWS_FSM_SURVIVABILITY0x2904
+#defineBUTTRESS_REG_FABRICS_FSM_SURVIVABILITY0x2908
+#defineBUTTRESS_REG_PS_SUB1_PM_FSM_SURVIVABILITY0x290c
+#defineBUTTRESS_REG_PS_SUB0_PM_FSM_SURVIVABILITY0x2910
+#defineBUTTRESS_REG_PS_PM_FSM_SURVIVABILITY0x2914
+#defineBUTTRESS_REG_IS_PM_FSM_SURVIVABILITY0x2918
+#defineBUTTRESS_REG_FLR_RST_FSM_SURVIVABILITY0x291c
+#defineBUTTRESS_REG_FW_RST_FSM_SURVIVABILITY0x2920
+#defineBUTTRESS_REG_RESETPREP_FSM_SURVIVABILITY0x2924
+#defineBUTTRESS_REG_POWER_FSM_DOMAIN_STATUS0x3000
+#defineBUTTRESS_REG_IDLEREQ_STATUS10x3004
+#defineBUTTRESS_REG_POWER_FSM_STATUS_IS_PS0x3008
+#defineBUTTRESS_REG_POWER_ACK_B_STATUS0x300c
+#defineBUTTRESS_REG_DOMAIN_RETENTION_CTL0x3010
+#defineBUTTRESS_REG_CG_CTRL_BITS0x3014
+#defineBUTTRESS_REG_IS_IFC_STATUS00x3018
+#defineBUTTRESS_REG_IS_IFC_STATUS10x301c
+#defineBUTTRESS_REG_PS_IFC_STATUS00x3020
+#defineBUTTRESS_REG_PS_IFC_STATUS10x3024
+#defineBUTTRESS_REG_BTRS_IFC_STATUS00x3028
+#defineBUTTRESS_REG_BTRS_IFC_STATUS10x302c
+#defineBUTTRESS_REG_IPU_SKU0x3030
+#defineBUTTRESS_REG_PS_IDLEACK0x3034
+#defineBUTTRESS_REG_IS_IDLEACK0x3038
+#defineBUTTRESS_REG_SPARE_REGS_00x303c
+#defineBUTTRESS_REG_SPARE_REGS_10x3040
+#defineBUTTRESS_REG_SPARE_REGS_20x3044
+#defineBUTTRESS_REG_SPARE_REGS_30x3048
+#defineBUTTRESS_REG_IUNIT_ACV0x304c
+#defineBUTTRESS_REG_CHICKEN_BITS0x3050
+#defineBUTTRESS_REG_SBENDPOINT_CFG0x3054
+#defineBUTTRESS_REG_ECC_ERR_LOG0x3058
+#defineBUTTRESS_REG_POWER_FSM_STATUS0x3070
+#defineBUTTRESS_REG_RESET_FSM_STATUS0x3074
+#defineBUTTRESS_REG_IDLE_STATUS0x3078
+#defineBUTTRESS_REG_IDLEACK_STATUS0x307c
+#defineBUTTRESS_REG_IPU_DEBUG0x3080drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_FW_BOOT_PARAMS00x4000
+#defineBUTTRESS_REG_FW_BOOT_PARAMS10x4004
+#defineBUTTRESS_REG_FW_BOOT_PARAMS20x4008
+#defineBUTTRESS_REG_FW_BOOT_PARAMS30x400c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS40x4010
+#defineBUTTRESS_REG_FW_BOOT_PARAMS50x4014
+#defineBUTTRESS_REG_FW_BOOT_PARAMS60x4018
+#defineBUTTRESS_REG_FW_BOOT_PARAMS70x401c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS80x4020
+#defineBUTTRESS_REG_FW_BOOT_PARAMS90x4024
+#defineBUTTRESS_REG_FW_BOOT_PARAMS100x4028
+#defineBUTTRESS_REG_FW_BOOT_PARAMS110x402c
+#defineBUTTRESS_REG_FW_BOOT_PARAMS120x4030
+#defineBUTTRESS_REG_FW_BOOT_PARAMS130x4034
+#defineBUTTRESS_REG_FW_BOOT_PARAMS140x4038
+#defineBUTTRESS_REG_FW_BOOT_PARAMS150x403cdrivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +4
-0+ +#define BUTTRESS_FW_BOOT_PARAMS_ENTRY (i) \ + (BUTTRESS_REG_FW_BOOT_PARAMS0 + ((i) * 4U)) +#define BUTTRESS_REG_FW_GP (i) (0x4040 +
0x4* (i))
+#defineBUTTRESS_REG_FPGA_SUPPORT(i)(0x40c0+0x4* (i))drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_FW_GP80x4060
+#defineBUTTRESS_REG_FW_GP240x40a0drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_GPIO_0_PADCFG_ADDR_CR0x4100
+#defineBUTTRESS_REG_GPIO_1_PADCFG_ADDR_CR0x4104
+#defineBUTTRESS_REG_GPIO_2_PADCFG_ADDR_CR0x4108
+#defineBUTTRESS_REG_GPIO_3_PADCFG_ADDR_CR0x410c
+#defineBUTTRESS_REG_GPIO_4_PADCFG_ADDR_CR0x4110
+#defineBUTTRESS_REG_GPIO_5_PADCFG_ADDR_CR0x4114
+#defineBUTTRESS_REG_GPIO_6_PADCFG_ADDR_CR0x4118
+#defineBUTTRESS_REG_GPIO_7_PADCFG_ADDR_CR0x411c
+#defineBUTTRESS_REG_GPIO_ENABLE0x4140
+#defineBUTTRESS_REG_GPIO_VALUE_CR0x4144drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_REG_IS_MEM_CORRECTABLE_ERROR_STATUS0x5000
+#defineBUTTRESS_REG_IS_MEM_FATAL_ERROR_STATUS0x5004
+#defineBUTTRESS_REG_IS_MEM_NON_FATAL_ERROR_STATUS0x5008
+#defineBUTTRESS_REG_IS_MEM_CHECK_PASSED0x500c
+#defineBUTTRESS_REG_IS_MEM_ERROR_INJECT0x5010
+#defineBUTTRESS_REG_IS_MEM_ERROR_CLEAR0x5014
+#defineBUTTRESS_REG_PS_MEM_CORRECTABLE_ERROR_STATUS0x5040
+#defineBUTTRESS_REG_PS_MEM_FATAL_ERROR_STATUS0x5044
+#defineBUTTRESS_REG_PS_MEM_NON_FATAL_ERROR_STATUS0x5048
+#defineBUTTRESS_REG_PS_MEM_CHECK_PASSED0x504c
+#defineBUTTRESS_REG_PS_MEM_ERROR_INJECT0x5050
+#defineBUTTRESS_REG_PS_MEM_ERROR_CLEAR0x5054drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define BUTTRESS_REG_IS_AB_REGION_MIN_ADDRESS (i) (0x6000 +
0x8* (i))
+#defineBUTTRESS_REG_IS_AB_REGION_MAX_ADDRESS(i)(0x6004+0x8* (i))
+#defineBUTTRESS_REG_IS_AB_VIOLATION_LOG00x6080
+#defineBUTTRESS_REG_IS_AB_VIOLATION_LOG10x6084
+#defineBUTTRESS_REG_PS_AB_REGION_MIN_ADDRESS(i)(0x6100+0x8* (i))
+#defineBUTTRESS_REG_PS_AB_REGION_MAX_ADDRESS0(0x6104+0x8* (i))
+#defineBUTTRESS_REG_PS_AB_VIOLATION_LOG00x6180
+#defineBUTTRESS_REG_PS_AB_VIOLATION_LOG10x6184
+#defineBUTTRESS_REG_PS_DEBUG_AB_VIOLATION_LOG00x6200
+#defineBUTTRESS_REG_PS_DEBUG_AB_VIOLATION_LOG10x6204
+#defineBUTTRESS_REG_IS_DEBUG_AB_VIOLATION_LOG00x6208
+#defineBUTTRESS_REG_IS_DEBUG_AB_VIOLATION_LOG10x620c
+#defineBUTTRESS_REG_IB_DVP_AB_VIOLATION_LOG00x6210
+#defineBUTTRESS_REG_IB_DVP_AB_VIOLATION_LOG10x6214
+#defineBUTTRESS_REG_IB_ATB2DTF_AB_VIOLATION_LOG00x6218
+#defineBUTTRESS_REG_IB_ATB2DTF_AB_VIOLATION_LOG10x621c
+#defineBUTTRESS_REG_AB_ENABLE0x6220
+#defineBUTTRESS_REG_AB_DEFAULT_ACCESS0x6230drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +10
-0+ +/* Indicates CSE has received an IPU driver IPC transaction */ +#define BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE BIT(0) +/* Indicates an IPC transaction from CSE has arrived */ +#define BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING BIT(1) +/* Indicates a CSR update from CSE has arrived */ +#define BUTTRESS_IRQ_CSE_CSR_SET BIT(2) +/* Indicates an interrupt set by Punit (not in use at this time) */ +#define BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ BIT(3) +/* Indicates an SAI violation was detected on access to IB registers */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_SAI_VIOLATION BIT(4) +/* Indicates a transaction to IS was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IS_AB_VIOLATION BIT(5) +/* Indicates a transaction to PS was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+#define BUTTRESS_IRQ_PS_AB_VIOLATION BIT(6) +/* Indicates an error response was detected by the IB config NoC */ +#define
BUTTRESS_IRQ_IB_CFG_NOC_ERR_IRQBIT(7)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+/* Indicates an error response was detected by the IB data NoC */ +#define BUTTRESS_IRQ_IB_DATA_NOC_ERR_IRQ BIT(8) +/* Transaction to DVP regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IB_DVP_AB_VIOLATION BIT(9) +/* Transaction to ATB2DTF regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ATB2DTF_AB_VIOLATION BIT(10) +/* Transaction to IS debug regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IS_DEBUG_AB_VIOLATION BIT(11) +/* Transaction to PS debug regs was not able to pass the access blocker */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_PS_DEBUG_AB_VIOLATION BIT(12) +/* Indicates timeout occurred waiting for a response from a target */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_IB_CFG_NOC_TIMEOUT_IRQ BIT(13) +/* Set when any correctable ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ECC_CORRECTABLE BIT(14) +/* Any noncorrectable-nonfatal ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+#define BUTTRESS_IRQ_ECC_NONCORRECTABLE_NONFATAL BIT(15) +/* Set when any noncorrectable-fatal ECC error input wire to buttress is set */
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +7
-0+#define BUTTRESS_IRQ_ECC_NONCORRECTABLE_FATAL BIT(16) +/* Set when timeout occurred waiting for a response from a target */ +#define BUTTRESS_IRQ_IS_CFG_NOC_TIMEOUT_IRQ BIT(17) +#define BUTTRESS_IRQ_PS_CFG_NOC_TIMEOUT_IRQ BIT(18) +#define BUTTRESS_IRQ_LB_CFG_NOC_TIMEOUT_IRQ BIT(19) +/* IS FW double exception event */ +#define
BUTTRESS_IRQ_IS_UC_PFATAL_ERRORBIT(26)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+/* PS FW double exception event */ +#define
BUTTRESS_IRQ_PS_UC_PFATAL_ERRORBIT(27)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +26
-0+/* IS FW watchdog event */ +#define BUTTRESS_IRQ_IS_WATCHDOG BIT(28) +/* PS FW watchdog event */ +#define BUTTRESS_IRQ_PS_WATCHDOG BIT(29) +/* IS IRC irq out */ +#define BUTTRESS_IRQ_IS_IRQ BIT(30) +/* PS IRC irq out */ +#define BUTTRESS_IRQ_PS_IRQ BIT(31) + +/* buttress irq */ +enum { +BUTTRESS_PWR_STATUS_HH_STATE_IDLE , +BUTTRESS_PWR_STATUS_HH_STATE_IN_PRGS , +BUTTRESS_PWR_STATUS_HH_STATE_DONE , +BUTTRESS_PWR_STATUS_HH_STATE_ERR , +}; + +#define BUTTRESS_TSC_CMD_START_TSC_SYNC BIT(0) +#define BUTTRESS_PWR_STATUS_HH_STATUS_SHIFT 11 +#define BUTTRESS_PWR_STATUS_HH_STATUS_MASK (0x3 << 11) +#define BUTTRESS_TSW_WA_SOFT_RESET BIT(8) +/* new for PTL */ +#define BUTTRESS_SEL_PB_TIMESTAMP BIT(9) +#define BUTTRESS_IRQS (BUTTRESS_IRQ_IS_IRQ | \ + BUTTRESS_IRQ_PS_IRQ | \ +
BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING| \drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+BUTTRESS_IRQ_CSE_CSR_SET | \ + BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE |\
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +14
-0+ BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ) + +/* Iunit to CSE regs */ +#define BUTTRESS_IU2CSEDB0_BUSY BIT(31) +#define BUTTRESS_IU2CSEDB0_SHORT_FORMAT_SHIFT 27 +#define BUTTRESS_IU2CSEDB0_CLIENT_ID_SHIFT 10 +#define BUTTRESS_IU2CSEDB0_IPC_CLIENT_ID_VAL 2 + +#define BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD 1 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN 2 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_REPLACE 3 +#define BUTTRESS_IU2CSEDATA0_IPC_UPDATE_SECURE_TOUCH 16 + +#define
BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONEBIT(0)
+#defineBUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONEBIT(1)
+#defineBUTTRESS_CSE2IUDATA0_IPC_AUTH_REPLACE_DONEBIT(2)
+#defineBUTTRESS_CSE2IUDATA0_IPC_UPDATE_SECURE_TOUCH_DONEBIT(4)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +2
-0+ +#define
BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE1BIT(0)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE2BIT(1)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASEBIT(
2)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQBIT(3)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALIDBIT(4)
+#defineBUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQBIT(5)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +65
-0+ +/* 0x20 == NACK, 0xf == unknown command */ +#define BUTTRESS_CSE2IUDATA0_IPC_NACK 0xf20 +#define BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK 0xffff + +/* IS/PS freq control */ +#define BUTTRESS_IS_FREQ_CTL_RATIO_MASK 0xff +#define BUTTRESS_PS_FREQ_CTL_RATIO_MASK 0xff +#define BUTTRESS_IS_FREQ_CTL_CDYN_MASK 0xff +#define BUTTRESS_PS_FREQ_CTL_CDYN_MASK 0xff + +#define IPU7_IS_FREQ_MAX 450 +#define IPU7_IS_FREQ_MIN 50 +#define IPU7_PS_FREQ_MAX 750 +#define BUTTRESS_PS_FREQ_RATIO_STEP 25U +/* valid for IPU8 */ +#define BUTTRESS_IS_FREQ_RATIO_STEP 25U + +/* IS: 400mhz, PS: 500mhz */ +#define IPU7_IS_FREQ_CTL_DEFAULT_RATIO 0x1b +#define IPU7_PS_FREQ_CTL_DEFAULT_RATIO 0x14 +/* IS: 400mhz, PS: 400mhz */ +#define IPU8_IS_FREQ_CTL_DEFAULT_RATIO 0x10 +#define IPU8_PS_FREQ_CTL_DEFAULT_RATIO 0x10 + +#define IPU_FREQ_CTL_CDYN 0x80 +#define IPU_FREQ_CTL_RATIO_SHIFT 0x0 +#define IPU_FREQ_CTL_CDYN_SHIFT 0x8 + +/* buttree power status */ +#define IPU_BUTTRESS_PWR_STATE_IS_PWR_SHIFT 0 +#define IPU_BUTTRESS_PWR_STATE_IS_PWR_MASK \ + (0x3 << IPU_BUTTRESS_PWR_STATE_IS_PWR_SHIFT) + +#define IPU_BUTTRESS_PWR_STATE_PS_PWR_SHIFT 4 +#define IPU_BUTTRESS_PWR_STATE_PS_PWR_MASK \ + (0x3 << IPU_BUTTRESS_PWR_STATE_PS_PWR_SHIFT) + +#define IPU_BUTTRESS_PWR_STATE_DN_DONE 0x0 +#define IPU_BUTTRESS_PWR_STATE_UP_PROCESS 0x1 +#define IPU_BUTTRESS_PWR_STATE_DN_PROCESS 0x2 +#define IPU_BUTTRESS_PWR_STATE_UP_DONE 0x3 + +#define BUTTRESS_PWR_STATE_IS_PWR_SHIFT 3 +#define BUTTRESS_PWR_STATE_IS_PWR_MASK (0x3 << 3) + +#define BUTTRESS_PWR_STATE_PS_PWR_SHIFT 6 +#define BUTTRESS_PWR_STATE_PS_PWR_MASK (0x3 << 6) + +#define PS_FSM_CG BIT(3) + +#define BUTTRESS_OVERRIDE_IS_CLK BIT(1) +#define BUTTRESS_OVERRIDE_PS_CLK BIT(2) +/* ps_pll only valid for ipu8 */ +#define BUTTRESS_OWN_ACK_PS_PLL BIT(8) +#define BUTTRESS_OWN_ACK_IS_CLK BIT(9) +#define BUTTRESS_OWN_ACK_PS_CLK BIT(10) + +/* FW reset ctrl */ +#define BUTTRESS_FW_RESET_CTL_START BIT(0) +#define BUTTRESS_FW_RESET_CTL_DONE BIT(1) + +/* security */ +#define BUTTRESS_SECURITY_CTL_FW_SECURE_MODE BIT(16) +#define BUTTRESS_SECURITY_CTL_FW_SETUP_MASK GENMASK(4,0)
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +3
-0+ +#define BUTTRESS_SECURITY_CTL_FW_SETUP_DONE BIT(0) +#define
BUTTRESS_SECURITY_CTL_AUTH_DONEBIT(1)drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +11
-0+#define BUTTRESS_SECURITY_CTL_AUTH_FAILED BIT(3) + +/* D2D */ +#define BUTTRESS_D2D_PWR_EN BIT(0) +#define BUTTRESS_D2D_PWR_ACK BIT(4) + +/* NDE */ +#define NDE_VAL_MASK GENMASK(9, 0) +#define NDE_SCALE_MASK GENMASK(12, 10) +#define NDE_VALID_MASK BIT(13) +#define NDE_RESVEC_MASK GENMASK(19,16)
drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +26
-0+#define NDE_IN_VBLANK_DIS_MASK BIT(31) + +#define BUTTRESS_NDE_VAL_ACTIVE 48 +#define BUTTRESS_NDE_SCALE_ACTIVE 2 +#define BUTTRESS_NDE_VALID_ACTIVE 1 + +#define BUTTRESS_NDE_VAL_DEFAULT 1023 +#define BUTTRESS_NDE_SCALE_DEFAULT 2 +#define BUTTRESS_NDE_VALID_DEFAULT 0 + +/* IS and PS UCX control */ +#define UCX_CTL_RESET BIT(0) +#define UCX_CTL_RUN BIT(1) +#define UCX_CTL_WAKEUP BIT(2) +#define UCX_CTL_SPARE GENMASK(7, 3) +#define UCX_STS_PWR GENMASK(17, 16) +#define UCX_STS_SLEEPING BIT(18) + +/* offset from PHY base */ +#define PHY_CSI_CFG 0xc0 +#define PHY_CSI_RCOMP_CONTROL 0xc8 +#define PHY_CSI_BSCAN_EXCLUDE 0xd8 + +#define PHY_CPHY_DLL_OVRD (x) (0x100 + 0x100 * (x)) +#define PHY_DPHY_DLL_OVRD (x) (0x14c + 0x100 * (x)) +#define PHY_CPHY_RX_CONTROL1 (x) (0x110 + 0x100 *(x))
+#definePHY_CPHY_RX_CONTROL2(x)(0x114+0x100*
(x))
+#definePHY_DPHY_CFG(x)(0x148+0x100*
(x))drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h new file +34
-0+#define PHY_BB_AFE_CONFIG (x) (0x174 + 0x100 * (x)) + +/* PB registers */ +#define INTERRUPT_STATUS 0x0 +#define BTRS_LOCAL_INTERRUPT_MASK 0x4 +#define GLOBAL_INTERRUPT_MASK 0x8 +#define HM_ATS 0xc +#define ATS_ERROR_LOG1 0x10 +#define ATS_ERROR_LOG2 0x14 +#define ATS_ERROR_CLEAR 0x18 +#define CFI_0_ERROR_LOG 0x1c +#define CFI_0_ERROR_CLEAR 0x20 +#define HASH_CONFIG 0x2c +#define TLBID_HASH_ENABLE_31_0 0x30 +#define TLBID_HASH_ENABLE_63_32 0x34 +#define TLBID_HASH_ENABLE_95_64 0x38 +#define TLBID_HASH_ENABLE_127_96 0x3c +#define CFI_1_ERROR_LOGGING 0x40 +#define CFI_1_ERROR_CLEAR 0x44 +#define IMR_ERROR_LOGGING_LOW 0x48 +#define IMR_ERROR_LOGGING_HIGH 0x4c +#define IMR_ERROR_CLEAR 0x50 +#define PORT_ARBITRATION_WEIGHTS 0x54 +#define IMR_ERROR_LOGGING_CFI_1_LOW 0x58 +#define IMR_ERROR_LOGGING_CFI_1_HIGH 0x5c +#define IMR_ERROR_CLEAR_CFI_1 0x60 +#define BAR2_MISC_CONFIG 0x64 +#define RSP_ID_CONFIG_AXI2CFI_0 0x68 +#define RSP_ID_CONFIG_AXI2CFI_1 0x6c +#define PB_DRIVER_PCODE_MAILBOX_STATUS 0x70 +#define PB_DRIVER_PCODE_MAILBOX_INTERFACE 0x74 +#define PORT_ARBITRATION_WEIGHTS_ATS 0x78 + +#endif /* IPU7_BUTTRESS_REGS_H */ drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +35
-0@@ -0,0 +1,1187 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <asm/cpu_device_id.h> +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/completion.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/firmware.h> +#include <linux/interrupt.h> +#include <linux/iopoll.h> +#include <linux/math64.h> +#include <linux/mm.h> +#include <linux/mutex.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pm_runtime.h> +#include <linux/scatterlist.h> +#include <linux/types.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-buttress.h" +#include "ipu7-buttress-regs.h" + +#define BOOTLOADER_STATUS_OFFSET BUTTRESS_REG_FW_BOOT_PARAMS7 + +#define BOOTLOADER_MAGIC_KEY 0xb00710ad + +#define ENTRY BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE1 +#define EXIT BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE2 +#defineQUERY
BUTTRESS_IU2CSECSR_IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASEdrivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +#define BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX 10 + +#define BUTTRESS_POWER_TIMEOUT_US (200 *
USEC_PER_MSEC)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +#define BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US (5 * USEC_PER_SEC) +#define BUTTRESS_CSE_AUTHENTICATE_TIMEOUT_US (10 * USEC_PER_SEC) +#define BUTTRESS_CSE_FWRESET_TIMEOUT_US (100 *
USEC_PER_MSEC)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +25
-0+ +#define BUTTRESS_IPC_TX_TIMEOUT_MS MSEC_PER_SEC +#define BUTTRESS_IPC_RX_TIMEOUT_MS MSEC_PER_SEC +#define BUTTRESS_IPC_VALIDITY_TIMEOUT_US (1 * USEC_PER_SEC) +#define BUTTRESS_TSC_SYNC_TIMEOUT_US (5 * USEC_PER_MSEC) + +#define BUTTRESS_IPC_RESET_RETRY 2000 +#define BUTTRESS_CSE_IPC_RESET_RETRY 4 +#define BUTTRESS_IPC_CMD_SEND_RETRY 1 + +static const u32 ipu7_adev_irq_mask[2 ] = { +BUTTRESS_IRQ_IS_IRQ , +BUTTRESS_IRQ_PS_IRQ +}; + +int ipu_buttress_ipc_reset (struct ipu7_device *isp, +struct ipu_buttress_ipc *ipc) +{ +unsigned int retries =BUTTRESS_IPC_RESET_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 val =0 , csr_in_clr; + +if (!isp->secure_mode) { + dev_dbg(dev, "Skip IPC reset for non-securemode\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+return 0 ; + } + +mutex_lock (&b->ipc_mutex); + +/* Clear-by-1 CSR (all bits), corresponding internal states. */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +14
-0+ val =readl (isp->base + ipc->csr_in); +writel (val, isp->base + ipc->csr_in); + +/* Set peer CSR bit IPC_PEER_COMP_ACTIONS_RST_PHASE1 */ +writel (ENTRY , isp->base + ipc->csr_out); +/* +* Clear-by-1 all CSR bits EXCEPT following +* bits: +* A. IPC_PEER_COMP_ACTIONS_RST_PHASE1. +* B. IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* C. Possibly custom bits, depending on +* their role. +*/ + csr_in_clr =
BUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQ|drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+BUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALID | + BUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQ |QUERY;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ + do { + usleep_range(400, 500); + val = readl(isp->base + ipc->csr_in); + switch (val) { + case ENTRY | EXIT: + case ENTRY | EXIT | QUERY: + /* + * 1) Clear-by-1 CSR bits + * (IPC_PEER_COMP_ACTIONS_RST_PHASE1, + * IPC_PEER_COMP_ACTIONS_RST_PHASE2). + * 2) Set peer CSR bit + *
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+*/ + writel(ENTRY | EXIT, isp->base + ipc-Quoted 1 line
csr_in);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+writel (QUERY , isp->base + ipc->csr_out); +break ; +case ENTRY : +case ENTRY |QUERY : +/* +* 1) Clear-by-1 CSR bits +* (IPC_PEER_COMP_ACTIONS_RST_PHASE1, +*
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE).drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+* 2) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE1. +*/ + writel(ENTRY | QUERY, isp->base + ipc-Quoted 1 line
csr_in);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+writel (ENTRY , isp->base + ipc->csr_out); +break ; +case EXIT : +case EXIT |QUERY : +/* +* Clear-by-1 CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* 1) Clear incoming doorbell. +* 2) Clear-by-1 all CSR bits EXCEPT following
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +15
-0+* bits: +* A. IPC_PEER_COMP_ACTIONS_RST_PHASE1. +* B. IPC_PEER_COMP_ACTIONS_RST_PHASE2. +* C. Possibly custom bits, depending on +* their role. +* 3) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE2. +*/ +writel (EXIT , isp->base + ipc->csr_in); +writel (0 , isp->base + ipc->db0_in); +writel (csr_in_clr, isp->base + ipc->csr_in); +writel (EXIT , isp->base + ipc->csr_out); + +/* +* Read csr_in again to make sure if
RST_PHASE2is done.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+* If csr_in is QUERY, it should be handled again.
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+*/ +usleep_range (200 ,300 ); + val =readl (isp->base + ipc->csr_in); +if (val &QUERY ) { + dev_dbg(dev, + "RST_PHASE2 retry csr_in =%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+break ; + } +mutex_unlock (&b->ipc_mutex); +return 0 ; +case QUERY : +/* +* 1) Clear-by-1 CSR bit +*
IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE.drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+* 2) Set peer CSR bit +* IPC_PEER_COMP_ACTIONS_RST_PHASE1 +*/ +writel (QUERY , isp->base + ipc->csr_in); +writel (ENTRY , isp->base + ipc->csr_out); +break ; +default : + dev_dbg_ratelimited(dev, "Unexpected CSR0x%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+break ; + } + }while (retries--); + +mutex_unlock (&b->ipc_mutex); +dev_err (dev,"Timed out while waiting for CSE\n" ); + +return -ETIMEDOUT ; +} + +static void ipu_buttress_ipc_validity_close (struct ipu7_device *isp, + struct ipu_buttress_ipc*ipc)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+{ +writel (BUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQ , + isp->base + ipc->csr_out); +} + +static int +ipu_buttress_ipc_validity_open (struct ipu7_device *isp, +struct ipu_buttress_ipc *ipc) +{ + unsigned int mask =
BUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALID;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+void __iomem *addr; +int ret; +u32 val; + +writel (BUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQ , + isp->base + ipc->csr_out); + + addr = isp->base + ipc->csr_in; + ret =readl_poll_timeout (addr, val, val & mask,200 , +BUTTRESS_IPC_VALIDITY_TIMEOUT_US ); +if (ret) { + dev_err(&isp->pdev->dev, "CSE validity timeout0x%x\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+ipu_buttress_ipc_validity_close (isp, ipc); + } + +return ret; +} + +static void ipu_buttress_ipc_recv (struct ipu7_device *isp, + struct ipu_buttress_ipc *ipc, u32
*ipc_msg)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+{ +if (ipc_msg) + *ipc_msg =readl (isp->base + ipc->data0_in); +writel (0 , isp->base + ipc->db0_in); +} + +static int ipu_buttress_ipc_send_bulk(struct ipu7_device *isp, + struct
ipu7_ipc_buttress_bulk_msg*msgs,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+ u32 size) +{ +unsigned long tx_timeout_jiffies, rx_timeout_jiffies; +unsigned int i, retry =BUTTRESS_IPC_CMD_SEND_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct ipu_buttress_ipc *ipc = &b->cse; +struct device *dev = &isp->pdev->dev; +int tout; +u32 val; +int ret; + +mutex_lock (&b->ipc_mutex); + + ret =ipu_buttress_ipc_validity_open (isp, ipc); +if (ret) { +dev_err (dev,"IPC validity open failed\n" ); + goto out; + } + + tx_timeout_jiffies =
msecs_to_jiffies(BUTTRESS_IPC_TX_TIMEOUT_MS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ rx_timeout_jiffies =
msecs_to_jiffies(BUTTRESS_IPC_RX_TIMEOUT_MS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ +for (i =0 ; i < size; i++) { +reinit_completion (&ipc->send_complete); +if (msgs[i].require_resp) +reinit_completion (&ipc->recv_complete); + + dev_dbg(dev, "bulk IPC command: 0x%x\n",msgs[i].cmd);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+writel (msgs[i].cmd, isp->base + ipc->data0_out); + val =BUTTRESS_IU2CSEDB0_BUSY | msgs[i].cmd_size; +writel (val, isp->base + ipc->db0_out); + + tout = wait_for_completion_timeout(&ipc-Quoted 1 line
send_complete,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+
tx_timeout_jiffies);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+if (!tout) { +dev_err (dev,"send IPC response timeout\n" ); +if (!retry--) { + ret = -ETIMEDOUT ; + goto out; + } + +/* Try again if CSE is not responding on first try */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +11
-0+writel (0 , isp->base + ipc->db0_out); + i--; +continue ; + } + + retry =BUTTRESS_IPC_CMD_SEND_RETRY ; + +if (!msgs[i].require_resp) +continue ; + + tout = wait_for_completion_timeout(&ipc-Quoted 1 line
recv_complete,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+
rx_timeout_jiffies);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+if (!tout) { +dev_err (dev,"recv IPC response timeout\n" ); + ret = -ETIMEDOUT ; + goto out; + } + +if (ipc->nack_mask && + (ipc->recv_data & ipc->nack_mask) == ipc->nack){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_err(dev, "IPC NACK for cmd 0x%x\n",msgs[i].cmd);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ ret = -EIO ; + goto out; + } + +if (ipc->recv_data != msgs[i].expected_resp) { + dev_err(dev, + "expected resp: 0x%x, IPC response:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ msgs[i].expected_resp, ipc-Quoted 1 line
recv_data);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +16
-0+ ret = -EIO ; + goto out; + } + } + +dev_dbg (dev,"bulk IPC commands done\n" ); + +out: +ipu_buttress_ipc_validity_close (isp, ipc); +mutex_unlock (&b->ipc_mutex); + +return ret; +} + +static int ipu_buttress_ipc_send (struct ipu7_device *isp, + u32 ipc_msg, u32 size, bool
require_resp,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ u32 expected_resp) +{ +struct ipu7_ipc_buttress_bulk_msg msg = { + .cmd = ipc_msg, + .cmd_size = size, + .require_resp = require_resp, + .expected_resp = expected_resp, + }; + +return ipu_buttress_ipc_send_bulk (isp, &msg,1 ); +} + +static irqreturn_t ipu_buttress_call_isr(struct ipu7_bus_device*adev)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+{ + irqreturn_t ret = IRQ_WAKE_THREAD; + + if (!adev || !adev->auxdrv || !adev->auxdrv_data) + return IRQ_NONE; + + if (adev->auxdrv_data->isr) + ret = adev->auxdrv_data->isr(adev); + + if (ret == IRQ_WAKE_THREAD && !adev->auxdrv_data-Quoted 1 line
isr_threaded)drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +23
-0+ ret =IRQ_NONE ; + +return ret; +} + +irqreturn_t ipu_buttress_isr (int irq,void *isp_ptr) +{ +struct ipu7_device *isp = isp_ptr; +struct ipu7_bus_device *adev[] = { isp->isys, isp->psys }; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +irqreturn_t ret =IRQ_NONE ; +u32 pb_irq, pb_local_irq; +u32 disable_irqs =0 ; +u32 irq_status; +unsigned int i; + +pm_runtime_get_noresume (dev); + + pb_irq =readl (isp->pb_base +INTERRUPT_STATUS ); +writel (pb_irq, isp->pb_base +INTERRUPT_STATUS ); + +/* check btrs ATS, CFI and IMR errors, BIT(0) is unused for IPU */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ pb_local_irq = readl(isp->pb_base +
BTRS_LOCAL_INTERRUPT_MASK);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (pb_local_irq & ~BIT (0 )) { + dev_warn(dev, "PB interrupt status 0x%x local0x%x\n",
pb_irq,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ pb_local_irq); + dev_warn(dev, "Details: %x %x %x %x %x %x %x %x\n", + readl(isp->pb_base + ATS_ERROR_LOG1), + readl(isp->pb_base + ATS_ERROR_LOG2), + readl(isp->pb_base + CFI_0_ERROR_LOG), + readl(isp->pb_base + CFI_1_ERROR_LOGGING), + readl(isp->pb_base +
IMR_ERROR_LOGGING_LOW),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_HIGH),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_CFI_1_LOW),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
IMR_ERROR_LOGGING_CFI_1_HIGH));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ } + + irq_status =readl (isp->base +BUTTRESS_REG_IRQ_STATUS ); +if (!irq_status) { +pm_runtime_put_noidle (dev); +return IRQ_NONE ; + } + + do { + writel(irq_status, isp->base +
BUTTRESS_REG_IRQ_CLEAR);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ +for (i =0 ; i <ARRAY_SIZE (ipu7_adev_irq_mask); i++){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ irqreturn_t r =
ipu_buttress_call_isr(adev[i]);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ +if (!(irq_status & ipu7_adev_irq_mask[i])) +continue ; + +if (r ==IRQ_WAKE_THREAD ) { + ret =IRQ_WAKE_THREAD ; + disable_irqs |=ipu7_adev_irq_mask[i];
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ } else if (ret == IRQ_NONE && r ==
IRQ_HANDLED) {drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+ ret =IRQ_HANDLED ; + } + } + + if (irq_status & (BUTTRESS_IRQS |
BUTTRESS_IRQ_SAI_VIOLATION) &&drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ ret == IRQ_NONE) + ret =IRQ_HANDLED ; + + if (irq_status &
BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING) {drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_dbg(dev,"BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ipu_buttress_ipc_recv(isp, &b->cse, &b-Quoted 1 line
cse.recv_data);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+complete (&b->cse.recv_complete); + } + +if (irq_status &BUTTRESS_IRQ_CSE_CSR_SET ) +dev_dbg (dev,"BUTTRESS_IRQ_CSE_CSR_SET\n" ); + +if (irq_status &BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE ){
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ dev_dbg(dev,"BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+complete (&b->cse.send_complete); + } + +if (irq_status &BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ ) + dev_dbg(dev,"BUTTRESS_IRQ_PUNIT_2_IUNIT_IRQ\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ +if (irq_status &BUTTRESS_IRQ_SAI_VIOLATION && +ipu_buttress_get_secure_mode (isp)) + dev_err(dev,"BUTTRESS_IRQ_SAI_VIOLATION\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ + irq_status = readl(isp->base +
BUTTRESS_REG_IRQ_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+ }while (irq_status); + +if (disable_irqs) +writel (BUTTRESS_IRQS & ~disable_irqs, + isp->base +BUTTRESS_REG_IRQ_ENABLE ); + +pm_runtime_put (dev); + +return ret; +} + +irqreturn_t ipu_buttress_isr_threaded (int irq,void *isp_ptr) +{ +struct ipu7_device *isp = isp_ptr; +struct ipu7_bus_device *adev[] = { isp->isys, isp->psys }; +const struct ipu7_auxdrv_data *drv_data =NULL ; +irqreturn_t ret =IRQ_NONE ; +unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ipu7_adev_irq_mask) && adev[i];i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +29
-0+ drv_data = adev[i]->auxdrv_data; +if (!drv_data) +continue ; + +if (drv_data->wake_isr_thread && + drv_data->isr_threaded (adev[i]) ==IRQ_HANDLED ) + ret =IRQ_HANDLED ; + } + +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_ENABLE ); + +return ret; +} + +static int isys_d2d_power (struct device *dev,bool on) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +int ret =0 ; +u32 val; + +dev_dbg (dev,"power %s isys d2d.\n" , on ?"UP" :"DOWN" ); + val =readl (isp->base +BUTTRESS_REG_D2D_CTL ); +if (!(val &BUTTRESS_D2D_PWR_ACK ) ^ on) { +dev_info (dev,"d2d already in %s state.\n" , + on ?"UP" :"DOWN" ); +return 0 ; + } + + val = on ? val | BUTTRESS_D2D_PWR_EN : val &(~BUTTRESS_D2D_PWR_EN);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+writel (val, isp->base +BUTTRESS_REG_D2D_CTL ); + ret = readl_poll_timeout(isp->base + BUTTRESS_REG_D2D_CTL, + val, (!(val & BUTTRESS_D2D_PWR_ACK)^ on),
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +26
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) +dev_err (dev,"power %s d2d timeout. status: 0x%x\n" , + on ?"UP" :"DOWN" , val); + +return ret; +} + +static void isys_nde_control (struct device *dev,bool on) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, value, scale, valid, resvec; +u32 nde_reg; + +if (on) { + value =BUTTRESS_NDE_VAL_ACTIVE ; + scale =BUTTRESS_NDE_SCALE_ACTIVE ; + valid =BUTTRESS_NDE_VALID_ACTIVE ; + }else { + value =BUTTRESS_NDE_VAL_DEFAULT ; + scale =BUTTRESS_NDE_SCALE_DEFAULT ; + valid =BUTTRESS_NDE_VALID_DEFAULT ; + } + +/* only set the fabrics resource ownership for ipu8 */ + nde_reg = is_ipu8(isp->hw_ver) ?
IPU8_BUTTRESS_REG_NDE_CONTROL:drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+IPU7_BUTTRESS_REG_NDE_CONTROL ; + resvec =is_ipu8 (isp->hw_ver) ?0x2 :0xe ; + val =FIELD_PREP (NDE_VAL_MASK , value) | +FIELD_PREP (NDE_SCALE_MASK , scale) | +FIELD_PREP (NDE_VALID_MASK , valid) | +FIELD_PREP (NDE_RESVEC_MASK , resvec); + +writel (val, isp->base + nde_reg); +} + +static int ipu7_buttress_powerup (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +23
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + + exp_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; +if (ctrl->subsys_id ==IPU_IS ) { + ret =isys_d2d_power (dev, true); +if (ret) + goto out_power; +isys_nde_control (dev, true); + } + +/* request clock resource ownership */ + val =readl (isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + val |= ctrl->ovrd_clk; +writel (val, isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SLEEP_LEVEL_STS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ val, (val & ctrl->own_clk_ack), + 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) + dev_warn(dev, "request clk ownership timeout. status0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ val); + + val = ctrl->ratio << ctrl->ratio_shift | ctrl->cdyn << ctrl-Quoted 1 line
cdyn_shift;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+ +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power up timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +19
-0+ goto out_power; + } + +dev_dbg (dev,"%s power up successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); + +/* release clock resource ownership */ + val =readl (isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + val &= ~ctrl->ovrd_clk; +writel (val, isp->base +BUTTRESS_REG_SLEEP_LEVEL_CFG ); + +out_power: +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu7_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +17
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + + exp_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; + val =0x8 << ctrl->ratio_shift; + +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power down timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +18
-0+ goto out_power; + } + +dev_dbg (dev,"%s power down successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +if (ctrl->subsys_id ==IPU_IS && !ret) { +isys_d2d_power (dev, false); +isys_nde_control (dev, false); + } + +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu8_buttress_powerup (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +22
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 sleep_level_reg =BUTTRESS_REG_SLEEP_LEVEL_STS ; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + exp_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; +if (ctrl->subsys_id ==IPU_IS ) { + ret =isys_d2d_power (dev, true); +if (ret) + goto out_power; +isys_nde_control (dev, true); + } + +/* request ps_pll when psys freq > 400Mhz */ +if (ctrl->subsys_id ==IPU_PS && ctrl->ratio >0x10 ) { +writel (1 , isp->base +BUTTRESS_REG_PS_PLL_ENABLE ); + ret = readl_poll_timeout(isp->base +
sleep_level_reg,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, (val & ctrl-Quoted 1 line
own_clk_ack),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ 100,
BUTTRESS_POWER_TIMEOUT_US);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (ret) + dev_warn(dev, "ps_pll req ack timeout.status 0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ val); + } + + val = ctrl->ratio << ctrl->ratio_shift | ctrl->cdyn << ctrl-Quoted 1 line
cdyn_shift;drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power up timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ goto out_power; + } + +dev_dbg (dev,"%s power up successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +static int ipu8_buttress_powerdown (struct device *dev, + const struct ipu_buttress_ctrl*ctrl)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; +u32 val, exp_sts; +int ret =0 ; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + exp_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; + +if (ctrl->subsys_id ==IPU_PS ) + val =0x10 << ctrl->ratio_shift; +else + val =0x8 << ctrl->ratio_shift; + +dev_dbg (dev,"set 0x%x to %s_WORKPOINT_REQ.\n" , val, + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" ); +writel (val, isp->base + ctrl->freq_ctl); + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val, ((val & ctrl->pwr_sts_mask) ==
exp_sts),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ 100, BUTTRESS_POWER_TIMEOUT_US); +if (ret) { + dev_err(dev, "%s power down timeout with status:0x%x\n",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ ctrl->subsys_id == IPU_IS ? "IS" : "PS",val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +13
-0+ goto out_power; + } + +dev_dbg (dev,"%s power down successfully. status: 0x%x\n" , + ctrl->subsys_id ==IPU_IS ?"IS" :"PS" , val); +out_power: +if (ctrl->subsys_id ==IPU_IS && !ret) { +isys_d2d_power (dev, false); +isys_nde_control (dev, false); + } + +if (ctrl->subsys_id ==IPU_PS ) { + val = readl(isp->base +
BUTTRESS_REG_SLEEP_LEVEL_STS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+if (val & ctrl->own_clk_ack) + writel(0, isp->base +
BUTTRESS_REG_PS_PLL_ENABLE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +60
-0+ } +mutex_unlock (&isp->buttress.power_mutex); + +return ret; +} + +int ipu_buttress_powerup (struct device *dev, +const struct ipu_buttress_ctrl *ctrl) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; + +if (is_ipu8 (isp->hw_ver)) +return ipu8_buttress_powerup (dev, ctrl); + +return ipu7_buttress_powerup (dev, ctrl); +} + +int ipu_buttress_powerdown (struct device *dev, +const struct ipu_buttress_ctrl *ctrl) +{ +struct ipu7_device *isp =to_ipu7_bus_device (dev)->isp; + +if (is_ipu8 (isp->hw_ver)) +return ipu8_buttress_powerdown (dev, ctrl); + +return ipu7_buttress_powerdown (dev, ctrl); +} + +bool ipu_buttress_get_secure_mode (struct ipu7_device *isp) +{ +u32 val; + + val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + +return val &BUTTRESS_SECURITY_CTL_FW_SECURE_MODE ; +} + +bool ipu_buttress_auth_done (struct ipu7_device *isp) +{ +u32 val; + +if (!isp->secure_mode) +return true; + + val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + val =FIELD_GET (BUTTRESS_SECURITY_CTL_FW_SETUP_MASK , val); + +return val ==BUTTRESS_SECURITY_CTL_AUTH_DONE ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_auth_done,"INTEL_IPU7" ); + +int ipu_buttress_get_isys_freq (struct ipu7_device *isp,u32 *freq) +{ +u32 reg_val; +int ret; + + ret =pm_runtime_get_sync (&isp->isys->auxdev.dev); +if (ret <0 ) { +pm_runtime_put (&isp->isys->auxdev.dev); + dev_err(&isp->pdev->dev, "Runtime PM failed (%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+return ret; + } + + reg_val =readl (isp->base +BUTTRESS_REG_IS_WORKPOINT_REQ ); + +pm_runtime_put (&isp->isys->auxdev.dev); + +if (is_ipu8 (isp->hw_ver)) + *freq = (reg_val &BUTTRESS_IS_FREQ_CTL_RATIO_MASK )* 25;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+else + *freq = (reg_val &BUTTRESS_IS_FREQ_CTL_RATIO_MASK )* 50 / 3;
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +14
-0+ +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_get_isys_freq,"INTEL_IPU7" ); + +int ipu_buttress_get_psys_freq (struct ipu7_device *isp,u32 *freq) +{ +u32 reg_val; +int ret; + + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +pm_runtime_put (&isp->psys->auxdev.dev); + dev_err(&isp->pdev->dev, "Runtime PM failed (%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +29
-0+return ret; + } + + reg_val =readl (isp->base +BUTTRESS_REG_PS_WORKPOINT_REQ ); + +pm_runtime_put (&isp->psys->auxdev.dev); + + reg_val &=BUTTRESS_PS_FREQ_CTL_RATIO_MASK ; + *freq =BUTTRESS_PS_FREQ_RATIO_STEP * reg_val; + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_get_psys_freq,"INTEL_IPU7" ); + +int ipu_buttress_reset_authentication (struct ipu7_device *isp) +{ +struct device *dev = &isp->pdev->dev; +int ret; +u32 val; + +if (!isp->secure_mode) { +dev_dbg (dev,"Skip auth for non-secure mode\n" ); +return 0 ; + } + +writel (BUTTRESS_FW_RESET_CTL_START , isp->base + +BUTTRESS_REG_FW_RESET_CTL ); + + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_FW_RESET_CTL, val,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val & BUTTRESS_FW_RESET_CTL_DONE,500,
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ BUTTRESS_CSE_FWRESET_TIMEOUT_US); +if (ret) { + dev_err(dev, "Time out while resettingauthentication state\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +36
-0+return ret; + } + +dev_dbg (dev,"FW reset for authentication done\n" ); +writel (0 , isp->base +BUTTRESS_REG_FW_RESET_CTL ); +/* leave some time for HW restore */ +usleep_range (800 ,1000 ); + +return 0 ; +} + +int ipu_buttress_authenticate (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 data, mask, done, fail; +int ret; + +if (!isp->secure_mode) { +dev_dbg (dev,"Skip auth for non-secure mode\n" ); +return 0 ; + } + +mutex_lock (&b->auth_mutex); + +if (ipu_buttress_auth_done (isp)) { + ret =0 ; + goto out_unlock; + } + +/* +* BUTTRESS_REG_FW_SOURCE_BASE needs to be set with FW CPD +* package address for secure mode. +*/ + + writel(isp->cpd_fw->size, isp->base +
BUTTRESS_REG_FW_SOURCE_SIZE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+writel (sg_dma_address (isp->psys->fw_sgt.sgl), + isp->base +BUTTRESS_REG_FW_SOURCE_BASE ); + +/* +* Write boot_load into IU2CSEDATA0 +* Write sizeof(boot_load) | 0x2 << CLIENT_ID to +* IU2CSEDB.IU2CSECMD and set IU2CSEDB.IU2CSEBUSY as +*/ +dev_info (dev,"Sending BOOT_LOAD to CSE\n" ); + ret = ipu_buttress_ipc_send(isp,
BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ 1, true, +
BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+if (ret) { +dev_err (dev,"CSE boot_load failed\n" ); + goto out_unlock; + } + + mask =BUTTRESS_SECURITY_CTL_FW_SETUP_MASK ; + done =BUTTRESS_SECURITY_CTL_FW_SETUP_DONE ; + fail =BUTTRESS_SECURITY_CTL_AUTH_FAILED ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SECURITY_CTL, data,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +15
-0+ ((data & mask) == done || + (data & mask) == fail),500 , + BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US); +if (ret) { +dev_err (dev,"CSE boot_load timeout\n" ); + goto out_unlock; + } + +if ((data & mask) == fail) { +dev_err (dev,"CSE auth failed\n" ); + ret = -EINVAL ; + goto out_unlock; + } + + ret = readl_poll_timeout(isp->base +
BOOTLOADER_STATUS_OFFSET,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ data, data == BOOTLOADER_MAGIC_KEY,500,
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US); +if (ret) { + dev_err(dev, "Unexpected magic number 0x%x\n",data);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ goto out_unlock; + } + +/* +* Write authenticate_run into IU2CSEDATA0 +* Write sizeof(boot_load) | 0x2 << CLIENT_ID to +* IU2CSEDB.IU2CSECMD and set IU2CSEDB.IU2CSEBUSY as +*/ +dev_info (dev,"Sending AUTHENTICATE_RUN to CSE\n" ); + ret = ipu_buttress_ipc_send(isp,
BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ 1, true, +
BUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONE);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+if (ret) { +dev_err (dev,"CSE authenticate_run failed\n" ); + goto out_unlock; + } + + done =BUTTRESS_SECURITY_CTL_AUTH_DONE ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_SECURITY_CTL, data,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +3
-0+ ((data & mask) == done || + (data & mask) == fail), 500, +
BUTTRESS_CSE_AUTHENTICATE_TIMEOUT_US);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +38
-0+if (ret) { +dev_err (dev,"CSE authenticate timeout\n" ); + goto out_unlock; + } + +if ((data & mask) == fail) { +dev_err (dev,"CSE boot_load failed\n" ); + ret = -EINVAL ; + goto out_unlock; + } + +dev_info (dev,"CSE authenticate_run done\n" ); + +out_unlock: +mutex_unlock (&b->auth_mutex); + +return ret; +} + +static int ipu_buttress_send_tsc_request (struct ipu7_device *isp) +{ +u32 val, mask, done; +int ret; + + mask =BUTTRESS_PWR_STATUS_HH_STATUS_MASK ; + +writel (BUTTRESS_TSC_CMD_START_TSC_SYNC , + isp->base +BUTTRESS_REG_TSC_CMD ); + + val =readl (isp->base +BUTTRESS_REG_PWR_STATUS ); + val =FIELD_GET (mask, val); +if (val ==BUTTRESS_PWR_STATUS_HH_STATE_ERR ) { +dev_err (&isp->pdev->dev,"Start tsc sync failed\n" ); +return -EINVAL ; + } + + done =BUTTRESS_PWR_STATUS_HH_STATE_DONE ; + ret = readl_poll_timeout(isp->base +
BUTTRESS_REG_PWR_STATUS, val,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+FIELD_GET (mask, val) == done,500 , + BUTTRESS_TSC_SYNC_TIMEOUT_US); +if (ret) + dev_err(&isp->pdev->dev, "Start tsc synctimeout\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +12
-0+ +return ret; +} + +int ipu_buttress_start_tsc_sync (struct ipu7_device *isp) +{ +void __iomem *base = isp->base; +unsigned int i; +u32 val; + +if (is_ipu8 (isp->hw_ver)) { + for (i = 0; i < BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX;i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val = readl(base +
BUTTRESS_REG_PB_TIMESTAMP_VALID);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+if (val ==1 ) +return 0 ; +usleep_range (40 ,50 ); + } + + dev_err(&isp->pdev->dev, "PB HH sync failed (valid%u)\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +9
-0+return -ETIMEDOUT ; + } + +if (is_ipu7p5 (isp->hw_ver)) { + val =readl (base +BUTTRESS_REG_TSC_CTL ); + val |=BUTTRESS_SEL_PB_TIMESTAMP ; +writel (val, base +BUTTRESS_REG_TSC_CTL ); + + for (i = 0; i < BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX;i++) {
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ val = readl(base +
BUTTRESS_REG_PB_TIMESTAMP_VALID);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+if (val ==1 ) +return 0 ; +usleep_range (40 ,50 ); + } + + dev_err(&isp->pdev->dev, "PB HH sync failed (valid%u)\n", val);
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +35
-0+ +return -ETIMEDOUT ; + } + +for (i =0 ; i <BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX ; i++) { +int ret; + + ret =ipu_buttress_send_tsc_request (isp); +if (ret != -ETIMEDOUT ) +return ret; + + val =readl (base +BUTTRESS_REG_TSC_CTL ); + val = val |BUTTRESS_TSW_WA_SOFT_RESET ; +writel (val, base +BUTTRESS_REG_TSC_CTL ); + val = val & (~BUTTRESS_TSW_WA_SOFT_RESET ); +writel (val, base +BUTTRESS_REG_TSC_CTL ); + } + +dev_err (&isp->pdev->dev,"TSC sync failed (timeout)\n" ); + +return -ETIMEDOUT ; +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_start_tsc_sync,"INTEL_IPU7" ); + +void ipu_buttress_tsc_read (struct ipu7_device *isp,u64 *val) +{ +unsigned long flags; +u32 tsc_hi, tsc_lo; + +local_irq_save (flags); +if (is_ipu7 (isp->hw_ver)) { + tsc_lo =readl (isp->base +BUTTRESS_REG_TSC_LO ); + tsc_hi =readl (isp->base +BUTTRESS_REG_TSC_HI ); + }else { + tsc_lo = readl(isp->base +
BUTTRESS_REG_PB_TIMESTAMP_LO);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ tsc_hi = readl(isp->base +
BUTTRESS_REG_PB_TIMESTAMP_HI);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +7
-0+ } + *val = (u64 )tsc_hi <<32 | tsc_lo; +local_irq_restore (flags); +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_tsc_read,"INTEL_IPU7" ); + +u64 ipu_buttress_tsc_ticks_to_ns(u64 ticks, const struct ipu7_device*isp)
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +20
-0+{ +u64 ns = ticks *10000 ; + +/* +* converting TSC tick count to ns is calculated by: +* Example (TSC clock frequency is 19.2MHz): +* ns = ticks * 1000 000 000 / 19.2Mhz +* = ticks * 1000 000 000 / 19200000Hz +* = ticks * 10000 / 192 ns +*/ +return div_u64 (ns, isp->buttress.ref_clk); +} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_tsc_ticks_to_ns,"INTEL_IPU7" ); + +/* trigger uc control to wakeup fw */ +void ipu_buttress_wakeup_is_uc (const struct ipu7_device *isp) +{ +u32 val; + + val = readl(isp->base +
BUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ val |=UCX_CTL_WAKEUP ; + writel(val, isp->base +
BUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +8
-0+} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_wakeup_is_uc,"INTEL_IPU7" ); + +void ipu_buttress_wakeup_ps_uc (const struct ipu7_device *isp) +{ +u32 val; + + val = readl(isp->base +
BUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ val |=UCX_CTL_WAKEUP ; + writel(val, isp->base +
BUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +18
-0+} +EXPORT_SYMBOL_NS_GPL (ipu_buttress_wakeup_ps_uc,"INTEL_IPU7" ); + +static const struct x86_cpu_id ipu_misc_cfg_exclusion[] = { +X86_MATCH_VFM_STEPS (INTEL_PANTHERLAKE_L ,0x1 ,0x1 ,0 ), + {}, +}; + +static void ipu_buttress_setup (struct ipu7_device *isp) +{ +struct device *dev = &isp->pdev->dev; +u32 val; + +/* program PB BAR */ +#define WRXREQOP_OVRD_VAL_MASK GENMASK(22, 19) +writel (0 , isp->pb_base +GLOBAL_INTERRUPT_MASK ); + val =readl (isp->pb_base +BAR2_MISC_CONFIG ); + if (is_ipu7(isp->hw_ver) ||
x86_match_cpu(ipu_misc_cfg_exclusion))drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+ val |=0x100U ; + else + val |= FIELD_PREP(WRXREQOP_OVRD_VAL_MASK, 0xf) | + BIT(18) | 0x100U; + +writel (val, isp->pb_base +BAR2_MISC_CONFIG ); + val =readl (isp->pb_base +BAR2_MISC_CONFIG ); + +if (is_ipu8 (isp->hw_ver)) { + writel(BIT(13), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(9), isp->pb_base +
TLBID_HASH_ENABLE_95_64);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "IPU8 TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_95_64));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ }else if (is_ipu7p5 (isp->hw_ver)) { + writel(BIT(14), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(9), isp->pb_base +
TLBID_HASH_ENABLE_95_64);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "IPU7P5 TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_95_64));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ }else { + writel(BIT(22), isp->pb_base +
TLBID_HASH_ENABLE_63_32);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ writel(BIT(1), isp->pb_base +
TLBID_HASH_ENABLE_127_96);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ dev_dbg(dev, "TLBID_HASH %x %x\n", + readl(isp->pb_base +
TLBID_HASH_ENABLE_63_32),drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ readl(isp->pb_base +
TLBID_HASH_ENABLE_127_96));drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +6
-0+ } + +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_CLEAR ); +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_MASK ); +writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_IRQ_ENABLE ); +/* LNL SW workaround for PS PD hang when PS sub-domain during PD */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +10
-0+writel (PS_FSM_CG , isp->base +BUTTRESS_REG_CG_CTRL_BITS ); +} + +void ipu_buttress_restore (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; + +ipu_buttress_setup (isp); + + writel(b->wdt_cached_value, isp->base +
BUTTRESS_REG_IDLE_WDT);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +28
-0+} + +int ipu_buttress_init (struct ipu7_device *isp) +{ +int ret, ipc_reset_retry =BUTTRESS_CSE_IPC_RESET_RETRY ; +struct ipu_buttress *b = &isp->buttress; +struct device *dev = &isp->pdev->dev; +u32 val; + +mutex_init (&b->power_mutex); +mutex_init (&b->auth_mutex); +mutex_init (&b->cons_mutex); +mutex_init (&b->ipc_mutex); +init_completion (&b->cse.send_complete); +init_completion (&b->cse.recv_complete); + + b->cse.nack =BUTTRESS_CSE2IUDATA0_IPC_NACK ; + b->cse.nack_mask =BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ; + b->cse.csr_in =BUTTRESS_REG_CSE2IUCSR ; + b->cse.csr_out =BUTTRESS_REG_IU2CSECSR ; + b->cse.db0_in =BUTTRESS_REG_CSE2IUDB0 ; + b->cse.db0_out =BUTTRESS_REG_IU2CSEDB0 ; + b->cse.data0_in =BUTTRESS_REG_CSE2IUDATA0 ; + b->cse.data0_out =BUTTRESS_REG_IU2CSEDATA0 ; + + isp->secure_mode =ipu_buttress_get_secure_mode (isp); + val =readl (isp->base +BUTTRESS_REG_IPU_SKU ); + dev_info(dev, "IPU%u SKU %u in %s mode mask 0x%x\n", val &
0xf,drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +1
-0+ (val >> 4) & 0x7, isp->secure_mode ? "secure" :"non-secure",
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +2
-0+ readl(isp->base + BUTTRESS_REG_CAMERA_MASK)); + b->wdt_cached_value = readl(isp->base +
BUTTRESS_REG_IDLE_WDT);drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +5
-0+ b->ref_clk =384 ; + +ipu_buttress_setup (isp); + +/* Retry couple of times in case of CSE initialization is delayed */
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +4
-0+ do { + ret = ipu_buttress_ipc_reset(isp, &b->cse); + if (ret) { + dev_warn(dev, "IPC reset protocol failed,retrying\n");
drivers/media/pci/intel/ipu7/ipu7-buttress.c new file +26
-0+ }else { +dev_dbg (dev,"IPC reset done\n" ); +return 0 ; + } + }while (ipc_reset_retry--); + +dev_err (dev,"IPC reset protocol failed\n" ); + +mutex_destroy (&b->power_mutex); +mutex_destroy (&b->auth_mutex); +mutex_destroy (&b->cons_mutex); +mutex_destroy (&b->ipc_mutex); + +return ret; +} + +void ipu_buttress_exit (struct ipu7_device *isp) +{ +struct ipu_buttress *b = &isp->buttress; + +writel (0 , isp->base +BUTTRESS_REG_IRQ_ENABLE ); +mutex_destroy (&b->power_mutex); +mutex_destroy (&b->auth_mutex); +mutex_destroy (&b->cons_mutex); +mutex_destroy (&b->ipc_mutex); +}drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +19
-0@@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_BUTTRESS_H +#define IPU7_BUTTRESS_H + +#include <linux/completion.h> +#include <linux/irqreturn.h> +#include <linux/list.h> +#include <linux/mutex.h> + +struct device; +struct ipu7_device; + +struct ipu_buttress_ctrl { + u32 subsys_id; + u32 freq_ctl, pwr_sts_shift, pwr_sts_mask, pwr_sts_on,
pwr_sts_off;drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +54
-0+u32 ratio; +u32 ratio_shift; +u32 cdyn; +u32 cdyn_shift; +u32 ovrd_clk; +u32 own_clk_ack; +}; + +struct ipu_buttress_ipc { +struct completion send_complete; +struct completion recv_complete; +u32 nack; +u32 nack_mask; +u32 recv_data; +u32 csr_out; +u32 csr_in; +u32 db0_in; +u32 db0_out; +u32 data0_out; +u32 data0_in; +}; + +struct ipu_buttress { +struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex; +struct ipu_buttress_ipc cse; +u32 psys_min_freq; +u32 wdt_cached_value; +u8 psys_force_ratio; +bool force_suspend; +u32 ref_clk; +}; + +struct ipu7_ipc_buttress_bulk_msg { +u32 cmd; +u32 expected_resp; +bool require_resp; +u8 cmd_size; +}; + +int ipu_buttress_ipc_reset (struct ipu7_device *isp, +struct ipu_buttress_ipc *ipc); +int ipu_buttress_powerup (struct device *dev, +const struct ipu_buttress_ctrl *ctrl); +int ipu_buttress_powerdown (struct device *dev, +const struct ipu_buttress_ctrl *ctrl); +bool ipu_buttress_get_secure_mode (struct ipu7_device *isp); +int ipu_buttress_authenticate (struct ipu7_device *isp); +int ipu_buttress_reset_authentication (struct ipu7_device *isp); +bool ipu_buttress_auth_done (struct ipu7_device *isp); +int ipu_buttress_get_isys_freq (struct ipu7_device *isp,u32 *freq); +int ipu_buttress_get_psys_freq (struct ipu7_device *isp,u32 *freq); +int ipu_buttress_start_tsc_sync (struct ipu7_device *isp); +void ipu_buttress_tsc_read (struct ipu7_device *isp,u64 *val); +u64 ipu_buttress_tsc_ticks_to_ns(u64 ticks, const struct ipu7_device*isp);
drivers/media/pci/intel/ipu7/ipu7-buttress.h new file +11
-0+ +irqreturn_t ipu_buttress_isr (int irq,void *isp_ptr); +irqreturn_t ipu_buttress_isr_threaded (int irq,void *isp_ptr); +int ipu_buttress_init (struct ipu7_device *isp); +void ipu_buttress_exit (struct ipu7_device *isp); +void ipu_buttress_csi_port_config (struct ipu7_device *isp, +u32 legacy,u32 combo); +void ipu_buttress_restore (struct ipu7_device *isp); +void ipu_buttress_wakeup_is_uc (const struct ipu7_device *isp); +void ipu_buttress_wakeup_ps_uc (const struct ipu7_device *isp); +#endif /* IPU7_BUTTRESS_H */ drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +10
-0@@ -0,0 +1,146 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2018 - 2024 Intel Corporation +*/ + +#ifndef IPU7_PLATFORM_REGS_H +#define IPU7_PLATFORM_REGS_H + +#define IS_BASE 0x230000 +#define IS_UC_CTRL_BASE (IS_BASE +
0x0)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +3
-0+ +#define PS_BASE 0x130000 +#define PS_UC_CTRL_BASE (PS_BASE +
0x0)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +128
-0+ +/* +* bit 0: IRQ from FW, +* bit 1, 2 and 3: IRQ from HW +*/ +#define TO_SW_IRQ_MASK 0xf +#define TO_SW_IRQ_FW BIT(0) + +#define FW_CODE_BASE 0x0 +#define FW_DATA_BASE 0x4 +#define CPU_AXI_CNTL 0x8 +#define CPU_QOS_CNTL 0xc +#define IDMA_AXI_CNTL 0x10 +#define IDMA_QOS_CNTL 0x14 +#define MEF_SPLIT_SIZE 0x18 +#define FW_MSG_CONTROL 0x1c +#define FW_MSG_CREDITS_STATUS 0x20 +#define FW_MSG_CREDIT_TAKEN 0x24 +#define FW_MSG_CREDIT_RETURNED 0x28 +#define TRIG_IDMA_IN 0x2c +#define IDMA_DONE 0x30 +#define IDMA_DONE_CLEAR 0x34 +#define DMEM_CAPACITY 0x38 +#define NON_SECURE_CODE_OFFSET 0x3c +#define UC_CG_CTRL_BITS 0x40 +#define ALT_RESET_VEC 0x44 +#define WDT_NMI_DURATION 0x104 +#define WDT_RST_REQ_DURATION 0x108 +#define WDT_CNTL 0x10c +#define WDT_NMI_CURRENT_COUNT 0x110 +#define WDT_RST_CURRENT_COUNT 0x114 +#define WDT_HALT 0x118 +#define WDT_STATUS 0x11c +#define SPARE_REG_RW 0x120 +#define SPARE_REG_RO 0x124 +#define FW_TO_FW_IRQ_CNTL_EDGE 0x200 +#define FW_TO_FW_IRQ_CNTL_MASK_N 0x204 +#define FW_TO_FW_IRQ_CNTL_STATUS 0x208 +#define FW_TO_FW_IRQ_CNTL_CLEAR 0x20c +#define FW_TO_FW_IRQ_CNTL_ENABLE 0x210 +#define FW_TO_FW_IRQ_CNTL_LEVEL_NOT_PULSE 0x214 +#define CLK_GATE_DIS 0x218 +#define DEBUG_STATUS 0x1000 +#define DEBUG_EXCPETION 0x1004 +#define TIE_GENERAL_INPUT 0x1008 +#define ERR_STATUS 0x100c +#define UC_ERR_INFO 0x1010 +#define SPARE_CNTL 0x1014 +#define MEF_TRC_CNTL 0x1100 +#define DBG_MEF_LAST_PUSH 0x1104 +#define DBG_MEF_LAST_POP 0x1108 +#define DBG_MEF_COUNT_CNTL 0x110c +#define DBG_MEF_COUNT1 0x1110 +#define DBG_MEF_COUNT2 0x1114 +#define DBG_MEF_ACC_OCCUPANCY 0x1118 +#define DBG_MEF_MAX_IRQ_TO_POP 0x111c +#define DBG_IRQ_CNTL 0x1120 +#define DBG_IRQ_COUNT 0x1124 +#define DBG_CYC_COUNT 0x1128 +#define DBG_CNTL 0x1130 +#define DBG_RST_REG 0x1134 +#define DBG_MEF_STATUS0 0x1138 +#define DBG_MEF_STATUS1 0x113c +#define PDEBUG_CTL 0x1140 +#define PDEBUG_DATA 0x1144 +#define PDEBUG_INST 0x1148 +#define PDEBUG_LS0ADDR 0x114c +#define PDEBUG_LS0DATA 0x1150 +#define PDEBUG_LS0STAT 0x1154 +#define PDEBUG_PC 0x1158 +#define PDEBUG_MISC 0x115c +#define PDEBUG_PREF_STS 0x1160 +#define MEF0_ADDR 0x2000 +#define MEF1_ADDR 0x2020 +#define PRINTF_EN_THROUGH_TRACE 0x3004 +#define PRINTF_EN_DIRECTLY_TO_DDR 0x3008 +#define PRINTF_DDR_BASE_ADDR 0x300c +#define PRINTF_DDR_SIZE 0x3010 +#define PRINTF_DDR_NEXT_ADDR 0x3014 +#define PRINTF_STATUS 0x3018 +#define PRINTF_AXI_CNTL 0x301c +#define PRINTF_MSG_LENGTH 0x3020 +#define TO_SW_IRQ_CNTL_EDGE 0x4000 +#define TO_SW_IRQ_CNTL_MASK_N 0x4004 +#define TO_SW_IRQ_CNTL_STATUS 0x4008 +#define TO_SW_IRQ_CNTL_CLEAR 0x400c +#define TO_SW_IRQ_CNTL_ENABLE 0x4010 +#define TO_SW_IRQ_CNTL_LEVEL_NOT_PULSE 0x4014 +#define ERR_IRQ_CNTL_EDGE 0x4018 +#define ERR_IRQ_CNTL_MASK_N 0x401c +#define ERR_IRQ_CNTL_STATUS 0x4020 +#define ERR_IRQ_CNTL_CLEAR 0x4024 +#define ERR_IRQ_CNTL_ENABLE 0x4028 +#define ERR_IRQ_CNTL_LEVEL_NOT_PULSE 0x402c +#define LOCAL_DMEM_BASE_ADDR 0x1300000 + +/* +* IS_UC_TO_SW irqs +* bit 0: IRQ from local FW +* bit 1~3: IRQ from HW +*/ +#define IS_UC_TO_SW_IRQ_MASK 0xf + +#define IPU_ISYS_SPC_OFFSET 0x210000 +#define IPU7_PSYS_SPC_OFFSET 0x118000 +#define IPU_ISYS_DMEM_OFFSET 0x200000 +#define IPU_PSYS_DMEM_OFFSET 0x100000 + +#define IPU7_ISYS_CSI_PORT_NUM 4 + +/* IRQ-related registers in PSYS */ +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_EDGE 0x134000 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_MASK 0x134004 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_STATUS 0x134008 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_CLEAR 0x13400c +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_ENABLE 0x134010 +#define IPU_REG_PSYS_TO_SW_IRQ_CNTL_LEVEL_NOT_PULSE 0x134014 +#define IRQ_FROM_LOCAL_FW BIT(0) + +/* +* psys subdomains power request regs +*/ +enum ipu7_device_buttress_psys_domain_pos { +IPU_PSYS_SUBDOMAIN_LB =0 , +IPU_PSYS_SUBDOMAIN_BB =1 , +}; + +#define
IPU7_PSYS_DOMAIN_POWER_MASK(BIT(IPU_PSYS_SUBDOMAIN_LB)| \drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +1
-0+
BIT(IPU_PSYS_SUBDOMAIN_BB))
+#defineIPU8_PSYS_DOMAIN_POWER_MASKBIT(IPU_PSYS_SUBDOMAIN_LB)drivers/media/pci/intel/ipu7/ipu7-platform-regs.h new file +3
-0+#define IPU_PSYS_DOMAIN_POWER_IN_PROGRESS BIT(31) + +#endif /* IPU7_PLATFORM_REGS_H */ drivers/media/pci/intel/ipu7/ipu7.c new file +60
-0@@ -0,0 +1,2791 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/acpi.h> +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/bug.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/firmware.h> +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/list.h> +#include <linux/module.h> +#include <linux/pm_runtime.h> +#include <linux/property.h> +#include <linux/scatterlist.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/vmalloc.h> +#include <linux/version.h> + +#include <media/ipu-bridge.h> + +#include "abi/ipu7_fw_common_abi.h" + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-buttress.h" +#include "ipu7-buttress-regs.h" +#include "ipu7-cpd.h" +#include "ipu7-dma.h" +#include "ipu7-isys-csi2-regs.h" +#include "ipu7-mmu.h" +#include "ipu7-platform-regs.h" + +#define IPU_PCI_BAR 0 +#define IPU_PCI_PBBAR 4 + +static unsigned int ipu7_csi_offsets[] = { +IPU_CSI_PORT_A_ADDR_OFFSET , +IPU_CSI_PORT_B_ADDR_OFFSET , +IPU_CSI_PORT_C_ADDR_OFFSET , +IPU_CSI_PORT_D_ADDR_OFFSET , +}; + +static struct ipu_isys_internal_pdata ipu7p5_isys_ipdata = { + .csi2 = { + .gpreg =IS_IO_CSI2_GPREGS_BASE , + }, + .hw_variant = { + .offset =IPU_UNIFIED_OFFSET , + .nr_mmus =IPU7P5_IS_MMU_NUM , + .mmu_hw = { + { + .name ="IS_FW_RD" , + .offset =
IPU7P5_IS_MMU_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20005101, + .refill = 0x00002726, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7P5_IS_ZLX_UC_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +0 ,1 ,0 ,0 + }, + .zlx_conf = { + 0x0, + }, + .uao_p_num =
IPU7P5_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ .uao_p2tlb = { +0x00000049 , +0x0000004c , +0x0000004d , + 0x00000000, + }, + }, + { + .name ="IS_FW_WR" , + .offset =
IPU7P5_IS_MMU_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20005001, + .refill = 0x00002524, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7P5_IS_ZLX_UC_WR_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { + 0, 1, 1, 0, + }, + .zlx_conf = { +0x0 , +0x00010101 , +0x00010101 , + 0x0, + }, + .uao_p_num =
IPU7P5_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0+ .uao_p2tlb = { +0x00000049 , +0x0000004a , +0x0000004b , + 0x00000000, + }, + }, + { + .name ="IS_DATA_WR_ISOC" , + .offset = IPU7P5_IS_MMU_M0_OFFSET, + .zlx_offset =
IPU7P5_IS_ZLX_M0_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004e01, + .refill = 0x00002120, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_M0_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_IS_ZLX_M0_NUM , + .zlx_axi_pool = { + 0x00000f10, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , + 0x00010103, + }, + .uao_p_num =
IPU7P5_IS_UAO_M0_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0+ .uao_p2tlb = { +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , +0x00000044 , +0x00000041 , +0x00000042 , +0x00000043 , + 0x00000044, + }, + }, + { + .name ="IS_DATA_WR_SNOOP" , + .offset = IPU7P5_IS_MMU_M1_OFFSET, + .zlx_offset =
IPU7P5_IS_ZLX_M1_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_IS_UAO_M1_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004f01, + .refill = 0x00002322, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_IS_MMU_M1_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_IS_MMU_M1_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_IS_ZLX_M1_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , + 0x00010103, + }, + .uao_p_num =
IPU7P5_IS_UAO_M1_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0+ .uao_p2tlb = { + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + }, + }, + }, + .cdc_fifos = 3, + .cdc_fifo_threshold = {6, 8, 2}, + .dmem_offset = IPU_ISYS_DMEM_OFFSET, + .spc_offset = IPU_ISYS_SPC_OFFSET, + }, + .isys_dma_overshoot = IPU_ISYS_OVERALLOC_MIN, +}; + +static struct ipu_psys_internal_pdata ipu7p5_psys_ipdata = { + .hw_variant = { + .offset = IPU_UNIFIED_OFFSET, + .nr_mmus = IPU7P5_PS_MMU_NUM, + .mmu_hw = { + { + .name = "PS_FW_RD", + .offset =
IPU7P5_PS_MMU_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20004001, + .refill = 0x00002726, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0+ .l1_block_sz = { +0x00000000 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000d , +0x0000000f , +0x00000011 , +0x00000012 , +0x00000013 , +0x00000014 , +0x00000016 , +0x00000018 , +0x00000019 , +0x0000001a , +0x0000001a , + 0x0000001a, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , + 0x0000001e, + }, + .zlx_nr =IPU7P5_PS_ZLX_FW_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +0 ,1 ,0 ,0 ,1 ,1 ,0 ,0 , + 0, 1, 1, 0, 0, 0, 0, 0, + }, + .zlx_conf = { +0x00000000 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_FW_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +22
-0+ .uao_p2tlb = { +0x0000002e , +0x00000035 , +0x00000036 , +0x00000031 , +0x00000037 , +0x00000038 , +0x00000039 , +0x00000032 , +0x00000033 , +0x0000003a , +0x0000003b , +0x0000003c , +0x00000034 , +0x0 , +0x0 , + 0x0, + }, + }, + { + .name ="PS_FW_WR" , + .offset =
IPU7P5_PS_MMU_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003e01, + .refill = 0x00002322, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +30
-0+ .l1_block_sz = { +0x00000000 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000d , +0x0000000e , +0x0000000f , +0x00000010 , +0x00000010 , + 0x00000010, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , + 0x00000012, + }, + .zlx_nr =IPU7P5_PS_ZLX_FW_WR_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { + 0, 1, 1, 0, 0, 0, 0, 0, 0,0,
drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0+ }, + .zlx_conf = { +0x00000000 , +0x00010101 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_FW_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ .uao_p2tlb = { +0x0000002e , +0x0000002f , +0x00000030 , +0x00000031 , +0x00000032 , +0x00000033 , +0x00000034 , +0x0 , +0x0 , + 0x0, + }, + }, + { + .name ="PS_DATA_RD" , + .offset =
IPU7P5_PS_MMU_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_DATA_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003f01, + .refill = 0x00002524, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_SRT_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_SRT_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +82
-0+ .l1_block_sz = { +0x00000000 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000b , +0x0000000d , +0x0000000f , +0x00000013 , +0x00000017 , +0x00000019 , +0x0000001b , +0x0000001d , +0x0000001f , +0x0000002b , +0x00000033 , +0x0000003f , +0x00000047 , +0x00000049 , +0x0000004b , +0x0000004c , +0x0000004d , + 0x0000004e, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000004 , +0x00000006 , +0x00000008 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , +0x0000001e , +0x00000020 , +0x00000022 , +0x00000024 , +0x00000026 , +0x00000028 , + 0x0000002a, + }, + .zlx_nr =IPU7P5_PS_ZLX_DATA_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 0, 0, 0, 0, + }, + .zlx_conf = { +0x00030303 , +0x00010101 , +0x00010101 , +0x00030202 , +0x00010101 , +0x00010101 , +0x00030303 , +0x00030303 , +0x00010101 , +0x00030800 , +0x00030500 , +0x00020101 , +0x00042000 , +0x00031000 , +0x00042000 , +0x00031000 , +0x00020400 , +0x00010101 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_SRT_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +28
-0+ .uao_p2tlb = { +0x0000001c , +0x0000001d , +0x0000001e , +0x0000001f , +0x00000020 , +0x00000021 , +0x00000022 , +0x00000023 , +0x00000024 , +0x00000025 , +0x00000026 , +0x00000027 , +0x00000028 , +0x00000029 , +0x0000002a , +0x0000002b , +0x0000002c , +0x0000002d , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + }, + { + .name ="PS_DATA_WR" , + .offset =
IPU7P5_PS_MMU_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .zlx_offset =
IPU7P5_PS_ZLX_DATA_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7P5_PS_UAO_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ .info_bits = 0x20003d01, + .refill = 0x00002120, + .collapse_en_bitmap = 0x1, + .at_sp_arb_cfg = 0x1, + .l1_block =
IPU7P5_PS_MMU_SRT_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7P5_PS_MMU_SRT_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7P5_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7P5_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +113
-0+ .l1_block_sz = { +0x00000000 , +0x00000002 , +0x00000006 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , +0x0000001e , +0x00000020 , +0x00000022 , +0x00000024 , +0x00000028 , +0x0000002a , +0x00000036 , +0x0000003e , +0x00000040 , +0x00000042 , +0x0000004e , +0x00000056 , +0x0000005c , +0x00000068 , +0x00000070 , +0x00000076 , +0x00000077 , +0x00000078 , + 0x00000079, + }, + .l2_block_sz = { +0x00000000 , +0x00000002 , +0x00000006 , +0x0000000a , +0x0000000c , +0x0000000e , +0x00000010 , +0x00000012 , +0x00000014 , +0x00000016 , +0x00000018 , +0x0000001a , +0x0000001c , +0x0000001e , +0x00000020 , +0x00000022 , +0x00000024 , +0x00000028 , +0x0000002a , +0x00000036 , +0x0000003e , +0x00000040 , +0x00000042 , +0x0000004e , +0x00000056 , +0x0000005c , +0x00000068 , +0x00000070 , +0x00000076 , +0x00000077 , +0x00000078 , + 0x00000079, + }, + .zlx_nr =IPU7P5_PS_ZLX_DATA_WR_NUM , + .zlx_axi_pool = { + 0x00000f50, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , +0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 , +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 0, 0, 0, 0, + }, + .zlx_conf = { +0x00010102 , +0x00030103 , +0x00030103 , +0x00010101 , +0x00010101 , +0x00030101 , +0x00010101 , +0x38010101 , +0x00000000 , +0x00000000 , +0x38010101 , +0x38010101 , +0x38010101 , +0x38010101 , +0x38010101 , +0x38010101 , +0x00030303 , +0x00010101 , +0x00042000 , +0x00031000 , +0x00010101 , +0x00010101 , +0x00042000 , +0x00031000 , +0x00031000 , +0x00042000 , +0x00031000 , +0x00031000 , +0x00000000 , +0x00000000 , +0x00000000 , + 0x00000000, + }, + .uao_p_num =
IPU7P5_PS_UAO_SRT_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +52
-0+ .uao_p2tlb = { + 0x00000000, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0000000c, + 0x0000000d, + 0x0000000e, + 0x0000000f, + 0x00000010, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + }, + }, + }, + .dmem_offset = IPU_PSYS_DMEM_OFFSET, + }, +}; + +static struct ipu_isys_internal_pdata ipu7_isys_ipdata = { + .csi2 = { + .gpreg = IS_IO_CSI2_GPREGS_BASE, + }, + .hw_variant = { + .offset = IPU_UNIFIED_OFFSET, + .nr_mmus = IPU7_IS_MMU_NUM, + .mmu_hw = { + { + .name = "IS_FW_RD", + .offset = IPU7_IS_MMU_FW_RD_OFFSET, + .zlx_offset =
IPU7_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .info_bits = 0x20006701, + .refill = 0x00002726, + .collapse_en_bitmap = 0x0, + .l1_block =
IPU7_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7_IS_ZLX_UC_RD_NUM , + .zlx_axi_pool = { + 0x00000f30, + }, + .zlx_en = { +0 ,0 ,0 ,0 + }, + .zlx_conf = { + 0x0, 0x0, 0x0, 0x0, + }, + .uao_p_num =
IPU7_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ .uao_p2tlb = { +0x00000061 , +0x00000064 , + 0x00000065, + }, + }, + { + .name ="IS_FW_WR" , + .offset = IPU7_IS_MMU_FW_WR_OFFSET, + .zlx_offset =
IPU7_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .info_bits = 0x20006801, + .refill = 0x00002524, + .collapse_en_bitmap = 0x0, + .l1_block =
IPU7_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0+ .l1_block_sz = { + 0x0, 0x8, 0xa, + }, + .l2_block_sz = { + 0x0, 0x2, 0x4, + }, + .zlx_nr =IPU7_IS_ZLX_UC_WR_NUM , + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { + 0, 1, 1, 0, + }, + .zlx_conf = { +0x0 , +0x00010101 , + 0x00010101, + }, + .uao_p_num =
IPU7_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0+ .uao_p2tlb = { +0x00000061 , +0x00000062 , + 0x00000063, + }, + }, + { + .name ="IS_DATA_WR_ISOC" , + .offset = IPU7_IS_MMU_M0_OFFSET, + .zlx_offset = IPU7_IS_ZLX_M0_OFFSET, + .uao_offset =
IPU7_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .info_bits = 0x20006601, + .refill = 0x00002120, + .collapse_en_bitmap = 0x0, + .l1_block =
IPU7_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7_IS_MMU_M0_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0+ .l1_block_sz = { + 0x0, 0x3, 0x6, 0x8, 0xa,
0xc,0xe,0x10,drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ }, + .l2_block_sz = { + 0x0, 0x2, 0x4, 0x6, 0x8,
0xa,0xc,0xe,drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0+ }, + .zlx_nr = IPU7_IS_ZLX_M0_NUM, + .zlx_axi_pool = { + 0x00000f10, + }, + .zlx_en = { + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , + 0x00010101, + }, + .uao_p_num =
IPU7_IS_UAO_M0_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ .uao_p2tlb = { +0x00000049 , +0x0000004a , +0x0000004b , +0x0000004c , +0x0000004d , +0x0000004e , +0x0000004f , + 0x00000050, + }, + }, + { + .name ="IS_DATA_WR_SNOOP" , + .offset = IPU7_IS_MMU_M1_OFFSET, + .zlx_offset = IPU7_IS_ZLX_M1_OFFSET, + .uao_offset =
IPU7_IS_UAO_M1_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .info_bits = 0x20006901, + .refill = 0x00002322, + .collapse_en_bitmap = 0x0, + .l1_block =
IPU7_IS_MMU_M1_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7_IS_MMU_M1_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .l1_block_sz = { +0x0 ,0x3 ,0x6 ,0x9 ,0xc , +0xe ,0x10 ,0x12 ,0x14 ,0x16 , + 0x18, 0x1a, 0x1c, 0x1e,
0x20,drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0+ 0x22, + }, + .l2_block_sz = { +0x0 ,0x2 ,0x4 ,0x6 ,0x8 , +0xa ,0xc ,0xe ,0x10 ,0x12 , + 0x14, 0x16, 0x18, 0x1a,
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +29
-0+ 0x1e, + }, + .zlx_nr = IPU7_IS_ZLX_M1_NUM, + .zlx_axi_pool = { + 0x00000f20, + }, + .zlx_en = { +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , + 1, 1, 1, 1, 1, 1, 1, 1, + }, + .zlx_conf = { +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010103 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , +0x00010101 , + 0x00010101, + }, + .uao_p_num =
IPU7_IS_UAO_M1_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0+ .uao_p2tlb = { + 0x00000051, + 0x00000052, + 0x00000053, + 0x00000054, + 0x00000055, + 0x00000056, + 0x00000057, + 0x00000058, + 0x00000059, + 0x0000005a, + 0x0000005b, + 0x0000005c, + 0x0000005d, + 0x0000005e, + 0x0000005f, + 0x00000060, + }, + }, + }, + .cdc_fifos = 3, + .cdc_fifo_threshold = {6, 8, 2}, + .dmem_offset = IPU_ISYS_DMEM_OFFSET, + .spc_offset = IPU_ISYS_SPC_OFFSET, + }, + .isys_dma_overshoot = IPU_ISYS_OVERALLOC_MIN, +}; + +static struct ipu_psys_internal_pdata ipu7_psys_ipdata = { + .hw_variant = { + .offset = IPU_UNIFIED_OFFSET, + .nr_mmus = IPU7_PS_MMU_NUM, + .mmu_hw = { + { + .name = "PS_FW_RD", + .offset = IPU7_PS_MMU_FW_RD_OFFSET, + .zlx_offset =
IPU7_PS_ZLX_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .uao_offset =
IPU7_PS_UAO_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .info_bits = 0x20004801, + .refill = 0x00002726, + .collapse_en_bitmap = 0x0, + .l1_block =
IPU7_PS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .l2_block =
IPU7_PS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l1streams =
IPU7_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ .nr_l2streams =
IPU7_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ .l1_block_sz = { +0 ,0x8 ,0xa ,0xc ,0xd , +0xf ,0x11 ,0x12 ,0x13 ,0x14 , + 0x16, 0x18, 0x19, 0x1a,
0x1a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ 0x1a, 0x1a, 0x1a, 0x1a,
0x1a,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ }, + .l2_block_sz = { +0x0 ,0x2 ,0x4 ,0x6 ,0x8 , +0xa ,0xc ,0xe ,0x10 ,0x12 , + 0x14, 0x16, 0x18, 0x1a,
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ 0x1e, 0x20, 0x22, 0x24,
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ }, + .zlx_nr = IPU7_PS_ZLX_FW_RD_NUM,Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +22
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_FW_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_DATA_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3f,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x46,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4b,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x50,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x57,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x61,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x30,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x44,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4e,drivers/media/pci/intel/ipu7/ipu7.c new file +30
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +18
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,0x0,0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,0x0,0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_ZLX_DATA_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x20,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x58,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x86,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x90,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x98,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x1c,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x26,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x30,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x3a,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x44,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x4e,drivers/media/pci/intel/ipu7/ipu7.c new file +46
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU7_PS_UAO_SRT_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0x0,drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_ZLX_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +11
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_ZLX_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UC_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_M0_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M0_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M0_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M0_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_M0_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +24
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_M1_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M1_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M1_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_M1_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +63
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_M1_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_ZLX_UPIPE_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UPIPE_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_UPIPE_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_UPIPE_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_UPIPE_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_MMU_UPIPE_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_IS_UAO_UPIPE_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +27
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_ZLX_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_FW_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +51
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_FW_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_ZLX_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_FW_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_FW_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_FW_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +15
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_ZLX_DATA_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_SRT_RD_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_RD_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_RD_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_RD_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +76
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_SRT_RD_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +33
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_ZLX_DATA_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_SRT_WR_OFFSET,drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_WR_L1_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_WR_L2_BLOCKNR_REG,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_MMU_SRT_WR_STREAM_NUM,drivers/media/pci/intel/ipu7/ipu7.c new file +95
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU8_PS_UAO_SRT_WR_PLANENUM,drivers/media/pci/intel/ipu7/ipu7.c new file +92
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*isys_ipdata,drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*psys_ipdata)drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*fwnode)
drivers/media/pci/intel/ipu7/ipu7.c new file +18
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*base,
drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
connection\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
ctrl,
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +20
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*base,
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unsigned int nr)
drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
ctrl,
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +21
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU_IS) ?drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
:
drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
ret);
drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
size,
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
0);
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
attr);
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
DMA_BIDIRECTIONAL, 0);drivers/media/pci/intel/ipu7/ipu7.c new file +26
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*sys,
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Quoted 1 line
fw_entry);drivers/media/pci/intel/ipu7/ipu7.c new file +23
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
%s.\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
pci_device_id*id)drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
NULL;
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
BIT(IPU_PCI_PBBAR),drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
(%d)\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
pcim_iomap_table()andpcim_iomap_regions()have been deprecated last year. That's also documented in those functions' docstrings. Please don't use them anymore.You can achieve all you need with the simpler
pcim_iomap_region()drivers/media/pci/intel/ipu7/ipu7.c
Quoted 207 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
table\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
%p\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +41
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
DMA_BIT_MASK(dma_mask));drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
mask\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
hardware\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Quoted 1 line
data,
drivers/media/pci/intel/ipu7/ipu7.c new file +31
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Quoted 1 line
mmu))
drivers/media/pci/intel/ipu7/ipu7.c new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Quoted 1 line
mmu))
drivers/media/pci/intel/ipu7/ipu7.c new file +29
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
You don't need this if you request with a
pcim_function. The 'm' stands for "managed". Those are devres functions that will clean up automatically ifprobe()fails or onceremove()is invoked.Furthermore, you should not mix
pcim_andpci_functions; at least not those.And even if the
pcim_functions wouldn't do a cleanup, you would leak the IO mappings above, sincepci_release_regions()just removes the region requests, but not the mapping cookies.
Quoted 6 lines
I recommend taking a look to the PCI subystem's documentation.
drivers/media/pci/intel/ipu7/ipu7.c
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
You also don't need this since you used
pcim_enable_device(), which will disable the device automatically on driver-detach.
Philipp,
Thanks for the review, I also found your talk at FOSDEM, I will cleanup these APIs.
Quoted 408 lines
P.
Quoted 402 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +87
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
failed!\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
suspend flow */
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0Lines of this file are not shown. View the raw message.
drivers/media/pci/intel/ipu7/ipu7.h new file +59
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
one line
+ * but it must be at minimum 1024 bytes. Value could be different in
+ * different versions / generations thus provide it via platform data.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +7
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
80MB */
drivers/media/pci/intel/ipu7/ipu7.h new file +26
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
IPU_PSYS_OPEN_CLOSE_TIMEOUT_US)drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*/
drivers/media/pci/intel/ipu7/ipu7.h new file +17
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
15 lines not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
5 lines not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +22
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +83
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1 line not shown · raw message
drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
2 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
In reply to Philipp StannerQuoted 40 lines · Philipp Stanner
Hi,
see below
Quoted 35 lines · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing systems
and the hardware presents itself as a single PCI device in system same
as IPU6.The IPU7 PCI device driver basically does PCI configurations, basic hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the ISYS
device driver.Signed-off-by Bingbu Cao <[email protected]>--- drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 + .../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 + .../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7.h | 244 ++ 8 files changed, 5144 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7.h
---snip---
Quoted 60 lines
Quoted 52 lines
+static int
ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)(quoted diff) +2
-0+{ + struct ipu_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl =NULL;
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev); +const struct ipu_buttress_ctrl *isys_buttress_ctrl; +const struct ipu_buttress_ctrl *psys_buttress_ctrl; +struct ipu_isys_internal_pdata *isys_ipdata; +struct ipu_psys_internal_pdata *psys_ipdata; +unsigned int dma_mask =IPU_DMA_MASK ; +struct device *dev = &pdev->dev; +void __iomem *isys_base =NULL ; +void __iomem *psys_base =NULL ; +void __iomem *const *iomap; +phys_addr_t phys, pb_phys; +struct ipu7_device *isp; +u32 is_es; +int ret; + + if (!fwnode || fwnode_property_read_u32(fwnode, "is_es",
&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ is_es =0 ; + + isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL ); +if (!isp) +return -ENOMEM ; + +dev_set_name (dev,"intel-ipu7" ); + isp->pdev = pdev; +INIT_LIST_HEAD (&isp->devices); + + ret =pcim_enable_device (pdev); +if (ret) + return dev_err_probe(dev, ret, "Enable PCI devicefailed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +dev_info (dev,"Device 0x%x (rev: 0x%x)\n" , + pdev->device, pdev->revision); + + phys =pci_resource_start (pdev,IPU_PCI_BAR ); + pb_phys =pci_resource_start (pdev,IPU_PCI_PBBAR ); +dev_info (dev,"IPU7 PCI BAR0 base %llx BAR2 base %llx\n" , + phys, pb_phys); + + ret = pcim_iomap_regions(pdev, BIT(IPU_PCI_BAR) |
BIT(IPU_PCI_PBBAR),drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ pci_name(pdev)); +if (ret) + return dev_err_probe(dev, ret, + "Failed to I/O memory remapping(%d)\n",
drivers/media/pci/intel/ipu7/ipu7.c line 2462
Quoted 3 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ ret); + + iomap =pcim_iomap_table (pdev);
pcim_iomap_table()andpcim_iomap_regions()have been deprecated last year. That's also documented in those functions' docstrings. Please don't use them anymore.
Quoted 1 line
You can achieve all you need with the simpler
pcim_iomap_region()
Philipp,
I see that pcim_iomap_regions() and pcim_add_mapping_to_legacy_table() have simple 'bar' checking, how does pcim_iomap_region() check that?
Quoted 634 lines
Quoted 199 lines
(quoted diff) +2
-0+ if (!iomap) + return dev_err_probe(dev, -ENODEV, "Failed to iomaptable\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ + isp->base = iomap[IPU_PCI_BAR ]; + isp->pb_base = iomap[IPU_PCI_PBBAR ]; + dev_info(dev, "IPU7 PCI BAR0 mapped at %p\n BAR2 mapped at%p\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +41
-0+ isp->base, isp->pb_base); + +pci_set_drvdata (pdev, isp); +pci_set_master (pdev); + +switch (id->device) { +case IPU7_PCI_ID : + isp->hw_ver =IPU_VER_7 ; + isp->cpd_fw_name =IPU7_FIRMWARE_NAME ; + isys_ipdata = &ipu7_isys_ipdata; + psys_ipdata = &ipu7_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU7P5_PCI_ID : + isp->hw_ver =IPU_VER_7P5 ; + isp->cpd_fw_name =IPU7P5_FIRMWARE_NAME ; + isys_ipdata = &ipu7p5_isys_ipdata; + psys_ipdata = &ipu7p5_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU8_PCI_ID : + isp->hw_ver =IPU_VER_8 ; + isp->cpd_fw_name =IPU8_FIRMWARE_NAME ; + isys_ipdata = &ipu8_isys_ipdata; + psys_ipdata = &ipu8_psys_ipdata; + isys_buttress_ctrl = &ipu8_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu8_psys_buttress_ctrl; +break ; +default : +WARN (1 ,"Unsupported IPU device" ); +return -ENODEV ; + } + +ipu_internal_pdata_init (isys_ipdata, psys_ipdata); + + isys_base = isp->base + isys_ipdata->hw_variant.offset; + psys_base = isp->base + psys_ipdata->hw_variant.offset; + + ret = dma_set_mask_and_coherent(dev,
DMA_BIT_MASK(dma_mask));(quoted diff) +2
-0+ if (ret) + return dev_err_probe(dev, ret, "Failed to set DMAmask\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +17
-0+ +dma_set_max_seg_size (dev,UINT_MAX ); + + ret =ipu7_pci_config_setup (pdev); +if (ret) +return ret; + + ret =ipu_buttress_init (isp); +if (ret) +return ret; + +dev_info (dev,"firmware cpd file: %s\n" , isp->cpd_fw_name); + + ret =request_firmware (&isp->cpd_fw, isp->cpd_fw_name, dev); +if (ret) { + dev_err_probe(dev, ret, + "Requesting signed firmware %sfailed\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ isp->cpd_fw_name); + goto buttress_exit; + } + + ret =ipu7_cpd_validate_cpd_file (isp, isp->cpd_fw->data, + isp->cpd_fw->size); +if (ret) { +dev_err_probe (dev, ret,"Failed to validate cpd\n" ); + goto out_ipu_bus_del_devices; + } + + isys_ctrl = devm_kmemdup(dev, isys_buttress_ctrl, + sizeof(*isys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +14
-0+if (!isys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->isys =ipu7_isys_init (pdev, dev, isys_ctrl, isys_base, + isys_ipdata,0 ); +if (IS_ERR (isp->isys)) { + ret =PTR_ERR (isp->isys); + goto out_ipu_bus_del_devices; + } + + psys_ctrl = devm_kmemdup(dev, psys_buttress_ctrl, + sizeof(*psys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +36
-0+if (!psys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->psys =ipu7_psys_init (pdev, &isp->isys->auxdev.dev, + psys_ctrl, psys_base, + psys_ipdata,0 ); +if (IS_ERR (isp->psys)) { + ret =PTR_ERR (isp->psys); + goto out_ipu_bus_del_devices; + } + + ret =devm_request_threaded_irq (dev, pdev->irq, + ipu_buttress_isr, + ipu_buttress_isr_threaded, +IRQF_SHARED ,IPU_NAME , isp); +if (ret) + goto out_ipu_bus_del_devices; + +if (!isp->secure_mode) { + ret =ipu7_init_fw_code_region (isp); +if (ret) + goto out_ipu_bus_del_devices; + }else { + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +dev_err (&isp->psys->auxdev.dev, +"Failed to get runtime PM\n" ); + goto out_ipu_bus_del_devices; + } + + ret =ipu7_mmu_hw_init (isp->psys->mmu); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "Failed to init MMUhardware\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ goto out_ipu_bus_del_devices; + } + + ret = ipu7_map_fw_code_region(isp->psys, + (void *)isp->cpd_fw-Quoted 1 line
data,
drivers/media/pci/intel/ipu7/ipu7.c new file +31
-0+ isp->cpd_fw->size); +if (ret) { +dev_err_probe (&isp->pdev->dev, ret, +"failed to map fw image\n" ); + goto out_ipu_bus_del_devices; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) { +dev_err_probe (&isp->pdev->dev, ret, +"FW authentication failed\n" ); + goto out_ipu_bus_del_devices; + } + +ipu7_mmu_hw_cleanup (isp->psys->mmu); +pm_runtime_put (&isp->psys->auxdev.dev); + } + +pm_runtime_put_noidle (dev); +pm_runtime_allow (dev); + + isp->ipu7_bus_ready_to_probe = true; + +return 0 ; + +out_ipu_bus_del_devices: +if (!IS_ERR_OR_NULL (isp->isys) && isp->isys->fw_sgt.nents) +ipu7_unmap_fw_code_region (isp->isys); +if (!IS_ERR_OR_NULL (isp->psys) && isp->psys->fw_sgt.nents) +ipu7_unmap_fw_code_region (isp->psys); + if (!IS_ERR_OR_NULL(isp->psys) && !IS_ERR_OR_NULL(isp->psys-Quoted 1 line
mmu))
(quoted diff) +2
-0+ ipu7_mmu_cleanup(isp->psys->mmu); + if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp->isys-Quoted 1 line
mmu))
drivers/media/pci/intel/ipu7/ipu7.c new file +19
-0+ipu7_mmu_cleanup (isp->isys->mmu); +if (!IS_ERR_OR_NULL (isp->psys)) +pm_runtime_put (&isp->psys->auxdev.dev); +ipu7_bus_del_devices (pdev); +release_firmware (isp->cpd_fw); +buttress_exit: +ipu_buttress_exit (isp); + +return ret; +} + +static void ipu7_pci_remove (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +if (!IS_ERR_OR_NULL (isp->isys) && isp->isys->fw_sgt.nents) +ipu7_unmap_fw_code_region (isp->isys); +if (!IS_ERR_OR_NULL (isp->psys) && isp->psys->fw_sgt.nents) +ipu7_unmap_fw_code_region (isp->psys);drivers/media/pci/intel/ipu7/ipu7.c line 2658
Quoted 10 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +if (!IS_ERR_OR_NULL (isp->fw_code_region)) +vfree (isp->fw_code_region); + +ipu7_bus_del_devices (pdev); + +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_noresume (&pdev->dev); + +pci_release_regions (pdev);You don't need this if you request with a
pcim_function. The 'm' stands for "managed". Those are devres functions that will clean up automatically ifprobe()fails or onceremove()is invoked.Furthermore, you should not mix
pcim_andpci_functions; at least not those.And even if the
pcim_functions wouldn't do a cleanup, you would leak the IO mappings above, sincepci_release_regions()just removes the region requests, but not the mapping cookies.I recommend taking a look to the PCI subystem's documentation.
drivers/media/pci/intel/ipu7/ipu7.c line 2659
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+pci_disable_device (pdev);You also don't need this since you used
pcim_enable_device(), which will disable the device automatically on driver-detach.P.
Quoted 402 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +87
-0+ +ipu_buttress_exit (isp); + +release_firmware (isp->cpd_fw); + +ipu7_mmu_cleanup (isp->psys->mmu); +ipu7_mmu_cleanup (isp->isys->mmu); +} + +static void ipu7_pci_reset_prepare (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +dev_warn (&pdev->dev,"FLR prepare\n" ); +pm_runtime_forbid (&isp->pdev->dev); +} + +static void ipu7_pci_reset_done (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +ipu_buttress_restore (isp); +if (isp->secure_mode) +ipu_buttress_reset_authentication (isp); + + isp->ipc_reinit = true; +pm_runtime_allow (&isp->pdev->dev); + +dev_warn (&pdev->dev,"FLR completed\n" ); +} + +/* +* PCI base driver code requires driver to provide these to enable +* PCI device level PM state transitions (D0<->D3) +*/ +static int ipu7_suspend (struct device *dev) +{ +return 0 ; +} + +static int ipu7_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu_buttress *b = &isp->buttress; +int ret; + + isp->secure_mode =ipu_buttress_get_secure_mode (isp); +dev_info (dev,"IPU7 in %s mode\n" , + isp->secure_mode ?"secure" :"non-secure" ); + +ipu_buttress_restore (isp); + + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) +dev_err (dev,"IPC reset protocol failed!\n" ); + + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +dev_err (dev,"Failed to get runtime PM\n" ); +return 0 ; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) +dev_err (dev,"FW authentication failed(%d)\n" , ret); + +pm_runtime_put (&isp->psys->auxdev.dev); + +return 0 ; +} + +static int ipu7_runtime_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + +ipu_buttress_restore (isp); + +if (isp->ipc_reinit) { +struct ipu_buttress *b = &isp->buttress; + + isp->ipc_reinit = false; + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) + dev_err(dev, "IPC reset protocolfailed!\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ } + +return 0 ; +} + +static const struct dev_pm_ops ipu7_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(&ipu7_suspend, &ipu7_resume) + SET_RUNTIME_PM_OPS(&ipu7_suspend, /* Same as insuspend flow */
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0+ &ipu7_runtime_resume, + NULL) +}; + +static const struct pci_device_id ipu7_pci_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7P5_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU8_PCI_ID )}, + {0 ,} +}; +MODULE_DEVICE_TABLE (pci, ipu7_pci_tbl); + +static const struct pci_error_handlers pci_err_handlers = { + .reset_prepare = ipu7_pci_reset_prepare, + .reset_done = ipu7_pci_reset_done, +}; + +static struct pci_driver ipu7_pci_driver = { + .name =IPU_NAME , + .id_table = ipu7_pci_tbl, + .probe = ipu7_pci_probe, + .remove = ipu7_pci_remove, + .driver = { + .pm = &ipu7_pm_ops, + }, + .err_handler = &pci_err_handlers, +}; + +module_pci_driver (ipu7_pci_driver); + +MODULE_IMPORT_NS ("INTEL_IPU_BRIDGE" ); +MODULE_AUTHOR ("Bingbu Cao <[email protected]>" ); +MODULE_AUTHOR ("Tianshu Qiu <[email protected]>" ); +MODULE_AUTHOR ("Qingwu Zhang <[email protected]>" ); +MODULE_AUTHOR ("Intel" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Intel ipu7 pci driver" );drivers/media/pci/intel/ipu7/ipu7.h new file +59
-0@@ -0,0 +1,244 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_H +#define IPU7_H + +#include <linux/list.h> +#include <linux/pci.h> +#include <linux/types.h> + +#include "ipu7-buttress.h" + +struct ipu7_bus_device ; +struct pci_dev ; +struct firmware ; + +#define IPU_NAME "intel-ipu7" +#define IPU_MEDIA_DEV_MODEL_NAME "ipu7" + +#define IPU7_FIRMWARE_NAME "intel/ipu/ipu7_fw.bin" +#define IPU7P5_FIRMWARE_NAME "intel/ipu/ipu7ptl_fw.bin" +#define IPU8_FIRMWARE_NAME "intel/ipu/ipu8_fw.bin" + +#define IPU7_ISYS_NUM_STREAMS 12 + +#define IPU7_PCI_ID 0x645d +#define IPU7P5_PCI_ID 0xb05d +#define IPU8_PCI_ID 0xd719 + +#define FW_LOG_BUF_SIZE (2 * 1024 * 1024) + +enum ipu_version { +IPU_VER_INVALID =0 , +IPU_VER_7 =1 , +IPU_VER_7P5 =2 , +IPU_VER_8 =3 , +}; + +static inline bool is_ipu7p5 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7P5 ; +} + +static inline bool is_ipu7 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7 ; +} + +static inline bool is_ipu8 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_8 ; +} + +#define IPU_UNIFIED_OFFSET 0 + +/* +* ISYS DMA can overshoot. For higher resolutions over allocation is one line
+ * but it must be at minimum 1024 bytes. Value could be different in
+ * different versions / generations thus provide it via platform data.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +7
-0+#define IPU_ISYS_OVERALLOC_MIN 1024 + +#define IPU_FW_CODE_REGION_SIZE 0x1000000/* 16MB */ +#define IPU_FW_CODE_REGION_START 0x4000000/* 64MB */ +#define IPU_FW_CODE_REGION_END (IPU_FW_CODE_REGION_START + \ + IPU_FW_CODE_REGION_SIZE) /*80MB */
drivers/media/pci/intel/ipu7/ipu7.h new file +26
-0+ +struct ipu7_device { +struct pci_dev *pdev; +struct list_head devices; +struct ipu7_bus_device *isys; +struct ipu7_bus_device *psys; +struct ipu_buttress buttress; + +const struct firmware *cpd_fw; +const char *cpd_fw_name; +/* Only for non-secure mode. */ +void *fw_code_region; + +void __iomem *base; +void __iomem *pb_base; +u8 hw_ver; +bool ipc_reinit; +bool secure_mode; +bool ipu7_bus_ready_to_probe; +}; + +#define IPU_DMA_MASK 39 +#define IPU_LIB_CALL_TIMEOUT_MS 2000 +#define IPU_PSYS_CMD_TIMEOUT_MS 2000 +#define IPU_PSYS_OPEN_CLOSE_TIMEOUT_US 50 +#define IPU_PSYS_OPEN_CLOSE_RETRY (10000 /
IPU_PSYS_OPEN_CLOSE_TIMEOUT_US)drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0+ +#define IPU_ISYS_NAME "isys" +#define IPU_PSYS_NAME "psys" + +#define IPU_MMU_ADDR_BITS 32 +/* FW is accessible within the first 2 GiB only in non-secure mode. */
drivers/media/pci/intel/ipu7/ipu7.h new file +17
-0+#define IPU_MMU_ADDR_BITS_NON_SECURE 31 + +#define IPU7_IS_MMU_NUM 4 +#define IPU7_PS_MMU_NUM 4 +#define IPU7P5_IS_MMU_NUM 4 +#define IPU7P5_PS_MMU_NUM 4 +#define IPU8_IS_MMU_NUM 5 +#define IPU8_PS_MMU_NUM 4 +#define IPU_MMU_MAX_NUM 5/* max(IS, PS) */ +#define IPU_MMU_MAX_TLB_L1_STREAMS 40 +#define IPU_MMU_MAX_TLB_L2_STREAMS 40 +#define IPU_ZLX_MAX_NUM 32 +#define IPU_ZLX_POOL_NUM 8 +#define IPU_UAO_PLANE_MAX_NUM 64 + +/* +* To maximize the IOSF utlization, IPU need to send requests in bursts.
+ * At the DMA interface with the buttress, there are CDC FIFOs with burst
+ * collection capability. CDC FIFO burst collectors have a configurable
+ * threshold and is configured based on the outcome of performance measurements.
+ *
+ * isys has 3 ports with IOSF interface for VC0, VC1 and VC2
+ * psys has 4 ports with IOSF interface for VC0, VC1w, VC1r and VC2
+ *
+ * Threshold values are pre-defined and are arrived at after performance
+ * evaluations on a type of IPU
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +4
-0+#define IPU_MAX_VC_IOSF_PORTS 4 + +/* +* IPU must configure correct arbitration mechanism related to the IOSF VC
+ * requests. There are two options per VC0 and VC1 - > 0 means rearbitrate on
+ * stall and 1 means stall until the request is completed.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +22
-0+#define IPU_BTRS_ARB_MODE_TYPE_REARB 0 +#define IPU_BTRS_ARB_MODE_TYPE_STALL 1 + +/* Currently chosen arbitration mechanism for VC0 */ +#define IPU_BTRS_ARB_STALL_MODE_VC0 IPU_BTRS_ARB_MODE_TYPE_REARB + +/* Currently chosen arbitration mechanism for VC1 */ +#define IPU_BTRS_ARB_STALL_MODE_VC1 IPU_BTRS_ARB_MODE_TYPE_REARB + +struct ipu7_isys_subdev_pdata ; + +/* One L2 entry maps 1024 L1 entries and one L1 entry per page */ +#define IPU_MMUV2_L2_RANGE (1024 * PAGE_SIZE) +/* Max L2 blocks per stream */ +#define IPU_MMUV2_MAX_L2_BLOCKS 2 +/* Max L1 blocks per stream */ +#define IPU_MMUV2_MAX_L1_BLOCKS 16 +#define IPU_MMUV2_TRASH_RANGE (IPU_MMUV2_L2_RANGE * \ + IPU_MMUV2_MAX_L2_BLOCKS) +/* Entries per L1 block */ +#define MMUV2_ENTRIES_PER_L1_BLOCK 16 +#define MMUV2_TRASH_L1_BLOCK_OFFSET (MMUV2_ENTRIES_PER_L1_BLOCK*
PAGE_SIZE)drivers/media/pci/intel/ipu7/ipu7.h new file +83
-0+#define MMUV2_TRASH_L2_BLOCK_OFFSET IPU_MMUV2_L2_RANGE + +struct ipu7_mmu_hw { +char name[32 ]; + +void __iomem *base; +void __iomem *zlx_base; +void __iomem *uao_base; + +u32 offset; +u32 zlx_offset; +u32 uao_offset; + +u32 info_bits; +u32 refill; +u32 collapse_en_bitmap; +u32 at_sp_arb_cfg; + +u32 l1_block; +u32 l2_block; + +u8 nr_l1streams; +u8 nr_l2streams; +u32 l1_block_sz[IPU_MMU_MAX_TLB_L1_STREAMS ]; +u32 l2_block_sz[IPU_MMU_MAX_TLB_L2_STREAMS ]; + +u8 zlx_nr; +u32 zlx_axi_pool[IPU_ZLX_POOL_NUM ]; +u32 zlx_en[IPU_ZLX_MAX_NUM ]; +u32 zlx_conf[IPU_ZLX_MAX_NUM ]; + +u32 uao_p_num; +u32 uao_p2tlb[IPU_UAO_PLANE_MAX_NUM ]; +}; + +struct ipu7_mmu_pdata { +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +int mmid; +}; + +struct ipu7_isys_csi2_pdata { +void __iomem *base; +}; + +struct ipu7_isys_internal_csi2_pdata { +u32 nports; +u32 *offsets; +u32 gpreg; +}; + +struct ipu7_hw_variants { +unsigned long offset; +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +u8 cdc_fifos; +u8 cdc_fifo_threshold[IPU_MAX_VC_IOSF_PORTS ]; +u32 dmem_offset; +u32 spc_offset;/* SPC offset from psys base */ +}; + +struct ipu_isys_internal_pdata { +struct ipu7_isys_internal_csi2_pdata csi2; +struct ipu7_hw_variants hw_variant; +u32 num_parallel_streams; +u32 isys_dma_overshoot; +}; + +struct ipu7_isys_pdata { +void __iomem *base; +const struct ipu_isys_internal_pdata *ipdata; +}; + +struct ipu_psys_internal_pdata { +struct ipu7_hw_variants hw_variant; +}; + +struct ipu7_psys_pdata { +void __iomem *base; +const struct ipu_psys_internal_pdata *ipdata; +}; + +int request_cpd_fw(const struct firmware **firmware_p, const char*name,
drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+ struct device *device); +void ipu_internal_pdata_init(struct ipu_isys_internal_pdata
*isys_ipdata,drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0+struct ipu_psys_internal_pdata
*psys_ipdata);drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+void ipu7_dump_fw_error_log (const struct ipu7_bus_device *adev); +#endif /* IPU7_H */
Signature · 2 lines
Best regards, Bingbu Cao
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
+Cc Bjorn, PCI
Quoted 114 lines · Bingbu Cao
Quoted 44 lines · Philipp Stanner
Hi,
see below
Quoted 39 lines · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing systems
and the hardware presents itself as a single PCI device in system same
as IPU6.The IPU7 PCI device driver basically does PCI configurations, basic
hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the
ISYS
device driver.Signed-off-by Bingbu Cao <[email protected]>---
drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 +.../media/pci/intel/ipu7/ipu7-buttress-regs.h| 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 +.../media/pci/intel/ipu7/ipu7-platform-regs.h| 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791
+++++++++++++++++
drivers/media/pci/intel/ipu7/ipu7.h | 244 ++8 files changed, 5144 insertions(+)create mode 100644
drivers/media/pci/intel/ipu7/ipu7-bus.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7-bus.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h
create mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-platform-regs.h
create mode 100644drivers/media/pci/intel/ipu7/ipu7.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7.h---snip---
Quoted 64 lines
Quoted 55 lines
+static int
ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)(quoted diff) +2
-0+{ + struct ipu_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl =NULL;
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev); +const struct ipu_buttress_ctrl *isys_buttress_ctrl; +const struct ipu_buttress_ctrl *psys_buttress_ctrl; +struct ipu_isys_internal_pdata *isys_ipdata; +struct ipu_psys_internal_pdata *psys_ipdata; +unsigned int dma_mask =IPU_DMA_MASK ; +struct device *dev = &pdev->dev; +void __iomem *isys_base =NULL ; +void __iomem *psys_base =NULL ; +void __iomem *const *iomap; +phys_addr_t phys, pb_phys; +struct ipu7_device *isp; +u32 is_es; +int ret; + + if (!fwnode || fwnode_property_read_u32(fwnode, "is_es",
&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ is_es =0 ; + + isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL ); +if (!isp) +return -ENOMEM ; + +dev_set_name (dev,"intel-ipu7" ); + isp->pdev = pdev; +INIT_LIST_HEAD (&isp->devices); + + ret =pcim_enable_device (pdev); +if (ret) + return dev_err_probe(dev, ret, "Enable PCIdevice
failed\n");drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0+ +dev_info (dev,"Device 0x%x (rev: 0x%x)\n" , + pdev->device, pdev->revision); + + phys =pci_resource_start (pdev,IPU_PCI_BAR ); + pb_phys =pci_resource_start (pdev,IPU_PCI_PBBAR ); + dev_info(dev, "IPU7 PCI BAR0 base %llx BAR2 base%llx\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ phys, pb_phys); + + ret = pcim_iomap_regions(pdev, BIT(IPU_PCI_BAR) |
BIT(IPU_PCI_PBBAR),drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ pci_name(pdev)); +if (ret) + return dev_err_probe(dev, ret, + "Failed to I/O memoryremapping
(%d)\n",drivers/media/pci/intel/ipu7/ipu7.c line 2462
Quoted 3 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ ret); + + iomap =pcim_iomap_table (pdev);
pcim_iomap_table()andpcim_iomap_regions()have been deprecated last
year. That's also documented in those functions' docstrings. Please don't use them anymore.
Quoted 7 lines
Quoted 1 line
You can achieve all you need with the simpler
pcim_iomap_region()Philipp,
I see that
pcim_iomap_regions()andpcim_add_mapping_to_legacy_table()
have simple 'bar' checking, how doespcim_iomap_region()check that?
You mean the BAR index range check I suppose.
That's a good question. It seems to me that the ultimately used pci_resource_start() will just overflow the device's array and you get UB – again.
He.
Damn.
We might wanna fix that. But we can ask ourselves: where. At the lowest point in those PCI region accessor macros which then bubble an EINVAL or similar upwards, or at the higher point, as in pcim_iomap_region().
This seems a PCI-wide problem. It seems to me that pci_iomap() & partners are also not safeguarded against overflowing.
Bjorn, shall we solve that? How? do you have a preference?
P.
PS: That is actually embarrassing since I complained in my talk about pcim_iomap_table() having no possibility for bounds checking. Ah, let's hope no one will notice that I said that ^_^
Quoted 680 lines
Quoted 679 lines
Quoted 220 lines
(quoted diff) +2
-0+ if (!iomap) + return dev_err_probe(dev, -ENODEV, "Failed toiomap
table\n");drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ + isp->base = iomap[IPU_PCI_BAR ]; + isp->pb_base = iomap[IPU_PCI_PBBAR ]; + dev_info(dev, "IPU7 PCI BAR0 mapped at %p\n BAR2 mappedat
%p\n",drivers/media/pci/intel/ipu7/ipu7.c new file +41
-0+ isp->base, isp->pb_base); + +pci_set_drvdata (pdev, isp); +pci_set_master (pdev); + +switch (id->device) { +case IPU7_PCI_ID : + isp->hw_ver =IPU_VER_7 ; + isp->cpd_fw_name =IPU7_FIRMWARE_NAME ; + isys_ipdata = &ipu7_isys_ipdata; + psys_ipdata = &ipu7_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU7P5_PCI_ID : + isp->hw_ver =IPU_VER_7P5 ; + isp->cpd_fw_name =IPU7P5_FIRMWARE_NAME ; + isys_ipdata = &ipu7p5_isys_ipdata; + psys_ipdata = &ipu7p5_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU8_PCI_ID : + isp->hw_ver =IPU_VER_8 ; + isp->cpd_fw_name =IPU8_FIRMWARE_NAME ; + isys_ipdata = &ipu8_isys_ipdata; + psys_ipdata = &ipu8_psys_ipdata; + isys_buttress_ctrl = &ipu8_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu8_psys_buttress_ctrl; +break ; +default : +WARN (1 ,"Unsupported IPU device" ); +return -ENODEV ; + } + +ipu_internal_pdata_init (isys_ipdata, psys_ipdata); + + isys_base = isp->base + isys_ipdata->hw_variant.offset; + psys_base = isp->base + psys_ipdata->hw_variant.offset; + + ret = dma_set_mask_and_coherent(dev,
DMA_BIT_MASK(dma_mask));(quoted diff) +2
-0+ if (ret) + return dev_err_probe(dev, ret, "Failed to setDMA
mask\n");drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0+ +dma_set_max_seg_size (dev,UINT_MAX ); + + ret =ipu7_pci_config_setup (pdev); +if (ret) +return ret; + + ret =ipu_buttress_init (isp); +if (ret) +return ret; + + dev_info(dev, "firmware cpd file: %s\n", isp-Quoted 1 line
cpd_fw_name);(quoted diff) +2
-0+ + ret = request_firmware(&isp->cpd_fw, isp->cpd_fw_name,dev);
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) { + dev_err_probe(dev, ret, + "Requesting signed firmware %sfailed\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ isp->cpd_fw_name); + goto buttress_exit; + } + + ret =ipu7_cpd_validate_cpd_file (isp, isp->cpd_fw->data, + isp->cpd_fw->size); +if (ret) { + dev_err_probe(dev, ret, "Failed to validatecpd\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ goto out_ipu_bus_del_devices; + } + + isys_ctrl = devm_kmemdup(dev, isys_buttress_ctrl, + sizeof(*isys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0+if (!isys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->isys = ipu7_isys_init(pdev, dev, isys_ctrl,
isys_base,drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ isys_ipdata, 0); +if (IS_ERR (isp->isys)) { + ret =PTR_ERR (isp->isys); + goto out_ipu_bus_del_devices; + } + + psys_ctrl = devm_kmemdup(dev, psys_buttress_ctrl, + sizeof(*psys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+if (!psys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->psys =ipu7_psys_init (pdev, &isp->isys->auxdev.dev, + psys_ctrl, psys_base, + psys_ipdata, 0); +if (IS_ERR (isp->psys)) { + ret =PTR_ERR (isp->psys); + goto out_ipu_bus_del_devices; + } + + ret =devm_request_threaded_irq (dev, pdev->irq, + ipu_buttress_isr, + ipu_buttress_isr_threaded,
(quoted diff) +1
-0+ IRQF_SHARED, IPU_NAME,isp);
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0+if (ret) + goto out_ipu_bus_del_devices; + +if (!isp->secure_mode) { + ret =ipu7_init_fw_code_region (isp); +if (ret) + goto out_ipu_bus_del_devices; + }else { + ret = pm_runtime_get_sync(&isp->psys-Quoted 1 line
auxdev.dev);
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+if (ret <0 ) { +dev_err (&isp->psys->auxdev.dev, +"Failed to get runtime PM\n" ); + goto out_ipu_bus_del_devices; + } + + ret =ipu7_mmu_hw_init (isp->psys->mmu); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "Failed to init MMUhardware\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ goto out_ipu_bus_del_devices; + } + + ret = ipu7_map_fw_code_region(isp->psys, + (void *)isp-Quoted 2 lines
cpd_fw-
data,(quoted diff) +1
-0+ isp->cpd_fw-Quoted 1 line
size);
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "failed to map fwimage\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0+ goto out_ipu_bus_del_devices; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "FW authenticationfailed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ goto out_ipu_bus_del_devices; + } + +ipu7_mmu_hw_cleanup (isp->psys->mmu); +pm_runtime_put (&isp->psys->auxdev.dev); + } + +pm_runtime_put_noidle (dev); +pm_runtime_allow (dev); + + isp->ipu7_bus_ready_to_probe = true; + +return 0 ; + +out_ipu_bus_del_devices: + if (!IS_ERR_OR_NULL(isp->isys) && isp->isys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->isys); + if (!IS_ERR_OR_NULL(isp->psys) && isp->psys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->psys); + if (!IS_ERR_OR_NULL(isp->psys) && !IS_ERR_OR_NULL(isp-Quoted 2 lines
psys-
mmu))(quoted diff) +2
-0+ ipu7_mmu_cleanup(isp->psys->mmu); + if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp-Quoted 2 lines
isys-
mmu))drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ipu7_mmu_cleanup (isp->isys->mmu); +if (!IS_ERR_OR_NULL (isp->psys)) +pm_runtime_put (&isp->psys->auxdev.dev); +ipu7_bus_del_devices (pdev); +release_firmware (isp->cpd_fw); +buttress_exit: +ipu_buttress_exit (isp); + +return ret; +} + +static void ipu7_pci_remove(struct pci_dev *pdev) +{ + struct ipu7_device *isp = pci_get_drvdata(pdev); + + if (!IS_ERR_OR_NULL(isp->isys) && isp->isys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->isys); + if (!IS_ERR_OR_NULL(isp->psys) && isp->psys-Quoted 1 line
fw_sgt.nents)
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ipu7_unmap_fw_code_region (isp->psys);drivers/media/pci/intel/ipu7/ipu7.c line 2658
Quoted 10 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +if (!IS_ERR_OR_NULL (isp->fw_code_region)) +vfree (isp->fw_code_region); + +ipu7_bus_del_devices (pdev); + +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_noresume (&pdev->dev); + +pci_release_regions (pdev);You don't need this if you request with a
pcim_function. The 'm' stands for "managed". Those are devres functions that will clean up automatically ifprobe()fails or onceremove()is invoked.Furthermore, you should not mix
pcim_andpci_functions; at least not
those.And even if the
pcim_functions wouldn't do a cleanup, you would leak
the IO mappings above, sincepci_release_regions()just removes the region requests, but not the mapping cookies.I recommend taking a look to the PCI subystem's documentation.
drivers/media/pci/intel/ipu7/ipu7.c line 2659
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+pci_disable_device (pdev);You also don't need this since you used
pcim_enable_device(), which will disable the device automatically on driver-detach.P.
Quoted 424 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +33
-0+ +ipu_buttress_exit (isp); + +release_firmware (isp->cpd_fw); + +ipu7_mmu_cleanup (isp->psys->mmu); +ipu7_mmu_cleanup (isp->isys->mmu); +} + +static void ipu7_pci_reset_prepare (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +dev_warn (&pdev->dev,"FLR prepare\n" ); +pm_runtime_forbid (&isp->pdev->dev); +} + +static void ipu7_pci_reset_done (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +ipu_buttress_restore (isp); +if (isp->secure_mode) +ipu_buttress_reset_authentication (isp); + + isp->ipc_reinit = true; +pm_runtime_allow (&isp->pdev->dev); + +dev_warn (&pdev->dev,"FLR completed\n" ); +} + +/* +* PCI base driver code requires driver to provide these to enable
+ * PCI device level PM state transitions (D0<->D3)
+ */drivers/media/pci/intel/ipu7/ipu7.c new file +31
-0+static int ipu7_suspend (struct device *dev) +{ +return 0 ; +} + +static int ipu7_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu_buttress *b = &isp->buttress; +int ret; + + isp->secure_mode =ipu_buttress_get_secure_mode (isp); +dev_info (dev,"IPU7 in %s mode\n" , + isp->secure_mode ?"secure" :"non-secure" ); + +ipu_buttress_restore (isp); + + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) +dev_err (dev,"IPC reset protocol failed!\n" ); + + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +dev_err (dev,"Failed to get runtime PM\n" ); +return 0 ; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) + dev_err(dev, "FW authentication failed(%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7.c new file +21
-0+ +pm_runtime_put (&isp->psys->auxdev.dev); + +return 0 ; +} + +static int ipu7_runtime_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + +ipu_buttress_restore (isp); + +if (isp->ipc_reinit) { +struct ipu_buttress *b = &isp->buttress; + + isp->ipc_reinit = false; + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) + dev_err(dev, "IPC reset protocolfailed!\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ } + +return 0 ; +} + +static const struct dev_pm_ops ipu7_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(&ipu7_suspend, &ipu7_resume) + SET_RUNTIME_PM_OPS(&ipu7_suspend, /* Same as insuspend flow */
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0+ &ipu7_runtime_resume, + NULL) +}; + +static const struct pci_device_id ipu7_pci_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7P5_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU8_PCI_ID )}, + {0 ,} +}; +MODULE_DEVICE_TABLE (pci, ipu7_pci_tbl); + +static const struct pci_error_handlers pci_err_handlers = { + .reset_prepare = ipu7_pci_reset_prepare, + .reset_done = ipu7_pci_reset_done, +}; + +static struct pci_driver ipu7_pci_driver = { + .name =IPU_NAME , + .id_table = ipu7_pci_tbl, + .probe = ipu7_pci_probe, + .remove = ipu7_pci_remove, + .driver = { + .pm = &ipu7_pm_ops, + }, + .err_handler = &pci_err_handlers, +}; + +module_pci_driver (ipu7_pci_driver); + +MODULE_IMPORT_NS ("INTEL_IPU_BRIDGE" ); +MODULE_AUTHOR ("Bingbu Cao <[email protected]>" ); +MODULE_AUTHOR ("Tianshu Qiu <[email protected]>" ); +MODULE_AUTHOR ("Qingwu Zhang <[email protected]>" ); +MODULE_AUTHOR ("Intel" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Intel ipu7 pci driver" );drivers/media/pci/intel/ipu7/ipu7.h new file +23
-0@@ -0,0 +1,244 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_H +#define IPU7_H + +#include <linux/list.h> +#include <linux/pci.h> +#include <linux/types.h> + +#include "ipu7-buttress.h" + +struct ipu7_bus_device ; +struct pci_dev ; +struct firmware ; + +#define IPU_NAME "intel-ipu7" +#define IPU_MEDIA_DEV_MODEL_NAME "ipu7" + +#define IPU7_FIRMWARE_NAME "intel/ipu/ipu7_fw.bin" +#define
IPU7P5_FIRMWARE_NAME"intel/ipu/ipu7ptl_fw.bin"drivers/media/pci/intel/ipu7/ipu7.h new file +9
-0+#define IPU8_FIRMWARE_NAME "intel/ipu/ipu8_fw.bin" + +#define IPU7_ISYS_NUM_STREAMS 12 + +#define IPU7_PCI_ID 0x645d +#define IPU7P5_PCI_ID 0xb05d +#define IPU8_PCI_ID 0xd719 + +#define FW_LOG_BUF_SIZE (2 * 1024 *1024)
drivers/media/pci/intel/ipu7/ipu7.h new file +27
-0+ +enum ipu_version { +IPU_VER_INVALID =0 , +IPU_VER_7 =1 , +IPU_VER_7P5 =2 , +IPU_VER_8 =3 , +}; + +static inline bool is_ipu7p5 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7P5 ; +} + +static inline bool is_ipu7 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7 ; +} + +static inline bool is_ipu8 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_8 ; +} + +#define IPU_UNIFIED_OFFSET 0 + +/* +* ISYS DMA can overshoot. For higher resolutions over allocation is
one line
+ * but it must be at minimum 1024 bytes. Value could be different in
+ * different versions / generations thus provide it via platform data.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+#define IPU_ISYS_OVERALLOC_MIN 1024 + +#define IPU_FW_CODE_REGION_SIZE 0x1000000/* 16MB */
drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+#define IPU_FW_CODE_REGION_START 0x4000000/* 64MB */ +#define
IPU_FW_CODE_REGION_END(IPU_FW_CODE_REGION_STARTdrivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+ \ +
IPU_FW_CODE_REGION_SIZE) /*
80MB */drivers/media/pci/intel/ipu7/ipu7.h new file +26
-0+ +struct ipu7_device { +struct pci_dev *pdev; +struct list_head devices; +struct ipu7_bus_device *isys; +struct ipu7_bus_device *psys; +struct ipu_buttress buttress; + +const struct firmware *cpd_fw; +const char *cpd_fw_name; +/* Only for non-secure mode. */ +void *fw_code_region; + +void __iomem *base; +void __iomem *pb_base; +u8 hw_ver; +bool ipc_reinit; +bool secure_mode; +bool ipu7_bus_ready_to_probe; +}; + +#define IPU_DMA_MASK 39 +#define IPU_LIB_CALL_TIMEOUT_MS 2000 +#define IPU_PSYS_CMD_TIMEOUT_MS 2000 +#define IPU_PSYS_OPEN_CLOSE_TIMEOUT_US 50 +#define IPU_PSYS_OPEN_CLOSE_RETRY (10000 /
IPU_PSYS_OPEN_CLOSE_TIMEOUT_US)drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0+ +#define IPU_ISYS_NAME "isys" +#define IPU_PSYS_NAME "psys" + +#define IPU_MMU_ADDR_BITS 32 +/* FW is accessible within the first 2 GiB only in non-secure mode.
*/drivers/media/pci/intel/ipu7/ipu7.h new file +9
-0+#define IPU_MMU_ADDR_BITS_NON_SECURE 31 + +#define IPU7_IS_MMU_NUM 4 +#define IPU7_PS_MMU_NUM 4 +#define IPU7P5_IS_MMU_NUM 4 +#define IPU7P5_PS_MMU_NUM 4 +#define IPU8_IS_MMU_NUM 5 +#define IPU8_PS_MMU_NUM 4 +#define IPU_MMU_MAX_NUM 5/* max(IS, PS) */
drivers/media/pci/intel/ipu7/ipu7.h new file +8
-0+#define IPU_MMU_MAX_TLB_L1_STREAMS 40 +#define IPU_MMU_MAX_TLB_L2_STREAMS 40 +#define IPU_ZLX_MAX_NUM 32 +#define IPU_ZLX_POOL_NUM 8 +#define IPU_UAO_PLANE_MAX_NUM 64 + +/* +* To maximize the IOSF utlization, IPU need to send requests in bursts.
+ * At the DMA interface with the buttress, there are CDC FIFOs with
burst
+ * collection capability. CDC FIFO burst collectors have a configurable
+ * threshold and is configured based on the outcome of performance
measurements.
+ *
+ * isys has 3 ports with IOSF interface for VC0, VC1 and VC2
+ * psys has 4 ports with IOSF interface for VC0, VC1w, VC1r and VC2
+ *
+ * Threshold values are pre-defined and are arrived at after performance
+ * evaluations on a type of IPU
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +4
-0+#define IPU_MAX_VC_IOSF_PORTS 4 + +/* +* IPU must configure correct arbitration mechanism related to the
IOSF VC
+ * requests. There are two options per VC0 and VC1 - > 0 means rearbitrate on
+ * stall and 1 means stall until the request is completed.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +5
-0+#define IPU_BTRS_ARB_MODE_TYPE_REARB 0 +#define IPU_BTRS_ARB_MODE_TYPE_STALL 1 + +/* Currently chosen arbitration mechanism for VC0 */ +#define
IPU_BTRS_ARB_STALL_MODE_VC0IPU_BTRS_ARB_MODE_TYPE_REARBdrivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+ +/* Currently chosen arbitration mechanism for VC1 */ +#define
IPU_BTRS_ARB_STALL_MODE_VC1IPU_BTRS_ARB_MODE_TYPE_REARBdrivers/media/pci/intel/ipu7/ipu7.h new file +4
-0+ +struct ipu7_isys_subdev_pdata ; + +/* One L2 entry maps 1024 L1 entries and one L1 entry per page */
drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0+#define IPU_MMUV2_L2_RANGE (1024 * PAGE_SIZE) +/* Max L2 blocks per stream */ +#define IPU_MMUV2_MAX_L2_BLOCKS 2 +/* Max L1 blocks per stream */ +#define IPU_MMUV2_MAX_L1_BLOCKS 16 +#define IPU_MMUV2_TRASH_RANGE (IPU_MMUV2_L2_RANGE* \
drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0+
IPU_MMUV2_MAX_L2_BLOCKS)drivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+/* Entries per L1 block */ +#define MMUV2_ENTRIES_PER_L1_BLOCK 16 +#define
MMUV2_TRASH_L1_BLOCK_OFFSET(MMUV2_ENTRIES_PER_L1_BLOCK
*PAGE_SIZE)drivers/media/pci/intel/ipu7/ipu7.h new file +83
-0+#define MMUV2_TRASH_L2_BLOCK_OFFSET IPU_MMUV2_L2_RANGE + +struct ipu7_mmu_hw { +char name[32 ]; + +void __iomem *base; +void __iomem *zlx_base; +void __iomem *uao_base; + +u32 offset; +u32 zlx_offset; +u32 uao_offset; + +u32 info_bits; +u32 refill; +u32 collapse_en_bitmap; +u32 at_sp_arb_cfg; + +u32 l1_block; +u32 l2_block; + +u8 nr_l1streams; +u8 nr_l2streams; +u32 l1_block_sz[IPU_MMU_MAX_TLB_L1_STREAMS ]; +u32 l2_block_sz[IPU_MMU_MAX_TLB_L2_STREAMS ]; + +u8 zlx_nr; +u32 zlx_axi_pool[IPU_ZLX_POOL_NUM ]; +u32 zlx_en[IPU_ZLX_MAX_NUM ]; +u32 zlx_conf[IPU_ZLX_MAX_NUM ]; + +u32 uao_p_num; +u32 uao_p2tlb[IPU_UAO_PLANE_MAX_NUM ]; +}; + +struct ipu7_mmu_pdata { +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +int mmid; +}; + +struct ipu7_isys_csi2_pdata { +void __iomem *base; +}; + +struct ipu7_isys_internal_csi2_pdata { +u32 nports; +u32 *offsets; +u32 gpreg; +}; + +struct ipu7_hw_variants { +unsigned long offset; +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +u8 cdc_fifos; +u8 cdc_fifo_threshold[IPU_MAX_VC_IOSF_PORTS ]; +u32 dmem_offset; +u32 spc_offset;/* SPC offset from psys base */ +}; + +struct ipu_isys_internal_pdata { +struct ipu7_isys_internal_csi2_pdata csi2; +struct ipu7_hw_variants hw_variant; +u32 num_parallel_streams; +u32 isys_dma_overshoot; +}; + +struct ipu7_isys_pdata { +void __iomem *base; +const struct ipu_isys_internal_pdata *ipdata; +}; + +struct ipu_psys_internal_pdata { +struct ipu7_hw_variants hw_variant; +}; + +struct ipu7_psys_pdata { +void __iomem *base; +const struct ipu_psys_internal_pdata *ipdata; +}; + +int request_cpd_fw(const struct firmware **firmware_p, constchar
*name,drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+ struct device *device); +void ipu_internal_pdata_init(struct ipu_isys_internal_pdata
*isys_ipdata,drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0+ struct ipu_psys_internal_pdata
*psys_ipdata);drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+void ipu7_dump_fw_error_log (const struct ipu7_bus_device *adev); +#endif /* IPU7_H */
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
Quoted 149 lines · Philipp Stanner
+Cc Bjorn, PCI
Quoted 121 lines · Bingbu Cao
Quoted 48 lines · Philipp Stanner
Hi,
see below
Quoted 43 lines · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Intel Image Processing Unit 7th Gen includes input and processing
systems
and the hardware presents itself as a single PCI device in system
same
as IPU6.The IPU7 PCI device driver basically does PCI configurations, basic
hardware configuration by its buttress interfaces, loads the firmware binary, register the auxiliary device which serve for the
ISYS
device driver.Signed-off-by Bingbu Cao <[email protected]>---
drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 +.../media/pci/intel/ipu7/ipu7-buttress-regs.h| 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 +.../media/pci/intel/ipu7/ipu7-platform-regs.h| 146 + drivers/media/pci/intel/ipu7/ipu7.c | 2791
+++++++++++++++++
drivers/media/pci/intel/ipu7/ipu7.h | 244 ++8 files changed, 5144 insertions(+)create mode 100644
drivers/media/pci/intel/ipu7/ipu7-bus.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7-bus.hcreate mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h
create mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.c
create mode 100644drivers/media/pci/intel/ipu7/ipu7-buttress.h
create mode 100644drivers/media/pci/intel/ipu7/ipu7-platform-regs.h
create mode 100644drivers/media/pci/intel/ipu7/ipu7.ccreate mode 100644drivers/media/pci/intel/ipu7/ipu7.h---snip---
Quoted 67 lines
Quoted 57 lines
+static int
ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)(quoted diff) +2
-0+{ + struct ipu_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl=
NULL;drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev); +const struct ipu_buttress_ctrl *isys_buttress_ctrl; +const struct ipu_buttress_ctrl *psys_buttress_ctrl; +struct ipu_isys_internal_pdata *isys_ipdata; +struct ipu_psys_internal_pdata *psys_ipdata; +unsigned int dma_mask =IPU_DMA_MASK ; +struct device *dev = &pdev->dev; +void __iomem *isys_base =NULL ; +void __iomem *psys_base =NULL ; +void __iomem *const *iomap; +phys_addr_t phys, pb_phys; +struct ipu7_device *isp; +u32 is_es; +int ret; + + if (!fwnode || fwnode_property_read_u32(fwnode,"
is_es",&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ is_es =0 ; + + isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL ); +if (!isp) +return -ENOMEM ; + +dev_set_name (dev,"intel-ipu7" ); + isp->pdev = pdev; +INIT_LIST_HEAD (&isp->devices); + + ret =pcim_enable_device (pdev); +if (ret) + return dev_err_probe(dev, ret, "Enable PCIdevice
failed\n");drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0+ +dev_info (dev,"Device 0x%x (rev: 0x%x)\n" , + pdev->device, pdev->revision); + + phys =pci_resource_start (pdev,IPU_PCI_BAR ); + pb_phys =pci_resource_start (pdev,IPU_PCI_PBBAR ); + dev_info(dev, "IPU7 PCI BAR0 base %llx BAR2 base%llx\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ phys, pb_phys); + + ret = pcim_iomap_regions(pdev, BIT(IPU_PCI_BAR) |
BIT(IPU_PCI_PBBAR),drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ pci_name(pdev)); +if (ret) + return dev_err_probe(dev, ret, + "Failed to I/O memoryremapping
(%d)\n",drivers/media/pci/intel/ipu7/ipu7.c line 2462
Quoted 3 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ ret); + + iomap =pcim_iomap_table (pdev);
pcim_iomap_table()andpcim_iomap_regions()have been deprecated last
year. That's also documented in those functions' docstrings. Please
don't use them anymore.Quoted 8 lines
Quoted 1 line
You can achieve all you need with the simpler
pcim_iomap_region()Philipp,
I see that
pcim_iomap_regions()andpcim_add_mapping_to_legacy_table()
have simple 'bar' checking, how doespcim_iomap_region()check that?You mean the BAR index range check I suppose.
That's a good question. It seems to me that the ultimately used
pci_resource_start()will just overflow the device's array and you get
UB – again.He.
Damn.We might wanna fix that. But we can ask ourselves: where. At the lowest
point in those PCI region accessor macros which then bubble an EINVAL or similar upwards, or at the higher point, as inpcim_iomap_region().
Quoted 4 lines
This seems a PCI-wide problem. It seems to me that
pci_iomap()& partners are also not safeguarded against overflowing.Bjorn, shall we solve that? How? do you have a preference?
I took a first look and it seems that many drivers directly use pci_resource_start() and assign its value to an unsigned integer.
So we have no way to have it check for the BAR index range and return - EINVAL.
Hm, kind of bad. So my first instinct is that we have no other choice but do such checks in the higher layers.
P.
Quoted 708 lines
P.
PS: That is actually embarrassing since I complained in my talk about
pcim_iomap_table()having no possibility for bounds checking. Ah, let's hope no one will notice that I said that ^_^Quoted 698 lines
Quoted 697 lines
Quoted 226 lines
(quoted diff) +2
-0+ if (!iomap) + return dev_err_probe(dev, -ENODEV, "Failed toiomap
table\n");drivers/media/pci/intel/ipu7/ipu7.c new file +4
-0+ + isp->base = iomap[IPU_PCI_BAR ]; + isp->pb_base = iomap[IPU_PCI_PBBAR ]; + dev_info(dev, "IPU7 PCI BAR0 mapped at %p\n BAR2mapped
at
%p\n",drivers/media/pci/intel/ipu7/ipu7.c new file +38
-0+ isp->base, isp->pb_base); + +pci_set_drvdata (pdev, isp); +pci_set_master (pdev); + +switch (id->device) { +case IPU7_PCI_ID : + isp->hw_ver =IPU_VER_7 ; + isp->cpd_fw_name =IPU7_FIRMWARE_NAME ; + isys_ipdata = &ipu7_isys_ipdata; + psys_ipdata = &ipu7_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU7P5_PCI_ID : + isp->hw_ver =IPU_VER_7P5 ; + isp->cpd_fw_name =IPU7P5_FIRMWARE_NAME ; + isys_ipdata = &ipu7p5_isys_ipdata; + psys_ipdata = &ipu7p5_psys_ipdata; + isys_buttress_ctrl = &ipu7_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu7_psys_buttress_ctrl; +break ; +case IPU8_PCI_ID : + isp->hw_ver =IPU_VER_8 ; + isp->cpd_fw_name =IPU8_FIRMWARE_NAME ; + isys_ipdata = &ipu8_isys_ipdata; + psys_ipdata = &ipu8_psys_ipdata; + isys_buttress_ctrl = &ipu8_isys_buttress_ctrl; + psys_buttress_ctrl = &ipu8_psys_buttress_ctrl; +break ; +default : +WARN (1 ,"Unsupported IPU device" ); +return -ENODEV ; + } + +ipu_internal_pdata_init (isys_ipdata, psys_ipdata); + + isys_base = isp->base + isys_ipdata-Quoted 1 line
hw_variant.offset;
(quoted diff) +1
-0+ psys_base = isp->base + psys_ipdata-Quoted 1 line
hw_variant.offset;
(quoted diff) +2
-0+ + ret = dma_set_mask_and_coherent(dev,
DMA_BIT_MASK(dma_mask));(quoted diff) +2
-0+ if (ret) + return dev_err_probe(dev, ret, "Failed to setDMA
mask\n");drivers/media/pci/intel/ipu7/ipu7.c new file +12
-0+ +dma_set_max_seg_size (dev,UINT_MAX ); + + ret =ipu7_pci_config_setup (pdev); +if (ret) +return ret; + + ret =ipu_buttress_init (isp); +if (ret) +return ret; + + dev_info(dev, "firmware cpd file: %s\n", isp-Quoted 1 line
cpd_fw_name);(quoted diff) +2
-0+ + ret = request_firmware(&isp->cpd_fw, isp->cpd_fw_name,dev);
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) { + dev_err_probe(dev, ret, + "Requesting signed firmware %sfailed\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ isp->cpd_fw_name); + goto buttress_exit; + } + + ret = ipu7_cpd_validate_cpd_file(isp, isp->cpd_fw-Quoted 1 line
data,
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+ isp->cpd_fw->size); +if (ret) { + dev_err_probe(dev, ret, "Failed to validatecpd\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ goto out_ipu_bus_del_devices; + } + + isys_ctrl = devm_kmemdup(dev, isys_buttress_ctrl, + sizeof(*isys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0+if (!isys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->isys = ipu7_isys_init(pdev, dev, isys_ctrl,
isys_base,drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ isys_ipdata, 0); +if (IS_ERR (isp->isys)) { + ret =PTR_ERR (isp->isys); + goto out_ipu_bus_del_devices; + } + + psys_ctrl = devm_kmemdup(dev, psys_buttress_ctrl, + sizeof(*psys_buttress_ctrl),
GFP_KERNEL);drivers/media/pci/intel/ipu7/ipu7.c new file +6
-0+if (!psys_ctrl) { + ret = -ENOMEM ; + goto out_ipu_bus_del_devices; + } + + isp->psys = ipu7_psys_init(pdev, &isp->isys-Quoted 1 line
auxdev.dev,
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ psys_ctrl, psys_base, + psys_ipdata, 0); +if (IS_ERR (isp->psys)) { + ret =PTR_ERR (isp->psys); + goto out_ipu_bus_del_devices; + } + + ret =devm_request_threaded_irq (dev, pdev->irq, + ipu_buttress_isr, + ipu_buttress_isr_threade
d,(quoted diff) +1
-0+ IRQF_SHARED, IPU_NAME,isp);
drivers/media/pci/intel/ipu7/ipu7.c new file +9
-0+if (ret) + goto out_ipu_bus_del_devices; + +if (!isp->secure_mode) { + ret =ipu7_init_fw_code_region (isp); +if (ret) + goto out_ipu_bus_del_devices; + }else { + ret = pm_runtime_get_sync(&isp->psys-Quoted 1 line
auxdev.dev);
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+if (ret <0 ) { +dev_err (&isp->psys->auxdev.dev, +"Failed to get runtime PM\n" ); + goto out_ipu_bus_del_devices; + } + + ret =ipu7_mmu_hw_init (isp->psys->mmu); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "Failed to init MMUhardware\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ goto out_ipu_bus_del_devices; + } + + ret = ipu7_map_fw_code_region(isp->psys, + (void *)isp-Quoted 2 lines
cpd_fw-
data,(quoted diff) +1
-0+ isp->cpd_fw-Quoted 1 line
size);
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "failed to map fwimage\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +7
-0+ goto out_ipu_bus_del_devices; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret, + "FW authenticationfailed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ goto out_ipu_bus_del_devices; + } + +ipu7_mmu_hw_cleanup (isp->psys->mmu); +pm_runtime_put (&isp->psys->auxdev.dev); + } + +pm_runtime_put_noidle (dev); +pm_runtime_allow (dev); + + isp->ipu7_bus_ready_to_probe = true; + +return 0 ; + +out_ipu_bus_del_devices: + if (!IS_ERR_OR_NULL(isp->isys) && isp->isys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->isys); + if (!IS_ERR_OR_NULL(isp->psys) && isp->psys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->psys); + if (!IS_ERR_OR_NULL(isp->psys) && !IS_ERR_OR_NULL(isp-Quoted 2 lines
psys-
mmu))(quoted diff) +2
-0+ ipu7_mmu_cleanup(isp->psys->mmu); + if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp-Quoted 2 lines
isys-
mmu))drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+ipu7_mmu_cleanup (isp->isys->mmu); +if (!IS_ERR_OR_NULL (isp->psys)) +pm_runtime_put (&isp->psys->auxdev.dev); +ipu7_bus_del_devices (pdev); +release_firmware (isp->cpd_fw); +buttress_exit: +ipu_buttress_exit (isp); + +return ret; +} + +static void ipu7_pci_remove(struct pci_dev *pdev) +{ + struct ipu7_device *isp = pci_get_drvdata(pdev); + + if (!IS_ERR_OR_NULL(isp->isys) && isp->isys-Quoted 1 line
fw_sgt.nents)
(quoted diff) +2
-0+ ipu7_unmap_fw_code_region(isp->isys); + if (!IS_ERR_OR_NULL(isp->psys) && isp->psys-Quoted 1 line
fw_sgt.nents)
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ipu7_unmap_fw_code_region (isp->psys);drivers/media/pci/intel/ipu7/ipu7.c line 2658
Quoted 10 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +if (!IS_ERR_OR_NULL (isp->fw_code_region)) +vfree (isp->fw_code_region); + +ipu7_bus_del_devices (pdev); + +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_noresume (&pdev->dev); + +pci_release_regions (pdev);You don't need this if you request with a
pcim_function. The 'm' stands for "managed". Those are devres functions that will clean up
automatically ifprobe()fails or onceremove()is invoked.Furthermore, you should not mix
pcim_andpci_functions; at least
not
those.And even if the
pcim_functions wouldn't do a cleanup, you would leak
the IO mappings above, sincepci_release_regions()just removes the
region requests, but not the mapping cookies.I recommend taking a look to the PCI subystem's documentation.
drivers/media/pci/intel/ipu7/ipu7.c line 2659
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+pci_disable_device (pdev);You also don't need this since you used
pcim_enable_device(), which
will disable the device automatically on driver-detach.P.
Quoted 432 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +33
-0+ +ipu_buttress_exit (isp); + +release_firmware (isp->cpd_fw); + +ipu7_mmu_cleanup (isp->psys->mmu); +ipu7_mmu_cleanup (isp->isys->mmu); +} + +static void ipu7_pci_reset_prepare (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +dev_warn (&pdev->dev,"FLR prepare\n" ); +pm_runtime_forbid (&isp->pdev->dev); +} + +static void ipu7_pci_reset_done (struct pci_dev *pdev) +{ +struct ipu7_device *isp =pci_get_drvdata (pdev); + +ipu_buttress_restore (isp); +if (isp->secure_mode) +ipu_buttress_reset_authentication (isp); + + isp->ipc_reinit = true; +pm_runtime_allow (&isp->pdev->dev); + +dev_warn (&pdev->dev,"FLR completed\n" ); +} + +/* +* PCI base driver code requires driver to provide these to enable
+ * PCI device level PM state transitions (D0<->D3)
+ */drivers/media/pci/intel/ipu7/ipu7.c new file +31
-0+static int ipu7_suspend (struct device *dev) +{ +return 0 ; +} + +static int ipu7_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +struct ipu_buttress *b = &isp->buttress; +int ret; + + isp->secure_mode =ipu_buttress_get_secure_mode (isp); +dev_info (dev,"IPU7 in %s mode\n" , + isp->secure_mode ?"secure" :"non-secure" ); + +ipu_buttress_restore (isp); + + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) +dev_err (dev,"IPC reset protocol failed!\n" ); + + ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); +if (ret <0 ) { +dev_err (dev,"Failed to get runtime PM\n" ); +return 0 ; + } + + ret =ipu_buttress_authenticate (isp); +if (ret) + dev_err(dev, "FW authentication failed(%d)\n",ret);
drivers/media/pci/intel/ipu7/ipu7.c new file +21
-0+ +pm_runtime_put (&isp->psys->auxdev.dev); + +return 0 ; +} + +static int ipu7_runtime_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct ipu7_device *isp =pci_get_drvdata (pdev); +int ret; + +ipu_buttress_restore (isp); + +if (isp->ipc_reinit) { +struct ipu_buttress *b = &isp->buttress; + + isp->ipc_reinit = false; + ret =ipu_buttress_ipc_reset (isp, &b->cse); +if (ret) + dev_err(dev, "IPC reset protocolfailed!\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +8
-0+ } + +return 0 ; +} + +static const struct dev_pm_ops ipu7_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(&ipu7_suspend, &ipu7_resume) + SET_RUNTIME_PM_OPS(&ipu7_suspend, /* Same as insuspend flow */
drivers/media/pci/intel/ipu7/ipu7.c new file +37
-0+ &ipu7_runtime_resume, + NULL) +}; + +static const struct pci_device_id ipu7_pci_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU7P5_PCI_ID )}, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,IPU8_PCI_ID )}, + {0 ,} +}; +MODULE_DEVICE_TABLE (pci, ipu7_pci_tbl); + +static const struct pci_error_handlers pci_err_handlers = { + .reset_prepare = ipu7_pci_reset_prepare, + .reset_done = ipu7_pci_reset_done, +}; + +static struct pci_driver ipu7_pci_driver = { + .name =IPU_NAME , + .id_table = ipu7_pci_tbl, + .probe = ipu7_pci_probe, + .remove = ipu7_pci_remove, + .driver = { + .pm = &ipu7_pm_ops, + }, + .err_handler = &pci_err_handlers, +}; + +module_pci_driver (ipu7_pci_driver); + +MODULE_IMPORT_NS ("INTEL_IPU_BRIDGE" ); +MODULE_AUTHOR ("Bingbu Cao <[email protected]>" ); +MODULE_AUTHOR ("Tianshu Qiu <[email protected]>" ); +MODULE_AUTHOR ("Qingwu Zhang <[email protected]>" ); +MODULE_AUTHOR ("Intel" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Intel ipu7 pci driver" );drivers/media/pci/intel/ipu7/ipu7.h new file +22
-0@@ -0,0 +1,244 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_H +#define IPU7_H + +#include <linux/list.h> +#include <linux/pci.h> +#include <linux/types.h> + +#include "ipu7-buttress.h" + +struct ipu7_bus_device ; +struct pci_dev ; +struct firmware ; + +#define IPU_NAME "intel-ipu7" +#define IPU_MEDIA_DEV_MODEL_NAME "ipu7" + +#define
IPU7_FIRMWARE_NAME"intel/ipu/ipu7_fw.bin"
+#defineIPU7P5_FIRMWARE_NAME"intel/ipu/ipu7ptl_fw.bin"
+#defineIPU8_FIRMWARE_NAME"intel/ipu/ipu8_fw.bin"drivers/media/pci/intel/ipu7/ipu7.h new file +8
-0+ +#define IPU7_ISYS_NUM_STREAMS 12 + +#define IPU7_PCI_ID 0x645d +#define IPU7P5_PCI_ID 0xb05d +#define IPU8_PCI_ID 0xd719 + +#define FW_LOG_BUF_SIZE (2 * 1024 *1024)
drivers/media/pci/intel/ipu7/ipu7.h new file +27
-0+ +enum ipu_version { +IPU_VER_INVALID =0 , +IPU_VER_7 =1 , +IPU_VER_7P5 =2 , +IPU_VER_8 =3 , +}; + +static inline bool is_ipu7p5 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7P5 ; +} + +static inline bool is_ipu7 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_7 ; +} + +static inline bool is_ipu8 (u8 hw_ver) +{ +return hw_ver ==IPU_VER_8 ; +} + +#define IPU_UNIFIED_OFFSET 0 + +/* +* ISYS DMA can overshoot. For higher resolutions over allocation is
one line
+ * but it must be at minimum 1024 bytes. Value could be different in
+ * different versions / generations thus provide it via platform
data.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+#define IPU_ISYS_OVERALLOC_MIN 1024 + +#define IPU_FW_CODE_REGION_SIZE 0x1000000/* 16MB */
drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+#define IPU_FW_CODE_REGION_START 0x4000000/* 64MB */ +#define
IPU_FW_CODE_REGION_END(IPU_FW_CODE_REGION_STARTdrivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+ \ +
IPU_FW_CODE_REGION_SIZE) /*
80MB */drivers/media/pci/intel/ipu7/ipu7.h new file +26
-0+ +struct ipu7_device { +struct pci_dev *pdev; +struct list_head devices; +struct ipu7_bus_device *isys; +struct ipu7_bus_device *psys; +struct ipu_buttress buttress; + +const struct firmware *cpd_fw; +const char *cpd_fw_name; +/* Only for non-secure mode. */ +void *fw_code_region; + +void __iomem *base; +void __iomem *pb_base; +u8 hw_ver; +bool ipc_reinit; +bool secure_mode; +bool ipu7_bus_ready_to_probe; +}; + +#define IPU_DMA_MASK 39 +#define IPU_LIB_CALL_TIMEOUT_MS 2000 +#define IPU_PSYS_CMD_TIMEOUT_MS 2000 +#define IPU_PSYS_OPEN_CLOSE_TIMEOUT_US 50 +#define IPU_PSYS_OPEN_CLOSE_RETRY (10000 /
IPU_PSYS_OPEN_CLOSE_TIMEOUT_US)drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0+ +#define IPU_ISYS_NAME "isys" +#define IPU_PSYS_NAME "psys" + +#define IPU_MMU_ADDR_BITS 32 +/* FW is accessible within the first 2 GiB only in non-secure mode.
*/drivers/media/pci/intel/ipu7/ipu7.h new file +9
-0+#define IPU_MMU_ADDR_BITS_NON_SECURE 31 + +#define IPU7_IS_MMU_NUM 4 +#define IPU7_PS_MMU_NUM 4 +#define IPU7P5_IS_MMU_NUM 4 +#define IPU7P5_PS_MMU_NUM 4 +#define IPU8_IS_MMU_NUM 5 +#define IPU8_PS_MMU_NUM 4 +#define IPU_MMU_MAX_NUM 5/* max(IS, PS)
*/drivers/media/pci/intel/ipu7/ipu7.h new file +8
-0+#define IPU_MMU_MAX_TLB_L1_STREAMS 40 +#define IPU_MMU_MAX_TLB_L2_STREAMS 40 +#define IPU_ZLX_MAX_NUM 32 +#define IPU_ZLX_POOL_NUM 8 +#define IPU_UAO_PLANE_MAX_NUM 64 + +/* +* To maximize the IOSF utlization, IPU need to send requests in
bursts.
+ * At the DMA interface with the buttress, there are CDC FIFOs with
burst
+ * collection capability. CDC FIFO burst collectors have a configurable
+ * threshold and is configured based on the outcome of performance
measurements.
+ *
+ * isys has 3 ports with IOSF interface for VC0, VC1 and VC2
+ * psys has 4 ports with IOSF interface for VC0, VC1w, VC1r and
VC2
+ *
+ * Threshold values are pre-defined and are arrived at after performance
+ * evaluations on a type of IPU
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +4
-0+#define IPU_MAX_VC_IOSF_PORTS 4 + +/* +* IPU must configure correct arbitration mechanism related to the
IOSF VC
+ * requests. There are two options per VC0 and VC1 - > 0 means rearbitrate on
+ * stall and 1 means stall until the request is completed.
+ */drivers/media/pci/intel/ipu7/ipu7.h new file +5
-0+#define IPU_BTRS_ARB_MODE_TYPE_REARB 0 +#define IPU_BTRS_ARB_MODE_TYPE_STALL 1 + +/* Currently chosen arbitration mechanism for VC0 */ +#define
IPU_BTRS_ARB_STALL_MODE_VC0IPU_BTRS_ARB_MODE_TYPE_REARBdrivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+ +/* Currently chosen arbitration mechanism for VC1 */ +#define
IPU_BTRS_ARB_STALL_MODE_VC1IPU_BTRS_ARB_MODE_TYPE_REARBdrivers/media/pci/intel/ipu7/ipu7.h new file +4
-0+ +struct ipu7_isys_subdev_pdata ; + +/* One L2 entry maps 1024 L1 entries and one L1 entry per page */
drivers/media/pci/intel/ipu7/ipu7.h new file +6
-0+#define IPU_MMUV2_L2_RANGE (1024 * PAGE_SIZE) +/* Max L2 blocks per stream */ +#define IPU_MMUV2_MAX_L2_BLOCKS 2 +/* Max L1 blocks per stream */ +#define IPU_MMUV2_MAX_L1_BLOCKS 16 +#define IPU_MMUV2_TRASH_RANGE (IPU_MMUV2_L2_RANGE* \
drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0+
IPU_MMUV2_MAX_L2_BLOCKS)drivers/media/pci/intel/ipu7/ipu7.h new file +3
-0+/* Entries per L1 block */ +#define MMUV2_ENTRIES_PER_L1_BLOCK 16 +#define
MMUV2_TRASH_L1_BLOCK_OFFSET(MMUV2_ENTRIES_PER_L1_BLOCK
*PAGE_SIZE)drivers/media/pci/intel/ipu7/ipu7.h new file +59
-0+#define MMUV2_TRASH_L2_BLOCK_OFFSET IPU_MMUV2_L2_RANGE + +struct ipu7_mmu_hw { +char name[32 ]; + +void __iomem *base; +void __iomem *zlx_base; +void __iomem *uao_base; + +u32 offset; +u32 zlx_offset; +u32 uao_offset; + +u32 info_bits; +u32 refill; +u32 collapse_en_bitmap; +u32 at_sp_arb_cfg; + +u32 l1_block; +u32 l2_block; + +u8 nr_l1streams; +u8 nr_l2streams; +u32 l1_block_sz[IPU_MMU_MAX_TLB_L1_STREAMS ]; +u32 l2_block_sz[IPU_MMU_MAX_TLB_L2_STREAMS ]; + +u8 zlx_nr; +u32 zlx_axi_pool[IPU_ZLX_POOL_NUM ]; +u32 zlx_en[IPU_ZLX_MAX_NUM ]; +u32 zlx_conf[IPU_ZLX_MAX_NUM ]; + +u32 uao_p_num; +u32 uao_p2tlb[IPU_UAO_PLANE_MAX_NUM ]; +}; + +struct ipu7_mmu_pdata { +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +int mmid; +}; + +struct ipu7_isys_csi2_pdata { +void __iomem *base; +}; + +struct ipu7_isys_internal_csi2_pdata { +u32 nports; +u32 *offsets; +u32 gpreg; +}; + +struct ipu7_hw_variants { +unsigned long offset; +u32 nr_mmus; +struct ipu7_mmu_hw mmu_hw[IPU_MMU_MAX_NUM ]; +u8 cdc_fifos; +u8 cdc_fifo_threshold[IPU_MAX_VC_IOSF_PORTS ]; +u32 dmem_offset; +u32 spc_offset;/* SPC offset from psys base */
drivers/media/pci/intel/ipu7/ipu7.h new file +24
-0+}; + +struct ipu_isys_internal_pdata { +struct ipu7_isys_internal_csi2_pdata csi2; +struct ipu7_hw_variants hw_variant; +u32 num_parallel_streams; +u32 isys_dma_overshoot; +}; + +struct ipu7_isys_pdata { +void __iomem *base; +const struct ipu_isys_internal_pdata *ipdata; +}; + +struct ipu_psys_internal_pdata { +struct ipu7_hw_variants hw_variant; +}; + +struct ipu7_psys_pdata { +void __iomem *base; +const struct ipu_psys_internal_pdata *ipdata; +}; + +int request_cpd_fw(const struct firmware **firmware_p, constchar
*name,drivers/media/pci/intel/ipu7/ipu7.h new file +2
-0+ struct device *device); +void ipu_internal_pdata_init(struct ipu_isys_internal_pdata
*isys_ipdata,drivers/media/pci/intel/ipu7/ipu7.h new file +1
-0+ struct ipu_psys_internal_pdata
*psys_ipdata);
+voidipu7_dump_fw_error_log(const struct ipu7_bus_device *adev);
+#endif /*IPU7_H*/
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
In reply to [email protected]Quoted 1 line · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
+
[SNIP]
Quoted 47 lines
+static int
ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)(quoted diff) +2
-0+{ + struct ipu_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl =NULL;
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev); +const struct ipu_buttress_ctrl *isys_buttress_ctrl; +const struct ipu_buttress_ctrl *psys_buttress_ctrl; +struct ipu_isys_internal_pdata *isys_ipdata; +struct ipu_psys_internal_pdata *psys_ipdata; +unsigned int dma_mask =IPU_DMA_MASK ; +struct device *dev = &pdev->dev; +void __iomem *isys_base =NULL ; +void __iomem *psys_base =NULL ; +void __iomem *const *iomap; +phys_addr_t phys, pb_phys; +struct ipu7_device *isp; +u32 is_es; +int ret; + + if (!fwnode || fwnode_property_read_u32(fwnode, "is_es",
&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ is_es =0 ; + + isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL ); +if (!isp) +return -ENOMEM ; + +dev_set_name (dev,"intel-ipu7" ); + isp->pdev = pdev; +INIT_LIST_HEAD (&isp->devices); + + ret =pcim_enable_device (pdev); +if (ret) + return dev_err_probe(dev, ret, "Enable PCI devicefailed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +dev_info (dev,"Device 0x%x (rev: 0x%x)\n" , + pdev->device, pdev->revision); + + phys =pci_resource_start (pdev,IPU_PCI_BAR ); + pb_phys =pci_resource_start (pdev,IPU_PCI_PBBAR ); +dev_info (dev,"IPU7 PCI BAR0 base %llx BAR2 base %llx\n" , + phys, pb_phys); + + ret = pcim_iomap_regions(pdev, BIT(IPU_PCI_BAR) |
BIT(IPU_PCI_PBBAR),
drivers/media/pci/intel/ipu7/ipu7.c line 2456
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ pci_name(pdev));
Oh and btw, since I just recognized this:
PCI request functions must always get the *driver's* name as their last parameter.
This string will be printed if there is a collision, i.e., when another driver tries to request the same resource. The output is only useful when the print contains the name of the party who actually stole your PCI region. Saying on which PCI device the region is won't be helpful.
btw, did you watch my Fosdem talk before or after I answered to this RFC? ;)
Thx
P.
Quoted 11 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) + return dev_err_probe(dev, ret, + "Failed to I/O memory remapping(%d)\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ ret); + + iomap =pcim_iomap_table (pdev); +if (!iomap) + return dev_err_probe(dev, -ENODEV, "Failed to iomaptable\n");
+
Re: [RFC PATCH 2/7] media: ipu7: add Intel IPU7 PCI device driver
Quoted 58 lines · Philipp Stanner
Quoted 1 line · On Fri, 2025-02-21 at 15:52 +0800, [email protected] wrote:
+
[SNIP]
Quoted 47 lines
+static int
ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)(quoted diff) +2
-0+{ + struct ipu_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl =NULL;
drivers/media/pci/intel/ipu7/ipu7.c new file +16
-0+struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev); +const struct ipu_buttress_ctrl *isys_buttress_ctrl; +const struct ipu_buttress_ctrl *psys_buttress_ctrl; +struct ipu_isys_internal_pdata *isys_ipdata; +struct ipu_psys_internal_pdata *psys_ipdata; +unsigned int dma_mask =IPU_DMA_MASK ; +struct device *dev = &pdev->dev; +void __iomem *isys_base =NULL ; +void __iomem *psys_base =NULL ; +void __iomem *const *iomap; +phys_addr_t phys, pb_phys; +struct ipu7_device *isp; +u32 is_es; +int ret; + + if (!fwnode || fwnode_property_read_u32(fwnode, "is_es",
&is_es))drivers/media/pci/intel/ipu7/ipu7.c new file +13
-0+ is_es =0 ; + + isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL ); +if (!isp) +return -ENOMEM ; + +dev_set_name (dev,"intel-ipu7" ); + isp->pdev = pdev; +INIT_LIST_HEAD (&isp->devices); + + ret =pcim_enable_device (pdev); +if (ret) + return dev_err_probe(dev, ret, "Enable PCI devicefailed\n");
drivers/media/pci/intel/ipu7/ipu7.c new file +10
-0+ +dev_info (dev,"Device 0x%x (rev: 0x%x)\n" , + pdev->device, pdev->revision); + + phys =pci_resource_start (pdev,IPU_PCI_BAR ); + pb_phys =pci_resource_start (pdev,IPU_PCI_PBBAR ); +dev_info (dev,"IPU7 PCI BAR0 base %llx BAR2 base %llx\n" , + phys, pb_phys); + + ret = pcim_iomap_regions(pdev, BIT(IPU_PCI_BAR) |
BIT(IPU_PCI_PBBAR),drivers/media/pci/intel/ipu7/ipu7.c line 2456
Quoted 1 line
drivers/media/pci/intel/ipu7/ipu7.c new file +1
-0+ pci_name(pdev));Oh and btw, since I just recognized this:
PCI request functions must always get the *driver's* name as their last parameter.
Quoted 8 lines
This string will be printed if there is a collision, i.e., when another driver tries to request the same resource. The output is only useful when the print contains the name of the party who actually stole your PCI region. Saying on which PCI device the region is won't be helpful.
btw, did you watch my Fosdem talk before or after I answered to this RFC? ;)
After. ;)
Quoted 18 lines
Thx
P.Quoted 11 lines
drivers/media/pci/intel/ipu7/ipu7.c new file +3
-0+if (ret) + return dev_err_probe(dev, ret, + "Failed to I/O memory remapping(%d)\n",
drivers/media/pci/intel/ipu7/ipu7.c new file +5
-0+ ret); + + iomap =pcim_iomap_table (pdev); +if (!iomap) + return dev_err_probe(dev, -ENODEV, "Failed to iomaptable\n");
+
Signature · 2 lines
Best regards, Bingbu Cao
RFC PATCH 3/7 media: ipu7: add IPU7 DMA APIs and MMU mapping
In reply to [email protected]From: Bingbu Cao <[email protected]>
The Intel IPU7 has internal microproccessor which runs the firmware The microprocessor access system DRAM by its internal 32-bit virtual address space. Driver should setup the MMU table and expose the DMA APIs for memory buffer mapping.
This patch adds the IPU MMU and a DMA mapping implementation to setup the internal MMU hardware.
--- drivers/media/pci/intel/ipu7/ipu7-dma.c | 509 ++++++++++++++ drivers/media/pci/intel/ipu7/ipu7-dma.h | 50 ++ drivers/media/pci/intel/ipu7/ipu7-mmu.c | 853 ++++++++++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7-mmu.h | 414 ++++++++++++ 4 files changed, 1826 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.h
drivers/media/pci/intel/ipu7/ipu7-dma.c new file +509 -0
@@ -0,0 +1,509 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/cacheflush.h> +#include <linux/dma-mapping.h> +#include <linux/iova.h> +#include <linux/list.h> +#include <linux/mm.h> +#include <linux/vmalloc.h> +#include <linux/scatterlist.h> +#include <linux/slab.h> +#include <linux/types.h> + +#include "ipu7.h" +#include "ipu7-bus.h" +#include "ipu7-dma.h" +#include "ipu7-mmu.h" + +struct vm_info { +struct list_head list; +struct page **pages; +dma_addr_t ipu7_iova; +void *vaddr; +unsigned long size; +}; + +static struct vm_info *get_vm_info (struct ipu7_mmu *mmu,dma_addr_t iova) +{ +struct vm_info *info, *save; + +list_for_each_entry_safe (info, save, &mmu->vma_list, list) { +if (iova >= info->ipu7_iova && + iova < (info->ipu7_iova + info->size)) +return info; + } + +return NULL ; +} + +static void __clear_buffer (struct page *page,size_t size,unsigned long attrs) +{ +void *ptr; + +if (!page) +return ; +/* +* Ensure that the allocated pages are zeroed, and that any data +* lurking in the kernel direct-mapped region is invalidated. +*/ + ptr =page_address (page); +memset (ptr,0 , size); +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 ) +clflush_cache_range (ptr, size); +} + +static struct page **__alloc_buffer (size_t size,gfp_t gfp,unsigned long attrs) +{ +unsigned int count =PHYS_PFN (size); +unsigned int array_size = count *sizeof (struct page *); +struct page **pages; +int i =0 ; + + pages =kvzalloc (array_size,GFP_KERNEL ); +if (!pages) +return NULL ; + + gfp |= __GFP_NOWARN; + +while (count) { +int j, order =__fls (count); + + pages[i] =alloc_pages (gfp, order); +while (!pages[i] && order) + pages[i] =alloc_pages (gfp, --order); +if (!pages[i]) + goto error; + +if (order) { +split_page (pages[i], order); + j =1 << order; +while (j--) + pages[i + j] = pages[i] + j; + } + +__clear_buffer (pages[i],PAGE_SIZE << order, attrs); + i +=1 << order; + count -=1 << order; + } + +return pages; +error: +while (i--) +if (pages[i]) +__free_pages (pages[i],0 ); +kvfree (pages); +return NULL ; +} + +static void __free_buffer (struct page **pages,size_t size,unsigned long attrs) +{ +unsigned int count =PHYS_PFN (size); +unsigned int i; + +for (i =0 ; i < count && pages[i]; i++) { +__clear_buffer (pages[i],PAGE_SIZE , attrs); +__free_pages (pages[i],0 ); + } + +kvfree (pages); +} + +void ipu7_dma_sync_single (struct ipu7_bus_device *sys,dma_addr_t dma_handle, +size_t size) +{ +void *vaddr; +u32 offset; +struct vm_info *info; +struct ipu7_mmu *mmu = sys->mmu; + + info =get_vm_info (mmu, dma_handle); +if (WARN_ON (!info)) +return ; + + offset = dma_handle - info->ipu7_iova; +if (WARN_ON (size > (info->size - offset))) +return ; + + vaddr = info->vaddr + offset; +clflush_cache_range (vaddr, size); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_sync_single,"INTEL_IPU7" ); + +void ipu7_dma_sync_sg (struct ipu7_bus_device *sys,struct scatterlist *sglist, +unsigned int nents) +{ +struct scatterlist *sg; +int i; + +for_each_sg (sglist, sg, nents, i) +clflush_cache_range (sg_virt (sg), sg->length); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_sync_sg,"INTEL_IPU7" ); + +void ipu7_dma_sync_sgtable (struct ipu7_bus_device *sys,struct sg_table *sgt) +{ +ipu7_dma_sync_sg (sys, sgt->sgl, sgt->orig_nents); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_sync_sgtable,"INTEL_IPU7" ); + +void *ipu7_dma_alloc (struct ipu7_bus_device *sys,size_t size, +dma_addr_t *dma_handle,gfp_t gfp, +unsigned long attrs) +{ +struct device *dev = &sys->auxdev.dev; +struct pci_dev *pdev = sys->isp->pdev; +dma_addr_t pci_dma_addr, ipu7_iova; +struct ipu7_mmu *mmu = sys->mmu; +struct vm_info *info; +unsigned long count; +struct page **pages; +struct iova *iova; +unsigned int i; +int ret; + + info =kzalloc (sizeof (*info),GFP_KERNEL ); +if (!info) +return NULL ; + + size =PAGE_ALIGN (size); + count =PHYS_PFN (size); + + iova =alloc_iova (&mmu->dmap->iovad, count, +PHYS_PFN (dma_get_mask (dev)),0 ); +if (!iova) + goto out_kfree; + + pages =__alloc_buffer (size, gfp, attrs); +if (!pages) + goto out_free_iova; + +dev_dbg (dev,"dma_alloc: size %zu iova low pfn %lu, high pfn %lu\n" , + size, iova->pfn_lo, iova->pfn_hi); +for (i =0 ; iova->pfn_lo + i <= iova->pfn_hi; i++) { + pci_dma_addr =dma_map_page_attrs (&pdev->dev, pages[i],0 , +PAGE_SIZE ,DMA_BIDIRECTIONAL , + attrs); +dev_dbg (dev,"dma_alloc: mapped pci_dma_addr %pad\n" , + &pci_dma_addr); +if (dma_mapping_error (&pdev->dev, pci_dma_addr)) { +dev_err (dev,"pci_dma_mapping for page[%d] failed" , i); + goto out_unmap; + } + + ret =ipu7_mmu_map (mmu->dmap->mmu_info, +PFN_PHYS (iova->pfn_lo + i), pci_dma_addr, +PAGE_SIZE ); +if (ret) { +dev_err (dev,"ipu7_mmu_map for pci_dma[%d] %pad failed" , + i, &pci_dma_addr); +dma_unmap_page_attrs (&pdev->dev, pci_dma_addr, +PAGE_SIZE ,DMA_BIDIRECTIONAL , + attrs); + goto out_unmap; + } + } + + info->vaddr =vmap (pages, count,VM_USERMAP ,PAGE_KERNEL ); +if (!info->vaddr) + goto out_unmap; + + *dma_handle =PFN_PHYS (iova->pfn_lo); + + info->pages = pages; + info->ipu7_iova = *dma_handle; + info->size = size; +list_add (&info->list, &mmu->vma_list); + +return info->vaddr; + +out_unmap: +while (i--) { + ipu7_iova =PFN_PHYS (iova->pfn_lo + i); + pci_dma_addr =ipu7_mmu_iova_to_phys (mmu->dmap->mmu_info, + ipu7_iova); +dma_unmap_page_attrs (&pdev->dev, pci_dma_addr,PAGE_SIZE , +DMA_BIDIRECTIONAL , attrs); + +ipu7_mmu_unmap (mmu->dmap->mmu_info, ipu7_iova,PAGE_SIZE ); + } + +__free_buffer (pages, size, attrs); + +out_free_iova: +__free_iova (&mmu->dmap->iovad, iova); +out_kfree: +kfree (info); + +return NULL ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_alloc,"INTEL_IPU7" ); + +void ipu7_dma_free (struct ipu7_bus_device *sys,size_t size,void *vaddr, +dma_addr_t dma_handle,unsigned long attrs) +{ +struct ipu7_mmu *mmu = sys->mmu; +struct pci_dev *pdev = sys->isp->pdev; +struct iova *iova =find_iova (&mmu->dmap->iovad,PHYS_PFN (dma_handle)); +dma_addr_t pci_dma_addr, ipu7_iova; +struct vm_info *info; +struct page **pages; +unsigned int i; + +if (WARN_ON (!iova)) +return ; + + info =get_vm_info (mmu, dma_handle); +if (WARN_ON (!info)) +return ; + +if (WARN_ON (!info->vaddr)) +return ; + +if (WARN_ON (!info->pages)) +return ; + +list_del (&info->list); + + size =PAGE_ALIGN (size); + + pages = info->pages; + +vunmap (vaddr); + +for (i =0 ; i <PHYS_PFN (size); i++) { + ipu7_iova =PFN_PHYS (iova->pfn_lo + i); + pci_dma_addr =ipu7_mmu_iova_to_phys (mmu->dmap->mmu_info, + ipu7_iova); +dma_unmap_page_attrs (&pdev->dev, pci_dma_addr,PAGE_SIZE , +DMA_BIDIRECTIONAL , attrs); + } + +ipu7_mmu_unmap (mmu->dmap->mmu_info,PFN_PHYS (iova->pfn_lo), +PFN_PHYS (iova_size (iova))); + +__free_buffer (pages, size, attrs); + + mmu->tlb_invalidate (mmu); + +__free_iova (&mmu->dmap->iovad, iova); + +kfree (info); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_free,"INTEL_IPU7" ); + +int ipu7_dma_mmap (struct ipu7_bus_device *sys,struct vm_area_struct *vma, +void *addr,dma_addr_t iova,size_t size, +unsigned long attrs) +{ +struct ipu7_mmu *mmu = sys->mmu; +size_t count =PFN_UP (size); +struct vm_info *info; +size_t i; +int ret; + + info =get_vm_info (mmu, iova); +if (!info) +return -EFAULT ; + +if (!info->vaddr) +return -EFAULT ; + +if (vma->vm_start & ~PAGE_MASK ) +return -EINVAL ; + +if (size > info->size) +return -EFAULT ; + +for (i =0 ; i < count; i++) { + ret =vm_insert_page (vma, vma->vm_start +PFN_PHYS (i), + info->pages[i]); +if (ret <0 ) +return ret; + } + +return 0 ; +} + +void ipu7_dma_unmap_sg (struct ipu7_bus_device *sys,struct scatterlist *sglist, +int nents,enum dma_data_direction dir, +unsigned long attrs) +{ +struct device *dev = &sys->auxdev.dev; +struct ipu7_mmu *mmu = sys->mmu; +struct iova *iova =find_iova (&mmu->dmap->iovad, +PHYS_PFN (sg_dma_address (sglist))); +struct scatterlist *sg; +dma_addr_t pci_dma_addr; +unsigned int i; + +if (!nents) +return ; + +if (WARN_ON (!iova)) +return ; + +/* +* Before IPU7 mmu unmap, return the pci dma address back to sg +* assume the nents is less than orig_nents as the least granule +* is 1 SZ_4K page +*/ +dev_dbg (dev,"trying to unmap concatenated %u ents\n" , nents); +for_each_sg (sglist, sg, nents, i) { +dev_dbg (dev,"unmap sg[%d] %pad size %u\n" , i, + &sg_dma_address (sg),sg_dma_len (sg)); + pci_dma_addr =ipu7_mmu_iova_to_phys (mmu->dmap->mmu_info, +sg_dma_address (sg)); +dev_dbg (dev,"return pci_dma_addr %pad back to sg[%d]\n" , + &pci_dma_addr, i); +sg_dma_address (sg) = pci_dma_addr; + } + +dev_dbg (dev,"ipu7_mmu_unmap low pfn %lu high pfn %lu\n" , + iova->pfn_lo, iova->pfn_hi); +ipu7_mmu_unmap (mmu->dmap->mmu_info,PFN_PHYS (iova->pfn_lo), +PFN_PHYS (iova_size (iova))); + + mmu->tlb_invalidate (mmu); +__free_iova (&mmu->dmap->iovad, iova); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_unmap_sg,"INTEL_IPU7" ); + +int ipu7_dma_map_sg (struct ipu7_bus_device *sys,struct scatterlist *sglist, +int nents,enum dma_data_direction dir, +unsigned long attrs) +{ +struct device *dev = &sys->auxdev.dev; +struct ipu7_mmu *mmu = sys->mmu; +struct scatterlist *sg; +struct iova *iova; +size_t npages =0 ; +unsigned long iova_addr; +int i; + +for_each_sg (sglist, sg, nents, i) { +if (sg->offset) { +dev_err (dev,"Unsupported non-zero sg[%d].offset %x\n" , + i, sg->offset); +return -EFAULT ; + } + } + +for_each_sg (sglist, sg, nents, i) + npages +=PFN_UP (sg_dma_len (sg)); + +dev_dbg (dev,"dmamap trying to map %d ents %zu pages\n" , + nents, npages); + +if (attrs &DMA_ATTR_RESERVE_REGION ) { +/* +* Reserve iova with size aligned to IPU_FW_CODE_REGION_SIZE. +* Only apply for non-secure mode. +*/ +unsigned long lo, hi; + + lo =iova_pfn (&mmu->dmap->iovad,IPU_FW_CODE_REGION_START ); + hi =iova_pfn (&mmu->dmap->iovad,IPU_FW_CODE_REGION_END ) -1 ; + iova =reserve_iova (&mmu->dmap->iovad, lo, hi); +if (!iova) { +dev_err (dev,"Reserve iova[%lx:%lx] failed.\n" , lo, hi); +return -ENOMEM ; + } +dev_dbg (dev,"iova[%lx:%lx] reserved for FW code.\n" , lo, hi); + }else { + iova =alloc_iova (&mmu->dmap->iovad, npages, +PHYS_PFN (dma_get_mask (dev)),0 ); +if (!iova) +return 0 ; + } + +dev_dbg (dev,"dmamap: iova low pfn %lu, high pfn %lu\n" , iova->pfn_lo, + iova->pfn_hi); + + iova_addr = iova->pfn_lo; +for_each_sg (sglist, sg, nents, i) { +phys_addr_t iova_pa; +int ret; + + iova_pa =PFN_PHYS (iova_addr); +dev_dbg (dev,"mapping entry %d: iova %pap phy %pap size %d\n" , + i, &iova_pa, &sg_dma_address (sg),sg_dma_len (sg)); + + ret =ipu7_mmu_map (mmu->dmap->mmu_info,PFN_PHYS (iova_addr), +sg_dma_address (sg), +PAGE_ALIGN (sg_dma_len (sg))); +if (ret) + goto out_fail; + +sg_dma_address (sg) =PFN_PHYS (iova_addr); + + iova_addr +=PFN_UP (sg_dma_len (sg)); + } + +dev_dbg (dev,"dmamap %d ents %zu pages mapped\n" , nents, npages); + +return nents; + +out_fail: +ipu7_dma_unmap_sg (sys, sglist, i, dir, attrs); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_map_sg,"INTEL_IPU7" ); + +int ipu7_dma_map_sgtable (struct ipu7_bus_device *sys,struct sg_table *sgt, +enum dma_data_direction dir,unsigned long attrs) +{ +int nents; + + nents =ipu7_dma_map_sg (sys, sgt->sgl, sgt->nents, dir, attrs); +if (nents <0 ) +return nents; + + sgt->nents = nents; + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_map_sgtable,"INTEL_IPU7" ); + +void ipu7_dma_unmap_sgtable (struct ipu7_bus_device *sys,struct sg_table *sgt, +enum dma_data_direction dir,unsigned long attrs) +{ +ipu7_dma_unmap_sg (sys, sgt->sgl, sgt->nents, dir, attrs); +} +EXPORT_SYMBOL_NS_GPL (ipu7_dma_unmap_sgtable,"INTEL_IPU7" ); + +/* +* Create scatter-list for the already allocated DMA buffer +*/ +int ipu7_dma_get_sgtable (struct ipu7_bus_device *sys,struct sg_table *sgt, +void *cpu_addr,dma_addr_t handle,size_t size, +unsigned long attrs) +{ +struct device *dev = &sys->auxdev.dev; +struct ipu7_mmu *mmu = sys->mmu; +struct vm_info *info; +int n_pages; +int ret =0 ; + + info =get_vm_info (mmu, handle); +if (!info) +return -EFAULT ; + +if (!info->vaddr) +return -EFAULT ; + +if (WARN_ON (!info->pages)) +return -ENOMEM ; + + n_pages =PFN_UP (size); + + ret =sg_alloc_table_from_pages (sgt, info->pages, n_pages,0 , size, +GFP_KERNEL ); +if (ret) +dev_warn (dev,"get sgt table failed\n" ); + +return ret; +}
drivers/media/pci/intel/ipu7/ipu7-dma.h new file +50 -0
50 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-mmu.c new file +853 -0
853 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-mmu.h new file +414 -0
414 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [RFC PATCH 3/7] media: ipu7: add IPU7 DMA APIs and MMU mapping
Quoted 6 lines · On Fri, Feb 21, 2025 at 03:52:48PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
The Intel IPU7 has internal microproccessor which runs the firmware The microprocessor access system DRAM by its internal 32-bit virtual address space. Driver should setup the MMU table and expose the DMA APIs for memory buffer mapping.
s/microproccessor/microprocessor/
s/access/accesses/
Quoted 4 lines
drivers/media/pci/intel/ipu7/ipu7-mmu.c new file +4
-0+#define ISP_PAGE_SHIFT 12 +#define ISP_PAGE_SIZE BIT(ISP_PAGE_SHIFT) +#define ISP_PAGE_MASK (~(ISP_PAGE_SIZE - 1)) +
drivers/media/pci/intel/ipu7/ipu7-mmu.c line 47
Quoted 10 lines
drivers/media/pci/intel/ipu7/ipu7-mmu.c new file +10
-0+#define ISP_L1PT_SHIFT 22 +#define ISP_L1PT_MASK (~((1U << ISP_L1PT_SHIFT) - 1)) + +#define ISP_L2PT_SHIFT 12 +#define ISP_L2PT_MASK (~(ISP_L1PT_MASK | (~(ISP_PAGE_MASK)))) + +#define ISP_L1PT_PTES 1024 +#define ISP_L2PT_PTES 1024 + +#define ISP_PADDR_SHIFT 12
If you used GENMASK(), FIELD_PREP(), FIELD_GET(), you wouldn't need these _SHIFT #defines.
RFC PATCH 4/7 media: ipu7: add firmware parse, syscom interface and boot sequence
In reply to [email protected]From: Bingbu Cao <[email protected]>
IPU7 irmware is generated and released as signed Code Partition Directory (CPD) format file which is aligned with the SPI flash code partition definition. The driver parses the CPD based on the layout.
Syscom is an inter-process(or) communication mechanism between an IPU and host. Syscom uses message queues for message exchange between IPU and host. Each message queue has its consumer and producer, host queue messages to firmware as the producer and then firmware to dequeue the messages as consumer and vice versa. IPU and host use shared registers or memory to reside the read and write indices which are updated by consumer and producer.
IPU7 firmware defined its boot sequence, driver setup the boot configuration and program the boot parameters to start and run the firmware.
--- drivers/media/pci/intel/ipu7/ipu7-boot.c | 434 +++++++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7-boot.h | 21 + drivers/media/pci/intel/ipu7/ipu7-cpd.c | 230 +++++++++++ drivers/media/pci/intel/ipu7/ipu7-cpd.h | 62 +++ drivers/media/pci/intel/ipu7/ipu7-syscom.c | 79 ++++ drivers/media/pci/intel/ipu7/ipu7-syscom.h | 36 ++ 6 files changed, 862 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.h
drivers/media/pci/intel/ipu7/ipu7-boot.c new file +434 -0
@@ -0,0 +1,434 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2022 - 2024 Intel Corporation +*/ + +#include <linux/bug.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/module.h> +#include <linux/iopoll.h> +#include <linux/string.h> +#include <linux/types.h> + +#include "abi/ipu7_fw_boot_abi.h" + +#include "ipu7.h" +#include "ipu7-boot.h" +#include "ipu7-bus.h" +#include "ipu7-buttress-regs.h" +#include "ipu7-dma.h" +#include "ipu7-platform-regs.h" +#include "ipu7-syscom.h" + +#define IPU_FW_START_STOP_TIMEOUT 2000 +#define IPU_BOOT_CELL_RESET_TIMEOUT (2 * USEC_PER_SEC) +#define BOOT_STATE_IS_CRITICAL (s) IA_GOFO_FW_BOOT_STATE_IS_CRITICAL(s) +#define BOOT_STATE_IS_READY (s) ((s) == IA_GOFO_FW_BOOT_STATE_READY) +#define BOOT_STATE_IS_INACTIVE (s) ((s) == IA_GOFO_FW_BOOT_STATE_INACTIVE) + +struct ipu7_boot_context { +u32 base; +u32 dmem_address; +u32 status_ctrl_reg; +u32 fw_start_address_reg; +u32 fw_code_base_reg; +}; + +static const struct ipu7_boot_context contexts[IPU_SUBSYS_NUM ] = { + { +/* ISYS */ + .dmem_address =IPU_ISYS_DMEM_OFFSET , + .status_ctrl_reg =BUTTRESS_REG_DRV_IS_UCX_CONTROL_STATUS , + .fw_start_address_reg =BUTTRESS_REG_DRV_IS_UCX_START_ADDR , + .fw_code_base_reg =IS_UC_CTRL_BASE + }, + { +/* PSYS */ + .dmem_address =IPU_PSYS_DMEM_OFFSET , + .status_ctrl_reg =BUTTRESS_REG_DRV_PS_UCX_CONTROL_STATUS , + .fw_start_address_reg =BUTTRESS_REG_DRV_PS_UCX_START_ADDR , + .fw_code_base_reg =PS_UC_CTRL_BASE + } +}; + +static u32 get_fw_boot_reg_addr (const struct ipu7_bus_device *adev, +enum ia_gofo_buttress_reg_id reg) +{ +u32 base = (adev->subsys ==IPU_IS ) ?0 :IA_GOFO_FW_BOOT_ID_MAX ; + +return BUTTRESS_FW_BOOT_PARAMS_ENTRY (base + reg); +} + +static void write_fw_boot_param (const struct ipu7_bus_device *adev, +enum ia_gofo_buttress_reg_id reg, +u32 val) +{ +void __iomem *base = adev->isp->base; + +dev_dbg (&adev->auxdev.dev, +"write boot param reg: %d addr: %x val: 0x%x\n" , + reg,get_fw_boot_reg_addr (adev, reg), val); +writel (val, base +get_fw_boot_reg_addr (adev, reg)); +} + +static u32 read_fw_boot_param (const struct ipu7_bus_device *adev, +enum ia_gofo_buttress_reg_id reg) +{ +void __iomem *base = adev->isp->base; + +return readl (base +get_fw_boot_reg_addr (adev, reg)); +} + +static int ipu7_boot_cell_reset (const struct ipu7_bus_device *adev) +{ +const struct ipu7_boot_context *ctx = &contexts[adev->subsys]; +const struct device *dev = &adev->auxdev.dev; +u32 ucx_ctrl_status = ctx->status_ctrl_reg; +u32 timeout =IPU_BOOT_CELL_RESET_TIMEOUT ; +void __iomem *base = adev->isp->base; +u32 val, val2; +int ret; + +dev_dbg (dev,"cell enter reset...\n" ); + val =readl (base + ucx_ctrl_status); +dev_dbg (dev,"cell_ctrl_reg addr = 0x%x, val = 0x%x\n" , + ucx_ctrl_status, val); + +dev_dbg (dev,"force cell reset...\n" ); + val |=UCX_CTL_RESET ; + val &= ~UCX_CTL_RUN ; + +dev_dbg (dev,"write status_ctrl_reg(0x%x) to 0x%x\n" , + ucx_ctrl_status, val); +writel (val, base + ucx_ctrl_status); + + ret =readl_poll_timeout (base + ucx_ctrl_status, val2, + (val2 &0x3 ) == (val &0x3 ),100 , timeout); +if (ret) { +dev_err (dev,"cell enter reset timeout. status: 0x%x\n" , val2); +return -ETIMEDOUT ; + } + +dev_dbg (dev,"cell exit reset...\n" ); + val =readl (base + ucx_ctrl_status); +WARN ((!(val &UCX_CTL_RESET ) || val &UCX_CTL_RUN ), +"cell status 0x%x" , val); + + val &= ~(UCX_CTL_RESET |UCX_CTL_RUN ); +dev_dbg (dev,"write status_ctrl_reg(0x%x) to 0x%x\n" , + ucx_ctrl_status, val); +writel (val, base + ucx_ctrl_status); + + ret =readl_poll_timeout (base + ucx_ctrl_status, val2, + (val2 &0x3 ) == (val &0x3 ),100 , timeout); +if (ret) { +dev_err (dev,"cell exit reset timeout. status: 0x%x\n" , val2); +return -ETIMEDOUT ; + } + +return 0 ; +} + +static void ipu7_boot_cell_start (const struct ipu7_bus_device *adev) +{ +const struct ipu7_boot_context *ctx = &contexts[adev->subsys]; +void __iomem *base = adev->isp->base; +const struct device *dev = &adev->auxdev.dev; +u32 val; + +dev_dbg (dev,"starting cell...\n" ); + val =readl (base + ctx->status_ctrl_reg); +WARN_ON (val & (UCX_CTL_RESET |UCX_CTL_RUN )); + + val &= ~UCX_CTL_RESET ; + val |=UCX_CTL_RUN ; +dev_dbg (dev,"write status_ctrl_reg(0x%x) to 0x%x\n" , + ctx->status_ctrl_reg, val); +writel (val, base + ctx->status_ctrl_reg); +} + +static void ipu7_boot_cell_stop (const struct ipu7_bus_device *adev) +{ +const struct ipu7_boot_context *ctx = &contexts[adev->subsys]; +void __iomem *base = adev->isp->base; +const struct device *dev = &adev->auxdev.dev; +u32 val; + +dev_dbg (dev,"stopping cell...\n" ); + + val =readl (base + ctx->status_ctrl_reg); + val &= ~UCX_CTL_RUN ; +dev_dbg (dev,"write status_ctrl_reg(0x%x) to 0x%x\n" , + ctx->status_ctrl_reg, val); +writel (val, base + ctx->status_ctrl_reg); + +/* Wait for uC transactions complete */ +usleep_range (10 ,20 ); + + val =readl (base + ctx->status_ctrl_reg); + val |=UCX_CTL_RESET ; +dev_dbg (dev,"write status_ctrl_reg(0x%x) to 0x%x\n" , + ctx->status_ctrl_reg, val); +writel (val, base + ctx->status_ctrl_reg); +} + +static int ipu7_boot_cell_init (const struct ipu7_bus_device *adev) +{ +const struct ipu7_boot_context *ctx = &contexts[adev->subsys]; +void __iomem *base = adev->isp->base; + +dev_dbg (&adev->auxdev.dev,"write fw_start_address_reg(0x%x) to 0x%x\n" , + ctx->fw_start_address_reg, adev->fw_entry); +writel (adev->fw_entry, base + ctx->fw_start_address_reg); + +return ipu7_boot_cell_reset (adev); +} + +static void init_boot_config (struct ia_gofo_boot_config *boot_config, +u32 length,u8 major) +{ +/* syscom version, new syscom2 version */ + boot_config->length = length; + boot_config->config_version.major =1U ; + boot_config->config_version.minor =0U ; + boot_config->config_version.subminor =0U ; + boot_config->config_version.patch =0U ; + +/* msg version for task interface */ + boot_config->client_version_support.num_versions =1U ; + boot_config->client_version_support.versions[0 ].major = major; + boot_config->client_version_support.versions[0 ].minor =0U ; + boot_config->client_version_support.versions[0 ].subminor =0U ; + boot_config->client_version_support.versions[0 ].patch =0U ; +} + +int ipu7_boot_init_boot_config (struct ipu7_bus_device *adev, +struct syscom_queue_config *qconfigs, +int num_queues,u32 uc_freq, +dma_addr_t subsys_config,u8 major) +{ +u32 total_queue_size =0 , total_queue_size_aligned =0 ; +struct ipu7_syscom_context *syscom = adev->syscom; +struct ia_gofo_boot_config *boot_config; +struct syscom_queue_params_config *cfgs; +struct device *dev = &adev->auxdev.dev; +struct syscom_config_s *syscfg; +dma_addr_t queue_mem_dma_ptr; +void *queue_mem_ptr; +unsigned int i; + +dev_dbg (dev,"boot config queues_nr: %d freq: %u sys_conf: 0x%llx\n" , + num_queues, uc_freq, subsys_config); +/* Allocate boot config. */ + adev->boot_config_size = +sizeof (*cfgs) * num_queues +sizeof (*boot_config); + adev->boot_config =ipu7_dma_alloc (adev, adev->boot_config_size, + &adev->boot_config_dma_addr, +GFP_KERNEL ,0 ); +if (!adev->boot_config) { +dev_err (dev,"Failed to allocate boot config.\n" ); +return -ENOMEM ; + } + + boot_config = adev->boot_config; +memset (boot_config,0 ,sizeof (struct ia_gofo_boot_config )); +init_boot_config (boot_config, adev->boot_config_size, major); + boot_config->subsys_config = subsys_config; + + boot_config->uc_tile_frequency = uc_freq; + boot_config->uc_tile_frequency_units = +IA_GOFO_FW_BOOT_UC_FREQUENCY_UNITS_MHZ ; + boot_config->syscom_context_config.max_output_queues = + syscom->num_output_queues; + boot_config->syscom_context_config.max_input_queues = + syscom->num_input_queues; + +ipu7_dma_sync_single (adev, adev->boot_config_dma_addr, + adev->boot_config_size); + +for (i =0 ; i < num_queues; i++) { +u32 queue_size = qconfigs[i].max_capacity * + qconfigs[i].token_size_in_bytes; + + total_queue_size += queue_size; + queue_size =ALIGN (queue_size,IA_GOFO_CL_SIZE ); + total_queue_size_aligned += queue_size; + qconfigs[i].queue_size = queue_size; + } + +/* Allocate queue memory */ + syscom->queue_mem =ipu7_dma_alloc (adev, total_queue_size_aligned, + &syscom->queue_mem_dma_addr, +GFP_KERNEL ,0 ); +if (!syscom->queue_mem) { +dev_err (dev,"Failed to allocate queue memory.\n" ); +return -ENOMEM ; + } + syscom->queue_mem_size = total_queue_size_aligned; + + syscfg = &boot_config->syscom_context_config; + cfgs =ipu7_syscom_get_queue_config (syscfg); + queue_mem_ptr = syscom->queue_mem; + queue_mem_dma_ptr = syscom->queue_mem_dma_addr; +for (i =0 ; i < num_queues; i++) { + cfgs[i].token_array_mem = queue_mem_dma_ptr; + cfgs[i].max_capacity = qconfigs[i].max_capacity; + cfgs[i].token_size_in_bytes = qconfigs[i].token_size_in_bytes; + qconfigs[i].token_array_mem = queue_mem_ptr; + queue_mem_dma_ptr += qconfigs[i].queue_size; + queue_mem_ptr += qconfigs[i].queue_size; + } + +ipu7_dma_sync_single (adev, syscom->queue_mem_dma_addr, + total_queue_size_aligned); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_boot_init_boot_config,"INTEL_IPU7" ); + +void ipu7_boot_release_boot_config (struct ipu7_bus_device *adev) +{ +struct ipu7_syscom_context *syscom = adev->syscom; + +if (syscom->queue_mem) { +ipu7_dma_free (adev, syscom->queue_mem_size, + syscom->queue_mem, + syscom->queue_mem_dma_addr,0 ); + syscom->queue_mem =NULL ; + syscom->queue_mem_dma_addr =0 ; + } + +if (adev->boot_config) { +ipu7_dma_free (adev, adev->boot_config_size, + adev->boot_config, + adev->boot_config_dma_addr,0 ); + adev->boot_config =NULL ; + adev->boot_config_dma_addr =0 ; + } +} +EXPORT_SYMBOL_NS_GPL (ipu7_boot_release_boot_config,"INTEL_IPU7" ); + +int ipu7_boot_start_fw (const struct ipu7_bus_device *adev) +{ +const struct device *dev = &adev->auxdev.dev; +u32 timeout =IPU_FW_START_STOP_TIMEOUT ; +void __iomem *base = adev->isp->base; +u32 boot_state, last_boot_state; +u32 indices_addr, msg_ver, id; +struct ia_gofo_version_s ver; +int ret; + + ret =ipu7_boot_cell_init (adev); +if (ret) +return ret; + +dev_dbg (dev,"start booting fw...\n" ); +/* store "uninit" state to syscom/boot state reg */ +write_fw_boot_param (adev,IA_GOFO_FW_BOOT_STATE_ID , +IA_GOFO_FW_BOOT_STATE_UNINIT ); +/* +* Set registers to zero +* (not strictly required, but recommended for diagnostics) +*/ +write_fw_boot_param (adev, +IA_GOFO_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID ,0 ); +write_fw_boot_param (adev,IA_GOFO_FW_BOOT_MESSAGING_VERSION_ID ,0 ); +/* store firmware configuration address */ +write_fw_boot_param (adev,IA_GOFO_FW_BOOT_CONFIG_ID , + adev->boot_config_dma_addr); + +/* Kick uC, then wait for boot complete */ +ipu7_boot_cell_start (adev); + + last_boot_state =IA_GOFO_FW_BOOT_STATE_UNINIT ; +while (timeout--) { + boot_state =read_fw_boot_param (adev, +IA_GOFO_FW_BOOT_STATE_ID ); +if (boot_state != last_boot_state) { +dev_dbg (dev,"boot state changed from 0x%x to 0x%x\n" , + last_boot_state, boot_state); + last_boot_state = boot_state; + } +if (BOOT_STATE_IS_CRITICAL (boot_state) || +BOOT_STATE_IS_READY (boot_state)) +break ; +usleep_range (1000 ,1200 ); + } + +if (BOOT_STATE_IS_CRITICAL (boot_state)) { +ipu7_dump_fw_error_log (adev); +dev_err (dev,"critical boot state error 0x%x\n" , boot_state); +return -EINVAL ; + }else if (!BOOT_STATE_IS_READY (boot_state)) { +dev_err (dev,"fw boot timeout. state: 0x%x\n" , boot_state); +return -ETIMEDOUT ; + } +dev_dbg (dev,"fw boot done.\n" ); + +/* Get FW syscom queue indices addr */ + id =IA_GOFO_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID ; + indices_addr =read_fw_boot_param (adev, id); + adev->syscom->queue_indices = base + indices_addr; +dev_dbg (dev,"fw queue indices offset is 0x%x\n" , indices_addr); + +/* Get message version. */ + msg_ver =read_fw_boot_param (adev, +IA_GOFO_FW_BOOT_MESSAGING_VERSION_ID ); +memcpy (&ver, &msg_ver,sizeof (msg_ver)); +dev_dbg (dev,"ipu message version is %d.%d.%d.%d\n" , + ver.major, ver.minor, ver.subminor, ver.patch); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_boot_start_fw,"INTEL_IPU7" ); + +int ipu7_boot_stop_fw (const struct ipu7_bus_device *adev) +{ +const struct device *dev = &adev->auxdev.dev; +u32 timeout =IPU_FW_START_STOP_TIMEOUT ; +u32 boot_state; + + boot_state =read_fw_boot_param (adev,IA_GOFO_FW_BOOT_STATE_ID ); +if (BOOT_STATE_IS_CRITICAL (boot_state) || + !BOOT_STATE_IS_READY (boot_state)) { +dev_err (dev,"fw not ready for shutdown, state 0x%x\n" , + boot_state); +return -EBUSY ; + } + +/* Issue shutdown to start shutdown process */ +dev_dbg (dev,"stopping fw...\n" ); +write_fw_boot_param (adev,IA_GOFO_FW_BOOT_STATE_ID , +IA_GOFO_FW_BOOT_STATE_SHUTDOWN_CMD ); +while (timeout--) { + boot_state =read_fw_boot_param (adev, +IA_GOFO_FW_BOOT_STATE_ID ); +if (BOOT_STATE_IS_CRITICAL (boot_state) || +BOOT_STATE_IS_INACTIVE (boot_state)) +break ; +usleep_range (1000 ,1200 ); + } + +if (BOOT_STATE_IS_CRITICAL (boot_state)) { +ipu7_dump_fw_error_log (adev); +dev_err (dev,"critical boot state error 0x%x\n" , boot_state); +return -EINVAL ; + }else if (!BOOT_STATE_IS_INACTIVE (boot_state)) { +dev_err (dev,"stop fw timeout. state: 0x%x\n" , boot_state); +return -ETIMEDOUT ; + } + +ipu7_boot_cell_stop (adev); +dev_dbg (dev,"stop fw done.\n" ); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_boot_stop_fw,"INTEL_IPU7" ); + +u32 ipu7_boot_get_boot_state (const struct ipu7_bus_device *adev) +{ +return read_fw_boot_param (adev,IA_GOFO_FW_BOOT_STATE_ID ); +} +EXPORT_SYMBOL_NS_GPL (ipu7_boot_get_boot_state,"INTEL_IPU7" );
drivers/media/pci/intel/ipu7/ipu7-boot.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2022 - 2024 Intel Corporation +*/ + +#include <linux/types.h> + +struct ipu7_bus_device ; +struct syscom_queue_config ; + +#define FW_QUEUE_CONFIG_SIZE (num_queues) \ + (sizeof(struct syscom_queue_config) * (num_queues)) + +int ipu7_boot_init_boot_config (struct ipu7_bus_device *adev, +struct syscom_queue_config *qconfigs, +int num_queues,u32 uc_freq, +dma_addr_t subsys_config,u8 major); +void ipu7_boot_release_boot_config (struct ipu7_bus_device *adev); +int ipu7_boot_start_fw (const struct ipu7_bus_device *adev); +int ipu7_boot_stop_fw (const struct ipu7_bus_device *adev); +u32 ipu7_boot_get_boot_state (const struct ipu7_bus_device *adev);
drivers/media/pci/intel/ipu7/ipu7-cpd.c new file +230 -0
230 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-cpd.h new file +62 -0
62 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-syscom.c new file +79 -0
79 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-syscom.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_SYSCOM_H +#define IPU7_SYSCOM_H + +#include <linux/types.h> + +struct syscom_config_s ; +struct syscom_queue_params_config ; + +struct syscom_queue_config { +void *token_array_mem; +u32 queue_size; +u16 token_size_in_bytes; +u16 max_capacity; +}; + +struct ipu7_syscom_context { +u16 num_input_queues; +u16 num_output_queues; +struct syscom_queue_config *queue_configs; +void __iomem *queue_indices; +dma_addr_t queue_mem_dma_addr; +void *queue_mem; +u32 queue_mem_size; +}; + +void ipu7_syscom_put_token (struct ipu7_syscom_context *ctx,int q); +void *ipu7_syscom_get_token (struct ipu7_syscom_context *ctx,int q); +struct syscom_queue_params_config * +ipu7_syscom_get_queue_config (struct syscom_config_s *config); + +#endif
Signature · 1 line
2.34.1
RFC PATCH 5/7 media: ipu7: add IPU7 firmware ABI headers
In reply to [email protected]From: Bingbu Cao <[email protected]>
IPU7 firmware defines the ABIs between firmware and software, this patch adds a series of ABI headers.
--- .../pci/intel/ipu7/abi/ipu7_fw_boot_abi.h | 164 ++++++ .../pci/intel/ipu7/abi/ipu7_fw_common_abi.h | 243 +++++++++ .../pci/intel/ipu7/abi/ipu7_fw_config_abi.h | 19 + .../intel/ipu7/abi/ipu7_fw_insys_config_abi.h | 19 + .../pci/intel/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++++++++++++++++ .../pci/intel/ipu7/abi/ipu7_fw_msg_abi.h | 509 ++++++++++++++++++ .../intel/ipu7/abi/ipu7_fw_psys_config_abi.h | 22 + .../pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h | 60 +++ 8 files changed, 1531 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_boot_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_common_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_insys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_isys_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_msg_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_psys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h
drivers/media/pci/intel/ipu7/abi/ipu7_fw_boot_abi.h new file +164 -0
@@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2020 - 2024 Intel Corporation +*/ + +#ifndef IPU7_FW_BOOT_ABI_H +#define IPU7_FW_BOOT_ABI_H + +#include "ipu7_fw_common_abi.h" +#include "ipu7_fw_syscom_abi.h" + +#define IA_GOFO_FWLOG_SEVERITY_CRIT (0U) +#define IA_GOFO_FWLOG_SEVERITY_ERROR (1U) +#define IA_GOFO_FWLOG_SEVERITY_WARNING (2U) +#define IA_GOFO_FWLOG_SEVERITY_INFO (3U) +#define IA_GOFO_FWLOG_SEVERITY_DEBUG (4U) +#define IA_GOFO_FWLOG_SEVERITY_VERBOSE (5U) +#define IA_GOFO_FWLOG_MAX_LOGGER_SOURCES (64U) + +#define LOGGER_CONFIG_CHANNEL_ENABLE_HWPRINTF_BITMASK BIT(0) +#define LOGGER_CONFIG_CHANNEL_ENABLE_SYSCOM_BITMASK BIT(1) +#define LOGGER_CONFIG_CHANNEL_ENABLE_ALL_BITMASK \ + (LOGGER_CONFIG_CHANNEL_ENABLE_HWPRINTF_BITMASK | \ + LOGGER_CONFIG_CHANNEL_ENABLE_SYSCOM_BITMASK) + +struct ia_gofo_logger_config { +u8 use_source_severity; +u8 source_severity[IA_GOFO_FWLOG_MAX_LOGGER_SOURCES ]; +u8 use_channels_enable_bitmask; +u8 channels_enable_bitmask; +u8 padding[1 ]; +ia_gofo_addr_t hw_printf_buffer_base_addr; +u32 hw_printf_buffer_size_bytes; +}; + +static inline void ia_gofo_logger_config_abi_test_func (void ) +{ +CHECK_ALIGN32 (struct ia_gofo_logger_config ); +} + +#pragma pack(push, 1) + +#define IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP \ + ((u32)IA_GOFO_FW_BOOT_ID_MAX) +#define IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_IS_OFFSET (0U) +#define IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_PS_OFFSET \ + ((IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_IS_OFFSET) + \ + (u32)(IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP)) +#define IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_PRIMARY_OFFSET (0U) +#define IA_GOFO_CCG_IPU_BUTTRESS_FW_BOOT_PARAMS_SECONDARY_OFFSET (0x3000U / 4U) +#define IA_GOFO_HKR_IPU_BUTTRESS_FW_BOOT_PARAMS_SECONDARY_OFFSET \ + (IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP * 2U) +#define IA_GOFO_HKR_HIF_BUTTRESS_FW_BOOT_PARAMS_SECONDARY_OFFSET \ + (IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP) +#define IA_GOFO_CCG_IPU_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX \ + (IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP * 4U) +#define IA_GOFO_HKR_IPU_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX \ + (IA_GOFO_BUTTRESS_FW_BOOT_PARAMS_MAX_REG_IDX_PER_APP * 4U) + +#define IA_GOFO_BOOT_RESERVED_SIZE (58U) +#define IA_GOFO_BOOT_SECONDARY_RESERVED_SIZE (IA_GOFO_BOOT_RESERVED_SIZE) +#define IA_GOFO_BOOT_SECONDARY_RESERVED_FIELDS \ + (sizeof(ia_gofo_addr_t) + sizeof(ia_gofo_addr_t) + sizeof(u32)) + +enum ia_gofo_buttress_reg_id { +IA_GOFO_FW_BOOT_CONFIG_ID =0 , +IA_GOFO_FW_BOOT_STATE_ID =1 , +IA_GOFO_FW_BOOT_RESERVED1_ID =IA_GOFO_FW_BOOT_STATE_ID , +IA_GOFO_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID =2 , +IA_GOFO_FW_BOOT_UNTRUSTED_ADDR_MIN_ID =3 , +IA_GOFO_FW_BOOT_RESERVED0_ID =IA_GOFO_FW_BOOT_UNTRUSTED_ADDR_MIN_ID , +IA_GOFO_FW_BOOT_MESSAGING_VERSION_ID =4 , +IA_GOFO_FW_BOOT_ID_MAX +}; + +enum ia_gofo_boot_uc_tile_frequency_units { +IA_GOFO_FW_BOOT_UC_FREQUENCY_UNITS_MHZ =0 , +IA_GOFO_FW_BOOT_UC_FREQUENCY_UNITS_KHZ =1 , +IA_GOFO_FW_BOOT_UC_FREQUENCY_UNITS_N +}; + +#define IA_GOFO_FW_BOOT_STATE_IS_CRITICAL (boot_state) \ + (0xdead0000U == ((boot_state) & 0xffff0000U)) + +struct ia_gofo_boot_config { +u32 length; +struct ia_gofo_version_s config_version; +struct ia_gofo_msg_version_list client_version_support; +ia_gofo_addr_t pkg_dir; +ia_gofo_addr_t subsys_config; +u32 uc_tile_frequency; +u16 checksum; +u8 uc_tile_frequency_units; +u8 padding[1 ]; +u32 reserved[IA_GOFO_BOOT_RESERVED_SIZE ]; +struct syscom_config_s syscom_context_config; +}; + +struct ia_gofo_secondary_boot_config { +u32 length; +struct ia_gofo_version_s config_version; +struct ia_gofo_msg_version_list client_version_support; +u8 reserved1[IA_GOFO_BOOT_SECONDARY_RESERVED_FIELDS ]; +u16 checksum; +u8 padding[2 ]; +u32 reserved2[IA_GOFO_BOOT_SECONDARY_RESERVED_SIZE ]; +struct syscom_config_s syscom_context_config; +}; + +#pragma pack(pop) + +static inline void ia_gofo_boot_config_abi_test_func (void ) +{ +CHECK_ALIGN32 (struct ia_gofo_boot_config ); +CHECK_ALIGN32 (struct ia_gofo_secondary_boot_config ); +} + +#define IA_GOFO_WDT_TIMEOUT_ERR 0xdead0401U +#define IA_GOFO_MEM_FATAL_DME_ERR 0xdead0801U +#define IA_GOFO_MEM_UNCORRECTABLE_LOCAL_ERR 0xdead0802U +#define IA_GOFO_MEM_UNCORRECTABLE_DIRTY_ERR 0xdead0803U +#define IA_GOFO_MEM_UNCORRECTABLE_DTAG_ERR 0xdead0804U +#define IA_GOFO_MEM_UNCORRECTABLE_CACHE_ERR 0xdead0805U +#define IA_GOFO_DOUBLE_EXCEPTION_ERR 0xdead0806U +#define IA_GOFO_BIST_DMEM_FAULT_DETECTION_ERR 0xdead1000U +#define IA_GOFO_BIST_DATA_INTEGRITY_FAILURE 0xdead1010U + +enum ia_gofo_boot_state { +IA_GOFO_FW_BOOT_STATE_SECONDARY_BOOT_CONFIG_READY =0x57a7b000U , +IA_GOFO_FW_BOOT_STATE_UNINIT =0x57a7e000U , +IA_GOFO_FW_BOOT_STATE_STARTING_0 =0x57a7d000U , +IA_GOFO_FW_BOOT_STATE_CACHE_INIT_DONE =0x57a7d010U , +IA_GOFO_FW_BOOT_STATE_MEM_INIT_DONE =0x57a7d020U , +IA_GOFO_FW_BOOT_STATE_STACK_INIT_DONE =0x57a7d030U , +IA_GOFO_FW_BOOT_STATE_EARLY_BOOT_DONE =0x57a7d100U , +IA_GOFO_FW_BOOT_STATE_BOOT_CONFIG_START =0x57a7d200U , +IA_GOFO_FW_BOOT_STATE_QUEUE_INIT_DONE =0x57a7d300U , +IA_GOFO_FW_BOOT_STATE_READY =0x57a7e100U , +IA_GOFO_FW_BOOT_STATE_CRIT_UNSPECIFIED =0xdead0001U , +IA_GOFO_FW_BOOT_STATE_CRIT_CFG_PTR =0xdead0101U , +IA_GOFO_FW_BOOT_STATE_CRIT_CFG_VERSION =0xdead0201U , +IA_GOFO_FW_BOOT_STATE_CRIT_MSG_VERSION =0xdead0301U , +IA_GOFO_FW_BOOT_STATE_CRIT_WDT_TIMEOUT =IA_GOFO_WDT_TIMEOUT_ERR , +IA_GOFO_FW_BOOT_STATE_WRONG_DATA_SECTION_UNPACKING =0xdead0501U , +IA_GOFO_FW_BOOT_STATE_WRONG_RO_DATA_SECTION_UNPACKING =0xdead0601U , +IA_GOFO_FW_BOOT_STATE_INVALID_UNTRUSTED_ADDR_MIN =0xdead0701U , +IA_GOFO_FW_BOOT_STATE_CRIT_MEM_FATAL_DME =IA_GOFO_MEM_FATAL_DME_ERR , +IA_GOFO_FW_BOOT_STATE_CRIT_MEM_UNCORRECTABLE_LOCAL = +IA_GOFO_MEM_UNCORRECTABLE_LOCAL_ERR , +IA_GOFO_FW_BOOT_STATE_CRIT_MEM_UNCORRECTABLE_DIRTY = +IA_GOFO_MEM_UNCORRECTABLE_DIRTY_ERR , +IA_GOFO_FW_BOOT_STATE_CRIT_MEM_UNCORRECTABLE_DTAG = +IA_GOFO_MEM_UNCORRECTABLE_DTAG_ERR , +IA_GOFO_FW_BOOT_STATE_CRIT_MEM_UNCORRECTABLE_CACHE = +IA_GOFO_MEM_UNCORRECTABLE_CACHE_ERR , +IA_GOFO_FW_BOOT_STATE_CRIT_DOUBLE_EXCEPTION = +IA_GOFO_DOUBLE_EXCEPTION_ERR , +IA_GOFO_FW_BOOT_STATE_SHUTDOWN_CMD =0x57a7f001U , +IA_GOFO_FW_BOOT_STATE_SHUTDOWN_START =0x57a7e200U , +IA_GOFO_FW_BOOT_STATE_INACTIVE =0x57a7e300U , +IA_GOFO_FW_BOOT_HW_CMD_ACK_TIMEOUT =0x57a7e400U +}; + +#endif
drivers/media/pci/intel/ipu7/abi/ipu7_fw_common_abi.h new file +243 -0
243 lines not on this page · raw message
drivers/media/pci/intel/ipu7/abi/ipu7_fw_config_abi.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2021 - 2024 Intel Corporation +*/ + +#ifndef IPU7_FW_CONFIG_ABI_H +#define IPU7_FW_CONFIG_ABI_H + +#include <linux/types.h> + +#define IPU_CONFIG_ABI_WDT_TIMER_DISABLED 0U +#define IPU_CONFIG_ABI_CMD_TIMER_DISABLED 0U + +struct ipu7_wdt_abi { +u32 wdt_timer1_us; +u32 wdt_timer2_us; +}; + +#endif
drivers/media/pci/intel/ipu7/abi/ipu7_fw_insys_config_abi.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2021 - 2024 Intel Corporation +*/ + +#ifndef IPU7_FW_INSYS_CONFIG_ABI_H +#define IPU7_FW_INSYS_CONFIG_ABI_H + +#include "ipu7_fw_boot_abi.h" +#include "ipu7_fw_config_abi.h" +#include "ipu7_fw_isys_abi.h" + +struct ipu7_insys_config { +u32 timeout_val_ms; +struct ia_gofo_logger_config logger_config; +struct ipu7_wdt_abi wdt_config; +}; + +#endif
drivers/media/pci/intel/ipu7/abi/ipu7_fw_isys_abi.h new file +495 -0
495 lines not on this page · raw message
drivers/media/pci/intel/ipu7/abi/ipu7_fw_msg_abi.h new file +509 -0
509 lines not on this page · raw message
drivers/media/pci/intel/ipu7/abi/ipu7_fw_psys_config_abi.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2020 - 2024 Intel Corporation +*/ + +#ifndef IPU7_PSYS_CONFIG_ABI_H_INCLUDED__ +#define IPU7_PSYS_CONFIG_ABI_H_INCLUDED__ + +#include <linux/types.h> + +#include "ipu7_fw_boot_abi.h" +#include "ipu7_fw_config_abi.h" + +struct ipu7_psys_config { +u32 use_debug_manifest; +u32 timeout_val_ms; +u32 compression_support_enabled; +struct ia_gofo_logger_config logger_config; +struct ipu7_wdt_abi wdt_config; +}; + +#endif
drivers/media/pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH 6/7 media: ipu7: add IPU7 input system device driver
In reply to [email protected]From: Bingbu Cao <[email protected]>
The main input system driver mainly cover the basic hardware setup, v4l2 devices registration, firmware stream interfaces and interrupt handling.
Input system CSI2 receiver is exposed as a v4l2 sub-device. Each CSI2 sub-device represent one single CSI2 hardware port which be linked with external sub-device such camera sensor by linked with ISYS CSI2's sink pad. The CSI2 source pad is linked to the sink pad of video capture device.
Register V4L2 video device and setup the VB2 queues to support video capture. Video streaming callback will trigger the input system driver to construct a input system stream configuration for firmware based on data type and stream ID and then queue buffers to firmware to do capture.
IPU7 CSI-2 D-PHY hardware is a Synopsys DWC MIPI CSI2 Rx IP, the driver program the DPHY to receive MIPI data from camera sensors.
--- drivers/media/pci/intel/ipu7/ipu7-fw-isys.c | 300 +++++ drivers/media/pci/intel/ipu7/ipu7-fw-isys.h | 39 + .../media/pci/intel/ipu7/ipu7-isys-csi-phy.c | 1051 +++++++++++++++ .../media/pci/intel/ipu7/ipu7-isys-csi-phy.h | 16 + .../pci/intel/ipu7/ipu7-isys-csi2-regs.h | 1197 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c | 565 ++++++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h | 73 + .../media/pci/intel/ipu7/ipu7-isys-queue.c | 836 ++++++++++++ .../media/pci/intel/ipu7/ipu7-isys-queue.h | 79 ++ .../media/pci/intel/ipu7/ipu7-isys-subdev.c | 381 ++++++ .../media/pci/intel/ipu7/ipu7-isys-subdev.h | 55 + .../media/pci/intel/ipu7/ipu7-isys-video.c | 1130 ++++++++++++++++ .../media/pci/intel/ipu7/ipu7-isys-video.h | 117 ++ drivers/media/pci/intel/ipu7/ipu7-isys.c | 1170 ++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7-isys.h | 150 +++ 15 files changed, 7159 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.h
drivers/media/pci/intel/ipu7/ipu7-fw-isys.c new file +300 -0
@@ -0,0 +1,300 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#include <linux/cacheflush.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <linux/types.h> + +#include "abi/ipu7_fw_insys_config_abi.h" +#include "abi/ipu7_fw_isys_abi.h" + +#include "ipu7.h" +#include "ipu7-boot.h" +#include "ipu7-bus.h" +#include "ipu7-dma.h" +#include "ipu7-fw-isys.h" +#include "ipu7-isys.h" +#include "ipu7-platform-regs.h" +#include "ipu7-syscom.h" + +static const char send_msg_types[N_IPU_INSYS_SEND_TYPE ][32 ] = { +"STREAM_OPEN" , +"STREAM_START_AND_CAPTURE" , +"STREAM_CAPTURE" , +"STREAM_ABORT" , +"STREAM_FLUSH" , +"STREAM_CLOSE" +}; + +int ipu7_fw_isys_complex_cmd (struct ipu7_isys *isys, +const unsigned int stream_handle, +void *cpu_mapped_buf, +dma_addr_t dma_mapped_buf, +size_t size,u16 send_type) +{ +struct ipu7_syscom_context *ctx = isys->adev->syscom; +struct device *dev = &isys->adev->auxdev.dev; +struct ipu7_insys_send_queue_token *token; + +if (send_type >=N_IPU_INSYS_SEND_TYPE ) +return -EINVAL ; + +dev_dbg (dev,"send_token: %s\n" , send_msg_types[send_type]); + +/* +* Time to flush cache in case we have some payload. Not all messages +* have that +*/ +if (cpu_mapped_buf) +clflush_cache_range (cpu_mapped_buf, size); + + token =ipu7_syscom_get_token (ctx, stream_handle + +IPU_INSYS_INPUT_MSG_QUEUE ); +if (!token) +return -EBUSY ; + + token->addr = dma_mapped_buf; + token->buf_handle = (unsigned long )cpu_mapped_buf; + token->send_type = send_type; + token->stream_id = stream_handle; + token->flag =IPU_INSYS_SEND_QUEUE_TOKEN_FLAG_NONE ; + +ipu7_syscom_put_token (ctx, stream_handle +IPU_INSYS_INPUT_MSG_QUEUE ); +/* now wakeup FW */ +ipu_buttress_wakeup_is_uc (isys->adev->isp); + +return 0 ; +} + +int ipu7_fw_isys_simple_cmd (struct ipu7_isys *isys, +const unsigned int stream_handle,u16 send_type) +{ +return ipu7_fw_isys_complex_cmd (isys, stream_handle,NULL ,0 ,0 , + send_type); +} + +int ipu7_fw_isys_init (struct ipu7_isys *isys) +{ +struct syscom_queue_config *queue_configs; +struct ipu7_bus_device *adev = isys->adev; +struct device *dev = &adev->auxdev.dev; +struct ipu7_insys_config *isys_config; +struct ipu7_syscom_context *syscom; +dma_addr_t isys_config_dma_addr; +unsigned int i, num_queues; +u32 freq; +u8 major; +int ret; + +/* Allocate and init syscom context. */ + syscom =devm_kzalloc (dev,sizeof (struct ipu7_syscom_context ), +GFP_KERNEL ); +if (!syscom) +return -ENOMEM ; + + adev->syscom = syscom; + syscom->num_input_queues =IPU_INSYS_MAX_INPUT_QUEUES ; + syscom->num_output_queues =IPU_INSYS_MAX_OUTPUT_QUEUES ; + num_queues = syscom->num_input_queues + syscom->num_output_queues; + queue_configs =devm_kzalloc (dev,FW_QUEUE_CONFIG_SIZE (num_queues), +GFP_KERNEL ); +if (!queue_configs) { +ipu7_fw_isys_release (isys); +return -ENOMEM ; + } + syscom->queue_configs = queue_configs; + queue_configs[IPU_INSYS_OUTPUT_MSG_QUEUE ].max_capacity = +IPU_ISYS_SIZE_RECV_QUEUE ; + queue_configs[IPU_INSYS_OUTPUT_MSG_QUEUE ].token_size_in_bytes = +sizeof (struct ipu7_insys_resp ); + queue_configs[IPU_INSYS_OUTPUT_LOG_QUEUE ].max_capacity = +IPU_ISYS_SIZE_LOG_QUEUE ; + queue_configs[IPU_INSYS_OUTPUT_LOG_QUEUE ].token_size_in_bytes = +sizeof (struct ipu7_insys_resp ); + queue_configs[IPU_INSYS_OUTPUT_RESERVED_QUEUE ].max_capacity =0 ; + queue_configs[IPU_INSYS_OUTPUT_RESERVED_QUEUE ].token_size_in_bytes =0 ; + + queue_configs[IPU_INSYS_INPUT_DEV_QUEUE ].max_capacity = +IPU_ISYS_MAX_STREAMS ; + queue_configs[IPU_INSYS_INPUT_DEV_QUEUE ].token_size_in_bytes = +sizeof (struct ipu7_insys_send_queue_token ); + +for (i =IPU_INSYS_INPUT_MSG_QUEUE ; i < num_queues; i++) { + queue_configs[i].max_capacity =IPU_ISYS_SIZE_SEND_QUEUE ; + queue_configs[i].token_size_in_bytes = +sizeof (struct ipu7_insys_send_queue_token ); + } + +/* Allocate ISYS subsys config. */ + isys_config =ipu7_dma_alloc (adev,sizeof (struct ipu7_insys_config ), + &isys_config_dma_addr,GFP_KERNEL ,0 ); +if (!isys_config) { +dev_err (dev,"Failed to allocate isys subsys config.\n" ); +ipu7_fw_isys_release (isys); +return -ENOMEM ; + } + isys->subsys_config = isys_config; + isys->subsys_config_dma_addr = isys_config_dma_addr; +memset (isys_config,0 ,sizeof (struct ipu7_insys_config )); + isys_config->logger_config.use_source_severity =0 ; + isys_config->logger_config.use_channels_enable_bitmask =1 ; + isys_config->logger_config.channels_enable_bitmask = +LOGGER_CONFIG_CHANNEL_ENABLE_SYSCOM_BITMASK ; + isys_config->logger_config.hw_printf_buffer_base_addr =0U ; + isys_config->logger_config.hw_printf_buffer_size_bytes =0U ; + isys_config->wdt_config.wdt_timer1_us =0 ; + isys_config->wdt_config.wdt_timer2_us =0 ; + ret =ipu_buttress_get_isys_freq (adev->isp, &freq); +if (ret) { +dev_err (dev,"Failed to get ISYS frequency.\n" ); +ipu7_fw_isys_release (isys); +return ret; + } + +ipu7_dma_sync_single (adev, isys_config_dma_addr, +sizeof (struct ipu7_insys_config )); + + major =is_ipu8 (adev->isp->hw_ver) ?2U :1U ; + ret =ipu7_boot_init_boot_config (adev, queue_configs, num_queues, + freq, isys_config_dma_addr, major); +if (ret) +ipu7_fw_isys_release (isys); + +return ret; +} + +void ipu7_fw_isys_release (struct ipu7_isys *isys) +{ +struct ipu7_bus_device *adev = isys->adev; + +ipu7_boot_release_boot_config (adev); +if (isys->subsys_config) { +ipu7_dma_free (adev, +sizeof (struct ipu7_insys_config ), + isys->subsys_config, + isys->subsys_config_dma_addr,0 ); + isys->subsys_config =NULL ; + isys->subsys_config_dma_addr =0 ; + } +} + +int ipu7_fw_isys_open (struct ipu7_isys *isys) +{ +return ipu7_boot_start_fw (isys->adev); +} + +int ipu7_fw_isys_close (struct ipu7_isys *isys) +{ +return ipu7_boot_stop_fw (isys->adev); +} + +struct ipu7_insys_resp *ipu7_fw_isys_get_resp (struct ipu7_isys *isys) +{ +return ipu7_syscom_get_token (isys->adev->syscom, +IPU_INSYS_OUTPUT_MSG_QUEUE ); +} + +void ipu7_fw_isys_put_resp (struct ipu7_isys *isys) +{ +ipu7_syscom_put_token (isys->adev->syscom,IPU_INSYS_OUTPUT_MSG_QUEUE ); +} + +void ipu7_fw_isys_dump_stream_cfg (struct device *dev, +struct ipu7_insys_stream_cfg *cfg) +{ +unsigned int i; + +dev_dbg (dev,"---------------------------\n" ); +dev_dbg (dev,"IPU_FW_ISYS_STREAM_CFG_DATA\n" ); + +dev_dbg (dev,".port id %d\n" , cfg->port_id); +dev_dbg (dev,".vc %d\n" , cfg->vc); +dev_dbg (dev,".nof_input_pins = %d\n" , cfg->nof_input_pins); +dev_dbg (dev,".nof_output_pins = %d\n" , cfg->nof_output_pins); +dev_dbg (dev,".stream_msg_map = 0x%x\n" , cfg->stream_msg_map); + +for (i =0 ; i < cfg->nof_input_pins; i++) { +dev_dbg (dev,".input_pin[%d]:\n" , i); +dev_dbg (dev,"\t.dt = 0x%0x\n" , + cfg->input_pins[i].dt); +dev_dbg (dev,"\t.disable_mipi_unpacking = %d\n" , + cfg->input_pins[i].disable_mipi_unpacking); +dev_dbg (dev,"\t.dt_rename_mode = %d\n" , + cfg->input_pins[i].dt_rename_mode); +dev_dbg (dev,"\t.mapped_dt = 0x%0x\n" , + cfg->input_pins[i].mapped_dt); +dev_dbg (dev,"\t.input_res = %d x %d\n" , + cfg->input_pins[i].input_res.width, + cfg->input_pins[i].input_res.height); +dev_dbg (dev,"\t.sync_msg_map = 0x%x\n" , + cfg->input_pins[i].sync_msg_map); + } + +for (i =0 ; i < cfg->nof_output_pins; i++) { +dev_dbg (dev,".output_pin[%d]:\n" , i); +dev_dbg (dev,"\t.input_pin_id = %d\n" , + cfg->output_pins[i].input_pin_id); +dev_dbg (dev,"\t.stride = %d\n" , cfg->output_pins[i].stride); +dev_dbg (dev,"\t.send_irq = %d\n" , + cfg->output_pins[i].send_irq); +dev_dbg (dev,"\t.ft = %d\n" , cfg->output_pins[i].ft); + +dev_dbg (dev,"\t.link.buffer_lines = %d\n" , + cfg->output_pins[i].link.buffer_lines); +dev_dbg (dev,"\t.link.foreign_key = %d\n" , + cfg->output_pins[i].link.foreign_key); +dev_dbg (dev,"\t.link.granularity_pointer_update = %d\n" , + cfg->output_pins[i].link.granularity_pointer_update); +dev_dbg (dev,"\t.link.msg_link_streaming_mode = %d\n" , + cfg->output_pins[i].link.msg_link_streaming_mode); +dev_dbg (dev,"\t.link.pbk_id = %d\n" , + cfg->output_pins[i].link.pbk_id); +dev_dbg (dev,"\t.link.pbk_slot_id = %d\n" , + cfg->output_pins[i].link.pbk_slot_id); +dev_dbg (dev,"\t.link.dest = %d\n" , + cfg->output_pins[i].link.dest); +dev_dbg (dev,"\t.link.use_sw_managed = %d\n" , + cfg->output_pins[i].link.use_sw_managed); +dev_dbg (dev,"\t.link.is_snoop = %d\n" , + cfg->output_pins[i].link.is_snoop); + +dev_dbg (dev,"\t.crop.line_top = %d\n" , + cfg->output_pins[i].crop.line_top); +dev_dbg (dev,"\t.crop.line_bottom = %d\n" , + cfg->output_pins[i].crop.line_bottom); + +dev_dbg (dev,"\t.dpcm_enable = %d\n" , + cfg->output_pins[i].dpcm.enable); +dev_dbg (dev,"\t.dpcm.type = %d\n" , + cfg->output_pins[i].dpcm.type); +dev_dbg (dev,"\t.dpcm.predictor = %d\n" , + cfg->output_pins[i].dpcm.predictor); + } +dev_dbg (dev,"---------------------------\n" ); +} + +void ipu7_fw_isys_dump_frame_buff_set (struct device *dev, +struct ipu7_insys_buffset *buf, +unsigned int outputs) +{ +unsigned int i; + +dev_dbg (dev,"--------------------------\n" ); +dev_dbg (dev,"IPU_ISYS_BUFF_SET\n" ); +dev_dbg (dev,".capture_msg_map = %d\n" , buf->capture_msg_map); +dev_dbg (dev,".frame_id = %d\n" , buf->frame_id); +dev_dbg (dev,".skip_frame = %d\n" , buf->skip_frame); + +for (i =0 ; i < outputs; i++) { +dev_dbg (dev,".output_pin[%d]:\n" , i); +dev_dbg (dev,"\t.user_token = %llx\n" , + buf->output_pins[i].user_token); +dev_dbg (dev,"\t.addr = 0x%x\n" , buf->output_pins[i].addr); + } +dev_dbg (dev,"---------------------------\n" ); +}
drivers/media/pci/intel/ipu7/ipu7-fw-isys.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_FW_ISYS_H +#define IPU7_FW_ISYS_H + +#include <linux/types.h> + +#include "abi/ipu7_fw_isys_abi.h" + +struct device ; +struct ipu7_insys_buffset ; +struct ipu7_insys_stream_cfg ; +struct ipu7_isys ; + +/* From here on type defines not coming from the ISYSAPI interface */ + +int ipu7_fw_isys_init (struct ipu7_isys *isys); +void ipu7_fw_isys_release (struct ipu7_isys *isys); +int ipu7_fw_isys_open (struct ipu7_isys *isys); +int ipu7_fw_isys_close (struct ipu7_isys *isys); + +void ipu7_fw_isys_dump_stream_cfg (struct device *dev, +struct ipu7_insys_stream_cfg *cfg); +void ipu7_fw_isys_dump_frame_buff_set (struct device *dev, +struct ipu7_insys_buffset *buf, +unsigned int outputs); +int ipu7_fw_isys_simple_cmd (struct ipu7_isys *isys, +const unsigned int stream_handle,u16 send_type); +int ipu7_fw_isys_complex_cmd (struct ipu7_isys *isys, +const unsigned int stream_handle, +void *cpu_mapped_buf, +dma_addr_t dma_mapped_buf, +size_t size,u16 send_type); +struct ipu7_insys_resp *ipu7_fw_isys_get_resp (struct ipu7_isys *isys); +void ipu7_fw_isys_put_resp (struct ipu7_isys *isys); +#endif
drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.c new file +1051 -0
1,051 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2013 - 2024 Intel Corporation +*/ + +#ifndef IPU7_ISYS_CSI_PHY_H +#define IPU7_ISYS_CSI_PHY_H + +struct ipu7_isys ; + +#define PHY_MODE_DPHY 0U +#define PHY_MODE_CPHY 1U + +int ipu7_isys_csi_phy_powerup (struct ipu7_isys_csi2 *csi2); +void ipu7_isys_csi_phy_powerdown (struct ipu7_isys_csi2 *csi2); +#endif
drivers/media/pci/intel/ipu7/ipu7-isys-csi2-regs.h new file +1197 -0
1,197 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c new file +565 -0
397 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h new file +73 -0
73 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-queue.c new file +836 -0
836 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-queue.h new file +79 -0
79 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-subdev.c new file +381 -0
381 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-subdev.h new file +55 -0
55 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-video.c new file +1130 -0
1,130 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys-video.h new file +117 -0
117 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys.c new file +1170 -0
1,170 lines not on this page · raw message
drivers/media/pci/intel/ipu7/ipu7-isys.h new file +150 -0
150 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
RFC PATCH 7/7 media: ipu7: add Makefile and Kconfig for IPU7
In reply to [email protected]From: Bingbu Cao <[email protected]>
Add Kconfig and Makefile for IPU7 driver and also update the Makefile to build the IPU7 driver.
--- drivers/media/pci/intel/Kconfig | 1 + drivers/media/pci/intel/Makefile | 1 + drivers/media/pci/intel/ipu7/Kconfig | 18 ++++++++++++++++++ drivers/media/pci/intel/ipu7/Makefile | 23 +++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/Kconfig create mode 100644 drivers/media/pci/intel/ipu7/Makefile
drivers/media/pci/intel/Kconfig +1 -0
@@ -2,6 +2,7 @@ source "drivers/media/pci/intel/ipu3/Kconfig" source "drivers/media/pci/intel/ipu6/Kconfig" +source "drivers/media/pci/intel/ipu7/Kconfig" source "drivers/media/pci/intel/ivsc/Kconfig" config IPU_BRIDGE
drivers/media/pci/intel/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_IPU_BRIDGE) += ipu-bridge.o obj-y += ipu3/ obj-y += ivsc/ obj-$(CONFIG_VIDEO_INTEL_IPU6) += ipu6/ +obj-$(CONFIG_VIDEO_INTEL_IPU7) += ipu7/
drivers/media/pci/intel/ipu7/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +config VIDEO_INTEL_IPU7 + tristate "Intel IPU7 driver" + depends on ACPI || COMPILE_TEST + depends on VIDEO_DEV + depends on X86 && X86_64 && HAS_DMA + depends on IPU_BRIDGE || !IPU_BRIDGE + select AUXILIARY_BUS + select IOMMU_IOVA + select VIDEO_V4L2_SUBDEV_API + select MEDIA_CONTROLLER + select VIDEOBUF2_DMA_CONTIG + select V4L2_FWNODE + help + This is the 7th Gen Intel Image Processing Unit, found in Intel SoCs + and used for capturing images and video from camera sensors. + + To compile this driver, say Y here! It contains 2 modules - + intel_ipu7 and intel_ipu7_isys.
drivers/media/pci/intel/ipu7/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2017 - 2024 Intel Corporation. + +intel-ipu7-objs += ipu7.o \ + ipu7-bus.o \ + ipu7-dma.o \ + ipu7-mmu.o \ + ipu7-buttress.o \ + ipu7-cpd.o \ + ipu7-syscom.o \ + ipu7-boot.o + +obj-$(CONFIG_VIDEO_INTEL_IPU7) += intel-ipu7.o + +intel-ipu7-isys-objs += ipu7-isys.o \ + ipu7-isys-csi2.o \ + ipu7-isys-csi-phy.o \ + ipu7-fw-isys.o \ + ipu7-isys-video.o \ + ipu7-isys-queue.o \ + ipu7-isys-subdev.o + +obj-$(CONFIG_VIDEO_INTEL_IPU7) += intel-ipu7-isys.o
Signature · 1 line
2.34.1
Re: [RFC PATCH 7/7] media: ipu7: add Makefile and Kconfig for IPU7
All,
Quoted 42 lines · On 2/21/25 3:52 PM, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Add
KconfigandMakefilefor IPU7 driver and also update theMakefileto build the IPU7 driver.Signed-off-by Bingbu Cao <[email protected]>--- drivers/media/pci/intel/Kconfig | 1 + drivers/media/pci/intel/Makefile | 1 + drivers/media/pci/intel/ipu7/Kconfig | 18 ++++++++++++++++++ drivers/media/pci/intel/ipu7/Makefile | 23 +++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 drivers/media/pci/intel/ipu7/Kconfig create mode 100644 drivers/media/pci/intel/ipu7/Makefiledrivers/media/pci/intel/Kconfig +1
-0@@ -2,6 +2,7 @@ source "drivers/media/pci/intel/ipu3/Kconfig" source "drivers/media/pci/intel/ipu6/Kconfig" +source "drivers/media/pci/intel/ipu7/Kconfig" source "drivers/media/pci/intel/ivsc/Kconfig" config IPU_BRIDGEdrivers/media/pci/intel/Makefile +1
-0@@ -6,3 +6,4 @@ obj-$(CONFIG_IPU_BRIDGE) += ipu-bridge.o obj-y += ipu3/ obj-y += ivsc/ obj-$(CONFIG_VIDEO_INTEL_IPU6) += ipu6/ +obj-$(CONFIG_VIDEO_INTEL_IPU7) += ipu7/drivers/media/pci/intel/ipu7/Kconfig new file +0
-0
drivers/media/pci/intel/ipu7/Kconfig line 5
Quoted 5 lines
drivers/media/pci/intel/ipu7/Kconfig new file +5
-0@@ -0,0 +1,18 @@ +config VIDEO_INTEL_IPU7 + tristate "Intel IPU7 driver" + depends on ACPI || COMPILE_TEST + depends on VIDEO_DEV + depends on X86 && X86_64 && HAS_DMA
depends on X86 && HAS_DMA
drivers/media/pci/intel/ipu7/Kconfig line 11
Quoted 6 lines
drivers/media/pci/intel/ipu7/Kconfig new file +6
-0+ depends on IPU_BRIDGE || !IPU_BRIDGE + select AUXILIARY_BUS + select IOMMU_IOVA + select VIDEO_V4L2_SUBDEV_API + select MEDIA_CONTROLLER + select VIDEOBUF2_DMA_CONTIG
This should be VIDEOBUF2_DMA_SG, I forgot to amend it.
Quoted 37 lines
drivers/media/pci/intel/ipu7/Kconfig new file +7
-0+ select V4L2_FWNODE + help + This is the 7th Gen Intel Image Processing Unit, found in Intel SoCs + and used for capturing images and video from camera sensors. + + To compile this driver, say Y here! It contains 2 modules - + intel_ipu7 and intel_ipu7_isys.drivers/media/pci/intel/ipu7/Makefile new file +23
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2017 - 2024 Intel Corporation. + +intel-ipu7-objs += ipu7.o \ + ipu7-bus.o \ + ipu7-dma.o \ + ipu7-mmu.o \ + ipu7-buttress.o \ + ipu7-cpd.o \ + ipu7-syscom.o \ + ipu7-boot.o + +obj-$(CONFIG_VIDEO_INTEL_IPU7) += intel-ipu7.o + +intel-ipu7-isys-objs += ipu7-isys.o \ + ipu7-isys-csi2.o \ + ipu7-isys-csi-phy.o \ + ipu7-fw-isys.o \ + ipu7-isys-video.o \ + ipu7-isys-queue.o \ + ipu7-isys-subdev.o + +obj-$(CONFIG_VIDEO_INTEL_IPU7) += intel-ipu7-isys.o
Signature · 2 lines
Best regards, Bingbu Cao
Sakari Ailus
maintainerHi Bingbu,
Quoted 11 lines · On Fri, Feb 21, 2025 at 03:52:45PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
This patch series adds a driver for Intel IPU7 input system. IPU7 is the seventh generation of Imaging Processing Unit, it is a PCI device which can be found in some Intel Client Platforms such as Intel Lunar Lake and Panther Lake, etc.
User can use IPU7 to capture images from MIPI camera sensors, support both MIPI CSI DPHY and CPHY.IPU7 input system driver uses MC and V4L2 sub-device APIs besides V4L2.
Quoted 13 lines
-
ipu7.c: the IPU7 PCI device driver probe, basic hardware configuration and initialization
- ipu7-bus: Initialise and register the auxiliary device for IS
- ipu7-buttress: Hardware buttress interfaces to allow driver to program to enable the power, firmware authentication and interrupt handling.
- ipu7-mmu and ipu7-dma: IPU MMU table setup and IPU DMA mapping APIs
- ipu7-cpd and ipu7-boot: firmware format parse and firmware boot flow
- abi: a series of ABI headers used by driver and firmware
- ipu7-syscom: syscom communication interfaces used by driver to queue commands to firmware
- ipu7-isys: main IPU7 input system driver, it registers CSI2 as v4l2 sub-devices and the capture as video devices.
Given that much of the driver code is the same than in the IPU6 driver (in particular split into devices, DMA, MMU and V4L2 / MC API related code), we should share at least that instead of looking to maintain two copies of it separately. The IPU7 driver probably has had a different starting point for development than the current IPU6 driver so there are a fair amount of differences in that code now but it is largely not due to differences in the hardware itself, for instance, the lack of metadata or multiple virtual channel support you listed below.
Quoted 114 lines
TODO list:
1. ABI headers cleanup (currently a copy from firmware as it is still in development and updating regularly, need cleanup to unifiy the headers)
2. add metadata capture support
3. add multiple virtual-channels capture support
4. remove unsecure mode code as secure mode is force to enabled in productBingbu Cao (7):
media: Rename the IPU PCI device table header and add IPU7 PCI IDs
media: ipu7: add Intel IPU7 PCI device driver
media: ipu7: add IPU7 DMA APIs and MMU mapping
media: ipu7: add firmware parse, syscom interface and boot sequence
media: ipu7: add IPU7 firmware ABI headers
media: ipu7: add IPU7 input system device driver
media: ipu7: addMakefileandKconfigfor IPU7drivers/media/pci/intel/Kconfig | 1 + drivers/media/pci/intel/Makefile | 1 + drivers/media/pci/intel/ipu6/ipu6.c | 2 +- drivers/media/pci/intel/ipu7/Kconfig | 18 + drivers/media/pci/intel/ipu7/Makefile | 23 + .../pci/intel/ipu7/abi/ipu7_fw_boot_abi.h | 164 + .../pci/intel/ipu7/abi/ipu7_fw_common_abi.h | 243 ++ .../pci/intel/ipu7/abi/ipu7_fw_config_abi.h | 19 + .../intel/ipu7/abi/ipu7_fw_insys_config_abi.h | 19 + .../pci/intel/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++ .../pci/intel/ipu7/abi/ipu7_fw_msg_abi.h | 509 +++ .../intel/ipu7/abi/ipu7_fw_psys_config_abi.h | 22 + .../pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h | 60 + drivers/media/pci/intel/ipu7/ipu7-boot.c | 434 +++ drivers/media/pci/intel/ipu7/ipu7-boot.h | 21 + drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 + .../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 + drivers/media/pci/intel/ipu7/ipu7-cpd.c | 230 ++ drivers/media/pci/intel/ipu7/ipu7-cpd.h | 62 + drivers/media/pci/intel/ipu7/ipu7-dma.c | 509 +++ drivers/media/pci/intel/ipu7/ipu7-dma.h | 50 + drivers/media/pci/intel/ipu7/ipu7-fw-isys.c | 300 ++ drivers/media/pci/intel/ipu7/ipu7-fw-isys.h | 39 + .../media/pci/intel/ipu7/ipu7-isys-csi-phy.c | 1051 +++++++ .../media/pci/intel/ipu7/ipu7-isys-csi-phy.h | 16 + .../pci/intel/ipu7/ipu7-isys-csi2-regs.h | 1197 +++++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c | 565 ++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h | 73 + .../media/pci/intel/ipu7/ipu7-isys-queue.c | 836 +++++ .../media/pci/intel/ipu7/ipu7-isys-queue.h | 79 + .../media/pci/intel/ipu7/ipu7-isys-subdev.c | 381 +++ .../media/pci/intel/ipu7/ipu7-isys-subdev.h | 55 + .../media/pci/intel/ipu7/ipu7-isys-video.c | 1130 +++++++ .../media/pci/intel/ipu7/ipu7-isys-video.h | 117 + drivers/media/pci/intel/ipu7/ipu7-isys.c | 1170 +++++++ drivers/media/pci/intel/ipu7/ipu7-isys.h | 150 + drivers/media/pci/intel/ipu7/ipu7-mmu.c | 853 +++++ drivers/media/pci/intel/ipu7/ipu7-mmu.h | 414 +++ .../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 + drivers/media/pci/intel/ipu7/ipu7-syscom.c | 79 + drivers/media/pci/intel/ipu7/ipu7-syscom.h | 36 + drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7.h | 244 ++ drivers/media/pci/intel/ivsc/mei_csi.c | 2 +- .../{ipu6-pci-table.h => ipu-pci-table.h} | 14 +- 48 files changed, 16578 insertions(+), 5 deletions(-) create mode 100644 drivers/media/pci/intel/ipu7/Kconfig create mode 100644 drivers/media/pci/intel/ipu7/Makefile create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_boot_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_common_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_insys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_isys_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_msg_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_psys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7.h rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari,
Quoted 26 lines · Sakari Ailus
Quoted 11 lines · On Fri, Feb 21, 2025 at 03:52:45PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
This patch series adds a driver for Intel IPU7 input system. IPU7 is the seventh generation of Imaging Processing Unit, it is a PCI device which can be found in some Intel Client Platforms such as Intel Lunar Lake and Panther Lake, etc.
User can use IPU7 to capture images from MIPI camera sensors, support both MIPI CSI DPHY and CPHY.IPU7 input system driver uses MC and V4L2 sub-device APIs besides V4L2.
Quoted 13 lines
-
ipu7.c: the IPU7 PCI device driver probe, basic hardware configuration and initialization
- ipu7-bus: Initialise and register the auxiliary device for IS
- ipu7-buttress: Hardware buttress interfaces to allow driver to program to enable the power, firmware authentication and interrupt handling.
- ipu7-mmu and ipu7-dma: IPU MMU table setup and IPU DMA mapping APIs
- ipu7-cpd and ipu7-boot: firmware format parse and firmware boot flow
- abi: a series of ABI headers used by driver and firmware
- ipu7-syscom: syscom communication interfaces used by driver to queue commands to firmware
- ipu7-isys: main IPU7 input system driver, it registers CSI2 as v4l2 sub-devices and the capture as video devices.
Quoted 8 lines
Given that much of the driver code is the same than in the IPU6 driver (in particular split into devices, DMA, MMU and V4L2 / MC API related code), we should share at least that instead of looking to maintain two copies of it separately. The IPU7 driver probably has had a different starting point for development than the current IPU6 driver so there are a fair amount of differences in that code now but it is largely not due to differences in the hardware itself, for instance, the lack of metadata or multiple virtual channel support you listed below.
Merging the two drivers in one seems a good idea to me, with lots of upsides, and very few downsides, if any. If there are strong technical reasons why this can't be done we should discuss them.
Quoted 111 lines
Quoted 111 lines
TODO list:
1. ABI headers cleanup (currently a copy from firmware as it is still in development and updating regularly, need cleanup to unifiy the headers)
2. add metadata capture support
3. add multiple virtual-channels capture support
4. remove unsecure mode code as secure mode is force to enabled in productBingbu Cao (7):
media: Rename the IPU PCI device table header and add IPU7 PCI IDs
media: ipu7: add Intel IPU7 PCI device driver
media: ipu7: add IPU7 DMA APIs and MMU mapping
media: ipu7: add firmware parse, syscom interface and boot sequence
media: ipu7: add IPU7 firmware ABI headers
media: ipu7: add IPU7 input system device driver
media: ipu7: addMakefileandKconfigfor IPU7drivers/media/pci/intel/Kconfig | 1 + drivers/media/pci/intel/Makefile | 1 + drivers/media/pci/intel/ipu6/ipu6.c | 2 +- drivers/media/pci/intel/ipu7/Kconfig | 18 + drivers/media/pci/intel/ipu7/Makefile | 23 + .../pci/intel/ipu7/abi/ipu7_fw_boot_abi.h | 164 + .../pci/intel/ipu7/abi/ipu7_fw_common_abi.h | 243 ++ .../pci/intel/ipu7/abi/ipu7_fw_config_abi.h | 19 + .../intel/ipu7/abi/ipu7_fw_insys_config_abi.h | 19 + .../pci/intel/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++ .../pci/intel/ipu7/abi/ipu7_fw_msg_abi.h | 509 +++ .../intel/ipu7/abi/ipu7_fw_psys_config_abi.h | 22 + .../pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h | 60 + drivers/media/pci/intel/ipu7/ipu7-boot.c | 434 +++ drivers/media/pci/intel/ipu7/ipu7-boot.h | 21 + drivers/media/pci/intel/ipu7/ipu7-bus.c | 158 + drivers/media/pci/intel/ipu7/ipu7-bus.h | 69 + .../media/pci/intel/ipu7/ipu7-buttress-regs.h | 465 +++ drivers/media/pci/intel/ipu7/ipu7-buttress.c | 1187 +++++++ drivers/media/pci/intel/ipu7/ipu7-buttress.h | 84 + drivers/media/pci/intel/ipu7/ipu7-cpd.c | 230 ++ drivers/media/pci/intel/ipu7/ipu7-cpd.h | 62 + drivers/media/pci/intel/ipu7/ipu7-dma.c | 509 +++ drivers/media/pci/intel/ipu7/ipu7-dma.h | 50 + drivers/media/pci/intel/ipu7/ipu7-fw-isys.c | 300 ++ drivers/media/pci/intel/ipu7/ipu7-fw-isys.h | 39 + .../media/pci/intel/ipu7/ipu7-isys-csi-phy.c | 1051 +++++++ .../media/pci/intel/ipu7/ipu7-isys-csi-phy.h | 16 + .../pci/intel/ipu7/ipu7-isys-csi2-regs.h | 1197 +++++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c | 565 ++++ drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h | 73 + .../media/pci/intel/ipu7/ipu7-isys-queue.c | 836 +++++ .../media/pci/intel/ipu7/ipu7-isys-queue.h | 79 + .../media/pci/intel/ipu7/ipu7-isys-subdev.c | 381 +++ .../media/pci/intel/ipu7/ipu7-isys-subdev.h | 55 + .../media/pci/intel/ipu7/ipu7-isys-video.c | 1130 +++++++ .../media/pci/intel/ipu7/ipu7-isys-video.h | 117 + drivers/media/pci/intel/ipu7/ipu7-isys.c | 1170 +++++++ drivers/media/pci/intel/ipu7/ipu7-isys.h | 150 + drivers/media/pci/intel/ipu7/ipu7-mmu.c | 853 +++++ drivers/media/pci/intel/ipu7/ipu7-mmu.h | 414 +++ .../media/pci/intel/ipu7/ipu7-platform-regs.h | 146 + drivers/media/pci/intel/ipu7/ipu7-syscom.c | 79 + drivers/media/pci/intel/ipu7/ipu7-syscom.h | 36 + drivers/media/pci/intel/ipu7/ipu7.c | 2791 +++++++++++++++++ drivers/media/pci/intel/ipu7/ipu7.h | 244 ++ drivers/media/pci/intel/ivsc/mei_csi.c | 2 +- .../{ipu6-pci-table.h => ipu-pci-table.h} | 14 +- 48 files changed, 16578 insertions(+), 5 deletions(-) create mode 100644 drivers/media/pci/intel/ipu7/Kconfig create mode 100644 drivers/media/pci/intel/ipu7/Makefile create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_boot_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_common_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_insys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_isys_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_msg_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_psys_config_abi.h create mode 100644 drivers/media/pci/intel/ipu7/abi/ipu7_fw_syscom_abi.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-boot.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-bus.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-buttress.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-cpd.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-dma.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-fw-isys.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi-phy.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-csi2.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-queue.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-subdev.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys-video.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-isys.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-mmu.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-platform-regs.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7-syscom.h create mode 100644 drivers/media/pci/intel/ipu7/ipu7.c create mode 100644 drivers/media/pci/intel/ipu7/ipu7.h rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 8 lines · On Fri, Feb 21, 2025 at 03:52:45PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
This patch series adds a driver for Intel IPU7 input system. IPU7 is the seventh generation of Imaging Processing Unit, it is a PCI device which can be found in some Intel Client Platforms such as Intel Lunar Lake and Panther Lake, etc.
User can use IPU7 to capture images from MIPI camera sensors, support both MIPI CSI DPHY and CPHY.
Minor whitespace nit:
$ git am m/20250221_bingbu_cao_intel_ipu7_pci_and_input_system_device_drivers.mbx Applying: media: Rename the IPU PCI device table header and add IPU7 PCI IDs Applying: media: ipu7: add Intel IPU7 PCI device driver Applying: media: ipu7: add IPU7 DMA APIs and MMU mapping Applying: media: ipu7: add firmware parse, syscom interface and boot sequence .git/rebase-apply/patch:871: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: media: ipu7: add IPU7 firmware ABI headers Applying: media: ipu7: add IPU7 input system device driver Applying: media: ipu7: add Makefile and Kconfig for IPU7