Skip to contentSkip to conversation

Intel IPU7 PCI and input system device drivers

PATCH Superseded [email protected] 4 participants 16 messages Apr 29, 2025 – May 26, 2025

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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.

Sakari suggest during RFC patch review it is better to separate the common code between IPU6 and IPU7 into a standalone module. So it is expected to move this driver out of staging tree in future once the common code separation complete for IPU6.

Bingbu Cao (8):
media: Rename the IPU PCI device table header and add IPU7 PCI IDs
media: staging/ipu7: add Intel IPU7 PCI device driver
media: staging/ipu7: add IPU7 DMA APIs and MMU mapping
media: staging/ipu7: add firmware parse, syscom interface and boot
sequence
media: staging/ipu7: add IPU7 firmware ABI headers
media: staging/ipu7: add IPU7 input system device driver
media: staging/ipu7: add Makefile and Kconfig for IPU7
MAINTAINERS: add maintainers for Intel IPU7 input system driver

 MAINTAINERS                                   |    9 +
 drivers/media/pci/intel/ipu6/ipu6.c           |    2 +-
 drivers/staging/media/Kconfig                 |    2 +
 drivers/staging/media/Makefile                |    1 +
 drivers/staging/media/ipu7/Kconfig            |   18 +
 drivers/staging/media/ipu7/Makefile           |   23 +
 drivers/staging/media/ipu7/TODO               |   13 +
 .../staging/media/ipu7/abi/ipu7_fw_boot_abi.h |  164 +
 .../media/ipu7/abi/ipu7_fw_common_abi.h       |  243 ++
 .../media/ipu7/abi/ipu7_fw_config_abi.h       |   19 +
 .../media/ipu7/abi/ipu7_fw_insys_config_abi.h |   19 +
 .../staging/media/ipu7/abi/ipu7_fw_isys_abi.h |  495 +++
 .../staging/media/ipu7/abi/ipu7_fw_msg_abi.h  |  509 +++
 .../media/ipu7/abi/ipu7_fw_psys_config_abi.h  |   22 +
 .../media/ipu7/abi/ipu7_fw_syscom_abi.h       |   60 +
 drivers/staging/media/ipu7/ipu7-boot.c        |  431 +++
 drivers/staging/media/ipu7/ipu7-boot.h        |   25 +
 drivers/staging/media/ipu7/ipu7-bus.c         |  158 +
 drivers/staging/media/ipu7/ipu7-bus.h         |   69 +
 .../staging/media/ipu7/ipu7-buttress-regs.h   |  463 +++
 drivers/staging/media/ipu7/ipu7-buttress.c    | 1192 +++++++
 drivers/staging/media/ipu7/ipu7-buttress.h    |   77 +
 drivers/staging/media/ipu7/ipu7-cpd.c         |  276 ++
 drivers/staging/media/ipu7/ipu7-cpd.h         |   16 +
 drivers/staging/media/ipu7/ipu7-dma.c         |  477 +++
 drivers/staging/media/ipu7/ipu7-dma.h         |   46 +
 drivers/staging/media/ipu7/ipu7-fw-isys.c     |  301 ++
 drivers/staging/media/ipu7/ipu7-fw-isys.h     |   39 +
 .../staging/media/ipu7/ipu7-isys-csi-phy.c    | 1028 ++++++
 .../staging/media/ipu7/ipu7-isys-csi-phy.h    |   16 +
 .../staging/media/ipu7/ipu7-isys-csi2-regs.h  | 1197 +++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |  542 ++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.h   |   73 +
 drivers/staging/media/ipu7/ipu7-isys-queue.c  |  838 +++++
 drivers/staging/media/ipu7/ipu7-isys-queue.h  |   72 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |  381 +++
 drivers/staging/media/ipu7/ipu7-isys-subdev.h |   55 +
 drivers/staging/media/ipu7/ipu7-isys-video.c  | 1127 +++++++
 drivers/staging/media/ipu7/ipu7-isys-video.h  |  117 +
 drivers/staging/media/ipu7/ipu7-isys.c        | 1170 +++++++
 drivers/staging/media/ipu7/ipu7-isys.h        |  142 +
 drivers/staging/media/ipu7/ipu7-mmu.c         |  853 +++++
 drivers/staging/media/ipu7/ipu7-mmu.h         |  414 +++
 .../staging/media/ipu7/ipu7-platform-regs.h   |  146 +
 drivers/staging/media/ipu7/ipu7-syscom.c      |   78 +
 drivers/staging/media/ipu7/ipu7-syscom.h      |   35 +
 drivers/staging/media/ipu7/ipu7.c             | 2786 +++++++++++++++++
 drivers/staging/media/ipu7/ipu7.h             |  242 ++
 .../{ipu6-pci-table.h => ipu-pci-table.h}     |   14 +-
 49 files changed, 16491 insertions(+), 4 deletions(-)
 create mode 100644 drivers/staging/media/ipu7/Kconfig
 create mode 100644 drivers/staging/media/ipu7/Makefile
 create mode 100644 drivers/staging/media/ipu7/TODO
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_insys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_msg_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_psys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_syscom_abi.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-boot.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-boot.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-bus.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-bus.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-cpd.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-cpd.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-dma.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-dma.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-mmu.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-mmu.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-platform-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-syscom.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-syscom.h
 create mode 100644 drivers/staging/media/ipu7/ipu7.c
 create mode 100644 drivers/staging/media/ipu7/ipu7.h
 rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/8 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 +-
 .../media/{ipu6-pci-table.h => ipu-pci-table.h}    | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
 rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)
drivers/media/pci/intel/ipu6/ipu6.c +1 -1
index 277af7cda8ee..aa859220ba94 100644
@@ -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"
include/media/ipu-pci-table.h renamed from include/media/ipu6-pci-table.h +11 -3
similarity index 68%
rename from include/media/ipu6-pci-table.h
rename to include/media/ipu-pci-table.h
index 0899d9d2f978..528080c6f742 100644
@@ -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
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] media: Rename the IPU PCI device table header and add IPU7 PCI IDs

Quoted 6 lines · On Tue, Apr 29, 2025 at 11:28:34AM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

Rename the IPU PCI device table header file and add the IPU7 PCI device IDs.

Quoted 61 lines
---
 drivers/media/pci/intel/ipu6/ipu6.c                |  2 +-
 .../media/{ipu6-pci-table.h => ipu-pci-table.h}    | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
 rename include/media/{ipu6-pci-table.h => ipu-pci-table.h} (68%)
drivers/media/pci/intel/ipu6/ipu6.c +1 -1
index 277af7cda8ee..aa859220ba94 100644
@@ -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"
include/media/ipu-pci-table.h renamed from include/media/ipu6-pci-table.h +11 -3
similarity index 68%
rename from include/media/ipu6-pci-table.h
rename to include/media/ipu-pci-table.h
index 0899d9d2f978..528080c6f742 100644
@@ -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
#3 lore raw

PATCH 2/8 media: staging/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/staging/media/ipu7/ipu7-bus.c         |  158 +
 drivers/staging/media/ipu7/ipu7-bus.h         |   69 +
 .../staging/media/ipu7/ipu7-buttress-regs.h   |  463 +++
 drivers/staging/media/ipu7/ipu7-buttress.c    | 1192 +++++++
 drivers/staging/media/ipu7/ipu7-buttress.h    |   77 +
 .../staging/media/ipu7/ipu7-platform-regs.h   |  146 +
 drivers/staging/media/ipu7/ipu7.c             | 2786 +++++++++++++++++
 drivers/staging/media/ipu7/ipu7.h             |  242 ++
 8 files changed, 5133 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/ipu7-bus.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-bus.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-buttress.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-platform-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7.c
 create mode 100644 drivers/staging/media/ipu7/ipu7.h
drivers/staging/media/ipu7/ipu7-bus.c new file +158 -0
new file mode 100644
index 000000000000..7da44fde002a
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 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,
+			   const 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/staging/media/ipu7/ipu7-bus.h new file +69 -0

69 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-buttress-regs.h new file +463 -0

463 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-buttress.c new file +1192 -0

1,192 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-buttress.h new file +77 -0

77 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-platform-regs.h new file +146 -0

146 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7.c new file +2786 -0

895 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7.h new file +242 -0

242 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.

Reviewed-by on v1 2/8
#4 lore raw

Re: [PATCH 2/8] media: staging/ipu7: add Intel IPU7 PCI device driver

Quoted 6 lines · On Tue, Apr 29, 2025 at 11:28:35AM +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.

Quoted 6 lines

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.

LGTM in general, some nits below.

drivers/staging/media/ipu7/ipu7-buttress-regs.h line 288

Quoted 7 lines
drivers/staging/media/ipu7/ipu7-buttress-regs.h new file +7 -0
+/* 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,
+};

Used as HW register value, need to be hard-coded constant?

drivers/staging/media/ipu7/ipu7-buttress-regs.h line 364

Quoted 4 lines
drivers/staging/media/ipu7/ipu7-buttress-regs.h new file +4 -0
+#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

No U suffix ?

Quoted 77 lines
drivers/staging/media/ipu7/ipu7-platform-regs.h new file +77 -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

drivers/staging/media/ipu7/ipu7-platform-regs.h line 108

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-platform-regs.h new file +10 -0
+#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

Do we need those defines ?

I think is fine to have unused defines for completeness and possible future usage, but I checked randomly 10 of above and none was referenced.

Regards
Stanislaw

#5 lore raw

PATCH 3/8 media: staging/ipu7: add IPU7 DMA APIs and MMU mapping

In reply to [email protected]

From: Bingbu Cao <[email protected]>

The Intel IPU7 has internal microprocessor which runs the firmware The microprocessor accesses 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/staging/media/ipu7/ipu7-dma.c | 477 ++++++++++++++
 drivers/staging/media/ipu7/ipu7-dma.h |  46 ++
 drivers/staging/media/ipu7/ipu7-mmu.c | 853 ++++++++++++++++++++++++++
 drivers/staging/media/ipu7/ipu7-mmu.h | 414 +++++++++++++
 4 files changed, 1790 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/ipu7-dma.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-dma.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-mmu.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-mmu.h
drivers/staging/media/ipu7/ipu7-dma.c new file +477 -0
new file mode 100644
index 000000000000..a118b41b2f34
@@ -0,0 +1,477 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 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 = 1U << order;
+			while (j--)
+				pages[i + j] = pages[i] + j;
+		}
+
+		__clear_buffer(pages[i], PAGE_SIZE << order, attrs);
+		i += 1U << order;
+		count -= 1U << 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(mmu->dmap->mmu_info->aperture_end), 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) - 1U;
+		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(mmu->dmap->mmu_info->aperture_end),
+				  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");
drivers/staging/media/ipu7/ipu7-dma.h new file +46 -0

46 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-mmu.c new file +853 -0

853 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-mmu.h new file +414 -0

414 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw

PATCH 4/8 media: staging/ipu7: add firmware parse, syscom interface and boot

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/staging/media/ipu7/ipu7-boot.c   | 431 +++++++++++++++++++++++
 drivers/staging/media/ipu7/ipu7-boot.h   |  25 ++
 drivers/staging/media/ipu7/ipu7-cpd.c    | 276 +++++++++++++++
 drivers/staging/media/ipu7/ipu7-cpd.h    |  16 +
 drivers/staging/media/ipu7/ipu7-syscom.c |  78 ++++
 drivers/staging/media/ipu7/ipu7-syscom.h |  35 ++
 6 files changed, 861 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/ipu7-boot.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-boot.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-cpd.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-cpd.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-syscom.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-syscom.h
drivers/staging/media/ipu7/ipu7-boot.c new file +431 -0
new file mode 100644
index 000000000000..2ef54e1eb004
@@ -0,0 +1,431 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022 - 2025 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) ? 0U : (u32)IA_GOFO_FW_BOOT_ID_MAX;
+
+	return BUTTRESS_FW_BOOT_PARAMS_ENTRY(base + (u32)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 & 0x3U) == (val & 0x3U), 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 & 0x3U) == (val & 0x3U), 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;
+	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);
+	dev_dbg(dev, "ipu message version is 0x%08x\n", msg_ver);
+
+	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/staging/media/ipu7/ipu7-boot.h new file +25 -0
new file mode 100644
index 000000000000..5600be849931
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2022 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_BOOT_H
+#define IPU7_BOOT_H
+
+#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);
+#endif
drivers/staging/media/ipu7/ipu7-cpd.c new file +276 -0

276 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-cpd.h new file +16 -0
new file mode 100644
index 000000000000..b4178848c6b9
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2015 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_CPD_H
+#define IPU7_CPD_H
+
+struct ipu7_device;
+
+int ipu7_cpd_validate_cpd_file(struct ipu7_device *isp,
+			       const void *cpd_file,
+			       unsigned long cpd_file_size);
+int ipu7_cpd_copy_binary(const void *cpd, const char *name,
+			 void *code_region, u32 *entry);
+#endif /* IPU7_CPD_H */
drivers/staging/media/ipu7/ipu7-syscom.c new file +78 -0

78 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-syscom.h new file +35 -0
new file mode 100644
index 000000000000..e1fbe3b7914e
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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
#7 lore raw

PATCH 5/8 media: staging/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.

---
 .../staging/media/ipu7/abi/ipu7_fw_boot_abi.h | 164 ++++++
 .../media/ipu7/abi/ipu7_fw_common_abi.h       | 243 +++++++++
 .../media/ipu7/abi/ipu7_fw_config_abi.h       |  19 +
 .../media/ipu7/abi/ipu7_fw_insys_config_abi.h |  19 +
 .../staging/media/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++++++++++++++++
 .../staging/media/ipu7/abi/ipu7_fw_msg_abi.h  | 509 ++++++++++++++++++
 .../media/ipu7/abi/ipu7_fw_psys_config_abi.h  |  22 +
 .../media/ipu7/abi/ipu7_fw_syscom_abi.h       |  60 +++
 8 files changed, 1531 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_insys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_msg_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_psys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_syscom_abi.h
drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h new file +164 -0
new file mode 100644
index 000000000000..8217e173f721
@@ -0,0 +1,164 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 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/staging/media/ipu7/abi/ipu7_fw_common_abi.h new file +243 -0

243 lines not on this page · raw message

drivers/staging/media/ipu7/abi/ipu7_fw_config_abi.h new file +19 -0
new file mode 100644
index 000000000000..c3f62aaedd86
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2021 - 2025 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/staging/media/ipu7/abi/ipu7_fw_insys_config_abi.h new file +19 -0
new file mode 100644
index 000000000000..f161a605c500
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2021 - 2025 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/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +495 -0

495 lines not on this page · raw message

drivers/staging/media/ipu7/abi/ipu7_fw_msg_abi.h new file +509 -0

509 lines not on this page · raw message

drivers/staging/media/ipu7/abi/ipu7_fw_psys_config_abi.h new file +22 -0
new file mode 100644
index 000000000000..ce3e0e5f7ede
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 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/staging/media/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
maintainer
#8 lore raw

Re: [PATCH 5/8] media: staging/ipu7: add IPU7 firmware ABI headers

Hi Bingbu,

Thanks for the set.

I have a few comments below. These could be either addressed now or put to the TODO file.

Quoted 62 lines · On Tue, Apr 29, 2025 at 11:28:38AM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

IPU7 firmware defines the ABIs between firmware and software, this patch adds a series of ABI headers.

---
 .../staging/media/ipu7/abi/ipu7_fw_boot_abi.h | 164 ++++++
 .../media/ipu7/abi/ipu7_fw_common_abi.h       | 243 +++++++++
 .../media/ipu7/abi/ipu7_fw_config_abi.h       |  19 +
 .../media/ipu7/abi/ipu7_fw_insys_config_abi.h |  19 +
 .../staging/media/ipu7/abi/ipu7_fw_isys_abi.h | 495 +++++++++++++++++
 .../staging/media/ipu7/abi/ipu7_fw_msg_abi.h  | 509 ++++++++++++++++++
 .../media/ipu7/abi/ipu7_fw_psys_config_abi.h  |  22 +
 .../media/ipu7/abi/ipu7_fw_syscom_abi.h       |  60 +++
 8 files changed, 1531 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_insys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_msg_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_psys_config_abi.h
 create mode 100644 drivers/staging/media/ipu7/abi/ipu7_fw_syscom_abi.h
drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h new file +31 -0
new file mode 100644
index 000000000000..8217e173f721
@@ -0,0 +1,164 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 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];

drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h line 41

Quoted 10 lines
drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h new file +10 -0
+	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)

Please use __packed for structs where you need it.

Quoted 161 lines
drivers/staging/media/ipu7/abi/ipu7_fw_boot_abi.h new file +123 -0
+
+#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/staging/media/ipu7/abi/ipu7_fw_common_abi.h new file +32 -0
new file mode 100644
index 000000000000..c1f6ac19b813
@@ -0,0 +1,243 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_FW_COMMOM_ABI_H
+#define IPU7_FW_COMMOM_ABI_H
+
+#include <linux/types.h>
+
+#define CHECK_SIZE_ALIGNMENT(struct_type, alignment) do { \
+	const u8 arr[((sizeof(struct_type) % (alignment)) == 0U) ? \
+			  1 : -1]; (void)arr;\
+	} while (false)
+
+#define CHECK_ALIGN16(struct_type) \
+	CHECK_SIZE_ALIGNMENT(struct_type, sizeof(u16))
+#define CHECK_ALIGN32(struct_type) \
+	CHECK_SIZE_ALIGNMENT(struct_type, sizeof(u32))
+#define CHECK_ALIGN64(struct_type) \
+	CHECK_SIZE_ALIGNMENT(struct_type, sizeof(u64))
+
+#define IA_GOFO_CL_SIZE		(64U)
+
+#define CHECK_ALIGN_CL(struct_type) \
+	CHECK_SIZE_ALIGNMENT(struct_type, IA_GOFO_CL_SIZE)
+
+#define IA_GOFO_PAGE_SIZE	(4096U)
+#define IA_GOFO_SRAM_PAGE_SIZE	(256U)
+
+#define CHECK_ALIGN_PAGE(struct_type) \
+	CHECK_SIZE_ALIGNMENT(struct_type, IA_GOFO_PAGE_SIZE)

drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h line 42

Quoted 10 lines
drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h new file +10 -0
+
+#define CHECK_EQUAL(lval, rval) do { \
+	const u8 arr[((lval) == (rval)) ? 1 : -1]; (void)arr;\
+	} while (false)
+
+#define CHECK_SMALLER_OR_EQUAL(lval, rval) do { \
+	const u8 arr[((lval) <= (rval)) ? 1 : -1]; (void)arr;\
+	} while (false)
+
+#define CHECK_SIZE(struct_type, size)	CHECK_EQUAL(sizeof(struct_type), size)

What's the purpose of these macros (with arguments)? Do you need these in the kernel?

Quoted 276 lines
drivers/staging/media/ipu7/abi/ipu7_fw_common_abi.h new file +201 -0
+
+#pragma pack(push, 1)
+typedef u32	ia_gofo_addr_t;
+
+#define IA_GOFO_ADDR_NULL	(0U)
+
+struct ia_gofo_version_s {
+	u8 patch;
+	u8 subminor;
+	u8 minor;
+	u8 major;
+};
+
+#define IA_GOFO_MSG_VERSION_INIT(major_val, minor_val, subminor_val, patch_val)\
+	{.major = (major_val), .minor = (minor_val), .subminor = \
+	(subminor_val), .patch = (patch_val)}
+
+#define IA_GOFO_MSG_VERSION_LIST_MAX_ENTRIES	(3U)
+#define IA_GOFO_MSG_RESERVED_SIZE		(3U)
+
+struct ia_gofo_msg_version_list {
+	u8 num_versions;
+	u8 reserved[IA_GOFO_MSG_RESERVED_SIZE];
+	struct ia_gofo_version_s versions[IA_GOFO_MSG_VERSION_LIST_MAX_ENTRIES];
+};
+
+#pragma pack(pop)
+
+static inline void ia_gofo_common_abi_test_func(void)
+{
+	CHECK_ALIGN32(struct ia_gofo_version_s);
+	CHECK_ALIGN32(struct ia_gofo_msg_version_list);
+}
+
+#define TLV_TYPE_PADDING		(0U)
+
+#pragma pack(push, 1)
+
+#define IA_GOFO_ABI_BITS_PER_BYTE	(8U)
+
+struct ia_gofo_tlv_header {
+	u16 tlv_type;
+	u16 tlv_len32;
+};
+
+struct ia_gofo_tlv_list {
+	u16 num_elems;
+	u16 head_offset;
+};
+
+#define TLV_ITEM_ALIGNMENT	((u32)sizeof(u32))
+#define TLV_MSG_ALIGNMENT	((u32)sizeof(u64))
+#define TLV_LIST_ALIGNMENT	TLV_ITEM_ALIGNMENT
+#pragma pack(pop)
+
+static inline void ia_gofo_msg_tlv_test_func(void)
+{
+	CHECK_ALIGN16(struct ia_gofo_tlv_header);
+	CHECK_ALIGN32(struct ia_gofo_tlv_list);
+}
+
+#define IA_GOFO_MODULO(dividend, divisor) ((dividend) % (divisor))
+
+#define IA_GOFO_MSG_ERR_MAX_DETAILS		(4U)
+#define IA_GOFO_MSG_ERR_OK			(0U)
+#define IA_GOFO_MSG_ERR_UNSPECIFED		(0xffffffffU)
+#define IA_GOFO_MSG_ERR_GROUP_UNSPECIFIED	(0U)
+#define IA_GOFO_MSG_ERR_IS_OK(err)	(IA_GOFO_MSG_ERR_OK == (err).err_code)
+
+#pragma pack(push, 1)
+struct ia_gofo_msg_err {
+	u32 err_group;
+	u32 err_code;
+	u32 err_detail[IA_GOFO_MSG_ERR_MAX_DETAILS];
+};
+
+#pragma pack(pop)
+
+#define IA_GOFO_MSG_ERR_GROUP_APP_EXT_START	(16U)
+#define IA_GOFO_MSG_ERR_GROUP_MAX		(31U)
+#define IA_GOFO_MSG_ERR_GROUP_INTERNAL_START	(IA_GOFO_MSG_ERR_GROUP_MAX + 1U)
+#define IA_GOFO_MSG_ERR_GROUP_RESERVED	IA_GOFO_MSG_ERR_GROUP_UNSPECIFIED
+#define IA_GOFO_MSG_ERR_GROUP_GENERAL		1
+
+static inline void ia_gofo_msg_err_test_func(void)
+{
+	CHECK_ALIGN64(struct ia_gofo_msg_err);
+}
+
+enum ia_gofo_msg_err_general {
+	IA_GOFO_MSG_ERR_GENERAL_OK = IA_GOFO_MSG_ERR_OK,
+	IA_GOFO_MSG_ERR_GENERAL_MSG_TOO_SMALL = 1,
+	IA_GOFO_MSG_ERR_GENERAL_MSG_TOO_LARGE = 2,
+	IA_GOFO_MSG_ERR_GENERAL_DEVICE_STATE = 3,
+	IA_GOFO_MSG_ERR_GENERAL_ALIGNMENT = 4,
+	IA_GOFO_MSG_ERR_GENERAL_INDIRECT_REF_PTR_INVALID = 5,
+	IA_GOFO_MSG_ERR_GENERAL_INVALID_MSG_TYPE = 6,
+	IA_GOFO_MSG_ERR_GENERAL_SYSCOM_FAIL = 7,
+	IA_GOFO_MSG_ERR_GENERAL_N
+};
+
+#pragma pack(push, 1)
+#define IA_GOFO_MSG_TYPE_RESERVED	0
+#define IA_GOFO_MSG_TYPE_INDIRECT	1
+#define IA_GOFO_MSG_TYPE_LOG		2
+#define IA_GOFO_MSG_TYPE_GENERAL_ERR	3
+
+struct ia_gofo_msg_header {
+	struct ia_gofo_tlv_header tlv_header;
+	struct ia_gofo_tlv_list msg_options;
+	u64 user_token;
+};
+
+struct ia_gofo_msg_header_ack {
+	struct ia_gofo_msg_header header;
+	struct ia_gofo_msg_err err;
+
+};
+
+struct ia_gofo_msg_general_err {
+	struct ia_gofo_msg_header_ack header;
+};
+
+#pragma pack(pop)
+
+static inline void ia_gofo_msg_header_test_func(void)
+{
+	CHECK_ALIGN64(struct ia_gofo_msg_header);
+	CHECK_ALIGN64(struct ia_gofo_msg_header_ack);
+	CHECK_ALIGN64(struct ia_gofo_msg_general_err);
+}
+
+#pragma pack(push, 1)
+enum ia_gofo_msg_link_streaming_mode {
+	IA_GOFO_MSG_LINK_STREAMING_MODE_SOFF = 0,
+	IA_GOFO_MSG_LINK_STREAMING_MODE_DOFF = 1,
+	IA_GOFO_MSG_LINK_STREAMING_MODE_BCLM = 2,
+	IA_GOFO_MSG_LINK_STREAMING_MODE_BCSM_FIX = 3,
+	IA_GOFO_MSG_LINK_STREAMING_MODE_N
+};
+
+enum ia_gofo_soc_pbk_instance_id {
+	IA_GOFO_SOC_PBK_ID0 = 0,
+	IA_GOFO_SOC_PBK_ID1 = 1,
+	IA_GOFO_SOC_PBK_ID_N
+};
+
+#define IA_GOFO_MSG_LINK_PBK_MAX_SLOTS	(2U)
+
+struct ia_gofo_msg_indirect {
+	struct ia_gofo_msg_header header;
+	struct ia_gofo_tlv_header ref_header;
+	ia_gofo_addr_t ref_msg_ptr;
+};
+
+#pragma pack(pop)
+
+static inline void ia_gofo_msg_indirect_test_func(void)
+{
+	CHECK_ALIGN64(struct ia_gofo_msg_indirect);
+}
+
+#pragma pack(push, 1)
+#define IA_GOFO_MSG_LOG_MAX_PARAMS	(4U)
+#define IA_GOFO_MSG_LOG_DOC_FMT_ID_MIN	(0U)
+
+#define IA_GOFO_MSG_LOG_DOC_FMT_ID_MAX	(4095U)
+#define IA_GOFO_MSG_LOG_FMT_ID_INVALID	(0xfffffffU)
+
+struct ia_gofo_msg_log_info {
+	u16 log_counter;
+	u8 msg_parameter_types;
+	u8 is_out_of_order;
+	u32 fmt_id;
+	u32 params[IA_GOFO_MSG_LOG_MAX_PARAMS];
+};
+
+struct ia_gofo_msg_log_info_ts {
+	u64 msg_ts;
+	struct ia_gofo_msg_log_info log_info;
+};
+
+struct ia_gofo_msg_log {
+	struct ia_gofo_msg_header header;
+	struct ia_gofo_msg_log_info_ts log_info_ts;
+};
+
+#pragma pack(pop)
+
+static inline void ia_gofo_msg_log_test_func(void)
+{
+	CHECK_ALIGN64(struct ia_gofo_msg_log);
+	CHECK_ALIGN64(struct ia_gofo_msg_log_info);
+	CHECK_ALIGN64(struct ia_gofo_msg_log_info_ts);
+}
+
+#define IA_GOFO_MSG_ABI_OUT_ACK_QUEUE_ID	(0U)
+#define IA_GOFO_MSG_ABI_OUT_LOG_QUEUE_ID	(1U)
+#define IA_GOFO_MSG_ABI_IN_DEV_QUEUE_ID		(2U)
+
+#endif
drivers/staging/media/ipu7/abi/ipu7_fw_config_abi.h new file +19 -0
new file mode 100644
index 000000000000..c3f62aaedd86
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2021 - 2025 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/staging/media/ipu7/abi/ipu7_fw_insys_config_abi.h new file +19 -0
new file mode 100644
index 000000000000..f161a605c500
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2021 - 2025 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/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +19 -0
new file mode 100644
index 000000000000..68ad4496af26
@@ -0,0 +1,495 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_FW_ISYS_ABI_H
+#define IPU7_FW_ISYS_ABI_H
+
+#include "ipu7_fw_common_abi.h"
+#include "ipu7_fw_isys_abi.h"
+
+#define IPU_INSYS_MAX_OUTPUT_QUEUES	(3U)
+#define IPU_INSYS_STREAM_ID_MAX		(16U)
+
+#define IPU_INSYS_MAX_INPUT_QUEUES	(IPU_INSYS_STREAM_ID_MAX + 1U)
+#define IPU_INSYS_OUTPUT_FIRST_QUEUE	(0U)
+#define IPU_INSYS_OUTPUT_LAST_QUEUE	(IPU_INSYS_MAX_OUTPUT_QUEUES - 1U)
+#define IPU_INSYS_OUTPUT_MSG_QUEUE	(IPU_INSYS_OUTPUT_FIRST_QUEUE)
+#define IPU_INSYS_OUTPUT_LOG_QUEUE	(IPU_INSYS_OUTPUT_FIRST_QUEUE + 1U)

drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h line 29

Quoted 10 lines
drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +10 -0
+#define IPU_INSYS_OUTPUT_RESERVED_QUEUE	(IPU_INSYS_OUTPUT_LAST_QUEUE)
+#define IPU_INSYS_INPUT_FIRST_QUEUE	(IPU_INSYS_MAX_OUTPUT_QUEUES)
+#define IPU_INSYS_INPUT_LAST_QUEUE \
+	(IPU_INSYS_INPUT_FIRST_QUEUE + IPU_INSYS_MAX_INPUT_QUEUES - 1U)
+#define IPU_INSYS_INPUT_DEV_QUEUE	(IPU_INSYS_INPUT_FIRST_QUEUE)
+#define IPU_INSYS_INPUT_MSG_QUEUE	(IPU_INSYS_INPUT_FIRST_QUEUE + 1U)
+#define IPU_INSYS_INPUT_MSG_MAX_QUEUE	(IPU_INSYS_MAX_INPUT_QUEUES - 1U)
+
+#define MAX_IPINS			(4U)
+#define MAX_OPINS			(4U)

These macros need "IPU7_" prefix. Please use elsewhere, too. Or are they the same as for IPU6?

Quoted 162 lines
drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +162 -0
+
+#define MAX_OPINS_FOR_SINGLE_IPINS	(3U)
+#define DEV_SEND_QUEUE_SIZE		(IPU_INSYS_STREAM_ID_MAX)
+
+#define PIN_PLANES_MAX			(4U)
+
+#define INSYS_MSG_ERR_STREAM_INSUFFICIENT_RESOURCES_INPUT \
+	INSYS_MSG_ERR_STREAM_INSUFFICIENT_RESOURCES
+
+typedef u64 ipu7_insys_return_token;
+
+enum ipu7_insys_resp_type {
+	IPU_INSYS_RESP_TYPE_STREAM_OPEN_DONE = 0,
+	IPU_INSYS_RESP_TYPE_STREAM_START_AND_CAPTURE_ACK = 1,
+	IPU_INSYS_RESP_TYPE_STREAM_CAPTURE_ACK = 2,
+	IPU_INSYS_RESP_TYPE_STREAM_ABORT_ACK = 3,
+	IPU_INSYS_RESP_TYPE_STREAM_FLUSH_ACK = 4,
+	IPU_INSYS_RESP_TYPE_STREAM_CLOSE_ACK = 5,
+	IPU_INSYS_RESP_TYPE_PIN_DATA_READY = 6,
+	IPU_INSYS_RESP_TYPE_FRAME_SOF = 7,
+	IPU_INSYS_RESP_TYPE_FRAME_EOF = 8,
+	IPU_INSYS_RESP_TYPE_STREAM_START_AND_CAPTURE_DONE = 9,
+	IPU_INSYS_RESP_TYPE_STREAM_CAPTURE_DONE = 10,
+	IPU_INSYS_RESP_TYPE_PWM_IRQ = 11,
+	N_IPU_INSYS_RESP_TYPE
+};
+
+enum ipu7_insys_send_type {
+	IPU_INSYS_SEND_TYPE_STREAM_OPEN = 0,
+	IPU_INSYS_SEND_TYPE_STREAM_START_AND_CAPTURE = 1,
+	IPU_INSYS_SEND_TYPE_STREAM_CAPTURE = 2,
+	IPU_INSYS_SEND_TYPE_STREAM_ABORT = 3,
+	IPU_INSYS_SEND_TYPE_STREAM_FLUSH = 4,
+	IPU_INSYS_SEND_TYPE_STREAM_CLOSE = 5,
+	N_IPU_INSYS_SEND_TYPE
+};
+
+enum ipu7_insys_mipi_vc {
+	IPU_INSYS_MIPI_VC_0 = 0,
+	IPU_INSYS_MIPI_VC_1 = 1,
+	IPU_INSYS_MIPI_VC_2 = 2,
+	IPU_INSYS_MIPI_VC_3 = 3,
+	IPU_INSYS_MIPI_VC_4 = 4,
+	IPU_INSYS_MIPI_VC_5 = 5,
+	IPU_INSYS_MIPI_VC_6 = 6,
+	IPU_INSYS_MIPI_VC_7 = 7,
+	IPU_INSYS_MIPI_VC_8 = 8,
+	IPU_INSYS_MIPI_VC_9 = 9,
+	IPU_INSYS_MIPI_VC_10 = 10,
+	IPU_INSYS_MIPI_VC_11 = 11,
+	IPU_INSYS_MIPI_VC_12 = 12,
+	IPU_INSYS_MIPI_VC_13 = 13,
+	IPU_INSYS_MIPI_VC_14 = 14,
+	IPU_INSYS_MIPI_VC_15 = 15,
+	N_IPU_INSYS_MIPI_VC
+};
+
+enum ipu7_insys_mipi_port {
+	IPU_INSYS_MIPI_PORT_0 = 0,
+	IPU_INSYS_MIPI_PORT_1 = 1,
+	IPU_INSYS_MIPI_PORT_2 = 2,
+	IPU_INSYS_MIPI_PORT_3 = 3,
+	IPU_INSYS_MIPI_PORT_4 = 4,
+	IPU_INSYS_MIPI_PORT_5 = 5,
+	NA_IPU_INSYS_MIPI_PORT
+};
+
+enum ipu7_insys_frame_format_type {
+	IPU_INSYS_FRAME_FORMAT_NV11 = 0,
+	IPU_INSYS_FRAME_FORMAT_NV12 = 1,
+	IPU_INSYS_FRAME_FORMAT_NV12_16 = 2,
+	IPU_INSYS_FRAME_FORMAT_NV12_TILEY = 3,
+	IPU_INSYS_FRAME_FORMAT_NV16 = 4,
+	IPU_INSYS_FRAME_FORMAT_NV21 = 5,
+	IPU_INSYS_FRAME_FORMAT_NV61 = 6,
+	IPU_INSYS_FRAME_FORMAT_YV12 = 7,
+	IPU_INSYS_FRAME_FORMAT_YV16 = 8,
+	IPU_INSYS_FRAME_FORMAT_YUV420 = 9,
+	IPU_INSYS_FRAME_FORMAT_YUV420_10 = 10,
+	IPU_INSYS_FRAME_FORMAT_YUV420_12 = 11,
+	IPU_INSYS_FRAME_FORMAT_YUV420_14 = 12,
+	IPU_INSYS_FRAME_FORMAT_YUV420_16 = 13,
+	IPU_INSYS_FRAME_FORMAT_YUV422 = 14,
+	IPU_INSYS_FRAME_FORMAT_YUV422_16 = 15,
+	IPU_INSYS_FRAME_FORMAT_UYVY = 16,
+	IPU_INSYS_FRAME_FORMAT_YUYV = 17,
+	IPU_INSYS_FRAME_FORMAT_YUV444 = 18,
+	IPU_INSYS_FRAME_FORMAT_YUV_LINE = 19,
+	IPU_INSYS_FRAME_FORMAT_RAW8 = 20,
+	IPU_INSYS_FRAME_FORMAT_RAW10 = 21,
+	IPU_INSYS_FRAME_FORMAT_RAW12 = 22,
+	IPU_INSYS_FRAME_FORMAT_RAW14 = 23,
+	IPU_INSYS_FRAME_FORMAT_RAW16 = 24,
+	IPU_INSYS_FRAME_FORMAT_RGB565 = 25,
+	IPU_INSYS_FRAME_FORMAT_PLANAR_RGB888 = 26,
+	IPU_INSYS_FRAME_FORMAT_RGBA888 = 27,
+	IPU_INSYS_FRAME_FORMAT_QPLANE6 = 28,
+	IPU_INSYS_FRAME_FORMAT_BINARY_8 = 29,
+	IPU_INSYS_FRAME_FORMAT_Y_8 = 30,
+	IPU_INSYS_FRAME_FORMAT_ARGB888 = 31,
+	IPU_INSYS_FRAME_FORMAT_BGRA888 = 32,
+	IPU_INSYS_FRAME_FORMAT_ABGR888 = 33,
+	N_IPU_INSYS_FRAME_FORMAT
+};
+
+#define IPU_INSYS_FRAME_FORMAT_RAW (IPU_INSYS_FRAME_FORMAT_RAW16)
+
+enum ipu7_insys_mipi_data_type {
+	IPU_INSYS_MIPI_DATA_TYPE_FRAME_START_CODE = 0x00,
+	IPU_INSYS_MIPI_DATA_TYPE_FRAME_END_CODE = 0x01,
+	IPU_INSYS_MIPI_DATA_TYPE_LINE_START_CODE = 0x02,
+	IPU_INSYS_MIPI_DATA_TYPE_LINE_END_CODE = 0x03,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x04 = 0x04,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x05 = 0x05,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x06 = 0x06,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x07 = 0x07,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT1 = 0x08,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT2 = 0x09,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT3 = 0x0a,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT4 = 0x0b,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT5 = 0x0c,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT6 = 0x0d,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT7 = 0x0e,
+	IPU_INSYS_MIPI_DATA_TYPE_GENERIC_SHORT8 = 0x0f,
+	IPU_INSYS_MIPI_DATA_TYPE_NULL = 0x10,
+	IPU_INSYS_MIPI_DATA_TYPE_BLANKING_DATA = 0x11,
+	IPU_INSYS_MIPI_DATA_TYPE_EMBEDDED = 0x12,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x13 = 0x13,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x14 = 0x14,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x15 = 0x15,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x16 = 0x16,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x17 = 0x17,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV420_8 = 0x18,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV420_10 = 0x19,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV420_8_LEGACY = 0x1a,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x1B = 0x1b,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV420_8_SHIFT = 0x1c,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV420_10_SHIFT = 0x1d,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV422_8 = 0x1e,
+	IPU_INSYS_MIPI_DATA_TYPE_YUV422_10 = 0x1f,
+	IPU_INSYS_MIPI_DATA_TYPE_RGB_444 = 0x20,
+	IPU_INSYS_MIPI_DATA_TYPE_RGB_555 = 0x21,
+	IPU_INSYS_MIPI_DATA_TYPE_RGB_565 = 0x22,
+	IPU_INSYS_MIPI_DATA_TYPE_RGB_666 = 0x23,
+	IPU_INSYS_MIPI_DATA_TYPE_RGB_888 = 0x24,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x25 = 0x25,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x26 = 0x26,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x27 = 0x27,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_6 = 0x28,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_7 = 0x29,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_8 = 0x2a,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_10 = 0x2b,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_12 = 0x2c,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_14 = 0x2d,
+	IPU_INSYS_MIPI_DATA_TYPE_RAW_16 = 0x2e,
+	IPU_INSYS_MIPI_DATA_TYPE_BINARY_8 = 0x2f,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF1 = 0x30,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF2 = 0x31,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF3 = 0x32,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF4 = 0x33,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF5 = 0x34,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF6 = 0x35,

drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h line 201

Quoted 10 lines
drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +10 -0
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF7 = 0x36,
+	IPU_INSYS_MIPI_DATA_TYPE_USER_DEF8 = 0x37,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x38 = 0x38,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x39 = 0x39,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3A = 0x3a,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3B = 0x3b,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3C = 0x3c,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3D = 0x3d,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3E = 0x3e,
+	IPU_INSYS_MIPI_DATA_TYPE_RESERVED_0x3F = 0x3f,

Do you need all these? See also include/media/mipi-csi2.h.

Quoted 903 lines
drivers/staging/media/ipu7/abi/ipu7_fw_isys_abi.h new file +294 -0
+	N_IPU_INSYS_MIPI_DATA_TYPE = 0x40
+};
+
+enum ipu7_insys_mipi_dt_rename_mode {
+	IPU_INSYS_MIPI_DT_NO_RENAME = 0,
+	IPU_INSYS_MIPI_DT_RENAMED_MODE = 1,
+	N_IPU_INSYS_MIPI_DT_MODE
+};
+
+#define IPU_INSYS_SEND_MSG_ENABLED				1U
+#define IPU_INSYS_SEND_MSG_DISABLED				0U
+
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_SOF			BIT(0)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_EOF			BIT(1)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_SOF			BIT(2)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_EOF			BIT(3)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_SOF_DISCARDED	BIT(4)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_EOF_DISCARDED	BIT(5)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_SOF_DISCARDED	BIT(6)
+#define IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_EOF_DISCARDED	BIT(7)
+#define IPU_INSYS_STREAM_SYNC_MSG_ENABLE_MSG_SEND_RESP ( \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_SOF | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_EOF | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_SOF_DISCARDED | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_RESP_EOF_DISCARDED)
+#define IPU_INSYS_STREAM_SYNC_MSG_ENABLE_MSG_SEND_IRQ ( \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_SOF | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_EOF | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_SOF_DISCARDED | \
+	IPU_INSYS_STREAM_SYNC_MSG_SEND_IRQ_EOF_DISCARDED)
+
+#define IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_OPEN_DONE		BIT(0)
+#define IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_OPEN_DONE		BIT(1)
+#define IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_START_ACK		BIT(2)
+#define IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_START_ACK		BIT(3)
+#define IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_CLOSE_ACK		BIT(4)
+#define IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_CLOSE_ACK		BIT(5)
+#define IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_FLUSH_ACK		BIT(6)
+#define IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_FLUSH_ACK		BIT(7)
+#define IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_ABORT_ACK		BIT(8)
+#define IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_ABORT_ACK		BIT(9)
+#define IPU_INSYS_STREAM_ENABLE_MSG_SEND_RESP ( \
+	IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_OPEN_DONE | \
+	IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_START_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_CLOSE_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_FLUSH_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_RESP_STREAM_ABORT_ACK)
+#define IPU_INSYS_STREAM_ENABLE_MSG_SEND_IRQ ( \
+	IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_OPEN_DONE | \
+	IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_START_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_CLOSE_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_FLUSH_ACK | \
+	IPU_INSYS_STREAM_MSG_SEND_IRQ_STREAM_ABORT_ACK)
+
+#define IPU_INSYS_FRAME_MSG_SEND_RESP_CAPTURE_ACK		BIT(0)
+#define IPU_INSYS_FRAME_MSG_SEND_IRQ_CAPTURE_ACK		BIT(1)
+#define IPU_INSYS_FRAME_MSG_SEND_RESP_CAPTURE_DONE		BIT(2)
+#define IPU_INSYS_FRAME_MSG_SEND_IRQ_CAPTURE_DONE		BIT(3)
+#define IPU_INSYS_FRAME_MSG_SEND_RESP_PIN_DATA_READY		BIT(4)
+#define IPU_INSYS_FRAME_MSG_SEND_IRQ_PIN_DATA_READY		BIT(5)
+#define IPU_INSYS_FRAME_ENABLE_MSG_SEND_RESP ( \
+	IPU_INSYS_FRAME_MSG_SEND_RESP_CAPTURE_ACK | \
+	IPU_INSYS_FRAME_MSG_SEND_RESP_CAPTURE_DONE | \
+	IPU_INSYS_FRAME_MSG_SEND_RESP_PIN_DATA_READY)
+#define IPU_INSYS_FRAME_ENABLE_MSG_SEND_IRQ ( \
+	IPU_INSYS_FRAME_MSG_SEND_IRQ_CAPTURE_ACK | \
+	IPU_INSYS_FRAME_MSG_SEND_IRQ_CAPTURE_DONE | \
+	IPU_INSYS_FRAME_MSG_SEND_IRQ_PIN_DATA_READY)
+
+enum ipu7_insys_output_link_dest {
+	IPU_INSYS_OUTPUT_LINK_DEST_MEM = 0,
+	IPU_INSYS_OUTPUT_LINK_DEST_PSYS = 1,
+	IPU_INSYS_OUTPUT_LINK_DEST_IPU_EXTERNAL = 2
+};
+
+enum ipu7_insys_dpcm_type {
+	IPU_INSYS_DPCM_TYPE_DISABLED = 0,
+	IPU_INSYS_DPCM_TYPE_10_8_10 = 1,
+	IPU_INSYS_DPCM_TYPE_12_8_12 = 2,
+	IPU_INSYS_DPCM_TYPE_12_10_12 = 3,
+	N_IPU_INSYS_DPCM_TYPE
+};
+
+enum ipu7_insys_dpcm_predictor {
+	IPU_INSYS_DPCM_PREDICTOR_1 = 0,
+	IPU_INSYS_DPCM_PREDICTOR_2 = 1,
+	N_IPU_INSYS_DPCM_PREDICTOR
+};
+
+enum ipu7_insys_send_queue_token_flag {
+	IPU_INSYS_SEND_QUEUE_TOKEN_FLAG_NONE = 0,
+	IPU_INSYS_SEND_QUEUE_TOKEN_FLAG_FLUSH_FORCE = 1
+};
+
+#pragma pack(push, 1)
+struct ipu7_insys_resolution {
+	u32 width;
+	u32 height;
+};
+
+struct ipu7_insys_capture_output_pin_payload {
+	u64 user_token;
+	ia_gofo_addr_t addr;
+	u8 pad[4];
+};
+
+struct ipu7_insys_output_link {
+	u32 buffer_lines;
+	u16 foreign_key;
+	u16 granularity_pointer_update;
+	u8 msg_link_streaming_mode;
+	u8 pbk_id;
+	u8 pbk_slot_id;
+	u8 dest;
+	u8 use_sw_managed;
+	u8 is_snoop;
+	u8 pad[2];
+};
+
+struct ipu7_insys_output_cropping {
+	u16 line_top;
+	u16 line_bottom;
+};
+
+struct ipu7_insys_output_dpcm {
+	u8 enable;
+	u8 type;
+	u8 predictor;
+	u8 pad;
+};
+
+struct ipu7_insys_output_pin {
+	struct ipu7_insys_output_link link;
+	struct ipu7_insys_output_cropping crop;
+	struct ipu7_insys_output_dpcm dpcm;
+	u32 stride;
+	u16 ft;
+	u8 send_irq;
+	u8 input_pin_id;
+	u8 early_ack_en;
+	u8 pad[3];
+};
+
+struct ipu7_insys_input_pin {
+	struct ipu7_insys_resolution input_res;
+	u16 sync_msg_map;
+	u8 dt;
+	u8 disable_mipi_unpacking;
+	u8 dt_rename_mode;
+	u8 mapped_dt;
+	u8 pad[2];
+};
+
+struct ipu7_insys_stream_cfg {
+	struct ipu7_insys_input_pin input_pins[MAX_IPINS];
+	struct ipu7_insys_output_pin output_pins[MAX_OPINS];
+	u16 stream_msg_map;
+	u8 port_id;
+	u8 vc;
+	u8 nof_input_pins;
+	u8 nof_output_pins;
+	u8 pad[2];
+};
+
+struct ipu7_insys_buffset {
+	struct ipu7_insys_capture_output_pin_payload output_pins[MAX_OPINS];
+	u8 capture_msg_map;
+	u8 frame_id;
+	u8 skip_frame;
+	u8 pad[5];
+};
+
+struct ipu7_insys_resp {
+	u64 buf_id;
+	struct ipu7_insys_capture_output_pin_payload pin;
+	struct ia_gofo_msg_err error_info;
+	u32 timestamp[2];
+	u8 type;
+	u8 msg_link_streaming_mode;
+	u8 stream_id;
+	u8 pin_id;
+	u8 frame_id;
+	u8 skip_frame;
+	u8 pad[2];
+};
+
+struct ipu7_insys_resp_queue_token {
+	struct ipu7_insys_resp resp_info;
+};
+
+struct ipu7_insys_send_queue_token {
+	u64 buf_handle;
+	ia_gofo_addr_t addr;
+	u16 stream_id;
+	u8 send_type;
+	u8 flag;
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_insys_types_test_func(void)
+{
+	CHECK_ALIGN32(struct ipu7_insys_resolution);
+	CHECK_ALIGN64(struct ipu7_insys_capture_output_pin_payload);
+	CHECK_ALIGN32(struct ipu7_insys_output_pin);
+	CHECK_ALIGN32(struct ipu7_insys_input_pin);
+	CHECK_ALIGN32(struct ipu7_insys_output_cropping);
+	CHECK_ALIGN32(struct ipu7_insys_stream_cfg);
+	CHECK_ALIGN64(struct ipu7_insys_buffset);
+	CHECK_ALIGN64(struct ipu7_insys_resp);
+	CHECK_ALIGN64(struct ipu7_insys_resp_queue_token);
+	CHECK_ALIGN64(struct ipu7_insys_send_queue_token);
+	CHECK_ALIGN32(struct ipu7_insys_output_link);
+}
+
+enum insys_msg_err_stream {
+	INSYS_MSG_ERR_STREAM_OK = IA_GOFO_MSG_ERR_OK,
+	INSYS_MSG_ERR_STREAM_STREAM_ID = 1,
+	INSYS_MSG_ERR_STREAM_MAX_OPINS = 2,
+	INSYS_MSG_ERR_STREAM_MAX_IPINS = 3,
+	INSYS_MSG_ERR_STREAM_STREAM_MESSAGES_MAP = 4,
+	INSYS_MSG_ERR_STREAM_SYNC_MESSAGES_MAP = 5,
+	INSYS_MSG_ERR_STREAM_SENSOR_TYPE = 6,
+	INSYS_MSG_ERR_STREAM_FOREIGN_KEY = 7,
+	INSYS_MSG_ERR_STREAM_STREAMING_MODE = 8,
+	INSYS_MSG_ERR_STREAM_DPCM_EN = 9,
+	INSYS_MSG_ERR_STREAM_DPCM_TYPE = 10,
+	INSYS_MSG_ERR_STREAM_DPCM_PREDICTOR = 11,
+	INSYS_MSG_ERR_STREAM_GRANULARITY_POINTER_UPDATE = 12,
+	INSYS_MSG_ERR_STREAM_MPF_LUT_ENTRY_RESOURCES_BUSY = 13,
+	INSYS_MSG_ERR_STREAM_MPF_DEV_ID = 14,
+	INSYS_MSG_ERR_STREAM_BUFFER_LINES = 15,
+	INSYS_MSG_ERR_STREAM_IPIN_ID = 16,
+	INSYS_MSG_ERR_STREAM_DATA_TYPE = 17,
+	INSYS_MSG_ERR_STREAM_STREAMING_PROTOCOL_STATE = 18,
+	INSYS_MSG_ERR_STREAM_SYSCOM_FLUSH = 19,
+	INSYS_MSG_ERR_STREAM_MIPI_VC = 20,
+	INSYS_MSG_ERR_STREAM_STREAM_SRC = 21,
+	INSYS_MSG_ERR_STREAM_PBK_ID = 22,
+	INSYS_MSG_ERR_STREAM_CMD_QUEUE_DEALLOCATE = 23,
+	INSYS_MSG_ERR_STREAM_INSUFFICIENT_RESOURCES = 24,
+	INSYS_MSG_ERR_STREAM_IPIN_CONFIGURATION = 25,
+	INSYS_MSG_ERR_STREAM_INVALID_STATE = 26,
+	INSYS_MSG_ERR_STREAM_SW_MANAGED = 27,
+	INSYS_MSG_ERR_STREAM_PBK_SLOT_ID = 28,
+	INSYS_MSG_ERR_STREAM_FLUSH_TIMEOUT = 29,
+	INSYS_MSG_ERR_STREAM_IPIN_WIDTH = 30,
+	INSYS_MSG_ERR_STREAM_IPIN_HEIGHT = 31,
+	INSYS_MSG_ERR_STREAM_OUTPUT_PIN_EARLY_ACK_EN = 32,
+	INSYS_MSG_ERR_STREAM_INCONSISTENT_PARAMS = 33,
+	INSYS_MSG_ERR_STREAM_PLANE_COUNT = 34,
+	INSYS_MSG_ERR_STREAM_FRAME_FORMAT_TYPE = 35,
+	INSYS_MSG_ERR_STREAM_INSUFFICIENT_RESOURCES_OUTPUT = 36,
+	INSYS_MSG_ERR_STREAM_N
+};
+
+enum insys_msg_err_capture {
+	INSYS_MSG_ERR_CAPTURE_OK = IA_GOFO_MSG_ERR_OK,
+	INSYS_MSG_ERR_CAPTURE_STREAM_ID = 1,
+	INSYS_MSG_ERR_CAPTURE_PAYLOAD_PTR = 2,
+	INSYS_MSG_ERR_CAPTURE_MEM_SLOT = 3,
+	INSYS_MSG_ERR_CAPTURE_STREAMING_MODE = 4,
+	INSYS_MSG_ERR_CAPTURE_AVAILABLE_CMD_SLOT = 5,
+	INSYS_MSG_ERR_CAPTURE_CONSUMED_CMD_SLOT = 6,
+	INSYS_MSG_ERR_CAPTURE_CMD_SLOT_PAYLOAD_PTR = 7,
+	INSYS_MSG_ERR_CAPTURE_CMD_PREPARE = 8,
+	INSYS_MSG_ERR_CAPTURE_OUTPUT_PIN = 9,
+	INSYS_MSG_ERR_CAPTURE_SYNC_FRAME_DROP = 10,
+	INSYS_MSG_ERR_CAPTURE_FRAME_MESSAGES_MAP = 11,
+	INSYS_MSG_ERR_CAPTURE_TIMEOUT = 12,
+	INSYS_MSG_ERR_CAPTURE_INVALID_STREAM_STATE = 13,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_MULTIBIT_PH_ERROR_DETECTED = 14,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_PAYLOAD_CRC_ERROR = 15,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_INPUT_DATA_LOSS_ELASTIC_FIFO_OVFL  = 16,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_PIXEL_BUFFER_OVERFLOW = 17,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_BAD_FRAME_DIM = 18,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_PHY_SYNC_ERR = 19,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_SECURE_TOUCH = 20,
+	INSYS_MSG_ERR_CAPTURE_HW_ERR_MASTER_SLAVE_SYNC_ERR = 21,
+	INSYS_MSG_ERR_CAPTURE_FRAME_SKIP_ERR = 22,
+	INSYS_MSG_ERR_CAPTURE_FE_INPUT_FIFO_OVERFLOW_ERR = 23,
+	INSYS_MSG_ERR_CAPTURE_CMD_SUBMIT_TO_HW = 24,
+	INSYS_MSG_ERR_CAPTURE_N
+};
+
+enum insys_msg_err_groups {
+	INSYS_MSG_ERR_GROUP_RESERVED = IA_GOFO_MSG_ERR_GROUP_RESERVED,
+	INSYS_MSG_ERR_GROUP_GENERAL = IA_GOFO_MSG_ERR_GROUP_GENERAL,
+	INSYS_MSG_ERR_GROUP_STREAM = 2,
+	INSYS_MSG_ERR_GROUP_CAPTURE = 3,
+	INSYS_MSG_ERR_GROUP_N,
+};
+
+#endif
drivers/staging/media/ipu7/abi/ipu7_fw_msg_abi.h new file +509 -0
new file mode 100644
index 000000000000..de159a4d8702
@@ -0,0 +1,509 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_FW_MSG_ABI_H
+#define IPU7_FW_MSG_ABI_H
+
+#include "ipu7_fw_common_abi.h"
+
+#pragma pack(push, 1)
+enum ipu7_msg_type {
+	IPU_MSG_TYPE_RESERVED = IA_GOFO_MSG_TYPE_RESERVED,
+	IPU_MSG_TYPE_INDIRECT = IA_GOFO_MSG_TYPE_INDIRECT,
+	IPU_MSG_TYPE_DEV_LOG = IA_GOFO_MSG_TYPE_LOG,
+	IPU_MSG_TYPE_GENERAL_ERR = IA_GOFO_MSG_TYPE_GENERAL_ERR,
+	IPU_MSG_TYPE_DEV_OPEN = 4,
+	IPU_MSG_TYPE_DEV_OPEN_ACK = 5,
+	IPU_MSG_TYPE_GRAPH_OPEN = 6,
+	IPU_MSG_TYPE_GRAPH_OPEN_ACK = 7,
+	IPU_MSG_TYPE_TASK_REQ = 8,
+	IPU_MSG_TYPE_TASK_DONE = 9,
+	IPU_MSG_TYPE_GRAPH_CLOSE = 10,
+	IPU_MSG_TYPE_GRAPH_CLOSE_ACK = 11,
+	IPU_MSG_TYPE_DEV_CLOSE = 12,
+	IPU_MSG_TYPE_DEV_CLOSE_ACK = 13,
+	IPU_MSG_TYPE_TERM_EVENT = 14,
+	IPU_MSG_TYPE_N,
+};
+
+#define IPU_MSG_MAX_NODE_TERMS		(64U)
+#define IPU_MSG_MAX_FRAGS		(7U)
+
+enum ipu7_msg_node_type {
+	IPU_MSG_NODE_TYPE_PAD = 0,
+	IPU_MSG_NODE_TYPE_BASE,
+	IPU_MSG_NODE_TYPE_N
+};
+
+#define IPU_MSG_NODE_MAX_DEVICES	(128U)
+#define DEB_NUM_UINT32	(IPU_MSG_NODE_MAX_DEVICES / (sizeof(u32) * 8U))
+
+typedef u32 ipu7_msg_teb_t[2];
+typedef u32 ipu7_msg_deb_t[DEB_NUM_UINT32];
+
+#define IPU_MSG_NODE_MAX_ROUTE_ENABLES	(128U)
+#define RBM_NUM_UINT32	(IPU_MSG_NODE_MAX_ROUTE_ENABLES / (sizeof(u32) * 8U))
+
+typedef u32 ipu7_msg_rbm_t[RBM_NUM_UINT32];
+
+enum ipu7_msg_node_profile_type {
+	IPU_MSG_NODE_PROFILE_TYPE_PAD = 0,
+	IPU_MSG_NODE_PROFILE_TYPE_BASE,
+	IPU_MSG_NODE_PROFILE_TYPE_CB,
+	IPU_MSG_NODE_PROFILE_TYPE_N
+};
+
+struct ipu7_msg_node_profile {
+	struct ia_gofo_tlv_header tlv_header;
+	ipu7_msg_teb_t teb;
+};
+
+struct ipu7_msg_cb_profile {
+	struct ipu7_msg_node_profile profile_base;
+	ipu7_msg_deb_t deb;
+	ipu7_msg_rbm_t rbm;
+	ipu7_msg_rbm_t reb;
+};
+
+#define IPU_MSG_NODE_MAX_PROFILES	(2U)
+#define IPU_MSG_NODE_DEF_PROFILE_IDX	(0U)
+#define IPU_MSG_NODE_RSRC_ID_EXT_IP	(0xffU)
+
+#define IPU_MSG_NODE_DONT_CARE_TEB_HI	(0xffffffffU)
+#define IPU_MSG_NODE_DONT_CARE_TEB_LO	(0xffffffffU)
+#define IPU_MSG_NODE_RSRC_ID_IS		(0xfeU)
+
+struct ipu7_msg_node {
+	struct ia_gofo_tlv_header tlv_header;
+	u8 node_rsrc_id;
+	u8 node_ctx_id;
+	u8 num_frags;
+	u8 reserved[1];
+	struct ia_gofo_tlv_list profiles_list;
+	struct ia_gofo_tlv_list terms_list;
+	struct ia_gofo_tlv_list node_options;
+};
+
+enum ipu7_msg_node_option_types {
+	IPU_MSG_NODE_OPTION_TYPES_PADDING = 0,
+	IPU_MSG_NODE_OPTION_TYPES_N
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_node_test_func(void)
+{
+	CHECK_ALIGN32(struct ipu7_msg_node);
+	CHECK_ALIGN32(struct ipu7_msg_node_profile);
+	CHECK_ALIGN32(struct ipu7_msg_cb_profile);
+}
+
+#pragma pack(push, 1)
+
+enum ipu7_msg_link_type {
+	IPU_MSG_LINK_TYPE_PAD = 0,
+	IPU_MSG_LINK_TYPE_GENERIC = 1,
+	IPU_MSG_LINK_TYPE_N
+};
+
+enum ipu7_msg_link_option_types {
+	IPU_MSG_LINK_OPTION_TYPES_PADDING = 0,
+	IPU_MSG_LINK_OPTION_TYPES_CMPRS = 1,
+	IPU_MSG_LINK_OPTION_TYPES_N
+};
+
+enum ipu7_msg_link_cmprs_option_bit_depth {
+	IPU_MSG_LINK_CMPRS_OPTION_8BPP = 0,
+	IPU_MSG_LINK_CMPRS_OPTION_10BPP = 1,
+	IPU_MSG_LINK_CMPRS_OPTION_12BPP = 2,
+};
+
+#define IPU_MSG_LINK_CMPRS_SPACE_SAVING_DENOM		(128U)
+#define IPU_MSG_LINK_CMPRS_LOSSY_CFG_PAYLOAD_SIZE	(5U)
+#define IPU_MSG_LINK_CMPRS_SPACE_SAVING_NUM_MAX \
+	(IPU_MSG_LINK_CMPRS_SPACE_SAVING_DENOM - 1U)
+
+struct ipu7_msg_link_cmprs_plane_desc {
+	u8 plane_enable;
+	u8 cmprs_enable;
+	u8 encoder_plane_id;
+	u8 decoder_plane_id;
+	u8 cmprs_is_lossy;
+	u8 cmprs_is_footprint;
+	u8 bit_depth;
+	u8 space_saving_numerator;
+	u32 pixels_offset;
+	u32 ts_offset;
+	u32 tile_row_to_tile_row_stride;
+	u32 rows_of_tiles;
+	u32 lossy_cfg[IPU_MSG_LINK_CMPRS_LOSSY_CFG_PAYLOAD_SIZE];
+};
+
+#define IPU_MSG_LINK_CMPRS_MAX_PLANES		(2U)
+#define IPU_MSG_LINK_CMPRS_NO_ALIGN_INTERVAL	(0U)
+#define IPU_MSG_LINK_CMPRS_MIN_ALIGN_INTERVAL	(16U)
+#define IPU_MSG_LINK_CMPRS_MAX_ALIGN_INTERVAL	(1024U)
+struct ipu7_msg_link_cmprs_option {
+	struct ia_gofo_tlv_header header;
+	u32 cmprs_buf_size;
+	u16 align_interval;
+	u8 reserved[2];
+	struct ipu7_msg_link_cmprs_plane_desc plane_descs[2];
+};
+
+struct ipu7_msg_link_ep {
+	u8 node_ctx_id;
+	u8 term_id;
+};
+
+struct ipu7_msg_link_ep_pair {
+	struct ipu7_msg_link_ep ep_src;
+	struct ipu7_msg_link_ep ep_dst;
+};
+
+#define IPU_MSG_LINK_FOREIGN_KEY_NONE		(65535U)
+#define IPU_MSG_LINK_FOREIGN_KEY_MAX		(64U)
+#define IPU_MSG_LINK_PBK_ID_DONT_CARE		(255U)
+#define IPU_MSG_LINK_PBK_SLOT_ID_DONT_CARE	(255U)
+#define IPU_MSG_LINK_TERM_ID_DONT_CARE		(0xffU)
+
+struct ipu7_msg_link {
+	struct ia_gofo_tlv_header tlv_header;
+	struct ipu7_msg_link_ep_pair endpoints;
+	u16 foreign_key;
+	u8 streaming_mode;
+	u8 pbk_id;
+	u8 pbk_slot_id;
+	u8 delayed_link;
+	u8 reserved[2];
+	struct ia_gofo_tlv_list link_options;
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_abi_link_test_func(void)
+{
+	CHECK_ALIGN32(struct ipu7_msg_link);
+	CHECK_ALIGN32(struct ipu7_msg_link_cmprs_option);
+	CHECK_ALIGN32(struct ipu7_msg_link_cmprs_plane_desc);
+}
+
+enum ipu7_msg_dev_state {
+	IPU_MSG_DEV_STATE_CLOSED = 0,
+	IPU_MSG_DEV_STATE_OPEN_WAIT = 1,
+	IPU_MSG_DEV_STATE_OPEN = 2,
+	IPU_MSG_DEV_STATE_CLOSE_WAIT = 3,
+	IPU_MSG_DEV_STATE_N
+};
+
+enum ipu7_msg_graph_state {
+	IPU_MSG_GRAPH_STATE_CLOSED = 0,
+	IPU_MSG_GRAPH_STATE_OPEN_WAIT = 1,
+	IPU_MSG_GRAPH_STATE_OPEN = 2,
+	IPU_MSG_GRAPH_STATE_CLOSE_WAIT = 3,
+	IPU_MSG_GRAPH_STATE_N
+};
+
+enum ipu7_msg_task_state {
+	IPU_MSG_TASK_STATE_DONE = 0,
+	IPU_MSG_TASK_STATE_WAIT_DONE = 1,
+	IPU_MSG_TASK_STATE_N
+};
+
+enum ipu7_msg_err_groups {
+	IPU_MSG_ERR_GROUP_RESERVED = IA_GOFO_MSG_ERR_GROUP_RESERVED,
+	IPU_MSG_ERR_GROUP_GENERAL = IA_GOFO_MSG_ERR_GROUP_GENERAL,
+	IPU_MSG_ERR_GROUP_DEVICE = 2,
+	IPU_MSG_ERR_GROUP_GRAPH = 3,
+	IPU_MSG_ERR_GROUP_TASK = 4,
+	IPU_MSG_ERR_GROUP_N,
+};
+
+#pragma pack(push, 1)
+struct ipu7_msg_task {
+	struct ia_gofo_msg_header header;
+	u8 graph_id;
+	u8 profile_idx;
+	u8 node_ctx_id;
+	u8 frame_id;
+	u8 frag_id;
+	u8 req_done_msg;
+	u8 req_done_irq;
+	u8 reserved[1];
+	ipu7_msg_teb_t payload_reuse_bm;
+	ia_gofo_addr_t term_buffers[IPU_MSG_MAX_NODE_TERMS];
+};
+
+struct ipu7_msg_task_done {
+	struct ia_gofo_msg_header_ack header;
+	u8 graph_id;
+	u8 frame_id;
+	u8 node_ctx_id;
+	u8 profile_idx;
+	u8 frag_id;
+	u8 reserved[3];
+};
+
+enum ipu7_msg_err_task {
+	IPU_MSG_ERR_TASK_OK = IA_GOFO_MSG_ERR_OK,
+	IPU_MSG_ERR_TASK_GRAPH_ID = 1,
+	IPU_MSG_ERR_TASK_NODE_CTX_ID = 2,
+	IPU_MSG_ERR_TASK_PROFILE_IDX = 3,
+	IPU_MSG_ERR_TASK_CTX_MEMORY_TASK = 4,
+	IPU_MSG_ERR_TASK_TERM_PAYLOAD_PTR = 5,
+	IPU_MSG_ERR_TASK_FRAME_ID = 6,
+	IPU_MSG_ERR_TASK_FRAG_ID = 7,
+	IPU_MSG_ERR_TASK_EXEC_EXT = 8,
+	IPU_MSG_ERR_TASK_EXEC_SBX = 9,
+	IPU_MSG_ERR_TASK_EXEC_INT = 10,
+	IPU_MSG_ERR_TASK_EXEC_UNKNOWN = 11,
+	IPU_MSG_ERR_TASK_N
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_task_test_func(void)
+{
+	CHECK_ALIGN64(struct ipu7_msg_task);
+	CHECK_ALIGN64(struct ipu7_msg_task_done);
+	CHECK_ALIGN32(struct ipu7_msg_link_cmprs_option);
+}
+
+#pragma pack(push, 1)
+enum ipu7_msg_term_type {
+	IPU_MSG_TERM_TYPE_PAD = 0,
+	IPU_MSG_TERM_TYPE_BASE,
+	IPU_MSG_TERM_TYPE_N,
+};
+
+#define IPU_MSG_TERM_EVENT_TYPE_NONE		0U
+#define IPU_MSG_TERM_EVENT_TYPE_PROGRESS	1U
+#define IPU_MSG_TERM_EVENT_TYPE_N	(IPU_MSG_TERM_EVENT_TYPE_PROGRESS + 1U)
+
+struct ipu7_msg_term {
+	struct ia_gofo_tlv_header tlv_header;
+	u8 term_id;
+	u8 event_req_bm;
+	u8 reserved[2];
+	u32 payload_size;
+	struct ia_gofo_tlv_list term_options;
+};
+
+enum ipu7_msg_term_option_types {
+	IPU_MSG_TERM_OPTION_TYPES_PADDING = 0,
+	IPU_MSG_TERM_OPTION_TYPES_N
+};
+
+struct ipu7_msg_term_event {
+	struct ia_gofo_msg_header header;
+	u8 graph_id;
+	u8 frame_id;
+	u8 node_ctx_id;
+	u8 profile_idx;
+	u8 frag_id;
+	u8 term_id;
+	u8 event_type;
+	u8 reserved[1];
+	u64 event_ts;
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_term_test_func(void)
+{
+	CHECK_ALIGN32(struct ipu7_msg_term);
+	CHECK_ALIGN64(struct ipu7_msg_term_event);
+}
+
+#pragma pack(push, 1)
+#define IPU_MSG_DEVICE_SEND_MSG_ENABLED		1U
+#define IPU_MSG_DEVICE_SEND_MSG_DISABLED	0U
+
+#define IPU_MSG_DEVICE_OPEN_SEND_RESP		BIT(0)
+#define IPU_MSG_DEVICE_OPEN_SEND_IRQ		BIT(1)
+
+#define IPU_MSG_DEVICE_CLOSE_SEND_RESP		BIT(0)
+#define IPU_MSG_DEVICE_CLOSE_SEND_IRQ		BIT(1)
+
+struct ipu7_msg_dev_open {
+	struct ia_gofo_msg_header header;
+	u32 max_graphs;
+	u8 dev_msg_map;
+	u8 enable_power_gating;
+	u8 reserved[2];
+};
+
+struct ipu7_msg_dev_open_ack {
+	struct ia_gofo_msg_header_ack header;
+};
+
+struct ipu7_msg_dev_close {
+	struct ia_gofo_msg_header header;
+	u8 dev_msg_map;
+	u8 reserved[7];
+};
+
+struct ipu7_msg_dev_close_ack {
+	struct ia_gofo_msg_header_ack header;
+};
+
+enum ipu7_msg_err_device {
+	IPU_MSG_ERR_DEVICE_OK = IA_GOFO_MSG_ERR_OK,
+	IPU_MSG_ERR_DEVICE_MAX_GRAPHS = 1,
+	IPU_MSG_ERR_DEVICE_MSG_MAP = 2,
+	IPU_MSG_ERR_DEVICE_N
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_device_test_func(void)
+{
+	CHECK_ALIGN32(struct ia_gofo_version_s);
+	CHECK_ALIGN64(struct ipu7_msg_dev_open);
+	CHECK_ALIGN64(struct ipu7_msg_dev_open_ack);
+	CHECK_ALIGN64(struct ipu7_msg_dev_close);
+	CHECK_ALIGN64(struct ipu7_msg_dev_close_ack);
+}
+
+#pragma pack(push, 1)
+#define IPU_MSG_GRAPH_ID_UNKNOWN	(0xffU)
+#define IPU_MSG_GRAPH_SEND_MSG_ENABLED	1U
+#define IPU_MSG_GRAPH_SEND_MSG_DISABLED	0U
+
+#define IPU_MSG_GRAPH_OPEN_SEND_RESP	BIT(0)
+#define IPU_MSG_GRAPH_OPEN_SEND_IRQ	BIT(1)
+
+#define IPU_MSG_GRAPH_CLOSE_SEND_RESP	BIT(0)
+#define IPU_MSG_GRAPH_CLOSE_SEND_IRQ	BIT(1)
+
+struct ipu7_msg_graph_open {
+	struct ia_gofo_msg_header header;
+	struct ia_gofo_tlv_list nodes;
+	struct ia_gofo_tlv_list links;
+	u8 graph_id;
+	u8 graph_msg_map;
+	u8 reserved[6];
+};
+
+enum ipu7_msg_graph_ack_option_types {
+	IPU_MSG_GRAPH_ACK_OPTION_TYPES_PADDING = 0,
+	IPU_MSG_GRAPH_ACK_TASK_Q_INFO,
+	IPU_MSG_GRAPH_ACK_OPTION_TYPES_N
+};
+
+struct ipu7_msg_graph_open_ack_task_q_info {
+	struct ia_gofo_tlv_header header;
+	u8 node_ctx_id;
+	u8 q_id;
+	u8 reserved[2];
+};
+
+struct ipu7_msg_graph_open_ack {
+	struct ia_gofo_msg_header_ack header;
+	u8 graph_id;
+	u8 reserved[7];
+};
+
+struct ipu7_msg_graph_close {
+	struct ia_gofo_msg_header header;
+	u8 graph_id;
+	u8 graph_msg_map;
+	u8 reserved[6];
+};
+
+struct ipu7_msg_graph_close_ack {
+	struct ia_gofo_msg_header_ack header;
+	u8 graph_id;
+	u8 reserved[7];
+};
+
+enum ipu7_msg_err_graph {
+	IPU_MSG_ERR_GRAPH_OK = IA_GOFO_MSG_ERR_OK,
+	IPU_MSG_ERR_GRAPH_GRAPH_STATE = 1,
+	IPU_MSG_ERR_GRAPH_MAX_GRAPHS = 2,
+	IPU_MSG_ERR_GRAPH_GRAPH_ID = 3,
+	IPU_MSG_ERR_GRAPH_NODE_CTX_ID = 4,
+	IPU_MSG_ERR_GRAPH_NODE_RSRC_ID = 5,
+	IPU_MSG_ERR_GRAPH_PROFILE_IDX = 6,
+	IPU_MSG_ERR_GRAPH_TERM_ID = 7,
+	IPU_MSG_ERR_GRAPH_TERM_PAYLOAD_SIZE = 8,
+	IPU_MSG_ERR_GRAPH_LINK_NODE_CTX_ID = 9,
+	IPU_MSG_ERR_GRAPH_LINK_TERM_ID = 10,
+	IPU_MSG_ERR_GRAPH_PROFILE_TYPE = 11,
+	IPU_MSG_ERR_GRAPH_NUM_FRAGS = 12,
+	IPU_MSG_ERR_GRAPH_QUEUE_ID_USAGE = 13,
+	IPU_MSG_ERR_GRAPH_QUEUE_OPEN = 14,
+	IPU_MSG_ERR_GRAPH_QUEUE_CLOSE = 15,
+	IPU_MSG_ERR_GRAPH_QUEUE_ID_TASK_REQ_MISMATCH = 16,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_FGRAPH = 17,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_NODE = 18,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_NODE_PROFILE = 19,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_TERM = 20,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_LINK = 21,
+	IPU_MSG_ERR_GRAPH_CTX_MSG_MAP = 22,
+	IPU_MSG_ERR_GRAPH_CTX_FOREIGN_KEY = 23,
+	IPU_MSG_ERR_GRAPH_CTX_STREAMING_MODE = 24,
+	IPU_MSG_ERR_GRAPH_CTX_PBK_RSRC = 25,
+	IPU_MSG_ERR_GRAPH_UNSUPPORTED_EVENT_TYPE = 26,
+	IPU_MSG_ERR_GRAPH_TOO_MANY_EVENTS = 27,
+	IPU_MSG_ERR_GRAPH_CTX_MEMORY_CMPRS = 28,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_ALIGN_INTERVAL = 29,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_PLANE_ID = 30,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_UNSUPPORTED_MODE = 31,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_BIT_DEPTH = 32,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_STRIDE_ALIGNMENT = 33,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_SUB_BUFFER_ALIGNMENT = 34,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_LAYOUT_ORDER = 35,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_LAYOUT_OVERLAP = 36,
+	IPU_MSG_ERR_GRAPH_CTX_CMPRS_BUFFER_TOO_SMALL = 37,
+	IPU_MSG_ERR_GRAPH_CTX_DELAYED_LINK = 38,
+	IPU_MSG_ERR_GRAPH_N
+};
+
+#pragma pack(pop)
+
+static inline void ipu7_msg_graph_test_func(void)
+{
+	CHECK_ALIGN64(struct ipu7_msg_graph_open);
+	CHECK_ALIGN64(struct ipu7_msg_graph_open_ack);
+	CHECK_ALIGN64(struct ipu7_msg_graph_close);
+	CHECK_ALIGN64(struct ipu7_msg_graph_close_ack);
+	CHECK_ALIGN32(struct ipu7_msg_graph_open_ack_task_q_info);
+}
+
+#define FWPS_MSG_ABI_MAX_INPUT_QUEUES	(60U)
+#define FWPS_MSG_ABI_MAX_OUTPUT_QUEUES	(2U)
+#define FWPS_MSG_ABI_MAX_QUEUES \
+	(FWPS_MSG_ABI_MAX_OUTPUT_QUEUES + FWPS_MSG_ABI_MAX_INPUT_QUEUES)
+
+#define FWPS_MSG_ABI_OUT_ACK_QUEUE_ID	(IA_GOFO_MSG_ABI_OUT_ACK_QUEUE_ID)
+#define FWPS_MSG_ABI_OUT_LOG_QUEUE_ID	(IA_GOFO_MSG_ABI_OUT_LOG_QUEUE_ID)
+#if (FWPS_MSG_ABI_OUT_LOG_QUEUE_ID >= FWPS_MSG_ABI_MAX_OUTPUT_QUEUES)
+#error "Maximum output queues configuration is too small to fit ACK and LOG \
+queues"
+#endif
+#define FWPS_MSG_ABI_IN_DEV_QUEUE_ID	(IA_GOFO_MSG_ABI_IN_DEV_QUEUE_ID)
+#define FWPS_MSG_ABI_IN_RESERVED_QUEUE_ID	(3U)
+#define FWPS_MSG_ABI_IN_FIRST_TASK_QUEUE_ID \
+	(FWPS_MSG_ABI_IN_RESERVED_QUEUE_ID + 1U)
+
+#if (FWPS_MSG_ABI_IN_FIRST_TASK_QUEUE_ID >= FWPS_MSG_ABI_MAX_INPUT_QUEUES)
+#error "Maximum queues configuration is too small to fit minimum number of \
+useful queues"
+#endif
+
+#define FWPS_MSG_ABI_IN_LAST_TASK_QUEUE_ID	(FWPS_MSG_ABI_MAX_QUEUES - 1U)
+#define FWPS_MSG_ABI_IN_MAX_TASK_QUEUES \
+	(FWPS_MSG_ABI_IN_LAST_TASK_QUEUE_ID - \
+	FWPS_MSG_ABI_IN_FIRST_TASK_QUEUE_ID + 1U)
+#define FWPS_MSG_ABI_OUT_FIRST_QUEUE_ID		(FWPS_MSG_ABI_OUT_ACK_QUEUE_ID)
+#define FWPS_MSG_ABI_OUT_LAST_QUEUE_ID	(FWPS_MSG_ABI_MAX_OUTPUT_QUEUES - 1U)
+#define FWPS_MSG_ABI_IN_FIRST_QUEUE_ID		(FWPS_MSG_ABI_IN_DEV_QUEUE_ID)
+#define FWPS_MSG_ABI_IN_LAST_QUEUE_ID	(FWPS_MSG_ABI_IN_LAST_TASK_QUEUE_ID)
+
+#define FWPS_MSG_HOST2FW_MAX_SIZE	(2U * 1024U)
+#define FWPS_MSG_FW2HOST_MAX_SIZE	(256U)
+
+#endif
drivers/staging/media/ipu7/abi/ipu7_fw_psys_config_abi.h new file +22 -0
new file mode 100644
index 000000000000..ce3e0e5f7ede
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 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/staging/media/ipu7/abi/ipu7_fw_syscom_abi.h new file +60 -0
new file mode 100644
index 000000000000..3b8d5a3c1460
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_FW_SYSCOM_ABI_H
+#define IPU7_FW_SYSCOM_ABI_H
+
+#include <linux/types.h>
+
+#include "ipu7_fw_common_abi.h"
+
+#pragma pack(push, 1)
+#define SYSCOM_QUEUE_MIN_CAPACITY	2U
+
+struct syscom_queue_params_config {
+	ia_gofo_addr_t token_array_mem;
+	u16 token_size_in_bytes;
+	u16 max_capacity;
+};
+
+struct syscom_config_s {
+	u16 max_output_queues;
+	u16 max_input_queues;
+};
+
+#pragma pack(pop)
+
+static inline struct syscom_queue_params_config *
+syscom_config_get_queue_configs(struct syscom_config_s *config)
+{
+	return (struct syscom_queue_params_config *)(&config[1]);
+}
+
+static inline const struct syscom_queue_params_config *
+syscom_config_get_queue_configs_const(const struct syscom_config_s *config)
+{
+	return (const struct syscom_queue_params_config *)(&config[1]);
+}
+
+static inline void syscom_abi_test_func(void)
+{
+	CHECK_ALIGN32(struct syscom_queue_params_config);
+	CHECK_ALIGN32(struct syscom_config_s);
+}
+
+#pragma pack(push, 1)
+struct syscom_queue_indices_s {
+	u32 read_index;
+	u32 write_index;
+};
+
+#pragma pack(pop)
+
+static inline void syscom_queue_abi_test_func(void)
+{
+	CHECK_ALIGN64(struct syscom_queue_indices_s);
+}
+
+#endif
Signature · 3 lines
Regards,

Sakari Ailus
#9 lore raw

PATCH 6/8 media: staging/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/staging/media/ipu7/TODO               |   13 +
 drivers/staging/media/ipu7/ipu7-fw-isys.c     |  301 +++++
 drivers/staging/media/ipu7/ipu7-fw-isys.h     |   39 +
 .../staging/media/ipu7/ipu7-isys-csi-phy.c    | 1028 ++++++++++++++
 .../staging/media/ipu7/ipu7-isys-csi-phy.h    |   16 +
 .../staging/media/ipu7/ipu7-isys-csi2-regs.h  | 1197 +++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |  542 ++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.h   |   73 +
 drivers/staging/media/ipu7/ipu7-isys-queue.c  |  838 ++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-queue.h  |   72 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |  381 ++++++
 drivers/staging/media/ipu7/ipu7-isys-subdev.h |   55 +
 drivers/staging/media/ipu7/ipu7-isys-video.c  | 1127 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-video.h  |  117 ++
 drivers/staging/media/ipu7/ipu7-isys.c        | 1170 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys.h        |  142 ++
 16 files changed, 7111 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/TODO
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.h
drivers/staging/media/ipu7/TODO new file +12 -0
new file mode 100644
index 000000000000..fcdf95c696fb
@@ -0,0 +1,12 @@
+This is a list of things that need to be done to get this driver out of the
+staging directory.
+
+- Add metadata capture support
+  The IPU7 hardware should support metadata capture, but it is not
+  fully verified with IPU7 firmware ABI so far, need to add the metadata
+  capture support.
+
+- Work with the common IPU ISYS module
+  Sakari commented much of the driver code is the same than the IPU6 driver.
+  IPU7 ISYS driver is expected to work with the common IPU ISYS module in future.
+
drivers/staging/media/ipu7/ipu7-fw-isys.c new file +301 -0

301 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-fw-isys.h new file +39 -0
new file mode 100644
index 000000000000..b556feda6b08
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi-phy.c new file +1028 -0

1,028 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-csi-phy.h new file +16 -0
new file mode 100644
index 000000000000..dfdcb61540c4
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +1197 -0

1,197 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +542 -0

407 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +73 -0

73 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-queue.c new file +838 -0

838 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-queue.h new file +72 -0

72 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-subdev.c new file +381 -0

381 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-subdev.h new file +55 -0

55 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-video.c new file +1127 -0

1,127 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys-video.h new file +117 -0

117 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys.c new file +1170 -0

1,170 lines not on this page · raw message

drivers/staging/media/ipu7/ipu7-isys.h new file +142 -0

142 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.

#10 lore raw

Re: [PATCH 6/8] media: staging/ipu7: add IPU7 input system device driver

Hi

Quoted 22 lines · On Tue, Apr 29, 2025 at 11:28:39AM +0800, [email protected] wrote:
drivers/staging/media/ipu7/ipu7-isys-subdev.c new file +22 -0
+unsigned int ipu7_isys_mbus_code_to_bpp(u32 code)
+{
+	switch (code) {
+	case MEDIA_BUS_FMT_RGB888_1X24:
+		return 24;
+	case MEDIA_BUS_FMT_YUYV10_1X20:
+		return 20;
+	case MEDIA_BUS_FMT_Y10_1X10:
+	case MEDIA_BUS_FMT_RGB565_1X16:
+	case MEDIA_BUS_FMT_UYVY8_1X16:
+	case MEDIA_BUS_FMT_YUYV8_1X16:
+		return 16;
+	case MEDIA_BUS_FMT_SBGGR12_1X12:
+	case MEDIA_BUS_FMT_SGBRG12_1X12:
+	case MEDIA_BUS_FMT_SGRBG12_1X12:
+	case MEDIA_BUS_FMT_SRGGB12_1X12:
+		return 12;
+	case MEDIA_BUS_FMT_SBGGR10_1X10:
+	case MEDIA_BUS_FMT_SGBRG10_1X10:
+	case MEDIA_BUS_FMT_SGRBG10_1X10:
+	case MEDIA_BUS_FMT_SRGGB10_1X10:
+		return 10;

drivers/staging/media/ipu7/ipu7-isys-subdev.c line 53

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-subdev.c new file +10 -0
+	case MEDIA_BUS_FMT_SBGGR8_1X8:
+	case MEDIA_BUS_FMT_SGBRG8_1X8:
+	case MEDIA_BUS_FMT_SGRBG8_1X8:
+	case MEDIA_BUS_FMT_SRGGB8_1X8:
+		return 8;
+	default:
+		WARN_ON(1);
+		return -EINVAL;
+	}
+}

We return negative error but return type is unsigned. Also we do not check for error on ipu7_isys_setup_video() when calling this function.

Regards
Stanislaw

maintainer
#11 lore raw

Re: [PATCH 6/8] media: staging/ipu7: add IPU7 input system device driver

In reply to [email protected]

Hi Bingbu,

drivers/staging/media/ipu7/TODO

Quoted 60 lines · On Tue, Apr 29, 2025 at 11:28:39AM +0800, [email protected] wrote:

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/staging/media/ipu7/TODO               |   13 +
 drivers/staging/media/ipu7/ipu7-fw-isys.c     |  301 +++++
 drivers/staging/media/ipu7/ipu7-fw-isys.h     |   39 +
 .../staging/media/ipu7/ipu7-isys-csi-phy.c    | 1028 ++++++++++++++
 .../staging/media/ipu7/ipu7-isys-csi-phy.h    |   16 +
 .../staging/media/ipu7/ipu7-isys-csi2-regs.h  | 1197 +++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |  542 ++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.h   |   73 +
 drivers/staging/media/ipu7/ipu7-isys-queue.c  |  838 ++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-queue.h  |   72 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |  381 ++++++
 drivers/staging/media/ipu7/ipu7-isys-subdev.h |   55 +
 drivers/staging/media/ipu7/ipu7-isys-video.c  | 1127 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-video.h  |  117 ++
 drivers/staging/media/ipu7/ipu7-isys.c        | 1170 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys.h        |  142 ++
 16 files changed, 7111 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/TODO
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.h
drivers/staging/media/ipu7/TODO new file +0 -0
new file mode 100644
index 000000000000..fcdf95c696fb
@@ -0,0 +1,12 @@

I'd move this change to the patch with the Makefile / Kconfig files.

drivers/staging/media/ipu7/TODO line 11

Quoted 11 lines
drivers/staging/media/ipu7/TODO new file +11 -0
+This is a list of things that need to be done to get this driver out of the
+staging directory.
+
+- Add metadata capture support
+  The IPU7 hardware should support metadata capture, but it is not
+  fully verified with IPU7 firmware ABI so far, need to add the metadata
+  capture support.
+
+- Work with the common IPU ISYS module
+  Sakari commented much of the driver code is the same than the IPU6 driver.
+  IPU7 ISYS driver is expected to work with the common IPU ISYS module in future.

The same goes for the main IPU driver, there will be a similar common module of that comparable to the ISYS common module.

Quoted 423 lines
drivers/staging/media/ipu7/TODO new file +1 -0
+
drivers/staging/media/ipu7/ipu7-fw-isys.c new file +301 -0
new file mode 100644
index 000000000000..e4b9c364572b
@@ -0,0 +1,301 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 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 * const send_msg_types[N_IPU_INSYS_SEND_TYPE] = {
+	"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 (struct ipu7_insys_resp *)
+		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/staging/media/ipu7/ipu7-fw-isys.h new file +39 -0
new file mode 100644
index 000000000000..b556feda6b08
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi-phy.c new file +64 -0
new file mode 100644
index 000000000000..e275ed393e7d
@@ -0,0 +1,1028 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#include <linux/bitmap.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <media/mipi-csi2.h>
+#include <media/v4l2-device.h>
+
+#include "ipu7.h"
+#include "ipu7-bus.h"
+#include "ipu7-buttress.h"
+#include "ipu7-isys.h"
+#include "ipu7-isys-csi2.h"
+#include "ipu7-isys-csi2-regs.h"
+#include "ipu7-platform-regs.h"
+#include "ipu7-isys-csi-phy.h"
+
+#define PORT_A	0U
+#define PORT_B	1U
+#define PORT_C	2U
+#define PORT_D	3U
+
+struct ddlcal_counter_ref_s {
+	u16 min_mbps;
+	u16 max_mbps;
+
+	u16 ddlcal_counter_ref;
+};
+
+struct ddlcal_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 oa_lanex_hsrx_cdphy_sel_fast;
+	u16 ddlcal_max_phase;
+	u16 phase_bound;
+	u16 ddlcal_dll_fbk;
+	u16 ddlcal_ddl_coarse_bank;
+	u16 fjump_deskew;
+	u16 min_eye_opening_deskew;
+};
+
+struct i_thssettle_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 i_thssettle;
+};
+
+ /* lane2 for 4l3t, lane1 for 2l2t */
+struct oa_lane_clk_div_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 oa_lane_hsrx_hs_clk_div;
+};
+
+struct cdr_fbk_cap_prog_params {
+	u16 min_mbps;

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 74

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+	u16 max_mbps;
+	u16 val;
+};
+
+static const struct ddlcal_counter_ref_s table0[] = {
+	{1500, 1999, 118},
+	{2000, 2499, 157},
+	{2500, 3499, 196},
+	{3500, 4499, 274},
+	{4500, 4500, 352},

Spaces inside braces, please.

Quoted 179 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +179 -0
+	{}
+};
+
+static const struct ddlcal_params table1[] = {
+	{1500, 1587, 0, 143, 167, 17, 3, 4, 29},
+	{1588, 1687, 0, 135, 167, 15, 3, 4, 27},
+	{1688, 1799, 0, 127, 135, 15, 2, 4, 26},
+	{1800, 1928, 0, 119, 135, 13, 2, 3, 24},
+	{1929, 2076, 0, 111, 135, 13, 2, 3, 23},
+	{2077, 2249, 0, 103, 135, 11, 2, 3, 21},
+	{2250, 2454, 0, 95, 103, 11, 1, 3, 19},
+	{2455, 2699, 0, 87, 103, 9, 1, 3, 18},
+	{2700, 2999, 0, 79, 103, 9, 1, 2, 16},
+	{3000, 3229, 0, 71, 71, 7, 1, 2, 15},
+	{3230, 3599, 1, 87, 103, 9, 1, 3, 18},
+	{3600, 3999, 1, 79, 103, 9, 1, 2, 16},
+	{4000, 4499, 1, 71, 103, 7, 1, 2, 15},
+	{4500, 4500, 1, 63, 71, 7, 0, 2, 13},
+	{}
+};
+
+static const struct i_thssettle_params table2[] = {
+	{80, 124, 24},
+	{125, 249, 20},
+	{250, 499, 16},
+	{500, 749, 14},
+	{750, 1499, 13},
+	{1500, 4500, 12},
+	{}
+};
+
+static const struct oa_lane_clk_div_params table6[] = {
+	{80, 159, 0x1},
+	{160, 319, 0x2},
+	{320, 639, 0x3},
+	{640, 1279, 0x4},
+	{1280, 2560, 0x5},
+	{2561, 4500, 0x6},
+	{}
+};
+
+static const struct cdr_fbk_cap_prog_params table7[] = {
+	{80, 919, 0},
+	{920, 1029, 1},
+	{1030, 1169, 2},
+	{1170, 1349, 3},
+	{1350, 1589, 4},
+	{1590, 1949, 5},
+	{1950, 2499, 6},
+	{}
+};
+
+static void dwc_phy_write(struct ipu7_isys *isys, u32 id, u32 addr, u16 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CDPHY_BASE(id);
+
+	dev_dbg(&isys->adev->auxdev.dev, "phy write: reg 0x%zx = data 0x%04x",
+		base + addr - isys_base, data);
+	writew(data, base + addr);
+}
+
+static u16 dwc_phy_read(struct ipu7_isys *isys, u32 id, u32 addr)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CDPHY_BASE(id);
+	u16 data;
+
+	data = readw(base + addr);
+	dev_dbg(&isys->adev->auxdev.dev, "phy read: reg 0x%zx = data 0x%04x",
+		base + addr - isys_base, data);
+
+	return data;
+}
+
+static void dwc_csi_write(struct ipu7_isys *isys, u32 id, u32 addr, u32 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CSI2_HOST_BASE(id);
+	struct device *dev = &isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "csi write: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, data);
+	writel(data, base + addr);
+	dev_dbg(dev, "csi read: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, readl(base + addr));
+}
+
+static void gpreg_write(struct ipu7_isys *isys, u32 id, u32 addr, u32 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	u32 gpreg = isys->pdata->ipdata->csi2.gpreg;
+	void __iomem *base = isys_base + gpreg + 0x1000 * id;
+	struct device *dev = &isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "gpreg write: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, data);
+	writel(data, base + addr);
+	dev_dbg(dev, "gpreg read: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, readl(base + addr));
+}
+
+static u32 dwc_csi_read(struct ipu7_isys *isys, u32 id, u32 addr)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CSI2_HOST_BASE(id);
+	u32 data;
+
+	data = readl(base + addr);
+	dev_dbg(&isys->adev->auxdev.dev, "csi read: reg 0x%zx = data 0x%x",
+		base + addr - isys_base, data);
+
+	return data;
+}
+
+static void dwc_phy_write_mask(struct ipu7_isys *isys, u32 id, u32 addr,
+			       u16 val, u8 lo, u8 hi)
+{
+	u32 temp, mask;
+
+	WARN_ON(lo > hi);
+	WARN_ON(hi > 15);
+
+	mask = ((~0U - (1U << lo) + 1U)) & (~0U >> (31 - hi));
+	temp = dwc_phy_read(isys, id, addr);
+	temp &= ~mask;
+	temp |= (val << lo) & mask;
+	dwc_phy_write(isys, id, addr, temp);
+}
+
+static void dwc_csi_write_mask(struct ipu7_isys *isys, u32 id, u32 addr,
+			       u32 val, u8 hi, u8 lo)
+{
+	u32 temp, mask;
+
+	WARN_ON(lo > hi);
+
+	mask = ((~0U - (1U << lo) + 1U)) & (~0U >> (31 - hi));
+	temp = dwc_csi_read(isys, id, addr);
+	temp &= ~mask;
+	temp |= (val << lo) & mask;
+	dwc_csi_write(isys, id, addr, temp);
+}
+
+static void ipu7_isys_csi_ctrl_cfg(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	struct device *dev = &isys->adev->auxdev.dev;
+	u32 id, lanes, phy_mode;
+	u32 val;
+
+	id = csi2->port;
+	lanes = csi2->nlanes;
+	phy_mode = csi2->phy_mode;
+	dev_dbg(dev, "csi-%d controller init with %u lanes, phy mode %u",
+		id, lanes, phy_mode);
+
+	val = dwc_csi_read(isys, id, VERSION);
+	dev_dbg(dev, "csi-%d controller version = 0x%x", id, val);
+
+	/* num of active data lanes */
+	dwc_csi_write(isys, id, N_LANES, lanes - 1);
+	dwc_csi_write(isys, id, CDPHY_MODE, phy_mode);
+	dwc_csi_write(isys, id, VC_EXTENSION, 0);
+
+	/* only mask PHY_FATAL and PKT_FATAL interrupts */
+	dwc_csi_write(isys, id, INT_MSK_PHY_FATAL, 0xff);
+	dwc_csi_write(isys, id, INT_MSK_PKT_FATAL, 0x3);
+	dwc_csi_write(isys, id, INT_MSK_PHY, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_LINE, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_BNDRY_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_SEQ_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_CRC_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_PLD_CRC_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_DATA_ID, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_ECC_CORRECTED, 0x0);
+}
+
+static void ipu7_isys_csi_phy_reset(struct ipu7_isys *isys, u32 id)

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 263

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+{
+	dwc_csi_write(isys, id, PHY_SHUTDOWNZ, 0);
+	dwc_csi_write(isys, id, DPHY_RSTZ, 0);
+	dwc_csi_write(isys, id, CSI2_RESETN, 0);
+	gpreg_write(isys, id, PHY_RESET, 0);
+	gpreg_write(isys, id, PHY_SHUTDOWN, 0);
+}
+
+#define N_DATA_IDS		8
+static DECLARE_BITMAP(data_ids, N_DATA_IDS);

Please move to device context struct.

Quoted 46 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +46 -0
+/* 8 Data ID monitors, each Data ID is composed by pair of VC and data type */
+static int __dids_config(struct ipu7_isys_csi2 *csi2, u32 id, u8 vc, u8 dt)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	u32 reg, n;
+	u8 lo, hi;
+	int ret;
+
+	dev_dbg(&isys->adev->auxdev.dev, "config CSI-%u with vc:%u dt:0x%02x\n",
+		id, vc, dt);
+
+	dwc_csi_write(isys, id, VC_EXTENSION, 0x0);
+	n = find_first_zero_bit(data_ids, N_DATA_IDS);
+	if (n == N_DATA_IDS)
+		return -ENOSPC;
+
+	ret = test_and_set_bit(n, data_ids);
+	if (ret)
+		return -EBUSY;
+
+	reg = n < 4 ? DATA_IDS_VC_1 : DATA_IDS_VC_2;
+	lo = (n % 4) * 8;
+	hi = lo + 4;
+	dwc_csi_write_mask(isys, id, reg, vc & GENMASK(4, 0), hi, lo);
+
+	reg = n < 4 ? DATA_IDS_1 : DATA_IDS_2;
+	lo = (n % 4) * 8;
+	hi = lo + 5;
+	dwc_csi_write_mask(isys, id, reg, dt & GENMASK(5, 0), hi, lo);
+
+	return 0;
+}
+
+static int ipu7_isys_csi_ctrl_dids_config(struct ipu7_isys_csi2 *csi2, u32 id)
+{
+	struct v4l2_mbus_frame_desc_entry *desc_entry = NULL;
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+	struct v4l2_mbus_frame_desc desc;
+	struct v4l2_subdev *ext_sd;
+	struct media_pad *pad;
+	unsigned int i;
+	int ret;
+
+	pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
+	if (IS_ERR(pad)) {
+		dev_warn(dev, "can't get remote source pad of %s (%ld)\n",

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 319

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+			 csi2->asd.sd.name, PTR_ERR(pad));
+		return PTR_ERR(pad);
+	}
+
+	ext_sd = media_entity_to_v4l2_subdev(pad->entity);
+	if (WARN(!ext_sd, "Failed to get subdev for entity %s\n",
+		 pad->entity->name))
+		return -ENODEV;
+
+	ret = v4l2_subdev_call(ext_sd, pad, get_frame_desc, pad->index, &desc);

Note that not all sensor drivers support get_frame_desc. Your driver should also work with those.

Quoted 12 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +12 -0
+	if (ret)
+		return ret;
+
+	if (desc.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) {
+		dev_warn(dev, "Unsupported frame descriptor type\n");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < desc.num_entries; i++) {
+		desc_entry = &desc.entry[i];
+		if (desc_entry->bus.csi2.vc < NR_OF_CSI2_VC) {
+			ret = __dids_config(csi2, id, desc_entry->bus.csi2.vc,

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 341

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+					    desc_entry->bus.csi2.dt);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
+#define CDPHY_TIMEOUT (5000000)

No need for parenthesis.

Quoted 50 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +50 -0
+static int ipu7_isys_phy_ready(struct ipu7_isys *isys, u32 id)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	u32 gpreg_offset = isys->pdata->ipdata->csi2.gpreg;
+	void __iomem *gpreg = isys_base + gpreg_offset + 0x1000 * id;
+	struct device *dev = &isys->adev->auxdev.dev;
+	unsigned int i;
+	u32 phy_ready;
+	u32 reg, rext;
+	int ret;
+
+	dev_dbg(dev, "waiting phy ready...\n");
+	ret = readl_poll_timeout(gpreg + PHY_READY, phy_ready,
+				 phy_ready & BIT(0) && phy_ready != ~0U,
+				 100, CDPHY_TIMEOUT);
+	dev_dbg(dev, "phy %u ready = 0x%08x\n", id, readl(gpreg + PHY_READY));
+	dev_dbg(dev, "csi %u PHY_RX = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_RX));
+	dev_dbg(dev, "csi %u PHY_STOPSTATE = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_STOPSTATE));
+	dev_dbg(dev, "csi %u PHY_CAL = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_CAL));
+	for (i = 0; i < 4U; i++) {
+		reg = CORE_DIG_DLANE_0_R_HS_RX_0 + (i * 0x400U);
+		dev_dbg(dev, "phy %u DLANE%u skewcal = 0x%04x\n",
+			id, i, dwc_phy_read(isys, id, reg));
+	}
+	dev_dbg(dev, "phy %u DDLCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5));
+	dev_dbg(dev, "phy %u TERMCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_TERMCAL_DEBUG_0));
+	dev_dbg(dev, "phy %u LPDCOCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_LPDCOCAL_DEBUG_RB));
+	dev_dbg(dev, "phy %u HSDCOCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_HSDCOCAL_DEBUG_RB));
+	dev_dbg(dev, "phy %u LPDCOCAL_VT = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_LPDCOCAL_DEBUG_VT));
+
+	if (!ret) {
+		if (id) {
+			dev_dbg(dev, "ignore phy %u rext\n", id);
+			return 0;
+		}
+
+		rext = dwc_phy_read(isys, id,
+				    CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15) & 0xfU;
+		dev_dbg(dev, "phy %u rext value = %u\n", id, rext);
+		isys->phy_rext_cal = (rext ? rext : 5);
+
+		return 0;

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 401

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+	}
+
+	dev_err(dev, "wait phy ready timeout!\n");
+
+	return ret;
+}
+
+static int lookup_table1(u16 mbps)
+{
+	int i;

unsigned int, please. Same elsewhere.

Quoted 190 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +190 -0
+
+	for (i = 0; i < ARRAY_SIZE(table1); i++) {
+		if (mbps >= table1[i].min_mbps && mbps <= table1[i].max_mbps)
+			return i;
+	}
+
+	return -ENXIO;
+}
+
+static const u16 deskew_fine_mem[] = {
+	0x0404, 0x040c, 0x0414, 0x041c,
+	0x0423, 0x0429, 0x0430, 0x043a,
+	0x0445, 0x044a, 0x0450, 0x045a,
+	0x0465, 0x0469, 0x0472, 0x047a,
+	0x0485, 0x0489, 0x0490, 0x049a,
+	0x04a4, 0x04ac, 0x04b4, 0x04bc,
+	0x04c4, 0x04cc, 0x04d4, 0x04dc,
+	0x04e4, 0x04ec, 0x04f4, 0x04fc,
+	0x0504, 0x050c, 0x0514, 0x051c,
+	0x0523, 0x0529, 0x0530, 0x053a,
+	0x0545, 0x054a, 0x0550, 0x055a,
+	0x0565, 0x0569, 0x0572, 0x057a,
+	0x0585, 0x0589, 0x0590, 0x059a,
+	0x05a4, 0x05ac, 0x05b4, 0x05bc,
+	0x05c4, 0x05cc, 0x05d4, 0x05dc,
+	0x05e4, 0x05ec, 0x05f4, 0x05fc,
+	0x0604, 0x060c, 0x0614, 0x061c,
+	0x0623, 0x0629, 0x0632, 0x063a,
+	0x0645, 0x064a, 0x0650, 0x065a,
+	0x0665, 0x0669, 0x0672, 0x067a,
+	0x0685, 0x0689, 0x0690, 0x069a,
+	0x06a4, 0x06ac, 0x06b4, 0x06bc,
+	0x06c4, 0x06cc, 0x06d4, 0x06dc,
+	0x06e4, 0x06ec, 0x06f4, 0x06fc,
+	0x0704, 0x070c, 0x0714, 0x071c,
+	0x0723, 0x072a, 0x0730, 0x073a,
+	0x0745, 0x074a, 0x0750, 0x075a,
+	0x0765, 0x0769, 0x0772, 0x077a,
+	0x0785, 0x0789, 0x0790, 0x079a,
+	0x07a4, 0x07ac, 0x07b4, 0x07bc,
+	0x07c4, 0x07cc, 0x07d4, 0x07dc,
+	0x07e4, 0x07ec, 0x07f4, 0x07fc,
+};
+
+static void ipu7_isys_dphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				  bool aggregation, u64 mbps)
+{
+	u16 hsrxval0 = 0;
+	u16 hsrxval1 = 0;
+	u16 hsrxval2 = 0;
+	int index;
+	u16 reg;
+	u16 val;
+	u32 i;
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_7, 0, 0, 9);
+	if (mbps > 1500)
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7,
+				   40, 0, 7);
+	else
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7,
+				   104, 0, 7);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_8, 80, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_0, 191, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_7, 34, 7, 12);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_1, 38, 8, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 4, 12, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 2, 10, 11);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 1, 8, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 38, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 1, 9, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_4, 10, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_6, 20, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_7, 19, 0, 6);
+
+	for (i = 0; i < ARRAY_SIZE(table0); i++) {
+		if (mbps >= table0[i].min_mbps && mbps <= table0[i].max_mbps) {
+			dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_3,
+					   table0[i].ddlcal_counter_ref,
+					   0, 9);
+			break;
+		}
+	}
+
+	index = lookup_table1(mbps);
+	if (index >= 0) {
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_1,
+				   table1[index].phase_bound, 0, 7);
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_5,
+				   table1[index].ddlcal_dll_fbk, 4, 9);
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_5,
+				   table1[index].ddlcal_ddl_coarse_bank, 0, 3);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8;
+		val = table1[index].oa_lanex_hsrx_cdphy_sel_fast;
+		for (i = 0; i < lanes + 1; i++)
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   12, 12);
+	}
+
+	reg = CORE_DIG_DLANE_0_RW_LP_0;
+	for (i = 0; i < lanes; i++)
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 6, 8, 11);
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2,
+			   0, 0, 0);
+	if (!is_ipu7(isys->adev->isp->hw_ver) ||
+	    id == PORT_B || id == PORT_C) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2,
+				   1, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2,
+				   0, 0, 0);
+	} else {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2,
+				   0, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2,
+				   1, 0, 0);
+	}
+
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2,
+				   0, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2,
+				   0, 0, 0);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_6, 1, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_6, 1, 3, 5);
+
+	reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12;
+	val = (mbps > 1500) ? 0 : 1;
+	for (i = 0; i < lanes + 1; i++) {
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), !val, 3, 3);
+	}
+
+	reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13;
+	val = (mbps > 1500) ? 0 : 1;
+	for (i = 0; i < lanes + 1; i++) {
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 3, 3);
+	}
+
+	if (!is_ipu7(isys->adev->isp->hw_ver) || id == PORT_B || id == PORT_C)
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9;
+	else
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9;
+
+	for (i = 0; i < ARRAY_SIZE(table6); i++) {
+		if (mbps >= table6[i].min_mbps && mbps <= table6[i].max_mbps) {
+			dwc_phy_write_mask(isys, id, reg,
+					   table6[i].oa_lane_hsrx_hs_clk_div,
+					   5, 7);
+			break;
+		}
+	}
+
+	if (aggregation) {
+		dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_0, 1,
+				   1, 1);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, 3, 3, 4);
+
+		val = (id == PORT_A) ? 3 : 0;
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, val, 3, 4);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, 3, 3, 4);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_HS_RX_0, 28, 0, 7);
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_HS_RX_7, 6, 0, 7);
+
+	reg = CORE_DIG_DLANE_0_RW_HS_RX_0;
+	for (i = 0; i < ARRAY_SIZE(table2); i++) {
+		if (mbps >= table2[i].min_mbps && mbps <= table2[i].max_mbps) {
+			u8 j;
+
+			for (j = 0; j < lanes; j++)
+				dwc_phy_write_mask(isys, id, reg + (j * 0x400),
+						   table2[i].i_thssettle,

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 601

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+						   8, 15);
+			break;
+		}
+	}
+
+	/* deskew */
+	for (i = 0; i < lanes; i++) {
+		reg = CORE_DIG_DLANE_0_RW_CFG_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+				   ((mbps > 1500) ? 0x1 : 0x2), 2, 3);

You can remove three pairs of parentheses above. Same below.

Quoted 133 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +133 -0
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_2;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+				   ((mbps > 2500) ? 0 : 1), 15, 15);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 13, 13);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 7, 9, 12);
+
+		reg = CORE_DIG_DLANE_0_RW_LP_0;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 12, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_LP_2;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 0, 0);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 16, 0, 7);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_3;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 2, 0, 2);
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].fjump_deskew;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   3, 8);
+		}
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_4;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 150, 0, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_5;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 0, 7);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 8, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_6;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 2, 0, 7);
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].min_eye_opening_deskew;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   8, 15);
+		}
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_7;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 13, 13);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 15, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_9;
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].ddlcal_max_phase;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+					   val, 0, 7);
+		}
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_LP_0, 1, 12, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_LP_2, 0, 0, 0);
+
+	for (i = 0; i < ARRAY_SIZE(deskew_fine_mem); i++)
+		dwc_phy_write_mask(isys, id, CORE_DIG_COMMON_RW_DESKEW_FINE_MEM,
+				   deskew_fine_mem[i], 0, 15);
+
+	if (mbps > 1500) {
+		hsrxval0 = 4;
+		hsrxval2 = 3;
+	}
+
+	if (mbps > 2500)
+		hsrxval1 = 2;
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9,
+				   hsrxval0, 0, 2);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9,
+				   hsrxval0, 0, 2);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9,
+				   hsrxval1, 3, 4);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9,
+				   hsrxval1, 3, 4);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15,
+				   hsrxval2, 0, 2);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15,
+				   hsrxval2, 0, 2);
+	}
+
+	/* force and override rext */
+	if (isys->phy_rext_cal && id) {
+		dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8,
+				   isys->phy_rext_cal, 0, 3);
+		dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
+				   1, 11, 11);
+	}
+}
+
+static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				  bool aggregation, u64 mbps)
+{
+	u8 trios = 2;
+	u16 coarse_target;
+	u16 deass_thresh;
+	u16 delay_thresh;
+	u16 reset_thresh;
+	u16 cap_prog = 6U;
+	u16 reg;
+	u16 val;

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 744

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+	u32 i;
+	u32 r;
+
+	if (is_ipu7p5(isys->adev->isp->hw_ver))
+		val = 0x15;
+	else
+		val = 0x155;
+
+	if (is_ipu7(isys->adev->isp->hw_ver))
+		trios = 3;

It'd be good to have hardware version specific struct where you'd have such values in a single location.

Quoted 14 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +14 -0
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_7, val, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7, 104, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_8, 16, 0, 7);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 6, 8, 11);
+
+	val = (mbps > 900U) ? 1U : 0U;
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 0, 0);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 768

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_5;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_6;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 10, 0, 15);
+	}

Too many magic numbers. :-( Please come up with human-readable names for these, including 0x400.

Simiarly below and probably elsewhere, too. No need to apply to individual tables entries though, but they need to be separate from the code.

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 776

Quoted 8 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +8 -0
+
+	/*
+	 * Below 900Msps, always use the same value.
+	 * The formula is suitable for data rate 80-3500Msps.
+	 * Timebase (us) = 1, DIV = 32, TDDL (UI) = 0.5
+	 */
+	if (mbps >= 80U) {
+		coarse_target = (u16)div_u64_rem(mbps, 16, &r);

No need to cast.

Quoted 280 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +252 -0
+		if (!r)
+			coarse_target--;
+	} else {
+		coarse_target = 56;
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_2 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, coarse_target, 0, 15);
+	}
+
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2, 1, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2, 0, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2, 1, 0, 0);
+
+	if (!is_ipu7p5(isys->adev->isp->hw_ver) && lanes == 4) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2,
+				   1, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2,
+				   0, 0, 0);
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_RW_TRIO0_0 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, 1, 6, 8);
+		dwc_phy_write_mask(isys, id, reg, 1, 3, 5);
+		dwc_phy_write_mask(isys, id, reg, 2, 0, 2);
+	}
+
+	deass_thresh = (u16)div_u64_rem(7 * 1000 * 6, mbps * 5U, &r) + 1;
+	if (r != 0)
+		deass_thresh++;
+
+	reg = CORE_DIG_RW_TRIO0_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   deass_thresh, 0, 7);
+
+	delay_thresh =
+		((224U - (9U * 7U)) * 1000U) / (5U * mbps) - 7U;
+
+	if (delay_thresh < 1)
+		delay_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_1;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   delay_thresh, 0, 15);
+
+	reset_thresh = (u16)div_u64_rem(2U * 5U * mbps, 7U * 1000U, &r);
+	if (!r)
+		reset_thresh--;
+
+	if (reset_thresh < 1)
+		reset_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   reset_thresh, 9, 11);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 1, 12, 15);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 0, 0, 0);
+
+	reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 12, 2, 6);
+
+	for (i = 0; i < ARRAY_SIZE(table7); i++) {
+		if (mbps >= table7[i].min_mbps && mbps <= table7[i].max_mbps) {
+			cap_prog = table7[i].val;
+			break;
+		}
+	}
+
+	for (i = 0; i < (lanes + 1); i++) {
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, 4U, 0, 2);
+		dwc_phy_write_mask(isys, id, reg, 0U, 3, 4);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, cap_prog, 10, 12);
+	}
+}
+
+static void ipu7_isys_phy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				 bool aggregation)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
+	u32 phy_mode;
+	s64 link_freq;
+	u64 mbps;
+
+	if (aggregation)
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[0]);
+	else
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[id]);
+
+	if (link_freq < 0) {
+		dev_warn(dev, "get link freq failed, use default mbps\n");
+		link_freq = 560000000;
+	}
+
+	mbps = div_u64(link_freq, 500000);
+	dev_dbg(dev, "config phy %u with lanes %u aggregation %d mbps %lld\n",
+		id, lanes, aggregation, mbps);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_10, 48, 0, 7);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2,
+			   1, 12, 13);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0,
+			   63, 2, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_STARTUP_1_1,
+			   563, 0, 11);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 5, 0, 7);
+	/* bypass the RCAL state (bit6) */
+	if (aggregation && id != PORT_A)
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 0x45,
+				   0, 7);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_6, 39, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_CALIBCTRL_RW_COMMON_BG_0, 500, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_TERMCAL_CFG_0, 38, 0, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_OFFSETCAL_CFG_0, 7, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TIMEBASE, 153, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF, 800, 0, 10);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF_RANGE, 27, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 47, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 127, 9, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 47, 7, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 27, 2, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_COARSE_CFG, 1, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_COMMON_CFG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   1, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3,
+			   3, 8, 9);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6,
+			   7, 12, 14);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
+			   0, 8, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5,
+			   0, 8, 8);
+
+	if (aggregation)
+		phy_mode = isys->csi2[0].phy_mode;
+	else
+		phy_mode = isys->csi2[id].phy_mode;
+
+	if (phy_mode == PHY_MODE_DPHY) {
+		ipu7_isys_dphy_config(isys, id, lanes, aggregation, mbps);
+	} else if (phy_mode == PHY_MODE_CPHY) {
+		ipu7_isys_cphy_config(isys, id, lanes, aggregation, mbps);
+	} else {
+		dev_err(dev, "unsupported phy mode %d!\n",
+			isys->csi2[id].phy_mode);
+	}
+}
+
+int ipu7_isys_csi_phy_powerup(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	u32 lanes = csi2->nlanes;
+	bool aggregation = false;
+	u32 id = csi2->port;
+	int ret;
+
+	/* lanes remapping for aggregation (port AB) mode */
+	if (!is_ipu7(isys->adev->isp->hw_ver) && lanes > 2 && id == PORT_A) {
+		aggregation = true;
+		lanes = 2;
+	}
+
+	ipu7_isys_csi_phy_reset(isys, id);
+	gpreg_write(isys, id, PHY_CLK_LANE_CONTROL, 0x1);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+	gpreg_write(isys, id, PHY_LANE_CONTROL_EN, (1U << lanes) - 1U);
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0xf);
+	gpreg_write(isys, id, PHY_MODE, csi2->phy_mode);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_CONTROL, 0x0);
+		gpreg_write(isys, PORT_B, PHY_LANE_CONTROL_EN, 0x3);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0xf);
+		gpreg_write(isys, PORT_B, PHY_MODE, csi2->phy_mode);
+	}
+
+	ipu7_isys_csi_ctrl_cfg(csi2);
+	ipu7_isys_csi_ctrl_dids_config(csi2, id);
+
+	ipu7_isys_phy_config(isys, id, lanes, aggregation);
+	gpreg_write(isys, id, PHY_RESET, 1);
+	gpreg_write(isys, id, PHY_SHUTDOWN, 1);
+	dwc_csi_write(isys, id, DPHY_RSTZ, 1);
+	dwc_csi_write(isys, id, PHY_SHUTDOWNZ, 1);
+	dwc_csi_write(isys, id, CSI2_RESETN, 1);
+
+	ret = ipu7_isys_phy_ready(isys, id);
+	if (ret < 0)
+		return ret;
+
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_phy_config(isys, PORT_B, 2, aggregation);
+		gpreg_write(isys, PORT_B, PHY_RESET, 1);
+		gpreg_write(isys, PORT_B, PHY_SHUTDOWN, 1);
+		dwc_csi_write(isys, PORT_B, DPHY_RSTZ, 1);
+		dwc_csi_write(isys, PORT_B, PHY_SHUTDOWNZ, 1);
+		dwc_csi_write(isys, PORT_B, CSI2_RESETN, 1);
+		ret = ipu7_isys_phy_ready(isys, PORT_B);
+		if (ret < 0)
+			return ret;
+
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0);
+	}
+
+	return 0;
+}
+
+void ipu7_isys_csi_phy_powerdown(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+
+	ipu7_isys_csi_phy_reset(isys, csi2->port);
+	if (!is_ipu7(isys->adev->isp->hw_ver) &&
+	    csi2->nlanes > 2U && csi2->port == PORT_A)
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+}
drivers/staging/media/ipu7/ipu7-isys-csi-phy.h new file +16 -0
new file mode 100644
index 000000000000..dfdcb61540c4
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +0 -0
new file mode 100644
index 000000000000..32704ca21341

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 10

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
@@ -0,0 +1,1197 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_ISYS_CSI2_REG_H
+#define IPU7_ISYS_CSI2_REG_H
+
+/* IS main regs base */
+#define IS_MAIN_BASE				(0x240000U)

Please drop U specifier from hexadecimal values.

Quoted 527 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +527 -0
+#define IS_MAIN_S2B_BASE			(IS_MAIN_BASE + 0x22000U)
+#define IS_MAIN_B2O_BASE			(IS_MAIN_BASE + 0x26000U)
+#define IS_MAIN_ISD_M0_BASE			(IS_MAIN_BASE + 0x2b000U)
+#define IS_MAIN_ISD_M1_BASE			(IS_MAIN_BASE + 0x2b100U)
+#define IS_MAIN_ISD_INT_BASE			(IS_MAIN_BASE + 0x2b200U)
+#define IS_MAIN_GDA_BASE			(IS_MAIN_BASE + 0x32000U)
+#define IS_MAIN_GPREGS_MAIN_BASE		(IS_MAIN_BASE + 0x32500U)
+#define IS_MAIN_IRQ_CTRL_BASE			(IS_MAIN_BASE + 0x32700U)
+#define IS_MAIN_PWM_CTRL_BASE			(IS_MAIN_BASE + 0x32b00U)
+
+#define S2B_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_S2B_BASE + 0x1cU)
+#define S2B_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_S2B_BASE + 0x20U)
+#define S2B_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_S2B_BASE + 0x24U)
+#define S2B_IID_IRQ_CTL_STATUS(iid)		(IS_MAIN_S2B_BASE + 0x94U + \
+						 0x100U * (iid))
+
+#define B2O_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_B2O_BASE + 0x30U)
+#define B2O_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_B2O_BASE + 0x34U)
+#define B2O_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_B2O_BASE + 0x38U)
+#define B2O_IID_IRQ_CTL_STATUS(oid)		(IS_MAIN_B2O_BASE + 0x3dcU + \
+						 0x200U * (oid))
+
+#define ISD_M0_IRQ_CTL_STATUS			(IS_MAIN_ISD_M0_BASE + 0x1cU)
+#define ISD_M0_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M0_BASE + 0x20U)
+#define ISD_M0_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M0_BASE + 0x24U)
+
+#define ISD_M1_IRQ_CTL_STATUS			(IS_MAIN_ISD_M1_BASE + 0x1cU)
+#define ISD_M1_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M1_BASE + 0x20U)
+#define ISD_M1_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M1_BASE + 0x24U)
+
+#define ISD_INT_IRQ_CTL_STATUS			(IS_MAIN_ISD_INT_BASE + 0x1cU)
+#define ISD_INT_IRQ_CTL_CLEAR			(IS_MAIN_ISD_INT_BASE + 0x20U)
+#define ISD_INT_IRQ_CTL_ENABLE			(IS_MAIN_ISD_INT_BASE + 0x24U)
+
+#define GDA_IRQ_CTL_STATUS			(IS_MAIN_GDA_BASE + 0x1cU)
+#define GDA_IRQ_CTL_CLEAR			(IS_MAIN_GDA_BASE + 0x20U)
+#define GDA_IRQ_CTL_ENABLE			(IS_MAIN_GDA_BASE + 0x24U)
+
+#define IS_MAIN_IRQ_CTL_EDGE			IS_MAIN_IRQ_CTRL_BASE
+#define IS_MAIN_IRQ_CTL_MASK			(IS_MAIN_IRQ_CTRL_BASE + 0x4U)
+#define IS_MAIN_IRQ_CTL_STATUS			(IS_MAIN_IRQ_CTRL_BASE + 0x8U)
+#define IS_MAIN_IRQ_CTL_CLEAR			(IS_MAIN_IRQ_CTRL_BASE + 0xcU)
+#define IS_MAIN_IRQ_CTL_ENABLE			(IS_MAIN_IRQ_CTRL_BASE + 0x10U)
+#define IS_MAIN_IRQ_CTL_LEVEL_NOT_PULSE		(IS_MAIN_IRQ_CTRL_BASE + 0x14U)
+
+/* IS IO regs base */
+#define IS_PHY_NUM				(4U)
+#define IS_IO_BASE				(0x280000U)
+
+/* dwc csi cdphy registers */
+#define IS_IO_CDPHY_BASE(i)			(IS_IO_BASE + 0x10000U * (i))
+#define PPI_STARTUP_RW_COMMON_DPHY_0			0x1800U
+#define PPI_STARTUP_RW_COMMON_DPHY_1			0x1802U
+#define PPI_STARTUP_RW_COMMON_DPHY_2			0x1804U
+#define PPI_STARTUP_RW_COMMON_DPHY_3			0x1806U
+#define PPI_STARTUP_RW_COMMON_DPHY_4			0x1808U
+#define PPI_STARTUP_RW_COMMON_DPHY_5			0x180aU
+#define PPI_STARTUP_RW_COMMON_DPHY_6			0x180cU
+#define PPI_STARTUP_RW_COMMON_DPHY_7			0x180eU
+#define PPI_STARTUP_RW_COMMON_DPHY_8			0x1810U
+#define PPI_STARTUP_RW_COMMON_DPHY_9			0x1812U
+#define PPI_STARTUP_RW_COMMON_DPHY_A			0x1814U
+#define PPI_STARTUP_RW_COMMON_DPHY_10			0x1820U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_1		0x1822U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_2		0x1824U
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_0		0x1840U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_1		0x1842U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_2		0x1844U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_3		0x1846U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_4		0x1848U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5		0x184aU
+#define PPI_CALIBCTRL_RW_COMMON_BG_0			0x184cU
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_7		0x184eU
+#define PPI_CALIBCTRL_RW_ADC_CFG_0			0x1850U
+#define PPI_CALIBCTRL_RW_ADC_CFG_1			0x1852U
+#define PPI_CALIBCTRL_R_ADC_DEBUG			0x1854U
+#define PPI_RW_LPDCOCAL_TOP_OVERRIDE			0x1c00U
+#define PPI_RW_LPDCOCAL_TIMEBASE			0x1c02U
+#define PPI_RW_LPDCOCAL_NREF				0x1c04U
+#define PPI_RW_LPDCOCAL_NREF_RANGE			0x1c06U
+#define PPI_RW_LPDCOCAL_NREF_TRIGGER_MAN		0x1c08U
+#define PPI_RW_LPDCOCAL_TWAIT_CONFIG			0x1c0aU
+#define PPI_RW_LPDCOCAL_VT_CONFIG			0x1c0cU
+#define PPI_R_LPDCOCAL_DEBUG_RB				0x1c0eU
+#define PPI_RW_LPDCOCAL_COARSE_CFG			0x1c10U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_RB			0x1c12U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_0_RB		0x1c14U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_1_RB		0x1c16U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_FWORD_RB		0x1c18U
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_CURR_ERROR		0x1c1aU
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_LAST_ERROR		0x1c1cU
+#define PPI_R_LPDCOCAL_DEBUG_VT				0x1c1eU
+#define PPI_RW_LB_TIMEBASE_CONFIG			0x1c20U
+#define PPI_RW_LB_STARTCMU_CONFIG			0x1c22U
+#define PPI_R_LBPULSE_COUNTER_RB			0x1c24U
+#define PPI_R_LB_START_CMU_RB				0x1c26U
+#define PPI_RW_LB_DPHY_BURST_START			0x1c28U
+#define PPI_RW_LB_CPHY_BURST_START			0x1c2aU
+#define PPI_RW_DDLCAL_CFG_0				0x1c40U
+#define PPI_RW_DDLCAL_CFG_1				0x1c42U
+#define PPI_RW_DDLCAL_CFG_2				0x1c44U
+#define PPI_RW_DDLCAL_CFG_3				0x1c46U
+#define PPI_RW_DDLCAL_CFG_4				0x1c48U
+#define PPI_RW_DDLCAL_CFG_5				0x1c4aU
+#define PPI_RW_DDLCAL_CFG_6				0x1c4cU
+#define PPI_RW_DDLCAL_CFG_7				0x1c4eU
+#define PPI_R_DDLCAL_DEBUG_0				0x1c50U
+#define PPI_R_DDLCAL_DEBUG_1				0x1c52U
+#define PPI_RW_PARITY_TEST				0x1c60U
+#define PPI_RW_STARTUP_OVR_0				0x1c62U
+#define PPI_RW_STARTUP_STATE_OVR_1			0x1c64U
+#define PPI_RW_DTB_SELECTOR				0x1c66U
+#define PPI_RW_DPHY_CLK_SPARE				0x1c6aU
+#define PPI_RW_COMMON_CFG				0x1c6cU
+#define PPI_RW_TERMCAL_CFG_0				0x1c80U
+#define PPI_R_TERMCAL_DEBUG_0				0x1c82U
+#define PPI_RW_TERMCAL_CTRL_0				0x1c84U
+#define PPI_RW_OFFSETCAL_CFG_0				0x1ca0U
+#define PPI_R_OFFSETCAL_DEBUG_LANE0			0x1ca2U
+#define PPI_R_OFFSETCAL_DEBUG_LANE1			0x1ca4U
+#define PPI_R_OFFSETCAL_DEBUG_LANE2			0x1ca6U
+#define PPI_R_OFFSETCAL_DEBUG_LANE3			0x1ca8U
+#define PPI_R_OFFSETCAL_DEBUG_LANE4			0x1caaU
+#define PPI_RW_HSDCOCAL_CFG_O				0x1d00U
+#define PPI_RW_HSDCOCAL_CFG_1				0x1d02U
+#define PPI_RW_HSDCOCAL_CFG_2				0x1d04U
+#define PPI_RW_HSDCOCAL_CFG_3				0x1d06U
+#define PPI_RW_HSDCOCAL_CFG_4				0x1d08U
+#define PPI_RW_HSDCOCAL_CFG_5				0x1d0aU
+#define PPI_RW_HSDCOCAL_CFG_6				0x1d0cU
+#define PPI_RW_HSDCOCAL_CFG_7				0x1d0eU
+#define PPI_RW_HSDCOCAL_CFG_8				0x1d10U
+#define PPI_R_HSDCOCAL_DEBUG_RB				0x1d12U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_0	0x2000U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_1	0x2002U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_2	0x2004U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_3	0x2006U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_4	0x2008U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_5	0x200aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_6	0x200cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_7	0x200eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_8	0x2010U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_9	0x2012U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_10	0x2014U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_11	0x2016U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_12	0x2018U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_13	0x201aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_14	0x201cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_15	0x201eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_0	0x2020U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_1	0x2022U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_2	0x2024U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_3	0x2026U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_4	0x2028U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_5	0x202aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_6	0x202cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_7	0x202eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_8	0x2030U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_9	0x2032U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_10	0x2034U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_11	0x2036U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_12	0x2038U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_13	0x203aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_14	0x203cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_15	0x203eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_0		0x2040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_1		0x2042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2		0x2044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_3		0x2046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_4		0x2048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_5		0x204aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_6		0x204cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7		0x204eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8		0x2050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9		0x2052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_10		0x2054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_11		0x2056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12		0x2058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13		0x205aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_14		0x205cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15		0x205eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_0		0x2060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_1		0x2062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_2		0x2064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_3		0x2066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_4		0x2068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_5		0x206aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_6		0x206cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_7		0x206eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_8		0x2070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_9		0x2072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_10		0x2074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_11		0x2076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_12		0x2078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_13		0x207aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_14		0x207cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_15		0x207eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_0		0x2080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_1		0x2082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_2		0x2084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_3		0x2086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_4		0x2088U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_0	0x20a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_1	0x20a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_2	0x20a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_3	0x20a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_4	0x20a8U
+#define CORE_DIG_RW_TRIO0_0				0x2100U
+#define CORE_DIG_RW_TRIO0_1				0x2102U
+#define CORE_DIG_RW_TRIO0_2				0x2104U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_0	0x2400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_1	0x2402U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_2	0x2404U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_3	0x2406U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_4	0x2408U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_5	0x240aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_6	0x240cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_7	0x240eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_8	0x2410U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_9	0x2412U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_10	0x2414U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_11	0x2416U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_12	0x2418U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_13	0x241aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_14	0x241cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_15	0x241eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_0	0x2420U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_1	0x2422U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_2	0x2424U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_3	0x2426U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_4	0x2428U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_5	0x242aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_6	0x242cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_7	0x242eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_8	0x2430U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_9	0x2432U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_10	0x2434U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_11	0x2436U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_12	0x2438U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_13	0x243aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_14	0x243cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_15	0x243eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_0		0x2440U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_1		0x2442U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2		0x2444U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_3		0x2446U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_4		0x2448U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_5		0x244aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_6		0x244cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_7		0x244eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_8		0x2450U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9		0x2452U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_10		0x2454U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_11		0x2456U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_12		0x2458U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_13		0x245aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_14		0x245cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15		0x245eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_0		0x2460U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_1		0x2462U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_2		0x2464U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_3		0x2466U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_4		0x2468U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_5		0x246aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_6		0x246cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_7		0x246eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_8		0x2470U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_9		0x2472U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_10		0x2474U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_11		0x2476U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_12		0x2478U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_13		0x247aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_14		0x247cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_15		0x247eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_0		0x2480U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_1		0x2482U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_2		0x2484U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_3		0x2486U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_4		0x2488U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_0	0x24a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_1	0x24a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_2	0x24a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_3	0x24a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_4	0x24a8U
+#define CORE_DIG_RW_TRIO1_0				0x2500U
+#define CORE_DIG_RW_TRIO1_1				0x2502U
+#define CORE_DIG_RW_TRIO1_2				0x2504U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_0	0x2800U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_1	0x2802U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_2	0x2804U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_3	0x2806U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_4	0x2808U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_5	0x280aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_6	0x280cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_7	0x280eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_8	0x2810U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_9	0x2812U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_10	0x2814U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_11	0x2816U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_12	0x2818U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_13	0x281aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_14	0x281cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_15	0x281eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_0	0x2820U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_1	0x2822U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_2	0x2824U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_3	0x2826U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_4	0x2828U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_5	0x282aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_6	0x282cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_7	0x282eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_8	0x2830U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_9	0x2832U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_10	0x2834U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_11	0x2836U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_12	0x2838U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_13	0x283aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_14	0x283cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_15	0x283eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_0		0x2840U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_1		0x2842U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2		0x2844U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_3		0x2846U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_4		0x2848U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_5		0x284aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_6		0x284cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_7		0x284eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_8		0x2850U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9		0x2852U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_10		0x2854U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_11		0x2856U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_12		0x2858U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_13		0x285aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_14		0x285cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15		0x285eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_0		0x2860U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_1		0x2862U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_2		0x2864U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_3		0x2866U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_4		0x2868U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_5		0x286aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_6		0x286cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_7		0x286eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_8		0x2870U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_9		0x2872U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_10		0x2874U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_11		0x2876U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_12		0x2878U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_13		0x287aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_14		0x287cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_15		0x287eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_0		0x2880U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_1		0x2882U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_2		0x2884U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_3		0x2886U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_4		0x2888U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_0	0x28a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_1	0x28a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_2	0x28a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_3	0x28a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_4	0x28a8U
+#define CORE_DIG_RW_TRIO2_0				0x2900U
+#define CORE_DIG_RW_TRIO2_1				0x2902U
+#define CORE_DIG_RW_TRIO2_2				0x2904U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_0	0x2c00U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_1	0x2c02U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_2	0x2c04U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_3	0x2c06U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_4	0x2c08U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_5	0x2c0aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_6	0x2c0cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_7	0x2c0eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_8	0x2c10U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_9	0x2c12U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_10	0x2c14U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_11	0x2c16U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_12	0x2c18U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_13	0x2c1aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_14	0x2c1cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_15	0x2c1eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_0		0x2c40U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_1		0x2c42U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2		0x2c44U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_3		0x2c46U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_4		0x2c48U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_5		0x2c4aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_6		0x2c4cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_7		0x2c4eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_8		0x2c50U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9		0x2c52U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_10		0x2c54U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_11		0x2c56U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_12		0x2c58U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_13		0x2c5aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_14		0x2c5cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15		0x2c5eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_0		0x2c60U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_1		0x2c62U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_2		0x2c64U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_3		0x2c66U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_4		0x2c68U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_5		0x2c6aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_6		0x2c6cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_7		0x2c6eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_8		0x2c70U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_9		0x2c72U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_10		0x2c74U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_11		0x2c76U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_12		0x2c78U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_13		0x2c7aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_14		0x2c7cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_15		0x2c7eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_0		0x2c80U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_1		0x2c82U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_2		0x2c84U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_3		0x2c86U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_4		0x2c88U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_0		0x3040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_1		0x3042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2		0x3044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_3		0x3046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_4		0x3048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_5		0x304aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_6		0x304cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_7		0x304eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_8		0x3050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9		0x3052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_10		0x3054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_11		0x3056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_12		0x3058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_13		0x305aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_14		0x305cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15		0x305eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_0		0x3060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_1		0x3062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_2		0x3064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_3		0x3066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_4		0x3068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_5		0x306aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_6		0x306cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_7		0x306eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_8		0x3070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_9		0x3072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_10		0x3074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_11		0x3076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_12		0x3078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_13		0x307aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_14		0x307cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_15		0x307eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_0		0x3080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_1		0x3082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_2		0x3084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_3		0x3086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_4		0x3088U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_0		0x3400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_1		0x3402U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_CLK_OVR_0_2		0x3404U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_0		0x3800U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_1		0x3802U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_2		0x3804U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_3		0x3806U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_4		0x3808U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_5		0x380aU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_6		0x380cU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_7		0x380eU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_8		0x3810U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_9		0x3812U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_10		0x3814U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_11		0x3816U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_12		0x3818U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_13		0x381aU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_14		0x381cU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_15		0x381eU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_0		0x3820U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_1		0x3822U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_2		0x3824U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_3		0x3826U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_4		0x3828U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0		0x3840U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1		0x3842U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_2		0x3844U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3		0x3846U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_4		0x3848U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5		0x384aU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6		0x384cU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7		0x384eU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8		0x3850U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_9		0x3852U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_10		0x3854U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_11		0x3856U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_12		0x3858U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_13		0x385aU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_14		0x385cU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15		0x385eU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_3_0		0x3860U
+#define CORE_DIG_RW_COMMON_0				0x3880U
+#define CORE_DIG_RW_COMMON_1				0x3882U
+#define CORE_DIG_RW_COMMON_2				0x3884U
+#define CORE_DIG_RW_COMMON_3				0x3886U
+#define CORE_DIG_RW_COMMON_4				0x3888U
+#define CORE_DIG_RW_COMMON_5				0x388aU
+#define CORE_DIG_RW_COMMON_6				0x388cU
+#define CORE_DIG_RW_COMMON_7				0x388eU
+#define CORE_DIG_RW_COMMON_8				0x3890U
+#define CORE_DIG_RW_COMMON_9				0x3892U
+#define CORE_DIG_RW_COMMON_10				0x3894U
+#define CORE_DIG_RW_COMMON_11				0x3896U
+#define CORE_DIG_RW_COMMON_12				0x3898U
+#define CORE_DIG_RW_COMMON_13				0x389aU
+#define CORE_DIG_RW_COMMON_14				0x389cU
+#define CORE_DIG_RW_COMMON_15				0x389eU
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0		0x39e0U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_1		0x39e2U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2		0x39e4U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_3		0x39e6U
+#define CORE_DIG_COMMON_RW_DESKEW_FINE_MEM		0x3fe0U
+#define CORE_DIG_COMMON_R_DESKEW_FINE_MEM		0x3fe2U
+#define PPI_RW_DPHY_LANE0_LBERT_0			0x4000U
+#define PPI_RW_DPHY_LANE0_LBERT_1			0x4002U
+#define PPI_R_DPHY_LANE0_LBERT_0			0x4004U
+#define PPI_R_DPHY_LANE0_LBERT_1			0x4006U
+#define PPI_RW_DPHY_LANE0_SPARE				0x4008U
+#define PPI_RW_DPHY_LANE1_LBERT_0			0x4400U
+#define PPI_RW_DPHY_LANE1_LBERT_1			0x4402U
+#define PPI_R_DPHY_LANE1_LBERT_0			0x4404U
+#define PPI_R_DPHY_LANE1_LBERT_1			0x4406U
+#define PPI_RW_DPHY_LANE1_SPARE				0x4408U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 547

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define PPI_RW_DPHY_LANE2_LBERT_0			0x4800U
+#define PPI_RW_DPHY_LANE2_LBERT_1			0x4802U
+#define PPI_R_DPHY_LANE2_LBERT_0			0x4804U
+#define PPI_R_DPHY_LANE2_LBERT_1			0x4806U
+#define PPI_RW_DPHY_LANE2_SPARE				0x4808U
+#define PPI_RW_DPHY_LANE3_LBERT_0			0x4c00U
+#define PPI_RW_DPHY_LANE3_LBERT_1			0x4c02U
+#define PPI_R_DPHY_LANE3_LBERT_0			0x4c04U
+#define PPI_R_DPHY_LANE3_LBERT_1			0x4c06U
+#define PPI_RW_DPHY_LANE3_SPARE				0x4c08U

How about using base address for lanes and then using offsets? I presume all lanes use same offset?

Same for CLANE definitions below.

Quoted 294 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +294 -0
+#define CORE_DIG_DLANE_0_RW_CFG_0			0x6000U
+#define CORE_DIG_DLANE_0_RW_CFG_1			0x6002U
+#define CORE_DIG_DLANE_0_RW_CFG_2			0x6004U
+#define CORE_DIG_DLANE_0_RW_LP_0			0x6080U
+#define CORE_DIG_DLANE_0_RW_LP_1			0x6082U
+#define CORE_DIG_DLANE_0_RW_LP_2			0x6084U
+#define CORE_DIG_DLANE_0_R_LP_0				0x60a0U
+#define CORE_DIG_DLANE_0_R_LP_1				0x60a2U
+#define CORE_DIG_DLANE_0_R_HS_TX_0			0x60e0U
+#define CORE_DIG_DLANE_0_RW_HS_RX_0			0x6100U
+#define CORE_DIG_DLANE_0_RW_HS_RX_1			0x6102U
+#define CORE_DIG_DLANE_0_RW_HS_RX_2			0x6104U
+#define CORE_DIG_DLANE_0_RW_HS_RX_3			0x6106U
+#define CORE_DIG_DLANE_0_RW_HS_RX_4			0x6108U
+#define CORE_DIG_DLANE_0_RW_HS_RX_5			0x610aU
+#define CORE_DIG_DLANE_0_RW_HS_RX_6			0x610cU
+#define CORE_DIG_DLANE_0_RW_HS_RX_7			0x610eU
+#define CORE_DIG_DLANE_0_RW_HS_RX_8			0x6110U
+#define CORE_DIG_DLANE_0_RW_HS_RX_9			0x6112U
+#define CORE_DIG_DLANE_0_R_HS_RX_0			0x6120U
+#define CORE_DIG_DLANE_0_R_HS_RX_1			0x6122U
+#define CORE_DIG_DLANE_0_R_HS_RX_2			0x6124U
+#define CORE_DIG_DLANE_0_R_HS_RX_3			0x6126U
+#define CORE_DIG_DLANE_0_R_HS_RX_4			0x6128U
+#define CORE_DIG_DLANE_0_RW_HS_TX_0			0x6200U
+#define CORE_DIG_DLANE_0_RW_HS_TX_1			0x6202U
+#define CORE_DIG_DLANE_0_RW_HS_TX_2			0x6204U
+#define CORE_DIG_DLANE_0_RW_HS_TX_3			0x6206U
+#define CORE_DIG_DLANE_0_RW_HS_TX_4			0x6208U
+#define CORE_DIG_DLANE_0_RW_HS_TX_5			0x620aU
+#define CORE_DIG_DLANE_0_RW_HS_TX_6			0x620cU
+#define CORE_DIG_DLANE_0_RW_HS_TX_7			0x620eU
+#define CORE_DIG_DLANE_0_RW_HS_TX_8			0x6210U
+#define CORE_DIG_DLANE_0_RW_HS_TX_9			0x6212U
+#define CORE_DIG_DLANE_0_RW_HS_TX_10			0x6214U
+#define CORE_DIG_DLANE_0_RW_HS_TX_11			0x6216U
+#define CORE_DIG_DLANE_0_RW_HS_TX_12			0x6218U
+#define CORE_DIG_DLANE_1_RW_CFG_0			0x6400U
+#define CORE_DIG_DLANE_1_RW_CFG_1			0x6402U
+#define CORE_DIG_DLANE_1_RW_CFG_2			0x6404U
+#define CORE_DIG_DLANE_1_RW_LP_0			0x6480U
+#define CORE_DIG_DLANE_1_RW_LP_1			0x6482U
+#define CORE_DIG_DLANE_1_RW_LP_2			0x6484U
+#define CORE_DIG_DLANE_1_R_LP_0				0x64a0U
+#define CORE_DIG_DLANE_1_R_LP_1				0x64a2U
+#define CORE_DIG_DLANE_1_R_HS_TX_0			0x64e0U
+#define CORE_DIG_DLANE_1_RW_HS_RX_0			0x6500U
+#define CORE_DIG_DLANE_1_RW_HS_RX_1			0x6502U
+#define CORE_DIG_DLANE_1_RW_HS_RX_2			0x6504U
+#define CORE_DIG_DLANE_1_RW_HS_RX_3			0x6506U
+#define CORE_DIG_DLANE_1_RW_HS_RX_4			0x6508U
+#define CORE_DIG_DLANE_1_RW_HS_RX_5			0x650aU
+#define CORE_DIG_DLANE_1_RW_HS_RX_6			0x650cU
+#define CORE_DIG_DLANE_1_RW_HS_RX_7			0x650eU
+#define CORE_DIG_DLANE_1_RW_HS_RX_8			0x6510U
+#define CORE_DIG_DLANE_1_RW_HS_RX_9			0x6512U
+#define CORE_DIG_DLANE_1_R_HS_RX_0			0x6520U
+#define CORE_DIG_DLANE_1_R_HS_RX_1			0x6522U
+#define CORE_DIG_DLANE_1_R_HS_RX_2			0x6524U
+#define CORE_DIG_DLANE_1_R_HS_RX_3			0x6526U
+#define CORE_DIG_DLANE_1_R_HS_RX_4			0x6528U
+#define CORE_DIG_DLANE_1_RW_HS_TX_0			0x6600U
+#define CORE_DIG_DLANE_1_RW_HS_TX_1			0x6602U
+#define CORE_DIG_DLANE_1_RW_HS_TX_2			0x6604U
+#define CORE_DIG_DLANE_1_RW_HS_TX_3			0x6606U
+#define CORE_DIG_DLANE_1_RW_HS_TX_4			0x6608U
+#define CORE_DIG_DLANE_1_RW_HS_TX_5			0x660aU
+#define CORE_DIG_DLANE_1_RW_HS_TX_6			0x660cU
+#define CORE_DIG_DLANE_1_RW_HS_TX_7			0x660eU
+#define CORE_DIG_DLANE_1_RW_HS_TX_8			0x6610U
+#define CORE_DIG_DLANE_1_RW_HS_TX_9			0x6612U
+#define CORE_DIG_DLANE_1_RW_HS_TX_10			0x6614U
+#define CORE_DIG_DLANE_1_RW_HS_TX_11			0x6616U
+#define CORE_DIG_DLANE_1_RW_HS_TX_12			0x6618U
+#define CORE_DIG_DLANE_2_RW_CFG_0			0x6800U
+#define CORE_DIG_DLANE_2_RW_CFG_1			0x6802U
+#define CORE_DIG_DLANE_2_RW_CFG_2			0x6804U
+#define CORE_DIG_DLANE_2_RW_LP_0			0x6880U
+#define CORE_DIG_DLANE_2_RW_LP_1			0x6882U
+#define CORE_DIG_DLANE_2_RW_LP_2			0x6884U
+#define CORE_DIG_DLANE_2_R_LP_0				0x68a0U
+#define CORE_DIG_DLANE_2_R_LP_1				0x68a2U
+#define CORE_DIG_DLANE_2_R_HS_TX_0			0x68e0U
+#define CORE_DIG_DLANE_2_RW_HS_RX_0			0x6900U
+#define CORE_DIG_DLANE_2_RW_HS_RX_1			0x6902U
+#define CORE_DIG_DLANE_2_RW_HS_RX_2			0x6904U
+#define CORE_DIG_DLANE_2_RW_HS_RX_3			0x6906U
+#define CORE_DIG_DLANE_2_RW_HS_RX_4			0x6908U
+#define CORE_DIG_DLANE_2_RW_HS_RX_5			0x690aU
+#define CORE_DIG_DLANE_2_RW_HS_RX_6			0x690cU
+#define CORE_DIG_DLANE_2_RW_HS_RX_7			0x690eU
+#define CORE_DIG_DLANE_2_RW_HS_RX_8			0x6910U
+#define CORE_DIG_DLANE_2_RW_HS_RX_9			0x6912U
+#define CORE_DIG_DLANE_2_R_HS_RX_0			0x6920U
+#define CORE_DIG_DLANE_2_R_HS_RX_1			0x6922U
+#define CORE_DIG_DLANE_2_R_HS_RX_2			0x6924U
+#define CORE_DIG_DLANE_2_R_HS_RX_3			0x6926U
+#define CORE_DIG_DLANE_2_R_HS_RX_4			0x6928U
+#define CORE_DIG_DLANE_2_RW_HS_TX_0			0x6a00U
+#define CORE_DIG_DLANE_2_RW_HS_TX_1			0x6a02U
+#define CORE_DIG_DLANE_2_RW_HS_TX_2			0x6a04U
+#define CORE_DIG_DLANE_2_RW_HS_TX_3			0x6a06U
+#define CORE_DIG_DLANE_2_RW_HS_TX_4			0x6a08U
+#define CORE_DIG_DLANE_2_RW_HS_TX_5			0x6a0aU
+#define CORE_DIG_DLANE_2_RW_HS_TX_6			0x6a0cU
+#define CORE_DIG_DLANE_2_RW_HS_TX_7			0x6a0eU
+#define CORE_DIG_DLANE_2_RW_HS_TX_8			0x6a10U
+#define CORE_DIG_DLANE_2_RW_HS_TX_9			0x6a12U
+#define CORE_DIG_DLANE_2_RW_HS_TX_10			0x6a14U
+#define CORE_DIG_DLANE_2_RW_HS_TX_11			0x6a16U
+#define CORE_DIG_DLANE_2_RW_HS_TX_12			0x6a18U
+#define CORE_DIG_DLANE_3_RW_CFG_0			0x6c00U
+#define CORE_DIG_DLANE_3_RW_CFG_1			0x6c02U
+#define CORE_DIG_DLANE_3_RW_CFG_2			0x6c04U
+#define CORE_DIG_DLANE_3_RW_LP_0			0x6c80U
+#define CORE_DIG_DLANE_3_RW_LP_1			0x6c82U
+#define CORE_DIG_DLANE_3_RW_LP_2			0x6c84U
+#define CORE_DIG_DLANE_3_R_LP_0				0x6ca0U
+#define CORE_DIG_DLANE_3_R_LP_1				0x6ca2U
+#define CORE_DIG_DLANE_3_R_HS_TX_0			0x6ce0U
+#define CORE_DIG_DLANE_3_RW_HS_RX_0			0x6d00U
+#define CORE_DIG_DLANE_3_RW_HS_RX_1			0x6d02U
+#define CORE_DIG_DLANE_3_RW_HS_RX_2			0x6d04U
+#define CORE_DIG_DLANE_3_RW_HS_RX_3			0x6d06U
+#define CORE_DIG_DLANE_3_RW_HS_RX_4			0x6d08U
+#define CORE_DIG_DLANE_3_RW_HS_RX_5			0x6d0aU
+#define CORE_DIG_DLANE_3_RW_HS_RX_6			0x6d0cU
+#define CORE_DIG_DLANE_3_RW_HS_RX_7			0x6d0eU
+#define CORE_DIG_DLANE_3_RW_HS_RX_8			0x6d10U
+#define CORE_DIG_DLANE_3_RW_HS_RX_9			0x6d12U
+#define CORE_DIG_DLANE_3_R_HS_RX_0			0x6d20U
+#define CORE_DIG_DLANE_3_R_HS_RX_1			0x6d22U
+#define CORE_DIG_DLANE_3_R_HS_RX_2			0x6d24U
+#define CORE_DIG_DLANE_3_R_HS_RX_3			0x6d26U
+#define CORE_DIG_DLANE_3_R_HS_RX_4			0x6d28U
+#define CORE_DIG_DLANE_3_RW_HS_TX_0			0x6e00U
+#define CORE_DIG_DLANE_3_RW_HS_TX_1			0x6e02U
+#define CORE_DIG_DLANE_3_RW_HS_TX_2			0x6e04U
+#define CORE_DIG_DLANE_3_RW_HS_TX_3			0x6e06U
+#define CORE_DIG_DLANE_3_RW_HS_TX_4			0x6e08U
+#define CORE_DIG_DLANE_3_RW_HS_TX_5			0x6e0aU
+#define CORE_DIG_DLANE_3_RW_HS_TX_6			0x6e0cU
+#define CORE_DIG_DLANE_3_RW_HS_TX_7			0x6e0eU
+#define CORE_DIG_DLANE_3_RW_HS_TX_8			0x6e10U
+#define CORE_DIG_DLANE_3_RW_HS_TX_9			0x6e12U
+#define CORE_DIG_DLANE_3_RW_HS_TX_10			0x6e14U
+#define CORE_DIG_DLANE_3_RW_HS_TX_11			0x6e16U
+#define CORE_DIG_DLANE_3_RW_HS_TX_12			0x6e18U
+#define CORE_DIG_DLANE_CLK_RW_CFG_0			0x7000U
+#define CORE_DIG_DLANE_CLK_RW_CFG_1			0x7002U
+#define CORE_DIG_DLANE_CLK_RW_CFG_2			0x7004U
+#define CORE_DIG_DLANE_CLK_RW_LP_0			0x7080U
+#define CORE_DIG_DLANE_CLK_RW_LP_1			0x7082U
+#define CORE_DIG_DLANE_CLK_RW_LP_2			0x7084U
+#define CORE_DIG_DLANE_CLK_R_LP_0			0x70a0U
+#define CORE_DIG_DLANE_CLK_R_LP_1			0x70a2U
+#define CORE_DIG_DLANE_CLK_R_HS_TX_0			0x70e0U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_0			0x7100U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_1			0x7102U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_2			0x7104U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_3			0x7106U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_4			0x7108U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_5			0x710aU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_6			0x710cU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_7			0x710eU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_8			0x7110U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_9			0x7112U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_0			0x7120U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_1			0x7122U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_2			0x7124U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_3			0x7126U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_4			0x7128U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_0			0x7200U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_1			0x7202U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_2			0x7204U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_3			0x7206U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_4			0x7208U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_5			0x720aU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_6			0x720cU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_7			0x720eU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_8			0x7210U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_9			0x7212U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_10			0x7214U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_11			0x7216U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_12			0x7218U
+#define PPI_RW_CPHY_TRIO0_LBERT_0			0x8000U
+#define PPI_RW_CPHY_TRIO0_LBERT_1			0x8002U
+#define PPI_R_CPHY_TRIO0_LBERT_0			0x8004U
+#define PPI_R_CPHY_TRIO0_LBERT_1			0x8006U
+#define PPI_RW_CPHY_TRIO0_SPARE				0x8008U
+#define PPI_RW_CPHY_TRIO1_LBERT_0			0x8400U
+#define PPI_RW_CPHY_TRIO1_LBERT_1			0x8402U
+#define PPI_R_CPHY_TRIO1_LBERT_0			0x8404U
+#define PPI_R_CPHY_TRIO1_LBERT_1			0x8406U
+#define PPI_RW_CPHY_TRIO1_SPARE				0x8408U
+#define PPI_RW_CPHY_TRIO2_LBERT_0			0x8800U
+#define PPI_RW_CPHY_TRIO2_LBERT_1			0x8802U
+#define PPI_R_CPHY_TRIO2_LBERT_0			0x8804U
+#define PPI_R_CPHY_TRIO2_LBERT_1			0x8806U
+#define PPI_RW_CPHY_TRIO2_SPARE				0x8808U
+#define CORE_DIG_CLANE_0_RW_CFG_0			0xa000U
+#define CORE_DIG_CLANE_0_RW_CFG_2			0xa004U
+#define CORE_DIG_CLANE_0_RW_LP_0			0xa080U
+#define CORE_DIG_CLANE_0_RW_LP_1			0xa082U
+#define CORE_DIG_CLANE_0_RW_LP_2			0xa084U
+#define CORE_DIG_CLANE_0_R_LP_0				0xa0a0U
+#define CORE_DIG_CLANE_0_R_LP_1				0xa0a2U
+#define CORE_DIG_CLANE_0_RW_HS_RX_0			0xa100U
+#define CORE_DIG_CLANE_0_RW_HS_RX_1			0xa102U
+#define CORE_DIG_CLANE_0_RW_HS_RX_2			0xa104U
+#define CORE_DIG_CLANE_0_RW_HS_RX_3			0xa106U
+#define CORE_DIG_CLANE_0_RW_HS_RX_4			0xa108U
+#define CORE_DIG_CLANE_0_RW_HS_RX_5			0xa10aU
+#define CORE_DIG_CLANE_0_RW_HS_RX_6			0xa10cU
+#define CORE_DIG_CLANE_0_R_RX_0				0xa120U
+#define CORE_DIG_CLANE_0_R_RX_1				0xa122U
+#define CORE_DIG_CLANE_0_R_TX_0				0xa124U
+#define CORE_DIG_CLANE_0_R_RX_2				0xa126U
+#define CORE_DIG_CLANE_0_R_RX_3				0xa128U
+#define CORE_DIG_CLANE_0_RW_HS_TX_0			0xa200U
+#define CORE_DIG_CLANE_0_RW_HS_TX_1			0xa202U
+#define CORE_DIG_CLANE_0_RW_HS_TX_2			0xa204U
+#define CORE_DIG_CLANE_0_RW_HS_TX_3			0xa206U
+#define CORE_DIG_CLANE_0_RW_HS_TX_4			0xa208U
+#define CORE_DIG_CLANE_0_RW_HS_TX_5			0xa20aU
+#define CORE_DIG_CLANE_0_RW_HS_TX_6			0xa20cU
+#define CORE_DIG_CLANE_0_RW_HS_TX_7			0xa20eU
+#define CORE_DIG_CLANE_0_RW_HS_TX_8			0xa210U
+#define CORE_DIG_CLANE_0_RW_HS_TX_9			0xa212U
+#define CORE_DIG_CLANE_0_RW_HS_TX_10			0xa214U
+#define CORE_DIG_CLANE_0_RW_HS_TX_11			0xa216U
+#define CORE_DIG_CLANE_0_RW_HS_TX_12			0xa218U
+#define CORE_DIG_CLANE_0_RW_HS_TX_13			0xa21aU
+#define CORE_DIG_CLANE_1_RW_CFG_0			0xa400U
+#define CORE_DIG_CLANE_1_RW_CFG_2			0xa404U
+#define CORE_DIG_CLANE_1_RW_LP_0			0xa480U
+#define CORE_DIG_CLANE_1_RW_LP_1			0xa482U
+#define CORE_DIG_CLANE_1_RW_LP_2			0xa484U
+#define CORE_DIG_CLANE_1_R_LP_0				0xa4a0U
+#define CORE_DIG_CLANE_1_R_LP_1				0xa4a2U
+#define CORE_DIG_CLANE_1_RW_HS_RX_0			0xa500U
+#define CORE_DIG_CLANE_1_RW_HS_RX_1			0xa502U
+#define CORE_DIG_CLANE_1_RW_HS_RX_2			0xa504U
+#define CORE_DIG_CLANE_1_RW_HS_RX_3			0xa506U
+#define CORE_DIG_CLANE_1_RW_HS_RX_4			0xa508U
+#define CORE_DIG_CLANE_1_RW_HS_RX_5			0xa50aU
+#define CORE_DIG_CLANE_1_RW_HS_RX_6			0xa50cU
+#define CORE_DIG_CLANE_1_R_RX_0				0xa520U
+#define CORE_DIG_CLANE_1_R_RX_1				0xa522U
+#define CORE_DIG_CLANE_1_R_TX_0				0xa524U
+#define CORE_DIG_CLANE_1_R_RX_2				0xa526U
+#define CORE_DIG_CLANE_1_R_RX_3				0xa528U
+#define CORE_DIG_CLANE_1_RW_HS_TX_0			0xa600U
+#define CORE_DIG_CLANE_1_RW_HS_TX_1			0xa602U
+#define CORE_DIG_CLANE_1_RW_HS_TX_2			0xa604U
+#define CORE_DIG_CLANE_1_RW_HS_TX_3			0xa606U
+#define CORE_DIG_CLANE_1_RW_HS_TX_4			0xa608U
+#define CORE_DIG_CLANE_1_RW_HS_TX_5			0xa60aU
+#define CORE_DIG_CLANE_1_RW_HS_TX_6			0xa60cU
+#define CORE_DIG_CLANE_1_RW_HS_TX_7			0xa60eU
+#define CORE_DIG_CLANE_1_RW_HS_TX_8			0xa610U
+#define CORE_DIG_CLANE_1_RW_HS_TX_9			0xa612U
+#define CORE_DIG_CLANE_1_RW_HS_TX_10			0xa614U
+#define CORE_DIG_CLANE_1_RW_HS_TX_11			0xa616U
+#define CORE_DIG_CLANE_1_RW_HS_TX_12			0xa618U
+#define CORE_DIG_CLANE_1_RW_HS_TX_13			0xa61aU
+#define CORE_DIG_CLANE_2_RW_CFG_0			0xa800U
+#define CORE_DIG_CLANE_2_RW_CFG_2			0xa804U
+#define CORE_DIG_CLANE_2_RW_LP_0			0xa880U
+#define CORE_DIG_CLANE_2_RW_LP_1			0xa882U
+#define CORE_DIG_CLANE_2_RW_LP_2			0xa884U
+#define CORE_DIG_CLANE_2_R_LP_0				0xa8a0U
+#define CORE_DIG_CLANE_2_R_LP_1				0xa8a2U
+#define CORE_DIG_CLANE_2_RW_HS_RX_0			0xa900U
+#define CORE_DIG_CLANE_2_RW_HS_RX_1			0xa902U
+#define CORE_DIG_CLANE_2_RW_HS_RX_2			0xa904U
+#define CORE_DIG_CLANE_2_RW_HS_RX_3			0xa906U
+#define CORE_DIG_CLANE_2_RW_HS_RX_4			0xa908U
+#define CORE_DIG_CLANE_2_RW_HS_RX_5			0xa90aU
+#define CORE_DIG_CLANE_2_RW_HS_RX_6			0xa90cU
+#define CORE_DIG_CLANE_2_R_RX_0				0xa920U
+#define CORE_DIG_CLANE_2_R_RX_1				0xa922U
+#define CORE_DIG_CLANE_2_R_TX_0				0xa924U
+#define CORE_DIG_CLANE_2_R_RX_2				0xa926U
+#define CORE_DIG_CLANE_2_R_RX_3				0xa928U
+#define CORE_DIG_CLANE_2_RW_HS_TX_0			0xaa00U
+#define CORE_DIG_CLANE_2_RW_HS_TX_1			0xaa02U
+#define CORE_DIG_CLANE_2_RW_HS_TX_2			0xaa04U
+#define CORE_DIG_CLANE_2_RW_HS_TX_3			0xaa06U
+#define CORE_DIG_CLANE_2_RW_HS_TX_4			0xaa08U
+#define CORE_DIG_CLANE_2_RW_HS_TX_5			0xaa0aU
+#define CORE_DIG_CLANE_2_RW_HS_TX_6			0xaa0cU
+#define CORE_DIG_CLANE_2_RW_HS_TX_7			0xaa0eU
+#define CORE_DIG_CLANE_2_RW_HS_TX_8			0xaa10U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 851

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define CORE_DIG_CLANE_2_RW_HS_TX_9			0xaa12U
+#define CORE_DIG_CLANE_2_RW_HS_TX_10			0xaa14U
+#define CORE_DIG_CLANE_2_RW_HS_TX_11			0xaa16U
+#define CORE_DIG_CLANE_2_RW_HS_TX_12			0xaa18U
+#define CORE_DIG_CLANE_2_RW_HS_TX_13			0xaa1aU
+
+/* dwc csi host controller registers */
+#define IS_IO_CSI2_HOST_BASE(i)			(IS_IO_BASE + 0x40000U + \
+						 0x2000U * (i))
+#define VERSION					0

I wonder if this HCI has a version? Perhaps a driver on its own would be nice, but that consideration can be left for later I think.

Quoted 196 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +196 -0
+#define N_LANES					0x4U
+#define CSI2_RESETN				0x8U
+#define INT_ST_MAIN				0xcU
+#define DATA_IDS_1				0x10U
+#define DATA_IDS_2				0x14U
+#define CDPHY_MODE				0x1cU
+#define DATA_IDS_VC_1				0x30U
+#define DATA_IDS_VC_2				0x34U
+#define PHY_SHUTDOWNZ				0x40U
+#define DPHY_RSTZ				0x44U
+#define PHY_RX					0x48U
+#define PHY_STOPSTATE				0x4cU
+#define PHY_TEST_CTRL0				0x50U
+#define PHY_TEST_CTRL1				0x54U
+#define PPI_PG_PATTERN_VRES			0x60U
+#define PPI_PG_PATTERN_HRES			0x64U
+#define PPI_PG_CONFIG				0x68U
+#define PPI_PG_ENABLE				0x6cU
+#define PPI_PG_STATUS				0x70U
+#define VC_EXTENSION				0xc8U
+#define PHY_CAL					0xccU
+#define INT_ST_PHY_FATAL			0xe0U
+#define INT_MSK_PHY_FATAL			0xe4U
+#define INT_FORCE_PHY_FATAL			0xe8U
+#define INT_ST_PKT_FATAL			0xf0U
+#define INT_MSK_PKT_FATAL			0xf4U
+#define INT_FORCE_PKT_FATAL			0xf8U
+#define INT_ST_PHY				0x110U
+#define INT_MSK_PHY				0x114U
+#define INT_FORCE_PHY				0x118U
+#define INT_ST_LINE				0x130U
+#define INT_MSK_LINE				0x134U
+#define INT_FORCE_LINE				0x138U
+#define INT_ST_BNDRY_FRAME_FATAL		0x280U
+#define INT_MSK_BNDRY_FRAME_FATAL		0x284U
+#define INT_FORCE_BNDRY_FRAME_FATAL		0x288U
+#define INT_ST_SEQ_FRAME_FATAL			0x290U
+#define INT_MSK_SEQ_FRAME_FATAL			0x294U
+#define INT_FORCE_SEQ_FRAME_FATAL		0x298U
+#define INT_ST_CRC_FRAME_FATAL			0x2a0U
+#define INT_MSK_CRC_FRAME_FATAL			0x2a4U
+#define INT_FORCE_CRC_FRAME_FATAL		0x2a8U
+#define INT_ST_PLD_CRC_FATAL			0x2b0U
+#define INT_MSK_PLD_CRC_FATAL			0x2b4U
+#define INT_FORCE_PLD_CRC_FATAL			0x2b8U
+#define INT_ST_DATA_ID				0x2c0U
+#define INT_MSK_DATA_ID				0x2c4U
+#define INT_FORCE_DATA_ID			0x2c8U
+#define INT_ST_ECC_CORRECTED			0x2d0U
+#define INT_MSK_ECC_CORRECTED			0x2d4U
+#define INT_FORCE_ECC_CORRECTED			0x2d8U
+#define SCRAMBLING				0x300U
+#define SCRAMBLING_SEED1			0x304U
+#define SCRAMBLING_SEED2			0x308U
+#define SCRAMBLING_SEED3			0x30cU
+#define SCRAMBLING_SEED4			0x310U
+#define SCRAMBLING				0x300U
+
+#define IS_IO_CSI2_ADPL_PORT_BASE(i)		(IS_IO_BASE + 0x40800U + \
+						 0x2000U * (i))
+#define CSI2_ADPL_INPUT_MODE			0
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN	0x4U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_ADDR	0x8U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_STATUS		0xcU
+#define CSI2_ADPL_IRQ_CTL_COMMON_STATUS		0xa4U
+#define CSI2_ADPL_IRQ_CTL_COMMON_CLEAR		0xa8U
+#define CSI2_ADPL_IRQ_CTL_COMMON_ENABLE		0xacU
+#define CSI2_ADPL_IRQ_CTL_FS_STATUS		0xbcU
+#define CSI2_ADPL_IRQ_CTL_FS_CLEAR		0xc0U
+#define CSI2_ADPL_IRQ_CTL_FS_ENABLE		0xc4U
+#define CSI2_ADPL_IRQ_CTL_FE_STATUS		0xc8U
+#define CSI2_ADPL_IRQ_CTL_FE_CLEAR		0xccU
+#define CSI2_ADPL_IRQ_CTL_FE_ENABLE		0xd0U
+
+/* software control the legacy csi irq */
+#define IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40c00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40d00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE		(IS_IO_BASE + 0x49000U)
+#define IS_IO_CSI2_IRQ_CTRL_BASE		(IS_IO_BASE + 0x4e100)
+
+#define IRQ_CTL_EDGE				0
+#define IRQ_CTL_MASK				0x4U
+#define IRQ_CTL_STATUS				0x8U
+#define IRQ_CTL_CLEAR				0xcU
+#define IRQ_CTL_ENABLE				0x10U
+/* FE irq for PTL */
+#define IRQ1_CTL_MASK				0x14U
+#define IRQ1_CTL_STATUS				0x18U
+#define IRQ1_CTL_CLEAR				0x1cU
+#define IRQ1_CTL_ENABLE				0x20U
+
+/* software to set the clock gate to use the port or mgc */
+#define IS_IO_GPREGS_BASE			(IS_IO_BASE + 0x49200U)
+#define SRST_PORT_ARB				0
+#define SRST_MGC				0x4U
+#define SRST_WIDTH_CONV				0x8U
+#define SRST_CSI_IRQ				0xcU
+#define SRST_CSI_LEGACY_IRQ			0x10U
+#define CLK_EN_TXCLKESC				0x14U
+#define CLK_DIV_FACTOR_IS_CLK			0x18U
+#define CLK_DIV_FACTOR_APB_CLK			0x1cU
+#define CSI_PORT_CLK_GATE			0x20U
+#define CSI_PORTAB_AGGREGATION			0x24U
+#define MGC_CLK_GATE				0x2cU
+#define CG_CTRL_BITS				0x3cU
+#define SPARE_RW				0xf8U
+#define SPARE_RO				0xfcU
+
+#define IS_IO_CSI2_MPF_PORT_BASE(i)		(IS_IO_BASE + 0x53000U + \
+						 0x1000U * (i))
+#define MPF_16_IRQ_CNTRL_STATUS			0x238U
+#define MPF_16_IRQ_CNTRL_CLEAR			0x23cU
+#define MPF_16_IRQ_CNTRL_ENABLE			0x240U
+
+/* software config the phy */
+#define IS_IO_CSI2_GPREGS_BASE		(IS_IO_BASE + 0x53400U)
+#define IPU8_IS_IO_CSI2_GPREGS_BASE	(IS_IO_BASE + 0x40e00U)
+#define CSI_ADAPT_LAYER_SRST		0
+#define MPF_SRST_RST			0x4U
+#define CSI_ERR_IRQ_CTRL_SRST		0x8U
+#define CSI_SYNC_RC_SRST		0xcU
+#define CSI_CG_CTRL_BITS		0x10U
+#define SOC_CSI2HOST_SELECT		0x14U
+#define PHY_RESET			0x18U
+#define PHY_SHUTDOWN			0x1cU
+#define PHY_MODE			0x20U
+#define PHY_READY			0x24U
+#define PHY_CLK_LANE_FORCE_CONTROL	0x28U
+#define PHY_CLK_LANE_CONTROL		0x2cU
+#define PHY_CLK_LANE_STATUS		0x30U
+#define PHY_LANE_RX_ESC_REQ		0x34U
+#define PHY_LANE_RX_ESC_DATA		0x38U
+#define PHY_LANE_TURNDISABLE		0x3cU
+#define PHY_LANE_DIRECTION		0x40U
+#define PHY_LANE_FORCE_CONTROL		0x44U
+#define PHY_LANE_CONTROL_EN		0x48U
+#define PHY_LANE_CONTROL_DATAWIDTH	0x4cU
+#define PHY_LANE_STATUS			0x50U
+#define PHY_LANE_ERR			0x54U
+#define PHY_LANE_RXALP			0x58U
+#define PHY_LANE_RXALP_NIBBLE		0x5cU
+#define PHY_PARITY_ERROR		0x60U
+#define PHY_DEBUG_REGS_CLK_GATE_EN	0x64U
+#define SPARE_RW			0xf8U
+#define SPARE_RO			0xfcU
+
+/* software not touch */
+#define PORT_ARB_BASE				(IS_IO_BASE + 0x4e000)
+#define PORT_ARB_IRQ_CTL_STATUS			0x4U
+#define PORT_ARB_IRQ_CTL_CLEAR			0x8U
+#define PORT_ARB_IRQ_CTL_ENABLE			0xcU
+
+#define MGC_PPC					4U
+#define MGC_DTYPE_RAW(i)			(((i) - 8) / 2)
+#define IS_IO_MGC_BASE				(IS_IO_BASE + 0x48000U)
+#define MGC_KICK				0
+#define MGC_ASYNC_STOP				0x4U
+#define MGC_PORT_OFFSET				0x100U
+#define MGC_CSI_PORT_MAP(i)			(0x8 + (i) * 0x4)
+#define MGC_MG_PORT(i)				(IS_IO_MGC_BASE +	\
+						 (i) * MGC_PORT_OFFSET)
+/* per mgc instance */
+#define MGC_MG_CSI_ADAPT_LAYER_TYPE		0x28U
+#define MGC_MG_MODE				0x2cU
+#define MGC_MG_INIT_COUNTER			0x30U
+#define MGC_MG_MIPI_VC				0x34U
+#define MGC_MG_MIPI_DTYPES			0x38U
+#define MGC_MG_MULTI_DTYPES_MODE		0x3cU
+#define MGC_MG_NOF_FRAMES			0x40U
+#define MGC_MG_FRAME_DIM			0x44U
+#define MGC_MG_HBLANK				0x48U
+#define MGC_MG_VBLANK				0x4cU
+#define MGC_MG_TPG_MODE				0x50U
+#define MGC_MG_TPG_R0				0x54U
+#define MGC_MG_TPG_G0				0x58U
+#define MGC_MG_TPG_B0				0x5cU
+#define MGC_MG_TPG_R1				0x60U
+#define MGC_MG_TPG_G1				0x64U
+#define MGC_MG_TPG_B1				0x68U
+#define MGC_MG_TPG_FACTORS			0x6cU
+#define MGC_MG_TPG_MASKS			0x70U
+#define MGC_MG_TPG_XY_MASK			0x74U
+#define MGC_MG_TPG_TILE_DIM			0x78U
+#define MGC_MG_PRBS_LFSR_INIT_0			0x7cU
+#define MGC_MG_PRBS_LFSR_INIT_1			0x80U
+#define MGC_MG_SYNC_STOP_POINT			0x84U
+#define MGC_MG_SYNC_STOP_POINT_LOC		0x88U
+#define MGC_MG_ERR_INJECT			0x8cU
+#define MGC_MG_ERR_LOCATION			0x90U
+#define MGC_MG_DTO_SPEED_CTRL_EN		0x94U
+#define MGC_MG_DTO_SPEED_CTRL_INCR_VAL		0x98U
+#define MGC_MG_HOR_LOC_STTS			0x9cU
+#define MGC_MG_VER_LOC_STTS			0xa0U
+#define MGC_MG_FRAME_NUM_STTS			0xa4U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1057

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define MGC_MG_BUSY_STTS			0xa8U
+#define MGC_MG_STOPPED_STTS			0xacU
+/* tile width and height in pixels for Chess board and Color palette */
+#define MGC_TPG_TILE_WIDTH			64U
+#define MGC_TPG_TILE_HEIGHT			64U
+
+#define IPU_CSI_PORT_A_ADDR_OFFSET		0
+#define IPU_CSI_PORT_B_ADDR_OFFSET		0
+#define IPU_CSI_PORT_C_ADDR_OFFSET		0
+#define IPU_CSI_PORT_D_ADDR_OFFSET		0

All 0?

Quoted 13 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +13 -0
+
+/*
+ * 0 - CSI RX Port 0 interrupt;
+ * 1 - MPF Port 0 interrupt;
+ * 2 - CSI RX Port 1 interrupt;
+ * 3 - MPF Port 1 interrupt;
+ * 4 - CSI RX Port 2 interrupt;
+ * 5 - MPF Port 2 interrupt;
+ * 6 - CSI RX Port 3 interrupt;
+ * 7 - MPF Port 3 interrupt;
+ * 8 - Port ARB FIFO 0 overflow;
+ * 9 - Port ARB FIFO 1 overflow;
+ * 10 - Port ARB FIFO 2 overflow;

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1080

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+ * 11 - Port ARB FIFO 3 overflow;
+ * 12 - isys_cfgnoc_err_probe_intl;
+ * 13-15 - reserved
+ */
+#define IPU7_CSI_IS_IO_IRQ_MASK		0xffffU
+
+/* Adapter layer irq */
+#define IPU7_CSI_ADPL_IRQ_MASK		0xffffU
+
+/* sw irq from legacy irq control

/*
*

Quoted 168 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +117 -0
+ * legacy irq status
+ * IPU7
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 sync interrupt
+ * 2 - CSI Port 1 error interrupt
+ * 3 - CSI Port 1 sync interrupt
+ * 4 - CSI Port 2 error interrupt
+ * 5 - CSI Port 2 sync interrupt
+ * 6 - CSI Port 3 error interrupt
+ * 7 - CSI Port 3 sync interrupt
+ * IPU7P5
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 fs interrupt
+ * 2 - CSI Port 0 fe interrupt
+ * 3 - CSI Port 1 error interrupt
+ * 4 - CSI Port 1 fs interrupt
+ * 5 - CSI Port 1 fe interrupt
+ * 6 - CSI Port 2 error interrupt
+ * 7 - CSI Port 2 fs interrupt
+ * 8 - CSI Port 2 fe interrupt
+ */
+#define IPU7_CSI_RX_LEGACY_IRQ_MASK		0x1ffU
+
+/* legacy error status per port
+ * 0 - Error handler FIFO full;
+ * 1 - Reserved Short Packet encoding detected;
+ * 2 - Reserved Long Packet encoding detected;
+ * 3 - Received packet is too short (fewer data words than specified in header);
+ * 4 - Received packet is too long (more data words than specified in header);
+ * 5 - Short packet discarded due to errors;
+ * 6 - Long packet discarded due to errors;
+ * 7 - CSI Combo Rx interrupt;
+ * 8 - IDI CDC FIFO overflow; remaining bits are reserved and tied to 0;
+ */
+#define IPU7_CSI_RX_ERROR_IRQ_MASK		0xfffU
+
+/*
+ * 0 - VC0 frame start received
+ * 1 - VC0 frame end received
+ * 2 - VC1 frame start received
+ * 3 - VC1 frame end received
+ * 4 - VC2 frame start received
+ * 5 - VC2 frame end received
+ * 6 - VC3 frame start received
+ * 7 - VC3 frame end received
+ * 8 - VC4 frame start received
+ * 9 - VC4 frame end received
+ * 10 - VC5 frame start received
+ * 11 - VC5 frame end received
+ * 12 - VC6 frame start received
+ * 13 - VC6 frame end received
+ * 14 - VC7 frame start received
+ * 15 - VC7 frame end received
+ * 16 - VC8 frame start received
+ * 17 - VC8 frame end received
+ * 18 - VC9 frame start received
+ * 19 - VC9 frame end received
+ * 20 - VC10 frame start received
+ * 21 - VC10 frame end received
+ * 22 - VC11 frame start received
+ * 23 - VC11 frame end received
+ * 24 - VC12 frame start received
+ * 25 - VC12 frame end received
+ * 26 - VC13 frame start received
+ * 27 - VC13 frame end received
+ * 28 - VC14 frame start received
+ * 29 - VC14 frame end received
+ * 30 - VC15 frame start received
+ * 31 - VC15 frame end received
+ */
+
+#define IPU7_CSI_RX_SYNC_IRQ_MASK		0 /* 0xffffffff */
+#define IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK		0 /* 0xffffffff */
+
+#define CSI_RX_NUM_ERRORS_IN_IRQ		12U
+#define CSI_RX_NUM_SYNC_IN_IRQ			32U
+
+enum CSI_FE_MODE_TYPE {
+	CSI_FE_DPHY_MODE = 0,
+	CSI_FE_CPHY_MODE = 1,
+};
+
+enum CSI_FE_INPUT_MODE {
+	CSI_SENSOR_INPUT = 0,
+	CSI_MIPIGEN_INPUT = 1,
+};
+
+enum MGC_CSI_ADPL_TYPE {
+	MGC_MAPPED_2_LANES = 0,
+	MGC_MAPPED_4_LANES = 1,
+};
+
+enum CSI2HOST_SELECTION {
+	CSI2HOST_SEL_SOC = 0,
+	CSI2HOST_SEL_CSI2HOST = 1,
+};
+
+#define IPU7_ISYS_LEGACY_IRQ_CSI2(port)		(0x3U << (port))
+#define IPU7P5_ISYS_LEGACY_IRQ_CSI2(port)	(0x7U << (port))
+
+/* ---------------------------------------------------------------- */
+#define CSI_REG_BASE				0x220000U
+#define CSI_REG_BASE_PORT(id)			((id) * 0x1000)
+
+/* CSI Port General Purpose Registers */
+#define CSI_REG_PORT_GPREG_SRST			0
+#define CSI_REG_PORT_GPREG_CSI2_SLV_REG_SRST	0x4U
+#define CSI_REG_PORT_GPREG_CSI2_PORT_CONTROL	0x8U
+
+#define CSI_RX_NUM_IRQ				32U
+
+#define IPU7_CSI_RX_SYNC_FS_VC			0x55555555U
+#define IPU7_CSI_RX_SYNC_FE_VC			0xaaaaaaaaU
+#define IPU7P5_CSI_RX_SYNC_FS_VC		0xffffU
+#define IPU7P5_CSI_RX_SYNC_FE_VC		0xffffU
+
+#endif /* IPU7_ISYS_CSI2_REG_H */
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +45 -0
new file mode 100644
index 000000000000..ae504fb41464
@@ -0,0 +1,542 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#include <linux/atomic.h>
+#include <linux/bits.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/minmax.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+
+#include <media/media-entity.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-subdev.h>
+
+#include "ipu7.h"
+#include "ipu7-bus.h"
+#include "ipu7-isys.h"
+#include "ipu7-isys-csi2.h"
+#include "ipu7-isys-csi2-regs.h"
+#include "ipu7-isys-csi-phy.h"
+
+static const u32 csi2_supported_codes[] = {
+	MEDIA_BUS_FMT_Y10_1X10,
+	MEDIA_BUS_FMT_RGB565_1X16,
+	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_UYVY8_1X16,
+	MEDIA_BUS_FMT_YUYV8_1X16,
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_SBGGR10_1X10,
+	MEDIA_BUS_FMT_SGBRG10_1X10,
+	MEDIA_BUS_FMT_SGRBG10_1X10,
+	MEDIA_BUS_FMT_SRGGB10_1X10,
+	MEDIA_BUS_FMT_SBGGR12_1X12,
+	MEDIA_BUS_FMT_SGBRG12_1X12,
+	MEDIA_BUS_FMT_SGRBG12_1X12,
+	MEDIA_BUS_FMT_SRGGB12_1X12,
+	MEDIA_BUS_FMT_SBGGR8_1X8,
+	MEDIA_BUS_FMT_SGBRG8_1X8,

drivers/staging/media/ipu7/ipu7-isys-csi2.c line 55

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +10 -0
+	MEDIA_BUS_FMT_SGRBG8_1X8,
+	MEDIA_BUS_FMT_SRGGB8_1X8,
+	0,
+};
+
+s64 ipu7_isys_csi2_get_link_freq(struct ipu7_isys_csi2 *csi2)
+{
+	struct media_pad *src_pad;
+
+	if (!csi2)

Can this be NULL?

drivers/staging/media/ipu7/ipu7-isys-csi2.h

Quoted 518 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +487 -0
+		return -EINVAL;
+
+	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
+	if (IS_ERR(src_pad)) {
+		dev_err(&csi2->isys->adev->auxdev.dev,
+			"can't get source pad of %s (%ld)\n",
+			csi2->asd.sd.name, PTR_ERR(src_pad));
+		return PTR_ERR(src_pad);
+	}
+
+	return v4l2_get_link_freq(src_pad, 0, 0);
+}
+
+static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
+				struct v4l2_event_subscription *sub)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "csi2 subscribe event(type %u id %u)\n",
+		sub->type, sub->id);
+
+	switch (sub->type) {
+	case V4L2_EVENT_FRAME_SYNC:
+		return v4l2_event_subscribe(fh, sub, 10, NULL);
+	case V4L2_EVENT_CTRL:
+		return v4l2_ctrl_subscribe_event(fh, sub);
+	default:
+		return -EINVAL;
+	}
+}
+
+static const struct v4l2_subdev_core_ops csi2_sd_core_ops = {
+	.subscribe_event = csi2_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static void csi2_irq_en(struct ipu7_isys_csi2 *csi2, bool enable)
+{
+	struct ipu7_device *isp = csi2->isys->adev->isp;
+	unsigned int offset, mask;
+
+	if (!enable) {
+		/* disable CSI2 legacy error irq */
+		offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		/* disable CSI2 legacy sync irq */
+		offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		if (!is_ipu7(isp->hw_ver)) {
+			writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+			writel(0, csi2->base + offset + IRQ1_CTL_MASK);
+			writel(0, csi2->base + offset + IRQ1_CTL_ENABLE);
+		}
+
+		return;
+	}
+
+	/* enable CSI2 legacy error irq */
+	offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	/* enable CSI2 legacy sync irq */
+	offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	mask = IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK;
+	if (!is_ipu7(isp->hw_ver)) {
+		writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+		writel(mask, csi2->base + offset + IRQ1_CTL_MASK);
+		writel(mask, csi2->base + offset + IRQ1_CTL_ENABLE);
+	}
+}
+
+static void ipu7_isys_csi2_disable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	void __iomem *isys_base = isys->pdata->base;
+
+	ipu7_isys_csi_phy_powerdown(csi2);
+
+	writel(0x4, isys_base + IS_IO_GPREGS_BASE + CLK_DIV_FACTOR_APB_CLK);
+	csi2_irq_en(csi2, 0);
+}
+
+static int ipu7_isys_csi2_enable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	struct device *dev = &isys->adev->auxdev.dev;
+	void __iomem *isys_base = isys->pdata->base;
+	unsigned int port, nlanes, offset;
+	int ret;
+
+	port = csi2->port;
+	nlanes = csi2->nlanes;
+
+	offset = IS_IO_GPREGS_BASE;
+	writel(0x2, isys_base + offset + CLK_DIV_FACTOR_APB_CLK);
+	dev_dbg(dev, "port %u CLK_GATE = 0x%04x DIV_FACTOR_APB_CLK=0x%04x\n",
+		port, readl(isys_base + offset + CSI_PORT_CLK_GATE),
+		readl(isys_base + offset + CLK_DIV_FACTOR_APB_CLK));
+	if (port == 0U && nlanes == 4U && !is_ipu7(isys->adev->isp->hw_ver)) {
+		dev_dbg(dev, "CSI port %u in aggregation mode\n", port);
+		writel(0x1, isys_base + offset + CSI_PORTAB_AGGREGATION);
+	}
+
+	/* input is coming from CSI receiver (sensor) */
+	offset = IS_IO_CSI2_ADPL_PORT_BASE(port);
+	writel(CSI_SENSOR_INPUT, isys_base + offset + CSI2_ADPL_INPUT_MODE);
+	writel(1, isys_base + offset + CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN);
+
+	ret = ipu7_isys_csi_phy_powerup(csi2);
+	if (ret) {
+		dev_err(dev, "CSI-%d PHY power up failed %d\n", port, ret);
+		return ret;
+	}
+	csi2_irq_en(csi2, 1);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_set_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct device *dev = &asd->isys->adev->auxdev.dev;
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_mbus_framefmt *src_ffmt;
+	struct v4l2_rect *crop;
+
+	if (sel->pad == CSI2_PAD_SINK || sel->target != V4L2_SEL_TGT_CROP)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	src_ffmt = v4l2_subdev_state_get_format(state, sel->pad, sel->stream);
+	if (!src_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	/* Only vertical cropping is supported */
+	sel->r.left = 0;
+	sel->r.width = sink_ffmt->width;
+	/* Non-bayer formats can't be single line cropped */
+	if (!ipu7_isys_is_bayer_format(sink_ffmt->code))
+		sel->r.top &= ~1U;
+	sel->r.height = clamp(sel->r.height & ~1U, IPU_ISYS_MIN_HEIGHT,
+			      sink_ffmt->height - sel->r.top);
+	*crop = sel->r;
+
+	/* update source pad format */
+	src_ffmt->width = sel->r.width;
+	src_ffmt->height = sel->r.height;
+	if (ipu7_isys_is_bayer_format(sink_ffmt->code))
+		src_ffmt->code = ipu7_isys_convert_bayer_order(sink_ffmt->code,
+							       sel->r.left,
+							       sel->r.top);
+	dev_dbg(dev, "set crop for %s sel: %d,%d,%d,%d code: 0x%x\n",
+		sd->name, sel->r.left, sel->r.top, sel->r.width, sel->r.height,
+		src_ffmt->code);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_get_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_rect *crop;
+	int ret = 0;
+
+	if (sd->entity.pads[sel->pad].flags & MEDIA_PAD_FL_SINK)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = sink_ffmt->width;
+		sel->r.height = sink_ffmt->height;
+		break;
+	case V4L2_SEL_TGT_CROP:
+		sel->r = *crop;
+		break;
+	default:
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
+/*
+ * Maximum stream ID is 63 for now, as we use u64 bitmask to represent a set
+ * of streams.
+ */
+#define CSI2_SUBDEV_MAX_STREAM_ID 63
+
+static int ipu7_isys_csi2_enable_streams(struct v4l2_subdev *sd,
+					 struct v4l2_subdev_state *state,
+					 u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	if (!csi2->stream_count) {
+		dev_dbg(&csi2->isys->adev->auxdev.dev,
+			"stream on CSI2-%u with %u lanes\n", csi2->port,
+			csi2->nlanes);
+		ret = ipu7_isys_csi2_enable_stream(csi2);
+		if (ret)
+			return ret;
+	}
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	ret = v4l2_subdev_enable_streams(r_sd, r_pad->index,
+					 BIT_ULL(sink_stream));
+	if (!ret) {
+		csi2->stream_count++;
+		return 0;
+	}
+
+	if (!csi2->stream_count)
+		ipu7_isys_csi2_disable_stream(csi2);
+
+	return ret;
+}
+
+static int ipu7_isys_csi2_disable_streams(struct v4l2_subdev *sd,
+					  struct v4l2_subdev_state *state,
+					  u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	v4l2_subdev_disable_streams(r_sd, r_pad->index, BIT_ULL(sink_stream));
+
+	if (--csi2->stream_count)
+		return 0;
+
+	dev_dbg(&csi2->isys->adev->auxdev.dev,
+		"stream off CSI2-%u with %u lanes\n", csi2->port, csi2->nlanes);
+
+	ipu7_isys_csi2_disable_stream(csi2);
+
+	return 0;
+}
+
+static const struct v4l2_subdev_pad_ops csi2_sd_pad_ops = {
+	.get_fmt = v4l2_subdev_get_fmt,
+	.set_fmt = ipu7_isys_subdev_set_fmt,
+	.get_selection = ipu7_isys_csi2_get_sel,
+	.set_selection = ipu7_isys_csi2_set_sel,
+	.enum_mbus_code = ipu7_isys_subdev_enum_mbus_code,
+	.enable_streams = ipu7_isys_csi2_enable_streams,
+	.disable_streams = ipu7_isys_csi2_disable_streams,
+	.set_routing = ipu7_isys_subdev_set_routing,
+};
+
+static const struct v4l2_subdev_ops csi2_sd_ops = {
+	.core = &csi2_sd_core_ops,
+	.pad = &csi2_sd_pad_ops,
+};
+
+static const struct media_entity_operations csi2_entity_ops = {
+	.link_validate = v4l2_subdev_link_validate,
+	.has_pad_interdep = v4l2_subdev_has_pad_interdep,
+};
+
+void ipu7_isys_csi2_cleanup(struct ipu7_isys_csi2 *csi2)
+{
+	if (!csi2->isys)
+		return;
+
+	v4l2_device_unregister_subdev(&csi2->asd.sd);
+	v4l2_subdev_cleanup(&csi2->asd.sd);
+	ipu7_isys_subdev_cleanup(&csi2->asd);
+	csi2->isys = NULL;
+}
+
+int ipu7_isys_csi2_init(struct ipu7_isys_csi2 *csi2,
+			struct ipu7_isys *isys,
+			void __iomem *base, unsigned int index)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +25 -0
new file mode 100644
index 000000000000..ea4e20525d16

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

These seem to require IPU7 prefix, too. It'd be nice to move them into a struct, specific to IPU version.

drivers/staging/media/ipu7/ipu7-isys-csi2.h

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +10 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

These are the same for IPU6, aren't they?

Signature · 1 line
Sakari Ailus

Part of the diff is not shown here. View the raw message.

#12 lore raw

Re: [PATCH 6/8] media: staging/ipu7: add IPU7 input system device driver

Sakari,

Thanks for your review.

Quoted 508 lines · Sakari Ailus

Hi Bingbu,

drivers/staging/media/ipu7/TODO

Quoted 60 lines · On Tue, Apr 29, 2025 at 11:28:39AM +0800, [email protected] wrote:

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/staging/media/ipu7/TODO               |   13 +
 drivers/staging/media/ipu7/ipu7-fw-isys.c     |  301 +++++
 drivers/staging/media/ipu7/ipu7-fw-isys.h     |   39 +
 .../staging/media/ipu7/ipu7-isys-csi-phy.c    | 1028 ++++++++++++++
 .../staging/media/ipu7/ipu7-isys-csi-phy.h    |   16 +
 .../staging/media/ipu7/ipu7-isys-csi2-regs.h  | 1197 +++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |  542 ++++++++
 drivers/staging/media/ipu7/ipu7-isys-csi2.h   |   73 +
 drivers/staging/media/ipu7/ipu7-isys-queue.c  |  838 ++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-queue.h  |   72 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |  381 ++++++
 drivers/staging/media/ipu7/ipu7-isys-subdev.h |   55 +
 drivers/staging/media/ipu7/ipu7-isys-video.c  | 1127 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys-video.h  |  117 ++
 drivers/staging/media/ipu7/ipu7-isys.c        | 1170 ++++++++++++++++
 drivers/staging/media/ipu7/ipu7-isys.h        |  142 ++
 16 files changed, 7111 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/TODO
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-fw-isys.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi-phy.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-csi2.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-queue.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-subdev.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys-video.h
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.c
 create mode 100644 drivers/staging/media/ipu7/ipu7-isys.h
drivers/staging/media/ipu7/TODO new file +0 -0
new file mode 100644
index 000000000000..fcdf95c696fb
@@ -0,0 +1,12 @@

I'd move this change to the patch with the Makefile / Kconfig files.

drivers/staging/media/ipu7/TODO line 11

Quoted 11 lines
drivers/staging/media/ipu7/TODO new file +11 -0
+This is a list of things that need to be done to get this driver out of the
+staging directory.
+
+- Add metadata capture support
+  The IPU7 hardware should support metadata capture, but it is not
+  fully verified with IPU7 firmware ABI so far, need to add the metadata
+  capture support.
+
+- Work with the common IPU ISYS module
+  Sakari commented much of the driver code is the same than the IPU6 driver.
+  IPU7 ISYS driver is expected to work with the common IPU ISYS module in future.

The same goes for the main IPU driver, there will be a similar common module of that comparable to the ISYS common module.

Quoted 427 lines
drivers/staging/media/ipu7/TODO new file +1 -0
+
drivers/staging/media/ipu7/ipu7-fw-isys.c new file +301 -0
new file mode 100644
index 000000000000..e4b9c364572b
@@ -0,0 +1,301 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 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 * const send_msg_types[N_IPU_INSYS_SEND_TYPE] = {
+	"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 (struct ipu7_insys_resp *)
+		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/staging/media/ipu7/ipu7-fw-isys.h new file +39 -0
new file mode 100644
index 000000000000..b556feda6b08
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi-phy.c new file +68 -0
new file mode 100644
index 000000000000..e275ed393e7d
@@ -0,0 +1,1028 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#include <linux/bitmap.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <media/mipi-csi2.h>
+#include <media/v4l2-device.h>
+
+#include "ipu7.h"
+#include "ipu7-bus.h"
+#include "ipu7-buttress.h"
+#include "ipu7-isys.h"
+#include "ipu7-isys-csi2.h"
+#include "ipu7-isys-csi2-regs.h"
+#include "ipu7-platform-regs.h"
+#include "ipu7-isys-csi-phy.h"
+
+#define PORT_A	0U
+#define PORT_B	1U
+#define PORT_C	2U
+#define PORT_D	3U
+
+struct ddlcal_counter_ref_s {
+	u16 min_mbps;
+	u16 max_mbps;
+
+	u16 ddlcal_counter_ref;
+};
+
+struct ddlcal_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 oa_lanex_hsrx_cdphy_sel_fast;
+	u16 ddlcal_max_phase;
+	u16 phase_bound;
+	u16 ddlcal_dll_fbk;
+	u16 ddlcal_ddl_coarse_bank;
+	u16 fjump_deskew;
+	u16 min_eye_opening_deskew;
+};
+
+struct i_thssettle_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 i_thssettle;
+};
+
+ /* lane2 for 4l3t, lane1 for 2l2t */
+struct oa_lane_clk_div_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 oa_lane_hsrx_hs_clk_div;
+};
+
+struct cdr_fbk_cap_prog_params {
+	u16 min_mbps;
+	u16 max_mbps;
+	u16 val;
+};
+
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 74

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +6 -0
+static const struct ddlcal_counter_ref_s table0[] = {
+	{1500, 1999, 118},
+	{2000, 2499, 157},
+	{2500, 3499, 196},
+	{3500, 4499, 274},
+	{4500, 4500, 352},

Spaces inside braces, please.

Will fix in v2.

Quoted 244 lines
Quoted 180 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +179 -0
+	{}
+};
+
+static const struct ddlcal_params table1[] = {
+	{1500, 1587, 0, 143, 167, 17, 3, 4, 29},
+	{1588, 1687, 0, 135, 167, 15, 3, 4, 27},
+	{1688, 1799, 0, 127, 135, 15, 2, 4, 26},
+	{1800, 1928, 0, 119, 135, 13, 2, 3, 24},
+	{1929, 2076, 0, 111, 135, 13, 2, 3, 23},
+	{2077, 2249, 0, 103, 135, 11, 2, 3, 21},
+	{2250, 2454, 0, 95, 103, 11, 1, 3, 19},
+	{2455, 2699, 0, 87, 103, 9, 1, 3, 18},
+	{2700, 2999, 0, 79, 103, 9, 1, 2, 16},
+	{3000, 3229, 0, 71, 71, 7, 1, 2, 15},
+	{3230, 3599, 1, 87, 103, 9, 1, 3, 18},
+	{3600, 3999, 1, 79, 103, 9, 1, 2, 16},
+	{4000, 4499, 1, 71, 103, 7, 1, 2, 15},
+	{4500, 4500, 1, 63, 71, 7, 0, 2, 13},
+	{}
+};
+
+static const struct i_thssettle_params table2[] = {
+	{80, 124, 24},
+	{125, 249, 20},
+	{250, 499, 16},
+	{500, 749, 14},
+	{750, 1499, 13},
+	{1500, 4500, 12},
+	{}
+};
+
+static const struct oa_lane_clk_div_params table6[] = {
+	{80, 159, 0x1},
+	{160, 319, 0x2},
+	{320, 639, 0x3},
+	{640, 1279, 0x4},
+	{1280, 2560, 0x5},
+	{2561, 4500, 0x6},
+	{}
+};
+
+static const struct cdr_fbk_cap_prog_params table7[] = {
+	{80, 919, 0},
+	{920, 1029, 1},
+	{1030, 1169, 2},
+	{1170, 1349, 3},
+	{1350, 1589, 4},
+	{1590, 1949, 5},
+	{1950, 2499, 6},
+	{}
+};
+
+static void dwc_phy_write(struct ipu7_isys *isys, u32 id, u32 addr, u16 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CDPHY_BASE(id);
+
+	dev_dbg(&isys->adev->auxdev.dev, "phy write: reg 0x%zx = data 0x%04x",
+		base + addr - isys_base, data);
+	writew(data, base + addr);
+}
+
+static u16 dwc_phy_read(struct ipu7_isys *isys, u32 id, u32 addr)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CDPHY_BASE(id);
+	u16 data;
+
+	data = readw(base + addr);
+	dev_dbg(&isys->adev->auxdev.dev, "phy read: reg 0x%zx = data 0x%04x",
+		base + addr - isys_base, data);
+
+	return data;
+}
+
+static void dwc_csi_write(struct ipu7_isys *isys, u32 id, u32 addr, u32 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CSI2_HOST_BASE(id);
+	struct device *dev = &isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "csi write: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, data);
+	writel(data, base + addr);
+	dev_dbg(dev, "csi read: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, readl(base + addr));
+}
+
+static void gpreg_write(struct ipu7_isys *isys, u32 id, u32 addr, u32 data)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	u32 gpreg = isys->pdata->ipdata->csi2.gpreg;
+	void __iomem *base = isys_base + gpreg + 0x1000 * id;
+	struct device *dev = &isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "gpreg write: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, data);
+	writel(data, base + addr);
+	dev_dbg(dev, "gpreg read: reg 0x%zx = data 0x%08x",
+		base + addr - isys_base, readl(base + addr));
+}
+
+static u32 dwc_csi_read(struct ipu7_isys *isys, u32 id, u32 addr)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	void __iomem *base = isys_base + IS_IO_CSI2_HOST_BASE(id);
+	u32 data;
+
+	data = readl(base + addr);
+	dev_dbg(&isys->adev->auxdev.dev, "csi read: reg 0x%zx = data 0x%x",
+		base + addr - isys_base, data);
+
+	return data;
+}
+
+static void dwc_phy_write_mask(struct ipu7_isys *isys, u32 id, u32 addr,
+			       u16 val, u8 lo, u8 hi)
+{
+	u32 temp, mask;
+
+	WARN_ON(lo > hi);
+	WARN_ON(hi > 15);
+
+	mask = ((~0U - (1U << lo) + 1U)) & (~0U >> (31 - hi));
+	temp = dwc_phy_read(isys, id, addr);
+	temp &= ~mask;
+	temp |= (val << lo) & mask;
+	dwc_phy_write(isys, id, addr, temp);
+}
+
+static void dwc_csi_write_mask(struct ipu7_isys *isys, u32 id, u32 addr,
+			       u32 val, u8 hi, u8 lo)
+{
+	u32 temp, mask;
+
+	WARN_ON(lo > hi);
+
+	mask = ((~0U - (1U << lo) + 1U)) & (~0U >> (31 - hi));
+	temp = dwc_csi_read(isys, id, addr);
+	temp &= ~mask;
+	temp |= (val << lo) & mask;
+	dwc_csi_write(isys, id, addr, temp);
+}
+
+static void ipu7_isys_csi_ctrl_cfg(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	struct device *dev = &isys->adev->auxdev.dev;
+	u32 id, lanes, phy_mode;
+	u32 val;
+
+	id = csi2->port;
+	lanes = csi2->nlanes;
+	phy_mode = csi2->phy_mode;
+	dev_dbg(dev, "csi-%d controller init with %u lanes, phy mode %u",
+		id, lanes, phy_mode);
+
+	val = dwc_csi_read(isys, id, VERSION);
+	dev_dbg(dev, "csi-%d controller version = 0x%x", id, val);
+
+	/* num of active data lanes */
+	dwc_csi_write(isys, id, N_LANES, lanes - 1);
+	dwc_csi_write(isys, id, CDPHY_MODE, phy_mode);
+	dwc_csi_write(isys, id, VC_EXTENSION, 0);
+
+	/* only mask PHY_FATAL and PKT_FATAL interrupts */
+	dwc_csi_write(isys, id, INT_MSK_PHY_FATAL, 0xff);
+	dwc_csi_write(isys, id, INT_MSK_PKT_FATAL, 0x3);
+	dwc_csi_write(isys, id, INT_MSK_PHY, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_LINE, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_BNDRY_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_SEQ_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_CRC_FRAME_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_PLD_CRC_FATAL, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_DATA_ID, 0x0);
+	dwc_csi_write(isys, id, INT_MSK_ECC_CORRECTED, 0x0);
+}
+
+static void ipu7_isys_csi_phy_reset(struct ipu7_isys *isys, u32 id)

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 263

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+{
+	dwc_csi_write(isys, id, PHY_SHUTDOWNZ, 0);
+	dwc_csi_write(isys, id, DPHY_RSTZ, 0);
+	dwc_csi_write(isys, id, CSI2_RESETN, 0);
+	gpreg_write(isys, id, PHY_RESET, 0);
+	gpreg_write(isys, id, PHY_SHUTDOWN, 0);
+}
+
+#define N_DATA_IDS		8
+static DECLARE_BITMAP(data_ids, N_DATA_IDS);

Please move to device context struct.

Quoted 51 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +51 -0
+/* 8 Data ID monitors, each Data ID is composed by pair of VC and data type */
+static int __dids_config(struct ipu7_isys_csi2 *csi2, u32 id, u8 vc, u8 dt)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	u32 reg, n;
+	u8 lo, hi;
+	int ret;
+
+	dev_dbg(&isys->adev->auxdev.dev, "config CSI-%u with vc:%u dt:0x%02x\n",
+		id, vc, dt);
+
+	dwc_csi_write(isys, id, VC_EXTENSION, 0x0);
+	n = find_first_zero_bit(data_ids, N_DATA_IDS);
+	if (n == N_DATA_IDS)
+		return -ENOSPC;
+
+	ret = test_and_set_bit(n, data_ids);
+	if (ret)
+		return -EBUSY;
+
+	reg = n < 4 ? DATA_IDS_VC_1 : DATA_IDS_VC_2;
+	lo = (n % 4) * 8;
+	hi = lo + 4;
+	dwc_csi_write_mask(isys, id, reg, vc & GENMASK(4, 0), hi, lo);
+
+	reg = n < 4 ? DATA_IDS_1 : DATA_IDS_2;
+	lo = (n % 4) * 8;
+	hi = lo + 5;
+	dwc_csi_write_mask(isys, id, reg, dt & GENMASK(5, 0), hi, lo);
+
+	return 0;
+}
+
+static int ipu7_isys_csi_ctrl_dids_config(struct ipu7_isys_csi2 *csi2, u32 id)
+{
+	struct v4l2_mbus_frame_desc_entry *desc_entry = NULL;
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+	struct v4l2_mbus_frame_desc desc;
+	struct v4l2_subdev *ext_sd;
+	struct media_pad *pad;
+	unsigned int i;
+	int ret;
+
+	pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
+	if (IS_ERR(pad)) {
+		dev_warn(dev, "can't get remote source pad of %s (%ld)\n",
+			 csi2->asd.sd.name, PTR_ERR(pad));
+		return PTR_ERR(pad);
+	}
+
+	ext_sd = media_entity_to_v4l2_subdev(pad->entity);
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 319

Quoted 5 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +5 -0
+	if (WARN(!ext_sd, "Failed to get subdev for entity %s\n",
+		 pad->entity->name))
+		return -ENODEV;
+
+	ret = v4l2_subdev_call(ext_sd, pad, get_frame_desc, pad->index, &desc);

Note that not all sensor drivers support get_frame_desc. Your driver should also work with those.

The caller ignore the returned errors now.

Quoted 283 lines
Quoted 13 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +12 -0
+	if (ret)
+		return ret;
+
+	if (desc.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) {
+		dev_warn(dev, "Unsupported frame descriptor type\n");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < desc.num_entries; i++) {
+		desc_entry = &desc.entry[i];
+		if (desc_entry->bus.csi2.vc < NR_OF_CSI2_VC) {
+			ret = __dids_config(csi2, id, desc_entry->bus.csi2.vc,

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 341

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+					    desc_entry->bus.csi2.dt);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
+#define CDPHY_TIMEOUT (5000000)

No need for parenthesis.

Quoted 50 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +50 -0
+static int ipu7_isys_phy_ready(struct ipu7_isys *isys, u32 id)
+{
+	void __iomem *isys_base = isys->pdata->base;
+	u32 gpreg_offset = isys->pdata->ipdata->csi2.gpreg;
+	void __iomem *gpreg = isys_base + gpreg_offset + 0x1000 * id;
+	struct device *dev = &isys->adev->auxdev.dev;
+	unsigned int i;
+	u32 phy_ready;
+	u32 reg, rext;
+	int ret;
+
+	dev_dbg(dev, "waiting phy ready...\n");
+	ret = readl_poll_timeout(gpreg + PHY_READY, phy_ready,
+				 phy_ready & BIT(0) && phy_ready != ~0U,
+				 100, CDPHY_TIMEOUT);
+	dev_dbg(dev, "phy %u ready = 0x%08x\n", id, readl(gpreg + PHY_READY));
+	dev_dbg(dev, "csi %u PHY_RX = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_RX));
+	dev_dbg(dev, "csi %u PHY_STOPSTATE = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_STOPSTATE));
+	dev_dbg(dev, "csi %u PHY_CAL = 0x%08x\n", id,
+		dwc_csi_read(isys, id, PHY_CAL));
+	for (i = 0; i < 4U; i++) {
+		reg = CORE_DIG_DLANE_0_R_HS_RX_0 + (i * 0x400U);
+		dev_dbg(dev, "phy %u DLANE%u skewcal = 0x%04x\n",
+			id, i, dwc_phy_read(isys, id, reg));
+	}
+	dev_dbg(dev, "phy %u DDLCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5));
+	dev_dbg(dev, "phy %u TERMCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_TERMCAL_DEBUG_0));
+	dev_dbg(dev, "phy %u LPDCOCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_LPDCOCAL_DEBUG_RB));
+	dev_dbg(dev, "phy %u HSDCOCAL = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_HSDCOCAL_DEBUG_RB));
+	dev_dbg(dev, "phy %u LPDCOCAL_VT = 0x%04x\n", id,
+		dwc_phy_read(isys, id, PPI_R_LPDCOCAL_DEBUG_VT));
+
+	if (!ret) {
+		if (id) {
+			dev_dbg(dev, "ignore phy %u rext\n", id);
+			return 0;
+		}
+
+		rext = dwc_phy_read(isys, id,
+				    CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15) & 0xfU;
+		dev_dbg(dev, "phy %u rext value = %u\n", id, rext);
+		isys->phy_rext_cal = (rext ? rext : 5);
+
+		return 0;

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 401

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+	}
+
+	dev_err(dev, "wait phy ready timeout!\n");
+
+	return ret;
+}
+
+static int lookup_table1(u16 mbps)
+{
+	int i;

unsigned int, please. Same elsewhere.

Quoted 194 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +194 -0
+
+	for (i = 0; i < ARRAY_SIZE(table1); i++) {
+		if (mbps >= table1[i].min_mbps && mbps <= table1[i].max_mbps)
+			return i;
+	}
+
+	return -ENXIO;
+}
+
+static const u16 deskew_fine_mem[] = {
+	0x0404, 0x040c, 0x0414, 0x041c,
+	0x0423, 0x0429, 0x0430, 0x043a,
+	0x0445, 0x044a, 0x0450, 0x045a,
+	0x0465, 0x0469, 0x0472, 0x047a,
+	0x0485, 0x0489, 0x0490, 0x049a,
+	0x04a4, 0x04ac, 0x04b4, 0x04bc,
+	0x04c4, 0x04cc, 0x04d4, 0x04dc,
+	0x04e4, 0x04ec, 0x04f4, 0x04fc,
+	0x0504, 0x050c, 0x0514, 0x051c,
+	0x0523, 0x0529, 0x0530, 0x053a,
+	0x0545, 0x054a, 0x0550, 0x055a,
+	0x0565, 0x0569, 0x0572, 0x057a,
+	0x0585, 0x0589, 0x0590, 0x059a,
+	0x05a4, 0x05ac, 0x05b4, 0x05bc,
+	0x05c4, 0x05cc, 0x05d4, 0x05dc,
+	0x05e4, 0x05ec, 0x05f4, 0x05fc,
+	0x0604, 0x060c, 0x0614, 0x061c,
+	0x0623, 0x0629, 0x0632, 0x063a,
+	0x0645, 0x064a, 0x0650, 0x065a,
+	0x0665, 0x0669, 0x0672, 0x067a,
+	0x0685, 0x0689, 0x0690, 0x069a,
+	0x06a4, 0x06ac, 0x06b4, 0x06bc,
+	0x06c4, 0x06cc, 0x06d4, 0x06dc,
+	0x06e4, 0x06ec, 0x06f4, 0x06fc,
+	0x0704, 0x070c, 0x0714, 0x071c,
+	0x0723, 0x072a, 0x0730, 0x073a,
+	0x0745, 0x074a, 0x0750, 0x075a,
+	0x0765, 0x0769, 0x0772, 0x077a,
+	0x0785, 0x0789, 0x0790, 0x079a,
+	0x07a4, 0x07ac, 0x07b4, 0x07bc,
+	0x07c4, 0x07cc, 0x07d4, 0x07dc,
+	0x07e4, 0x07ec, 0x07f4, 0x07fc,
+};
+
+static void ipu7_isys_dphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				  bool aggregation, u64 mbps)
+{
+	u16 hsrxval0 = 0;
+	u16 hsrxval1 = 0;
+	u16 hsrxval2 = 0;
+	int index;
+	u16 reg;
+	u16 val;
+	u32 i;
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_7, 0, 0, 9);
+	if (mbps > 1500)
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7,
+				   40, 0, 7);
+	else
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7,
+				   104, 0, 7);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_8, 80, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_0, 191, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_7, 34, 7, 12);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_1, 38, 8, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 4, 12, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 2, 10, 11);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 1, 8, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 38, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_2, 1, 9, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_4, 10, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_6, 20, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_7, 19, 0, 6);
+
+	for (i = 0; i < ARRAY_SIZE(table0); i++) {
+		if (mbps >= table0[i].min_mbps && mbps <= table0[i].max_mbps) {
+			dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_3,
+					   table0[i].ddlcal_counter_ref,
+					   0, 9);
+			break;
+		}
+	}
+
+	index = lookup_table1(mbps);
+	if (index >= 0) {
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_1,
+				   table1[index].phase_bound, 0, 7);
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_5,
+				   table1[index].ddlcal_dll_fbk, 4, 9);
+		dwc_phy_write_mask(isys, id, PPI_RW_DDLCAL_CFG_5,
+				   table1[index].ddlcal_ddl_coarse_bank, 0, 3);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8;
+		val = table1[index].oa_lanex_hsrx_cdphy_sel_fast;
+		for (i = 0; i < lanes + 1; i++)
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   12, 12);
+	}
+
+	reg = CORE_DIG_DLANE_0_RW_LP_0;
+	for (i = 0; i < lanes; i++)
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 6, 8, 11);
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2,
+			   0, 0, 0);
+	if (!is_ipu7(isys->adev->isp->hw_ver) ||
+	    id == PORT_B || id == PORT_C) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2,
+				   1, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2,
+				   0, 0, 0);
+	} else {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2,
+				   0, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2,
+				   1, 0, 0);
+	}
+
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2,
+				   0, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2,
+				   0, 0, 0);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_6, 1, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_6, 1, 3, 5);
+
+	reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12;
+	val = (mbps > 1500) ? 0 : 1;
+	for (i = 0; i < lanes + 1; i++) {
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), !val, 3, 3);
+	}
+
+	reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13;
+	val = (mbps > 1500) ? 0 : 1;
+	for (i = 0; i < lanes + 1; i++) {
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 3, 3);
+	}
+
+	if (!is_ipu7(isys->adev->isp->hw_ver) || id == PORT_B || id == PORT_C)
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9;
+	else
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9;
+
+	for (i = 0; i < ARRAY_SIZE(table6); i++) {
+		if (mbps >= table6[i].min_mbps && mbps <= table6[i].max_mbps) {
+			dwc_phy_write_mask(isys, id, reg,
+					   table6[i].oa_lane_hsrx_hs_clk_div,
+					   5, 7);
+			break;
+		}
+	}
+
+	if (aggregation) {
+		dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_0, 1,
+				   1, 1);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, 3, 3, 4);
+
+		val = (id == PORT_A) ? 3 : 0;
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, val, 3, 4);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15;
+		dwc_phy_write_mask(isys, id, reg, 3, 3, 4);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_HS_RX_0, 28, 0, 7);
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_HS_RX_7, 6, 0, 7);
+
+	reg = CORE_DIG_DLANE_0_RW_HS_RX_0;
+	for (i = 0; i < ARRAY_SIZE(table2); i++) {
+		if (mbps >= table2[i].min_mbps && mbps <= table2[i].max_mbps) {
+			u8 j;
+
+			for (j = 0; j < lanes; j++)
+				dwc_phy_write_mask(isys, id, reg + (j * 0x400),
+						   table2[i].i_thssettle,
+						   8, 15);
+			break;
+		}
+	}
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 601

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +6 -0
+
+	/* deskew */
+	for (i = 0; i < lanes; i++) {
+		reg = CORE_DIG_DLANE_0_RW_CFG_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+				   ((mbps > 1500) ? 0x1 : 0x2), 2, 3);

You can remove three pairs of parentheses above. Same below.

This also just to satisfy the MISRA (FUSA) rule :(.

Quoted 139 lines
Quoted 139 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +138 -0
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_2;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+				   ((mbps > 2500) ? 0 : 1), 15, 15);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 13, 13);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 7, 9, 12);
+
+		reg = CORE_DIG_DLANE_0_RW_LP_0;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 12, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_LP_2;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 0, 0);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 16, 0, 7);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_3;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 2, 0, 2);
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].fjump_deskew;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   3, 8);
+		}
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_4;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 150, 0, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_5;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 0, 7);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 8, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_6;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 2, 0, 7);
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].min_eye_opening_deskew;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400), val,
+					   8, 15);
+		}
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_7;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 13, 13);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 0, 15, 15);
+
+		reg = CORE_DIG_DLANE_0_RW_HS_RX_9;
+		index = lookup_table1(mbps);
+		if (index >= 0) {
+			val = table1[index].ddlcal_max_phase;
+			dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+					   val, 0, 7);
+		}
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_LP_0, 1, 12, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_DLANE_CLK_RW_LP_2, 0, 0, 0);
+
+	for (i = 0; i < ARRAY_SIZE(deskew_fine_mem); i++)
+		dwc_phy_write_mask(isys, id, CORE_DIG_COMMON_RW_DESKEW_FINE_MEM,
+				   deskew_fine_mem[i], 0, 15);
+
+	if (mbps > 1500) {
+		hsrxval0 = 4;
+		hsrxval2 = 3;
+	}
+
+	if (mbps > 2500)
+		hsrxval1 = 2;
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9,
+			   hsrxval0, 0, 2);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9,
+				   hsrxval0, 0, 2);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9,
+				   hsrxval0, 0, 2);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9,
+			   hsrxval1, 3, 4);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9,
+				   hsrxval1, 3, 4);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9,
+				   hsrxval1, 3, 4);
+	}
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15,
+			   hsrxval2, 0, 2);
+	if (lanes == 4 && is_ipu7(isys->adev->isp->hw_ver)) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15,
+				   hsrxval2, 0, 2);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15,
+				   hsrxval2, 0, 2);
+	}
+
+	/* force and override rext */
+	if (isys->phy_rext_cal && id) {
+		dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8,
+				   isys->phy_rext_cal, 0, 3);
+		dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
+				   1, 11, 11);
+	}
+}
+
+static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				  bool aggregation, u64 mbps)
+{
+	u8 trios = 2;
+	u16 coarse_target;
+	u16 deass_thresh;
+	u16 delay_thresh;
+	u16 reset_thresh;
+	u16 cap_prog = 6U;
+	u16 reg;
+	u16 val;
+	u32 i;
+	u32 r;
+
+	if (is_ipu7p5(isys->adev->isp->hw_ver))
+		val = 0x15;
Quoted 9 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 744

Quoted 5 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +5 -0
+	else
+		val = 0x155;
+
+	if (is_ipu7(isys->adev->isp->hw_ver))
+		trios = 3;

It'd be good to have hardware version specific struct where you'd have such values in a single location.

It could be done, but there are many variants and a new IPU7 platform is coming, I think I can do this in future.

Quoted 28 lines
Quoted 14 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +14 -0
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_7, val, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7, 104, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_8, 16, 0, 7);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 6, 8, 11);
+
+	val = (mbps > 900U) ? 1U : 0U;
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 0, 0);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 768

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_5;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_6;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 10, 0, 15);
+	}

Too many magic numbers. :-( Please come up with human-readable names for these, including 0x400.

Quoted 2 lines

Simiarly below and probably elsewhere, too. No need to apply to individual tables entries though, but they need to be separate from the code.

I don't think it is doable now, these are from PHY manual, I don't know the actual meaning of these magic registers.

Quoted 296 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 776

Quoted 9 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +8 -0
+
+	/*
+	 * Below 900Msps, always use the same value.
+	 * The formula is suitable for data rate 80-3500Msps.
+	 * Timebase (us) = 1, DIV = 32, TDDL (UI) = 0.5
+	 */
+	if (mbps >= 80U) {
+		coarse_target = (u16)div_u64_rem(mbps, 16, &r);

No need to cast.

Quoted 284 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +252 -0
+		if (!r)
+			coarse_target--;
+	} else {
+		coarse_target = 56;
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_2 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, coarse_target, 0, 15);
+	}
+
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2, 1, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2, 0, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2, 1, 0, 0);
+
+	if (!is_ipu7p5(isys->adev->isp->hw_ver) && lanes == 4) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2,
+				   1, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2,
+				   0, 0, 0);
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_RW_TRIO0_0 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, 1, 6, 8);
+		dwc_phy_write_mask(isys, id, reg, 1, 3, 5);
+		dwc_phy_write_mask(isys, id, reg, 2, 0, 2);
+	}
+
+	deass_thresh = (u16)div_u64_rem(7 * 1000 * 6, mbps * 5U, &r) + 1;
+	if (r != 0)
+		deass_thresh++;
+
+	reg = CORE_DIG_RW_TRIO0_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   deass_thresh, 0, 7);
+
+	delay_thresh =
+		((224U - (9U * 7U)) * 1000U) / (5U * mbps) - 7U;
+
+	if (delay_thresh < 1)
+		delay_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_1;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   delay_thresh, 0, 15);
+
+	reset_thresh = (u16)div_u64_rem(2U * 5U * mbps, 7U * 1000U, &r);
+	if (!r)
+		reset_thresh--;
+
+	if (reset_thresh < 1)
+		reset_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   reset_thresh, 9, 11);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 1, 12, 15);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 0, 0, 0);
+
+	reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 12, 2, 6);
+
+	for (i = 0; i < ARRAY_SIZE(table7); i++) {
+		if (mbps >= table7[i].min_mbps && mbps <= table7[i].max_mbps) {
+			cap_prog = table7[i].val;
+			break;
+		}
+	}
+
+	for (i = 0; i < (lanes + 1); i++) {
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, 4U, 0, 2);
+		dwc_phy_write_mask(isys, id, reg, 0U, 3, 4);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, cap_prog, 10, 12);
+	}
+}
+
+static void ipu7_isys_phy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				 bool aggregation)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
+	u32 phy_mode;
+	s64 link_freq;
+	u64 mbps;
+
+	if (aggregation)
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[0]);
+	else
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[id]);
+
+	if (link_freq < 0) {
+		dev_warn(dev, "get link freq failed, use default mbps\n");
+		link_freq = 560000000;
+	}
+
+	mbps = div_u64(link_freq, 500000);
+	dev_dbg(dev, "config phy %u with lanes %u aggregation %d mbps %lld\n",
+		id, lanes, aggregation, mbps);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_10, 48, 0, 7);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2,
+			   1, 12, 13);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0,
+			   63, 2, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_STARTUP_1_1,
+			   563, 0, 11);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 5, 0, 7);
+	/* bypass the RCAL state (bit6) */
+	if (aggregation && id != PORT_A)
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 0x45,
+				   0, 7);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_6, 39, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_CALIBCTRL_RW_COMMON_BG_0, 500, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_TERMCAL_CFG_0, 38, 0, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_OFFSETCAL_CFG_0, 7, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TIMEBASE, 153, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF, 800, 0, 10);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF_RANGE, 27, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 47, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 127, 9, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 47, 7, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 27, 2, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_COARSE_CFG, 1, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_COMMON_CFG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   1, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3,
+			   3, 8, 9);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6,
+			   7, 12, 14);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
+			   0, 8, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5,
+			   0, 8, 8);
+
+	if (aggregation)
+		phy_mode = isys->csi2[0].phy_mode;
+	else
+		phy_mode = isys->csi2[id].phy_mode;
+
+	if (phy_mode == PHY_MODE_DPHY) {
+		ipu7_isys_dphy_config(isys, id, lanes, aggregation, mbps);
+	} else if (phy_mode == PHY_MODE_CPHY) {
+		ipu7_isys_cphy_config(isys, id, lanes, aggregation, mbps);
+	} else {
+		dev_err(dev, "unsupported phy mode %d!\n",
+			isys->csi2[id].phy_mode);
+	}
+}
+
+int ipu7_isys_csi_phy_powerup(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	u32 lanes = csi2->nlanes;
+	bool aggregation = false;
+	u32 id = csi2->port;
+	int ret;
+
+	/* lanes remapping for aggregation (port AB) mode */
+	if (!is_ipu7(isys->adev->isp->hw_ver) && lanes > 2 && id == PORT_A) {
+		aggregation = true;
+		lanes = 2;
+	}
+
+	ipu7_isys_csi_phy_reset(isys, id);
+	gpreg_write(isys, id, PHY_CLK_LANE_CONTROL, 0x1);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+	gpreg_write(isys, id, PHY_LANE_CONTROL_EN, (1U << lanes) - 1U);
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0xf);
+	gpreg_write(isys, id, PHY_MODE, csi2->phy_mode);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_CONTROL, 0x0);
+		gpreg_write(isys, PORT_B, PHY_LANE_CONTROL_EN, 0x3);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0xf);
+		gpreg_write(isys, PORT_B, PHY_MODE, csi2->phy_mode);
+	}
+
+	ipu7_isys_csi_ctrl_cfg(csi2);
+	ipu7_isys_csi_ctrl_dids_config(csi2, id);
+
+	ipu7_isys_phy_config(isys, id, lanes, aggregation);
+	gpreg_write(isys, id, PHY_RESET, 1);
+	gpreg_write(isys, id, PHY_SHUTDOWN, 1);
+	dwc_csi_write(isys, id, DPHY_RSTZ, 1);
+	dwc_csi_write(isys, id, PHY_SHUTDOWNZ, 1);
+	dwc_csi_write(isys, id, CSI2_RESETN, 1);
+
+	ret = ipu7_isys_phy_ready(isys, id);
+	if (ret < 0)
+		return ret;
+
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_phy_config(isys, PORT_B, 2, aggregation);
+		gpreg_write(isys, PORT_B, PHY_RESET, 1);
+		gpreg_write(isys, PORT_B, PHY_SHUTDOWN, 1);
+		dwc_csi_write(isys, PORT_B, DPHY_RSTZ, 1);
+		dwc_csi_write(isys, PORT_B, PHY_SHUTDOWNZ, 1);
+		dwc_csi_write(isys, PORT_B, CSI2_RESETN, 1);
+		ret = ipu7_isys_phy_ready(isys, PORT_B);
+		if (ret < 0)
+			return ret;
+
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0);
+	}
+
+	return 0;
+}
+
+void ipu7_isys_csi_phy_powerdown(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+
+	ipu7_isys_csi_phy_reset(isys, csi2->port);
+	if (!is_ipu7(isys->adev->isp->hw_ver) &&
+	    csi2->nlanes > 2U && csi2->port == PORT_A)
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+}
drivers/staging/media/ipu7/ipu7-isys-csi-phy.h new file +16 -0
new file mode 100644
index 000000000000..dfdcb61540c4
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +4 -0
new file mode 100644
index 000000000000..32704ca21341
@@ -0,0 +1,1197 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
Quoted 9 lines

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 10

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +6 -0
+
+#ifndef IPU7_ISYS_CSI2_REG_H
+#define IPU7_ISYS_CSI2_REG_H
+
+/* IS main regs base */
+#define IS_MAIN_BASE				(0x240000U)

Please drop U specifier from hexadecimal values.

We changed these for fixing the FUSA(MISRA C) problems, is it not liked by kernel coding rule?

Quoted 541 lines
Quoted 527 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +527 -0
+#define IS_MAIN_S2B_BASE			(IS_MAIN_BASE + 0x22000U)
+#define IS_MAIN_B2O_BASE			(IS_MAIN_BASE + 0x26000U)
+#define IS_MAIN_ISD_M0_BASE			(IS_MAIN_BASE + 0x2b000U)
+#define IS_MAIN_ISD_M1_BASE			(IS_MAIN_BASE + 0x2b100U)
+#define IS_MAIN_ISD_INT_BASE			(IS_MAIN_BASE + 0x2b200U)
+#define IS_MAIN_GDA_BASE			(IS_MAIN_BASE + 0x32000U)
+#define IS_MAIN_GPREGS_MAIN_BASE		(IS_MAIN_BASE + 0x32500U)
+#define IS_MAIN_IRQ_CTRL_BASE			(IS_MAIN_BASE + 0x32700U)
+#define IS_MAIN_PWM_CTRL_BASE			(IS_MAIN_BASE + 0x32b00U)
+
+#define S2B_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_S2B_BASE + 0x1cU)
+#define S2B_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_S2B_BASE + 0x20U)
+#define S2B_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_S2B_BASE + 0x24U)
+#define S2B_IID_IRQ_CTL_STATUS(iid)		(IS_MAIN_S2B_BASE + 0x94U + \
+						 0x100U * (iid))
+
+#define B2O_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_B2O_BASE + 0x30U)
+#define B2O_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_B2O_BASE + 0x34U)
+#define B2O_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_B2O_BASE + 0x38U)
+#define B2O_IID_IRQ_CTL_STATUS(oid)		(IS_MAIN_B2O_BASE + 0x3dcU + \
+						 0x200U * (oid))
+
+#define ISD_M0_IRQ_CTL_STATUS			(IS_MAIN_ISD_M0_BASE + 0x1cU)
+#define ISD_M0_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M0_BASE + 0x20U)
+#define ISD_M0_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M0_BASE + 0x24U)
+
+#define ISD_M1_IRQ_CTL_STATUS			(IS_MAIN_ISD_M1_BASE + 0x1cU)
+#define ISD_M1_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M1_BASE + 0x20U)
+#define ISD_M1_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M1_BASE + 0x24U)
+
+#define ISD_INT_IRQ_CTL_STATUS			(IS_MAIN_ISD_INT_BASE + 0x1cU)
+#define ISD_INT_IRQ_CTL_CLEAR			(IS_MAIN_ISD_INT_BASE + 0x20U)
+#define ISD_INT_IRQ_CTL_ENABLE			(IS_MAIN_ISD_INT_BASE + 0x24U)
+
+#define GDA_IRQ_CTL_STATUS			(IS_MAIN_GDA_BASE + 0x1cU)
+#define GDA_IRQ_CTL_CLEAR			(IS_MAIN_GDA_BASE + 0x20U)
+#define GDA_IRQ_CTL_ENABLE			(IS_MAIN_GDA_BASE + 0x24U)
+
+#define IS_MAIN_IRQ_CTL_EDGE			IS_MAIN_IRQ_CTRL_BASE
+#define IS_MAIN_IRQ_CTL_MASK			(IS_MAIN_IRQ_CTRL_BASE + 0x4U)
+#define IS_MAIN_IRQ_CTL_STATUS			(IS_MAIN_IRQ_CTRL_BASE + 0x8U)
+#define IS_MAIN_IRQ_CTL_CLEAR			(IS_MAIN_IRQ_CTRL_BASE + 0xcU)
+#define IS_MAIN_IRQ_CTL_ENABLE			(IS_MAIN_IRQ_CTRL_BASE + 0x10U)
+#define IS_MAIN_IRQ_CTL_LEVEL_NOT_PULSE		(IS_MAIN_IRQ_CTRL_BASE + 0x14U)
+
+/* IS IO regs base */
+#define IS_PHY_NUM				(4U)
+#define IS_IO_BASE				(0x280000U)
+
+/* dwc csi cdphy registers */
+#define IS_IO_CDPHY_BASE(i)			(IS_IO_BASE + 0x10000U * (i))
+#define PPI_STARTUP_RW_COMMON_DPHY_0			0x1800U
+#define PPI_STARTUP_RW_COMMON_DPHY_1			0x1802U
+#define PPI_STARTUP_RW_COMMON_DPHY_2			0x1804U
+#define PPI_STARTUP_RW_COMMON_DPHY_3			0x1806U
+#define PPI_STARTUP_RW_COMMON_DPHY_4			0x1808U
+#define PPI_STARTUP_RW_COMMON_DPHY_5			0x180aU
+#define PPI_STARTUP_RW_COMMON_DPHY_6			0x180cU
+#define PPI_STARTUP_RW_COMMON_DPHY_7			0x180eU
+#define PPI_STARTUP_RW_COMMON_DPHY_8			0x1810U
+#define PPI_STARTUP_RW_COMMON_DPHY_9			0x1812U
+#define PPI_STARTUP_RW_COMMON_DPHY_A			0x1814U
+#define PPI_STARTUP_RW_COMMON_DPHY_10			0x1820U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_1		0x1822U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_2		0x1824U
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_0		0x1840U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_1		0x1842U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_2		0x1844U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_3		0x1846U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_4		0x1848U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5		0x184aU
+#define PPI_CALIBCTRL_RW_COMMON_BG_0			0x184cU
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_7		0x184eU
+#define PPI_CALIBCTRL_RW_ADC_CFG_0			0x1850U
+#define PPI_CALIBCTRL_RW_ADC_CFG_1			0x1852U
+#define PPI_CALIBCTRL_R_ADC_DEBUG			0x1854U
+#define PPI_RW_LPDCOCAL_TOP_OVERRIDE			0x1c00U
+#define PPI_RW_LPDCOCAL_TIMEBASE			0x1c02U
+#define PPI_RW_LPDCOCAL_NREF				0x1c04U
+#define PPI_RW_LPDCOCAL_NREF_RANGE			0x1c06U
+#define PPI_RW_LPDCOCAL_NREF_TRIGGER_MAN		0x1c08U
+#define PPI_RW_LPDCOCAL_TWAIT_CONFIG			0x1c0aU
+#define PPI_RW_LPDCOCAL_VT_CONFIG			0x1c0cU
+#define PPI_R_LPDCOCAL_DEBUG_RB				0x1c0eU
+#define PPI_RW_LPDCOCAL_COARSE_CFG			0x1c10U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_RB			0x1c12U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_0_RB		0x1c14U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_1_RB		0x1c16U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_FWORD_RB		0x1c18U
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_CURR_ERROR		0x1c1aU
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_LAST_ERROR		0x1c1cU
+#define PPI_R_LPDCOCAL_DEBUG_VT				0x1c1eU
+#define PPI_RW_LB_TIMEBASE_CONFIG			0x1c20U
+#define PPI_RW_LB_STARTCMU_CONFIG			0x1c22U
+#define PPI_R_LBPULSE_COUNTER_RB			0x1c24U
+#define PPI_R_LB_START_CMU_RB				0x1c26U
+#define PPI_RW_LB_DPHY_BURST_START			0x1c28U
+#define PPI_RW_LB_CPHY_BURST_START			0x1c2aU
+#define PPI_RW_DDLCAL_CFG_0				0x1c40U
+#define PPI_RW_DDLCAL_CFG_1				0x1c42U
+#define PPI_RW_DDLCAL_CFG_2				0x1c44U
+#define PPI_RW_DDLCAL_CFG_3				0x1c46U
+#define PPI_RW_DDLCAL_CFG_4				0x1c48U
+#define PPI_RW_DDLCAL_CFG_5				0x1c4aU
+#define PPI_RW_DDLCAL_CFG_6				0x1c4cU
+#define PPI_RW_DDLCAL_CFG_7				0x1c4eU
+#define PPI_R_DDLCAL_DEBUG_0				0x1c50U
+#define PPI_R_DDLCAL_DEBUG_1				0x1c52U
+#define PPI_RW_PARITY_TEST				0x1c60U
+#define PPI_RW_STARTUP_OVR_0				0x1c62U
+#define PPI_RW_STARTUP_STATE_OVR_1			0x1c64U
+#define PPI_RW_DTB_SELECTOR				0x1c66U
+#define PPI_RW_DPHY_CLK_SPARE				0x1c6aU
+#define PPI_RW_COMMON_CFG				0x1c6cU
+#define PPI_RW_TERMCAL_CFG_0				0x1c80U
+#define PPI_R_TERMCAL_DEBUG_0				0x1c82U
+#define PPI_RW_TERMCAL_CTRL_0				0x1c84U
+#define PPI_RW_OFFSETCAL_CFG_0				0x1ca0U
+#define PPI_R_OFFSETCAL_DEBUG_LANE0			0x1ca2U
+#define PPI_R_OFFSETCAL_DEBUG_LANE1			0x1ca4U
+#define PPI_R_OFFSETCAL_DEBUG_LANE2			0x1ca6U
+#define PPI_R_OFFSETCAL_DEBUG_LANE3			0x1ca8U
+#define PPI_R_OFFSETCAL_DEBUG_LANE4			0x1caaU
+#define PPI_RW_HSDCOCAL_CFG_O				0x1d00U
+#define PPI_RW_HSDCOCAL_CFG_1				0x1d02U
+#define PPI_RW_HSDCOCAL_CFG_2				0x1d04U
+#define PPI_RW_HSDCOCAL_CFG_3				0x1d06U
+#define PPI_RW_HSDCOCAL_CFG_4				0x1d08U
+#define PPI_RW_HSDCOCAL_CFG_5				0x1d0aU
+#define PPI_RW_HSDCOCAL_CFG_6				0x1d0cU
+#define PPI_RW_HSDCOCAL_CFG_7				0x1d0eU
+#define PPI_RW_HSDCOCAL_CFG_8				0x1d10U
+#define PPI_R_HSDCOCAL_DEBUG_RB				0x1d12U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_0	0x2000U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_1	0x2002U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_2	0x2004U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_3	0x2006U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_4	0x2008U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_5	0x200aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_6	0x200cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_7	0x200eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_8	0x2010U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_9	0x2012U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_10	0x2014U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_11	0x2016U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_12	0x2018U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_13	0x201aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_14	0x201cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_15	0x201eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_0	0x2020U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_1	0x2022U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_2	0x2024U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_3	0x2026U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_4	0x2028U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_5	0x202aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_6	0x202cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_7	0x202eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_8	0x2030U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_9	0x2032U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_10	0x2034U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_11	0x2036U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_12	0x2038U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_13	0x203aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_14	0x203cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_15	0x203eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_0		0x2040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_1		0x2042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2		0x2044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_3		0x2046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_4		0x2048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_5		0x204aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_6		0x204cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7		0x204eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8		0x2050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9		0x2052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_10		0x2054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_11		0x2056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12		0x2058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13		0x205aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_14		0x205cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15		0x205eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_0		0x2060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_1		0x2062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_2		0x2064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_3		0x2066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_4		0x2068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_5		0x206aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_6		0x206cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_7		0x206eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_8		0x2070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_9		0x2072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_10		0x2074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_11		0x2076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_12		0x2078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_13		0x207aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_14		0x207cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_15		0x207eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_0		0x2080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_1		0x2082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_2		0x2084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_3		0x2086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_4		0x2088U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_0	0x20a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_1	0x20a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_2	0x20a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_3	0x20a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_4	0x20a8U
+#define CORE_DIG_RW_TRIO0_0				0x2100U
+#define CORE_DIG_RW_TRIO0_1				0x2102U
+#define CORE_DIG_RW_TRIO0_2				0x2104U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_0	0x2400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_1	0x2402U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_2	0x2404U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_3	0x2406U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_4	0x2408U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_5	0x240aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_6	0x240cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_7	0x240eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_8	0x2410U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_9	0x2412U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_10	0x2414U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_11	0x2416U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_12	0x2418U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_13	0x241aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_14	0x241cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_15	0x241eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_0	0x2420U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_1	0x2422U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_2	0x2424U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_3	0x2426U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_4	0x2428U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_5	0x242aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_6	0x242cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_7	0x242eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_8	0x2430U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_9	0x2432U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_10	0x2434U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_11	0x2436U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_12	0x2438U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_13	0x243aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_14	0x243cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_15	0x243eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_0		0x2440U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_1		0x2442U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2		0x2444U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_3		0x2446U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_4		0x2448U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_5		0x244aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_6		0x244cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_7		0x244eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_8		0x2450U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9		0x2452U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_10		0x2454U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_11		0x2456U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_12		0x2458U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_13		0x245aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_14		0x245cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15		0x245eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_0		0x2460U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_1		0x2462U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_2		0x2464U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_3		0x2466U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_4		0x2468U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_5		0x246aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_6		0x246cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_7		0x246eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_8		0x2470U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_9		0x2472U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_10		0x2474U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_11		0x2476U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_12		0x2478U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_13		0x247aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_14		0x247cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_15		0x247eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_0		0x2480U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_1		0x2482U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_2		0x2484U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_3		0x2486U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_4		0x2488U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_0	0x24a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_1	0x24a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_2	0x24a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_3	0x24a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_4	0x24a8U
+#define CORE_DIG_RW_TRIO1_0				0x2500U
+#define CORE_DIG_RW_TRIO1_1				0x2502U
+#define CORE_DIG_RW_TRIO1_2				0x2504U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_0	0x2800U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_1	0x2802U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_2	0x2804U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_3	0x2806U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_4	0x2808U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_5	0x280aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_6	0x280cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_7	0x280eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_8	0x2810U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_9	0x2812U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_10	0x2814U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_11	0x2816U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_12	0x2818U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_13	0x281aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_14	0x281cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_15	0x281eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_0	0x2820U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_1	0x2822U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_2	0x2824U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_3	0x2826U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_4	0x2828U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_5	0x282aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_6	0x282cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_7	0x282eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_8	0x2830U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_9	0x2832U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_10	0x2834U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_11	0x2836U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_12	0x2838U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_13	0x283aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_14	0x283cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_15	0x283eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_0		0x2840U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_1		0x2842U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2		0x2844U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_3		0x2846U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_4		0x2848U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_5		0x284aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_6		0x284cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_7		0x284eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_8		0x2850U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9		0x2852U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_10		0x2854U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_11		0x2856U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_12		0x2858U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_13		0x285aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_14		0x285cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15		0x285eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_0		0x2860U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_1		0x2862U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_2		0x2864U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_3		0x2866U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_4		0x2868U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_5		0x286aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_6		0x286cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_7		0x286eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_8		0x2870U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_9		0x2872U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_10		0x2874U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_11		0x2876U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_12		0x2878U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_13		0x287aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_14		0x287cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_15		0x287eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_0		0x2880U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_1		0x2882U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_2		0x2884U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_3		0x2886U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_4		0x2888U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_0	0x28a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_1	0x28a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_2	0x28a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_3	0x28a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_4	0x28a8U
+#define CORE_DIG_RW_TRIO2_0				0x2900U
+#define CORE_DIG_RW_TRIO2_1				0x2902U
+#define CORE_DIG_RW_TRIO2_2				0x2904U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_0	0x2c00U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_1	0x2c02U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_2	0x2c04U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_3	0x2c06U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_4	0x2c08U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_5	0x2c0aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_6	0x2c0cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_7	0x2c0eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_8	0x2c10U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_9	0x2c12U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_10	0x2c14U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_11	0x2c16U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_12	0x2c18U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_13	0x2c1aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_14	0x2c1cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_15	0x2c1eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_0		0x2c40U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_1		0x2c42U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2		0x2c44U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_3		0x2c46U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_4		0x2c48U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_5		0x2c4aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_6		0x2c4cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_7		0x2c4eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_8		0x2c50U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9		0x2c52U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_10		0x2c54U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_11		0x2c56U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_12		0x2c58U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_13		0x2c5aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_14		0x2c5cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15		0x2c5eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_0		0x2c60U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_1		0x2c62U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_2		0x2c64U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_3		0x2c66U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_4		0x2c68U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_5		0x2c6aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_6		0x2c6cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_7		0x2c6eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_8		0x2c70U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_9		0x2c72U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_10		0x2c74U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_11		0x2c76U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_12		0x2c78U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_13		0x2c7aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_14		0x2c7cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_15		0x2c7eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_0		0x2c80U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_1		0x2c82U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_2		0x2c84U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_3		0x2c86U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_4		0x2c88U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_0		0x3040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_1		0x3042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2		0x3044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_3		0x3046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_4		0x3048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_5		0x304aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_6		0x304cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_7		0x304eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_8		0x3050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9		0x3052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_10		0x3054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_11		0x3056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_12		0x3058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_13		0x305aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_14		0x305cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15		0x305eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_0		0x3060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_1		0x3062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_2		0x3064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_3		0x3066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_4		0x3068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_5		0x306aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_6		0x306cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_7		0x306eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_8		0x3070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_9		0x3072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_10		0x3074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_11		0x3076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_12		0x3078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_13		0x307aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_14		0x307cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_15		0x307eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_0		0x3080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_1		0x3082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_2		0x3084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_3		0x3086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_4		0x3088U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_0		0x3400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_1		0x3402U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_CLK_OVR_0_2		0x3404U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_0		0x3800U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_1		0x3802U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_2		0x3804U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_3		0x3806U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_4		0x3808U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_5		0x380aU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_6		0x380cU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_7		0x380eU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_8		0x3810U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_9		0x3812U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_10		0x3814U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_11		0x3816U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_12		0x3818U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_13		0x381aU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_14		0x381cU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_15		0x381eU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_0		0x3820U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_1		0x3822U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_2		0x3824U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_3		0x3826U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_4		0x3828U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0		0x3840U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1		0x3842U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_2		0x3844U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3		0x3846U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_4		0x3848U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5		0x384aU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6		0x384cU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7		0x384eU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8		0x3850U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_9		0x3852U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_10		0x3854U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_11		0x3856U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_12		0x3858U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_13		0x385aU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_14		0x385cU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15		0x385eU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_3_0		0x3860U
+#define CORE_DIG_RW_COMMON_0				0x3880U
+#define CORE_DIG_RW_COMMON_1				0x3882U
+#define CORE_DIG_RW_COMMON_2				0x3884U
+#define CORE_DIG_RW_COMMON_3				0x3886U
+#define CORE_DIG_RW_COMMON_4				0x3888U
+#define CORE_DIG_RW_COMMON_5				0x388aU
+#define CORE_DIG_RW_COMMON_6				0x388cU
+#define CORE_DIG_RW_COMMON_7				0x388eU
+#define CORE_DIG_RW_COMMON_8				0x3890U
+#define CORE_DIG_RW_COMMON_9				0x3892U
+#define CORE_DIG_RW_COMMON_10				0x3894U
+#define CORE_DIG_RW_COMMON_11				0x3896U
+#define CORE_DIG_RW_COMMON_12				0x3898U
+#define CORE_DIG_RW_COMMON_13				0x389aU
+#define CORE_DIG_RW_COMMON_14				0x389cU
+#define CORE_DIG_RW_COMMON_15				0x389eU
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0		0x39e0U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_1		0x39e2U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2		0x39e4U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_3		0x39e6U
+#define CORE_DIG_COMMON_RW_DESKEW_FINE_MEM		0x3fe0U
+#define CORE_DIG_COMMON_R_DESKEW_FINE_MEM		0x3fe2U
+#define PPI_RW_DPHY_LANE0_LBERT_0			0x4000U
+#define PPI_RW_DPHY_LANE0_LBERT_1			0x4002U
+#define PPI_R_DPHY_LANE0_LBERT_0			0x4004U
+#define PPI_R_DPHY_LANE0_LBERT_1			0x4006U
+#define PPI_RW_DPHY_LANE0_SPARE				0x4008U
+#define PPI_RW_DPHY_LANE1_LBERT_0			0x4400U
+#define PPI_RW_DPHY_LANE1_LBERT_1			0x4402U
+#define PPI_R_DPHY_LANE1_LBERT_0			0x4404U
+#define PPI_R_DPHY_LANE1_LBERT_1			0x4406U
+#define PPI_RW_DPHY_LANE1_SPARE				0x4408U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 547

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define PPI_RW_DPHY_LANE2_LBERT_0			0x4800U
+#define PPI_RW_DPHY_LANE2_LBERT_1			0x4802U
+#define PPI_R_DPHY_LANE2_LBERT_0			0x4804U
+#define PPI_R_DPHY_LANE2_LBERT_1			0x4806U
+#define PPI_RW_DPHY_LANE2_SPARE				0x4808U
+#define PPI_RW_DPHY_LANE3_LBERT_0			0x4c00U
+#define PPI_RW_DPHY_LANE3_LBERT_1			0x4c02U
+#define PPI_R_DPHY_LANE3_LBERT_0			0x4c04U
+#define PPI_R_DPHY_LANE3_LBERT_1			0x4c06U
+#define PPI_RW_DPHY_LANE3_SPARE				0x4c08U

How about using base address for lanes and then using offsets? I presume all lanes use same offset?

Quoted 2 lines

Same for CLANE definitions below.

I copied these defines directly from the SNPS spec register list, it is useful to query and compare with the spec.

Quoted 508 lines
Quoted 294 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +294 -0
+#define CORE_DIG_DLANE_0_RW_CFG_0			0x6000U
+#define CORE_DIG_DLANE_0_RW_CFG_1			0x6002U
+#define CORE_DIG_DLANE_0_RW_CFG_2			0x6004U
+#define CORE_DIG_DLANE_0_RW_LP_0			0x6080U
+#define CORE_DIG_DLANE_0_RW_LP_1			0x6082U
+#define CORE_DIG_DLANE_0_RW_LP_2			0x6084U
+#define CORE_DIG_DLANE_0_R_LP_0				0x60a0U
+#define CORE_DIG_DLANE_0_R_LP_1				0x60a2U
+#define CORE_DIG_DLANE_0_R_HS_TX_0			0x60e0U
+#define CORE_DIG_DLANE_0_RW_HS_RX_0			0x6100U
+#define CORE_DIG_DLANE_0_RW_HS_RX_1			0x6102U
+#define CORE_DIG_DLANE_0_RW_HS_RX_2			0x6104U
+#define CORE_DIG_DLANE_0_RW_HS_RX_3			0x6106U
+#define CORE_DIG_DLANE_0_RW_HS_RX_4			0x6108U
+#define CORE_DIG_DLANE_0_RW_HS_RX_5			0x610aU
+#define CORE_DIG_DLANE_0_RW_HS_RX_6			0x610cU
+#define CORE_DIG_DLANE_0_RW_HS_RX_7			0x610eU
+#define CORE_DIG_DLANE_0_RW_HS_RX_8			0x6110U
+#define CORE_DIG_DLANE_0_RW_HS_RX_9			0x6112U
+#define CORE_DIG_DLANE_0_R_HS_RX_0			0x6120U
+#define CORE_DIG_DLANE_0_R_HS_RX_1			0x6122U
+#define CORE_DIG_DLANE_0_R_HS_RX_2			0x6124U
+#define CORE_DIG_DLANE_0_R_HS_RX_3			0x6126U
+#define CORE_DIG_DLANE_0_R_HS_RX_4			0x6128U
+#define CORE_DIG_DLANE_0_RW_HS_TX_0			0x6200U
+#define CORE_DIG_DLANE_0_RW_HS_TX_1			0x6202U
+#define CORE_DIG_DLANE_0_RW_HS_TX_2			0x6204U
+#define CORE_DIG_DLANE_0_RW_HS_TX_3			0x6206U
+#define CORE_DIG_DLANE_0_RW_HS_TX_4			0x6208U
+#define CORE_DIG_DLANE_0_RW_HS_TX_5			0x620aU
+#define CORE_DIG_DLANE_0_RW_HS_TX_6			0x620cU
+#define CORE_DIG_DLANE_0_RW_HS_TX_7			0x620eU
+#define CORE_DIG_DLANE_0_RW_HS_TX_8			0x6210U
+#define CORE_DIG_DLANE_0_RW_HS_TX_9			0x6212U
+#define CORE_DIG_DLANE_0_RW_HS_TX_10			0x6214U
+#define CORE_DIG_DLANE_0_RW_HS_TX_11			0x6216U
+#define CORE_DIG_DLANE_0_RW_HS_TX_12			0x6218U
+#define CORE_DIG_DLANE_1_RW_CFG_0			0x6400U
+#define CORE_DIG_DLANE_1_RW_CFG_1			0x6402U
+#define CORE_DIG_DLANE_1_RW_CFG_2			0x6404U
+#define CORE_DIG_DLANE_1_RW_LP_0			0x6480U
+#define CORE_DIG_DLANE_1_RW_LP_1			0x6482U
+#define CORE_DIG_DLANE_1_RW_LP_2			0x6484U
+#define CORE_DIG_DLANE_1_R_LP_0				0x64a0U
+#define CORE_DIG_DLANE_1_R_LP_1				0x64a2U
+#define CORE_DIG_DLANE_1_R_HS_TX_0			0x64e0U
+#define CORE_DIG_DLANE_1_RW_HS_RX_0			0x6500U
+#define CORE_DIG_DLANE_1_RW_HS_RX_1			0x6502U
+#define CORE_DIG_DLANE_1_RW_HS_RX_2			0x6504U
+#define CORE_DIG_DLANE_1_RW_HS_RX_3			0x6506U
+#define CORE_DIG_DLANE_1_RW_HS_RX_4			0x6508U
+#define CORE_DIG_DLANE_1_RW_HS_RX_5			0x650aU
+#define CORE_DIG_DLANE_1_RW_HS_RX_6			0x650cU
+#define CORE_DIG_DLANE_1_RW_HS_RX_7			0x650eU
+#define CORE_DIG_DLANE_1_RW_HS_RX_8			0x6510U
+#define CORE_DIG_DLANE_1_RW_HS_RX_9			0x6512U
+#define CORE_DIG_DLANE_1_R_HS_RX_0			0x6520U
+#define CORE_DIG_DLANE_1_R_HS_RX_1			0x6522U
+#define CORE_DIG_DLANE_1_R_HS_RX_2			0x6524U
+#define CORE_DIG_DLANE_1_R_HS_RX_3			0x6526U
+#define CORE_DIG_DLANE_1_R_HS_RX_4			0x6528U
+#define CORE_DIG_DLANE_1_RW_HS_TX_0			0x6600U
+#define CORE_DIG_DLANE_1_RW_HS_TX_1			0x6602U
+#define CORE_DIG_DLANE_1_RW_HS_TX_2			0x6604U
+#define CORE_DIG_DLANE_1_RW_HS_TX_3			0x6606U
+#define CORE_DIG_DLANE_1_RW_HS_TX_4			0x6608U
+#define CORE_DIG_DLANE_1_RW_HS_TX_5			0x660aU
+#define CORE_DIG_DLANE_1_RW_HS_TX_6			0x660cU
+#define CORE_DIG_DLANE_1_RW_HS_TX_7			0x660eU
+#define CORE_DIG_DLANE_1_RW_HS_TX_8			0x6610U
+#define CORE_DIG_DLANE_1_RW_HS_TX_9			0x6612U
+#define CORE_DIG_DLANE_1_RW_HS_TX_10			0x6614U
+#define CORE_DIG_DLANE_1_RW_HS_TX_11			0x6616U
+#define CORE_DIG_DLANE_1_RW_HS_TX_12			0x6618U
+#define CORE_DIG_DLANE_2_RW_CFG_0			0x6800U
+#define CORE_DIG_DLANE_2_RW_CFG_1			0x6802U
+#define CORE_DIG_DLANE_2_RW_CFG_2			0x6804U
+#define CORE_DIG_DLANE_2_RW_LP_0			0x6880U
+#define CORE_DIG_DLANE_2_RW_LP_1			0x6882U
+#define CORE_DIG_DLANE_2_RW_LP_2			0x6884U
+#define CORE_DIG_DLANE_2_R_LP_0				0x68a0U
+#define CORE_DIG_DLANE_2_R_LP_1				0x68a2U
+#define CORE_DIG_DLANE_2_R_HS_TX_0			0x68e0U
+#define CORE_DIG_DLANE_2_RW_HS_RX_0			0x6900U
+#define CORE_DIG_DLANE_2_RW_HS_RX_1			0x6902U
+#define CORE_DIG_DLANE_2_RW_HS_RX_2			0x6904U
+#define CORE_DIG_DLANE_2_RW_HS_RX_3			0x6906U
+#define CORE_DIG_DLANE_2_RW_HS_RX_4			0x6908U
+#define CORE_DIG_DLANE_2_RW_HS_RX_5			0x690aU
+#define CORE_DIG_DLANE_2_RW_HS_RX_6			0x690cU
+#define CORE_DIG_DLANE_2_RW_HS_RX_7			0x690eU
+#define CORE_DIG_DLANE_2_RW_HS_RX_8			0x6910U
+#define CORE_DIG_DLANE_2_RW_HS_RX_9			0x6912U
+#define CORE_DIG_DLANE_2_R_HS_RX_0			0x6920U
+#define CORE_DIG_DLANE_2_R_HS_RX_1			0x6922U
+#define CORE_DIG_DLANE_2_R_HS_RX_2			0x6924U
+#define CORE_DIG_DLANE_2_R_HS_RX_3			0x6926U
+#define CORE_DIG_DLANE_2_R_HS_RX_4			0x6928U
+#define CORE_DIG_DLANE_2_RW_HS_TX_0			0x6a00U
+#define CORE_DIG_DLANE_2_RW_HS_TX_1			0x6a02U
+#define CORE_DIG_DLANE_2_RW_HS_TX_2			0x6a04U
+#define CORE_DIG_DLANE_2_RW_HS_TX_3			0x6a06U
+#define CORE_DIG_DLANE_2_RW_HS_TX_4			0x6a08U
+#define CORE_DIG_DLANE_2_RW_HS_TX_5			0x6a0aU
+#define CORE_DIG_DLANE_2_RW_HS_TX_6			0x6a0cU
+#define CORE_DIG_DLANE_2_RW_HS_TX_7			0x6a0eU
+#define CORE_DIG_DLANE_2_RW_HS_TX_8			0x6a10U
+#define CORE_DIG_DLANE_2_RW_HS_TX_9			0x6a12U
+#define CORE_DIG_DLANE_2_RW_HS_TX_10			0x6a14U
+#define CORE_DIG_DLANE_2_RW_HS_TX_11			0x6a16U
+#define CORE_DIG_DLANE_2_RW_HS_TX_12			0x6a18U
+#define CORE_DIG_DLANE_3_RW_CFG_0			0x6c00U
+#define CORE_DIG_DLANE_3_RW_CFG_1			0x6c02U
+#define CORE_DIG_DLANE_3_RW_CFG_2			0x6c04U
+#define CORE_DIG_DLANE_3_RW_LP_0			0x6c80U
+#define CORE_DIG_DLANE_3_RW_LP_1			0x6c82U
+#define CORE_DIG_DLANE_3_RW_LP_2			0x6c84U
+#define CORE_DIG_DLANE_3_R_LP_0				0x6ca0U
+#define CORE_DIG_DLANE_3_R_LP_1				0x6ca2U
+#define CORE_DIG_DLANE_3_R_HS_TX_0			0x6ce0U
+#define CORE_DIG_DLANE_3_RW_HS_RX_0			0x6d00U
+#define CORE_DIG_DLANE_3_RW_HS_RX_1			0x6d02U
+#define CORE_DIG_DLANE_3_RW_HS_RX_2			0x6d04U
+#define CORE_DIG_DLANE_3_RW_HS_RX_3			0x6d06U
+#define CORE_DIG_DLANE_3_RW_HS_RX_4			0x6d08U
+#define CORE_DIG_DLANE_3_RW_HS_RX_5			0x6d0aU
+#define CORE_DIG_DLANE_3_RW_HS_RX_6			0x6d0cU
+#define CORE_DIG_DLANE_3_RW_HS_RX_7			0x6d0eU
+#define CORE_DIG_DLANE_3_RW_HS_RX_8			0x6d10U
+#define CORE_DIG_DLANE_3_RW_HS_RX_9			0x6d12U
+#define CORE_DIG_DLANE_3_R_HS_RX_0			0x6d20U
+#define CORE_DIG_DLANE_3_R_HS_RX_1			0x6d22U
+#define CORE_DIG_DLANE_3_R_HS_RX_2			0x6d24U
+#define CORE_DIG_DLANE_3_R_HS_RX_3			0x6d26U
+#define CORE_DIG_DLANE_3_R_HS_RX_4			0x6d28U
+#define CORE_DIG_DLANE_3_RW_HS_TX_0			0x6e00U
+#define CORE_DIG_DLANE_3_RW_HS_TX_1			0x6e02U
+#define CORE_DIG_DLANE_3_RW_HS_TX_2			0x6e04U
+#define CORE_DIG_DLANE_3_RW_HS_TX_3			0x6e06U
+#define CORE_DIG_DLANE_3_RW_HS_TX_4			0x6e08U
+#define CORE_DIG_DLANE_3_RW_HS_TX_5			0x6e0aU
+#define CORE_DIG_DLANE_3_RW_HS_TX_6			0x6e0cU
+#define CORE_DIG_DLANE_3_RW_HS_TX_7			0x6e0eU
+#define CORE_DIG_DLANE_3_RW_HS_TX_8			0x6e10U
+#define CORE_DIG_DLANE_3_RW_HS_TX_9			0x6e12U
+#define CORE_DIG_DLANE_3_RW_HS_TX_10			0x6e14U
+#define CORE_DIG_DLANE_3_RW_HS_TX_11			0x6e16U
+#define CORE_DIG_DLANE_3_RW_HS_TX_12			0x6e18U
+#define CORE_DIG_DLANE_CLK_RW_CFG_0			0x7000U
+#define CORE_DIG_DLANE_CLK_RW_CFG_1			0x7002U
+#define CORE_DIG_DLANE_CLK_RW_CFG_2			0x7004U
+#define CORE_DIG_DLANE_CLK_RW_LP_0			0x7080U
+#define CORE_DIG_DLANE_CLK_RW_LP_1			0x7082U
+#define CORE_DIG_DLANE_CLK_RW_LP_2			0x7084U
+#define CORE_DIG_DLANE_CLK_R_LP_0			0x70a0U
+#define CORE_DIG_DLANE_CLK_R_LP_1			0x70a2U
+#define CORE_DIG_DLANE_CLK_R_HS_TX_0			0x70e0U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_0			0x7100U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_1			0x7102U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_2			0x7104U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_3			0x7106U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_4			0x7108U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_5			0x710aU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_6			0x710cU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_7			0x710eU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_8			0x7110U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_9			0x7112U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_0			0x7120U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_1			0x7122U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_2			0x7124U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_3			0x7126U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_4			0x7128U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_0			0x7200U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_1			0x7202U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_2			0x7204U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_3			0x7206U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_4			0x7208U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_5			0x720aU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_6			0x720cU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_7			0x720eU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_8			0x7210U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_9			0x7212U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_10			0x7214U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_11			0x7216U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_12			0x7218U
+#define PPI_RW_CPHY_TRIO0_LBERT_0			0x8000U
+#define PPI_RW_CPHY_TRIO0_LBERT_1			0x8002U
+#define PPI_R_CPHY_TRIO0_LBERT_0			0x8004U
+#define PPI_R_CPHY_TRIO0_LBERT_1			0x8006U
+#define PPI_RW_CPHY_TRIO0_SPARE				0x8008U
+#define PPI_RW_CPHY_TRIO1_LBERT_0			0x8400U
+#define PPI_RW_CPHY_TRIO1_LBERT_1			0x8402U
+#define PPI_R_CPHY_TRIO1_LBERT_0			0x8404U
+#define PPI_R_CPHY_TRIO1_LBERT_1			0x8406U
+#define PPI_RW_CPHY_TRIO1_SPARE				0x8408U
+#define PPI_RW_CPHY_TRIO2_LBERT_0			0x8800U
+#define PPI_RW_CPHY_TRIO2_LBERT_1			0x8802U
+#define PPI_R_CPHY_TRIO2_LBERT_0			0x8804U
+#define PPI_R_CPHY_TRIO2_LBERT_1			0x8806U
+#define PPI_RW_CPHY_TRIO2_SPARE				0x8808U
+#define CORE_DIG_CLANE_0_RW_CFG_0			0xa000U
+#define CORE_DIG_CLANE_0_RW_CFG_2			0xa004U
+#define CORE_DIG_CLANE_0_RW_LP_0			0xa080U
+#define CORE_DIG_CLANE_0_RW_LP_1			0xa082U
+#define CORE_DIG_CLANE_0_RW_LP_2			0xa084U
+#define CORE_DIG_CLANE_0_R_LP_0				0xa0a0U
+#define CORE_DIG_CLANE_0_R_LP_1				0xa0a2U
+#define CORE_DIG_CLANE_0_RW_HS_RX_0			0xa100U
+#define CORE_DIG_CLANE_0_RW_HS_RX_1			0xa102U
+#define CORE_DIG_CLANE_0_RW_HS_RX_2			0xa104U
+#define CORE_DIG_CLANE_0_RW_HS_RX_3			0xa106U
+#define CORE_DIG_CLANE_0_RW_HS_RX_4			0xa108U
+#define CORE_DIG_CLANE_0_RW_HS_RX_5			0xa10aU
+#define CORE_DIG_CLANE_0_RW_HS_RX_6			0xa10cU
+#define CORE_DIG_CLANE_0_R_RX_0				0xa120U
+#define CORE_DIG_CLANE_0_R_RX_1				0xa122U
+#define CORE_DIG_CLANE_0_R_TX_0				0xa124U
+#define CORE_DIG_CLANE_0_R_RX_2				0xa126U
+#define CORE_DIG_CLANE_0_R_RX_3				0xa128U
+#define CORE_DIG_CLANE_0_RW_HS_TX_0			0xa200U
+#define CORE_DIG_CLANE_0_RW_HS_TX_1			0xa202U
+#define CORE_DIG_CLANE_0_RW_HS_TX_2			0xa204U
+#define CORE_DIG_CLANE_0_RW_HS_TX_3			0xa206U
+#define CORE_DIG_CLANE_0_RW_HS_TX_4			0xa208U
+#define CORE_DIG_CLANE_0_RW_HS_TX_5			0xa20aU
+#define CORE_DIG_CLANE_0_RW_HS_TX_6			0xa20cU
+#define CORE_DIG_CLANE_0_RW_HS_TX_7			0xa20eU
+#define CORE_DIG_CLANE_0_RW_HS_TX_8			0xa210U
+#define CORE_DIG_CLANE_0_RW_HS_TX_9			0xa212U
+#define CORE_DIG_CLANE_0_RW_HS_TX_10			0xa214U
+#define CORE_DIG_CLANE_0_RW_HS_TX_11			0xa216U
+#define CORE_DIG_CLANE_0_RW_HS_TX_12			0xa218U
+#define CORE_DIG_CLANE_0_RW_HS_TX_13			0xa21aU
+#define CORE_DIG_CLANE_1_RW_CFG_0			0xa400U
+#define CORE_DIG_CLANE_1_RW_CFG_2			0xa404U
+#define CORE_DIG_CLANE_1_RW_LP_0			0xa480U
+#define CORE_DIG_CLANE_1_RW_LP_1			0xa482U
+#define CORE_DIG_CLANE_1_RW_LP_2			0xa484U
+#define CORE_DIG_CLANE_1_R_LP_0				0xa4a0U
+#define CORE_DIG_CLANE_1_R_LP_1				0xa4a2U
+#define CORE_DIG_CLANE_1_RW_HS_RX_0			0xa500U
+#define CORE_DIG_CLANE_1_RW_HS_RX_1			0xa502U
+#define CORE_DIG_CLANE_1_RW_HS_RX_2			0xa504U
+#define CORE_DIG_CLANE_1_RW_HS_RX_3			0xa506U
+#define CORE_DIG_CLANE_1_RW_HS_RX_4			0xa508U
+#define CORE_DIG_CLANE_1_RW_HS_RX_5			0xa50aU
+#define CORE_DIG_CLANE_1_RW_HS_RX_6			0xa50cU
+#define CORE_DIG_CLANE_1_R_RX_0				0xa520U
+#define CORE_DIG_CLANE_1_R_RX_1				0xa522U
+#define CORE_DIG_CLANE_1_R_TX_0				0xa524U
+#define CORE_DIG_CLANE_1_R_RX_2				0xa526U
+#define CORE_DIG_CLANE_1_R_RX_3				0xa528U
+#define CORE_DIG_CLANE_1_RW_HS_TX_0			0xa600U
+#define CORE_DIG_CLANE_1_RW_HS_TX_1			0xa602U
+#define CORE_DIG_CLANE_1_RW_HS_TX_2			0xa604U
+#define CORE_DIG_CLANE_1_RW_HS_TX_3			0xa606U
+#define CORE_DIG_CLANE_1_RW_HS_TX_4			0xa608U
+#define CORE_DIG_CLANE_1_RW_HS_TX_5			0xa60aU
+#define CORE_DIG_CLANE_1_RW_HS_TX_6			0xa60cU
+#define CORE_DIG_CLANE_1_RW_HS_TX_7			0xa60eU
+#define CORE_DIG_CLANE_1_RW_HS_TX_8			0xa610U
+#define CORE_DIG_CLANE_1_RW_HS_TX_9			0xa612U
+#define CORE_DIG_CLANE_1_RW_HS_TX_10			0xa614U
+#define CORE_DIG_CLANE_1_RW_HS_TX_11			0xa616U
+#define CORE_DIG_CLANE_1_RW_HS_TX_12			0xa618U
+#define CORE_DIG_CLANE_1_RW_HS_TX_13			0xa61aU
+#define CORE_DIG_CLANE_2_RW_CFG_0			0xa800U
+#define CORE_DIG_CLANE_2_RW_CFG_2			0xa804U
+#define CORE_DIG_CLANE_2_RW_LP_0			0xa880U
+#define CORE_DIG_CLANE_2_RW_LP_1			0xa882U
+#define CORE_DIG_CLANE_2_RW_LP_2			0xa884U
+#define CORE_DIG_CLANE_2_R_LP_0				0xa8a0U
+#define CORE_DIG_CLANE_2_R_LP_1				0xa8a2U
+#define CORE_DIG_CLANE_2_RW_HS_RX_0			0xa900U
+#define CORE_DIG_CLANE_2_RW_HS_RX_1			0xa902U
+#define CORE_DIG_CLANE_2_RW_HS_RX_2			0xa904U
+#define CORE_DIG_CLANE_2_RW_HS_RX_3			0xa906U
+#define CORE_DIG_CLANE_2_RW_HS_RX_4			0xa908U
+#define CORE_DIG_CLANE_2_RW_HS_RX_5			0xa90aU
+#define CORE_DIG_CLANE_2_RW_HS_RX_6			0xa90cU
+#define CORE_DIG_CLANE_2_R_RX_0				0xa920U
+#define CORE_DIG_CLANE_2_R_RX_1				0xa922U
+#define CORE_DIG_CLANE_2_R_TX_0				0xa924U
+#define CORE_DIG_CLANE_2_R_RX_2				0xa926U
+#define CORE_DIG_CLANE_2_R_RX_3				0xa928U
+#define CORE_DIG_CLANE_2_RW_HS_TX_0			0xaa00U
+#define CORE_DIG_CLANE_2_RW_HS_TX_1			0xaa02U
+#define CORE_DIG_CLANE_2_RW_HS_TX_2			0xaa04U
+#define CORE_DIG_CLANE_2_RW_HS_TX_3			0xaa06U
+#define CORE_DIG_CLANE_2_RW_HS_TX_4			0xaa08U
+#define CORE_DIG_CLANE_2_RW_HS_TX_5			0xaa0aU
+#define CORE_DIG_CLANE_2_RW_HS_TX_6			0xaa0cU
+#define CORE_DIG_CLANE_2_RW_HS_TX_7			0xaa0eU
+#define CORE_DIG_CLANE_2_RW_HS_TX_8			0xaa10U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 851

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define CORE_DIG_CLANE_2_RW_HS_TX_9			0xaa12U
+#define CORE_DIG_CLANE_2_RW_HS_TX_10			0xaa14U
+#define CORE_DIG_CLANE_2_RW_HS_TX_11			0xaa16U
+#define CORE_DIG_CLANE_2_RW_HS_TX_12			0xaa18U
+#define CORE_DIG_CLANE_2_RW_HS_TX_13			0xaa1aU
+
+/* dwc csi host controller registers */
+#define IS_IO_CSI2_HOST_BASE(i)			(IS_IO_BASE + 0x40000U + \
+						 0x2000U * (i))
+#define VERSION					0

I wonder if this HCI has a version? Perhaps a driver on its own would be nice, but that consideration can be left for later I think.

Quoted 200 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +200 -0
+#define N_LANES					0x4U
+#define CSI2_RESETN				0x8U
+#define INT_ST_MAIN				0xcU
+#define DATA_IDS_1				0x10U
+#define DATA_IDS_2				0x14U
+#define CDPHY_MODE				0x1cU
+#define DATA_IDS_VC_1				0x30U
+#define DATA_IDS_VC_2				0x34U
+#define PHY_SHUTDOWNZ				0x40U
+#define DPHY_RSTZ				0x44U
+#define PHY_RX					0x48U
+#define PHY_STOPSTATE				0x4cU
+#define PHY_TEST_CTRL0				0x50U
+#define PHY_TEST_CTRL1				0x54U
+#define PPI_PG_PATTERN_VRES			0x60U
+#define PPI_PG_PATTERN_HRES			0x64U
+#define PPI_PG_CONFIG				0x68U
+#define PPI_PG_ENABLE				0x6cU
+#define PPI_PG_STATUS				0x70U
+#define VC_EXTENSION				0xc8U
+#define PHY_CAL					0xccU
+#define INT_ST_PHY_FATAL			0xe0U
+#define INT_MSK_PHY_FATAL			0xe4U
+#define INT_FORCE_PHY_FATAL			0xe8U
+#define INT_ST_PKT_FATAL			0xf0U
+#define INT_MSK_PKT_FATAL			0xf4U
+#define INT_FORCE_PKT_FATAL			0xf8U
+#define INT_ST_PHY				0x110U
+#define INT_MSK_PHY				0x114U
+#define INT_FORCE_PHY				0x118U
+#define INT_ST_LINE				0x130U
+#define INT_MSK_LINE				0x134U
+#define INT_FORCE_LINE				0x138U
+#define INT_ST_BNDRY_FRAME_FATAL		0x280U
+#define INT_MSK_BNDRY_FRAME_FATAL		0x284U
+#define INT_FORCE_BNDRY_FRAME_FATAL		0x288U
+#define INT_ST_SEQ_FRAME_FATAL			0x290U
+#define INT_MSK_SEQ_FRAME_FATAL			0x294U
+#define INT_FORCE_SEQ_FRAME_FATAL		0x298U
+#define INT_ST_CRC_FRAME_FATAL			0x2a0U
+#define INT_MSK_CRC_FRAME_FATAL			0x2a4U
+#define INT_FORCE_CRC_FRAME_FATAL		0x2a8U
+#define INT_ST_PLD_CRC_FATAL			0x2b0U
+#define INT_MSK_PLD_CRC_FATAL			0x2b4U
+#define INT_FORCE_PLD_CRC_FATAL			0x2b8U
+#define INT_ST_DATA_ID				0x2c0U
+#define INT_MSK_DATA_ID				0x2c4U
+#define INT_FORCE_DATA_ID			0x2c8U
+#define INT_ST_ECC_CORRECTED			0x2d0U
+#define INT_MSK_ECC_CORRECTED			0x2d4U
+#define INT_FORCE_ECC_CORRECTED			0x2d8U
+#define SCRAMBLING				0x300U
+#define SCRAMBLING_SEED1			0x304U
+#define SCRAMBLING_SEED2			0x308U
+#define SCRAMBLING_SEED3			0x30cU
+#define SCRAMBLING_SEED4			0x310U
+#define SCRAMBLING				0x300U
+
+#define IS_IO_CSI2_ADPL_PORT_BASE(i)		(IS_IO_BASE + 0x40800U + \
+						 0x2000U * (i))
+#define CSI2_ADPL_INPUT_MODE			0
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN	0x4U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_ADDR	0x8U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_STATUS		0xcU
+#define CSI2_ADPL_IRQ_CTL_COMMON_STATUS		0xa4U
+#define CSI2_ADPL_IRQ_CTL_COMMON_CLEAR		0xa8U
+#define CSI2_ADPL_IRQ_CTL_COMMON_ENABLE		0xacU
+#define CSI2_ADPL_IRQ_CTL_FS_STATUS		0xbcU
+#define CSI2_ADPL_IRQ_CTL_FS_CLEAR		0xc0U
+#define CSI2_ADPL_IRQ_CTL_FS_ENABLE		0xc4U
+#define CSI2_ADPL_IRQ_CTL_FE_STATUS		0xc8U
+#define CSI2_ADPL_IRQ_CTL_FE_CLEAR		0xccU
+#define CSI2_ADPL_IRQ_CTL_FE_ENABLE		0xd0U
+
+/* software control the legacy csi irq */
+#define IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40c00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40d00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE		(IS_IO_BASE + 0x49000U)
+#define IS_IO_CSI2_IRQ_CTRL_BASE		(IS_IO_BASE + 0x4e100)
+
+#define IRQ_CTL_EDGE				0
+#define IRQ_CTL_MASK				0x4U
+#define IRQ_CTL_STATUS				0x8U
+#define IRQ_CTL_CLEAR				0xcU
+#define IRQ_CTL_ENABLE				0x10U
+/* FE irq for PTL */
+#define IRQ1_CTL_MASK				0x14U
+#define IRQ1_CTL_STATUS				0x18U
+#define IRQ1_CTL_CLEAR				0x1cU
+#define IRQ1_CTL_ENABLE				0x20U
+
+/* software to set the clock gate to use the port or mgc */
+#define IS_IO_GPREGS_BASE			(IS_IO_BASE + 0x49200U)
+#define SRST_PORT_ARB				0
+#define SRST_MGC				0x4U
+#define SRST_WIDTH_CONV				0x8U
+#define SRST_CSI_IRQ				0xcU
+#define SRST_CSI_LEGACY_IRQ			0x10U
+#define CLK_EN_TXCLKESC				0x14U
+#define CLK_DIV_FACTOR_IS_CLK			0x18U
+#define CLK_DIV_FACTOR_APB_CLK			0x1cU
+#define CSI_PORT_CLK_GATE			0x20U
+#define CSI_PORTAB_AGGREGATION			0x24U
+#define MGC_CLK_GATE				0x2cU
+#define CG_CTRL_BITS				0x3cU
+#define SPARE_RW				0xf8U
+#define SPARE_RO				0xfcU
+
+#define IS_IO_CSI2_MPF_PORT_BASE(i)		(IS_IO_BASE + 0x53000U + \
+						 0x1000U * (i))
+#define MPF_16_IRQ_CNTRL_STATUS			0x238U
+#define MPF_16_IRQ_CNTRL_CLEAR			0x23cU
+#define MPF_16_IRQ_CNTRL_ENABLE			0x240U
+
+/* software config the phy */
+#define IS_IO_CSI2_GPREGS_BASE		(IS_IO_BASE + 0x53400U)
+#define IPU8_IS_IO_CSI2_GPREGS_BASE	(IS_IO_BASE + 0x40e00U)
+#define CSI_ADAPT_LAYER_SRST		0
+#define MPF_SRST_RST			0x4U
+#define CSI_ERR_IRQ_CTRL_SRST		0x8U
+#define CSI_SYNC_RC_SRST		0xcU
+#define CSI_CG_CTRL_BITS		0x10U
+#define SOC_CSI2HOST_SELECT		0x14U
+#define PHY_RESET			0x18U
+#define PHY_SHUTDOWN			0x1cU
+#define PHY_MODE			0x20U
+#define PHY_READY			0x24U
+#define PHY_CLK_LANE_FORCE_CONTROL	0x28U
+#define PHY_CLK_LANE_CONTROL		0x2cU
+#define PHY_CLK_LANE_STATUS		0x30U
+#define PHY_LANE_RX_ESC_REQ		0x34U
+#define PHY_LANE_RX_ESC_DATA		0x38U
+#define PHY_LANE_TURNDISABLE		0x3cU
+#define PHY_LANE_DIRECTION		0x40U
+#define PHY_LANE_FORCE_CONTROL		0x44U
+#define PHY_LANE_CONTROL_EN		0x48U
+#define PHY_LANE_CONTROL_DATAWIDTH	0x4cU
+#define PHY_LANE_STATUS			0x50U
+#define PHY_LANE_ERR			0x54U
+#define PHY_LANE_RXALP			0x58U
+#define PHY_LANE_RXALP_NIBBLE		0x5cU
+#define PHY_PARITY_ERROR		0x60U
+#define PHY_DEBUG_REGS_CLK_GATE_EN	0x64U
+#define SPARE_RW			0xf8U
+#define SPARE_RO			0xfcU
+
+/* software not touch */
+#define PORT_ARB_BASE				(IS_IO_BASE + 0x4e000)
+#define PORT_ARB_IRQ_CTL_STATUS			0x4U
+#define PORT_ARB_IRQ_CTL_CLEAR			0x8U
+#define PORT_ARB_IRQ_CTL_ENABLE			0xcU
+
+#define MGC_PPC					4U
+#define MGC_DTYPE_RAW(i)			(((i) - 8) / 2)
+#define IS_IO_MGC_BASE				(IS_IO_BASE + 0x48000U)
+#define MGC_KICK				0
+#define MGC_ASYNC_STOP				0x4U
+#define MGC_PORT_OFFSET				0x100U
+#define MGC_CSI_PORT_MAP(i)			(0x8 + (i) * 0x4)
+#define MGC_MG_PORT(i)				(IS_IO_MGC_BASE +	\
+						 (i) * MGC_PORT_OFFSET)
+/* per mgc instance */
+#define MGC_MG_CSI_ADAPT_LAYER_TYPE		0x28U
+#define MGC_MG_MODE				0x2cU
+#define MGC_MG_INIT_COUNTER			0x30U
+#define MGC_MG_MIPI_VC				0x34U
+#define MGC_MG_MIPI_DTYPES			0x38U
+#define MGC_MG_MULTI_DTYPES_MODE		0x3cU
+#define MGC_MG_NOF_FRAMES			0x40U
+#define MGC_MG_FRAME_DIM			0x44U
+#define MGC_MG_HBLANK				0x48U
+#define MGC_MG_VBLANK				0x4cU
+#define MGC_MG_TPG_MODE				0x50U
+#define MGC_MG_TPG_R0				0x54U
+#define MGC_MG_TPG_G0				0x58U
+#define MGC_MG_TPG_B0				0x5cU
+#define MGC_MG_TPG_R1				0x60U
+#define MGC_MG_TPG_G1				0x64U
+#define MGC_MG_TPG_B1				0x68U
+#define MGC_MG_TPG_FACTORS			0x6cU
+#define MGC_MG_TPG_MASKS			0x70U
+#define MGC_MG_TPG_XY_MASK			0x74U
+#define MGC_MG_TPG_TILE_DIM			0x78U
+#define MGC_MG_PRBS_LFSR_INIT_0			0x7cU
+#define MGC_MG_PRBS_LFSR_INIT_1			0x80U
+#define MGC_MG_SYNC_STOP_POINT			0x84U
+#define MGC_MG_SYNC_STOP_POINT_LOC		0x88U
+#define MGC_MG_ERR_INJECT			0x8cU
+#define MGC_MG_ERR_LOCATION			0x90U
+#define MGC_MG_DTO_SPEED_CTRL_EN		0x94U
+#define MGC_MG_DTO_SPEED_CTRL_INCR_VAL		0x98U
+#define MGC_MG_HOR_LOC_STTS			0x9cU
+#define MGC_MG_VER_LOC_STTS			0xa0U
+#define MGC_MG_FRAME_NUM_STTS			0xa4U
+#define MGC_MG_BUSY_STTS			0xa8U
+#define MGC_MG_STOPPED_STTS			0xacU
+/* tile width and height in pixels for Chess board and Color palette */
+#define MGC_TPG_TILE_WIDTH			64U
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1057

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +6 -0
+#define MGC_TPG_TILE_HEIGHT			64U
+
+#define IPU_CSI_PORT_A_ADDR_OFFSET		0
+#define IPU_CSI_PORT_B_ADDR_OFFSET		0
+#define IPU_CSI_PORT_C_ADDR_OFFSET		0
+#define IPU_CSI_PORT_D_ADDR_OFFSET		0

All 0?

Yes, the register offset here is actually useless. As the IPU7 ISYS registers are grouped by component instead of port number.

		offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
		mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);

But we still keep the defines to be compatible with IPU6.

Quoted 200 lines
Quoted 14 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +13 -0
+
+/*
+ * 0 - CSI RX Port 0 interrupt;
+ * 1 - MPF Port 0 interrupt;
+ * 2 - CSI RX Port 1 interrupt;
+ * 3 - MPF Port 1 interrupt;
+ * 4 - CSI RX Port 2 interrupt;
+ * 5 - MPF Port 2 interrupt;
+ * 6 - CSI RX Port 3 interrupt;
+ * 7 - MPF Port 3 interrupt;
+ * 8 - Port ARB FIFO 0 overflow;
+ * 9 - Port ARB FIFO 1 overflow;
+ * 10 - Port ARB FIFO 2 overflow;

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1080

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+ * 11 - Port ARB FIFO 3 overflow;
+ * 12 - isys_cfgnoc_err_probe_intl;
+ * 13-15 - reserved
+ */
+#define IPU7_CSI_IS_IO_IRQ_MASK		0xffffU
+
+/* Adapter layer irq */
+#define IPU7_CSI_ADPL_IRQ_MASK		0xffffU
+
+/* sw irq from legacy irq control

/*
*

Quoted 172 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +117 -0
+ * legacy irq status
+ * IPU7
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 sync interrupt
+ * 2 - CSI Port 1 error interrupt
+ * 3 - CSI Port 1 sync interrupt
+ * 4 - CSI Port 2 error interrupt
+ * 5 - CSI Port 2 sync interrupt
+ * 6 - CSI Port 3 error interrupt
+ * 7 - CSI Port 3 sync interrupt
+ * IPU7P5
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 fs interrupt
+ * 2 - CSI Port 0 fe interrupt
+ * 3 - CSI Port 1 error interrupt
+ * 4 - CSI Port 1 fs interrupt
+ * 5 - CSI Port 1 fe interrupt
+ * 6 - CSI Port 2 error interrupt
+ * 7 - CSI Port 2 fs interrupt
+ * 8 - CSI Port 2 fe interrupt
+ */
+#define IPU7_CSI_RX_LEGACY_IRQ_MASK		0x1ffU
+
+/* legacy error status per port
+ * 0 - Error handler FIFO full;
+ * 1 - Reserved Short Packet encoding detected;
+ * 2 - Reserved Long Packet encoding detected;
+ * 3 - Received packet is too short (fewer data words than specified in header);
+ * 4 - Received packet is too long (more data words than specified in header);
+ * 5 - Short packet discarded due to errors;
+ * 6 - Long packet discarded due to errors;
+ * 7 - CSI Combo Rx interrupt;
+ * 8 - IDI CDC FIFO overflow; remaining bits are reserved and tied to 0;
+ */
+#define IPU7_CSI_RX_ERROR_IRQ_MASK		0xfffU
+
+/*
+ * 0 - VC0 frame start received
+ * 1 - VC0 frame end received
+ * 2 - VC1 frame start received
+ * 3 - VC1 frame end received
+ * 4 - VC2 frame start received
+ * 5 - VC2 frame end received
+ * 6 - VC3 frame start received
+ * 7 - VC3 frame end received
+ * 8 - VC4 frame start received
+ * 9 - VC4 frame end received
+ * 10 - VC5 frame start received
+ * 11 - VC5 frame end received
+ * 12 - VC6 frame start received
+ * 13 - VC6 frame end received
+ * 14 - VC7 frame start received
+ * 15 - VC7 frame end received
+ * 16 - VC8 frame start received
+ * 17 - VC8 frame end received
+ * 18 - VC9 frame start received
+ * 19 - VC9 frame end received
+ * 20 - VC10 frame start received
+ * 21 - VC10 frame end received
+ * 22 - VC11 frame start received
+ * 23 - VC11 frame end received
+ * 24 - VC12 frame start received
+ * 25 - VC12 frame end received
+ * 26 - VC13 frame start received
+ * 27 - VC13 frame end received
+ * 28 - VC14 frame start received
+ * 29 - VC14 frame end received
+ * 30 - VC15 frame start received
+ * 31 - VC15 frame end received
+ */
+
+#define IPU7_CSI_RX_SYNC_IRQ_MASK		0 /* 0xffffffff */
+#define IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK		0 /* 0xffffffff */
+
+#define CSI_RX_NUM_ERRORS_IN_IRQ		12U
+#define CSI_RX_NUM_SYNC_IN_IRQ			32U
+
+enum CSI_FE_MODE_TYPE {
+	CSI_FE_DPHY_MODE = 0,
+	CSI_FE_CPHY_MODE = 1,
+};
+
+enum CSI_FE_INPUT_MODE {
+	CSI_SENSOR_INPUT = 0,
+	CSI_MIPIGEN_INPUT = 1,
+};
+
+enum MGC_CSI_ADPL_TYPE {
+	MGC_MAPPED_2_LANES = 0,
+	MGC_MAPPED_4_LANES = 1,
+};
+
+enum CSI2HOST_SELECTION {
+	CSI2HOST_SEL_SOC = 0,
+	CSI2HOST_SEL_CSI2HOST = 1,
+};
+
+#define IPU7_ISYS_LEGACY_IRQ_CSI2(port)		(0x3U << (port))
+#define IPU7P5_ISYS_LEGACY_IRQ_CSI2(port)	(0x7U << (port))
+
+/* ---------------------------------------------------------------- */
+#define CSI_REG_BASE				0x220000U
+#define CSI_REG_BASE_PORT(id)			((id) * 0x1000)
+
+/* CSI Port General Purpose Registers */
+#define CSI_REG_PORT_GPREG_SRST			0
+#define CSI_REG_PORT_GPREG_CSI2_SLV_REG_SRST	0x4U
+#define CSI_REG_PORT_GPREG_CSI2_PORT_CONTROL	0x8U
+
+#define CSI_RX_NUM_IRQ				32U
+
+#define IPU7_CSI_RX_SYNC_FS_VC			0x55555555U
+#define IPU7_CSI_RX_SYNC_FE_VC			0xaaaaaaaaU
+#define IPU7P5_CSI_RX_SYNC_FS_VC		0xffffU
+#define IPU7P5_CSI_RX_SYNC_FE_VC		0xffffU
+
+#endif /* IPU7_ISYS_CSI2_REG_H */
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +49 -0
new file mode 100644
index 000000000000..ae504fb41464
@@ -0,0 +1,542 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#include <linux/atomic.h>
+#include <linux/bits.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/minmax.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+
+#include <media/media-entity.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-subdev.h>
+
+#include "ipu7.h"
+#include "ipu7-bus.h"
+#include "ipu7-isys.h"
+#include "ipu7-isys-csi2.h"
+#include "ipu7-isys-csi2-regs.h"
+#include "ipu7-isys-csi-phy.h"
+
+static const u32 csi2_supported_codes[] = {
+	MEDIA_BUS_FMT_Y10_1X10,
+	MEDIA_BUS_FMT_RGB565_1X16,
+	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_UYVY8_1X16,
+	MEDIA_BUS_FMT_YUYV8_1X16,
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_SBGGR10_1X10,
+	MEDIA_BUS_FMT_SGBRG10_1X10,
+	MEDIA_BUS_FMT_SGRBG10_1X10,
+	MEDIA_BUS_FMT_SRGGB10_1X10,
+	MEDIA_BUS_FMT_SBGGR12_1X12,
+	MEDIA_BUS_FMT_SGBRG12_1X12,
+	MEDIA_BUS_FMT_SGRBG12_1X12,
+	MEDIA_BUS_FMT_SRGGB12_1X12,
+	MEDIA_BUS_FMT_SBGGR8_1X8,
+	MEDIA_BUS_FMT_SGBRG8_1X8,
+	MEDIA_BUS_FMT_SGRBG8_1X8,
+	MEDIA_BUS_FMT_SRGGB8_1X8,
+	0,
+};
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.c line 55

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +6 -0
+
+s64 ipu7_isys_csi2_get_link_freq(struct ipu7_isys_csi2 *csi2)
+{
+	struct media_pad *src_pad;
+
+	if (!csi2)

Can this be NULL?

This could be NULL if the caller call wrong CSI2 number(likely coding problem), but the check is harmless as it can be used to avoid crash later.

Quoted 523 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.h

Quoted 519 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +487 -0
+		return -EINVAL;
+
+	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
+	if (IS_ERR(src_pad)) {
+		dev_err(&csi2->isys->adev->auxdev.dev,
+			"can't get source pad of %s (%ld)\n",
+			csi2->asd.sd.name, PTR_ERR(src_pad));
+		return PTR_ERR(src_pad);
+	}
+
+	return v4l2_get_link_freq(src_pad, 0, 0);
+}
+
+static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
+				struct v4l2_event_subscription *sub)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "csi2 subscribe event(type %u id %u)\n",
+		sub->type, sub->id);
+
+	switch (sub->type) {
+	case V4L2_EVENT_FRAME_SYNC:
+		return v4l2_event_subscribe(fh, sub, 10, NULL);
+	case V4L2_EVENT_CTRL:
+		return v4l2_ctrl_subscribe_event(fh, sub);
+	default:
+		return -EINVAL;
+	}
+}
+
+static const struct v4l2_subdev_core_ops csi2_sd_core_ops = {
+	.subscribe_event = csi2_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static void csi2_irq_en(struct ipu7_isys_csi2 *csi2, bool enable)
+{
+	struct ipu7_device *isp = csi2->isys->adev->isp;
+	unsigned int offset, mask;
+
+	if (!enable) {
+		/* disable CSI2 legacy error irq */
+		offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		/* disable CSI2 legacy sync irq */
+		offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		if (!is_ipu7(isp->hw_ver)) {
+			writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+			writel(0, csi2->base + offset + IRQ1_CTL_MASK);
+			writel(0, csi2->base + offset + IRQ1_CTL_ENABLE);
+		}
+
+		return;
+	}
+
+	/* enable CSI2 legacy error irq */
+	offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	/* enable CSI2 legacy sync irq */
+	offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	mask = IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK;
+	if (!is_ipu7(isp->hw_ver)) {
+		writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+		writel(mask, csi2->base + offset + IRQ1_CTL_MASK);
+		writel(mask, csi2->base + offset + IRQ1_CTL_ENABLE);
+	}
+}
+
+static void ipu7_isys_csi2_disable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	void __iomem *isys_base = isys->pdata->base;
+
+	ipu7_isys_csi_phy_powerdown(csi2);
+
+	writel(0x4, isys_base + IS_IO_GPREGS_BASE + CLK_DIV_FACTOR_APB_CLK);
+	csi2_irq_en(csi2, 0);
+}
+
+static int ipu7_isys_csi2_enable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	struct device *dev = &isys->adev->auxdev.dev;
+	void __iomem *isys_base = isys->pdata->base;
+	unsigned int port, nlanes, offset;
+	int ret;
+
+	port = csi2->port;
+	nlanes = csi2->nlanes;
+
+	offset = IS_IO_GPREGS_BASE;
+	writel(0x2, isys_base + offset + CLK_DIV_FACTOR_APB_CLK);
+	dev_dbg(dev, "port %u CLK_GATE = 0x%04x DIV_FACTOR_APB_CLK=0x%04x\n",
+		port, readl(isys_base + offset + CSI_PORT_CLK_GATE),
+		readl(isys_base + offset + CLK_DIV_FACTOR_APB_CLK));
+	if (port == 0U && nlanes == 4U && !is_ipu7(isys->adev->isp->hw_ver)) {
+		dev_dbg(dev, "CSI port %u in aggregation mode\n", port);
+		writel(0x1, isys_base + offset + CSI_PORTAB_AGGREGATION);
+	}
+
+	/* input is coming from CSI receiver (sensor) */
+	offset = IS_IO_CSI2_ADPL_PORT_BASE(port);
+	writel(CSI_SENSOR_INPUT, isys_base + offset + CSI2_ADPL_INPUT_MODE);
+	writel(1, isys_base + offset + CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN);
+
+	ret = ipu7_isys_csi_phy_powerup(csi2);
+	if (ret) {
+		dev_err(dev, "CSI-%d PHY power up failed %d\n", port, ret);
+		return ret;
+	}
+	csi2_irq_en(csi2, 1);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_set_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct device *dev = &asd->isys->adev->auxdev.dev;
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_mbus_framefmt *src_ffmt;
+	struct v4l2_rect *crop;
+
+	if (sel->pad == CSI2_PAD_SINK || sel->target != V4L2_SEL_TGT_CROP)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	src_ffmt = v4l2_subdev_state_get_format(state, sel->pad, sel->stream);
+	if (!src_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	/* Only vertical cropping is supported */
+	sel->r.left = 0;
+	sel->r.width = sink_ffmt->width;
+	/* Non-bayer formats can't be single line cropped */
+	if (!ipu7_isys_is_bayer_format(sink_ffmt->code))
+		sel->r.top &= ~1U;
+	sel->r.height = clamp(sel->r.height & ~1U, IPU_ISYS_MIN_HEIGHT,
+			      sink_ffmt->height - sel->r.top);
+	*crop = sel->r;
+
+	/* update source pad format */
+	src_ffmt->width = sel->r.width;
+	src_ffmt->height = sel->r.height;
+	if (ipu7_isys_is_bayer_format(sink_ffmt->code))
+		src_ffmt->code = ipu7_isys_convert_bayer_order(sink_ffmt->code,
+							       sel->r.left,
+							       sel->r.top);
+	dev_dbg(dev, "set crop for %s sel: %d,%d,%d,%d code: 0x%x\n",
+		sd->name, sel->r.left, sel->r.top, sel->r.width, sel->r.height,
+		src_ffmt->code);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_get_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_rect *crop;
+	int ret = 0;
+
+	if (sd->entity.pads[sel->pad].flags & MEDIA_PAD_FL_SINK)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = sink_ffmt->width;
+		sel->r.height = sink_ffmt->height;
+		break;
+	case V4L2_SEL_TGT_CROP:
+		sel->r = *crop;
+		break;
+	default:
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
+/*
+ * Maximum stream ID is 63 for now, as we use u64 bitmask to represent a set
+ * of streams.
+ */
+#define CSI2_SUBDEV_MAX_STREAM_ID 63
+
+static int ipu7_isys_csi2_enable_streams(struct v4l2_subdev *sd,
+					 struct v4l2_subdev_state *state,
+					 u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	if (!csi2->stream_count) {
+		dev_dbg(&csi2->isys->adev->auxdev.dev,
+			"stream on CSI2-%u with %u lanes\n", csi2->port,
+			csi2->nlanes);
+		ret = ipu7_isys_csi2_enable_stream(csi2);
+		if (ret)
+			return ret;
+	}
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	ret = v4l2_subdev_enable_streams(r_sd, r_pad->index,
+					 BIT_ULL(sink_stream));
+	if (!ret) {
+		csi2->stream_count++;
+		return 0;
+	}
+
+	if (!csi2->stream_count)
+		ipu7_isys_csi2_disable_stream(csi2);
+
+	return ret;
+}
+
+static int ipu7_isys_csi2_disable_streams(struct v4l2_subdev *sd,
+					  struct v4l2_subdev_state *state,
+					  u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	v4l2_subdev_disable_streams(r_sd, r_pad->index, BIT_ULL(sink_stream));
+
+	if (--csi2->stream_count)
+		return 0;
+
+	dev_dbg(&csi2->isys->adev->auxdev.dev,
+		"stream off CSI2-%u with %u lanes\n", csi2->port, csi2->nlanes);
+
+	ipu7_isys_csi2_disable_stream(csi2);
+
+	return 0;
+}
+
+static const struct v4l2_subdev_pad_ops csi2_sd_pad_ops = {
+	.get_fmt = v4l2_subdev_get_fmt,
+	.set_fmt = ipu7_isys_subdev_set_fmt,
+	.get_selection = ipu7_isys_csi2_get_sel,
+	.set_selection = ipu7_isys_csi2_set_sel,
+	.enum_mbus_code = ipu7_isys_subdev_enum_mbus_code,
+	.enable_streams = ipu7_isys_csi2_enable_streams,
+	.disable_streams = ipu7_isys_csi2_disable_streams,
+	.set_routing = ipu7_isys_subdev_set_routing,
+};
+
+static const struct v4l2_subdev_ops csi2_sd_ops = {
+	.core = &csi2_sd_core_ops,
+	.pad = &csi2_sd_pad_ops,
+};
+
+static const struct media_entity_operations csi2_entity_ops = {
+	.link_validate = v4l2_subdev_link_validate,
+	.has_pad_interdep = v4l2_subdev_has_pad_interdep,
+};
+
+void ipu7_isys_csi2_cleanup(struct ipu7_isys_csi2 *csi2)
+{
+	if (!csi2->isys)
+		return;
+
+	v4l2_device_unregister_subdev(&csi2->asd.sd);
+	v4l2_subdev_cleanup(&csi2->asd.sd);
+	ipu7_isys_subdev_cleanup(&csi2->asd);
+	csi2->isys = NULL;
+}
+
+int ipu7_isys_csi2_init(struct ipu7_isys_csi2 *csi2,
+			struct ipu7_isys *isys,
+			void __iomem *base, unsigned int index)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +25 -0
new file mode 100644
index 000000000000..ea4e20525d16

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

These seem to require IPU7 prefix, too. It'd be nice to move them into a struct, specific to IPU version.

Quoted 12 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.h

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +10 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

These are the same for IPU6, aren't they?

Will remove them.

Quoted 1 line
Signature · 2 lines
Best regards,
Bingbu Cao

Part of the diff is not shown here. View the raw message.

maintainer
#13 lore raw

Re: [PATCH 6/8] media: staging/ipu7: add IPU7 input system device driver

Hi Bingbu,

Quoted 9 lines · Bingbu Cao
Quoted 7 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 601

Quoted 5 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +5 -0
+	/* deskew */
+	for (i = 0; i < lanes; i++) {
+		reg = CORE_DIG_DLANE_0_RW_CFG_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400),
+				   ((mbps > 1500) ? 0x1 : 0x2), 2, 3);

You can remove three pairs of parentheses above. Same below.

This also just to satisfy the MISRA (FUSA) rule :(.

MISRA isn't part of the kernel coding style. I'm pretty sure you could automate generating patches with Coccinelle where you need to be MISRA compliant.

Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +16 -0
+static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				  bool aggregation, u64 mbps)
+{
+	u8 trios = 2;
+	u16 coarse_target;
+	u16 deass_thresh;
+	u16 delay_thresh;
+	u16 reset_thresh;
+	u16 cap_prog = 6U;
+	u16 reg;
+	u16 val;
+	u32 i;
+	u32 r;
+
+	if (is_ipu7p5(isys->adev->isp->hw_ver))
+		val = 0x15;
Quoted 9 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 744

Quoted 5 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +5 -0
+	else
+		val = 0x155;
+
+	if (is_ipu7(isys->adev->isp->hw_ver))
+		trios = 3;

It'd be good to have hardware version specific struct where you'd have such values in a single location.

Quoted 2 lines

It could be done, but there are many variants and a new IPU7 platform is coming, I think I can do this in future.

Fair enough. If this function remains IPU7 specific, I mean not being relevant for IPU6, then this could be workable indeed.

Quoted 29 lines
Quoted 29 lines
Quoted 15 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +14 -0
+
+	dwc_phy_write_mask(isys, id, CORE_DIG_RW_COMMON_7, val, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_7, 104, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_8, 16, 0, 7);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 6, 8, 11);
+
+	val = (mbps > 900U) ? 1U : 0U;
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 1, 0, 0);
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), val, 1, 1);

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 768

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +10 -0
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_1;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_5;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 38, 0, 15);
+
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_6;
+		dwc_phy_write_mask(isys, id, reg + (i * 0x400), 10, 0, 15);
+	}

Too many magic numbers. :-( Please come up with human-readable names for these, including 0x400.

Quoted 5 lines
Quoted 2 lines

Simiarly below and probably elsewhere, too. No need to apply to individual tables entries though, but they need to be separate from the code.

I don't think it is doable now, these are from PHY manual, I don't know the actual meaning of these magic registers.

Ok. At least add a comment to explain this, and what the values are for.

For register addresses you could add a macro to calculate it based on trios. What does that value signify btw.?

Quoted 13 lines
Quoted 13 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 776

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +8 -0
+
+	/*
+	 * Below 900Msps, always use the same value.
+	 * The formula is suitable for data rate 80-3500Msps.
+	 * Timebase (us) = 1, DIV = 32, TDDL (UI) = 0.5
+	 */
+	if (mbps >= 80U) {
+		coarse_target = (u16)div_u64_rem(mbps, 16, &r);

No need to cast.

Quoted 2 lines
Quoted 2 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 778

Quoted 2 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +2 -0
+		if (!r)
+			coarse_target--;

Please use u32 for mbps.

Then you can also achieve the same result by just:

		coarse_target = (mbps - 1) / 16;

This seems to be a repeating pattern in this function at least.

Quoted 101 lines
Quoted 101 lines
Quoted 101 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +101 -0
+	} else {
+		coarse_target = 56;
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_CLANE_0_RW_HS_RX_2 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, coarse_target, 0, 15);
+	}
+
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2, 1, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2, 0, 0, 0);
+	dwc_phy_write_mask(isys, id,
+			   CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2, 1, 0, 0);
+
+	if (!is_ipu7p5(isys->adev->isp->hw_ver) && lanes == 4) {
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2,
+				   1, 0, 0);
+		dwc_phy_write_mask(isys, id,
+				   CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2,
+				   0, 0, 0);
+	}
+
+	for (i = 0; i < trios; i++) {
+		reg = CORE_DIG_RW_TRIO0_0 + i * 0x400;
+		dwc_phy_write_mask(isys, id, reg, 1, 6, 8);
+		dwc_phy_write_mask(isys, id, reg, 1, 3, 5);
+		dwc_phy_write_mask(isys, id, reg, 2, 0, 2);
+	}
+
+	deass_thresh = (u16)div_u64_rem(7 * 1000 * 6, mbps * 5U, &r) + 1;
+	if (r != 0)
+		deass_thresh++;
+
+	reg = CORE_DIG_RW_TRIO0_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   deass_thresh, 0, 7);
+
+	delay_thresh =
+		((224U - (9U * 7U)) * 1000U) / (5U * mbps) - 7U;
+
+	if (delay_thresh < 1)
+		delay_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_1;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   delay_thresh, 0, 15);
+
+	reset_thresh = (u16)div_u64_rem(2U * 5U * mbps, 7U * 1000U, &r);
+	if (!r)
+		reset_thresh--;
+
+	if (reset_thresh < 1)
+		reset_thresh = 1;
+
+	reg = CORE_DIG_RW_TRIO0_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
+				   reset_thresh, 9, 11);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 1, 12, 15);
+
+	reg = CORE_DIG_CLANE_0_RW_LP_2;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 0, 0, 0);
+
+	reg = CORE_DIG_CLANE_0_RW_HS_RX_0;
+	for (i = 0; i < trios; i++)
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 12, 2, 6);
+
+	for (i = 0; i < ARRAY_SIZE(table7); i++) {
+		if (mbps >= table7[i].min_mbps && mbps <= table7[i].max_mbps) {
+			cap_prog = table7[i].val;
+			break;
+		}
+	}
+
+	for (i = 0; i < (lanes + 1); i++) {
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, 4U, 0, 2);
+		dwc_phy_write_mask(isys, id, reg, 0U, 3, 4);
+
+		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7 + 0x400 * i;
+		dwc_phy_write_mask(isys, id, reg, cap_prog, 10, 12);
+	}
+}
+
+static void ipu7_isys_phy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
+				 bool aggregation)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
+	u32 phy_mode;
+	s64 link_freq;
+	u64 mbps;
+
Quoted 8 lines
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi-phy.c line 887

Quoted 8 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +8 -0
+	if (aggregation)
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[0]);
+	else
+		link_freq = ipu7_isys_csi2_get_link_freq(&isys->csi2[id]);
+
+	if (link_freq < 0) {
+		dev_warn(dev, "get link freq failed, use default mbps\n");
+		link_freq = 560000000;

Please just handle the error.

Quoted 183 lines
Quoted 173 lines
Quoted 173 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c new file +141 -0
+	}
+
+	mbps = div_u64(link_freq, 500000);
+	dev_dbg(dev, "config phy %u with lanes %u aggregation %d mbps %lld\n",
+		id, lanes, aggregation, mbps);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_10, 48, 0, 7);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2,
+			   1, 12, 13);
+	dwc_phy_write_mask(isys, id, CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0,
+			   63, 2, 7);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_STARTUP_1_1,
+			   563, 0, 11);
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 5, 0, 7);
+	/* bypass the RCAL state (bit6) */
+	if (aggregation && id != PORT_A)
+		dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_2, 0x45,
+				   0, 7);
+
+	dwc_phy_write_mask(isys, id, PPI_STARTUP_RW_COMMON_DPHY_6, 39, 0, 7);
+	dwc_phy_write_mask(isys, id, PPI_CALIBCTRL_RW_COMMON_BG_0, 500, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_TERMCAL_CFG_0, 38, 0, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_OFFSETCAL_CFG_0, 7, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TIMEBASE, 153, 0, 9);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF, 800, 0, 10);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_NREF_RANGE, 27, 0, 4);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 47, 0, 8);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_TWAIT_CONFIG, 127, 9, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 47, 7, 15);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 27, 2, 6);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_VT_CONFIG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_LPDCOCAL_COARSE_CFG, 1, 0, 1);
+	dwc_phy_write_mask(isys, id, PPI_RW_COMMON_CFG, 3, 0, 1);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   1, 10, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3,
+			   3, 8, 9);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0,
+			   0, 15, 15);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6,
+			   7, 12, 14);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
+			   0, 8, 10);
+	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5,
+			   0, 8, 8);
+
+	if (aggregation)
+		phy_mode = isys->csi2[0].phy_mode;
+	else
+		phy_mode = isys->csi2[id].phy_mode;
+
+	if (phy_mode == PHY_MODE_DPHY) {
+		ipu7_isys_dphy_config(isys, id, lanes, aggregation, mbps);
+	} else if (phy_mode == PHY_MODE_CPHY) {
+		ipu7_isys_cphy_config(isys, id, lanes, aggregation, mbps);
+	} else {
+		dev_err(dev, "unsupported phy mode %d!\n",
+			isys->csi2[id].phy_mode);
+	}
+}
+
+int ipu7_isys_csi_phy_powerup(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	u32 lanes = csi2->nlanes;
+	bool aggregation = false;
+	u32 id = csi2->port;
+	int ret;
+
+	/* lanes remapping for aggregation (port AB) mode */
+	if (!is_ipu7(isys->adev->isp->hw_ver) && lanes > 2 && id == PORT_A) {
+		aggregation = true;
+		lanes = 2;
+	}
+
+	ipu7_isys_csi_phy_reset(isys, id);
+	gpreg_write(isys, id, PHY_CLK_LANE_CONTROL, 0x1);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+	gpreg_write(isys, id, PHY_LANE_CONTROL_EN, (1U << lanes) - 1U);
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0xf);
+	gpreg_write(isys, id, PHY_MODE, csi2->phy_mode);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_CONTROL, 0x0);
+		gpreg_write(isys, PORT_B, PHY_LANE_CONTROL_EN, 0x3);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0x2);
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0xf);
+		gpreg_write(isys, PORT_B, PHY_MODE, csi2->phy_mode);
+	}
+
+	ipu7_isys_csi_ctrl_cfg(csi2);
+	ipu7_isys_csi_ctrl_dids_config(csi2, id);
+
+	ipu7_isys_phy_config(isys, id, lanes, aggregation);
+	gpreg_write(isys, id, PHY_RESET, 1);
+	gpreg_write(isys, id, PHY_SHUTDOWN, 1);
+	dwc_csi_write(isys, id, DPHY_RSTZ, 1);
+	dwc_csi_write(isys, id, PHY_SHUTDOWNZ, 1);
+	dwc_csi_write(isys, id, CSI2_RESETN, 1);
+
+	ret = ipu7_isys_phy_ready(isys, id);
+	if (ret < 0)
+		return ret;
+
+	gpreg_write(isys, id, PHY_LANE_FORCE_CONTROL, 0);
+	gpreg_write(isys, id, PHY_CLK_LANE_FORCE_CONTROL, 0);
+
+	/* config PORT_B if aggregation mode */
+	if (aggregation) {
+		ipu7_isys_phy_config(isys, PORT_B, 2, aggregation);
+		gpreg_write(isys, PORT_B, PHY_RESET, 1);
+		gpreg_write(isys, PORT_B, PHY_SHUTDOWN, 1);
+		dwc_csi_write(isys, PORT_B, DPHY_RSTZ, 1);
+		dwc_csi_write(isys, PORT_B, PHY_SHUTDOWNZ, 1);
+		dwc_csi_write(isys, PORT_B, CSI2_RESETN, 1);
+		ret = ipu7_isys_phy_ready(isys, PORT_B);
+		if (ret < 0)
+			return ret;
+
+		gpreg_write(isys, PORT_B, PHY_LANE_FORCE_CONTROL, 0);
+		gpreg_write(isys, PORT_B, PHY_CLK_LANE_FORCE_CONTROL, 0);
+	}
+
+	return 0;
+}
+
+void ipu7_isys_csi_phy_powerdown(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+
+	ipu7_isys_csi_phy_reset(isys, csi2->port);
+	if (!is_ipu7(isys->adev->isp->hw_ver) &&
+	    csi2->nlanes > 2U && csi2->port == PORT_A)
+		ipu7_isys_csi_phy_reset(isys, PORT_B);
+}
drivers/staging/media/ipu7/ipu7-isys-csi-phy.h new file +16 -0
new file mode 100644
index 000000000000..dfdcb61540c4
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 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/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +4 -0
new file mode 100644
index 000000000000..32704ca21341
@@ -0,0 +1,1197 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 - 2025 Intel Corporation
+ */
Quoted 9 lines

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 10

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +6 -0
+
+#ifndef IPU7_ISYS_CSI2_REG_H
+#define IPU7_ISYS_CSI2_REG_H
+
+/* IS main regs base */
+#define IS_MAIN_BASE				(0x240000U)

Please drop U specifier from hexadecimal values.

Quoted 2 lines

We changed these for fixing the FUSA(MISRA C) problems, is it not liked by kernel coding rule?

I've frankly never seen that in kernel code. I grepped a bit and there are 3,5 million cases without U suffix and a bit less than 2000 with it. So it exists but is rare, for the reason of being redundant. I don't have a strong opinion on it either way but I lean towards removing it as it's redundant.

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +40 -0
+#define IS_MAIN_S2B_BASE			(IS_MAIN_BASE + 0x22000U)
+#define IS_MAIN_B2O_BASE			(IS_MAIN_BASE + 0x26000U)
+#define IS_MAIN_ISD_M0_BASE			(IS_MAIN_BASE + 0x2b000U)
+#define IS_MAIN_ISD_M1_BASE			(IS_MAIN_BASE + 0x2b100U)
+#define IS_MAIN_ISD_INT_BASE			(IS_MAIN_BASE + 0x2b200U)
+#define IS_MAIN_GDA_BASE			(IS_MAIN_BASE + 0x32000U)
+#define IS_MAIN_GPREGS_MAIN_BASE		(IS_MAIN_BASE + 0x32500U)
+#define IS_MAIN_IRQ_CTRL_BASE			(IS_MAIN_BASE + 0x32700U)
+#define IS_MAIN_PWM_CTRL_BASE			(IS_MAIN_BASE + 0x32b00U)
+
+#define S2B_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_S2B_BASE + 0x1cU)
+#define S2B_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_S2B_BASE + 0x20U)
+#define S2B_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_S2B_BASE + 0x24U)
+#define S2B_IID_IRQ_CTL_STATUS(iid)		(IS_MAIN_S2B_BASE + 0x94U + \
+						 0x100U * (iid))
+
+#define B2O_IRQ_COMMON_0_CTL_STATUS		(IS_MAIN_B2O_BASE + 0x30U)
+#define B2O_IRQ_COMMON_0_CTL_CLEAR		(IS_MAIN_B2O_BASE + 0x34U)
+#define B2O_IRQ_COMMON_0_CTL_ENABLE		(IS_MAIN_B2O_BASE + 0x38U)
+#define B2O_IID_IRQ_CTL_STATUS(oid)		(IS_MAIN_B2O_BASE + 0x3dcU + \
+						 0x200U * (oid))
+
+#define ISD_M0_IRQ_CTL_STATUS			(IS_MAIN_ISD_M0_BASE + 0x1cU)
+#define ISD_M0_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M0_BASE + 0x20U)
+#define ISD_M0_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M0_BASE + 0x24U)
+
+#define ISD_M1_IRQ_CTL_STATUS			(IS_MAIN_ISD_M1_BASE + 0x1cU)
+#define ISD_M1_IRQ_CTL_CLEAR			(IS_MAIN_ISD_M1_BASE + 0x20U)
+#define ISD_M1_IRQ_CTL_ENABLE			(IS_MAIN_ISD_M1_BASE + 0x24U)
+
+#define ISD_INT_IRQ_CTL_STATUS			(IS_MAIN_ISD_INT_BASE + 0x1cU)
+#define ISD_INT_IRQ_CTL_CLEAR			(IS_MAIN_ISD_INT_BASE + 0x20U)
+#define ISD_INT_IRQ_CTL_ENABLE			(IS_MAIN_ISD_INT_BASE + 0x24U)
+
+#define GDA_IRQ_CTL_STATUS			(IS_MAIN_GDA_BASE + 0x1cU)
+#define GDA_IRQ_CTL_CLEAR			(IS_MAIN_GDA_BASE + 0x20U)
+#define GDA_IRQ_CTL_ENABLE			(IS_MAIN_GDA_BASE + 0x24U)
+
+#define IS_MAIN_IRQ_CTL_EDGE			IS_MAIN_IRQ_CTRL_BASE
+#define IS_MAIN_IRQ_CTL_MASK			(IS_MAIN_IRQ_CTRL_BASE + 0x4U)
Quoted 8 lines
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 58

Quoted 8 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +8 -0
+#define IS_MAIN_IRQ_CTL_STATUS			(IS_MAIN_IRQ_CTRL_BASE + 0x8U)
+#define IS_MAIN_IRQ_CTL_CLEAR			(IS_MAIN_IRQ_CTRL_BASE + 0xcU)
+#define IS_MAIN_IRQ_CTL_ENABLE			(IS_MAIN_IRQ_CTRL_BASE + 0x10U)
+#define IS_MAIN_IRQ_CTL_LEVEL_NOT_PULSE		(IS_MAIN_IRQ_CTRL_BASE + 0x14U)
+
+/* IS IO regs base */
+#define IS_PHY_NUM				(4U)
+#define IS_IO_BASE				(0x280000U)

These parentheses are redundant, too, btw.

Quoted 493 lines
Quoted 493 lines
Quoted 479 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +479 -0
+
+/* dwc csi cdphy registers */
+#define IS_IO_CDPHY_BASE(i)			(IS_IO_BASE + 0x10000U * (i))
+#define PPI_STARTUP_RW_COMMON_DPHY_0			0x1800U
+#define PPI_STARTUP_RW_COMMON_DPHY_1			0x1802U
+#define PPI_STARTUP_RW_COMMON_DPHY_2			0x1804U
+#define PPI_STARTUP_RW_COMMON_DPHY_3			0x1806U
+#define PPI_STARTUP_RW_COMMON_DPHY_4			0x1808U
+#define PPI_STARTUP_RW_COMMON_DPHY_5			0x180aU
+#define PPI_STARTUP_RW_COMMON_DPHY_6			0x180cU
+#define PPI_STARTUP_RW_COMMON_DPHY_7			0x180eU
+#define PPI_STARTUP_RW_COMMON_DPHY_8			0x1810U
+#define PPI_STARTUP_RW_COMMON_DPHY_9			0x1812U
+#define PPI_STARTUP_RW_COMMON_DPHY_A			0x1814U
+#define PPI_STARTUP_RW_COMMON_DPHY_10			0x1820U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_1		0x1822U
+#define PPI_STARTUP_RW_COMMON_STARTUP_1_2		0x1824U
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_0		0x1840U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_1		0x1842U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_2		0x1844U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_3		0x1846U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_4		0x1848U
+#define PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5		0x184aU
+#define PPI_CALIBCTRL_RW_COMMON_BG_0			0x184cU
+#define PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_7		0x184eU
+#define PPI_CALIBCTRL_RW_ADC_CFG_0			0x1850U
+#define PPI_CALIBCTRL_RW_ADC_CFG_1			0x1852U
+#define PPI_CALIBCTRL_R_ADC_DEBUG			0x1854U
+#define PPI_RW_LPDCOCAL_TOP_OVERRIDE			0x1c00U
+#define PPI_RW_LPDCOCAL_TIMEBASE			0x1c02U
+#define PPI_RW_LPDCOCAL_NREF				0x1c04U
+#define PPI_RW_LPDCOCAL_NREF_RANGE			0x1c06U
+#define PPI_RW_LPDCOCAL_NREF_TRIGGER_MAN		0x1c08U
+#define PPI_RW_LPDCOCAL_TWAIT_CONFIG			0x1c0aU
+#define PPI_RW_LPDCOCAL_VT_CONFIG			0x1c0cU
+#define PPI_R_LPDCOCAL_DEBUG_RB				0x1c0eU
+#define PPI_RW_LPDCOCAL_COARSE_CFG			0x1c10U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_RB			0x1c12U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_0_RB		0x1c14U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_1_RB		0x1c16U
+#define PPI_R_LPDCOCAL_DEBUG_COARSE_FWORD_RB		0x1c18U
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_CURR_ERROR		0x1c1aU
+#define PPI_R_LPDCOCAL_DEBUG_MEASURE_LAST_ERROR		0x1c1cU
+#define PPI_R_LPDCOCAL_DEBUG_VT				0x1c1eU
+#define PPI_RW_LB_TIMEBASE_CONFIG			0x1c20U
+#define PPI_RW_LB_STARTCMU_CONFIG			0x1c22U
+#define PPI_R_LBPULSE_COUNTER_RB			0x1c24U
+#define PPI_R_LB_START_CMU_RB				0x1c26U
+#define PPI_RW_LB_DPHY_BURST_START			0x1c28U
+#define PPI_RW_LB_CPHY_BURST_START			0x1c2aU
+#define PPI_RW_DDLCAL_CFG_0				0x1c40U
+#define PPI_RW_DDLCAL_CFG_1				0x1c42U
+#define PPI_RW_DDLCAL_CFG_2				0x1c44U
+#define PPI_RW_DDLCAL_CFG_3				0x1c46U
+#define PPI_RW_DDLCAL_CFG_4				0x1c48U
+#define PPI_RW_DDLCAL_CFG_5				0x1c4aU
+#define PPI_RW_DDLCAL_CFG_6				0x1c4cU
+#define PPI_RW_DDLCAL_CFG_7				0x1c4eU
+#define PPI_R_DDLCAL_DEBUG_0				0x1c50U
+#define PPI_R_DDLCAL_DEBUG_1				0x1c52U
+#define PPI_RW_PARITY_TEST				0x1c60U
+#define PPI_RW_STARTUP_OVR_0				0x1c62U
+#define PPI_RW_STARTUP_STATE_OVR_1			0x1c64U
+#define PPI_RW_DTB_SELECTOR				0x1c66U
+#define PPI_RW_DPHY_CLK_SPARE				0x1c6aU
+#define PPI_RW_COMMON_CFG				0x1c6cU
+#define PPI_RW_TERMCAL_CFG_0				0x1c80U
+#define PPI_R_TERMCAL_DEBUG_0				0x1c82U
+#define PPI_RW_TERMCAL_CTRL_0				0x1c84U
+#define PPI_RW_OFFSETCAL_CFG_0				0x1ca0U
+#define PPI_R_OFFSETCAL_DEBUG_LANE0			0x1ca2U
+#define PPI_R_OFFSETCAL_DEBUG_LANE1			0x1ca4U
+#define PPI_R_OFFSETCAL_DEBUG_LANE2			0x1ca6U
+#define PPI_R_OFFSETCAL_DEBUG_LANE3			0x1ca8U
+#define PPI_R_OFFSETCAL_DEBUG_LANE4			0x1caaU
+#define PPI_RW_HSDCOCAL_CFG_O				0x1d00U
+#define PPI_RW_HSDCOCAL_CFG_1				0x1d02U
+#define PPI_RW_HSDCOCAL_CFG_2				0x1d04U
+#define PPI_RW_HSDCOCAL_CFG_3				0x1d06U
+#define PPI_RW_HSDCOCAL_CFG_4				0x1d08U
+#define PPI_RW_HSDCOCAL_CFG_5				0x1d0aU
+#define PPI_RW_HSDCOCAL_CFG_6				0x1d0cU
+#define PPI_RW_HSDCOCAL_CFG_7				0x1d0eU
+#define PPI_RW_HSDCOCAL_CFG_8				0x1d10U
+#define PPI_R_HSDCOCAL_DEBUG_RB				0x1d12U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_0	0x2000U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_1	0x2002U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_2	0x2004U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_3	0x2006U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_4	0x2008U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_5	0x200aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_6	0x200cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_7	0x200eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_8	0x2010U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_9	0x2012U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_10	0x2014U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_11	0x2016U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_12	0x2018U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_13	0x201aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_14	0x201cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_15	0x201eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_0	0x2020U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_1	0x2022U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_2	0x2024U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_3	0x2026U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_4	0x2028U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_5	0x202aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_6	0x202cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_7	0x202eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_8	0x2030U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_9	0x2032U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_10	0x2034U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_11	0x2036U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_12	0x2038U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_13	0x203aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_14	0x203cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_15	0x203eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_0		0x2040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_1		0x2042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2		0x2044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_3		0x2046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_4		0x2048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_5		0x204aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_6		0x204cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7		0x204eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8		0x2050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9		0x2052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_10		0x2054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_11		0x2056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12		0x2058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13		0x205aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_14		0x205cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15		0x205eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_0		0x2060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_1		0x2062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_2		0x2064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_3		0x2066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_4		0x2068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_5		0x206aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_6		0x206cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_7		0x206eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_8		0x2070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_9		0x2072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_10		0x2074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_11		0x2076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_12		0x2078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_13		0x207aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_14		0x207cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_15		0x207eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_0		0x2080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_1		0x2082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_2		0x2084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_3		0x2086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_4		0x2088U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_0	0x20a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_1	0x20a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_2	0x20a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_3	0x20a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_4	0x20a8U
+#define CORE_DIG_RW_TRIO0_0				0x2100U
+#define CORE_DIG_RW_TRIO0_1				0x2102U
+#define CORE_DIG_RW_TRIO0_2				0x2104U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_0	0x2400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_1	0x2402U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_2	0x2404U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_3	0x2406U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_4	0x2408U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_5	0x240aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_6	0x240cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_7	0x240eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_8	0x2410U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_9	0x2412U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_10	0x2414U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_11	0x2416U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_12	0x2418U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_13	0x241aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_14	0x241cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_15	0x241eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_0	0x2420U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_1	0x2422U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_2	0x2424U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_3	0x2426U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_4	0x2428U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_5	0x242aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_6	0x242cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_7	0x242eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_8	0x2430U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_9	0x2432U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_10	0x2434U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_11	0x2436U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_12	0x2438U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_13	0x243aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_14	0x243cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_15	0x243eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_0		0x2440U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_1		0x2442U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2		0x2444U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_3		0x2446U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_4		0x2448U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_5		0x244aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_6		0x244cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_7		0x244eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_8		0x2450U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9		0x2452U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_10		0x2454U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_11		0x2456U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_12		0x2458U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_13		0x245aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_14		0x245cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15		0x245eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_0		0x2460U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_1		0x2462U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_2		0x2464U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_3		0x2466U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_4		0x2468U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_5		0x246aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_6		0x246cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_7		0x246eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_8		0x2470U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_9		0x2472U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_10		0x2474U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_11		0x2476U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_12		0x2478U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_13		0x247aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_14		0x247cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_15		0x247eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_0		0x2480U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_1		0x2482U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_2		0x2484U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_3		0x2486U
+#define CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_4		0x2488U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_0	0x24a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_1	0x24a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_2	0x24a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_3	0x24a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_4	0x24a8U
+#define CORE_DIG_RW_TRIO1_0				0x2500U
+#define CORE_DIG_RW_TRIO1_1				0x2502U
+#define CORE_DIG_RW_TRIO1_2				0x2504U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_0	0x2800U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_1	0x2802U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_2	0x2804U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_3	0x2806U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_4	0x2808U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_5	0x280aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_6	0x280cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_7	0x280eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_8	0x2810U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_9	0x2812U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_10	0x2814U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_11	0x2816U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_12	0x2818U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_13	0x281aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_14	0x281cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_15	0x281eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_0	0x2820U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_1	0x2822U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_2	0x2824U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_3	0x2826U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_4	0x2828U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_5	0x282aU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_6	0x282cU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_7	0x282eU
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_8	0x2830U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_9	0x2832U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_10	0x2834U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_11	0x2836U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_12	0x2838U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_13	0x283aU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_14	0x283cU
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_15	0x283eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_0		0x2840U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_1		0x2842U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2		0x2844U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_3		0x2846U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_4		0x2848U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_5		0x284aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_6		0x284cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_7		0x284eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_8		0x2850U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9		0x2852U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_10		0x2854U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_11		0x2856U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_12		0x2858U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_13		0x285aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_14		0x285cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15		0x285eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_0		0x2860U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_1		0x2862U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_2		0x2864U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_3		0x2866U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_4		0x2868U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_5		0x286aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_6		0x286cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_7		0x286eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_8		0x2870U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_9		0x2872U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_10		0x2874U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_11		0x2876U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_12		0x2878U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_13		0x287aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_14		0x287cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_15		0x287eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_0		0x2880U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_1		0x2882U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_2		0x2884U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_3		0x2886U
+#define CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_4		0x2888U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_0	0x28a0U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_1	0x28a2U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_2	0x28a4U
+#define CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_3	0x28a6U
+#define CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_4	0x28a8U
+#define CORE_DIG_RW_TRIO2_0				0x2900U
+#define CORE_DIG_RW_TRIO2_1				0x2902U
+#define CORE_DIG_RW_TRIO2_2				0x2904U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_0	0x2c00U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_1	0x2c02U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_2	0x2c04U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_3	0x2c06U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_4	0x2c08U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_5	0x2c0aU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_6	0x2c0cU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_7	0x2c0eU
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_8	0x2c10U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_9	0x2c12U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_10	0x2c14U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_11	0x2c16U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_12	0x2c18U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_13	0x2c1aU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_14	0x2c1cU
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_15	0x2c1eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_0		0x2c40U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_1		0x2c42U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2		0x2c44U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_3		0x2c46U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_4		0x2c48U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_5		0x2c4aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_6		0x2c4cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_7		0x2c4eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_8		0x2c50U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9		0x2c52U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_10		0x2c54U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_11		0x2c56U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_12		0x2c58U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_13		0x2c5aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_14		0x2c5cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15		0x2c5eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_0		0x2c60U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_1		0x2c62U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_2		0x2c64U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_3		0x2c66U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_4		0x2c68U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_5		0x2c6aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_6		0x2c6cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_7		0x2c6eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_8		0x2c70U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_9		0x2c72U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_10		0x2c74U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_11		0x2c76U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_12		0x2c78U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_13		0x2c7aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_14		0x2c7cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_15		0x2c7eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_0		0x2c80U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_1		0x2c82U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_2		0x2c84U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_3		0x2c86U
+#define CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_4		0x2c88U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_0		0x3040U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_1		0x3042U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2		0x3044U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_3		0x3046U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_4		0x3048U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_5		0x304aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_6		0x304cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_7		0x304eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_8		0x3050U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9		0x3052U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_10		0x3054U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_11		0x3056U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_12		0x3058U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_13		0x305aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_14		0x305cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15		0x305eU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_0		0x3060U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_1		0x3062U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_2		0x3064U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_3		0x3066U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_4		0x3068U
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_5		0x306aU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_6		0x306cU
+#define CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_7		0x306eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_8		0x3070U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_9		0x3072U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_10		0x3074U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_11		0x3076U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_12		0x3078U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_13		0x307aU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_14		0x307cU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_15		0x307eU
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_0		0x3080U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_1		0x3082U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_2		0x3084U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_3		0x3086U
+#define CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_4		0x3088U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_0		0x3400U
+#define CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_1		0x3402U
+#define CORE_DIG_IOCTRL_R_DPHY_PPI_CLK_OVR_0_2		0x3404U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_0		0x3800U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_1		0x3802U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_2		0x3804U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_3		0x3806U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_4		0x3808U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_5		0x380aU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_6		0x380cU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_7		0x380eU
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_8		0x3810U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_9		0x3812U
+#define CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_10		0x3814U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_11		0x3816U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_12		0x3818U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_13		0x381aU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_14		0x381cU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_15		0x381eU
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_0		0x3820U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_1		0x3822U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_2		0x3824U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_3		0x3826U
+#define CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_4		0x3828U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0		0x3840U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1		0x3842U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_2		0x3844U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3		0x3846U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_4		0x3848U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5		0x384aU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6		0x384cU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7		0x384eU
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8		0x3850U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_9		0x3852U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_10		0x3854U
+#define CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_11		0x3856U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_12		0x3858U
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_13		0x385aU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_14		0x385cU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15		0x385eU
+#define CORE_DIG_IOCTRL_R_AFE_CB_CTRL_3_0		0x3860U
+#define CORE_DIG_RW_COMMON_0				0x3880U
+#define CORE_DIG_RW_COMMON_1				0x3882U
+#define CORE_DIG_RW_COMMON_2				0x3884U
+#define CORE_DIG_RW_COMMON_3				0x3886U
+#define CORE_DIG_RW_COMMON_4				0x3888U
+#define CORE_DIG_RW_COMMON_5				0x388aU
+#define CORE_DIG_RW_COMMON_6				0x388cU
+#define CORE_DIG_RW_COMMON_7				0x388eU
+#define CORE_DIG_RW_COMMON_8				0x3890U
+#define CORE_DIG_RW_COMMON_9				0x3892U
+#define CORE_DIG_RW_COMMON_10				0x3894U
+#define CORE_DIG_RW_COMMON_11				0x3896U
+#define CORE_DIG_RW_COMMON_12				0x3898U
+#define CORE_DIG_RW_COMMON_13				0x389aU
+#define CORE_DIG_RW_COMMON_14				0x389cU
+#define CORE_DIG_RW_COMMON_15				0x389eU
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0		0x39e0U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_1		0x39e2U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2		0x39e4U
+#define CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_3		0x39e6U
+#define CORE_DIG_COMMON_RW_DESKEW_FINE_MEM		0x3fe0U
+#define CORE_DIG_COMMON_R_DESKEW_FINE_MEM		0x3fe2U
+#define PPI_RW_DPHY_LANE0_LBERT_0			0x4000U
+#define PPI_RW_DPHY_LANE0_LBERT_1			0x4002U
+#define PPI_R_DPHY_LANE0_LBERT_0			0x4004U
+#define PPI_R_DPHY_LANE0_LBERT_1			0x4006U
+#define PPI_RW_DPHY_LANE0_SPARE				0x4008U
+#define PPI_RW_DPHY_LANE1_LBERT_0			0x4400U
+#define PPI_RW_DPHY_LANE1_LBERT_1			0x4402U
+#define PPI_R_DPHY_LANE1_LBERT_0			0x4404U
+#define PPI_R_DPHY_LANE1_LBERT_1			0x4406U
+#define PPI_RW_DPHY_LANE1_SPARE				0x4408U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 547

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define PPI_RW_DPHY_LANE2_LBERT_0			0x4800U
+#define PPI_RW_DPHY_LANE2_LBERT_1			0x4802U
+#define PPI_R_DPHY_LANE2_LBERT_0			0x4804U
+#define PPI_R_DPHY_LANE2_LBERT_1			0x4806U
+#define PPI_RW_DPHY_LANE2_SPARE				0x4808U
+#define PPI_RW_DPHY_LANE3_LBERT_0			0x4c00U
+#define PPI_RW_DPHY_LANE3_LBERT_1			0x4c02U
+#define PPI_R_DPHY_LANE3_LBERT_0			0x4c04U
+#define PPI_R_DPHY_LANE3_LBERT_1			0x4c06U
+#define PPI_RW_DPHY_LANE3_SPARE				0x4c08U

How about using base address for lanes and then using offsets? I presume all lanes use same offset?

Quoted 5 lines
Quoted 2 lines

Same for CLANE definitions below.

I copied these defines directly from the SNPS spec register list, it is useful to query and compare with the spec.

Would you be using these still as-is? I don't think so.

Quoted 519 lines
Quoted 510 lines
Quoted 296 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +294 -0
+#define CORE_DIG_DLANE_0_RW_CFG_0			0x6000U
+#define CORE_DIG_DLANE_0_RW_CFG_1			0x6002U
+#define CORE_DIG_DLANE_0_RW_CFG_2			0x6004U
+#define CORE_DIG_DLANE_0_RW_LP_0			0x6080U
+#define CORE_DIG_DLANE_0_RW_LP_1			0x6082U
+#define CORE_DIG_DLANE_0_RW_LP_2			0x6084U
+#define CORE_DIG_DLANE_0_R_LP_0				0x60a0U
+#define CORE_DIG_DLANE_0_R_LP_1				0x60a2U
+#define CORE_DIG_DLANE_0_R_HS_TX_0			0x60e0U
+#define CORE_DIG_DLANE_0_RW_HS_RX_0			0x6100U
+#define CORE_DIG_DLANE_0_RW_HS_RX_1			0x6102U
+#define CORE_DIG_DLANE_0_RW_HS_RX_2			0x6104U
+#define CORE_DIG_DLANE_0_RW_HS_RX_3			0x6106U
+#define CORE_DIG_DLANE_0_RW_HS_RX_4			0x6108U
+#define CORE_DIG_DLANE_0_RW_HS_RX_5			0x610aU
+#define CORE_DIG_DLANE_0_RW_HS_RX_6			0x610cU
+#define CORE_DIG_DLANE_0_RW_HS_RX_7			0x610eU
+#define CORE_DIG_DLANE_0_RW_HS_RX_8			0x6110U
+#define CORE_DIG_DLANE_0_RW_HS_RX_9			0x6112U
+#define CORE_DIG_DLANE_0_R_HS_RX_0			0x6120U
+#define CORE_DIG_DLANE_0_R_HS_RX_1			0x6122U
+#define CORE_DIG_DLANE_0_R_HS_RX_2			0x6124U
+#define CORE_DIG_DLANE_0_R_HS_RX_3			0x6126U
+#define CORE_DIG_DLANE_0_R_HS_RX_4			0x6128U
+#define CORE_DIG_DLANE_0_RW_HS_TX_0			0x6200U
+#define CORE_DIG_DLANE_0_RW_HS_TX_1			0x6202U
+#define CORE_DIG_DLANE_0_RW_HS_TX_2			0x6204U
+#define CORE_DIG_DLANE_0_RW_HS_TX_3			0x6206U
+#define CORE_DIG_DLANE_0_RW_HS_TX_4			0x6208U
+#define CORE_DIG_DLANE_0_RW_HS_TX_5			0x620aU
+#define CORE_DIG_DLANE_0_RW_HS_TX_6			0x620cU
+#define CORE_DIG_DLANE_0_RW_HS_TX_7			0x620eU
+#define CORE_DIG_DLANE_0_RW_HS_TX_8			0x6210U
+#define CORE_DIG_DLANE_0_RW_HS_TX_9			0x6212U
+#define CORE_DIG_DLANE_0_RW_HS_TX_10			0x6214U
+#define CORE_DIG_DLANE_0_RW_HS_TX_11			0x6216U
+#define CORE_DIG_DLANE_0_RW_HS_TX_12			0x6218U
+#define CORE_DIG_DLANE_1_RW_CFG_0			0x6400U
+#define CORE_DIG_DLANE_1_RW_CFG_1			0x6402U
+#define CORE_DIG_DLANE_1_RW_CFG_2			0x6404U
+#define CORE_DIG_DLANE_1_RW_LP_0			0x6480U
+#define CORE_DIG_DLANE_1_RW_LP_1			0x6482U
+#define CORE_DIG_DLANE_1_RW_LP_2			0x6484U
+#define CORE_DIG_DLANE_1_R_LP_0				0x64a0U
+#define CORE_DIG_DLANE_1_R_LP_1				0x64a2U
+#define CORE_DIG_DLANE_1_R_HS_TX_0			0x64e0U
+#define CORE_DIG_DLANE_1_RW_HS_RX_0			0x6500U
+#define CORE_DIG_DLANE_1_RW_HS_RX_1			0x6502U
+#define CORE_DIG_DLANE_1_RW_HS_RX_2			0x6504U
+#define CORE_DIG_DLANE_1_RW_HS_RX_3			0x6506U
+#define CORE_DIG_DLANE_1_RW_HS_RX_4			0x6508U
+#define CORE_DIG_DLANE_1_RW_HS_RX_5			0x650aU
+#define CORE_DIG_DLANE_1_RW_HS_RX_6			0x650cU
+#define CORE_DIG_DLANE_1_RW_HS_RX_7			0x650eU
+#define CORE_DIG_DLANE_1_RW_HS_RX_8			0x6510U
+#define CORE_DIG_DLANE_1_RW_HS_RX_9			0x6512U
+#define CORE_DIG_DLANE_1_R_HS_RX_0			0x6520U
+#define CORE_DIG_DLANE_1_R_HS_RX_1			0x6522U
+#define CORE_DIG_DLANE_1_R_HS_RX_2			0x6524U
+#define CORE_DIG_DLANE_1_R_HS_RX_3			0x6526U
+#define CORE_DIG_DLANE_1_R_HS_RX_4			0x6528U
+#define CORE_DIG_DLANE_1_RW_HS_TX_0			0x6600U
+#define CORE_DIG_DLANE_1_RW_HS_TX_1			0x6602U
+#define CORE_DIG_DLANE_1_RW_HS_TX_2			0x6604U
+#define CORE_DIG_DLANE_1_RW_HS_TX_3			0x6606U
+#define CORE_DIG_DLANE_1_RW_HS_TX_4			0x6608U
+#define CORE_DIG_DLANE_1_RW_HS_TX_5			0x660aU
+#define CORE_DIG_DLANE_1_RW_HS_TX_6			0x660cU
+#define CORE_DIG_DLANE_1_RW_HS_TX_7			0x660eU
+#define CORE_DIG_DLANE_1_RW_HS_TX_8			0x6610U
+#define CORE_DIG_DLANE_1_RW_HS_TX_9			0x6612U
+#define CORE_DIG_DLANE_1_RW_HS_TX_10			0x6614U
+#define CORE_DIG_DLANE_1_RW_HS_TX_11			0x6616U
+#define CORE_DIG_DLANE_1_RW_HS_TX_12			0x6618U
+#define CORE_DIG_DLANE_2_RW_CFG_0			0x6800U
+#define CORE_DIG_DLANE_2_RW_CFG_1			0x6802U
+#define CORE_DIG_DLANE_2_RW_CFG_2			0x6804U
+#define CORE_DIG_DLANE_2_RW_LP_0			0x6880U
+#define CORE_DIG_DLANE_2_RW_LP_1			0x6882U
+#define CORE_DIG_DLANE_2_RW_LP_2			0x6884U
+#define CORE_DIG_DLANE_2_R_LP_0				0x68a0U
+#define CORE_DIG_DLANE_2_R_LP_1				0x68a2U
+#define CORE_DIG_DLANE_2_R_HS_TX_0			0x68e0U
+#define CORE_DIG_DLANE_2_RW_HS_RX_0			0x6900U
+#define CORE_DIG_DLANE_2_RW_HS_RX_1			0x6902U
+#define CORE_DIG_DLANE_2_RW_HS_RX_2			0x6904U
+#define CORE_DIG_DLANE_2_RW_HS_RX_3			0x6906U
+#define CORE_DIG_DLANE_2_RW_HS_RX_4			0x6908U
+#define CORE_DIG_DLANE_2_RW_HS_RX_5			0x690aU
+#define CORE_DIG_DLANE_2_RW_HS_RX_6			0x690cU
+#define CORE_DIG_DLANE_2_RW_HS_RX_7			0x690eU
+#define CORE_DIG_DLANE_2_RW_HS_RX_8			0x6910U
+#define CORE_DIG_DLANE_2_RW_HS_RX_9			0x6912U
+#define CORE_DIG_DLANE_2_R_HS_RX_0			0x6920U
+#define CORE_DIG_DLANE_2_R_HS_RX_1			0x6922U
+#define CORE_DIG_DLANE_2_R_HS_RX_2			0x6924U
+#define CORE_DIG_DLANE_2_R_HS_RX_3			0x6926U
+#define CORE_DIG_DLANE_2_R_HS_RX_4			0x6928U
+#define CORE_DIG_DLANE_2_RW_HS_TX_0			0x6a00U
+#define CORE_DIG_DLANE_2_RW_HS_TX_1			0x6a02U
+#define CORE_DIG_DLANE_2_RW_HS_TX_2			0x6a04U
+#define CORE_DIG_DLANE_2_RW_HS_TX_3			0x6a06U
+#define CORE_DIG_DLANE_2_RW_HS_TX_4			0x6a08U
+#define CORE_DIG_DLANE_2_RW_HS_TX_5			0x6a0aU
+#define CORE_DIG_DLANE_2_RW_HS_TX_6			0x6a0cU
+#define CORE_DIG_DLANE_2_RW_HS_TX_7			0x6a0eU
+#define CORE_DIG_DLANE_2_RW_HS_TX_8			0x6a10U
+#define CORE_DIG_DLANE_2_RW_HS_TX_9			0x6a12U
+#define CORE_DIG_DLANE_2_RW_HS_TX_10			0x6a14U
+#define CORE_DIG_DLANE_2_RW_HS_TX_11			0x6a16U
+#define CORE_DIG_DLANE_2_RW_HS_TX_12			0x6a18U
+#define CORE_DIG_DLANE_3_RW_CFG_0			0x6c00U
+#define CORE_DIG_DLANE_3_RW_CFG_1			0x6c02U
+#define CORE_DIG_DLANE_3_RW_CFG_2			0x6c04U
+#define CORE_DIG_DLANE_3_RW_LP_0			0x6c80U
+#define CORE_DIG_DLANE_3_RW_LP_1			0x6c82U
+#define CORE_DIG_DLANE_3_RW_LP_2			0x6c84U
+#define CORE_DIG_DLANE_3_R_LP_0				0x6ca0U
+#define CORE_DIG_DLANE_3_R_LP_1				0x6ca2U
+#define CORE_DIG_DLANE_3_R_HS_TX_0			0x6ce0U
+#define CORE_DIG_DLANE_3_RW_HS_RX_0			0x6d00U
+#define CORE_DIG_DLANE_3_RW_HS_RX_1			0x6d02U
+#define CORE_DIG_DLANE_3_RW_HS_RX_2			0x6d04U
+#define CORE_DIG_DLANE_3_RW_HS_RX_3			0x6d06U
+#define CORE_DIG_DLANE_3_RW_HS_RX_4			0x6d08U
+#define CORE_DIG_DLANE_3_RW_HS_RX_5			0x6d0aU
+#define CORE_DIG_DLANE_3_RW_HS_RX_6			0x6d0cU
+#define CORE_DIG_DLANE_3_RW_HS_RX_7			0x6d0eU
+#define CORE_DIG_DLANE_3_RW_HS_RX_8			0x6d10U
+#define CORE_DIG_DLANE_3_RW_HS_RX_9			0x6d12U
+#define CORE_DIG_DLANE_3_R_HS_RX_0			0x6d20U
+#define CORE_DIG_DLANE_3_R_HS_RX_1			0x6d22U
+#define CORE_DIG_DLANE_3_R_HS_RX_2			0x6d24U
+#define CORE_DIG_DLANE_3_R_HS_RX_3			0x6d26U
+#define CORE_DIG_DLANE_3_R_HS_RX_4			0x6d28U
+#define CORE_DIG_DLANE_3_RW_HS_TX_0			0x6e00U
+#define CORE_DIG_DLANE_3_RW_HS_TX_1			0x6e02U
+#define CORE_DIG_DLANE_3_RW_HS_TX_2			0x6e04U
+#define CORE_DIG_DLANE_3_RW_HS_TX_3			0x6e06U
+#define CORE_DIG_DLANE_3_RW_HS_TX_4			0x6e08U
+#define CORE_DIG_DLANE_3_RW_HS_TX_5			0x6e0aU
+#define CORE_DIG_DLANE_3_RW_HS_TX_6			0x6e0cU
+#define CORE_DIG_DLANE_3_RW_HS_TX_7			0x6e0eU
+#define CORE_DIG_DLANE_3_RW_HS_TX_8			0x6e10U
+#define CORE_DIG_DLANE_3_RW_HS_TX_9			0x6e12U
+#define CORE_DIG_DLANE_3_RW_HS_TX_10			0x6e14U
+#define CORE_DIG_DLANE_3_RW_HS_TX_11			0x6e16U
+#define CORE_DIG_DLANE_3_RW_HS_TX_12			0x6e18U
+#define CORE_DIG_DLANE_CLK_RW_CFG_0			0x7000U
+#define CORE_DIG_DLANE_CLK_RW_CFG_1			0x7002U
+#define CORE_DIG_DLANE_CLK_RW_CFG_2			0x7004U
+#define CORE_DIG_DLANE_CLK_RW_LP_0			0x7080U
+#define CORE_DIG_DLANE_CLK_RW_LP_1			0x7082U
+#define CORE_DIG_DLANE_CLK_RW_LP_2			0x7084U
+#define CORE_DIG_DLANE_CLK_R_LP_0			0x70a0U
+#define CORE_DIG_DLANE_CLK_R_LP_1			0x70a2U
+#define CORE_DIG_DLANE_CLK_R_HS_TX_0			0x70e0U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_0			0x7100U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_1			0x7102U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_2			0x7104U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_3			0x7106U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_4			0x7108U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_5			0x710aU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_6			0x710cU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_7			0x710eU
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_8			0x7110U
+#define CORE_DIG_DLANE_CLK_RW_HS_RX_9			0x7112U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_0			0x7120U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_1			0x7122U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_2			0x7124U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_3			0x7126U
+#define CORE_DIG_DLANE_CLK_R_HS_RX_4			0x7128U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_0			0x7200U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_1			0x7202U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_2			0x7204U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_3			0x7206U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_4			0x7208U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_5			0x720aU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_6			0x720cU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_7			0x720eU
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_8			0x7210U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_9			0x7212U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_10			0x7214U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_11			0x7216U
+#define CORE_DIG_DLANE_CLK_RW_HS_TX_12			0x7218U
+#define PPI_RW_CPHY_TRIO0_LBERT_0			0x8000U
+#define PPI_RW_CPHY_TRIO0_LBERT_1			0x8002U
+#define PPI_R_CPHY_TRIO0_LBERT_0			0x8004U
+#define PPI_R_CPHY_TRIO0_LBERT_1			0x8006U
+#define PPI_RW_CPHY_TRIO0_SPARE				0x8008U
+#define PPI_RW_CPHY_TRIO1_LBERT_0			0x8400U
+#define PPI_RW_CPHY_TRIO1_LBERT_1			0x8402U
+#define PPI_R_CPHY_TRIO1_LBERT_0			0x8404U
+#define PPI_R_CPHY_TRIO1_LBERT_1			0x8406U
+#define PPI_RW_CPHY_TRIO1_SPARE				0x8408U
+#define PPI_RW_CPHY_TRIO2_LBERT_0			0x8800U
+#define PPI_RW_CPHY_TRIO2_LBERT_1			0x8802U
+#define PPI_R_CPHY_TRIO2_LBERT_0			0x8804U
+#define PPI_R_CPHY_TRIO2_LBERT_1			0x8806U
+#define PPI_RW_CPHY_TRIO2_SPARE				0x8808U
+#define CORE_DIG_CLANE_0_RW_CFG_0			0xa000U
+#define CORE_DIG_CLANE_0_RW_CFG_2			0xa004U
+#define CORE_DIG_CLANE_0_RW_LP_0			0xa080U
+#define CORE_DIG_CLANE_0_RW_LP_1			0xa082U
+#define CORE_DIG_CLANE_0_RW_LP_2			0xa084U
+#define CORE_DIG_CLANE_0_R_LP_0				0xa0a0U
+#define CORE_DIG_CLANE_0_R_LP_1				0xa0a2U
+#define CORE_DIG_CLANE_0_RW_HS_RX_0			0xa100U
+#define CORE_DIG_CLANE_0_RW_HS_RX_1			0xa102U
+#define CORE_DIG_CLANE_0_RW_HS_RX_2			0xa104U
+#define CORE_DIG_CLANE_0_RW_HS_RX_3			0xa106U
+#define CORE_DIG_CLANE_0_RW_HS_RX_4			0xa108U
+#define CORE_DIG_CLANE_0_RW_HS_RX_5			0xa10aU
+#define CORE_DIG_CLANE_0_RW_HS_RX_6			0xa10cU
+#define CORE_DIG_CLANE_0_R_RX_0				0xa120U
+#define CORE_DIG_CLANE_0_R_RX_1				0xa122U
+#define CORE_DIG_CLANE_0_R_TX_0				0xa124U
+#define CORE_DIG_CLANE_0_R_RX_2				0xa126U
+#define CORE_DIG_CLANE_0_R_RX_3				0xa128U
+#define CORE_DIG_CLANE_0_RW_HS_TX_0			0xa200U
+#define CORE_DIG_CLANE_0_RW_HS_TX_1			0xa202U
+#define CORE_DIG_CLANE_0_RW_HS_TX_2			0xa204U
+#define CORE_DIG_CLANE_0_RW_HS_TX_3			0xa206U
+#define CORE_DIG_CLANE_0_RW_HS_TX_4			0xa208U
+#define CORE_DIG_CLANE_0_RW_HS_TX_5			0xa20aU
+#define CORE_DIG_CLANE_0_RW_HS_TX_6			0xa20cU
+#define CORE_DIG_CLANE_0_RW_HS_TX_7			0xa20eU
+#define CORE_DIG_CLANE_0_RW_HS_TX_8			0xa210U
+#define CORE_DIG_CLANE_0_RW_HS_TX_9			0xa212U
+#define CORE_DIG_CLANE_0_RW_HS_TX_10			0xa214U
+#define CORE_DIG_CLANE_0_RW_HS_TX_11			0xa216U
+#define CORE_DIG_CLANE_0_RW_HS_TX_12			0xa218U
+#define CORE_DIG_CLANE_0_RW_HS_TX_13			0xa21aU
+#define CORE_DIG_CLANE_1_RW_CFG_0			0xa400U
+#define CORE_DIG_CLANE_1_RW_CFG_2			0xa404U
+#define CORE_DIG_CLANE_1_RW_LP_0			0xa480U
+#define CORE_DIG_CLANE_1_RW_LP_1			0xa482U
+#define CORE_DIG_CLANE_1_RW_LP_2			0xa484U
+#define CORE_DIG_CLANE_1_R_LP_0				0xa4a0U
+#define CORE_DIG_CLANE_1_R_LP_1				0xa4a2U
+#define CORE_DIG_CLANE_1_RW_HS_RX_0			0xa500U
+#define CORE_DIG_CLANE_1_RW_HS_RX_1			0xa502U
+#define CORE_DIG_CLANE_1_RW_HS_RX_2			0xa504U
+#define CORE_DIG_CLANE_1_RW_HS_RX_3			0xa506U
+#define CORE_DIG_CLANE_1_RW_HS_RX_4			0xa508U
+#define CORE_DIG_CLANE_1_RW_HS_RX_5			0xa50aU
+#define CORE_DIG_CLANE_1_RW_HS_RX_6			0xa50cU
+#define CORE_DIG_CLANE_1_R_RX_0				0xa520U
+#define CORE_DIG_CLANE_1_R_RX_1				0xa522U
+#define CORE_DIG_CLANE_1_R_TX_0				0xa524U
+#define CORE_DIG_CLANE_1_R_RX_2				0xa526U
+#define CORE_DIG_CLANE_1_R_RX_3				0xa528U
+#define CORE_DIG_CLANE_1_RW_HS_TX_0			0xa600U
+#define CORE_DIG_CLANE_1_RW_HS_TX_1			0xa602U
+#define CORE_DIG_CLANE_1_RW_HS_TX_2			0xa604U
+#define CORE_DIG_CLANE_1_RW_HS_TX_3			0xa606U
+#define CORE_DIG_CLANE_1_RW_HS_TX_4			0xa608U
+#define CORE_DIG_CLANE_1_RW_HS_TX_5			0xa60aU
+#define CORE_DIG_CLANE_1_RW_HS_TX_6			0xa60cU
+#define CORE_DIG_CLANE_1_RW_HS_TX_7			0xa60eU
+#define CORE_DIG_CLANE_1_RW_HS_TX_8			0xa610U
+#define CORE_DIG_CLANE_1_RW_HS_TX_9			0xa612U
+#define CORE_DIG_CLANE_1_RW_HS_TX_10			0xa614U
+#define CORE_DIG_CLANE_1_RW_HS_TX_11			0xa616U
+#define CORE_DIG_CLANE_1_RW_HS_TX_12			0xa618U
+#define CORE_DIG_CLANE_1_RW_HS_TX_13			0xa61aU
+#define CORE_DIG_CLANE_2_RW_CFG_0			0xa800U
+#define CORE_DIG_CLANE_2_RW_CFG_2			0xa804U
+#define CORE_DIG_CLANE_2_RW_LP_0			0xa880U
+#define CORE_DIG_CLANE_2_RW_LP_1			0xa882U
+#define CORE_DIG_CLANE_2_RW_LP_2			0xa884U
+#define CORE_DIG_CLANE_2_R_LP_0				0xa8a0U
+#define CORE_DIG_CLANE_2_R_LP_1				0xa8a2U
+#define CORE_DIG_CLANE_2_RW_HS_RX_0			0xa900U
+#define CORE_DIG_CLANE_2_RW_HS_RX_1			0xa902U
+#define CORE_DIG_CLANE_2_RW_HS_RX_2			0xa904U
+#define CORE_DIG_CLANE_2_RW_HS_RX_3			0xa906U
+#define CORE_DIG_CLANE_2_RW_HS_RX_4			0xa908U
+#define CORE_DIG_CLANE_2_RW_HS_RX_5			0xa90aU
+#define CORE_DIG_CLANE_2_RW_HS_RX_6			0xa90cU
+#define CORE_DIG_CLANE_2_R_RX_0				0xa920U
+#define CORE_DIG_CLANE_2_R_RX_1				0xa922U
+#define CORE_DIG_CLANE_2_R_TX_0				0xa924U
+#define CORE_DIG_CLANE_2_R_RX_2				0xa926U
+#define CORE_DIG_CLANE_2_R_RX_3				0xa928U
+#define CORE_DIG_CLANE_2_RW_HS_TX_0			0xaa00U
+#define CORE_DIG_CLANE_2_RW_HS_TX_1			0xaa02U
+#define CORE_DIG_CLANE_2_RW_HS_TX_2			0xaa04U
+#define CORE_DIG_CLANE_2_RW_HS_TX_3			0xaa06U
+#define CORE_DIG_CLANE_2_RW_HS_TX_4			0xaa08U
+#define CORE_DIG_CLANE_2_RW_HS_TX_5			0xaa0aU
+#define CORE_DIG_CLANE_2_RW_HS_TX_6			0xaa0cU
+#define CORE_DIG_CLANE_2_RW_HS_TX_7			0xaa0eU
+#define CORE_DIG_CLANE_2_RW_HS_TX_8			0xaa10U

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 851

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+#define CORE_DIG_CLANE_2_RW_HS_TX_9			0xaa12U
+#define CORE_DIG_CLANE_2_RW_HS_TX_10			0xaa14U
+#define CORE_DIG_CLANE_2_RW_HS_TX_11			0xaa16U
+#define CORE_DIG_CLANE_2_RW_HS_TX_12			0xaa18U
+#define CORE_DIG_CLANE_2_RW_HS_TX_13			0xaa1aU
+
+/* dwc csi host controller registers */
+#define IS_IO_CSI2_HOST_BASE(i)			(IS_IO_BASE + 0x40000U + \
+						 0x2000U * (i))
+#define VERSION					0

I wonder if this HCI has a version? Perhaps a driver on its own would be nice, but that consideration can be left for later I think.

Quoted 200 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +200 -0
+#define N_LANES					0x4U
+#define CSI2_RESETN				0x8U
+#define INT_ST_MAIN				0xcU
+#define DATA_IDS_1				0x10U
+#define DATA_IDS_2				0x14U
+#define CDPHY_MODE				0x1cU
+#define DATA_IDS_VC_1				0x30U
+#define DATA_IDS_VC_2				0x34U
+#define PHY_SHUTDOWNZ				0x40U
+#define DPHY_RSTZ				0x44U
+#define PHY_RX					0x48U
+#define PHY_STOPSTATE				0x4cU
+#define PHY_TEST_CTRL0				0x50U
+#define PHY_TEST_CTRL1				0x54U
+#define PPI_PG_PATTERN_VRES			0x60U
+#define PPI_PG_PATTERN_HRES			0x64U
+#define PPI_PG_CONFIG				0x68U
+#define PPI_PG_ENABLE				0x6cU
+#define PPI_PG_STATUS				0x70U
+#define VC_EXTENSION				0xc8U
+#define PHY_CAL					0xccU
+#define INT_ST_PHY_FATAL			0xe0U
+#define INT_MSK_PHY_FATAL			0xe4U
+#define INT_FORCE_PHY_FATAL			0xe8U
+#define INT_ST_PKT_FATAL			0xf0U
+#define INT_MSK_PKT_FATAL			0xf4U
+#define INT_FORCE_PKT_FATAL			0xf8U
+#define INT_ST_PHY				0x110U
+#define INT_MSK_PHY				0x114U
+#define INT_FORCE_PHY				0x118U
+#define INT_ST_LINE				0x130U
+#define INT_MSK_LINE				0x134U
+#define INT_FORCE_LINE				0x138U
+#define INT_ST_BNDRY_FRAME_FATAL		0x280U
+#define INT_MSK_BNDRY_FRAME_FATAL		0x284U
+#define INT_FORCE_BNDRY_FRAME_FATAL		0x288U
+#define INT_ST_SEQ_FRAME_FATAL			0x290U
+#define INT_MSK_SEQ_FRAME_FATAL			0x294U
+#define INT_FORCE_SEQ_FRAME_FATAL		0x298U
+#define INT_ST_CRC_FRAME_FATAL			0x2a0U
+#define INT_MSK_CRC_FRAME_FATAL			0x2a4U
+#define INT_FORCE_CRC_FRAME_FATAL		0x2a8U
+#define INT_ST_PLD_CRC_FATAL			0x2b0U
+#define INT_MSK_PLD_CRC_FATAL			0x2b4U
+#define INT_FORCE_PLD_CRC_FATAL			0x2b8U
+#define INT_ST_DATA_ID				0x2c0U
+#define INT_MSK_DATA_ID				0x2c4U
+#define INT_FORCE_DATA_ID			0x2c8U
+#define INT_ST_ECC_CORRECTED			0x2d0U
+#define INT_MSK_ECC_CORRECTED			0x2d4U
+#define INT_FORCE_ECC_CORRECTED			0x2d8U
+#define SCRAMBLING				0x300U
+#define SCRAMBLING_SEED1			0x304U
+#define SCRAMBLING_SEED2			0x308U
+#define SCRAMBLING_SEED3			0x30cU
+#define SCRAMBLING_SEED4			0x310U
+#define SCRAMBLING				0x300U
+
+#define IS_IO_CSI2_ADPL_PORT_BASE(i)		(IS_IO_BASE + 0x40800U + \
+						 0x2000U * (i))
+#define CSI2_ADPL_INPUT_MODE			0
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN	0x4U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_ADDR	0x8U
+#define CSI2_ADPL_CSI_RX_ERR_IRQ_STATUS		0xcU
+#define CSI2_ADPL_IRQ_CTL_COMMON_STATUS		0xa4U
+#define CSI2_ADPL_IRQ_CTL_COMMON_CLEAR		0xa8U
+#define CSI2_ADPL_IRQ_CTL_COMMON_ENABLE		0xacU
+#define CSI2_ADPL_IRQ_CTL_FS_STATUS		0xbcU
+#define CSI2_ADPL_IRQ_CTL_FS_CLEAR		0xc0U
+#define CSI2_ADPL_IRQ_CTL_FS_ENABLE		0xc4U
+#define CSI2_ADPL_IRQ_CTL_FE_STATUS		0xc8U
+#define CSI2_ADPL_IRQ_CTL_FE_CLEAR		0xccU
+#define CSI2_ADPL_IRQ_CTL_FE_ENABLE		0xd0U
+
+/* software control the legacy csi irq */
+#define IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40c00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(i)	(IS_IO_BASE + 0x40d00U + \
+						 0x2000U * (i))
+#define IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE		(IS_IO_BASE + 0x49000U)
+#define IS_IO_CSI2_IRQ_CTRL_BASE		(IS_IO_BASE + 0x4e100)
+
+#define IRQ_CTL_EDGE				0
+#define IRQ_CTL_MASK				0x4U
+#define IRQ_CTL_STATUS				0x8U
+#define IRQ_CTL_CLEAR				0xcU
+#define IRQ_CTL_ENABLE				0x10U
+/* FE irq for PTL */
+#define IRQ1_CTL_MASK				0x14U
+#define IRQ1_CTL_STATUS				0x18U
+#define IRQ1_CTL_CLEAR				0x1cU
+#define IRQ1_CTL_ENABLE				0x20U
+
+/* software to set the clock gate to use the port or mgc */
+#define IS_IO_GPREGS_BASE			(IS_IO_BASE + 0x49200U)
+#define SRST_PORT_ARB				0
+#define SRST_MGC				0x4U
+#define SRST_WIDTH_CONV				0x8U
+#define SRST_CSI_IRQ				0xcU
+#define SRST_CSI_LEGACY_IRQ			0x10U
+#define CLK_EN_TXCLKESC				0x14U
+#define CLK_DIV_FACTOR_IS_CLK			0x18U
+#define CLK_DIV_FACTOR_APB_CLK			0x1cU
+#define CSI_PORT_CLK_GATE			0x20U
+#define CSI_PORTAB_AGGREGATION			0x24U
+#define MGC_CLK_GATE				0x2cU
+#define CG_CTRL_BITS				0x3cU
+#define SPARE_RW				0xf8U
+#define SPARE_RO				0xfcU
+
+#define IS_IO_CSI2_MPF_PORT_BASE(i)		(IS_IO_BASE + 0x53000U + \
+						 0x1000U * (i))
+#define MPF_16_IRQ_CNTRL_STATUS			0x238U
+#define MPF_16_IRQ_CNTRL_CLEAR			0x23cU
+#define MPF_16_IRQ_CNTRL_ENABLE			0x240U
+
+/* software config the phy */
+#define IS_IO_CSI2_GPREGS_BASE		(IS_IO_BASE + 0x53400U)
+#define IPU8_IS_IO_CSI2_GPREGS_BASE	(IS_IO_BASE + 0x40e00U)
+#define CSI_ADAPT_LAYER_SRST		0
+#define MPF_SRST_RST			0x4U
+#define CSI_ERR_IRQ_CTRL_SRST		0x8U
+#define CSI_SYNC_RC_SRST		0xcU
+#define CSI_CG_CTRL_BITS		0x10U
+#define SOC_CSI2HOST_SELECT		0x14U
+#define PHY_RESET			0x18U
+#define PHY_SHUTDOWN			0x1cU
+#define PHY_MODE			0x20U
+#define PHY_READY			0x24U
+#define PHY_CLK_LANE_FORCE_CONTROL	0x28U
+#define PHY_CLK_LANE_CONTROL		0x2cU
+#define PHY_CLK_LANE_STATUS		0x30U
+#define PHY_LANE_RX_ESC_REQ		0x34U
+#define PHY_LANE_RX_ESC_DATA		0x38U
+#define PHY_LANE_TURNDISABLE		0x3cU
+#define PHY_LANE_DIRECTION		0x40U
+#define PHY_LANE_FORCE_CONTROL		0x44U
+#define PHY_LANE_CONTROL_EN		0x48U
+#define PHY_LANE_CONTROL_DATAWIDTH	0x4cU
+#define PHY_LANE_STATUS			0x50U
+#define PHY_LANE_ERR			0x54U
+#define PHY_LANE_RXALP			0x58U
+#define PHY_LANE_RXALP_NIBBLE		0x5cU
+#define PHY_PARITY_ERROR		0x60U
+#define PHY_DEBUG_REGS_CLK_GATE_EN	0x64U
+#define SPARE_RW			0xf8U
+#define SPARE_RO			0xfcU
+
+/* software not touch */
+#define PORT_ARB_BASE				(IS_IO_BASE + 0x4e000)
+#define PORT_ARB_IRQ_CTL_STATUS			0x4U
+#define PORT_ARB_IRQ_CTL_CLEAR			0x8U
+#define PORT_ARB_IRQ_CTL_ENABLE			0xcU
+
+#define MGC_PPC					4U
+#define MGC_DTYPE_RAW(i)			(((i) - 8) / 2)
+#define IS_IO_MGC_BASE				(IS_IO_BASE + 0x48000U)
+#define MGC_KICK				0
+#define MGC_ASYNC_STOP				0x4U
+#define MGC_PORT_OFFSET				0x100U
+#define MGC_CSI_PORT_MAP(i)			(0x8 + (i) * 0x4)
+#define MGC_MG_PORT(i)				(IS_IO_MGC_BASE +	\
+						 (i) * MGC_PORT_OFFSET)
+/* per mgc instance */
+#define MGC_MG_CSI_ADAPT_LAYER_TYPE		0x28U
+#define MGC_MG_MODE				0x2cU
+#define MGC_MG_INIT_COUNTER			0x30U
+#define MGC_MG_MIPI_VC				0x34U
+#define MGC_MG_MIPI_DTYPES			0x38U
+#define MGC_MG_MULTI_DTYPES_MODE		0x3cU
+#define MGC_MG_NOF_FRAMES			0x40U
+#define MGC_MG_FRAME_DIM			0x44U
+#define MGC_MG_HBLANK				0x48U
+#define MGC_MG_VBLANK				0x4cU
+#define MGC_MG_TPG_MODE				0x50U
+#define MGC_MG_TPG_R0				0x54U
+#define MGC_MG_TPG_G0				0x58U
+#define MGC_MG_TPG_B0				0x5cU
+#define MGC_MG_TPG_R1				0x60U
+#define MGC_MG_TPG_G1				0x64U
+#define MGC_MG_TPG_B1				0x68U
+#define MGC_MG_TPG_FACTORS			0x6cU
+#define MGC_MG_TPG_MASKS			0x70U
+#define MGC_MG_TPG_XY_MASK			0x74U
+#define MGC_MG_TPG_TILE_DIM			0x78U
+#define MGC_MG_PRBS_LFSR_INIT_0			0x7cU
+#define MGC_MG_PRBS_LFSR_INIT_1			0x80U
+#define MGC_MG_SYNC_STOP_POINT			0x84U
+#define MGC_MG_SYNC_STOP_POINT_LOC		0x88U
+#define MGC_MG_ERR_INJECT			0x8cU
+#define MGC_MG_ERR_LOCATION			0x90U
+#define MGC_MG_DTO_SPEED_CTRL_EN		0x94U
+#define MGC_MG_DTO_SPEED_CTRL_INCR_VAL		0x98U
+#define MGC_MG_HOR_LOC_STTS			0x9cU
+#define MGC_MG_VER_LOC_STTS			0xa0U
+#define MGC_MG_FRAME_NUM_STTS			0xa4U
+#define MGC_MG_BUSY_STTS			0xa8U
+#define MGC_MG_STOPPED_STTS			0xacU
+/* tile width and height in pixels for Chess board and Color palette */
+#define MGC_TPG_TILE_WIDTH			64U
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1057

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +6 -0
+#define MGC_TPG_TILE_HEIGHT			64U
+
+#define IPU_CSI_PORT_A_ADDR_OFFSET		0
+#define IPU_CSI_PORT_B_ADDR_OFFSET		0
+#define IPU_CSI_PORT_C_ADDR_OFFSET		0
+#define IPU_CSI_PORT_D_ADDR_OFFSET		0

All 0?

Quoted 8 lines

Yes, the register offset here is actually useless. As the IPU7 ISYS registers are grouped by component instead of port number.

		offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
		mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);

But we still keep the defines to be compatible with IPU6.

No, just no. It's completely pointless to keep such macros around.

Quoted 210 lines
Quoted 201 lines
Quoted 15 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +13 -0
+
+/*
+ * 0 - CSI RX Port 0 interrupt;
+ * 1 - MPF Port 0 interrupt;
+ * 2 - CSI RX Port 1 interrupt;
+ * 3 - MPF Port 1 interrupt;
+ * 4 - CSI RX Port 2 interrupt;
+ * 5 - MPF Port 2 interrupt;
+ * 6 - CSI RX Port 3 interrupt;
+ * 7 - MPF Port 3 interrupt;
+ * 8 - Port ARB FIFO 0 overflow;
+ * 9 - Port ARB FIFO 1 overflow;
+ * 10 - Port ARB FIFO 2 overflow;

drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h line 1080

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +10 -0
+ * 11 - Port ARB FIFO 3 overflow;
+ * 12 - isys_cfgnoc_err_probe_intl;
+ * 13-15 - reserved
+ */
+#define IPU7_CSI_IS_IO_IRQ_MASK		0xffffU
+
+/* Adapter layer irq */
+#define IPU7_CSI_ADPL_IRQ_MASK		0xffffU
+
+/* sw irq from legacy irq control

/*
*

Quoted 172 lines
drivers/staging/media/ipu7/ipu7-isys-csi2-regs.h new file +117 -0
+ * legacy irq status
+ * IPU7
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 sync interrupt
+ * 2 - CSI Port 1 error interrupt
+ * 3 - CSI Port 1 sync interrupt
+ * 4 - CSI Port 2 error interrupt
+ * 5 - CSI Port 2 sync interrupt
+ * 6 - CSI Port 3 error interrupt
+ * 7 - CSI Port 3 sync interrupt
+ * IPU7P5
+ * 0 - CSI Port 0 error interrupt
+ * 1 - CSI Port 0 fs interrupt
+ * 2 - CSI Port 0 fe interrupt
+ * 3 - CSI Port 1 error interrupt
+ * 4 - CSI Port 1 fs interrupt
+ * 5 - CSI Port 1 fe interrupt
+ * 6 - CSI Port 2 error interrupt
+ * 7 - CSI Port 2 fs interrupt
+ * 8 - CSI Port 2 fe interrupt
+ */
+#define IPU7_CSI_RX_LEGACY_IRQ_MASK		0x1ffU
+
+/* legacy error status per port
+ * 0 - Error handler FIFO full;
+ * 1 - Reserved Short Packet encoding detected;
+ * 2 - Reserved Long Packet encoding detected;
+ * 3 - Received packet is too short (fewer data words than specified in header);
+ * 4 - Received packet is too long (more data words than specified in header);
+ * 5 - Short packet discarded due to errors;
+ * 6 - Long packet discarded due to errors;
+ * 7 - CSI Combo Rx interrupt;
+ * 8 - IDI CDC FIFO overflow; remaining bits are reserved and tied to 0;
+ */
+#define IPU7_CSI_RX_ERROR_IRQ_MASK		0xfffU
+
+/*
+ * 0 - VC0 frame start received
+ * 1 - VC0 frame end received
+ * 2 - VC1 frame start received
+ * 3 - VC1 frame end received
+ * 4 - VC2 frame start received
+ * 5 - VC2 frame end received
+ * 6 - VC3 frame start received
+ * 7 - VC3 frame end received
+ * 8 - VC4 frame start received
+ * 9 - VC4 frame end received
+ * 10 - VC5 frame start received
+ * 11 - VC5 frame end received
+ * 12 - VC6 frame start received
+ * 13 - VC6 frame end received
+ * 14 - VC7 frame start received
+ * 15 - VC7 frame end received
+ * 16 - VC8 frame start received
+ * 17 - VC8 frame end received
+ * 18 - VC9 frame start received
+ * 19 - VC9 frame end received
+ * 20 - VC10 frame start received
+ * 21 - VC10 frame end received
+ * 22 - VC11 frame start received
+ * 23 - VC11 frame end received
+ * 24 - VC12 frame start received
+ * 25 - VC12 frame end received
+ * 26 - VC13 frame start received
+ * 27 - VC13 frame end received
+ * 28 - VC14 frame start received
+ * 29 - VC14 frame end received
+ * 30 - VC15 frame start received
+ * 31 - VC15 frame end received
+ */
+
+#define IPU7_CSI_RX_SYNC_IRQ_MASK		0 /* 0xffffffff */
+#define IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK		0 /* 0xffffffff */
+
+#define CSI_RX_NUM_ERRORS_IN_IRQ		12U
+#define CSI_RX_NUM_SYNC_IN_IRQ			32U
+
+enum CSI_FE_MODE_TYPE {
+	CSI_FE_DPHY_MODE = 0,
+	CSI_FE_CPHY_MODE = 1,
+};
+
+enum CSI_FE_INPUT_MODE {
+	CSI_SENSOR_INPUT = 0,
+	CSI_MIPIGEN_INPUT = 1,
+};
+
+enum MGC_CSI_ADPL_TYPE {
+	MGC_MAPPED_2_LANES = 0,
+	MGC_MAPPED_4_LANES = 1,
+};
+
+enum CSI2HOST_SELECTION {
+	CSI2HOST_SEL_SOC = 0,
+	CSI2HOST_SEL_CSI2HOST = 1,
+};
+
+#define IPU7_ISYS_LEGACY_IRQ_CSI2(port)		(0x3U << (port))
+#define IPU7P5_ISYS_LEGACY_IRQ_CSI2(port)	(0x7U << (port))
+
+/* ---------------------------------------------------------------- */
+#define CSI_REG_BASE				0x220000U
+#define CSI_REG_BASE_PORT(id)			((id) * 0x1000)
+
+/* CSI Port General Purpose Registers */
+#define CSI_REG_PORT_GPREG_SRST			0
+#define CSI_REG_PORT_GPREG_CSI2_SLV_REG_SRST	0x4U
+#define CSI_REG_PORT_GPREG_CSI2_PORT_CONTROL	0x8U
+
+#define CSI_RX_NUM_IRQ				32U
+
+#define IPU7_CSI_RX_SYNC_FS_VC			0x55555555U
+#define IPU7_CSI_RX_SYNC_FE_VC			0xaaaaaaaaU
+#define IPU7P5_CSI_RX_SYNC_FS_VC		0xffffU
+#define IPU7P5_CSI_RX_SYNC_FE_VC		0xffffU
+
+#endif /* IPU7_ISYS_CSI2_REG_H */
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +49 -0
new file mode 100644
index 000000000000..ae504fb41464
@@ -0,0 +1,542 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#include <linux/atomic.h>
+#include <linux/bits.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/minmax.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+
+#include <media/media-entity.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-subdev.h>
+
+#include "ipu7.h"
+#include "ipu7-bus.h"
+#include "ipu7-isys.h"
+#include "ipu7-isys-csi2.h"
+#include "ipu7-isys-csi2-regs.h"
+#include "ipu7-isys-csi-phy.h"
+
+static const u32 csi2_supported_codes[] = {
+	MEDIA_BUS_FMT_Y10_1X10,
+	MEDIA_BUS_FMT_RGB565_1X16,
+	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_UYVY8_1X16,
+	MEDIA_BUS_FMT_YUYV8_1X16,
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_SBGGR10_1X10,
+	MEDIA_BUS_FMT_SGBRG10_1X10,
+	MEDIA_BUS_FMT_SGRBG10_1X10,
+	MEDIA_BUS_FMT_SRGGB10_1X10,
+	MEDIA_BUS_FMT_SBGGR12_1X12,
+	MEDIA_BUS_FMT_SGBRG12_1X12,
+	MEDIA_BUS_FMT_SGRBG12_1X12,
+	MEDIA_BUS_FMT_SRGGB12_1X12,
+	MEDIA_BUS_FMT_SBGGR8_1X8,
+	MEDIA_BUS_FMT_SGBRG8_1X8,
+	MEDIA_BUS_FMT_SGRBG8_1X8,
+	MEDIA_BUS_FMT_SRGGB8_1X8,
+	0,
+};
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.c line 55

Quoted 6 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +6 -0
+
+s64 ipu7_isys_csi2_get_link_freq(struct ipu7_isys_csi2 *csi2)
+{
+	struct media_pad *src_pad;
+
+	if (!csi2)

Can this be NULL?

Quoted 3 lines

This could be NULL if the caller call wrong CSI2 number(likely coding problem), but the check is harmless as it can be used to avoid crash later.

It won't be NULL. Please just remove the check.

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +31 -0
+		return -EINVAL;
+
+	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
+	if (IS_ERR(src_pad)) {
+		dev_err(&csi2->isys->adev->auxdev.dev,
+			"can't get source pad of %s (%ld)\n",
+			csi2->asd.sd.name, PTR_ERR(src_pad));
+		return PTR_ERR(src_pad);
+	}
+
+	return v4l2_get_link_freq(src_pad, 0, 0);
+}
+
+static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
+				struct v4l2_event_subscription *sub)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+
+	dev_dbg(dev, "csi2 subscribe event(type %u id %u)\n",
+		sub->type, sub->id);
+
+	switch (sub->type) {
+	case V4L2_EVENT_FRAME_SYNC:
+		return v4l2_event_subscribe(fh, sub, 10, NULL);
+	case V4L2_EVENT_CTRL:
+		return v4l2_ctrl_subscribe_event(fh, sub);
+	default:
+		return -EINVAL;
+	}
Quoted 8 lines
Quoted 8 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.c line 94

Quoted 8 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +8 -0
+}
+
+static const struct v4l2_subdev_core_ops csi2_sd_core_ops = {
+	.subscribe_event = csi2_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static void csi2_irq_en(struct ipu7_isys_csi2 *csi2, bool enable)

This would be actually nicer as two separate functions.

Quoted 497 lines
Quoted 483 lines
Quoted 469 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.c new file +448 -0
+{
+	struct ipu7_device *isp = csi2->isys->adev->isp;
+	unsigned int offset, mask;
+
+	if (!enable) {
+		/* disable CSI2 legacy error irq */
+		offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		/* disable CSI2 legacy sync irq */
+		offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+		mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+		writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+		writel(0, csi2->base + offset + IRQ_CTL_MASK);
+		writel(0, csi2->base + offset + IRQ_CTL_ENABLE);
+
+		if (!is_ipu7(isp->hw_ver)) {
+			writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+			writel(0, csi2->base + offset + IRQ1_CTL_MASK);
+			writel(0, csi2->base + offset + IRQ1_CTL_ENABLE);
+		}
+
+		return;
+	}
+
+	/* enable CSI2 legacy error irq */
+	offset = IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_ERROR_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	/* enable CSI2 legacy sync irq */
+	offset = IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE(csi2->port);
+	mask = IPU7_CSI_RX_SYNC_IRQ_MASK;
+	writel(mask, csi2->base + offset + IRQ_CTL_CLEAR);
+	writel(mask, csi2->base + offset + IRQ_CTL_MASK);
+	writel(mask, csi2->base + offset + IRQ_CTL_ENABLE);
+
+	mask = IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK;
+	if (!is_ipu7(isp->hw_ver)) {
+		writel(mask, csi2->base + offset + IRQ1_CTL_CLEAR);
+		writel(mask, csi2->base + offset + IRQ1_CTL_MASK);
+		writel(mask, csi2->base + offset + IRQ1_CTL_ENABLE);
+	}
+}
+
+static void ipu7_isys_csi2_disable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	void __iomem *isys_base = isys->pdata->base;
+
+	ipu7_isys_csi_phy_powerdown(csi2);
+
+	writel(0x4, isys_base + IS_IO_GPREGS_BASE + CLK_DIV_FACTOR_APB_CLK);
+	csi2_irq_en(csi2, 0);
+}
+
+static int ipu7_isys_csi2_enable_stream(struct ipu7_isys_csi2 *csi2)
+{
+	struct ipu7_isys *isys = csi2->isys;
+	struct device *dev = &isys->adev->auxdev.dev;
+	void __iomem *isys_base = isys->pdata->base;
+	unsigned int port, nlanes, offset;
+	int ret;
+
+	port = csi2->port;
+	nlanes = csi2->nlanes;
+
+	offset = IS_IO_GPREGS_BASE;
+	writel(0x2, isys_base + offset + CLK_DIV_FACTOR_APB_CLK);
+	dev_dbg(dev, "port %u CLK_GATE = 0x%04x DIV_FACTOR_APB_CLK=0x%04x\n",
+		port, readl(isys_base + offset + CSI_PORT_CLK_GATE),
+		readl(isys_base + offset + CLK_DIV_FACTOR_APB_CLK));
+	if (port == 0U && nlanes == 4U && !is_ipu7(isys->adev->isp->hw_ver)) {
+		dev_dbg(dev, "CSI port %u in aggregation mode\n", port);
+		writel(0x1, isys_base + offset + CSI_PORTAB_AGGREGATION);
+	}
+
+	/* input is coming from CSI receiver (sensor) */
+	offset = IS_IO_CSI2_ADPL_PORT_BASE(port);
+	writel(CSI_SENSOR_INPUT, isys_base + offset + CSI2_ADPL_INPUT_MODE);
+	writel(1, isys_base + offset + CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN);
+
+	ret = ipu7_isys_csi_phy_powerup(csi2);
+	if (ret) {
+		dev_err(dev, "CSI-%d PHY power up failed %d\n", port, ret);
+		return ret;
+	}
+	csi2_irq_en(csi2, 1);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_set_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct device *dev = &asd->isys->adev->auxdev.dev;
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_mbus_framefmt *src_ffmt;
+	struct v4l2_rect *crop;
+
+	if (sel->pad == CSI2_PAD_SINK || sel->target != V4L2_SEL_TGT_CROP)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	src_ffmt = v4l2_subdev_state_get_format(state, sel->pad, sel->stream);
+	if (!src_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	/* Only vertical cropping is supported */
+	sel->r.left = 0;
+	sel->r.width = sink_ffmt->width;
+	/* Non-bayer formats can't be single line cropped */
+	if (!ipu7_isys_is_bayer_format(sink_ffmt->code))
+		sel->r.top &= ~1U;
+	sel->r.height = clamp(sel->r.height & ~1U, IPU_ISYS_MIN_HEIGHT,
+			      sink_ffmt->height - sel->r.top);
+	*crop = sel->r;
+
+	/* update source pad format */
+	src_ffmt->width = sel->r.width;
+	src_ffmt->height = sel->r.height;
+	if (ipu7_isys_is_bayer_format(sink_ffmt->code))
+		src_ffmt->code = ipu7_isys_convert_bayer_order(sink_ffmt->code,
+							       sel->r.left,
+							       sel->r.top);
+	dev_dbg(dev, "set crop for %s sel: %d,%d,%d,%d code: 0x%x\n",
+		sd->name, sel->r.left, sel->r.top, sel->r.width, sel->r.height,
+		src_ffmt->code);
+
+	return 0;
+}
+
+static int ipu7_isys_csi2_get_sel(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_state *state,
+				  struct v4l2_subdev_selection *sel)
+{
+	struct v4l2_mbus_framefmt *sink_ffmt;
+	struct v4l2_rect *crop;
+	int ret = 0;
+
+	if (sd->entity.pads[sel->pad].flags & MEDIA_PAD_FL_SINK)
+		return -EINVAL;
+
+	sink_ffmt = v4l2_subdev_state_get_opposite_stream_format(state,
+								 sel->pad,
+								 sel->stream);
+	if (!sink_ffmt)
+		return -EINVAL;
+
+	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
+	if (!crop)
+		return -EINVAL;
+
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = sink_ffmt->width;
+		sel->r.height = sink_ffmt->height;
+		break;
+	case V4L2_SEL_TGT_CROP:
+		sel->r = *crop;
+		break;
+	default:
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
+/*
+ * Maximum stream ID is 63 for now, as we use u64 bitmask to represent a set
+ * of streams.
+ */
+#define CSI2_SUBDEV_MAX_STREAM_ID 63
+
+static int ipu7_isys_csi2_enable_streams(struct v4l2_subdev *sd,
+					 struct v4l2_subdev_state *state,
+					 u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	if (!csi2->stream_count) {
+		dev_dbg(&csi2->isys->adev->auxdev.dev,
+			"stream on CSI2-%u with %u lanes\n", csi2->port,
+			csi2->nlanes);
+		ret = ipu7_isys_csi2_enable_stream(csi2);
+		if (ret)
+			return ret;
+	}
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	ret = v4l2_subdev_enable_streams(r_sd, r_pad->index,
+					 BIT_ULL(sink_stream));
+	if (!ret) {
+		csi2->stream_count++;
+		return 0;
+	}
+
+	if (!csi2->stream_count)
+		ipu7_isys_csi2_disable_stream(csi2);
+
+	return ret;
+}
+
+static int ipu7_isys_csi2_disable_streams(struct v4l2_subdev *sd,
+					  struct v4l2_subdev_state *state,
+					  u32 pad, u64 streams_mask)
+{
+	struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
+	struct ipu7_isys_csi2 *csi2 = to_ipu7_isys_csi2(asd);
+	struct v4l2_subdev *r_sd;
+	struct media_pad *r_pad;
+	u32 sink_pad, sink_stream;
+	int ret, i;
+
+	for (i = 0; i <= CSI2_SUBDEV_MAX_STREAM_ID; i++) {
+		if (streams_mask & BIT_ULL(i))
+			break;
+	}
+
+	ret = v4l2_subdev_routing_find_opposite_end(&state->routing, pad, i,
+						    &sink_pad, &sink_stream);
+	if (ret)
+		return ret;
+
+	r_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
+	r_sd = media_entity_to_v4l2_subdev(r_pad->entity);
+
+	v4l2_subdev_disable_streams(r_sd, r_pad->index, BIT_ULL(sink_stream));
+
+	if (--csi2->stream_count)
+		return 0;
+
+	dev_dbg(&csi2->isys->adev->auxdev.dev,
+		"stream off CSI2-%u with %u lanes\n", csi2->port, csi2->nlanes);
+
+	ipu7_isys_csi2_disable_stream(csi2);
+
+	return 0;
+}
+
+static const struct v4l2_subdev_pad_ops csi2_sd_pad_ops = {
+	.get_fmt = v4l2_subdev_get_fmt,
+	.set_fmt = ipu7_isys_subdev_set_fmt,
+	.get_selection = ipu7_isys_csi2_get_sel,
+	.set_selection = ipu7_isys_csi2_set_sel,
+	.enum_mbus_code = ipu7_isys_subdev_enum_mbus_code,
+	.enable_streams = ipu7_isys_csi2_enable_streams,
+	.disable_streams = ipu7_isys_csi2_disable_streams,
+	.set_routing = ipu7_isys_subdev_set_routing,
+};
+
+static const struct v4l2_subdev_ops csi2_sd_ops = {
+	.core = &csi2_sd_core_ops,
+	.pad = &csi2_sd_pad_ops,
+};
+
+static const struct media_entity_operations csi2_entity_ops = {
+	.link_validate = v4l2_subdev_link_validate,
+	.has_pad_interdep = v4l2_subdev_has_pad_interdep,
+};
+
+void ipu7_isys_csi2_cleanup(struct ipu7_isys_csi2 *csi2)
+{
+	if (!csi2->isys)
+		return;
+
+	v4l2_device_unregister_subdev(&csi2->asd.sd);
+	v4l2_subdev_cleanup(&csi2->asd.sd);
+	ipu7_isys_subdev_cleanup(&csi2->asd);
+	csi2->isys = NULL;
+}
+
+int ipu7_isys_csi2_init(struct ipu7_isys_csi2 *csi2,
+			struct ipu7_isys *isys,
+			void __iomem *base, unsigned int index)
+{
+	struct device *dev = &isys->adev->auxdev.dev;
+	int ret;
+
+	csi2->isys = isys;
+	csi2->base = base;
+	csi2->port = index;
+
+	if (!is_ipu7(isys->adev->isp->hw_ver))
+		csi2->legacy_irq_mask = 0x7U << (index * 3U);
+	else
+		csi2->legacy_irq_mask = 0x3U << (index * 2U);
+
+	dev_dbg(dev, "csi-%d legacy irq mask = 0x%x\n", index,
+		csi2->legacy_irq_mask);
+
+	csi2->asd.sd.entity.ops = &csi2_entity_ops;
+	csi2->asd.isys = isys;
+
+	ret = ipu7_isys_subdev_init(&csi2->asd, &csi2_sd_ops, 0,
+				    NR_OF_CSI2_SINK_PADS, NR_OF_CSI2_SRC_PADS);
+	if (ret)
+		return ret;
+
+	csi2->asd.source = (int)index;
+	csi2->asd.supported_codes = csi2_supported_codes;
+	snprintf(csi2->asd.sd.name, sizeof(csi2->asd.sd.name),
+		 IPU_ISYS_ENTITY_PREFIX " CSI2 %u", index);
+	v4l2_set_subdevdata(&csi2->asd.sd, &csi2->asd);
+
+	ret = v4l2_subdev_init_finalize(&csi2->asd.sd);
+	if (ret) {
+		dev_err(dev, "failed to init v4l2 subdev (%d)\n", ret);
+		goto isys_subdev_cleanup;
+	}
+
+	ret = v4l2_device_register_subdev(&isys->v4l2_dev, &csi2->asd.sd);
+	if (ret) {
+		dev_err(dev, "failed to register v4l2 subdev (%d)\n", ret);
+		goto v4l2_subdev_cleanup;
+	}
+
+	return 0;
+
+v4l2_subdev_cleanup:
+	v4l2_subdev_cleanup(&csi2->asd.sd);
+isys_subdev_cleanup:
+	ipu7_isys_subdev_cleanup(&csi2->asd);
+
+	return ret;
+}
+
+void ipu7_isys_csi2_sof_event_by_stream(struct ipu7_isys_stream *stream)
+{
+	struct ipu7_isys_csi2 *csi2 = ipu7_isys_subdev_to_csi2(stream->asd);
+	struct device *dev = &stream->isys->adev->auxdev.dev;
+	struct video_device *vdev = csi2->asd.sd.devnode;
+	struct v4l2_event ev = {
+		.type = V4L2_EVENT_FRAME_SYNC,
+	};
+
+	ev.id = stream->vc;
+	ev.u.frame_sync.frame_sequence = atomic_fetch_inc(&stream->sequence);
+	v4l2_event_queue(vdev, &ev);
+
+	dev_dbg(dev, "sof_event::csi2-%i sequence: %i, vc: %d\n",
+		csi2->port, ev.u.frame_sync.frame_sequence, stream->vc);
+}
+
+void ipu7_isys_csi2_eof_event_by_stream(struct ipu7_isys_stream *stream)
+{
+	struct ipu7_isys_csi2 *csi2 = ipu7_isys_subdev_to_csi2(stream->asd);
+	struct device *dev = &stream->isys->adev->auxdev.dev;
+	u32 frame_sequence = atomic_read(&stream->sequence);
+
+	dev_dbg(dev, "eof_event::csi2-%i sequence: %i\n",
+		csi2->port, frame_sequence);
+}
+
+int ipu7_isys_csi2_get_remote_desc(u32 source_stream,
+				   struct ipu7_isys_csi2 *csi2,
+				   struct media_entity *source_entity,
+				   struct v4l2_mbus_frame_desc_entry *entry,
+				   int *nr_queues)
+{
+	struct v4l2_mbus_frame_desc_entry *desc_entry = NULL;
+	struct device *dev = &csi2->isys->adev->auxdev.dev;
+	struct v4l2_mbus_frame_desc desc;
+	struct v4l2_subdev *source;
+	struct media_pad *pad;
+	unsigned int i;
+	int ret;
+
+	source = media_entity_to_v4l2_subdev(source_entity);
+	if (!source)
+		return -EPIPE;
+
+	pad = media_pad_remote_pad_first(&csi2->asd.pad[CSI2_PAD_SINK]);
+	if (!pad)
+		return -EPIPE;
+
+	ret = v4l2_subdev_call(source, pad, get_frame_desc, pad->index, &desc);
+	if (ret)
+		return ret;
+
+	if (desc.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) {
+		dev_err(dev, "Unsupported frame descriptor type\n");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < desc.num_entries; i++) {
+		if (source_stream == desc.entry[i].stream) {
+			desc_entry = &desc.entry[i];
+			break;
+		}
+	}
+
+	if (!desc_entry) {
+		dev_err(dev, "Failed to find stream %u from remote subdev\n",
+			source_stream);
+		return -EINVAL;
+	}
+
+	if (desc_entry->bus.csi2.vc >= NR_OF_CSI2_VC) {
+		dev_err(dev, "invalid vc %d\n", desc_entry->bus.csi2.vc);
+		return -EINVAL;
+	}
+
+	*entry = *desc_entry;
+
+	for (i = 0; i < desc.num_entries; i++) {
+		if (desc_entry->bus.csi2.vc == desc.entry[i].bus.csi2.vc)
+			(*nr_queues)++;
+	}
+
+	return 0;
+}
drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +15 -0
new file mode 100644
index 000000000000..ea4e20525d16
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 - 2025 Intel Corporation
+ */
+
+#ifndef IPU7_ISYS_CSI2_H
+#define IPU7_ISYS_CSI2_H
+
+#include <linux/container_of.h>
+#include <linux/types.h>
+
+#include "ipu7-isys-subdev.h"
+#include "ipu7-isys-video.h"
+
+struct ipu7_isys;

drivers/staging/media/ipu7/ipu7-isys-csi2.h line 25

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +10 -0
+struct ipu7_isys_csi2_pdata;
+struct ipu7_isys_stream;
+
+#define NR_OF_CSI2_VC		16U
+#define INVALID_VC_ID		-1
+#define NR_OF_CSI2_SINK_PADS	1U
+#define CSI2_PAD_SINK		0U
+#define NR_OF_CSI2_SRC_PADS	8U
+#define CSI2_PAD_SRC		1U
+#define NR_OF_CSI2_PADS		(NR_OF_CSI2_SINK_PADS + NR_OF_CSI2_SRC_PADS)

These seem to require IPU7 prefix, too. It'd be nice to move them into a struct, specific to IPU version.

Quoted 12 lines

drivers/staging/media/ipu7/ipu7-isys-csi2.h line 35

Quoted 10 lines
drivers/staging/media/ipu7/ipu7-isys-csi2.h new file +10 -0
+
+#define CSI2_CSI_RX_DLY_CNT_TERMEN_CLANE_A		0
+#define CSI2_CSI_RX_DLY_CNT_TERMEN_CLANE_B		0
+#define CSI2_CSI_RX_DLY_CNT_SETTLE_CLANE_A		95
+#define CSI2_CSI_RX_DLY_CNT_SETTLE_CLANE_B		-8
+
+#define CSI2_CSI_RX_DLY_CNT_TERMEN_DLANE_A		0
+#define CSI2_CSI_RX_DLY_CNT_TERMEN_DLANE_B		0
+#define CSI2_CSI_RX_DLY_CNT_SETTLE_DLANE_A		85
+#define CSI2_CSI_RX_DLY_CNT_SETTLE_DLANE_B		-2

These are the same for IPU6, aren't they?

Will remove them.

Signature · 3 lines
Regards,

Sakari Ailus
#14 lore raw

PATCH 7/8 media: staging/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/staging/media/Kconfig       |  2 ++
 drivers/staging/media/Makefile      |  1 +
 drivers/staging/media/ipu7/Kconfig  | 18 ++++++++++++++++++
 drivers/staging/media/ipu7/Makefile | 23 +++++++++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 drivers/staging/media/ipu7/Kconfig
 create mode 100644 drivers/staging/media/ipu7/Makefile
drivers/staging/media/Kconfig +2 -0
index b44214854399..043ffbc472fb 100644
@@ -28,6 +28,8 @@ source "drivers/staging/media/imx/Kconfig"
 
 source "drivers/staging/media/ipu3/Kconfig"
 
+source "drivers/staging/media/ipu7/Kconfig"
+
 source "drivers/staging/media/max96712/Kconfig"
 
 source "drivers/staging/media/meson/vdec/Kconfig"
drivers/staging/media/Makefile +1 -0
index ad4e9619a9e0..177dfe95289b 100644
@@ -9,4 +9,5 @@ obj-$(CONFIG_VIDEO_STARFIVE_CAMSS)	+= starfive/
 obj-$(CONFIG_VIDEO_SUNXI)	+= sunxi/
 obj-$(CONFIG_VIDEO_TEGRA)	+= tegra-video/
 obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
+obj-$(CONFIG_VIDEO_INTEL_IPU7)	+= ipu7/
 obj-$(CONFIG_DVB_AV7110)	+= av7110/
drivers/staging/media/ipu7/Kconfig new file +18 -0
new file mode 100644
index 000000000000..5b800e9b09c4
@@ -0,0 +1,18 @@
+config VIDEO_INTEL_IPU7
+	tristate "Intel IPU7 driver"
+	depends on ACPI || COMPILE_TEST
+	depends on VIDEO_DEV
+	depends on X86 && 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_SG
+	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/staging/media/ipu7/Makefile new file +23 -0
new file mode 100644
index 000000000000..6d2aec219e65
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2017 - 2025 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
#15 lore raw

PATCH 8/8 MAINTAINERS: add maintainers for Intel IPU7 input system driver

In reply to [email protected]

From: Bingbu Cao <[email protected]>

Update MAINTAINERS file for Intel IPU7 input system staging driver.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index f31aeb6b452e..044c8e341074 100644
@@ -12035,6 +12035,15 @@ T:	git git://linuxtv.org/media.git
 F:	Documentation/admin-guide/media/ipu6-isys.rst
 F:	drivers/media/pci/intel/ipu6/
 
+INTEL IPU7 INPUT SYSTEM DRIVER
+M:	Sakari Ailus <[email protected]>
+R:	Bingbu Cao <[email protected]>
+R:	Stanislaw Gruszka <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://linuxtv.org/media.git
+F:	drivers/staging/media/ipu7/
+
 INTEL ISHTP ECLITE DRIVER
 M:	Srinivas Pandruvada <[email protected]>
 L:	[email protected]
Signature · 1 line
2.34.1