media: ipu6: Add support for ipu7 hardware
Subsystems (2)
v2 cover media: ipu6: Add support for ipu7 hardware
Hello,
The 7th Gen Intel Imaging Processing Unit is a PCI device including input system and processing system. This set adds support for ISYS in IPU7 and IPU7.5.
Changes since v1:
- Fixed review and checkpatch issues.
- Fixed a bug in ipu6 fw communication.
- Added missing bits for ipu7 CSI2 initialization.
- Changed IPU runtime detection.
- Added IPU7.5 support.
Antti Laakso (44):
media: ipu6: Add helpers for IPU runtime variation
media: ipu6: Rename pointer to firmware context
media: ipu6: Rename buttress_ipc pointer
media: ipu6: Remove duplicate warnings in cpd validation
media: ipu6: Remove unused ipu6 firmware struct
media: ipu6: Cleanup ipu6_mmu_init()
media: ipu6: Simplify firmware com arguments
media: ipu6: Add helper to identify ipu7
media: ipu6: Prepare buttress for ipu7 support
media: ipu6: Use single struct for registers
media: ipu6: Rename IPU subsys ID
media: ipu6: Add ipu7 buttress support
media: ipu6: Prepare mmu driver for hw variation
media: ipu6: Add ipu7 mmu support
media: ipu6: Add ipu7 cpd handling
media: ipu6: Add check for pkg_dir before freeing
media: ipu6: Rename isys fw msg union
media: ipu6: Move isys isr handlers to fw file
media: ipu6: Move hw specific buffer handling down
media: ipu6: Isolate hw specific buffer handling
media: ipu6: Add isys firmware ops
media: ipu6: Add ipu7 fw start/stop functionality
media: ipu6: Add ipu7 fw com methods
media: ipu6: Add ipu7 fw isys ops
media: ipu6: Add ipu7 csi2 register definitions
media: ipu6: Add ipu7 isr handler
media: ipu6: Add ipu7 csi phy driver
media: ipu6: Split ipu6 csi2 stream enable/disable
media: ipu6: Add support for ipu7 csi2 receiver
media: ipu6: Parse bus type for ipu7
media: ipu6: Enable ipu7 isys interrupts
media: ipu6: Skip watermark configuration for ipu7
media: ipu6: The SPC init is valid only for ipu6
media: ipu6: The VC arbitration mechanism is ipu6 only
media: ipu6: Move buttress mem alloc out from probe
media: ipu6: Read correct SKU ID for ipu7
media: ipu6: Add support for fixed iova region
media: ipu6: Make fw mapping function reusable
media: ipu6: Move isys fw mapping to pci_probe
media: ipu6: Map ipu7 firmware
media: ipu6: Set model name for ipu7
media: ipu6: Add ipu7.5 buttress support
media: ipu6: Add ipu7.5 mmu initialization data
media: ipu6: Enable ipu7 and ipu7.5
drivers/media/pci/intel/ipu6/Makefile | 10 +- drivers/media/pci/intel/ipu6/ipu6-bus.h | 6 +- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 568 +++++--- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 50 +- drivers/media/pci/intel/ipu6/ipu6-cpd.c | 195 ++- drivers/media/pci/intel/ipu6/ipu6-cpd.h | 43 + drivers/media/pci/intel/ipu6/ipu6-dma.c | 24 +- drivers/media/pci/intel/ipu6/ipu6-dma.h | 2 + drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 589 +++++++- drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 48 +- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 207 ++- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h | 5 + .../media/pci/intel/ipu6/ipu6-isys-queue.c | 87 +- .../media/pci/intel/ipu6/ipu6-isys-queue.h | 6 +- .../media/pci/intel/ipu6/ipu6-isys-video.c | 160 +-- .../media/pci/intel/ipu6/ipu6-isys-video.h | 1 + drivers/media/pci/intel/ipu6/ipu6-isys.c | 397 ++---- drivers/media/pci/intel/ipu6/ipu6-isys.h | 55 +- drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c | 296 ++++ drivers/media/pci/intel/ipu6/ipu6-mmu.c | 133 +- drivers/media/pci/intel/ipu6/ipu6-mmu.h | 158 ++- .../intel/ipu6/ipu6-platform-buttress-regs.h | 111 +- drivers/media/pci/intel/ipu6/ipu6.c | 536 +++++--- drivers/media/pci/intel/ipu6/ipu6.h | 200 +-- drivers/media/pci/intel/ipu6/ipu7-boot.c | 405 ++++++ drivers/media/pci/intel/ipu6/ipu7-boot.h | 46 + drivers/media/pci/intel/ipu6/ipu7-fw-com.c | 74 + drivers/media/pci/intel/ipu6/ipu7-fw-com.h | 53 + drivers/media/pci/intel/ipu6/ipu7-fw-isys.c | 787 +++++++++++ drivers/media/pci/intel/ipu6/ipu7-fw-isys.h | 296 ++++ .../media/pci/intel/ipu6/ipu7-isys-csi-phy.c | 1072 +++++++++++++++ .../media/pci/intel/ipu6/ipu7-isys-csi-phy.h | 16 + .../pci/intel/ipu6/ipu7-isys-csi2-regs.h | 1189 +++++++++++++++++ drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c | 858 ++++++++++++ drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h | 254 ++++ .../media/pci/intel/ipu6/ipu7-platform-regs.h | 32 + include/media/ipu6-pci-table.h | 4 + 37 files changed, 7596 insertions(+), 1377 deletions(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-boot.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-boot.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-isys.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-isys.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-platform-regs.h
Signature · 1 line
2.55.0
PATCH v2 1/44 media: ipu6: Add helpers for IPU runtime variation
And replace inline functions with defines.
--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 4 +-- drivers/media/pci/intel/ipu6/ipu6.c | 29 ++++++++-------- drivers/media/pci/intel/ipu6/ipu6.h | 42 +++++------------------- 3 files changed, 25 insertions(+), 50 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys.c +2 -2
@@ -1104,9 +1104,9 @@ static int isys_probe(struct auxiliary_device *auxdev,isys_iwake_watermark_init (isys); -if (is_ipu6se (adev->isp->hw_ver)) +if (IS_IPU6SE (adev->isp)) isys->phy_set_power = ipu6_isys_jsl_phy_set_power; -else if (is_ipu6ep_mtl (adev->isp->hw_ver)) +else if (IS_IPU6EP_MTL (adev->isp)) isys->phy_set_power = ipu6_isys_dwc_phy_set_power;else isys->phy_set_power = ipu6_isys_mcd_phy_set_power;
drivers/media/pci/intel/ipu6/ipu6.c +14 -15
@@ -290,8 +290,6 @@ EXPORT_SYMBOL_NS_GPL(ipu6_configure_spc, "INTEL_IPU6");static void ipu6_internal_pdata_init (struct ipu6_device *isp) { -u8 hw_ver = isp->hw_ver; - isys_ipdata.num_parallel_streams =IPU6_ISYS_NUM_STREAMS ; isys_ipdata.sram_gran_shift =IPU6_SRAM_GRANULARITY_SHIFT ; isys_ipdata.sram_gran_size =IPU6_SRAM_GRANULARITY_SIZE ;
@@ -314,19 +312,19 @@ static void ipu6_internal_pdata_init(struct ipu6_device *isp)IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_STATUS ; isys_ipdata.csi2.ctrl0_irq_lnp =IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_LEVEL_NOT_PULSE ; - isys_ipdata.enhanced_iwake =is_ipu6ep_mtl (hw_ver) ||is_ipu6ep (hw_ver); + isys_ipdata.enhanced_iwake =IS_IPU6EP_MTL (isp) ||IS_IPU6EP (isp); psys_ipdata.hw_variant.spc_offset =IPU6_PSYS_SPC_OFFSET ; isys_ipdata.csi2.fw_access_port_ofs =CSI_REG_HUB_FW_ACCESS_PORT_OFS ; -if (is_ipu6ep (hw_ver)) { +if (IS_IPU6EP (isp)) { isys_ipdata.ltr =IPU6EP_LTR_VALUE ; isys_ipdata.memopen_threshold =IPU6EP_MIN_MEMOPEN_TH ; } -if (is_ipu6_tgl (hw_ver)) +if (IS_IPU6_TGL (isp)) isys_ipdata.csi2.nports =IPU6_TGL_ISYS_CSI2_NPORTS ; -if (is_ipu6ep_mtl (hw_ver)) { +if (IS_IPU6EP_MTL (isp)) { isys_ipdata.csi2.nports =IPU6EP_MTL_ISYS_CSI2_NPORTS ; isys_ipdata.csi2.ctrl0_irq_edge =
@@ -347,7 +345,7 @@ static void ipu6_internal_pdata_init(struct ipu6_device *isp) isys_ipdata.memopen_threshold =IPU6EP_MTL_MIN_MEMOPEN_TH ; } -if (is_ipu6se (hw_ver)) { +if (IS_IPU6SE (isp)) { isys_ipdata.csi2.nports =IPU6SE_ISYS_CSI2_NPORTS ; isys_ipdata.csi2.irq_mask =IPU6SE_CSI_RX_ERROR_IRQ_MASK ; isys_ipdata.num_parallel_streams =IPU6SE_ISYS_NUM_STREAMS ;
@@ -454,12 +452,13 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent,return psys_adev; } -static int ipu6_pci_config_setup (struct pci_dev *dev,u8 hw_ver) +static int ipu6_pci_config_setup (struct pci_dev *dev) { +struct ipu6_device *isp =pci_get_drvdata (dev);int ret;/* No PCI msi capability for IPU6EP */ -if (is_ipu6ep (hw_ver) ||is_ipu6ep_mtl (hw_ver)) { +if (IS_IPU6EP (isp) ||IS_IPU6EP_MTL (isp)) {/* likely do nothing as msi not enabled by default */ pci_disable_msi (dev);return 0 ;
@@ -525,26 +524,26 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) isp->cpd_metadata_cmpnt_size =sizeof (struct ipu6_cpd_metadata_cmpnt );switch (id->device) {case PCI_DEVICE_ID_INTEL_IPU6 : - isp->hw_ver =IPU6_VER_6 ; + isp->hw_ver =IPU_VERSION_6 ; isp->cpd_fw_name =IPU6_FIRMWARE_NAME ;break ;case PCI_DEVICE_ID_INTEL_IPU6SE : - isp->hw_ver =IPU6_VER_6SE ; + isp->hw_ver =IPU_VERSION_6SE ; isp->cpd_fw_name =IPU6SE_FIRMWARE_NAME ; isp->cpd_metadata_cmpnt_size =sizeof (struct ipu6se_cpd_metadata_cmpnt );break ;case PCI_DEVICE_ID_INTEL_IPU6EP_ADLP :case PCI_DEVICE_ID_INTEL_IPU6EP_RPLP : - isp->hw_ver =IPU6_VER_6EP ; + isp->hw_ver =IPU_VERSION_6EP ; isp->cpd_fw_name =IPU6EP_FIRMWARE_NAME ;break ;case PCI_DEVICE_ID_INTEL_IPU6EP_ADLN : - isp->hw_ver =IPU6_VER_6EP ; + isp->hw_ver =IPU_VERSION_6EP ; isp->cpd_fw_name =IPU6EPADLN_FIRMWARE_NAME ;break ;case PCI_DEVICE_ID_INTEL_IPU6EP_MTL : - isp->hw_ver =IPU6_VER_6EP_MTL ; + isp->hw_ver =IPU_VERSION_6EP_MTL ; isp->cpd_fw_name =IPU6EPMTL_FIRMWARE_NAME ;break ;default :
@@ -564,7 +563,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)dma_set_max_seg_size (dev,UINT_MAX ); - ret =ipu6_pci_config_setup (pdev, isp->hw_ver); + ret =ipu6_pci_config_setup (pdev);if (ret)return ret;
drivers/media/pci/intel/ipu6/ipu6.h +9 -33
48 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 2/44 media: ipu6: Rename pointer to firmware context
In reply to Antti LaaksoThe name fwcom is used to refer firmware communication context and firmware communication configuration. Try to avoid confusion and rename context variable.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 56 ++++++++++--------- .../media/pci/intel/ipu6/ipu6-isys-video.c | 4 +- drivers/media/pci/intel/ipu6/ipu6-isys.c | 6 +- drivers/media/pci/intel/ipu6/ipu6-isys.h | 5 +- 4 files changed, 36 insertions(+), 35 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +29 -27
@@ -32,7 +32,7 @@ static int handle_proxy_response(struct ipu6_isys *isys, unsigned int req_id)struct ipu6_fw_isys_proxy_resp_info_abi *resp;int ret; - resp =ipu6_recv_get_token (isys->fwcom,IPU6_BASE_PROXY_RECV_QUEUES ); + resp =ipu6_recv_get_token (isys->fwctx,IPU6_BASE_PROXY_RECV_QUEUES );if (!resp)return 1 ;
@@ -42,7 +42,7 @@ static int handle_proxy_response(struct ipu6_isys *isys, unsigned int req_id) ret = req_id == resp->request_id ?0 : -EIO ; -ipu6_recv_put_token (isys->fwcom,IPU6_BASE_PROXY_RECV_QUEUES ); +ipu6_recv_put_token (isys->fwctx,IPU6_BASE_PROXY_RECV_QUEUES );return ret; }
@@ -52,7 +52,7 @@ int ipu6_fw_isys_send_proxy_token(struct ipu6_isys *isys,unsigned int index, unsigned int offset, u32 value) { - struct ipu6_fw_com_context *ctx = isys->fwcom; + struct ipu6_fw_com_context *ctx = isys->fwctx;struct device *dev = &isys->adev->auxdev.dev;struct ipu6_fw_proxy_send_queue_token *token;unsigned int timeout =1000 ;
@@ -96,7 +96,7 @@ int ipu6_fw_isys_complex_cmd(struct ipu6_isys *isys,dma_addr_t dma_mapped_buf, size_t size, u16 send_type) { - struct ipu6_fw_com_context *ctx = isys->fwcom; + struct ipu6_fw_com_context *ctx = isys->fwctx;struct device *dev = &isys->adev->auxdev.dev;struct ipu6_fw_send_queue_token *token;
@@ -138,7 +138,7 @@ int ipu6_fw_isys_close(struct ipu6_isys *isys)struct device *dev = &isys->adev->auxdev.dev;int retry =IPU6_ISYS_CLOSE_RETRY ;unsigned long flags; -void *fwcom; +void *fwctx;int ret;/*
@@ -148,9 +148,9 @@ int ipu6_fw_isys_close(struct ipu6_isys *isys)* spinlock to wait the interrupt handler to be finished */ spin_lock_irqsave (&isys->power_lock, flags); - ret =ipu6_fw_com_close (isys->fwcom); - fwcom = isys->fwcom; - isys->fwcom =NULL ; + ret =ipu6_fw_com_close (isys->fwctx); + fwctx = isys->fwctx; + isys->fwctx =NULL ;spin_unlock_irqrestore (&isys->power_lock, flags);if (ret)dev_err (dev,"Device close failure: %d\n" , ret);
@@ -158,14 +158,14 @@ int ipu6_fw_isys_close(struct ipu6_isys *isys)/* release probably fails if the close failed. Let's try still */ do {usleep_range (400 ,500 ); - ret =ipu6_fw_com_release (fwcom,0 ); + ret =ipu6_fw_com_release (fwctx,0 ); retry--; }while (ret && retry);if (ret) {dev_err (dev,"Device release time out %d\n" , ret);spin_lock_irqsave (&isys->power_lock, flags); - isys->fwcom = fwcom; + isys->fwctx = fwctx;spin_unlock_irqrestore (&isys->power_lock, flags); }
@@ -176,11 +176,11 @@ void ipu6_fw_isys_cleanup(struct ipu6_isys *isys) {int ret; - ret =ipu6_fw_com_release (isys->fwcom,1 ); + ret =ipu6_fw_com_release (isys->fwctx,1 );if (ret <0 )dev_warn (&isys->adev->auxdev.dev,"Device busy, fw_com release failed." ); - isys->fwcom =NULL ; + isys->fwctx =NULL ; }static void start_sp (struct ipu6_bus_device *adev)
@@ -212,7 +212,7 @@ static int query_sp(struct ipu6_bus_device *adev) }static int ipu6_isys_fwcom_cfg_init (struct ipu6_isys *isys, -struct ipu6_fw_com_cfg *fwcom, +struct ipu6_fw_com_cfg *fwcom_cfg,unsigned int num_streams) {unsigned int max_send_queues, max_sram_blocks, max_devq_size;
@@ -258,14 +258,16 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys,if (!output_queue_cfg)return -ENOMEM ; - fwcom->input = input_queue_cfg; - fwcom->output = output_queue_cfg; + fwcom_cfg->input = input_queue_cfg; + fwcom_cfg->output = output_queue_cfg; - fwcom->num_input_queues = isys_fw_cfg->num_send_queues[type_proxy] + + fwcom_cfg->num_input_queues = + isys_fw_cfg->num_send_queues[type_proxy] + isys_fw_cfg->num_send_queues[type_dev] + isys_fw_cfg->num_send_queues[type_msg]; - fwcom->num_output_queues = isys_fw_cfg->num_recv_queues[type_proxy] + + fwcom_cfg->num_output_queues = + isys_fw_cfg->num_recv_queues[type_proxy] + isys_fw_cfg->num_recv_queues[type_dev] + isys_fw_cfg->num_recv_queues[type_msg];
@@ -280,7 +282,7 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys, isys_fw_cfg->buffer_partition.num_gda_pages[i] =0 ; } -/* FW assumes proxy interface at fwcom queue 0 */ +/* FW assumes proxy interface at fwcom_cfg queue 0 */ for (i =0 ; i < isys_fw_cfg->num_send_queues[type_proxy]; i++) { input_queue_cfg[i].token_size =sizeof (struct ipu6_fw_proxy_send_queue_token );
@@ -314,9 +316,9 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys,IPU6_ISYS_SIZE_RECV_QUEUE ; } - fwcom->dmem_addr = isys->pdata->ipdata->hw_variant.dmem_offset; - fwcom->specific_addr = isys_fw_cfg; - fwcom->specific_size =sizeof (*isys_fw_cfg); + fwcom_cfg->dmem_addr = isys->pdata->ipdata->hw_variant.dmem_offset; + fwcom_cfg->specific_addr = isys_fw_cfg; + fwcom_cfg->specific_size =sizeof (*isys_fw_cfg);return 0 ; }
@@ -325,23 +327,23 @@ int ipu6_fw_isys_init(struct ipu6_isys *isys, unsigned int num_streams) {struct device *dev = &isys->adev->auxdev.dev;int retry =IPU6_ISYS_OPEN_RETRY ; -struct ipu6_fw_com_cfg fwcom = { +struct ipu6_fw_com_cfg fwcom_cfg = { .cell_start = start_sp, .cell_ready = query_sp, .buttress_boot_offset =SYSCOM_BUTTRESS_FW_PARAMS_ISYS_OFFSET , };int ret; -ipu6_isys_fwcom_cfg_init (isys, &fwcom, num_streams); +ipu6_isys_fwcom_cfg_init (isys, &fwcom_cfg, num_streams); - isys->fwcom =ipu6_fw_com_prepare (&fwcom, isys->adev, + isys->fwctx =ipu6_fw_com_prepare (&fwcom_cfg, isys->adev, isys->pdata->base); -if (!isys->fwcom) { +if (!isys->fwctx) {dev_err (dev,"isys fw com prepare failed\n" );return -EIO ; } - ret =ipu6_fw_com_open (isys->fwcom); + ret =ipu6_fw_com_open (isys->fwctx);if (ret) {dev_err (dev,"isys fw com open failed %d\n" , ret);return ret;
@@ -349,7 +351,7 @@ int ipu6_fw_isys_init(struct ipu6_isys *isys, unsigned int num_streams)do {usleep_range (400 ,500 ); -if (ipu6_fw_com_ready (isys->fwcom)) +if (ipu6_fw_com_ready (isys->fwctx))break ; retry--; }while (retry >0 );
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +2 -2
@@ -1114,7 +1114,7 @@ int ipu6_isys_fw_open(struct ipu6_isys *isys)*/ ipu6_cleanup_fw_msg_bufs (isys); -if (isys->fwcom) { +if (isys->fwctx) {/* * Something went wrong in previous shutdown. As we are now * restarting isys we can safely delete old context.
@@ -1147,7 +1147,7 @@ void ipu6_isys_fw_close(struct ipu6_isys *isys) isys->ref_count--;if (!isys->ref_count) {ipu6_fw_isys_close (isys); -if (isys->fwcom) { +if (isys->fwctx) { isys->need_reset = true;dev_warn (&isys->adev->auxdev.dev,"failed to close fw isys\n" );
drivers/media/pci/intel/ipu6/ipu6-isys.c +3 -3
@@ -1212,10 +1212,10 @@ static int isys_isr_one(struct ipu6_bus_device *adev)u32 index;u64 ts; -if (!isys->fwcom) +if (!isys->fwctx)return 1 ; - resp =ipu6_fw_isys_get_resp (isys->fwcom,IPU6_BASE_MSG_RECV_QUEUES ); + resp =ipu6_fw_isys_get_resp (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES );if (!resp)return 1 ;
@@ -1324,7 +1324,7 @@ static int isys_isr_one(struct ipu6_bus_device *adev)ipu6_isys_put_stream (stream); leave: -ipu6_fw_isys_put_resp (isys->fwcom,IPU6_BASE_MSG_RECV_QUEUES ); +ipu6_fw_isys_put_resp (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES );return 0 ; }
drivers/media/pci/intel/ipu6/ipu6-isys.h +2 -3
@@ -114,8 +114,7 @@ struct sensor_async_sd {* @csi2_rx_ctrl_cached: cached shared value between all CSI2 receivers * @streams_lock: serialise access to streams * @streams: streams per firmware stream ID -* @fwcom: fw communication layer private pointer -* or optional external library private pointer +* @fwctx: fw communication layer context pointer * @phy_termcal_val: the termination calibration value, only used for DWC PHY * @need_reset: Isys requires d0i0->i3 transition * @ref_count: total number of callers fw open
@@ -136,7 +135,7 @@ struct ipu6_isys {spinlock_t streams_lock;struct ipu6_isys_stream streams[IPU6_ISYS_MAX_STREAMS ];int streams_ref_count[IPU6_ISYS_MAX_STREAMS ]; -void *fwcom; +void *fwctx;u32 phy_termcal_val;bool need_reset;bool icache_prefetch;
Signature · 1 line
2.55.0
PATCH v2 3/44 media: ipu6: Rename buttress_ipc pointer
In reply to Antti LaaksoThe ipu6_buttress_ipc structure is called as cse sometimes, rename it to ipc for consistency.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 33 ++++++++++---------- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 2 +- drivers/media/pci/intel/ipu6/ipu6.c | 4 +-- 3 files changed, 20 insertions(+), 19 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +17 -16
@@ -221,7 +221,7 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp,unsigned long tx_timeout_jiffies, rx_timeout_jiffies;unsigned int i, retry =BUTTRESS_IPC_CMD_SEND_RETRY ;struct ipu6_buttress *b = &isp->buttress; -struct ipu6_buttress_ipc *ipc = &b->cse; +struct ipu6_buttress_ipc *ipc = &b->ipc;u32 val;int ret;int tout;
@@ -378,14 +378,15 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)if (irq_status &BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING ) {dev_dbg (&isp->pdev->dev,"BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING\n" ); -ipu6_buttress_ipc_recv (isp, &b->cse, &b->cse.recv_data); -complete (&b->cse.recv_complete); + +ipu6_buttress_ipc_recv (isp, &b->ipc, &b->ipc.recv_data); +complete (&b->ipc.recv_complete); }if (irq_status &BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE ) {dev_dbg (&isp->pdev->dev,"BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE\n" ); -complete (&b->cse.send_complete); +complete (&b->ipc.send_complete); } if (irq_status & BUTTRESS_ISR_SAI_VIOLATION &&
@@ -830,17 +831,17 @@ int ipu6_buttress_init(struct ipu6_device *isp)mutex_init (&b->auth_mutex);mutex_init (&b->cons_mutex);mutex_init (&b->ipc_mutex); -init_completion (&b->cse.send_complete); -init_completion (&b->cse.recv_complete); - - b->cse.nack =BUTTRESS_CSE2IUDATA0_IPC_NACK ; - b->cse.nack_mask =BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ; - b->cse.csr_in =BUTTRESS_REG_CSE2IUCSR ; - b->cse.csr_out =BUTTRESS_REG_IU2CSECSR ; - b->cse.db0_in =BUTTRESS_REG_CSE2IUDB0 ; - b->cse.db0_out =BUTTRESS_REG_IU2CSEDB0 ; - b->cse.data0_in =BUTTRESS_REG_CSE2IUDATA0 ; - b->cse.data0_out =BUTTRESS_REG_IU2CSEDATA0 ; +init_completion (&b->ipc.send_complete); +init_completion (&b->ipc.recv_complete); + + b->ipc.nack =BUTTRESS_CSE2IUDATA0_IPC_NACK ; + b->ipc.nack_mask =BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ; + b->ipc.csr_in =BUTTRESS_REG_CSE2IUCSR ; + b->ipc.csr_out =BUTTRESS_REG_IU2CSECSR ; + b->ipc.db0_in =BUTTRESS_REG_CSE2IUDB0 ; + b->ipc.db0_out =BUTTRESS_REG_IU2CSEDB0 ; + b->ipc.data0_in =BUTTRESS_REG_CSE2IUDATA0 ; + b->ipc.data0_out =BUTTRESS_REG_IU2CSEDATA0 ;INIT_LIST_HEAD (&b->constraints);
@@ -877,7 +878,7 @@ int ipu6_buttress_init(struct ipu6_device *isp)/* Retry couple of times in case of CSE initialization is delayed */ do { - ret = ipu6_buttress_ipc_reset(isp, &b->cse); + ret = ipu6_buttress_ipc_reset(isp, &b->ipc); if (ret) { dev_warn(&isp->pdev->dev, "IPC reset protocol failed, retrying\n");
drivers/media/pci/intel/ipu6/ipu6-buttress.h +1 -1
@@ -44,7 +44,7 @@ struct ipu6_buttress_ipc {struct ipu6_buttress {struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex; -struct ipu6_buttress_ipc cse; +struct ipu6_buttress_ipc ipc;struct list_head constraints;u32 wdt_cached_value;bool force_suspend;
drivers/media/pci/intel/ipu6/ipu6.c +2 -2
@@ -765,7 +765,7 @@ static int ipu6_resume(struct device *dev)ipu6_buttress_restore (isp); - ret =ipu6_buttress_ipc_reset (isp, &b->cse); + ret =ipu6_buttress_ipc_reset (isp, &b->ipc);if (ret)dev_err (&isp->pdev->dev,"IPC reset protocol failed!\n" );
@@ -797,7 +797,7 @@ static int ipu6_runtime_resume(struct device *dev)struct ipu6_buttress *b = &isp->buttress; isp->need_ipc_reset = false; - ret =ipu6_buttress_ipc_reset (isp, &b->cse); + ret =ipu6_buttress_ipc_reset (isp, &b->ipc);if (ret)dev_err (&isp->pdev->dev,"IPC reset protocol failed\n" ); }
Signature · 1 line
2.55.0
PATCH v2 4/44 media: ipu6: Remove duplicate warnings in cpd validation
In reply to Antti LaaksoSome of the error paths printed same or similar errors twice, once is enough.
--- drivers/media/pci/intel/ipu6/ipu6-cpd.c | 29 ++++++------------------- 1 file changed, 7 insertions(+), 22 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-cpd.c +7 -22
@@ -266,7 +266,6 @@ static int ipu6_cpd_validate_moduledata(struct ipu6_device *isp, u32 moduledata_size) {const struct ipu6_cpd_module_data_hdr *mod_hdr = moduledata; -int ret;/* Ensure moduledata hdr is within moduledata */ if (moduledata_size < sizeof(*mod_hdr) ||
@@ -276,15 +275,9 @@ static int ipu6_cpd_validate_moduledata(struct ipu6_device *isp, }dev_dbg (&isp->pdev->dev,"FW version: %x\n" , mod_hdr->fw_pkg_date); - ret =ipu6_cpd_validate_cpd (isp, moduledata + mod_hdr->hdr_len, - moduledata_size - mod_hdr->hdr_len, - moduledata_size); -if (ret) { -dev_err (&isp->pdev->dev,"Invalid CPD in moduledata\n" ); -return ret; - } - -return 0 ; +return ipu6_cpd_validate_cpd (isp, moduledata + mod_hdr->hdr_len, + moduledata_size - mod_hdr->hdr_len, + moduledata_size); } static int ipu6_cpd_validate_metadata(struct ipu6_device *isp,
@@ -325,10 +318,8 @@ int ipu6_cpd_validate_cpd_file(struct ipu6_device *isp, const void *cpd_file, ret =ipu6_cpd_validate_cpd (isp, cpd_file, cpd_file_size, cpd_file_size); -if (ret) { -dev_err (&isp->pdev->dev,"Invalid CPD in file\n" ); +if (ret)return ret; - }/* Check for CPD file marker */ if (hdr->hdr_mark !=CPD_HDR_MARK ) {
@@ -346,17 +337,11 @@ int ipu6_cpd_validate_cpd_file(struct ipu6_device *isp, const void *cpd_file,/* Validate metadata */ ent =ipu6_cpd_get_metadata (cpd_file); ret =ipu6_cpd_validate_metadata (isp, cpd_file + ent->offset, ent->len); -if (ret) { -dev_err (&isp->pdev->dev,"Invalid CPD metadata\n" ); +if (ret)return ret; - }/* Validate moduledata */ ent =ipu6_cpd_get_moduledata (cpd_file); - ret =ipu6_cpd_validate_moduledata (isp, cpd_file + ent->offset, - ent->len); -if (ret) -dev_err (&isp->pdev->dev,"Invalid CPD moduledata\n" ); - -return ret; +return ipu6_cpd_validate_moduledata (isp, cpd_file + ent->offset, + ent->len); }
Signature · 1 line
2.55.0
PATCH v2 5/44 media: ipu6: Remove unused ipu6 firmware struct
In reply to Antti LaaksoThe struct ipu6_fw_proxy_write_queue_token is not used anywhere, remove it.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 15 --------------- 1 file changed, 15 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.h +0 -15
@@ -511,21 +511,6 @@ struct ipu6_fw_isys_proxy_resp_info_abi {struct ipu6_fw_isys_proxy_error_info_abi error_info; }; -/** -* struct ipu6_fw_proxy_write_queue_token - ISYS proxy write queue token -* @request_id: update id for the specific proxy write request -* @region_index: Region id for the proxy write request -* @offset: Offset of the write request according to the base address -* of the region -* @value: Value that is requested to be written with the proxy write request -*/ -struct ipu6_fw_proxy_write_queue_token { -u32 request_id; -u32 region_index; -u32 offset; -u32 value; -}; -/** * struct ipu6_fw_resp_queue_token - ISYS response queue token * @resp_info: response info
Signature · 1 line
2.55.0
PATCH v2 6/44 media: ipu6: Cleanup ipu6_mmu_init()
In reply to Antti LaaksoThe struct ipu6_mmu_pdata is used only in ipu6_mmu_init(), and not really needed, remove it.
--- drivers/media/pci/intel/ipu6/ipu6-mmu.c | 13 ++++++------- drivers/media/pci/intel/ipu6/ipu6.h | 6 ------ 2 files changed, 6 insertions(+), 13 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-mmu.c +6 -7
@@ -750,27 +750,26 @@ struct ipu6_mmu *ipu6_mmu_init(struct device *dev, const struct ipu6_hw_variants *hw) {struct ipu6_device *isp =pci_get_drvdata (to_pci_dev (dev)); -struct ipu6_mmu_pdata *pdata; +struct ipu6_mmu_hw *mmu_hw;struct ipu6_mmu *mmu;unsigned int i;if (hw->nr_mmus >IPU6_MMU_MAX_DEVICES )return ERR_PTR (-EINVAL ); - pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); -if (!pdata) + mmu_hw =devm_kcalloc (dev,sizeof (*mmu_hw), hw->nr_mmus,GFP_KERNEL ); +if (!mmu_hw)return ERR_PTR (-ENOMEM );for (i =0 ; i < hw->nr_mmus; i++) { -struct ipu6_mmu_hw *pdata_mmu = &pdata->mmu_hw[i];const struct ipu6_mmu_hw *src_mmu = &hw->mmu_hw[i];if (src_mmu->nr_l1streams >IPU6_MMU_MAX_TLB_L1_STREAMS || src_mmu->nr_l2streams >IPU6_MMU_MAX_TLB_L2_STREAMS )return ERR_PTR (-EINVAL ); - *pdata_mmu = *src_mmu; - pdata_mmu->base = base + src_mmu->offset; + mmu_hw[i] = *src_mmu; + mmu_hw[i].base = base + src_mmu->offset; } mmu =devm_kzalloc (dev,sizeof (*mmu),GFP_KERNEL );
@@ -778,7 +777,7 @@ struct ipu6_mmu *ipu6_mmu_init(struct device *dev,return ERR_PTR (-ENOMEM ); mmu->mmid = mmid; - mmu->mmu_hw = pdata->mmu_hw; + mmu->mmu_hw = mmu_hw; mmu->nr_mmus = hw->nr_mmus; mmu->tlb_invalidate = tlb_invalidate; mmu->ready = false;
drivers/media/pci/intel/ipu6/ipu6.h +0 -6
@@ -239,12 +239,6 @@ struct ipu6_mmu_hw {bool insert_read_before_invalidate; }; -struct ipu6_mmu_pdata { -u32 nr_mmus; -struct ipu6_mmu_hw mmu_hw[IPU6_MMU_MAX_DEVICES ]; -int mmid; -}; -struct ipu6_isys_csi2_pdata {void __iomem *base; };
Signature · 1 line
2.55.0
PATCH v2 7/44 media: ipu6: Simplify firmware com arguments
In reply to Antti LaaksoWe need only pointer to ipu6_isys struct, and queue number can be removed as it is always the same.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 8 ++++---- drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 4 ++-- drivers/media/pci/intel/ipu6/ipu6-isys.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +4 -4
@@ -366,14 +366,14 @@ int ipu6_fw_isys_init(struct ipu6_isys *isys, unsigned int num_streams) }struct ipu6_fw_isys_resp_info_abi * -ipu6_fw_isys_get_resp (void *context,unsigned int queue) +ipu6_fw_isys_get_resp (struct ipu6_isys *isys) { -return ipu6_recv_get_token (context, queue); +return ipu6_recv_get_token (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES ); } -void ipu6_fw_isys_put_resp (void *context,unsigned int queue) +void ipu6_fw_isys_put_resp (struct ipu6_isys *isys) { -ipu6_recv_put_token (context, queue); +ipu6_recv_put_token (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES ); } void ipu6_fw_isys_dump_stream_cfg(struct device *dev,
drivers/media/pci/intel/ipu6/ipu6-fw-isys.h +2 -2
@@ -576,6 +576,6 @@ int ipu6_fw_isys_send_proxy_token(struct ipu6_isys *isys, unsigned int offset, u32 value);void ipu6_fw_isys_cleanup (struct ipu6_isys *isys);struct ipu6_fw_isys_resp_info_abi * -ipu6_fw_isys_get_resp (void *context,unsigned int queue); -void ipu6_fw_isys_put_resp (void *context,unsigned int queue); +ipu6_fw_isys_get_resp (struct ipu6_isys *isys); +void ipu6_fw_isys_put_resp (struct ipu6_isys *isys);#endif
drivers/media/pci/intel/ipu6/ipu6-isys.c +2 -2
@@ -1215,7 +1215,7 @@ static int isys_isr_one(struct ipu6_bus_device *adev)if (!isys->fwctx)return 1 ; - resp =ipu6_fw_isys_get_resp (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES ); + resp =ipu6_fw_isys_get_resp (isys);if (!resp)return 1 ;
@@ -1324,7 +1324,7 @@ static int isys_isr_one(struct ipu6_bus_device *adev)ipu6_isys_put_stream (stream); leave: -ipu6_fw_isys_put_resp (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES ); +ipu6_fw_isys_put_resp (isys);return 0 ; }
Signature · 1 line
2.55.0
PATCH v2 8/44 media: ipu6: Add helper to identify ipu7
In reply to Antti LaaksoThe ipu7 comes in two flavors as of now, ipu7 and ipu7p5.
--- drivers/media/pci/intel/ipu6/ipu6.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/pci/intel/ipu6/ipu6.h +6 -0
@@ -27,11 +27,17 @@ struct ipu6_bus_device;#define IPU_VERSION_6SE BIT(1)/* JSL */ #define IPU_VERSION_6EP BIT(2)/* ADL/RPL */ #define IPU_VERSION_6EP_MTL BIT(3)/* MTL */ +#define IPU_VERSION_7 BIT(4)/* LNL */ +#define IPU_VERSION_7P5 BIT(5)/* PTL */ #define IS_IPU6_TGL (isp) ((isp)->hw_ver & IPU_VERSION_6)#define IS_IPU6SE (isp) ((isp)->hw_ver & IPU_VERSION_6SE)#define IS_IPU6EP (isp) ((isp)->hw_ver & IPU_VERSION_6EP)#define IS_IPU6EP_MTL (isp) ((isp)->hw_ver & IPU_VERSION_6EP_MTL) +#define IS_IPU7 (isp) ((isp)->hw_ver & \ + (IPU_VERSION_7 | IPU_VERSION_7P5)) +#define IS_IPU7_MTL (isp) ((isp)->hw_ver & IPU_VERSION_7) +#define IS_IPU7P5 (isp) ((isp)->hw_ver & IPU_VERSION_7P5)/* * ISYS DMA can overshoot. For higher resolutions over allocation is one line
Signature · 1 line
2.55.0
PATCH v2 9/44 media: ipu6: Prepare buttress for ipu7 support
In reply to Antti LaaksoIntroduce a struct to hold buttress registers and bitmasks that vary across hardware versions beyond ipu6 to simplify support for future hardware versions.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 96 ++++++++++--------- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 25 +++++ .../intel/ipu6/ipu6-platform-buttress-regs.h | 2 +- drivers/media/pci/intel/ipu6/ipu6.c | 26 +++++ 4 files changed, 101 insertions(+), 48 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +49 -47
@@ -55,11 +55,6 @@#define BUTTRESS_MAX_CONSECUTIVE_IRQS 100 -static const u32 ipu6_adev_irq_mask[2 ] = { -BUTTRESS_ISR_IS_IRQ , -BUTTRESS_ISR_PS_IRQ -}; -int ipu6_buttress_ipc_reset (struct ipu6_device *isp,struct ipu6_buttress_ipc *ipc) {
@@ -337,7 +332,8 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)struct ipu6_device *isp = isp_ptr;struct ipu6_bus_device *adev[] = { isp->isys, isp->psys };struct ipu6_buttress *b = &isp->buttress; -u32 reg_irq_sts =BUTTRESS_REG_ISR_STATUS ; +const struct ipu6_buttress_registers *regs = b->regs; +const u32 adev_irq_mask[] = { regs->irq_is, regs->irq_ps };irqreturn_t ret =IRQ_NONE ;u32 disable_irqs =0 ;u32 irq_status;
@@ -348,7 +344,7 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)if (!active)return IRQ_NONE ; - irq_status =readl (isp->base + reg_irq_sts); + irq_status =readl (isp->base + regs->irq_status);if (irq_status ==0 ||WARN_ON_ONCE (irq_status ==0xffffffffu )) {if (active >0 )pm_runtime_put_noidle (&isp->pdev->dev);
@@ -356,26 +352,26 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr) } do { - writel(irq_status, isp->base + BUTTRESS_REG_ISR_CLEAR); + writel(irq_status, isp->base + regs->irq_clear); - for (i = 0; i < ARRAY_SIZE(ipu6_adev_irq_mask); i++) { + for (i = 0; i < ARRAY_SIZE(adev_irq_mask); i++) { irqreturn_t r = ipu6_buttress_call_isr(adev[i]); - if (!(irq_status & ipu6_adev_irq_mask[i])) + if (!(irq_status & adev_irq_mask[i])) continue; if (r == IRQ_WAKE_THREAD) { ret = IRQ_WAKE_THREAD; - disable_irqs |= ipu6_adev_irq_mask[i]; + disable_irqs |= adev_irq_mask[i]; } else if (ret == IRQ_NONE && r == IRQ_HANDLED) { ret = IRQ_HANDLED; } } - if ((irq_status & BUTTRESS_EVENT) && ret == IRQ_NONE) + if ((irq_status & regs->irq_events) && ret == IRQ_NONE) ret = IRQ_HANDLED; - if (irq_status & BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING) { + if (irq_status & regs->irq_cse_ipc) { dev_dbg(&isp->pdev->dev, "BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING\n");
@@ -383,13 +379,13 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)complete (&b->ipc.recv_complete); } -if (irq_status &BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE ) { +if (irq_status & regs->irq_exec_done) {dev_dbg (&isp->pdev->dev,"BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE\n" );complete (&b->ipc.send_complete); } -if (irq_status &BUTTRESS_ISR_SAI_VIOLATION && +if (irq_status & regs->irq_sai &&ipu6_buttress_get_secure_mode (isp))dev_err (&isp->pdev->dev,"BUTTRESS_ISR_SAI_VIOLATION\n" );
@@ -408,12 +404,12 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)break ; } - irq_status =readl (isp->base + reg_irq_sts); + irq_status =readl (isp->base + regs->irq_status); }while (irq_status);if (disable_irqs) -writel (BUTTRESS_IRQS & ~disable_irqs, - isp->base +BUTTRESS_REG_ISR_ENABLE ); +writel (regs->irq_all & ~disable_irqs, + isp->base + regs->irq_enable);if (active >0 )pm_runtime_put (&isp->pdev->dev);
@@ -424,12 +420,13 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)irqreturn_t ipu6_buttress_isr_threaded (int irq,void *isp_ptr) {struct ipu6_device *isp = isp_ptr; +const struct ipu6_buttress_registers *regs = isp->buttress.regs;struct ipu6_bus_device *adev[] = { isp->isys, isp->psys };const struct ipu6_auxdrv_data *drv_data =NULL ;irqreturn_t ret =IRQ_NONE ;unsigned int i; -for (i =0 ; i <ARRAY_SIZE (ipu6_adev_irq_mask) && adev[i]; i++) { +for (i =0 ; i <ARRAY_SIZE (adev) && adev[i]; i++) { drv_data = adev[i]->auxdrv_data;if (!drv_data)continue ;
@@ -439,7 +436,7 @@ irqreturn_t ipu6_buttress_isr_threaded(int irq, void *isp_ptr) ret =IRQ_HANDLED ; } -writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_ISR_ENABLE ); +writel (regs->irq_all, isp->base + regs->irq_enable);return ret; }
@@ -472,7 +469,7 @@ int ipu6_buttress_power(struct device *dev,writel (val, isp->base + ctrl->freq_ctl); - ret =readl_poll_timeout (isp->base +BUTTRESS_REG_PWR_STATE , + ret =readl_poll_timeout (isp->base + isp->buttress.regs->pwr_status, val, (val & ctrl->pwr_sts_mask) == pwr_sts,100 ,BUTTRESS_POWER_TIMEOUT_US );if (ret)
@@ -488,7 +485,7 @@ bool ipu6_buttress_get_secure_mode(struct ipu6_device *isp) {u32 val; - val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + val =readl (isp->base + isp->buttress.regs->security_ctl);return val &BUTTRESS_SECURITY_CTL_FW_SECURE_MODE ; }
@@ -500,7 +497,7 @@ bool ipu6_buttress_auth_done(struct ipu6_device *isp)if (!isp->secure_mode)return true; - val =readl (isp->base +BUTTRESS_REG_SECURITY_CTL ); + val =readl (isp->base + isp->buttress.regs->security_ctl); val =FIELD_GET (BUTTRESS_SECURITY_CTL_FW_SETUP_MASK , val);return val ==BUTTRESS_SECURITY_CTL_AUTH_DONE ;
@@ -518,10 +515,10 @@ int ipu6_buttress_reset_authentication(struct ipu6_device *isp) }writel (BUTTRESS_FW_RESET_CTL_START , isp->base + -BUTTRESS_REG_FW_RESET_CTL ); + isp->buttress.regs->fw_reset_ctl); - ret =readl_poll_timeout (isp->base +BUTTRESS_REG_FW_RESET_CTL , val, - val &BUTTRESS_FW_RESET_CTL_DONE ,500 , + ret =readl_poll_timeout (isp->base + isp->buttress.regs->fw_reset_ctl, + val, val &BUTTRESS_FW_RESET_CTL_DONE ,500 ,BUTTRESS_CSE_FWRESET_TIMEOUT_US );if (ret) { dev_err(&isp->pdev->dev,
@@ -530,7 +527,8 @@ int ipu6_buttress_reset_authentication(struct ipu6_device *isp) }dev_dbg (&isp->pdev->dev,"FW reset for authentication done\n" ); -writel (0 , isp->base +BUTTRESS_REG_FW_RESET_CTL ); +writel (0 , isp->base + isp->buttress.regs->fw_reset_ctl); +/* leave some time for HW restore */ usleep_range (800 ,1000 );
@@ -660,7 +658,7 @@ int ipu6_buttress_authenticate(struct ipu6_device *isp) mask =BUTTRESS_SECURITY_CTL_FW_SETUP_MASK ; done =BUTTRESS_SECURITY_CTL_FW_SETUP_DONE ; fail =BUTTRESS_SECURITY_CTL_AUTH_FAILED ; - ret =readl_poll_timeout (isp->base +BUTTRESS_REG_SECURITY_CTL , data, + ret =readl_poll_timeout (isp->base + b->regs->security_ctl, data, ((data & mask) == done || (data & mask) == fail),500 ,BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US );
@@ -700,7 +698,7 @@ int ipu6_buttress_authenticate(struct ipu6_device *isp) } done =BUTTRESS_SECURITY_CTL_AUTH_DONE ; - ret =readl_poll_timeout (isp->base +BUTTRESS_REG_SECURITY_CTL , data, + ret =readl_poll_timeout (isp->base + b->regs->security_ctl, data, ((data & mask) == done || (data & mask) == fail),500 ,BUTTRESS_CSE_AUTHENTICATE_TIMEOUT_US );
@@ -725,15 +723,16 @@ int ipu6_buttress_authenticate(struct ipu6_device *isp)static int ipu6_buttress_send_tsc_request (struct ipu6_device *isp) { +const struct ipu6_buttress_registers *regs = isp->buttress.regs;u32 val, mask, done;int ret; mask =BUTTRESS_PWR_STATE_HH_STATUS_MASK ;writel (BUTTRESS_FABRIC_CMD_START_TSC_SYNC , - isp->base +BUTTRESS_REG_FABRIC_CMD ); + isp->base + regs->fabric_cmd); - val =readl (isp->base +BUTTRESS_REG_PWR_STATE ); + val =readl (isp->base + regs->pwr_status); val =FIELD_GET (mask, val);if (val ==BUTTRESS_PWR_STATE_HH_STATE_ERR ) {dev_err (&isp->pdev->dev,"Start tsc sync failed\n" );
@@ -741,8 +740,8 @@ static int ipu6_buttress_send_tsc_request(struct ipu6_device *isp) } done =BUTTRESS_PWR_STATE_HH_STATE_DONE ; - ret =readl_poll_timeout (isp->base +BUTTRESS_REG_PWR_STATE , val, -FIELD_GET (mask, val) == done,500 , + ret =readl_poll_timeout (isp->base + regs->pwr_status, + val,FIELD_GET (mask, val) == done,500 ,BUTTRESS_TSC_SYNC_TIMEOUT_US );if (ret)dev_err (&isp->pdev->dev,"Start tsc sync timeout\n" );
@@ -762,11 +761,13 @@ int ipu6_buttress_start_tsc_sync(struct ipu6_device *isp)if (ret != -ETIMEDOUT )return ret; - val =readl (isp->base +BUTTRESS_REG_TSW_CTL ); +u32 tsw_ctl = isp->buttress.regs->tsw_ctl; + + val =readl (isp->base + tsw_ctl); val = val |BUTTRESS_TSW_CTL_SOFT_RESET ; -writel (val, isp->base +BUTTRESS_REG_TSW_CTL ); +writel (val, isp->base + tsw_ctl); val = val & ~BUTTRESS_TSW_CTL_SOFT_RESET ; -writel (val, isp->base +BUTTRESS_REG_TSW_CTL ); +writel (val, isp->base + tsw_ctl); }dev_err (&isp->pdev->dev,"TSC sync failed (timeout)\n" );
@@ -777,13 +778,14 @@ EXPORT_SYMBOL_NS_GPL(ipu6_buttress_start_tsc_sync, "INTEL_IPU6");void ipu6_buttress_tsc_read (struct ipu6_device *isp,u64 *val) { +void __iomem *tsc = isp->base + isp->buttress.regs->tsc_lo;u32 tsc_hi_1, tsc_hi_2, tsc_lo;unsigned long flags;local_irq_save (flags); - tsc_hi_1 =readl (isp->base +BUTTRESS_REG_TSC_HI ); - tsc_lo =readl (isp->base +BUTTRESS_REG_TSC_LO ); - tsc_hi_2 =readl (isp->base +BUTTRESS_REG_TSC_HI ); + tsc_hi_1 =readl (tsc +BUTTRESS_TSC_HI_OFFSET ); + tsc_lo =readl (tsc); + tsc_hi_2 =readl (tsc +BUTTRESS_TSC_HI_OFFSET );if (tsc_hi_1 == tsc_hi_2) { *val = (u64 )tsc_hi_1 <<32 | tsc_lo; }else {
@@ -816,9 +818,9 @@ void ipu6_buttress_restore(struct ipu6_device *isp) {struct ipu6_buttress *b = &isp->buttress; -writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_ISR_CLEAR ); -writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_ISR_ENABLE ); -writel (b->wdt_cached_value, isp->base +BUTTRESS_REG_WDT ); +writel (b->regs->irq_all, isp->base + b->regs->irq_clear); +writel (b->regs->irq_all, isp->base + b->regs->irq_enable); +writel (b->wdt_cached_value, isp->base + b->regs->wdt); }int ipu6_buttress_init (struct ipu6_device *isp)
@@ -851,12 +853,12 @@ int ipu6_buttress_init(struct ipu6_device *isp)readl (isp->base +BUTTRESS_REG_SECURITY_TOUCH ), readl(isp->base + BUTTRESS_REG_CAMERA_MASK)); - b->wdt_cached_value =readl (isp->base +BUTTRESS_REG_WDT ); -writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_ISR_CLEAR ); -writel (BUTTRESS_IRQS , isp->base +BUTTRESS_REG_ISR_ENABLE ); + b->wdt_cached_value =readl (isp->base + b->regs->wdt); +writel (b->regs->irq_all, isp->base + b->regs->irq_clear); +writel (b->regs->irq_all, isp->base + b->regs->irq_enable);/* get ref_clk frequency by reading the indication in btrs control */ - val =readl (isp->base +BUTTRESS_REG_BTRS_CTRL ); + val =readl (isp->base + b->regs->btrs_ctrl); val =FIELD_GET (BUTTRESS_REG_BTRS_CTRL_REF_CLK_IND , val);switch (val) {
@@ -902,7 +904,7 @@ void ipu6_buttress_exit(struct ipu6_device *isp) {struct ipu6_buttress *b = &isp->buttress; -writel (0 , isp->base +BUTTRESS_REG_ISR_ENABLE ); +writel (0 , isp->base + b->regs->irq_enable);mutex_destroy (&b->power_mutex);mutex_destroy (&b->auth_mutex);
drivers/media/pci/intel/ipu6/ipu6-buttress.h +25 -0
@@ -42,9 +42,34 @@ struct ipu6_buttress_ipc {u32 data0_in; }; +struct ipu6_buttress_registers { +/* Registers */ +u32 irq_status; +u32 irq_clear; +u32 irq_enable; +u32 pwr_status; +u32 security_ctl; +u32 fw_reset_ctl; +u32 fabric_cmd; +u32 tsw_ctl; +u32 tsc_lo; +u32 wdt; +u32 btrs_ctrl; + +/* Bitmasks */ +u32 irq_is; +u32 irq_ps; +u32 irq_all; +u32 irq_events; +u32 irq_cse_ipc; +u32 irq_exec_done; +u32 irq_sai; +}; +struct ipu6_buttress {struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex;struct ipu6_buttress_ipc ipc; +const struct ipu6_buttress_registers *regs;struct list_head constraints;u32 wdt_cached_value;bool force_suspend;
drivers/media/pci/intel/ipu6/ipu6-platform-buttress-regs.h +1 -1
@@ -212,7 +212,7 @@ enum {#define BUTTRESS_TSW_CTL_SOFT_RESET BIT(8)#define BUTTRESS_REG_TSC_LO 0x164 -#define BUTTRESS_REG_TSC_HI 0x168 +#define BUTTRESS_TSC_HI_OFFSET 4#define BUTTRESS_IRQS (BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING | \ BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE | \
drivers/media/pci/intel/ipu6/ipu6.c +26 -0
@@ -228,6 +228,30 @@ static const struct ipu6_buttress_ctrl psys_buttress_ctrl = { .pwr_sts_off = IPU6_BUTTRESS_PWR_STATE_DN_DONE, }; +static const struct ipu6_buttress_registers ipu6_buttress_regs = { +/* Registers */ + .irq_status =BUTTRESS_REG_ISR_STATUS , + .irq_clear =BUTTRESS_REG_ISR_CLEAR , + .irq_enable =BUTTRESS_REG_ISR_ENABLE , + .pwr_status =BUTTRESS_REG_PWR_STATE , + .security_ctl =BUTTRESS_REG_SECURITY_CTL , + .fw_reset_ctl =BUTTRESS_REG_FW_RESET_CTL , + .fabric_cmd =BUTTRESS_REG_FABRIC_CMD , + .tsw_ctl =BUTTRESS_REG_TSW_CTL , + .tsc_lo =BUTTRESS_REG_TSC_LO , + .wdt =BUTTRESS_REG_WDT , + .btrs_ctrl =BUTTRESS_REG_BTRS_CTRL , + +/* Bitmasks */ + .irq_is =BUTTRESS_ISR_IS_IRQ , + .irq_ps =BUTTRESS_ISR_PS_IRQ , + .irq_all =BUTTRESS_IRQS , + .irq_events =BUTTRESS_EVENT , + .irq_cse_ipc =BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING , + .irq_exec_done =BUTTRESS_ISR_IPC_EXEC_DONE_BY_CSE , + .irq_sai =BUTTRESS_ISR_SAI_VIOLATION , +}; + static void ipu6_pkg_dir_configure_spc(struct ipu6_device *isp, const struct ipu6_hw_variants *hw_variant,
@@ -522,6 +546,8 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_master (pdev); isp->cpd_metadata_cmpnt_size =sizeof (struct ipu6_cpd_metadata_cmpnt ); + isp->buttress.regs = &ipu6_buttress_regs; +switch (id->device) {case PCI_DEVICE_ID_INTEL_IPU6 : isp->hw_ver =IPU_VERSION_6 ;
Signature · 1 line
2.55.0
PATCH v2 10/44 media: ipu6: Use single struct for registers
In reply to Antti LaaksoMove register values from ipu6_buttress_ipc struct to ipu6_buttress_registers as these are different in future hardware versions as well.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 86 +++++++++----------- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 17 ++-- drivers/media/pci/intel/ipu6/ipu6.c | 13 +-- 3 files changed, 54 insertions(+), 62 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +39 -47
@@ -55,11 +55,11 @@#define BUTTRESS_MAX_CONSECUTIVE_IRQS 100 -int ipu6_buttress_ipc_reset (struct ipu6_device *isp, -struct ipu6_buttress_ipc *ipc) +int ipu6_buttress_ipc_reset (struct ipu6_device *isp) {unsigned int retries =BUTTRESS_IPC_RESET_RETRY ;struct ipu6_buttress *b = &isp->buttress; +const struct ipu6_buttress_registers *regs = b->regs;u32 val =0 , csr_in_clr;if (!isp->secure_mode) {
@@ -70,11 +70,11 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,mutex_lock (&b->ipc_mutex);/* Clear-by-1 CSR (all bits), corresponding internal states. */ - val =readl (isp->base + ipc->csr_in); -writel (val, isp->base + ipc->csr_in); + val =readl (isp->base + regs->csr_in); +writel (val, isp->base + regs->csr_in);/* Set peer CSR bit IPC_PEER_COMP_ACTIONS_RST_PHASE1 */ -writel (ENTRY , isp->base + ipc->csr_out); +writel (ENTRY , isp->base + regs->csr_out);/* * Clear-by-1 all CSR bits EXCEPT following * bits:
@@ -89,7 +89,7 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp, do { usleep_range(400, 500); - val = readl(isp->base + ipc->csr_in); + val = readl(isp->base + regs->csr_in); switch (val) { case ENTRY | EXIT: case ENTRY | EXIT | QUERY:
@@ -100,8 +100,8 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,* 2) Set peer CSR bit * IPC_PEER_QUERIED_IP_COMP_ACTIONS_RST_PHASE. */ -writel (ENTRY |EXIT , isp->base + ipc->csr_in); -writel (QUERY , isp->base + ipc->csr_out); +writel (ENTRY |EXIT , isp->base + regs->csr_in); +writel (QUERY , isp->base + regs->csr_out);break ;case ENTRY :case ENTRY |QUERY :
@@ -112,8 +112,8 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,* 2) Set peer CSR bit * IPC_PEER_COMP_ACTIONS_RST_PHASE1. */ -writel (ENTRY |QUERY , isp->base + ipc->csr_in); -writel (ENTRY , isp->base + ipc->csr_out); +writel (ENTRY |QUERY , isp->base + regs->csr_in); +writel (ENTRY , isp->base + regs->csr_out);break ;case EXIT :case EXIT |QUERY :
@@ -130,17 +130,17 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,* 3) Set peer CSR bit * IPC_PEER_COMP_ACTIONS_RST_PHASE2. */ -writel (EXIT , isp->base + ipc->csr_in); -writel (0 , isp->base + ipc->db0_in); -writel (csr_in_clr, isp->base + ipc->csr_in); -writel (EXIT , isp->base + ipc->csr_out); +writel (EXIT , isp->base + regs->csr_in); +writel (0 , isp->base + regs->db0_in); +writel (csr_in_clr, isp->base + regs->csr_in); +writel (EXIT , isp->base + regs->csr_out);/* * Read csr_in again to make sure if RST_PHASE2 is done. * If csr_in is QUERY, it should be handled again. */ usleep_range (200 ,300 ); - val =readl (isp->base + ipc->csr_in); + val =readl (isp->base + regs->csr_in);if (val &QUERY ) {dev_dbg (&isp->pdev->dev,"RST_PHASE2 retry csr_in = %x\n" , val);
@@ -155,8 +155,8 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,* 2) Set peer CSR bit * IPC_PEER_COMP_ACTIONS_RST_PHASE1 */ -writel (QUERY , isp->base + ipc->csr_in); -writel (ENTRY , isp->base + ipc->csr_out); +writel (QUERY , isp->base + regs->csr_in); +writel (ENTRY , isp->base + regs->csr_out);break ;default : dev_dbg_ratelimited(&isp->pdev->dev,
@@ -171,42 +171,42 @@ int ipu6_buttress_ipc_reset(struct ipu6_device *isp,return -ETIMEDOUT ; } -static void ipu6_buttress_ipc_validity_close (struct ipu6_device *isp, -struct ipu6_buttress_ipc *ipc) +static void ipu6_buttress_ipc_validity_close (struct ipu6_device *isp) {writel (BUTTRESS_IU2CSECSR_IPC_PEER_DEASSERTED_REG_VALID_REQ , - isp->base + ipc->csr_out); + isp->base + isp->buttress.regs->csr_out); }static int -ipu6_buttress_ipc_validity_open (struct ipu6_device *isp, -struct ipu6_buttress_ipc *ipc) +ipu6_buttress_ipc_validity_open (struct ipu6_device *isp) {unsigned int mask =BUTTRESS_IU2CSECSR_IPC_PEER_ACKED_REG_VALID ; +const struct ipu6_buttress_registers *regs = isp->buttress.regs;void __iomem *addr;int ret;u32 val;writel (BUTTRESS_IU2CSECSR_IPC_PEER_ASSERTED_REG_VALID_REQ , - isp->base + ipc->csr_out); + isp->base + regs->csr_out); - addr = isp->base + ipc->csr_in; + addr = isp->base + regs->csr_in; ret =readl_poll_timeout (addr, val, val & mask,200 ,BUTTRESS_IPC_VALIDITY_TIMEOUT_US );if (ret) {dev_err (&isp->pdev->dev,"CSE validity timeout 0x%x\n" , val); -ipu6_buttress_ipc_validity_close (isp, ipc); +ipu6_buttress_ipc_validity_close (isp); }return ret; } -static void ipu6_buttress_ipc_recv (struct ipu6_device *isp, -struct ipu6_buttress_ipc *ipc,u32 *ipc_msg) +static void ipu6_buttress_ipc_recv (struct ipu6_device *isp,u32 *ipc_msg) { +const struct ipu6_buttress_registers *regs = isp->buttress.regs; +if (ipc_msg) - *ipc_msg =readl (isp->base + ipc->data0_in); -writel (0 , isp->base + ipc->db0_in); + *ipc_msg =readl (isp->base + regs->data0_in); +writel (0 , isp->base + regs->db0_in); } static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp,
@@ -217,13 +217,14 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp,unsigned int i, retry =BUTTRESS_IPC_CMD_SEND_RETRY ;struct ipu6_buttress *b = &isp->buttress;struct ipu6_buttress_ipc *ipc = &b->ipc; +const struct ipu6_buttress_registers *regs = b->regs;u32 val;int ret;int tout;mutex_lock (&b->ipc_mutex); - ret =ipu6_buttress_ipc_validity_open (isp, ipc); + ret =ipu6_buttress_ipc_validity_open (isp);if (ret) {dev_err (&isp->pdev->dev,"IPC validity open failed\n" ); goto out;
@@ -239,9 +240,9 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp,dev_dbg (&isp->pdev->dev,"bulk IPC command: 0x%x\n" , msgs[i].cmd); -writel (msgs[i].cmd, isp->base + ipc->data0_out); +writel (msgs[i].cmd, isp->base + regs->data0_out); val =BUTTRESS_IU2CSEDB0_BUSY | msgs[i].cmd_size; -writel (val, isp->base + ipc->db0_out); +writel (val, isp->base + regs->db0_out); tout =wait_for_completion_timeout (&ipc->send_complete, tx_timeout_jiffies);
@@ -253,7 +254,7 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp, }/* Try again if CSE is not responding on first try */ -writel (0 , isp->base + ipc->db0_out); +writel (0 , isp->base + regs->db0_out); i--;continue ; }
@@ -271,8 +272,8 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp, goto out; } -if (ipc->nack_mask && - (ipc->recv_data & ipc->nack_mask) == ipc->nack) { +if ((ipc->recv_data &BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ) == +BUTTRESS_CSE2IUDATA0_IPC_NACK ) {dev_err (&isp->pdev->dev,"IPC NACK for cmd 0x%x\n" , msgs[i].cmd); ret = -EIO ;
@@ -291,7 +292,7 @@ static int ipu6_buttress_ipc_send_bulk(struct ipu6_device *isp,dev_dbg (&isp->pdev->dev,"bulk IPC commands done\n" ); out: -ipu6_buttress_ipc_validity_close (isp, ipc); +ipu6_buttress_ipc_validity_close (isp);mutex_unlock (&b->ipc_mutex);return ret; }
@@ -375,7 +376,7 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)dev_dbg (&isp->pdev->dev,"BUTTRESS_ISR_IPC_FROM_CSE_IS_WAITING\n" ); -ipu6_buttress_ipc_recv (isp, &b->ipc, &b->ipc.recv_data); +ipu6_buttress_ipc_recv (isp, &b->ipc.recv_data);complete (&b->ipc.recv_complete); }
@@ -836,15 +837,6 @@ int ipu6_buttress_init(struct ipu6_device *isp)init_completion (&b->ipc.send_complete);init_completion (&b->ipc.recv_complete); - b->ipc.nack =BUTTRESS_CSE2IUDATA0_IPC_NACK ; - b->ipc.nack_mask =BUTTRESS_CSE2IUDATA0_IPC_NACK_MASK ; - b->ipc.csr_in =BUTTRESS_REG_CSE2IUCSR ; - b->ipc.csr_out =BUTTRESS_REG_IU2CSECSR ; - b->ipc.db0_in =BUTTRESS_REG_CSE2IUDB0 ; - b->ipc.db0_out =BUTTRESS_REG_IU2CSEDB0 ; - b->ipc.data0_in =BUTTRESS_REG_CSE2IUDATA0 ; - b->ipc.data0_out =BUTTRESS_REG_IU2CSEDATA0 ; -INIT_LIST_HEAD (&b->constraints); isp->secure_mode =ipu6_buttress_get_secure_mode (isp);
@@ -880,7 +872,7 @@ int ipu6_buttress_init(struct ipu6_device *isp)/* Retry couple of times in case of CSE initialization is delayed */ do { - ret = ipu6_buttress_ipc_reset(isp, &b->ipc); + ret = ipu6_buttress_ipc_reset(isp); if (ret) { dev_warn(&isp->pdev->dev, "IPC reset protocol failed, retrying\n");
drivers/media/pci/intel/ipu6/ipu6-buttress.h +7 -10
@@ -31,15 +31,7 @@ struct ipu6_buttress_ctrl {struct ipu6_buttress_ipc {struct completion send_complete;struct completion recv_complete; -u32 nack; -u32 nack_mask;u32 recv_data; -u32 csr_out; -u32 csr_in; -u32 db0_in; -u32 db0_out; -u32 data0_out; -u32 data0_in; };struct ipu6_buttress_registers {
@@ -55,6 +47,12 @@ struct ipu6_buttress_registers {u32 tsc_lo;u32 wdt;u32 btrs_ctrl; +u32 csr_in; +u32 csr_out; +u32 db0_in; +u32 db0_out; +u32 data0_in; +u32 data0_out;/* Bitmasks */ u32 irq_is;
@@ -83,8 +81,7 @@ struct ipu6_ipc_buttress_bulk_msg {u8 cmd_size; }; -int ipu6_buttress_ipc_reset (struct ipu6_device *isp, -struct ipu6_buttress_ipc *ipc); +int ipu6_buttress_ipc_reset (struct ipu6_device *isp);int ipu6_buttress_map_fw_image (struct ipu6_bus_device *sys,const struct firmware *fw,struct sg_table *sgt);
drivers/media/pci/intel/ipu6/ipu6.c +8 -5
@@ -241,6 +241,12 @@ static const struct ipu6_buttress_registers ipu6_buttress_regs = { .tsc_lo = BUTTRESS_REG_TSC_LO, .wdt = BUTTRESS_REG_WDT, .btrs_ctrl = BUTTRESS_REG_BTRS_CTRL, + .csr_in = BUTTRESS_REG_CSE2IUCSR, + .csr_out = BUTTRESS_REG_IU2CSECSR, + .db0_in = BUTTRESS_REG_CSE2IUDB0, + .db0_out = BUTTRESS_REG_IU2CSEDB0, + .data0_in = BUTTRESS_REG_CSE2IUDATA0, + .data0_out = BUTTRESS_REG_IU2CSEDATA0,/* Bitmasks */ .irq_is = BUTTRESS_ISR_IS_IRQ,
@@ -779,7 +785,6 @@ static int ipu6_resume(struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);struct ipu6_device *isp =pci_get_drvdata (pdev); -struct ipu6_buttress *b = &isp->buttress;int ret;/* Configure the arbitration mechanisms for VC requests */
@@ -791,7 +796,7 @@ static int ipu6_resume(struct device *dev)ipu6_buttress_restore (isp); - ret =ipu6_buttress_ipc_reset (isp, &b->ipc); + ret =ipu6_buttress_ipc_reset (isp);if (ret)dev_err (&isp->pdev->dev,"IPC reset protocol failed!\n" );
@@ -820,10 +825,8 @@ static int ipu6_runtime_resume(struct device *dev)ipu6_buttress_restore (isp);if (isp->need_ipc_reset) { -struct ipu6_buttress *b = &isp->buttress; - isp->need_ipc_reset = false; - ret =ipu6_buttress_ipc_reset (isp, &b->ipc); + ret =ipu6_buttress_ipc_reset (isp);if (ret)dev_err (&isp->pdev->dev,"IPC reset protocol failed\n" ); }
Signature · 1 line
2.55.0
PATCH v2 11/44 media: ipu6: Rename IPU subsys ID
In reply to Antti LaaksoWe will need subsys ID later elsewhere, so move it to common header too.
--- drivers/media/pci/intel/ipu6/ipu6-mmu.h | 3 --- drivers/media/pci/intel/ipu6/ipu6.c | 5 ++--- drivers/media/pci/intel/ipu6/ipu6.h | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-mmu.h +0 -3
@@ -4,9 +4,6 @@#ifndef IPU6_MMU_H #define IPU6_MMU_H -#define ISYS_MMID 1 -#define PSYS_MMID 0 -#include <linux/list.h> #include <linux/spinlock_types.h> #include <linux/types.h>
drivers/media/pci/intel/ipu6/ipu6.c +2 -3
@@ -424,8 +424,7 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent, "ipu6_bus_initialize_device isys failed\n"); } - isys_adev->mmu =ipu6_mmu_init (dev, base,ISYS_MMID , - &ipdata->hw_variant); + isys_adev->mmu =ipu6_mmu_init (dev, base,IPU_ISYS , &ipdata->hw_variant);if (IS_ERR (isys_adev->mmu)) {put_device (&isys_adev->auxdev.dev); return dev_err_cast_probe(dev, isys_adev->mmu,
@@ -465,7 +464,7 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent, "ipu6_bus_initialize_device psys failed\n"); } - psys_adev->mmu =ipu6_mmu_init (&pdev->dev, base,PSYS_MMID , + psys_adev->mmu =ipu6_mmu_init (&pdev->dev, base,IPU_PSYS , &ipdata->hw_variant);if (IS_ERR (psys_adev->mmu)) {put_device (&psys_adev->auxdev.dev);
drivers/media/pci/intel/ipu6/ipu6.h +3 -0
@@ -70,6 +70,9 @@ struct ipu6_device {bool bus_ready_to_probe; }; +#define IPU_PSYS 0 +#define IPU_ISYS 1 +#define IPU6_ISYS_NAME "isys"#define IPU6_PSYS_NAME "psys"
Signature · 1 line
2.55.0
PATCH v2 12/44 media: ipu6: Add ipu7 buttress support
In reply to Antti LaaksoThe ipu7 differs from ipu6 e.g. in power management, authentication, interrupt handling and clock setup. Add support for ipu7 buttress.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 292 +++++++++++++++--- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 3 + .../intel/ipu6/ipu6-platform-buttress-regs.h | 102 ++++++ drivers/media/pci/intel/ipu6/ipu6.c | 104 +++++-- drivers/media/pci/intel/ipu6/ipu6.h | 2 + include/media/ipu6-pci-table.h | 2 + 6 files changed, 444 insertions(+), 61 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +249 -43
@@ -345,6 +345,13 @@ irqreturn_t ipu6_buttress_isr(int irq, void *isp_ptr)if (!active)return IRQ_NONE ; +if (IS_IPU7 (isp)) { +u32 pb_irq; + + pb_irq =readl (isp->pb_base +IPU7_PB_INTERRUPT_STATUS ); +writel (pb_irq, isp->pb_base +IPU7_PB_INTERRUPT_STATUS ); + } + irq_status =readl (isp->base + regs->irq_status);if (irq_status ==0 ||WARN_ON_ONCE (irq_status ==0xffffffffu )) {if (active >0 )
@@ -442,28 +449,141 @@ irqreturn_t ipu6_buttress_isr_threaded(int irq, void *isp_ptr)return ret; } -int ipu6_buttress_power (struct device *dev, -const struct ipu6_buttress_ctrl *ctrl,bool on) +static int ipu7_isys_d2d_power (struct ipu6_device *isp,bool on) +{ +u32 target = on ?IPU7_BUTTRESS_D2D_PWR_ACK :0U ; +u32 val; +int ret; + + val =readl (isp->base +IPU7_BUTTRESS_REG_D2D_CTL ); +if ((val &IPU7_BUTTRESS_D2D_PWR_ACK ) == target) +return 0 ; + +if (on) + val |=IPU7_BUTTRESS_D2D_PWR_EN ; +else + val &= ~IPU7_BUTTRESS_D2D_PWR_EN ; +writel (val, isp->base +IPU7_BUTTRESS_REG_D2D_CTL ); + + ret =readl_poll_timeout (isp->base +IPU7_BUTTRESS_REG_D2D_CTL , val, + (val &IPU7_BUTTRESS_D2D_PWR_ACK ) == target, +100 ,BUTTRESS_POWER_TIMEOUT_US ); +if (ret) +dev_err (&isp->pdev->dev,"D2D power %s timeout: 0x%x\n" , + on ?"up" :"down" , val); + +return ret; +} + +static void ipu7_nde_control (struct ipu6_device *isp,bool on) +{ +u32 val; + + val =FIELD_PREP (IPU7_NDE_VAL_MASK , + on ?IPU7_NDE_VAL_ACTIVE :IPU7_NDE_VAL_DEFAULT ) | +FIELD_PREP (IPU7_NDE_SCALE_MASK , + on ?IPU7_NDE_SCALE_ACTIVE :IPU7_NDE_SCALE_DEFAULT ) | +FIELD_PREP (IPU7_NDE_VALID_MASK , + on ?IPU7_NDE_VALID_ACTIVE :IPU7_NDE_VALID_DEFAULT ) | +FIELD_PREP (IPU7_NDE_RESVEC_MASK ,IPU7_NDE_RESVEC ); +writel (val, isp->base +IPU7_BUTTRESS_REG_NDE_CONTROL ); +} + +static int __ipu7_power_on (struct device *dev, +const struct ipu6_buttress_ctrl *ctrl) +{ +struct ipu6_device *isp =to_ipu6_bus_device (dev)->isp; +bool is_isys = ctrl->subsys_id ==IPU_ISYS ; +u32 pwr_sts, val, ovrd_clk, slp, own_clk_ack; +int ret; + + val = ctrl->ratio | (IPU7_FREQ_CTL_CDYN <<IPU7_FREQ_CTL_CDYN_SHIFT ); + pwr_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; + +if (is_isys) { + ret =ipu7_isys_d2d_power (isp, true); +if (ret) +return ret; + +ipu7_nde_control (isp, true); + } + +/* Request clock ownership. */ + ovrd_clk = is_isys ?IPU7_BUTTRESS_OVERRIDE_IS_CLK : +IPU7_BUTTRESS_OVERRIDE_PS_CLK ; + + slp =readl (isp->base +IPU7_BUTTRESS_REG_SLEEP_LEVEL_CFG ); +writel (slp | ovrd_clk, isp->base +IPU7_BUTTRESS_REG_SLEEP_LEVEL_CFG ); + + own_clk_ack = is_isys ?IPU7_BUTTRESS_OWN_ACK_IS_CLK : +IPU7_BUTTRESS_OWN_ACK_PS_CLK ; + ret =readl_poll_timeout (isp->base +IPU7_BUTTRESS_REG_SLEEP_LEVEL_STS , + slp, (slp & own_clk_ack), +100 ,BUTTRESS_POWER_TIMEOUT_US ); +if (ret) +dev_warn (&isp->pdev->dev,"clock ownership timeout: 0x%x\n" , + slp); + +writel (val, isp->base + ctrl->freq_ctl); + + ret =readl_poll_timeout (isp->base + isp->buttress.regs->pwr_status, + val, (val & ctrl->pwr_sts_mask) == pwr_sts, +100 ,BUTTRESS_POWER_TIMEOUT_US ); +if (ret) { +dev_err (&isp->pdev->dev, +"Change power status timeout with 0x%x\n" , val); +return ret; + } + + slp =readl (isp->base +IPU7_BUTTRESS_REG_SLEEP_LEVEL_CFG ); +writel (slp & ~ovrd_clk, isp->base +IPU7_BUTTRESS_REG_SLEEP_LEVEL_CFG ); + +return 0 ; +} + +static int __ipu7_power_off (struct device *dev, +const struct ipu6_buttress_ctrl *ctrl) {struct ipu6_device *isp =to_ipu6_bus_device (dev)->isp;u32 pwr_sts, val;int ret; -if (!ctrl) -return 0 ; +writel (0x8U , isp->base + ctrl->freq_ctl); -mutex_lock (&isp->buttress.power_mutex); + pwr_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; + ret =readl_poll_timeout (isp->base + isp->buttress.regs->pwr_status, + val, (val & ctrl->pwr_sts_mask) == pwr_sts, +100 ,BUTTRESS_POWER_TIMEOUT_US ); +if (ret) { +dev_err (&isp->pdev->dev, +"Change power status timeout with 0x%x\n" , val); +return ret; + } + +if (ctrl->subsys_id ==IPU_ISYS ) { +ipu7_isys_d2d_power (isp, false); +ipu7_nde_control (isp, false); + } + +return 0 ; +} + +static int __ipu6_power (struct device *dev, +const struct ipu6_buttress_ctrl *ctrl,bool on) +{ +struct ipu6_device *isp =to_ipu6_bus_device (dev)->isp; +u32 pwr_sts, val; +int ret;if (!on) { val =0 ; pwr_sts = ctrl->pwr_sts_off << ctrl->pwr_sts_shift; }else { val =BUTTRESS_FREQ_CTL_START | -FIELD_PREP (BUTTRESS_FREQ_CTL_RATIO_MASK , - ctrl->ratio) | -FIELD_PREP (BUTTRESS_FREQ_CTL_QOS_FLOOR_MASK , - ctrl->qos_floor) | -BUTTRESS_FREQ_CTL_ICCMAX_LEVEL ; +FIELD_PREP (BUTTRESS_FREQ_CTL_RATIO_MASK , ctrl->ratio) | +FIELD_PREP (BUTTRESS_FREQ_CTL_QOS_FLOOR_MASK , + ctrl->qos_floor) | +BUTTRESS_FREQ_CTL_ICCMAX_LEVEL ; pwr_sts = ctrl->pwr_sts_on << ctrl->pwr_sts_shift; }
@@ -477,6 +597,26 @@ int ipu6_buttress_power(struct device *dev,dev_err (&isp->pdev->dev,"Change power status timeout with 0x%x\n" , val); +return ret; +} + +int ipu6_buttress_power (struct device *dev, +const struct ipu6_buttress_ctrl *ctrl,bool on) +{ +struct ipu6_device *isp =to_ipu6_bus_device (dev)->isp; +int ret; + +if (!ctrl) +return 0 ; + +mutex_lock (&isp->buttress.power_mutex); + +if (IS_IPU7 (isp)) + ret = on ?__ipu7_power_on (dev, ctrl) : +__ipu7_power_off (dev, ctrl); +else + ret =__ipu6_power (dev, ctrl, on); +mutex_unlock (&isp->buttress.power_mutex);return ret;
@@ -634,11 +774,18 @@ int ipu6_buttress_authenticate(struct ipu6_device *isp)* Write address of FIT table to FW_SOURCE register * Let's use fw address. I.e. not using FIT table yet */ - data =lower_32_bits (isp->psys->pkg_dir_dma_addr); -writel (data, isp->base +BUTTRESS_REG_FW_SOURCE_BASE_LO ); +if (IS_IPU7 (isp)) { +writel (isp->cpd_fw->size, + isp->base +IPU7_BUTTRESS_REG_FW_SOURCE_SIZE ); +writel (sg_dma_address (isp->psys->fw_sgt.sgl), + isp->base +IPU7_BUTTRESS_REG_FW_SOURCE_BASE ); + }else { + data =lower_32_bits (isp->psys->pkg_dir_dma_addr); +writel (data, isp->base +BUTTRESS_REG_FW_SOURCE_BASE_LO ); - data =upper_32_bits (isp->psys->pkg_dir_dma_addr); -writel (data, isp->base +BUTTRESS_REG_FW_SOURCE_BASE_HI ); + data =upper_32_bits (isp->psys->pkg_dir_dma_addr); +writel (data, isp->base +BUTTRESS_REG_FW_SOURCE_BASE_HI ); + }/* * Write boot_load into IU2CSEDATA0
@@ -674,8 +821,11 @@ int ipu6_buttress_authenticate(struct ipu6_device *isp) goto out_unlock; } - ret =readl_poll_timeout (psys_pdata->base +BOOTLOADER_STATUS_OFFSET , - data, data ==BOOTLOADER_MAGIC_KEY ,500 , +void __iomem *base =IS_IPU7 (isp) ? + isp->base +IPU7_BUTTRESS_REG_FW_BOOT_PARAMS7 : + psys_pdata->base +BOOTLOADER_STATUS_OFFSET ; + + ret =readl_poll_timeout (base, data, data ==BOOTLOADER_MAGIC_KEY ,500 ,BUTTRESS_CSE_BOOTLOAD_TIMEOUT_US );if (ret) { dev_err(&isp->pdev->dev, "Unexpected magic number 0x%x\n",
@@ -815,12 +965,61 @@ u64 ipu6_buttress_tsc_ticks_to_ns(u64 ticks, const struct ipu6_device *isp) }EXPORT_SYMBOL_NS_GPL (ipu6_buttress_tsc_ticks_to_ns,"INTEL_IPU6" ); -void ipu6_buttress_restore (struct ipu6_device *isp) +/* trigger uc control to wakeup fw */ +void ipu7_buttress_wakeup_isys (const struct ipu6_device *isp) +{ +u32 val; + + val =readl (isp->base +IPU7_BUTTRESS_REG_ISYS_UCX_CTRL_STATUS ); + val |=IPU7_UCX_CTL_WAKEUP ; +writel (val, isp->base +IPU7_BUTTRESS_REG_ISYS_UCX_CTRL_STATUS ); +} +EXPORT_SYMBOL_NS_GPL (ipu7_buttress_wakeup_isys,"INTEL_IPU6" ); + +u32 ipu7_buttress_get_isys_freq (struct ipu6_device *isp) +{ +u32 val; + + val =readl (isp->base +IPU7_BUTTRESS_REG_IS_WORKPOINT_REQ ); + val &=IPU7_BUTTRESS_IS_FREQ_CTL_RATIO_MASK ; + +return val *50 /3 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_buttress_get_isys_freq,"INTEL_IPU6" ); + +static void ipu7_buttress_setup (struct ipu6_device *isp) {struct ipu6_buttress *b = &isp->buttress; +u32 val; + +/* program PB BAR */ +writel (0 , isp->pb_base +IPU7_GLOBAL_INTERRUPT_MASK ); + val =readl (isp->pb_base +IPU7_BAR2_MISC_CONFIG ); + val |=0x100U ; + +writel (val, isp->pb_base +IPU7_BAR2_MISC_CONFIG ); + +writel (BIT (22 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_63_32 ); +writel (BIT (1 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_127_96 );writel (b->regs->irq_all, isp->base + b->regs->irq_clear); +writel (b->regs->irq_all, isp->base +IPU7_BUTTRESS_REG_IRQ_MASK );writel (b->regs->irq_all, isp->base + b->regs->irq_enable); + +/* LNL SW workaround for PS PD hang when PS sub-domain during PD */ +writel (IPU7_BUTTRESS_CG_CTRL_PS_FSM_CG , isp->base +IPU7_BUTTRESS_REG_CG_CTRL_BITS ); +} + +void ipu6_buttress_restore (struct ipu6_device *isp) +{ +struct ipu6_buttress *b = &isp->buttress; + +if (IS_IPU7 (isp)) { +ipu7_buttress_setup (isp); + }else { +writel (b->regs->irq_all, isp->base + b->regs->irq_clear); +writel (b->regs->irq_all, isp->base + b->regs->irq_enable); + }writel (b->wdt_cached_value, isp->base + b->regs->wdt); }
@@ -838,37 +1037,44 @@ int ipu6_buttress_init(struct ipu6_device *isp)init_completion (&b->ipc.recv_complete);INIT_LIST_HEAD (&b->constraints); - isp->secure_mode =ipu6_buttress_get_secure_mode (isp); -dev_dbg (&isp->pdev->dev,"IPU6 in %s mode touch 0x%x mask 0x%x\n" , - isp->secure_mode ?"secure" :"non-secure" , -readl (isp->base +BUTTRESS_REG_SECURITY_TOUCH ), -readl (isp->base +BUTTRESS_REG_CAMERA_MASK )); - b->wdt_cached_value =readl (isp->base + b->regs->wdt); -writel (b->regs->irq_all, isp->base + b->regs->irq_clear); -writel (b->regs->irq_all, isp->base + b->regs->irq_enable); +dev_dbg (&isp->pdev->dev,"IPU in %s mode\n" , + isp->secure_mode ?"secure" :"non-secure" ); -/* get ref_clk frequency by reading the indication in btrs control */ - val =readl (isp->base + b->regs->btrs_ctrl); - val =FIELD_GET (BUTTRESS_REG_BTRS_CTRL_REF_CLK_IND , val); - -switch (val) { -case 0x0 : - b->ref_clk =240 ; -break ; -case 0x1 : - b->ref_clk =192 ; -break ; -case 0x2 : +if (IS_IPU7 (isp)) { +ipu7_buttress_setup (isp); b->ref_clk =384 ; -break ; -default : -dev_warn (&isp->pdev->dev, -"Unsupported ref clock, use 19.2Mhz by default.\n" ); - b->ref_clk =192 ; -break ; + }else { +dev_dbg (&isp->pdev->dev,"IPU6 touch 0x%x mask 0x%x\n" , +readl (isp->base +BUTTRESS_REG_SECURITY_TOUCH ), +readl (isp->base +BUTTRESS_REG_CAMERA_MASK )); + +writel (b->regs->irq_all, isp->base + b->regs->irq_clear); +writel (b->regs->irq_all, isp->base + b->regs->irq_enable); + +/* get ref_clk frequency by reading the indication in btrs control */ + val =readl (isp->base + b->regs->btrs_ctrl); + val =FIELD_GET (BUTTRESS_REG_BTRS_CTRL_REF_CLK_IND , val); + +switch (val) { +case 0x0 : + b->ref_clk =240 ; +break ; +case 0x1 : + b->ref_clk =192 ; +break ; +case 0x2 : + b->ref_clk =384 ; +break ; +default : +dev_warn (&isp->pdev->dev, +"Unsupported ref clock, use 19.2Mhz by default.\n" ); + b->ref_clk =192 ; +break ; + } } + b->wdt_cached_value =readl (isp->base + b->regs->wdt);/* Retry couple of times in case of CSE initialization is delayed */ do {
drivers/media/pci/intel/ipu6/ipu6-buttress.h +3 -0
@@ -26,6 +26,7 @@ struct ipu6_buttress_ctrl {u32 freq_ctl, pwr_sts_shift, pwr_sts_mask, pwr_sts_on, pwr_sts_off;unsigned int ratio;unsigned int qos_floor; +int subsys_id; };struct ipu6_buttress_ipc {
@@ -104,4 +105,6 @@ void ipu6_buttress_exit(struct ipu6_device *isp);void ipu6_buttress_csi_port_config (struct ipu6_device *isp,u32 legacy,u32 combo);void ipu6_buttress_restore (struct ipu6_device *isp); +void ipu7_buttress_wakeup_isys (const struct ipu6_device *isp); +u32 ipu7_buttress_get_isys_freq (struct ipu6_device *isp);#endif /* IPU6_BUTTRESS_H */
drivers/media/pci/intel/ipu6/ipu6-platform-buttress-regs.h +102 -0
106 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6.c +86 -18
152 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6.h +2 -0
@@ -22,6 +22,7 @@ struct ipu6_bus_device;#define IPU6_FIRMWARE_NAME "intel/ipu/ipu6_fw.bin"#define IPU6EPMTL_FIRMWARE_NAME "intel/ipu/ipu6epmtl_fw.bin"#define IPU6EPADLN_FIRMWARE_NAME "intel/ipu/ipu6epadln_fw.bin" +#define IPU7_FIRMWARE_NAME "intel/ipu/ipu7_fw.bin"#define IPU_VERSION_6 BIT(0)/* TGL */ #define IPU_VERSION_6SE BIT(1)/* JSL */
@@ -64,6 +65,7 @@ struct ipu6_device {u32 cpd_metadata_cmpnt_size;void __iomem *base; +void __iomem *pb_base;bool need_ipc_reset;bool secure_mode;u8 hw_ver;
include/media/ipu6-pci-table.h +2 -0
@@ -14,6 +14,8 @@#define PCI_DEVICE_ID_INTEL_IPU6EP_ADLN 0x462e#define PCI_DEVICE_ID_INTEL_IPU6EP_RPLP 0xa75d#define PCI_DEVICE_ID_INTEL_IPU6EP_MTL 0x7d19 +#define PCI_DEVICE_ID_INTEL_IPU7 0x645d +#define PCI_DEVICE_ID_INTEL_IPU7P5 0xb05dstatic const struct pci_device_id ipu6_pci_tbl[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_IPU6 ) },
Signature · 1 line
2.55.0
PATCH v2 13/44 media: ipu6: Prepare mmu driver for hw variation
In reply to Antti LaaksoWe are about to add support for ipu7 mmu. Split ipu6 mmu hardware specific and common code to separate files.
--- drivers/media/pci/intel/ipu6/Makefile | 1 + drivers/media/pci/intel/ipu6/ipu6-dma.c | 4 +- drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c | 296 +++++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu6-mmu.c | 120 +-------- drivers/media/pci/intel/ipu6/ipu6-mmu.h | 149 ++++++++++- drivers/media/pci/intel/ipu6/ipu6.c | 125 +-------- drivers/media/pci/intel/ipu6/ipu6.h | 132 +-------- 7 files changed, 456 insertions(+), 371 deletions(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c
drivers/media/pci/intel/ipu6/Makefile +1 -0
@@ -4,6 +4,7 @@ intel-ipu6-y := ipu6.o \ ipu6-bus.o \ ipu6-dma.o \ ipu6-mmu.o \ + ipu6-mmu-hw.o \ ipu6-buttress.o \ ipu6-cpd.o \ ipu6-fw-com.o
drivers/media/pci/intel/ipu6/ipu6-dma.c +2 -2
@@ -286,7 +286,7 @@ void ipu6_dma_free(struct ipu6_bus_device *sys, size_t size, void *vaddr,__free_buffer (pages, size, attrs); - mmu->tlb_invalidate (mmu); + mmu->ops->tlb_invalidate (mmu);__free_iova (&mmu->dmap->iovad, iova);
@@ -366,7 +366,7 @@ void ipu6_dma_unmap_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,ipu6_mmu_unmap (mmu->dmap->mmu_info,PFN_PHYS (iova->pfn_lo),PFN_PHYS (iova_size (iova))); - mmu->tlb_invalidate (mmu); + mmu->ops->tlb_invalidate (mmu);__free_iova (&mmu->dmap->iovad, iova); }EXPORT_SYMBOL_NS_GPL (ipu6_dma_unmap_sg,"INTEL_IPU6" );
drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c new file +296 -0
296 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6-mmu.c +11 -109
169 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6-mmu.h +143 -6
177 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6.c +2 -123
149 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6.h +1 -131
150 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 14/44 media: ipu6: Add ipu7 mmu support
In reply to Antti LaaksoThe ipu7 mmu have similar page tables as ipu6, but e.g. register interface is different. Add own driver handling ipu7 mmu specifics.
--- drivers/media/pci/intel/ipu6/Makefile | 1 + drivers/media/pci/intel/ipu6/ipu6-mmu.c | 14 +- drivers/media/pci/intel/ipu6/ipu6-mmu.h | 8 +- drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c | 599 +++++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h | 155 ++++++ 5 files changed, 773 insertions(+), 4 deletions(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h
drivers/media/pci/intel/ipu6/Makefile +1 -0
@@ -5,6 +5,7 @@ intel-ipu6-y := ipu6.o \ ipu6-dma.o \ ipu6-mmu.o \ ipu6-mmu-hw.o \ + ipu7-mmu-hw.o \ ipu6-buttress.o \ ipu6-cpd.o \ ipu6-fw-com.o
drivers/media/pci/intel/ipu6/ipu6-mmu.c +11 -3
@@ -473,7 +473,12 @@ static struct ipu6_mmu_info *ipu6_mmu_alloc(struct ipu6_device *isp)if (!mmu_info)return NULL ; - mmu_info->aperture_start =0 ; +if (IS_IPU7 (isp)) + mmu_info->aperture_start = isp->secure_mode ? +IPU7_FW_CODE_REGION_END :IPU7_FW_CODE_REGION_START ; +else + mmu_info->aperture_start =0 ; + mmu_info->aperture_end = (dma_addr_t)DMA_BIT_MASK(isp->secure_mode ? IPU6_MMU_ADDR_BITS :
@@ -532,6 +537,7 @@ EXPORT_SYMBOL_NS_GPL(ipu6_mmu_hw_cleanup, "INTEL_IPU6");static struct ipu6_dma_mapping *alloc_dma_mapping (struct ipu6_device *isp) {struct ipu6_dma_mapping *dmap; +unsigned long base_pfn; dmap =kzalloc_obj (*dmap);if (!dmap)
@@ -543,7 +549,9 @@ static struct ipu6_dma_mapping *alloc_dma_mapping(struct ipu6_device *isp)return NULL ; } -init_iova_domain (&dmap->iovad,SZ_4K ,1 ); + base_pfn = max_t(unsigned long, 1, +PFN_DOWN (dmap->mmu_info->aperture_start)); +init_iova_domain (&dmap->iovad,SZ_4K , base_pfn); dmap->mmu_info->dmap = dmap;dev_dbg (&isp->pdev->dev,"alloc mapping\n" );
@@ -676,7 +684,7 @@ struct ipu6_mmu *ipu6_mmu_init(struct device *dev,if (!mmu)return ERR_PTR (-ENOMEM ); - mmu->ops = &ipu6_mmu_ops; + mmu->ops =IS_IPU7 (isp) ? &ipu7_mmu_ops : &ipu6_mmu_ops; mmu->mmid = mmid; mmu->ready = false;INIT_LIST_HEAD (&mmu->vma_list);
drivers/media/pci/intel/ipu6/ipu6-mmu.h +7 -1
@@ -8,6 +8,8 @@#include <linux/spinlock_types.h> #include <linux/types.h> +#include "ipu7-mmu-hw.h" +struct device ;struct page ;
@@ -171,7 +173,10 @@ struct ipu6_mmu_hw_ops {struct ipu6_mmu {struct list_head node; -struct ipu6_mmu_hw *ipu6_mmu_hw; +union { +struct ipu6_mmu_hw *ipu6_mmu_hw; +struct ipu7_mmu_hw *ipu7_mmu_hw; + };unsigned int nr_mmus;unsigned int mmid;
@@ -192,6 +197,7 @@ struct ipu6_mmu { };extern const struct ipu6_mmu_hw_ops ipu6_mmu_ops; +extern const struct ipu6_mmu_hw_ops ipu7_mmu_ops;struct ipu6_mmu *ipu6_mmu_init (struct device *dev,void __iomem *base,int mmid);
drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c new file +599 -0
599 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 15/44 media: ipu6: Add ipu7 cpd handling
In reply to Antti LaaksoThe firmware format differs slightly between ipu6 and ipu7. Add support for ipu7 firmware validation and handling.
--- drivers/media/pci/intel/ipu6/ipu6-cpd.c | 169 +++++++++++++++++++++--- drivers/media/pci/intel/ipu6/ipu6-cpd.h | 43 ++++++ 2 files changed, 197 insertions(+), 15 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-cpd.c +154 -15
@@ -16,6 +16,7 @@#include "ipu6-bus.h" #include "ipu6-cpd.h" #include "ipu6-dma.h" +#include "ipu7-mmu-hw.h" /* 15 entries + header*/ #define MAX_PKG_DIR_ENT_CNT 16
@@ -62,6 +63,20 @@ static inline const struct ipu6_cpd_ent *ipu6_cpd_get_entry(const void *cpd,#define ipu6_cpd_get_metadata (cpd) ipu6_cpd_get_entry(cpd, METADATA_IDX)#define ipu6_cpd_get_moduledata (cpd) ipu6_cpd_get_entry(cpd, MODULEDATA_IDX) +#define IPU7_CPD_BINARY_START_IDX 1U +#define IPU7_CPD_METADATA_START_IDX 2U +#define IPU7_CPD_BINARY_NUM 2U/* ISYS + PSYS */ +#define IPU7_CPD_METADATA_ATTR 0xa +#define IPU7_CPD_METADATA_IPL 0x1c +/* +* Entries include: +* 1 manifest entry. +* 1 metadata entry for each sub system(ISYS and PSYS). +* 1 binary entry for each sub system(ISYS and PSYS). +*/ +#define IPU7_CPD_ENTRY_NUM (IPU7_CPD_BINARY_NUM * 2U + 1U) +#define IPU7_MAX_MANIFEST_SIZE (SZ_4K * sizeof(u32)) +static const struct ipu6_cpd_metadata_cmpnt_hdr *ipu6_cpd_metadata_get_cmpnt (struct ipu6_device *isp,const void *metadata,unsigned int metadata_size,u8 idx)
@@ -309,39 +324,163 @@ static int ipu6_cpd_validate_metadata(struct ipu6_device *isp,return 0 ; } -int ipu6_cpd_validate_cpd_file (struct ipu6_device *isp,const void *cpd_file, -unsigned long cpd_file_size) +static struct ipu7_cpd_metadata *ipu7_cpd_get_metadata (const void *cpd,int idx) { -const struct ipu6_cpd_hdr *hdr = cpd_file; -const struct ipu6_cpd_ent *ent; -int ret; +const struct ipu6_cpd_ent *cpd_ent = +ipu6_cpd_get_entry (cpd,IPU7_CPD_METADATA_START_IDX + idx *2 ); - ret =ipu6_cpd_validate_cpd (isp, cpd_file, cpd_file_size, - cpd_file_size); -if (ret) -return ret; +return (struct ipu7_cpd_metadata *)((u8 *)cpd + cpd_ent->offset); +} -/* Check for CPD file marker */ -if (hdr->hdr_mark !=CPD_HDR_MARK ) { -dev_err (&isp->pdev->dev,"Invalid CPD header\n" ); +static int ipu7_cpd_validate_metadata (struct ipu6_device *isp, +const void *cpd,int idx) +{ +const struct ipu6_cpd_ent *cpd_ent = +ipu6_cpd_get_entry (cpd,IPU7_CPD_METADATA_START_IDX + idx *2 ); +const struct ipu6_cpd_ent *bin_ent = +ipu6_cpd_get_entry (cpd,IPU7_CPD_BINARY_START_IDX + idx *2 ); +const struct ipu7_cpd_metadata *metadata = +ipu7_cpd_get_metadata (cpd, idx); +struct device *dev = &isp->pdev->dev; +u32 offset; + +/* Sanity check for metadata size */ +if (cpd_ent->len !=sizeof (struct ipu7_cpd_metadata )) { +dev_err (dev,"Invalid metadata size\n" ); +return -EINVAL ; + } + +/* Validate type and length of metadata sections */ +if (metadata->attr.hdr.type !=IPU7_CPD_METADATA_ATTR ) { +dev_err (dev,"Invalid metadata attr type (%d)\n" , + metadata->attr.hdr.type);return -EINVAL ; } +if (metadata->attr.hdr.len !=sizeof (struct ipu7_cpd_metadata_attr )) { +dev_err (dev,"Invalid metadata attr size (%d)\n" , + metadata->attr.hdr.len); +return -EINVAL ; + } +if (metadata->ipl.hdr.type !=IPU7_CPD_METADATA_IPL ) { +dev_err (dev,"Invalid metadata ipl type (%d)\n" , + metadata->ipl.hdr.type); +return -EINVAL ; + } +if (metadata->ipl.hdr.len !=sizeof (struct ipu7_cpd_metadata_ipl )) { +dev_err (dev,"Invalid metadata ipl size (%d)\n" , + metadata->ipl.hdr.len); +return -EINVAL ; + } + + offset = metadata->ipl.param[0 ]; +if (offset >IPU7_FW_CODE_REGION_SIZE || + bin_ent->len >IPU7_FW_CODE_REGION_SIZE - offset) { +dev_err (dev,"Incorrect binary size %u and offset %u\n" , + bin_ent->len, offset); +return -EINVAL ; + } + +return 0 ; +} + +static int __ipu7_validate_cpd_file (struct ipu6_device *isp,const void *cpd_file, +unsigned long cpd_file_size) +{ +const struct ipu6_cpd_ent *ent; +const struct ipu7_cpd_hdr *hdr = cpd_file; +unsigned int i; -/* Sanity check for manifest size */ ent =ipu6_cpd_get_manifest (cpd_file); -if (ent->len >MAX_MANIFEST_SIZE ) { +if (ent->len >IPU7_MAX_MANIFEST_SIZE ) {dev_err (&isp->pdev->dev,"Invalid CPD manifest size\n" );return -EINVAL ; } +/* Sanity check for CPD entry header */ +if (hdr->ent_cnt !=IPU7_CPD_ENTRY_NUM ) { +dev_err (&isp->pdev->dev,"Invalid CPD entry number %d\n" , + hdr->ent_cnt); +return -EINVAL ; + }/* Validate metadata */ +for (i =0 ; i <IPU7_CPD_BINARY_NUM ; i++) { +int ret =ipu7_cpd_validate_metadata (isp, cpd_file, i); + +if (ret) { +dev_err (&isp->pdev->dev,"Invalid metadata(%d)\n" , i); +return ret; + } + } +return 0 ; +} + +static int __ipu6_validate_cpd_file (struct ipu6_device *isp,const void *cpd_file, +unsigned long cpd_file_size) +{ +const struct ipu6_cpd_ent *ent; +int ret; + + ent =ipu6_cpd_get_manifest (cpd_file); +if (ent->len >MAX_MANIFEST_SIZE ) { +dev_err (&isp->pdev->dev,"Invalid CPD manifest size\n" ); +return -EINVAL ; + } + ent =ipu6_cpd_get_metadata (cpd_file); ret =ipu6_cpd_validate_metadata (isp, cpd_file + ent->offset, ent->len);if (ret)return ret; -/* Validate moduledata */ ent =ipu6_cpd_get_moduledata (cpd_file);return ipu6_cpd_validate_moduledata (isp, cpd_file + ent->offset, ent->len); } + +int ipu6_cpd_validate_cpd_file (struct ipu6_device *isp,const void *cpd_file, +unsigned long cpd_file_size) +{ +const struct ipu6_cpd_hdr *hdr = cpd_file; +int ret; + + ret =ipu6_cpd_validate_cpd (isp, cpd_file, cpd_file_size, + cpd_file_size); +if (ret) +return ret; + +/* Check for CPD file marker */ +if (hdr->hdr_mark !=CPD_HDR_MARK ) { +dev_err (&isp->pdev->dev,"Invalid CPD header\n" ); +return -EINVAL ; + } + +if (IS_IPU7 (isp)) +return __ipu7_validate_cpd_file (isp, cpd_file, cpd_file_size); + +return __ipu6_validate_cpd_file (isp, cpd_file, cpd_file_size); +} + +int ipu7_cpd_copy_binary (const void *cpd,const char *name,void *dst, +u32 *entry) +{ +unsigned int i; + +for (i =0 ; i <IPU7_CPD_BINARY_NUM ; i++) { +const struct ipu7_cpd_metadata *metadata; +u8 idx =IPU7_CPD_BINARY_START_IDX + i *2U ; +const struct ipu6_cpd_ent *ent = +ipu6_cpd_get_entry (cpd, idx); + +if (strncmp (ent->name, name,sizeof (ent->name))) +continue ; + + metadata =ipu7_cpd_get_metadata (cpd, i); +memcpy (dst + metadata->ipl.param[0 ], cpd + ent->offset, + ent->len); + *entry = metadata->ipl.param[2 ]; + +return 0 ; + } + +return -ENOENT ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_cpd_copy_binary,"INTEL_IPU6" );
drivers/media/pci/intel/ipu6/ipu6-cpd.h +43 -0
51 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 16/44 media: ipu6: Add check for pkg_dir before freeing
In reply to Antti LaaksoWe are adding support for mapping ipu7 firmware which doesn't have pkg_dir.
--- drivers/media/pci/intel/ipu6/ipu6-cpd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-cpd.c +3 -2
@@ -235,8 +235,9 @@ EXPORT_SYMBOL_NS_GPL(ipu6_cpd_create_pkg_dir, "INTEL_IPU6");void ipu6_cpd_free_pkg_dir (struct ipu6_bus_device *adev) { -ipu6_dma_free (adev, adev->pkg_dir_size, adev->pkg_dir, - adev->pkg_dir_dma_addr,0 ); +if (adev->pkg_dir) +ipu6_dma_free (adev, adev->pkg_dir_size, adev->pkg_dir, + adev->pkg_dir_dma_addr,0 ); }EXPORT_SYMBOL_NS_GPL (ipu6_cpd_free_pkg_dir,"INTEL_IPU6" );
Signature · 1 line
2.55.0
PATCH v2 17/44 media: ipu6: Rename isys fw msg union
In reply to Antti LaaksoLater we need to abstract ipu7 firmware abi structs same way we have it now for ipu6. Renaming union per ipu helps to make the split more clear.
--- drivers/media/pci/intel/ipu6/ipu6-isys-queue.c | 4 ++-- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 4 ++-- drivers/media/pci/intel/ipu6/ipu6-isys.c | 4 ++-- drivers/media/pci/intel/ipu6/ipu6-isys.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c +2 -2
@@ -316,7 +316,7 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video *av,if (!msg)return -ENOMEM ; - buf = &msg->fw_msg.frame; + buf = &msg->ipu6.frame;ipu6_isys_buf_to_fw_frame_buf (buf, stream, bl);ipu6_fw_isys_dump_frame_buff_set (dev, buf, stream->nr_output_pins);
@@ -396,7 +396,7 @@ static void buf_queue(struct vb2_buffer *vb) goto out; } - buf = &msg->fw_msg.frame; + buf = &msg->ipu6.frame;ipu6_isys_buf_to_fw_frame_buf (buf, stream, &bl);ipu6_fw_isys_dump_frame_buff_set (dev, buf, stream->nr_output_pins);
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +2 -2
@@ -533,7 +533,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av,if (!msg)return -ENOMEM ; - stream_cfg = &msg->fw_msg.stream; + stream_cfg = &msg->ipu6.stream; stream_cfg->src = stream->stream_source; stream_cfg->vc = stream->vc; stream_cfg->isl_use =0 ;
@@ -590,7 +590,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av, ret = -ENOMEM ; goto out_put_stream_opened; } - buf = &msg->fw_msg.frame; + buf = &msg->ipu6.frame;ipu6_isys_buf_to_fw_frame_buf (buf, stream, bl);ipu6_isys_buffer_list_queue (bl,IPU6_ISYS_BUFFER_LIST_FL_ACTIVE ,0 );
drivers/media/pci/intel/ipu6/ipu6-isys.c +2 -2
@@ -1003,7 +1003,7 @@ struct isys_fw_msgs *ipu6_get_fw_msg_buf(struct ipu6_isys_stream *stream) msg = list_last_entry(&isys->framebuflist, struct isys_fw_msgs, head);list_move (&msg->head, &isys->framebuflist_fw);spin_unlock_irqrestore (&isys->listlock, flags); -memset (&msg->fw_msg,0 ,sizeof (msg->fw_msg)); +memset (&msg->ipu6,0 ,sizeof (msg->ipu6));return msg; }
@@ -1029,7 +1029,7 @@ void ipu6_put_fw_msg_buf(struct ipu6_isys *isys, uintptr_t data)return ;spin_lock_irqsave (&isys->listlock, flags); - msg = container_of(ptr, struct isys_fw_msgs, fw_msg.dummy); + msg = container_of(ptr, struct isys_fw_msgs, ipu6.dummy);list_move (&msg->head, &isys->framebuflist);spin_unlock_irqrestore (&isys->listlock, flags); }
drivers/media/pci/intel/ipu6/ipu6-isys.h +1 -1
@@ -169,7 +169,7 @@ struct isys_fw_msgs {u64 dummy;struct ipu6_fw_isys_frame_buff_set_abi frame;struct ipu6_fw_isys_stream_cfg_data_abi stream; - } fw_msg; + } ipu6;struct list_head head;dma_addr_t dma_addr; };
Signature · 1 line
2.55.0
PATCH v2 18/44 media: ipu6: Move isys isr handlers to fw file
In reply to Antti LaaksoThe ipu7 will have its own isr handlers. Move ipu6 isr code to hardware specific file.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 259 +++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 3 + drivers/media/pci/intel/ipu6/ipu6-isys.c | 263 +------------------- 3 files changed, 263 insertions(+), 262 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +259 -0
@@ -487,3 +487,262 @@ ipu6_fw_isys_dump_frame_buff_set(struct device *dev,dev_dbg (dev,"-----------------------------------------------------\n" ); } + +struct fwmsg { +int type; +char *msg; +bool valid_ts; +}; + +static const struct fwmsg fw_msg[] = { + {IPU6_FW_ISYS_RESP_TYPE_STREAM_OPEN_DONE ,"STREAM_OPEN_DONE" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_CLOSE_ACK ,"STREAM_CLOSE_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_START_ACK ,"STREAM_START_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_START_AND_CAPTURE_ACK , +"STREAM_START_AND_CAPTURE_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_STOP_ACK ,"STREAM_STOP_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_FLUSH_ACK ,"STREAM_FLUSH_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_PIN_DATA_READY ,"PIN_DATA_READY" ,1 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_CAPTURE_ACK ,"STREAM_CAPTURE_ACK" ,0 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_START_AND_CAPTURE_DONE , +"STREAM_START_AND_CAPTURE_DONE" ,1 }, + {IPU6_FW_ISYS_RESP_TYPE_STREAM_CAPTURE_DONE ,"STREAM_CAPTURE_DONE" ,1 }, + {IPU6_FW_ISYS_RESP_TYPE_FRAME_SOF ,"FRAME_SOF" ,1 }, + {IPU6_FW_ISYS_RESP_TYPE_FRAME_EOF ,"FRAME_EOF" ,1 }, + {IPU6_FW_ISYS_RESP_TYPE_STATS_DATA_READY ,"STATS_READY" ,1 }, + {-1 ,"UNKNOWN MESSAGE" ,0 } +}; + +static u32 resp_type_to_index (int type) +{ +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (fw_msg); i++) +if (fw_msg[i].type == type) +return i; + +return ARRAY_SIZE (fw_msg) -1 ; +} + +int ipu6_isys_isr_one (struct ipu6_bus_device *adev) +{ +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +struct ipu6_fw_isys_resp_info_abi *resp; +struct ipu6_isys_stream *stream; +struct ipu6_isys_csi2 *csi2 =NULL ; +u32 index; +u64 ts; + +if (!isys->fwctx) +return 1 ; + + resp =ipu6_fw_isys_get_resp (isys); +if (!resp) +return 1 ; + + ts = (u64 )resp->timestamp[1 ] <<32 | resp->timestamp[0 ]; + + index =resp_type_to_index (resp->type); +dev_dbg (&adev->auxdev.dev, +"FW resp %02d %s, stream %u, ts 0x%16.16llx, pin %d\n" , + resp->type, fw_msg[index].msg, resp->stream_handle, + fw_msg[index].valid_ts ? ts :0 , resp->pin_id); + +if (resp->error_info.error ==IPU6_FW_ISYS_ERROR_STREAM_IN_SUSPENSION ) +/* Suspension is kind of special case: not enough buffers */ +dev_dbg (&adev->auxdev.dev, +"FW error resp SUSPENSION, details %d\n" , + resp->error_info.error_details); +else if (resp->error_info.error) +dev_dbg (&adev->auxdev.dev, +"FW error resp error %d, details %d\n" , + resp->error_info.error, resp->error_info.error_details); + +if (resp->stream_handle >=IPU6_ISYS_MAX_STREAMS ) { +dev_err (&adev->auxdev.dev,"bad stream handle %u\n" , + resp->stream_handle); + goto leave; + } + + stream =ipu6_isys_query_stream_by_handle (isys, resp->stream_handle); +if (!stream) { +dev_err (&adev->auxdev.dev,"stream of stream_handle %u is unused\n" , + resp->stream_handle); + goto leave; + } + stream->error = resp->error_info.error; + + csi2 =ipu6_isys_subdev_to_csi2 (stream->asd); + +switch (resp->type) { +case IPU6_FW_ISYS_RESP_TYPE_STREAM_OPEN_DONE : +complete (&stream->stream_open_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_CLOSE_ACK : +complete (&stream->stream_close_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_START_ACK : +complete (&stream->stream_start_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_START_AND_CAPTURE_ACK : +complete (&stream->stream_start_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_STOP_ACK : +complete (&stream->stream_stop_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_FLUSH_ACK : +complete (&stream->stream_stop_completion); +break ; +case IPU6_FW_ISYS_RESP_TYPE_PIN_DATA_READY : +/* +* firmware only release the capture msg until software +* get pin_data_ready event +*/ +ipu6_put_fw_msg_buf (ipu6_bus_get_drvdata (adev), resp->buf_id); +if (resp->pin_id <IPU6_ISYS_OUTPUT_PINS && + stream->output_pins_queue[resp->pin_id]) +ipu6_isys_queue_buf_ready (stream, resp); +else +dev_warn (&adev->auxdev.dev, +"%d:No queue for pin id %d\n" , + resp->stream_handle, resp->pin_id); +if (csi2) +ipu6_isys_csi2_error (csi2); + +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_CAPTURE_ACK : +break ; +case IPU6_FW_ISYS_RESP_TYPE_STREAM_START_AND_CAPTURE_DONE : +case IPU6_FW_ISYS_RESP_TYPE_STREAM_CAPTURE_DONE : +break ; +case IPU6_FW_ISYS_RESP_TYPE_FRAME_SOF : + +ipu6_isys_csi2_sof_event_by_stream (stream); + stream->seq[stream->seq_index].sequence = +atomic_read (&stream->sequence) -1 ; + stream->seq[stream->seq_index].timestamp = ts; +dev_dbg (&adev->auxdev.dev, +"sof: handle %d: (index %u), timestamp 0x%16.16llx\n" , + resp->stream_handle, + stream->seq[stream->seq_index].sequence, ts); + stream->seq_index = (stream->seq_index +1 ) + %IPU6_ISYS_MAX_PARALLEL_SOF ; +break ; +case IPU6_FW_ISYS_RESP_TYPE_FRAME_EOF : +ipu6_isys_csi2_eof_event_by_stream (stream); +dev_dbg (&adev->auxdev.dev, +"eof: handle %d: (index %u), timestamp 0x%16.16llx\n" , + resp->stream_handle, + stream->seq[stream->seq_index].sequence, ts); +break ; +case IPU6_FW_ISYS_RESP_TYPE_STATS_DATA_READY : +break ; +default : +dev_err (&adev->auxdev.dev,"%d:unknown response type %u\n" , + resp->stream_handle, resp->type); +break ; + } + +ipu6_isys_put_stream (stream); +leave: +ipu6_fw_isys_put_resp (isys); +return 0 ; +} + +static void ipu6_isys_csi2_isr (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys_stream *stream; +unsigned int i; +u32 status; +int source; + +ipu6_isys_register_errors (csi2); + + status =readl (csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + +CSI_PORT_REG_BASE_IRQ_STATUS_OFFSET ); + +writel (status, csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + +CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET ); + + source = csi2->asd.source; +for (i =0 ; i <NR_OF_CSI2_VC ; i++) { +if (status &IPU_CSI_RX_IRQ_FS_VC (i)) { + stream =ipu6_isys_query_stream_by_source (csi2->isys, + source, i); +if (stream) { +ipu6_isys_csi2_sof_event_by_stream (stream); +ipu6_isys_put_stream (stream); + } + } + +if (status &IPU_CSI_RX_IRQ_FE_VC (i)) { + stream =ipu6_isys_query_stream_by_source (csi2->isys, + source, i); +if (stream) { +ipu6_isys_csi2_eof_event_by_stream (stream); +ipu6_isys_put_stream (stream); + } + } + } +} + +irqreturn_t ipu6_isys_isr (struct ipu6_bus_device *adev) +{ +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +void __iomem *base = isys->pdata->base; +u32 status_sw, status_csi; +u32 ctrl0_status, ctrl0_clear; + +spin_lock (&isys->power_lock); +if (!isys->power) { +spin_unlock (&isys->power_lock); +return IRQ_NONE ; + } + + ctrl0_status = isys->pdata->ipdata->csi2.ctrl0_irq_status; + ctrl0_clear = isys->pdata->ipdata->csi2.ctrl0_irq_clear; + + status_csi =readl (isys->pdata->base + ctrl0_status); + status_sw =readl (isys->pdata->base + +IPU6_REG_ISYS_UNISPART_IRQ_STATUS ); + +writel (ISYS_UNISPART_IRQS & ~IPU6_ISYS_UNISPART_IRQ_SW , + base +IPU6_REG_ISYS_UNISPART_IRQ_MASK ); + +do { +writel (status_csi, isys->pdata->base + ctrl0_clear); + +writel (status_sw, isys->pdata->base + +IPU6_REG_ISYS_UNISPART_IRQ_CLEAR ); + +if (isys->isr_csi2_bits & status_csi) { +unsigned int i; + +for (i =0 ; i < isys->pdata->ipdata->csi2.nports; i++) { +/* irq from not enabled port */ +if (!isys->csi2[i].base) +continue ; +if (status_csi &IPU6_ISYS_UNISPART_IRQ_CSI2 (i)) +ipu6_isys_csi2_isr (&isys->csi2[i]); + } + } + +writel (0 , base +IPU6_REG_ISYS_UNISPART_SW_IRQ_REG ); + +if (!ipu6_isys_isr_one (adev)) + status_sw =IPU6_ISYS_UNISPART_IRQ_SW ; +else + status_sw =0 ; + + status_csi =readl (isys->pdata->base + ctrl0_status); + status_sw |=readl (isys->pdata->base + +IPU6_REG_ISYS_UNISPART_IRQ_STATUS ); + }while ((status_csi & isys->isr_csi2_bits) || + (status_sw &IPU6_ISYS_UNISPART_IRQ_SW )); + +writel (ISYS_UNISPART_IRQS , base +IPU6_REG_ISYS_UNISPART_IRQ_MASK ); + +spin_unlock (&isys->power_lock); + +return IRQ_HANDLED ; +}
drivers/media/pci/intel/ipu6/ipu6-fw-isys.h +3 -0
@@ -578,4 +578,7 @@ void ipu6_fw_isys_cleanup(struct ipu6_isys *isys);struct ipu6_fw_isys_resp_info_abi *ipu6_fw_isys_get_resp (struct ipu6_isys *isys);void ipu6_fw_isys_put_resp (struct ipu6_isys *isys); +int ipu6_isys_isr_one (struct ipu6_bus_device *adev); +irqreturn_t ipu6_isys_isr (struct ipu6_bus_device *adev); +#endif
drivers/media/pci/intel/ipu6/ipu6-isys.c +1 -262
282 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 19/44 media: ipu6: Move hw specific buffer handling down
In reply to Antti LaaksoMove handling of hardware specific buffers out of common code, like ipu6-isys-video.c. Now the ipu6_put_fw_msg_buf() works with fw_msg_bufs, like its counterpart ipu6_get_fw_msg_buf().
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 11 ++++++++++- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 6 +++--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 7 ++----- drivers/media/pci/intel/ipu6/ipu6-isys.h | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +10 -1
@@ -530,6 +530,7 @@ int ipu6_isys_isr_one(struct ipu6_bus_device *adev)struct ipu6_fw_isys_resp_info_abi *resp;struct ipu6_isys_stream *stream;struct ipu6_isys_csi2 *csi2 =NULL ; +struct isys_fw_msgs *isys_fw_msg =NULL ;u32 index;u64 ts;
@@ -598,7 +599,15 @@ int ipu6_isys_isr_one(struct ipu6_bus_device *adev)* firmware only release the capture msg until software * get pin_data_ready event */ -ipu6_put_fw_msg_buf (ipu6_bus_get_drvdata (adev), resp->buf_id); +if (!resp->buf_id) +dev_warn (&adev->auxdev.dev,"%d: Invalid buf ID\n" , + resp->stream_handle); +else + isys_fw_msg = +container_of ((void *)(uintptr_t )resp->buf_id, + struct isys_fw_msgs, ipu6.dummy); + +ipu6_put_fw_msg_buf (ipu6_bus_get_drvdata (adev), isys_fw_msg);if (resp->pin_id <IPU6_ISYS_OUTPUT_PINS && stream->output_pins_queue[resp->pin_id])ipu6_isys_queue_buf_ready (stream, resp);
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +3 -3
@@ -544,7 +544,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av, ret =ipu6_isys_fw_pin_cfg (__av, stream_cfg);if (ret <0 ) { -ipu6_put_fw_msg_buf (av->isys, (uintptr_t )stream_cfg); +ipu6_put_fw_msg_buf (av->isys, msg);return ret; } }
@@ -561,7 +561,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av, IPU6_FW_ISYS_SEND_TYPE_STREAM_OPEN);if (ret <0 ) {dev_err (dev,"can't open stream (%d)\n" , ret); -ipu6_put_fw_msg_buf (av->isys, (uintptr_t )stream_cfg); +ipu6_put_fw_msg_buf (av->isys, msg);return ret; }
@@ -570,7 +570,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av, tout =wait_for_completion_timeout (&stream->stream_open_completion,IPU6_FW_CALL_TIMEOUT_JIFFIES ); -ipu6_put_fw_msg_buf (av->isys, (uintptr_t )stream_cfg); +ipu6_put_fw_msg_buf (av->isys, msg);if (!tout) {dev_err (dev,"stream open time out\n" );
drivers/media/pci/intel/ipu6/ipu6-isys.c +2 -5
@@ -919,17 +919,14 @@ void ipu6_cleanup_fw_msg_bufs(struct ipu6_isys *isys)spin_unlock_irqrestore (&isys->listlock, flags); } -void ipu6_put_fw_msg_buf (struct ipu6_isys *isys,uintptr_t data) +void ipu6_put_fw_msg_buf (struct ipu6_isys *isys,struct isys_fw_msgs *msg) { -struct isys_fw_msgs *msg;unsigned long flags; -void *ptr = (void *)data; -if (!ptr) +if (!msg)return ;spin_lock_irqsave (&isys->listlock, flags); - msg = container_of(ptr, struct isys_fw_msgs, ipu6.dummy);list_move (&msg->head, &isys->framebuflist);spin_unlock_irqrestore (&isys->listlock, flags); }
drivers/media/pci/intel/ipu6/ipu6-isys.h +1 -1
@@ -175,7 +175,7 @@ struct isys_fw_msgs { };struct isys_fw_msgs *ipu6_get_fw_msg_buf (struct ipu6_isys_stream *stream); -void ipu6_put_fw_msg_buf (struct ipu6_isys *isys,uintptr_t data); +void ipu6_put_fw_msg_buf (struct ipu6_isys *isys,struct isys_fw_msgs *msg);void ipu6_cleanup_fw_msg_bufs (struct ipu6_isys *isys);extern const struct v4l2_ioctl_ops ipu6_isys_ioctl_ops;
Signature · 1 line
2.55.0
PATCH v2 20/44 media: ipu6: Isolate hw specific buffer handling
In reply to Antti LaaksoMove ipu6 specific buffer and stream handling down to hardware specific file, to make it possible to add ipu7 specific functionality.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 241 ++++++++++++++++-- drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 42 ++- .../media/pci/intel/ipu6/ipu6-isys-queue.c | 77 +----- .../media/pci/intel/ipu6/ipu6-isys-queue.h | 4 - .../media/pci/intel/ipu6/ipu6-isys-video.c | 128 +--------- 5 files changed, 270 insertions(+), 222 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +219 -22
@@ -90,11 +90,11 @@ int ipu6_fw_isys_send_proxy_token(struct ipu6_isys *isys,return ret; } -int ipu6_fw_isys_complex_cmd (struct ipu6_isys *isys, -const unsigned int stream_handle, -void *cpu_mapped_buf, -dma_addr_t dma_mapped_buf, -size_t size,u16 send_type) +static int ipu6_fw_isys_complex_cmd (struct ipu6_isys *isys, +const unsigned int stream_handle, +void *cpu_mapped_buf, +dma_addr_t dma_mapped_buf, +size_t size,u16 send_type) {struct ipu6_fw_com_context *ctx = isys->fwctx;struct device *dev = &isys->adev->auxdev.dev;
@@ -126,13 +126,6 @@ int ipu6_fw_isys_complex_cmd(struct ipu6_isys *isys,return 0 ; } -int ipu6_fw_isys_simple_cmd (struct ipu6_isys *isys, -const unsigned int stream_handle,u16 send_type) -{ -return ipu6_fw_isys_complex_cmd (isys, stream_handle,NULL ,0 ,0 , - send_type); -} -int ipu6_fw_isys_close (struct ipu6_isys *isys) {struct device *dev = &isys->adev->auxdev.dev;
@@ -376,9 +369,9 @@ void ipu6_fw_isys_put_resp(struct ipu6_isys *isys)ipu6_recv_put_token (isys->fwctx,IPU6_BASE_MSG_RECV_QUEUES ); } -void ipu6_fw_isys_dump_stream_cfg (struct device *dev, -struct ipu6_fw_isys_stream_cfg_data_abi *cfg) +void ipu6_fw_isys_dump_stream_cfg (struct device *dev,struct isys_fw_msgs *msg) { +struct ipu6_fw_isys_stream_cfg_data_abi *cfg = &msg->ipu6.stream;unsigned int i;dev_dbg (dev,"-----------------------------------------------------\n" );
@@ -454,12 +447,14 @@ void ipu6_fw_isys_dump_stream_cfg(struct device *dev, }void -ipu6_fw_isys_dump_frame_buff_set (struct device *dev, -struct ipu6_fw_isys_frame_buff_set_abi *buf, +ipu6_fw_isys_dump_frame_buff_set (struct device *dev,struct isys_fw_msgs *msg,unsigned int outputs) { +struct ipu6_fw_isys_frame_buff_set_abi *buf;unsigned int i; + buf = &msg->ipu6.frame; +dev_dbg (dev,"-----------------------------------------------------\n" );dev_dbg (dev,"IPU6_FW_ISYS_FRAME_BUFF_SET\n" );
@@ -596,16 +591,17 @@ int ipu6_isys_isr_one(struct ipu6_bus_device *adev)break ;case IPU6_FW_ISYS_RESP_TYPE_PIN_DATA_READY :/* -* firmware only release the capture msg until software +* firmware only release the capture message until software * get pin_data_ready event */ -if (!resp->buf_id) +if (!resp->buf_id) {dev_warn (&adev->auxdev.dev,"%d: Invalid buf ID\n" , resp->stream_handle); -else - isys_fw_msg = -container_of ((void *)(uintptr_t )resp->buf_id, - struct isys_fw_msgs, ipu6.dummy); + goto leave_put_stream; + } + + isys_fw_msg =container_of ((void *)(uintptr_t )resp->buf_id, + struct isys_fw_msgs, ipu6.dummy);ipu6_put_fw_msg_buf (ipu6_bus_get_drvdata (adev), isys_fw_msg); if (resp->pin_id < IPU6_ISYS_OUTPUT_PINS &&
@@ -652,6 +648,7 @@ int ipu6_isys_isr_one(struct ipu6_bus_device *adev)break ; } +leave_put_stream:ipu6_isys_put_stream (stream); leave:ipu6_fw_isys_put_resp (isys);
@@ -755,3 +752,203 @@ irqreturn_t ipu6_isys_isr(struct ipu6_bus_device *adev)return IRQ_HANDLED ; } + +static int ipu6_isys_fw_pin_cfg (struct ipu6_isys_video *av, +struct ipu6_fw_isys_stream_cfg_data_abi *cfg) +{ +struct media_pad *src_pad =media_pad_remote_pad_first (&av->pad); +struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (src_pad->entity); +struct v4l2_subdev_state *state =v4l2_subdev_get_locked_active_state (sd); +struct ipu6_fw_isys_input_pin_info_abi *input_pin; +struct ipu6_fw_isys_output_pin_info_abi *output_pin; +struct ipu6_isys_stream *stream = av->stream; +struct ipu6_isys_queue *aq = &av->aq; +struct v4l2_mbus_framefmt fmt; +const struct ipu6_isys_pixelformat *pfmt = +ipu6_isys_get_isys_format (ipu6_isys_get_format (av),0 ); +struct v4l2_rect v4l2_crop; +struct ipu6_isys *isys = av->isys; +int input_pins = cfg->nof_input_pins++; +int output_pins; +u32 src_stream; + + src_stream =ipu6_isys_get_src_stream_by_src_pad (sd, src_pad->index); + fmt = *v4l2_subdev_state_get_format (state, src_pad->index, src_stream); + v4l2_crop = *v4l2_subdev_state_get_crop (state, src_pad->index, src_stream); + + input_pin = &cfg->input_pins[input_pins]; + input_pin->input_res.width = fmt.width; + input_pin->input_res.height = fmt.height; + input_pin->dt = av->dt; + input_pin->bits_per_pix = pfmt->bpp_packed; + input_pin->mapped_dt =0x40 ;/* invalid mipi data type */ + input_pin->mipi_decompression =0 ; + input_pin->capture_mode =IPU6_FW_ISYS_CAPTURE_MODE_REGULAR ; + input_pin->mipi_store_mode = pfmt->bpp == pfmt->bpp_packed ? +IPU6_FW_ISYS_MIPI_STORE_MODE_DISCARD_LONG_HEADER : +IPU6_FW_ISYS_MIPI_STORE_MODE_NORMAL ; + input_pin->crop_first_and_last_lines = v4l2_crop.top &1 ; + + output_pins = cfg->nof_output_pins++; + aq->fw_output = output_pins; + stream->output_pins_queue[output_pins] = aq; + + output_pin = &cfg->output_pins[output_pins]; + output_pin->input_pin_id = input_pins; + output_pin->output_res.width =ipu6_isys_get_frame_width (av); + output_pin->output_res.height =ipu6_isys_get_frame_height (av); + + output_pin->stride =ipu6_isys_get_bytes_per_line (av); +if (pfmt->bpp != pfmt->bpp_packed) + output_pin->pt =IPU6_FW_ISYS_PIN_TYPE_RAW_SOC ; +else + output_pin->pt =IPU6_FW_ISYS_PIN_TYPE_MIPI ; + output_pin->ft = pfmt->css_pixelformat; + output_pin->send_irq =1 ; +memset (output_pin->ts_offsets,0 ,sizeof (output_pin->ts_offsets)); + output_pin->s2m_pixel_soc_pixel_remapping = +S2M_PIXEL_SOC_PIXEL_REMAPPING_FLAG_NO_REMAPPING ; + output_pin->csi_be_soc_pixel_remapping = +CSI_BE_SOC_PIXEL_REMAPPING_FLAG_NO_REMAPPING ; + + output_pin->snoopable = true; + output_pin->error_handling_enable = false; + output_pin->sensor_type = isys->sensor_type++; +if (isys->sensor_type > isys->pdata->ipdata->sensor_type_end) + isys->sensor_type = isys->pdata->ipdata->sensor_type_start; + +return 0 ; +} + +int ipu6_fw_isys_prepare_stream_cfg (struct ipu6_isys_video *av, +struct isys_fw_msgs *msg) +{ +struct ipu6_fw_isys_stream_cfg_data_abi *stream_cfg; +struct device *dev = &av->isys->adev->auxdev.dev; +struct ipu6_isys_stream *stream = av->stream; +struct ipu6_isys_queue *aq; + + stream_cfg = &msg->ipu6.stream; + stream_cfg->src = stream->stream_source; + stream_cfg->vc = stream->vc; + stream_cfg->isl_use =0 ; + stream_cfg->sensor_type =IPU6_FW_ISYS_SENSOR_MODE_NORMAL ; + +list_for_each_entry (aq, &stream->queues, node) { +struct ipu6_isys_video *__av =ipu6_isys_queue_to_video (aq); +int ret; + + ret =ipu6_isys_fw_pin_cfg (__av, stream_cfg); +if (ret <0 ) +return ret; + } + +ipu6_fw_isys_dump_stream_cfg (dev, msg); + + stream->nr_output_pins = stream_cfg->nof_output_pins; + +return 0 ; +} + +int ipu6_fw_isys_stream_open (struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg) +{ +return ipu6_fw_isys_complex_cmd (isys, stream_handle, + &msg->ipu6.stream, msg->dma_addr, +sizeof (msg->ipu6.stream), +IPU6_FW_ISYS_SEND_TYPE_STREAM_OPEN ); +} + +int ipu6_fw_isys_stream_close (struct ipu6_isys *isys, +const unsigned int stream_handle) +{ +return ipu6_fw_isys_complex_cmd (isys, stream_handle,NULL ,0 ,0 , +IPU6_FW_ISYS_SEND_TYPE_STREAM_CLOSE ); +} + +int ipu6_fw_isys_stream_flush (struct ipu6_isys *isys, +const unsigned int stream_handle) +{ +return ipu6_fw_isys_complex_cmd (isys, stream_handle,NULL ,0 ,0 , +IPU6_FW_ISYS_SEND_TYPE_STREAM_FLUSH ); +} + +int ipu6_fw_isys_stream_start (struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg,bool capture) +{ +u16 cmd_type; + +if (capture) + cmd_type =IPU6_FW_ISYS_SEND_TYPE_STREAM_START_AND_CAPTURE ; +else + cmd_type =IPU6_FW_ISYS_SEND_TYPE_STREAM_START ; + +return ipu6_fw_isys_complex_cmd (isys, stream_handle, + &msg->ipu6.stream, msg->dma_addr, +sizeof (msg->ipu6.stream), cmd_type); +} + +int ipu6_fw_isys_stream_capture (struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg) +{ +return ipu6_fw_isys_complex_cmd (isys, stream_handle, + &msg->ipu6.stream, msg->dma_addr, +sizeof (msg->ipu6.stream), +IPU6_FW_ISYS_SEND_TYPE_STREAM_CAPTURE ); +} + +static void +ipu6_isys_buf_to_fw_frame_buf_pin (struct vb2_buffer *vb, +struct ipu6_fw_isys_frame_buff_set_abi *set) +{ +struct ipu6_isys_queue *aq =vb2_queue_to_isys_queue (vb->vb2_queue); +struct vb2_v4l2_buffer *vvb =to_vb2_v4l2_buffer (vb); +struct ipu6_isys_video_buffer *ivb = +vb2_buffer_to_ipu6_isys_video_buffer (vvb); + + set->output_pins[aq->fw_output].addr = ivb->dma_addr; + set->output_pins[aq->fw_output].out_buf_id = vb->index +1 ; +} + +/* +* Convert a buffer list to a isys fw ABI framebuffer set. The +* buffer list is not modified. +*/ +#define IPU6_ISYS_FRAME_NUM_THRESHOLD (30) +void +ipu6_fw_isys_prepare_buf_set (struct isys_fw_msgs *msg, +struct ipu6_isys_stream *stream, +struct ipu6_isys_buffer_list *bl) +{ +struct ipu6_fw_isys_frame_buff_set_abi *set = &msg->ipu6.frame; +struct ipu6_isys_buffer *ib; + +WARN_ON (!bl->nbufs); + + set->send_irq_sof =1 ; + set->send_resp_sof =1 ; + set->send_irq_eof =0 ; + set->send_resp_eof =0 ; + +if (stream->streaming) + set->send_irq_capture_ack =0 ; +else + set->send_irq_capture_ack =1 ; + set->send_irq_capture_done =0 ; + + set->send_resp_capture_ack =1 ; + set->send_resp_capture_done =1 ; +if (atomic_read (&stream->sequence) >=IPU6_ISYS_FRAME_NUM_THRESHOLD ) { + set->send_resp_capture_ack =0 ; + set->send_resp_capture_done =0 ; + } + +list_for_each_entry (ib, &bl->head, head) { +struct vb2_buffer *vb =ipu6_isys_buffer_to_vb2_buffer (ib); + +ipu6_isys_buf_to_fw_frame_buf_pin (vb, set); + } +}
drivers/media/pci/intel/ipu6/ipu6-fw-isys.h +29 -13
60 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c +9 -68
117 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6-isys-queue.h +0 -4
@@ -60,10 +60,6 @@ struct ipu6_isys_buffer_list {void ipu6_isys_buffer_list_queue (struct ipu6_isys_buffer_list *bl,unsigned long op_flags,enum vb2_buffer_state state); -void -ipu6_isys_buf_to_fw_frame_buf (struct ipu6_fw_isys_frame_buff_set_abi *set, -struct ipu6_isys_stream *stream, -struct ipu6_isys_buffer_list *bl);void ipu6_isys_queue_buf_ready (struct ipu6_isys_stream *stream,struct ipu6_fw_isys_resp_info_abi *info);int ipu6_isys_queue_init (struct ipu6_isys_queue *aq);
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +13 -115
180 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 21/44 media: ipu6: Add isys firmware ops
In reply to Antti LaaksoAdd struct for ipu6 firmware ops. This is a preparation to add support for ipu7 firmware communication.
--- drivers/media/pci/intel/ipu6/ipu6-bus.h | 3 + drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 71 +++++++++++-------- drivers/media/pci/intel/ipu6/ipu6-fw-isys.h | 38 +--------- .../media/pci/intel/ipu6/ipu6-isys-queue.c | 24 ++++--- .../media/pci/intel/ipu6/ipu6-isys-video.c | 35 +++++---- drivers/media/pci/intel/ipu6/ipu6-isys.c | 1 + drivers/media/pci/intel/ipu6/ipu6-isys.h | 32 +++++++++ 7 files changed, 116 insertions(+), 88 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-bus.h +3 -0
@@ -37,6 +37,7 @@ struct ipu6_auxdrv_data {irqreturn_t (*isr)(struct ipu6_bus_device *adev);irqreturn_t (*isr_threaded)(struct ipu6_bus_device *adev);bool wake_isr_thread; +const struct ipu6_fw_isys_ops *fw_ops; };#define to_ipu6_bus_device (_dev) \
@@ -45,6 +46,8 @@ struct ipu6_auxdrv_data { container_of(_auxdev, struct ipu6_bus_device, auxdev)#define ipu6_bus_get_drvdata (adev) dev_get_drvdata(&(adev)->auxdev.dev) +extern const struct ipu6_fw_isys_ops ipu6_fw_isys_ops; +struct ipu6_bus_device * ipu6_bus_initialize_device(struct pci_dev *pdev, struct device *parent, void *pdata, const struct ipu6_buttress_ctrl *ctrl,
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +43 -28
153 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu6-fw-isys.h +3 -35
@@ -559,42 +559,10 @@ struct ipu6_fw_proxy_send_queue_token { u32 value; }; -int ipu6_fw_isys_init (struct ipu6_isys *isys,unsigned int num_streams); -int ipu6_fw_isys_close (struct ipu6_isys *isys); -int ipu6_fw_isys_send_proxy_token (struct ipu6_isys *isys, -unsigned int req_id, -unsigned int index, -unsigned int offset,u32 value); -void ipu6_fw_isys_cleanup (struct ipu6_isys *isys); -struct ipu6_fw_isys_resp_info_abi * -ipu6_fw_isys_get_resp (struct ipu6_isys *isys); -void ipu6_fw_isys_put_resp (struct ipu6_isys *isys); +int ipu6_fw_isys_send_proxy_token (struct ipu6_isys *isys,unsigned int req_id, +unsigned int index,unsigned int offset, +u32 value);int ipu6_isys_isr_one (struct ipu6_bus_device *adev);irqreturn_t ipu6_isys_isr (struct ipu6_bus_device *adev); -int ipu6_fw_isys_stream_open (struct ipu6_isys *isys, -const unsigned int stream_handle, -struct isys_fw_msgs *msg); -int ipu6_fw_isys_stream_close (struct ipu6_isys *isys, -const unsigned int stream_handle); -int ipu6_fw_isys_stream_flush (struct ipu6_isys *isys, -const unsigned int stream_handle); -int ipu6_fw_isys_stream_start (struct ipu6_isys *isys, -const unsigned int stream_handle, -struct isys_fw_msgs *msg,bool capture); -int ipu6_fw_isys_stream_capture (struct ipu6_isys *isys, -const unsigned int stream_handle, -struct isys_fw_msgs *msg); -int ipu6_fw_isys_prepare_stream_cfg (struct ipu6_isys_video *av, -struct isys_fw_msgs *msg); -void -ipu6_fw_isys_prepare_buf_set (struct isys_fw_msgs *msg, -struct ipu6_isys_stream *stream, -struct ipu6_isys_buffer_list *bl); -void -ipu6_fw_isys_dump_stream_cfg (struct device *dev,struct isys_fw_msgs *set); -void -ipu6_fw_isys_dump_frame_buff_set (struct device *dev,struct isys_fw_msgs *set, -unsigned int outputs); -#endif
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c +13 -11
@@ -237,8 +237,10 @@ static int buffer_list_get(struct ipu6_isys_stream *stream,static int ipu6_isys_stream_start (struct ipu6_isys_video *av,struct ipu6_isys_buffer_list *bl) { +struct ipu6_bus_device *adev = av->isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops;struct ipu6_isys_stream *stream = av->stream; -struct device *dev = &stream->isys->adev->auxdev.dev; +struct device *dev = &adev->auxdev.dev;struct ipu6_isys_buffer_list __bl;int ret;
@@ -262,14 +264,13 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video *av,if (!msg)return -ENOMEM ; -ipu6_fw_isys_prepare_buf_set (msg, stream, bl); -ipu6_fw_isys_dump_frame_buff_set (dev, msg, - stream->nr_output_pins); + fw_ops->prepare_buf_set (msg, stream, bl); + fw_ops->dump_frame_buf_set (dev, msg, stream->nr_output_pins);ipu6_isys_buffer_list_queue (bl,IPU6_ISYS_BUFFER_LIST_FL_ACTIVE ,0 ); - ret =ipu6_fw_isys_stream_capture (stream->isys, - stream->stream_handle, msg); + ret = fw_ops->stream_capture (stream->isys, + stream->stream_handle, msg); }while (!WARN_ON (ret));return 0 ;
@@ -288,11 +289,13 @@ static void buf_queue(struct vb2_buffer *vb) {struct ipu6_isys_queue *aq =vb2_queue_to_isys_queue (vb->vb2_queue);struct ipu6_isys_video *av =ipu6_isys_queue_to_video (aq); +struct ipu6_bus_device *adev = av->isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops;struct vb2_v4l2_buffer *vvb =to_vb2_v4l2_buffer (vb);struct ipu6_isys_video_buffer *ivb =vb2_buffer_to_ipu6_isys_video_buffer (vvb);struct ipu6_isys_buffer *ib = &ivb->ib; -struct device *dev = &av->isys->adev->auxdev.dev; +struct device *dev = &adev->auxdev.dev;struct ipu6_isys_stream *stream = av->stream;struct ipu6_isys_buffer_list bl;struct isys_fw_msgs *msg;
@@ -339,8 +342,8 @@ static void buf_queue(struct vb2_buffer *vb) goto out; } -ipu6_fw_isys_prepare_buf_set (msg, stream, &bl); -ipu6_fw_isys_dump_frame_buff_set (dev, msg, stream->nr_output_pins); + fw_ops->prepare_buf_set (msg, stream, &bl); + fw_ops->dump_frame_buf_set (dev, msg, stream->nr_output_pins);/* * We must queue the buffers in the buffer list to the
@@ -350,8 +353,7 @@ static void buf_queue(struct vb2_buffer *vb)*/ ipu6_isys_buffer_list_queue (&bl,IPU6_ISYS_BUFFER_LIST_FL_ACTIVE ,0 ); - ret =ipu6_fw_isys_stream_capture (stream->isys, stream->stream_handle, - msg); + ret = fw_ops->stream_capture (stream->isys, stream->stream_handle, msg);if (ret <0 )dev_err (dev,"send stream capture failed\n" );
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +21 -14
@@ -453,8 +453,10 @@ static void put_stream_opened(struct ipu6_isys_video *av)static int start_stream_firmware (struct ipu6_isys_video *av,struct ipu6_isys_buffer_list *bl) { +struct ipu6_bus_device *adev = av->isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops;struct ipu6_isys_stream *stream = av->stream; -struct device *dev = &av->isys->adev->auxdev.dev; +struct device *dev = &adev->auxdev.dev;struct isys_fw_msgs *msg =NULL ;int ret, retout, tout;bool capture = bl ? true : false;
@@ -463,7 +465,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av,if (!msg)return -ENOMEM ; - ret =ipu6_fw_isys_prepare_stream_cfg (av, msg); + ret = fw_ops->prepare_stream_cfg (av, msg);if (ret <0 ) {ipu6_put_fw_msg_buf (av->isys, msg);return ret;
@@ -471,7 +473,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av,reinit_completion (&stream->stream_open_completion); - ret =ipu6_fw_isys_stream_open (av->isys, stream->stream_handle, msg); + ret = fw_ops->stream_open (av->isys, stream->stream_handle, msg);if (ret <0 ) {dev_err (dev,"can't open stream (%d)\n" , ret);ipu6_put_fw_msg_buf (av->isys, msg);
@@ -504,15 +506,15 @@ static int start_stream_firmware(struct ipu6_isys_video *av, goto out_put_stream_opened; } -ipu6_fw_isys_prepare_buf_set (msg, stream, bl); + fw_ops->prepare_buf_set (msg, stream, bl);ipu6_isys_buffer_list_queue (bl,IPU6_ISYS_BUFFER_LIST_FL_ACTIVE ,0 ); }reinit_completion (&stream->stream_start_completion); - ret =ipu6_fw_isys_stream_start (av->isys, stream->stream_handle, msg, - capture); + ret = fw_ops->stream_start (av->isys, stream->stream_handle, msg, + capture);if (ret <0 ) {dev_err (dev,"can't start streaming (%d)\n" , ret);
@@ -538,7 +540,7 @@ static int start_stream_firmware(struct ipu6_isys_video *av, out_stream_close:reinit_completion (&stream->stream_close_completion); - retout =ipu6_fw_isys_stream_close (av->isys, stream->stream_handle); + retout = fw_ops->stream_close (av->isys, stream->stream_handle);if (retout <0 ) {dev_dbg (dev,"can't close stream (%d)\n" , retout); goto out_put_stream_opened;
@@ -561,13 +563,15 @@ static int start_stream_firmware(struct ipu6_isys_video *av,static void stop_streaming_firmware (struct ipu6_isys_video *av) { -struct device *dev = &av->isys->adev->auxdev.dev; +struct ipu6_bus_device *adev = av->isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops; +struct device *dev = &adev->auxdev.dev;struct ipu6_isys_stream *stream = av->stream;int ret, tout;reinit_completion (&stream->stream_stop_completion); - ret =ipu6_fw_isys_stream_flush (av->isys, stream->stream_handle); + ret = fw_ops->stream_flush (av->isys, stream->stream_handle);if (ret <0 ) {dev_err (dev,"can't stop stream (%d)\n" , ret);return ;
@@ -585,13 +589,15 @@ static void stop_streaming_firmware(struct ipu6_isys_video *av)static void close_streaming_firmware (struct ipu6_isys_video *av) { +struct ipu6_bus_device *adev = av->isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops;struct ipu6_isys_stream *stream = av->stream; -struct device *dev = &av->isys->adev->auxdev.dev; +struct device *dev = &adev->auxdev.dev;int ret, tout;reinit_completion (&stream->stream_close_completion); - ret =ipu6_fw_isys_stream_close (av->isys, stream->stream_handle); + ret = fw_ops->stream_close (av->isys, stream->stream_handle);if (ret <0 ) {dev_err (dev,"can't close stream (%d)\n" , ret);return ;
@@ -990,6 +996,7 @@ static const struct v4l2_file_operations isys_fops = {int ipu6_isys_fw_open (struct ipu6_isys *isys) {struct ipu6_bus_device *adev = isys->adev; +const struct ipu6_fw_isys_ops *fw_ops = adev->auxdrv_data->fw_ops;const struct ipu6_isys_internal_pdata *ipdata = isys->pdata->ipdata;int ret;
@@ -1018,10 +1025,10 @@ int ipu6_isys_fw_open(struct ipu6_isys *isys)* restarting isys we can safely delete old context. */ dev_warn (&adev->auxdev.dev,"clearing old context\n" ); -ipu6_fw_isys_cleanup (isys); + fw_ops->cleanup (isys); } - ret =ipu6_fw_isys_init (isys, ipdata->num_parallel_streams); + ret = fw_ops->init (isys, ipdata->num_parallel_streams);if (ret <0 ) goto out;
@@ -1044,7 +1051,7 @@ void ipu6_isys_fw_close(struct ipu6_isys *isys) isys->ref_count--;if (!isys->ref_count) { -ipu6_fw_isys_close (isys); + isys->adev->auxdrv_data->fw_ops->close (isys);if (isys->fwctx) { isys->need_reset = true; dev_warn(&isys->adev->auxdev.dev,
drivers/media/pci/intel/ipu6/ipu6-isys.c +1 -0
@@ -1068,6 +1068,7 @@ static const struct ipu6_auxdrv_data ipu6_isys_auxdrv_data = { .isr = ipu6_isys_isr, .isr_threaded = NULL, .wake_isr_thread = false, + .fw_ops = &ipu6_fw_isys_ops, };static const struct auxiliary_device_id ipu6_isys_id_table[] = {
drivers/media/pci/intel/ipu6/ipu6-isys.h +32 -0
@@ -174,6 +174,38 @@ struct isys_fw_msgs {dma_addr_t dma_addr; }; +struct ipu6_fw_isys_ops { +int (*init)(struct ipu6_isys *isys,unsigned int num_streams); +int (*close)(struct ipu6_isys *isys); +int (*send_cmd)(struct ipu6_isys *isys, +const unsigned int stream_handle, +void *cpu_mapped_buf, +dma_addr_t dma_mapped_buf, +size_t size,u16 send_type); +void (*cleanup)(struct ipu6_isys *isys); +int (*prepare_stream_cfg)(struct ipu6_isys_video *av, +struct isys_fw_msgs *msg); +void (*prepare_buf_set)(struct isys_fw_msgs *msg, +struct ipu6_isys_stream *stream, +struct ipu6_isys_buffer_list *bl); +int (*stream_open)(struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg); +int (*stream_start)(struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg,bool capture); +int (*stream_capture)(struct ipu6_isys *isys, +const unsigned int stream_handle, +struct isys_fw_msgs *msg); +int (*stream_flush)(struct ipu6_isys *isys, +const unsigned int stream_handle); +int (*stream_close)(struct ipu6_isys *isys, +const unsigned int stream_handle); +void (*dump_stream_cfg)(struct device *dev,struct isys_fw_msgs *msg); +void (*dump_frame_buf_set)(struct device *dev,struct isys_fw_msgs *msg, +unsigned int outputs); +}; +struct isys_fw_msgs *ipu6_get_fw_msg_buf (struct ipu6_isys_stream *stream);void ipu6_put_fw_msg_buf (struct ipu6_isys *isys,struct isys_fw_msgs *msg);void ipu6_cleanup_fw_msg_bufs (struct ipu6_isys *isys);
Signature · 1 line
2.55.0
PATCH v2 22/44 media: ipu6: Add ipu7 fw start/stop functionality
In reply to Antti LaaksoThe ipu7 firmware start/stop sequence differs from ipu6. Add ipu7-specific functions to handle this.
--- drivers/media/pci/intel/ipu6/ipu7-boot.c | 405 ++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu7-boot.h | 46 ++ .../media/pci/intel/ipu6/ipu7-platform-regs.h | 12 + 3 files changed, 463 insertions(+) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-boot.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-boot.h create mode 100644 drivers/media/pci/intel/ipu6/ipu7-platform-regs.h
drivers/media/pci/intel/ipu6/ipu7-boot.c new file +405 -0
@@ -0,0 +1,405 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2022 - 2026 Intel Corporation +*/ + +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/iopoll.h> +#include <linux/types.h> + +#include "ipu6.h" +#include "ipu6-bus.h" +#include "ipu6-buttress.h" +#include "ipu6-dma.h" +#include "ipu6-isys.h" +#include "ipu6-platform-buttress-regs.h" +#include "ipu7-boot.h" +#include "ipu7-platform-regs.h" + +#define IPU7_FW_START_STOP_TIMEOUT 2000 +#define IPU7_BOOT_CELL_RESET_TIMEOUT (2 * USEC_PER_SEC) +#define IPU7_BOOT_STATE_CRITICAL (s) (((s) & 0xffff0000U) == 0xdead0000U) +#define IPU7_BOOT_STATE_READY (s) ((s) == 0x57a7e100U) +#define IPU7_BOOT_STATE_INACTIVE (s) ((s) == 0x57a7e300U) +#define IPU7_BUTTRESS_REG_FW_BOOT_PARAMS0 0x4000 +#define IPU7_BUTTRESS_FW_BOOT_PARAMS_ENTRY (i) \ + (IPU7_BUTTRESS_REG_FW_BOOT_PARAMS0 + ((i) * 4U)) + +struct boot_regs { +u32 base; +u32 dmem_address; +u32 status_ctrl_reg; +u32 fw_start_address_reg; +u32 fw_code_base_reg; +}; + +enum ipu7_boot_reg_id { +IPU7_FW_BOOT_CONFIG_ID =0 , +IPU7_FW_BOOT_STATE_ID =1 , +IPU7_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID =2 , +IPU7_FW_BOOT_UNTRUSTED_ADDR_MIN_ID =3 , +IPU7_FW_BOOT_MESSAGING_VERSION_ID =4 , +IPU7_FW_BOOT_ID_MAX , +}; + +enum ipu7_boot_state { +IPU7_FW_BOOT_STATE_UNINIT =0x57a7e000U , +IPU7_FW_BOOT_STATE_READY =0x57a7e100U , +IPU7_FW_BOOT_STATE_SHUTDOWN_CMD =0x57a7f001U , +IPU7_FW_BOOT_STATE_INACTIVE =0x57a7e300U , +}; + +static const struct boot_regs boot_regs[IPU_SUBSYS_NUM ] = { + [IPU_ISYS ] = { + .dmem_address =IPU7_ISYS_DMEM_OFFSET , + .status_ctrl_reg =IPU7_BUTTRESS_REG_ISYS_UCX_CTRL_STATUS , + .fw_start_address_reg =IPU7_BUTTRESS_REG_ISYS_UCX_START_ADDR , + .fw_code_base_reg =IPU7_IS_UC_CTRL_BASE + }, + [IPU_PSYS ] = { + .dmem_address =IPU7_PSYS_DMEM_OFFSET , + .status_ctrl_reg =IPU7_BUTTRESS_REG_PSYS_UCX_CTRL_STATUS , + .fw_start_address_reg =IPU7_BUTTRESS_REG_PSYS_UCX_START_ADDR , + .fw_code_base_reg =IPU7_PS_UC_CTRL_BASE + } +}; + +static u32 get_fw_boot_reg_addr (const struct ipu6_bus_device *adev, +enum ipu7_boot_reg_id reg) +{ +u32 base = (adev->ctrl->subsys_id ==IPU_ISYS ) ? +0U : (u32 )IPU7_FW_BOOT_ID_MAX ; + +return IPU7_BUTTRESS_FW_BOOT_PARAMS_ENTRY (base + (u32 )reg); +} + +static void write_fw_boot_param (const struct ipu6_bus_device *adev, +enum ipu7_boot_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 ipu6_bus_device *adev, +enum ipu7_boot_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 ipu6_bus_device *adev) +{ +const struct device *dev = &adev->auxdev.dev; +const struct boot_regs *regs = &boot_regs[adev->ctrl->subsys_id]; +u32 ucx_ctrl_status = regs->status_ctrl_reg; +u32 timeout =IPU7_BOOT_CELL_RESET_TIMEOUT ; +void __iomem *base = adev->isp->base; +u32 val, val2; +int ret; + + val =readl (base + ucx_ctrl_status); + val |=IPU7_UCX_CTL_RESET ; + val &= ~IPU7_UCX_CTL_RUN ; + +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 ; + } + + val =readl (base + ucx_ctrl_status); + val &= ~(IPU7_UCX_CTL_RESET |IPU7_UCX_CTL_RUN ); +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 ipu6_bus_device *adev) +{ +const struct boot_regs *regs = &boot_regs[adev->ctrl->subsys_id]; +void __iomem *base = adev->isp->base; +u32 val; + + val =readl (base + regs->status_ctrl_reg); +WARN_ON (val & (IPU7_UCX_CTL_RESET |IPU7_UCX_CTL_RUN )); + + val &= ~IPU7_UCX_CTL_RESET ; + val |=IPU7_UCX_CTL_RUN ; +writel (val, base + regs->status_ctrl_reg); +} + +static void ipu7_boot_cell_stop (const struct ipu6_bus_device *adev) +{ +const struct boot_regs *regs = &boot_regs[adev->ctrl->subsys_id]; +void __iomem *base = adev->isp->base; +u32 val; + + val =readl (base + regs->status_ctrl_reg); + val &= ~IPU7_UCX_CTL_RUN ; +writel (val, base + regs->status_ctrl_reg); + +/* Wait for uC transactions complete */ +usleep_range (10 ,20 ); + + val =readl (base + regs->status_ctrl_reg); + val |=IPU7_UCX_CTL_RESET ; +writel (val, base + regs->status_ctrl_reg); +} + +static int ipu7_boot_cell_init (const struct ipu6_bus_device *adev) +{ +const struct boot_regs *regs = &boot_regs[adev->ctrl->subsys_id]; +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +struct ipu7_fw_com_context *fwctx = isys->fwctx; +void __iomem *base = adev->isp->base; + +writel (fwctx->fw_entry, base + regs->fw_start_address_reg); + +return ipu7_boot_cell_reset (adev); +} + +static void init_cfg_versions (struct ipu7_boot_abi_cfg *boot_cfg,u32 length,u8 major) +{ + boot_cfg->length = length; + boot_cfg->config_version.major =1U ; + boot_cfg->config_version.minor =0U ; + boot_cfg->config_version.subminor =0U ; + boot_cfg->config_version.patch =0U ; + + boot_cfg->client_version_support.num_versions =1U ; + boot_cfg->client_version_support.versions[0 ].major = major; + boot_cfg->client_version_support.versions[0 ].minor =0U ; + boot_cfg->client_version_support.versions[0 ].subminor =0U ; + boot_cfg->client_version_support.versions[0 ].patch =0U ; +} + +int ipu7_init_boot_config (struct ipu6_bus_device *adev, +struct ipu7_fw_com_queue_config *qconfigs, +int num_queues,u32 uc_freq, +dma_addr_t subsys_config,u8 major) +{ +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +struct ipu7_fw_com_context *fwctx = isys->fwctx; +struct ipu7_boot_abi_cfg *boot_config; +struct ipu7_fw_com_queue_params_config *cfgs; +struct device *dev = &adev->auxdev.dev; +u32 total_queue_size_aligned =0 ; +dma_addr_t queue_mem_dma_ptr; +void *queue_mem_ptr; +unsigned int i; + +/* Allocate boot config. */ + fwctx->boot_config_size = +sizeof (*cfgs) * num_queues +sizeof (*boot_config); + fwctx->boot_config =ipu6_dma_alloc (adev, fwctx->boot_config_size, + &fwctx->boot_config_dma_addr, +GFP_KERNEL ,0 ); +if (!fwctx->boot_config) { +dev_err (dev,"Failed to allocate boot config.\n" ); +return -ENOMEM ; + } + + boot_config = fwctx->boot_config; +memset (boot_config,0 ,sizeof (*boot_config)); +init_cfg_versions (boot_config, fwctx->boot_config_size, major); + boot_config->subsys_config = subsys_config; + + boot_config->uc_tile_frequency = uc_freq; + boot_config->uc_tile_frequency_units =0 ; + boot_config->fw_com_config.max_output_queues = + fwctx->num_output_queues; + boot_config->fw_com_config.max_input_queues = + fwctx->num_input_queues; + +ipu6_dma_sync_single (adev, fwctx->boot_config_dma_addr, + fwctx->boot_config_size); + +for (i =0 ; i < num_queues; i++) { +u32 queue_size = qconfigs[i].max_capacity * + qconfigs[i].token_size_in_bytes; + + queue_size =ALIGN (queue_size,64U ); + total_queue_size_aligned += queue_size; + qconfigs[i].queue_size = queue_size; + } + +/* Allocate queue memory */ + fwctx->queue_mem =ipu6_dma_alloc (adev, total_queue_size_aligned, + &fwctx->queue_mem_dma_addr, +GFP_KERNEL ,0 ); +if (!fwctx->queue_mem) { +dev_err (dev,"Failed to allocate queue memory.\n" ); +return -ENOMEM ; + } + fwctx->queue_mem_size = total_queue_size_aligned; + + cfgs =ipu7_fw_com_get_queue_config (&boot_config->fw_com_config); + queue_mem_ptr = fwctx->queue_mem; + queue_mem_dma_ptr = fwctx->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; + } + +ipu6_dma_sync_single (adev, fwctx->queue_mem_dma_addr, + total_queue_size_aligned); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (ipu7_init_boot_config,"INTEL_IPU6" ); + +void ipu7_release_boot_config (struct ipu6_bus_device *adev) +{ +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +struct ipu7_fw_com_context *fwctx; + +if (!isys || !isys->fwctx) +return ; + + fwctx = isys->fwctx; + +if (fwctx->queue_mem) { +ipu6_dma_free (adev, fwctx->queue_mem_size, + fwctx->queue_mem, + fwctx->queue_mem_dma_addr,0 ); + fwctx->queue_mem =NULL ; + fwctx->queue_mem_dma_addr =0 ; + } + +if (fwctx->boot_config) { +ipu6_dma_free (adev, fwctx->boot_config_size, + fwctx->boot_config, + fwctx->boot_config_dma_addr,0 ); + fwctx->boot_config =NULL ; + fwctx->boot_config_dma_addr =0 ; + } +} +EXPORT_SYMBOL_NS_GPL (ipu7_release_boot_config,"INTEL_IPU6" ); + +int ipu7_boot_start_fw (const struct ipu6_bus_device *adev) +{ +const struct device *dev = &adev->auxdev.dev; +struct ipu6_isys *isys =ipu6_bus_get_drvdata (adev); +struct ipu7_fw_com_context *fwctx = isys->fwctx; +u32 timeout =IPU7_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; + +/* store "uninit" state to boot state reg */ +write_fw_boot_param (adev,IPU7_FW_BOOT_STATE_ID , +IPU7_FW_BOOT_STATE_UNINIT ); +/* Set registers to zero, recommended for diagnostics. */ +write_fw_boot_param (adev, +IPU7_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID ,0 ); +write_fw_boot_param (adev,IPU7_FW_BOOT_MESSAGING_VERSION_ID ,0 ); +/* store firmware configuration address */ +write_fw_boot_param (adev,IPU7_FW_BOOT_CONFIG_ID , + fwctx->boot_config_dma_addr); + +ipu7_boot_cell_start (adev); + + last_boot_state =IPU7_FW_BOOT_STATE_UNINIT ; +while (timeout--) { + boot_state =read_fw_boot_param (adev, +IPU7_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 (IPU7_BOOT_STATE_CRITICAL (boot_state) || +IPU7_BOOT_STATE_READY (boot_state)) +break ; +usleep_range (1000 ,1200 ); + } + +if (IPU7_BOOT_STATE_CRITICAL (boot_state)) { +dev_err (dev,"critical boot state error 0x%x\n" , boot_state); +return -EINVAL ; + }else if (!IPU7_BOOT_STATE_READY (boot_state)) { +dev_err (dev,"fw boot timeout. state: 0x%x\n" , boot_state); +return -ETIMEDOUT ; + } +dev_dbg (dev,"fw boot done.\n" ); + + id =IPU7_FW_BOOT_SYSCOM_QUEUE_INDICES_BASE_ID ; + indices_addr =read_fw_boot_param (adev, id); + fwctx->queue_indices = base + indices_addr; +dev_dbg (dev,"fw queue indices offset is 0x%x\n" , indices_addr); + + msg_ver =read_fw_boot_param (adev, +IPU7_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_IPU6" ); + +int ipu7_boot_stop_fw (const struct ipu6_bus_device *adev) +{ +const struct device *dev = &adev->auxdev.dev; +u32 timeout =IPU7_FW_START_STOP_TIMEOUT ; +u32 boot_state; + + boot_state =read_fw_boot_param (adev,IPU7_FW_BOOT_STATE_ID ); +if (IPU7_BOOT_STATE_CRITICAL (boot_state) || + !IPU7_BOOT_STATE_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,IPU7_FW_BOOT_STATE_ID , +IPU7_FW_BOOT_STATE_SHUTDOWN_CMD ); +while (timeout--) { + boot_state =read_fw_boot_param (adev, +IPU7_FW_BOOT_STATE_ID ); +if (IPU7_BOOT_STATE_CRITICAL (boot_state) || +IPU7_BOOT_STATE_INACTIVE (boot_state)) +break ; +usleep_range (1000 ,1200 ); + } + +if (IPU7_BOOT_STATE_CRITICAL (boot_state)) { +dev_err (dev,"critical boot state error 0x%x\n" , boot_state); +return -EINVAL ; + }else if (!IPU7_BOOT_STATE_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_IPU6" );
drivers/media/pci/intel/ipu6/ipu7-boot.h new file +46 -0
46 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-platform-regs.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2026 Intel Corporation */ + +#ifndef IPU7_PLATFORM_REGS_H +#define IPU7_PLATFORM_REGS_H + +#define IPU7_IS_UC_CTRL_BASE 0x230000 +#define IPU7_ISYS_DMEM_OFFSET 0x200000 +#define IPU7_PS_UC_CTRL_BASE 0x130000 +#define IPU7_PSYS_DMEM_OFFSET 0x100000 + +#endif
Signature · 1 line
2.55.0
PATCH v2 23/44 media: ipu6: Add ipu7 fw com methods
In reply to Antti LaaksoThe get/put token methods read/write to ipu7 firmware message queues.
--- drivers/media/pci/intel/ipu6/Makefile | 4 +- drivers/media/pci/intel/ipu6/ipu7-fw-com.c | 74 ++++++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu7-fw-com.h | 51 +++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.h
drivers/media/pci/intel/ipu6/Makefile +3 -1
@@ -8,7 +8,9 @@ intel-ipu6-y := ipu6.o \ ipu7-mmu-hw.o \ ipu6-buttress.o \ ipu6-cpd.o \ - ipu6-fw-com.o + ipu6-fw-com.o \ + ipu7-fw-com.o \ + ipu7-boot.o obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6.o
drivers/media/pci/intel/ipu6/ipu7-fw-com.c new file +74 -0
74 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-fw-com.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 24/44 media: ipu6: Add ipu7 fw isys ops
In reply to Antti LaaksoThe ipu7 isys firmware functions handle messaging
with ipu7 hardware.
--- drivers/media/pci/intel/ipu6/Makefile | 1 + drivers/media/pci/intel/ipu6/ipu6-bus.h | 2 + drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 3 +- .../media/pci/intel/ipu6/ipu6-isys-queue.c | 2 +- .../media/pci/intel/ipu6/ipu6-isys-queue.h | 2 + .../media/pci/intel/ipu6/ipu6-isys-video.c | 1 + .../media/pci/intel/ipu6/ipu6-isys-video.h | 1 + drivers/media/pci/intel/ipu6/ipu6-isys.c | 15 +- drivers/media/pci/intel/ipu6/ipu6-isys.h | 13 +- drivers/media/pci/intel/ipu6/ipu7-fw-com.h | 2 + drivers/media/pci/intel/ipu6/ipu7-fw-isys.c | 465 ++++++++++++++++++ drivers/media/pci/intel/ipu6/ipu7-fw-isys.h | 258 ++++++++++ 12 files changed, 757 insertions(+), 8 deletions(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-isys.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-isys.h
drivers/media/pci/intel/ipu6/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6.o intel-ipu6-isys-y := ipu6-isys.o \ ipu6-isys-csi2.o \ ipu6-fw-isys.o \ + ipu7-fw-isys.o \ ipu6-isys-video.o \ ipu6-isys-queue.o \ ipu6-isys-subdev.o \
drivers/media/pci/intel/ipu6/ipu6-bus.h +2 -0
@@ -31,6 +31,7 @@ struct ipu6_bus_device {u64 *pkg_dir;dma_addr_t pkg_dir_dma_addr;unsigned int pkg_dir_size; +u32 fw_entry; };struct ipu6_auxdrv_data {
@@ -47,6 +48,7 @@ struct ipu6_auxdrv_data {#define ipu6_bus_get_drvdata (adev) dev_get_drvdata(&(adev)->auxdev.dev)extern const struct ipu6_fw_isys_ops ipu6_fw_isys_ops; +extern const struct ipu6_fw_isys_ops ipu7_fw_isys_ops;struct ipu6_bus_device * ipu6_bus_initialize_device(struct pci_dev *pdev, struct device *parent,
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +2 -1
@@ -15,6 +15,7 @@#include "ipu6-isys.h" #include "ipu6-platform-isys-csi2-reg.h" #include "ipu6-platform-regs.h" +#include "ipu7-fw-isys.h" static const char send_msg_types[N_IPU6_FW_ISYS_SEND_TYPE ][32 ] = {"STREAM_OPEN" ,
@@ -602,7 +603,7 @@ int ipu6_isys_isr_one(struct ipu6_bus_device *adev) } isys_fw_msg =container_of ((void *)(uintptr_t )resp->buf_id, - struct isys_fw_msgs, ipu6.dummy); + struct isys_fw_msgs, dummy);ipu6_put_fw_msg_buf (ipu6_bus_get_drvdata (adev), isys_fw_msg); if (resp->pin_id < IPU6_ISYS_OUTPUT_PINS &&
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c +1 -1
@@ -684,7 +684,7 @@ static void ipu6_isys_queue_buf_done(struct ipu6_isys_buffer *ib) } } -static void +void ipu6_stream_buf_ready (struct ipu6_isys_stream *stream,u8 pin_id,u32 pin_addr,u64 time,bool error_check) {
drivers/media/pci/intel/ipu6/ipu6-isys-queue.h +2 -0
@@ -63,4 +63,6 @@ void ipu6_isys_buffer_list_queue(struct ipu6_isys_buffer_list *bl,void ipu6_isys_queue_buf_ready (struct ipu6_isys_stream *stream,struct ipu6_fw_isys_resp_info_abi *info);int ipu6_isys_queue_init (struct ipu6_isys_queue *aq); +void ipu6_stream_buf_ready (struct ipu6_isys_stream *stream,u8 pin_id, +u32 pin_addr,u64 time,bool error_check);#endif /* IPU6_ISYS_QUEUE_H */
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +1 -0
@@ -627,6 +627,7 @@ int ipu6_isys_video_prepare_stream(struct ipu6_isys_video *av, stream->nr_queues = nr_queues;atomic_set (&stream->sequence,0 ); +atomic_set (&stream->buf_id,0 ); stream->seq_index =0 ;memset (stream->seq,0 ,sizeof (stream->seq));
drivers/media/pci/intel/ipu6/ipu6-isys-video.h +1 -0
@@ -44,6 +44,7 @@ struct sequence_info {struct ipu6_isys_stream {struct mutex mutex;atomic_t sequence; +atomic_t buf_id;unsigned int seq_index;struct sequence_info seq[IPU6_ISYS_MAX_PARALLEL_SOF ];int stream_source;
drivers/media/pci/intel/ipu6/ipu6-isys.c +12 -3
@@ -931,6 +931,9 @@ void ipu6_put_fw_msg_buf(struct ipu6_isys *isys, struct isys_fw_msgs *msg)spin_unlock_irqrestore (&isys->listlock, flags); } +static const struct ipu6_auxdrv_data ipu6_isys_auxdrv_data; +static const struct ipu6_auxdrv_data ipu7_isys_auxdrv_data; +static int isys_probe (struct auxiliary_device *auxdev,const struct auxiliary_device_id *auxdev_id) {
@@ -949,8 +952,8 @@ static int isys_probe(struct auxiliary_device *auxdev,if (!isys)return -ENOMEM ; - adev->auxdrv_data = - (const struct ipu6_auxdrv_data *)auxdev_id->driver_data; + adev->auxdrv_data =IS_IPU7 (isp) ? &ipu7_isys_auxdrv_data : + &ipu6_isys_auxdrv_data; adev->auxdrv =to_auxiliary_drv (auxdev->dev.driver); isys->adev = adev; isys->pdata = adev->pdata;
@@ -1071,10 +1074,16 @@ static const struct ipu6_auxdrv_data ipu6_isys_auxdrv_data = { .fw_ops = &ipu6_fw_isys_ops, }; +static const struct ipu6_auxdrv_data ipu7_isys_auxdrv_data = { + .isr = ipu6_isys_isr, + .isr_threaded =NULL , + .wake_isr_thread = false, + .fw_ops = &ipu7_fw_isys_ops, +}; +static const struct auxiliary_device_id ipu6_isys_id_table[] = { { .name ="intel_ipu6.isys" , - .driver_data = (kernel_ulong_t)&ipu6_isys_auxdrv_data, }, { } };
drivers/media/pci/intel/ipu6/ipu6-isys.h +10 -3
@@ -17,6 +17,7 @@#include "ipu6.h" #include "ipu6-fw-isys.h" +#include "ipu7-fw-isys.h" #include "ipu6-isys-csi2.h" #include "ipu6-isys-video.h"
@@ -167,9 +168,15 @@ struct ipu6_isys {struct isys_fw_msgs {union {u64 dummy; -struct ipu6_fw_isys_frame_buff_set_abi frame; -struct ipu6_fw_isys_stream_cfg_data_abi stream; - } ipu6; +union { +struct ipu6_fw_isys_frame_buff_set_abi frame; +struct ipu6_fw_isys_stream_cfg_data_abi stream; + } ipu6; +union { +struct ipu7_fw_isys_frame_buff_set frame; +struct ipu7_fw_isys_stream_cfg stream; + } ipu7; + };struct list_head head;dma_addr_t dma_addr; };
drivers/media/pci/intel/ipu6/ipu7-fw-com.h +2 -0
@@ -25,6 +25,8 @@ struct ipu7_fw_com_context {dma_addr_t boot_config_dma_addr;u32 boot_config_size;u32 fw_entry; +struct ipu7_insys_config *fw_config; +dma_addr_t fw_config_dma_addr; };struct ipu7_fw_com_queue_params_config {
drivers/media/pci/intel/ipu6/ipu7-fw-isys.c new file +465 -0
465 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-fw-isys.h new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 25/44 media: ipu6: Add ipu7 csi2 register definitions
In reply to Antti LaaksoThis is needed later when adding support for the ipu7 csi2 receiver.
--- .../pci/intel/ipu6/ipu7-isys-csi2-regs.h | 1189 +++++++++++++++++ 1 file changed, 1189 insertions(+) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h
drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h new file +1189 -0
@@ -0,0 +1,1189 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2020 - 2026 Intel Corporation +*/ + +#ifndef IPU7_ISYS_CSI2_REG_H +#define IPU7_ISYS_CSI2_REG_H + +/* IS main regs base */ +#define IPU7_IS_MAIN_BASE 0x240000 +#define IPU7_IS_MAIN_S2B_BASE (IPU7_IS_MAIN_BASE + 0x22000) +#define IPU7_IS_MAIN_B2O_BASE (IPU7_IS_MAIN_BASE + 0x26000) +#define IPU7_IS_MAIN_ISD_M0_BASE (IPU7_IS_MAIN_BASE + 0x2b000) +#define IPU7_IS_MAIN_ISD_M1_BASE (IPU7_IS_MAIN_BASE + 0x2b100) +#define IPU7_IS_MAIN_ISD_INT_BASE (IPU7_IS_MAIN_BASE + 0x2b200) +#define IPU7_IS_MAIN_GDA_BASE (IPU7_IS_MAIN_BASE + 0x32000) +#define IPU7_IS_MAIN_GPREGS_MAIN_BASE (IPU7_IS_MAIN_BASE + 0x32500) +#define IPU7_IS_MAIN_IRQ_CTRL_BASE (IPU7_IS_MAIN_BASE + 0x32700) +#define IPU7_IS_MAIN_PWM_CTRL_BASE (IPU7_IS_MAIN_BASE + 0x32b00) + +#define IPU7_S2B_IRQ_COMMON_0_CTL_STATUS (IPU7_IS_MAIN_S2B_BASE + 0x1c) +#define IPU7_S2B_IRQ_COMMON_0_CTL_CLEAR (IPU7_IS_MAIN_S2B_BASE + 0x20) +#define IPU7_S2B_IRQ_COMMON_0_CTL_ENABLE (IPU7_IS_MAIN_S2B_BASE + 0x24) +#define IPU7_S2B_IID_IRQ_CTL_STATUS (iid) (IPU7_IS_MAIN_S2B_BASE + 0x94 + \ + 0x100 * (iid)) + +#define IPU7_B2O_IRQ_COMMON_0_CTL_STATUS (IPU7_IS_MAIN_B2O_BASE + 0x30) +#define IPU7_B2O_IRQ_COMMON_0_CTL_CLEAR (IPU7_IS_MAIN_B2O_BASE + 0x34) +#define IPU7_B2O_IRQ_COMMON_0_CTL_ENABLE (IPU7_IS_MAIN_B2O_BASE + 0x38) +#define IPU7_B2O_IID_IRQ_CTL_STATUS (oid) (IPU7_IS_MAIN_B2O_BASE + 0x3dc + \ + 0x200 * (oid)) + +#define IPU7_ISD_M0_IRQ_CTL_STATUS (IPU7_IS_MAIN_ISD_M0_BASE + 0x1c) +#define IPU7_ISD_M0_IRQ_CTL_CLEAR (IPU7_IS_MAIN_ISD_M0_BASE + 0x20) +#define IPU7_ISD_M0_IRQ_CTL_ENABLE (IPU7_IS_MAIN_ISD_M0_BASE + 0x24) + +#define IPU7_ISD_M1_IRQ_CTL_STATUS (IPU7_IS_MAIN_ISD_M1_BASE + 0x1c) +#define IPU7_ISD_M1_IRQ_CTL_CLEAR (IPU7_IS_MAIN_ISD_M1_BASE + 0x20) +#define IPU7_ISD_M1_IRQ_CTL_ENABLE (IPU7_IS_MAIN_ISD_M1_BASE + 0x24) + +#define IPU7_ISD_INT_IRQ_CTL_STATUS (IPU7_IS_MAIN_ISD_INT_BASE + 0x1c) +#define IPU7_ISD_INT_IRQ_CTL_CLEAR (IPU7_IS_MAIN_ISD_INT_BASE + 0x20) +#define IPU7_ISD_INT_IRQ_CTL_ENABLE (IPU7_IS_MAIN_ISD_INT_BASE + 0x24) + +#define IPU7_GDA_IRQ_CTL_STATUS (IPU7_IS_MAIN_GDA_BASE + 0x1c) +#define IPU7_GDA_IRQ_CTL_CLEAR (IPU7_IS_MAIN_GDA_BASE + 0x20) +#define IPU7_GDA_IRQ_CTL_ENABLE (IPU7_IS_MAIN_GDA_BASE + 0x24) + +#define IPU7_IS_MAIN_IRQ_CTL_EDGE IPU7_IS_MAIN_IRQ_CTRL_BASE +#define IPU7_IS_MAIN_IRQ_CTL_MASK (IPU7_IS_MAIN_IRQ_CTRL_BASE + 0x4) +#define IPU7_IS_MAIN_IRQ_CTL_STATUS (IPU7_IS_MAIN_IRQ_CTRL_BASE + 0x8) +#define IPU7_IS_MAIN_IRQ_CTL_CLEAR (IPU7_IS_MAIN_IRQ_CTRL_BASE + 0xc) +#define IPU7_IS_MAIN_IRQ_CTL_ENABLE (IPU7_IS_MAIN_IRQ_CTRL_BASE + 0x10) +#define IPU7_IS_MAIN_IRQ_CTL_LEVEL_NOT_PULSE (IPU7_IS_MAIN_IRQ_CTRL_BASE + 0x14) + +/* IS IO regs base */ +#define IPU7_IS_PHY_NUM 4U +#define IPU7_IS_IO_BASE 0x280000 + +/* dwc csi cdphy registers */ +#define IPU7_IS_IO_CDPHY_BASE (i) (IPU7_IS_IO_BASE + 0x10000 * (i)) +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_0 0x1800 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_1 0x1802 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_2 0x1804 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_3 0x1806 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_4 0x1808 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_5 0x180a +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_6 0x180c +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_7 0x180e +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_8 0x1810 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_9 0x1812 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_A 0x1814 +#define IPU7_PPI_STARTUP_RW_COMMON_DPHY_10 0x1820 +#define IPU7_PPI_STARTUP_RW_COMMON_STARTUP_1_1 0x1822 +#define IPU7_PPI_STARTUP_RW_COMMON_STARTUP_1_2 0x1824 +#define IPU7_PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_0 0x1840 +#define IPU7_PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_1 0x1842 +#define IPU7_PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_2 0x1844 +#define IPU7_PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_3 0x1846 +#define IPU7_PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_4 0x1848 +#define IPU7_PPI_CALIBCTRL_R_COMMON_CALIBCTRL_2_5 0x184a +#define IPU7_PPI_CALIBCTRL_RW_COMMON_BG_0 0x184c +#define IPU7_PPI_CALIBCTRL_RW_COMMON_CALIBCTRL_2_7 0x184e +#define IPU7_PPI_CALIBCTRL_RW_ADC_CFG_0 0x1850 +#define IPU7_PPI_CALIBCTRL_RW_ADC_CFG_1 0x1852 +#define IPU7_PPI_CALIBCTRL_R_ADC_DEBUG 0x1854 +#define IPU7_PPI_RW_LPDCOCAL_TOP_OVERRIDE 0x1c00 +#define IPU7_PPI_RW_LPDCOCAL_TIMEBASE 0x1c02 +#define IPU7_PPI_RW_LPDCOCAL_NREF 0x1c04 +#define IPU7_PPI_RW_LPDCOCAL_NREF_RANGE 0x1c06 +#define IPU7_PPI_RW_LPDCOCAL_NREF_TRIGGER_MAN 0x1c08 +#define IPU7_PPI_RW_LPDCOCAL_TWAIT_CONFIG 0x1c0a +#define IPU7_PPI_RW_LPDCOCAL_VT_CONFIG 0x1c0c +#define IPU7_PPI_R_LPDCOCAL_DEBUG_RB 0x1c0e +#define IPU7_PPI_RW_LPDCOCAL_COARSE_CFG 0x1c10 +#define IPU7_PPI_R_LPDCOCAL_DEBUG_COARSE_RB 0x1c12 +#define IPU7_PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_0_RB 0x1c14 +#define IPU7_PPI_R_LPDCOCAL_DEBUG_COARSE_MEAS_1_RB 0x1c16 +#define IPU7_PPI_R_LPDCOCAL_DEBUG_COARSE_FWORD_RB 0x1c18 +#define IPU7_PPI_R_LPDCOCAL_DEBUG_MEASURE_CURR_ERROR 0x1c1a +#define IPU7_PPI_R_LPDCOCAL_DEBUG_MEASURE_LAST_ERROR 0x1c1c +#define IPU7_PPI_R_LPDCOCAL_DEBUG_VT 0x1c1e +#define IPU7_PPI_RW_LB_TIMEBASE_CONFIG 0x1c20 +#define IPU7_PPI_RW_LB_STARTCMU_CONFIG 0x1c22 +#define IPU7_PPI_R_LBPULSE_COUNTER_RB 0x1c24 +#define IPU7_PPI_R_LB_START_CMU_RB 0x1c26 +#define IPU7_PPI_RW_LB_DPHY_BURST_START 0x1c28 +#define IPU7_PPI_RW_LB_CPHY_BURST_START 0x1c2a +#define IPU7_PPI_RW_DDLCAL_CFG_0 0x1c40 +#define IPU7_PPI_RW_DDLCAL_CFG_1 0x1c42 +#define IPU7_PPI_RW_DDLCAL_CFG_2 0x1c44 +#define IPU7_PPI_RW_DDLCAL_CFG_3 0x1c46 +#define IPU7_PPI_RW_DDLCAL_CFG_4 0x1c48 +#define IPU7_PPI_RW_DDLCAL_CFG_5 0x1c4a +#define IPU7_PPI_RW_DDLCAL_CFG_6 0x1c4c +#define IPU7_PPI_RW_DDLCAL_CFG_7 0x1c4e +#define IPU7_PPI_R_DDLCAL_DEBUG_0 0x1c50 +#define IPU7_PPI_R_DDLCAL_DEBUG_1 0x1c52 +#define IPU7_PPI_RW_PARITY_TEST 0x1c60 +#define IPU7_PPI_RW_STARTUP_OVR_0 0x1c62 +#define IPU7_PPI_RW_STARTUP_STATE_OVR_1 0x1c64 +#define IPU7_PPI_RW_DTB_SELECTOR 0x1c66 +#define IPU7_PPI_RW_DPHY_CLK_SPARE 0x1c6a +#define IPU7_PPI_RW_COMMON_CFG 0x1c6c +#define IPU7_PPI_RW_TERMCAL_CFG_0 0x1c80 +#define IPU7_PPI_R_TERMCAL_DEBUG_0 0x1c82 +#define IPU7_PPI_RW_TERMCAL_CTRL_0 0x1c84 +#define IPU7_PPI_RW_OFFSETCAL_CFG_0 0x1ca0 +#define IPU7_PPI_R_OFFSETCAL_DEBUG_LANE0 0x1ca2 +#define IPU7_PPI_R_OFFSETCAL_DEBUG_LANE1 0x1ca4 +#define IPU7_PPI_R_OFFSETCAL_DEBUG_LANE2 0x1ca6 +#define IPU7_PPI_R_OFFSETCAL_DEBUG_LANE3 0x1ca8 +#define IPU7_PPI_R_OFFSETCAL_DEBUG_LANE4 0x1caa +#define IPU7_PPI_RW_HSDCOCAL_CFG_O 0x1d00 +#define IPU7_PPI_RW_HSDCOCAL_CFG_1 0x1d02 +#define IPU7_PPI_RW_HSDCOCAL_CFG_2 0x1d04 +#define IPU7_PPI_RW_HSDCOCAL_CFG_3 0x1d06 +#define IPU7_PPI_RW_HSDCOCAL_CFG_4 0x1d08 +#define IPU7_PPI_RW_HSDCOCAL_CFG_5 0x1d0a +#define IPU7_PPI_RW_HSDCOCAL_CFG_6 0x1d0c +#define IPU7_PPI_RW_HSDCOCAL_CFG_7 0x1d0e +#define IPU7_PPI_RW_HSDCOCAL_CFG_8 0x1d10 +#define IPU7_PPI_R_HSDCOCAL_DEBUG_RB 0x1d12 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_0 0x2000 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_1 0x2002 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_2 0x2004 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_3 0x2006 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_4 0x2008 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_5 0x200a +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_6 0x200c +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_7 0x200e +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE0_OVR_0_8 0x2010 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_9 0x2012 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_10 0x2014 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_11 0x2016 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_12 0x2018 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_13 0x201a +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_14 0x201c +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE0_OVR_0_15 0x201e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_0 0x2020 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_1 0x2022 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_2 0x2024 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_3 0x2026 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_4 0x2028 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_5 0x202a +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_6 0x202c +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_7 0x202e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_8 0x2030 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_1_9 0x2032 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_10 0x2034 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_11 0x2036 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_12 0x2038 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_13 0x203a +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_14 0x203c +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_1_15 0x203e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_0 0x2040 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_1 0x2042 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_2 0x2044 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_3 0x2046 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_4 0x2048 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_5 0x204a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_6 0x204c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7 0x204e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_8 0x2050 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9 0x2052 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_10 0x2054 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_11 0x2056 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_12 0x2058 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_13 0x205a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_14 0x205c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_15 0x205e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_0 0x2060 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_1 0x2062 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_2 0x2064 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_3 0x2066 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_4 0x2068 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_5 0x206a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_6 0x206c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_3_7 0x206e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_8 0x2070 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_9 0x2072 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_10 0x2074 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_11 0x2076 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_12 0x2078 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_13 0x207a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_14 0x207c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_3_15 0x207e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_0 0x2080 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_1 0x2082 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_2 0x2084 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_3 0x2086 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE0_CTRL_4_4 0x2088 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_0 0x20a0 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_1 0x20a2 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_2 0x20a4 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE0_OVR_5_3 0x20a6 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE0_OVR_5_4 0x20a8 +#define IPU7_CORE_DIG_RW_TRIO0_0 0x2100 +#define IPU7_CORE_DIG_RW_TRIO0_1 0x2102 +#define IPU7_CORE_DIG_RW_TRIO0_2 0x2104 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_0 0x2400 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_1 0x2402 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_2 0x2404 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_3 0x2406 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_4 0x2408 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_5 0x240a +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_6 0x240c +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_7 0x240e +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE1_OVR_0_8 0x2410 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_9 0x2412 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_10 0x2414 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_11 0x2416 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_12 0x2418 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_13 0x241a +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_14 0x241c +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE1_OVR_0_15 0x241e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_0 0x2420 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_1 0x2422 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_2 0x2424 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_3 0x2426 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_4 0x2428 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_5 0x242a +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_6 0x242c +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_7 0x242e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_8 0x2430 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_1_9 0x2432 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_10 0x2434 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_11 0x2436 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_12 0x2438 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_13 0x243a +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_14 0x243c +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_1_15 0x243e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_0 0x2440 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_1 0x2442 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_2 0x2444 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_3 0x2446 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_4 0x2448 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_5 0x244a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_6 0x244c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_7 0x244e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_8 0x2450 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_9 0x2452 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_10 0x2454 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_11 0x2456 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_12 0x2458 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_13 0x245a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_14 0x245c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_15 0x245e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_0 0x2460 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_1 0x2462 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_2 0x2464 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_3 0x2466 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_4 0x2468 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_5 0x246a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_6 0x246c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_3_7 0x246e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_8 0x2470 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_9 0x2472 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_10 0x2474 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_11 0x2476 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_12 0x2478 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_13 0x247a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_14 0x247c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_3_15 0x247e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_0 0x2480 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_1 0x2482 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_2 0x2484 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_3 0x2486 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE1_CTRL_4_4 0x2488 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_0 0x24a0 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_1 0x24a2 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_2 0x24a4 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE1_OVR_5_3 0x24a6 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE1_OVR_5_4 0x24a8 +#define IPU7_CORE_DIG_RW_TRIO1_0 0x2500 +#define IPU7_CORE_DIG_RW_TRIO1_1 0x2502 +#define IPU7_CORE_DIG_RW_TRIO1_2 0x2504 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_0 0x2800 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_1 0x2802 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_2 0x2804 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_3 0x2806 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_4 0x2808 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_5 0x280a +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_6 0x280c +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_7 0x280e +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE2_OVR_0_8 0x2810 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_9 0x2812 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_10 0x2814 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_11 0x2816 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_12 0x2818 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_13 0x281a +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_14 0x281c +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE2_OVR_0_15 0x281e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_0 0x2820 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_1 0x2822 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_2 0x2824 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_3 0x2826 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_4 0x2828 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_5 0x282a +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_6 0x282c +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_7 0x282e +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_8 0x2830 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_1_9 0x2832 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_10 0x2834 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_11 0x2836 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_12 0x2838 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_13 0x283a +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_14 0x283c +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_1_15 0x283e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_0 0x2840 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_1 0x2842 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_2 0x2844 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_3 0x2846 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_4 0x2848 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_5 0x284a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_6 0x284c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_7 0x284e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_8 0x2850 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_9 0x2852 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_10 0x2854 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_11 0x2856 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_12 0x2858 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_13 0x285a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_14 0x285c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_15 0x285e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_0 0x2860 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_1 0x2862 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_2 0x2864 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_3 0x2866 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_4 0x2868 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_5 0x286a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_6 0x286c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_3_7 0x286e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_8 0x2870 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_9 0x2872 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_10 0x2874 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_11 0x2876 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_12 0x2878 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_13 0x287a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_14 0x287c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_3_15 0x287e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_0 0x2880 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_1 0x2882 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_2 0x2884 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_3 0x2886 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE2_CTRL_4_4 0x2888 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_0 0x28a0 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_1 0x28a2 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_2 0x28a4 +#define IPU7_CORE_DIG_IOCTRL_RW_CPHY_PPI_LANE2_OVR_5_3 0x28a6 +#define IPU7_CORE_DIG_IOCTRL_R_CPHY_PPI_LANE2_OVR_5_4 0x28a8 +#define IPU7_CORE_DIG_RW_TRIO2_0 0x2900 +#define IPU7_CORE_DIG_RW_TRIO2_1 0x2902 +#define IPU7_CORE_DIG_RW_TRIO2_2 0x2904 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_0 0x2c00 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_1 0x2c02 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_2 0x2c04 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_3 0x2c06 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_4 0x2c08 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_5 0x2c0a +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_6 0x2c0c +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_7 0x2c0e +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_LANE3_OVR_0_8 0x2c10 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_9 0x2c12 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_10 0x2c14 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_11 0x2c16 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_12 0x2c18 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_13 0x2c1a +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_14 0x2c1c +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_LANE3_OVR_0_15 0x2c1e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_0 0x2c40 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_1 0x2c42 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_2 0x2c44 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_3 0x2c46 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_4 0x2c48 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_5 0x2c4a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_6 0x2c4c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_7 0x2c4e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_8 0x2c50 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_9 0x2c52 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_10 0x2c54 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_11 0x2c56 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_12 0x2c58 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_13 0x2c5a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_14 0x2c5c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_15 0x2c5e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_0 0x2c60 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_1 0x2c62 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_2 0x2c64 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_3 0x2c66 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_4 0x2c68 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_5 0x2c6a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_6 0x2c6c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_3_7 0x2c6e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_8 0x2c70 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_9 0x2c72 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_10 0x2c74 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_11 0x2c76 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_12 0x2c78 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_13 0x2c7a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_14 0x2c7c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_3_15 0x2c7e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_0 0x2c80 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_1 0x2c82 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_2 0x2c84 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_3 0x2c86 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE3_CTRL_4_4 0x2c88 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_0 0x3040 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_1 0x3042 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_2 0x3044 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_3 0x3046 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_4 0x3048 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_5 0x304a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_6 0x304c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_7 0x304e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_8 0x3050 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_9 0x3052 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_10 0x3054 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_11 0x3056 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_12 0x3058 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_13 0x305a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_14 0x305c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_15 0x305e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_0 0x3060 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_1 0x3062 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_2 0x3064 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_3 0x3066 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_4 0x3068 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_5 0x306a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_6 0x306c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_3_7 0x306e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_8 0x3070 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_9 0x3072 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_10 0x3074 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_11 0x3076 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_12 0x3078 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_13 0x307a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_14 0x307c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_3_15 0x307e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_0 0x3080 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_1 0x3082 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_2 0x3084 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_3 0x3086 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_LANE4_CTRL_4_4 0x3088 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_0 0x3400 +#define IPU7_CORE_DIG_IOCTRL_RW_DPHY_PPI_CLK_OVR_0_1 0x3402 +#define IPU7_CORE_DIG_IOCTRL_R_DPHY_PPI_CLK_OVR_0_2 0x3404 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_0 0x3800 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_1 0x3802 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_2 0x3804 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_3 0x3806 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_4 0x3808 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_5 0x380a +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_6 0x380c +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_7 0x380e +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_8 0x3810 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_9 0x3812 +#define IPU7_CORE_DIG_IOCTRL_RW_COMMON_PPI_OVR_0_10 0x3814 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_11 0x3816 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_12 0x3818 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_13 0x381a +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_14 0x381c +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_0_15 0x381e +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_0 0x3820 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_1 0x3822 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_2 0x3824 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_3 0x3826 +#define IPU7_CORE_DIG_IOCTRL_R_COMMON_PPI_OVR_1_4 0x3828 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_0 0x3840 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_1 0x3842 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_2 0x3844 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_3 0x3846 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_4 0x3848 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5 0x384a +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_6 0x384c +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7 0x384e +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_8 0x3850 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_9 0x3852 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_10 0x3854 +#define IPU7_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_11 0x3856 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_12 0x3858 +#define IPU7_CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_13 0x385a +#define IPU7_CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_14 0x385c +#define IPU7_CORE_DIG_IOCTRL_R_AFE_CB_CTRL_2_15 0x385e +#define IPU7_CORE_DIG_IOCTRL_R_AFE_CB_CTRL_3_0 0x3860 +#define IPU7_CORE_DIG_RW_COMMON_0 0x3880 +#define IPU7_CORE_DIG_RW_COMMON_1 0x3882 +#define IPU7_CORE_DIG_RW_COMMON_2 0x3884 +#define IPU7_CORE_DIG_RW_COMMON_3 0x3886 +#define IPU7_CORE_DIG_RW_COMMON_4 0x3888 +#define IPU7_CORE_DIG_RW_COMMON_5 0x388a +#define IPU7_CORE_DIG_RW_COMMON_6 0x388c +#define IPU7_CORE_DIG_RW_COMMON_7 0x388e +#define IPU7_CORE_DIG_RW_COMMON_8 0x3890 +#define IPU7_CORE_DIG_RW_COMMON_9 0x3892 +#define IPU7_CORE_DIG_RW_COMMON_10 0x3894 +#define IPU7_CORE_DIG_RW_COMMON_11 0x3896 +#define IPU7_CORE_DIG_RW_COMMON_12 0x3898 +#define IPU7_CORE_DIG_RW_COMMON_13 0x389a +#define IPU7_CORE_DIG_RW_COMMON_14 0x389c +#define IPU7_CORE_DIG_RW_COMMON_15 0x389e +#define IPU7_CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_0 0x39e0 +#define IPU7_CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_1 0x39e2 +#define IPU7_CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_2 0x39e4 +#define IPU7_CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_3 0x39e6 +#define IPU7_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM 0x3fe0 +#define IPU7_CORE_DIG_COMMON_R_DESKEW_FINE_MEM 0x3fe2 +#define IPU7_PPI_RW_DPHY_LANE0_LBERT_0 0x4000 +#define IPU7_PPI_RW_DPHY_LANE0_LBERT_1 0x4002 +#define IPU7_PPI_R_DPHY_LANE0_LBERT_0 0x4004 +#define IPU7_PPI_R_DPHY_LANE0_LBERT_1 0x4006 +#define IPU7_PPI_RW_DPHY_LANE0_SPARE 0x4008 +#define IPU7_PPI_RW_DPHY_LANE1_LBERT_0 0x4400 +#define IPU7_PPI_RW_DPHY_LANE1_LBERT_1 0x4402 +#define IPU7_PPI_R_DPHY_LANE1_LBERT_0 0x4404 +#define IPU7_PPI_R_DPHY_LANE1_LBERT_1 0x4406 +#define IPU7_PPI_RW_DPHY_LANE1_SPARE 0x4408 +#define IPU7_PPI_RW_DPHY_LANE2_LBERT_0 0x4800 +#define IPU7_PPI_RW_DPHY_LANE2_LBERT_1 0x4802 +#define IPU7_PPI_R_DPHY_LANE2_LBERT_0 0x4804 +#define IPU7_PPI_R_DPHY_LANE2_LBERT_1 0x4806 +#define IPU7_PPI_RW_DPHY_LANE2_SPARE 0x4808 +#define IPU7_PPI_RW_DPHY_LANE3_LBERT_0 0x4c00 +#define IPU7_PPI_RW_DPHY_LANE3_LBERT_1 0x4c02 +#define IPU7_PPI_R_DPHY_LANE3_LBERT_0 0x4c04 +#define IPU7_PPI_R_DPHY_LANE3_LBERT_1 0x4c06 +#define IPU7_PPI_RW_DPHY_LANE3_SPARE 0x4c08 +#define IPU7_CORE_DIG_DLANE_0_RW_CFG_0 0x6000 +#define IPU7_CORE_DIG_DLANE_0_RW_CFG_1 0x6002 +#define IPU7_CORE_DIG_DLANE_0_RW_CFG_2 0x6004 +#define IPU7_CORE_DIG_DLANE_0_RW_LP_0 0x6080 +#define IPU7_CORE_DIG_DLANE_0_RW_LP_1 0x6082 +#define IPU7_CORE_DIG_DLANE_0_RW_LP_2 0x6084 +#define IPU7_CORE_DIG_DLANE_0_R_LP_0 0x60a0 +#define IPU7_CORE_DIG_DLANE_0_R_LP_1 0x60a2 +#define IPU7_CORE_DIG_DLANE_0_R_HS_TX_0 0x60e0 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_0 0x6100 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_1 0x6102 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_2 0x6104 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_3 0x6106 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_4 0x6108 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_5 0x610a +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_6 0x610c +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_7 0x610e +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_8 0x6110 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_RX_9 0x6112 +#define IPU7_CORE_DIG_DLANE_0_R_HS_RX_0 0x6120 +#define IPU7_CORE_DIG_DLANE_0_R_HS_RX_1 0x6122 +#define IPU7_CORE_DIG_DLANE_0_R_HS_RX_2 0x6124 +#define IPU7_CORE_DIG_DLANE_0_R_HS_RX_3 0x6126 +#define IPU7_CORE_DIG_DLANE_0_R_HS_RX_4 0x6128 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_0 0x6200 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_1 0x6202 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_2 0x6204 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_3 0x6206 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_4 0x6208 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_5 0x620a +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_6 0x620c +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_7 0x620e +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_8 0x6210 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_9 0x6212 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_10 0x6214 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_11 0x6216 +#define IPU7_CORE_DIG_DLANE_0_RW_HS_TX_12 0x6218 +#define IPU7_CORE_DIG_DLANE_1_RW_CFG_0 0x6400 +#define IPU7_CORE_DIG_DLANE_1_RW_CFG_1 0x6402 +#define IPU7_CORE_DIG_DLANE_1_RW_CFG_2 0x6404 +#define IPU7_CORE_DIG_DLANE_1_RW_LP_0 0x6480 +#define IPU7_CORE_DIG_DLANE_1_RW_LP_1 0x6482 +#define IPU7_CORE_DIG_DLANE_1_RW_LP_2 0x6484 +#define IPU7_CORE_DIG_DLANE_1_R_LP_0 0x64a0 +#define IPU7_CORE_DIG_DLANE_1_R_LP_1 0x64a2 +#define IPU7_CORE_DIG_DLANE_1_R_HS_TX_0 0x64e0 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_0 0x6500 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_1 0x6502 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_2 0x6504 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_3 0x6506 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_4 0x6508 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_5 0x650a +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_6 0x650c +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_7 0x650e +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_8 0x6510 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_RX_9 0x6512 +#define IPU7_CORE_DIG_DLANE_1_R_HS_RX_0 0x6520 +#define IPU7_CORE_DIG_DLANE_1_R_HS_RX_1 0x6522 +#define IPU7_CORE_DIG_DLANE_1_R_HS_RX_2 0x6524 +#define IPU7_CORE_DIG_DLANE_1_R_HS_RX_3 0x6526 +#define IPU7_CORE_DIG_DLANE_1_R_HS_RX_4 0x6528 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_0 0x6600 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_1 0x6602 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_2 0x6604 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_3 0x6606 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_4 0x6608 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_5 0x660a +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_6 0x660c +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_7 0x660e +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_8 0x6610 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_9 0x6612 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_10 0x6614 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_11 0x6616 +#define IPU7_CORE_DIG_DLANE_1_RW_HS_TX_12 0x6618 +#define IPU7_CORE_DIG_DLANE_2_RW_CFG_0 0x6800 +#define IPU7_CORE_DIG_DLANE_2_RW_CFG_1 0x6802 +#define IPU7_CORE_DIG_DLANE_2_RW_CFG_2 0x6804 +#define IPU7_CORE_DIG_DLANE_2_RW_LP_0 0x6880 +#define IPU7_CORE_DIG_DLANE_2_RW_LP_1 0x6882 +#define IPU7_CORE_DIG_DLANE_2_RW_LP_2 0x6884 +#define IPU7_CORE_DIG_DLANE_2_R_LP_0 0x68a0 +#define IPU7_CORE_DIG_DLANE_2_R_LP_1 0x68a2 +#define IPU7_CORE_DIG_DLANE_2_R_HS_TX_0 0x68e0 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_0 0x6900 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_1 0x6902 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_2 0x6904 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_3 0x6906 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_4 0x6908 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_5 0x690a +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_6 0x690c +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_7 0x690e +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_8 0x6910 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_RX_9 0x6912 +#define IPU7_CORE_DIG_DLANE_2_R_HS_RX_0 0x6920 +#define IPU7_CORE_DIG_DLANE_2_R_HS_RX_1 0x6922 +#define IPU7_CORE_DIG_DLANE_2_R_HS_RX_2 0x6924 +#define IPU7_CORE_DIG_DLANE_2_R_HS_RX_3 0x6926 +#define IPU7_CORE_DIG_DLANE_2_R_HS_RX_4 0x6928 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_0 0x6a00 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_1 0x6a02 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_2 0x6a04 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_3 0x6a06 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_4 0x6a08 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_5 0x6a0a +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_6 0x6a0c +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_7 0x6a0e +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_8 0x6a10 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_9 0x6a12 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_10 0x6a14 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_11 0x6a16 +#define IPU7_CORE_DIG_DLANE_2_RW_HS_TX_12 0x6a18 +#define IPU7_CORE_DIG_DLANE_3_RW_CFG_0 0x6c00 +#define IPU7_CORE_DIG_DLANE_3_RW_CFG_1 0x6c02 +#define IPU7_CORE_DIG_DLANE_3_RW_CFG_2 0x6c04 +#define IPU7_CORE_DIG_DLANE_3_RW_LP_0 0x6c80 +#define IPU7_CORE_DIG_DLANE_3_RW_LP_1 0x6c82 +#define IPU7_CORE_DIG_DLANE_3_RW_LP_2 0x6c84 +#define IPU7_CORE_DIG_DLANE_3_R_LP_0 0x6ca0 +#define IPU7_CORE_DIG_DLANE_3_R_LP_1 0x6ca2 +#define IPU7_CORE_DIG_DLANE_3_R_HS_TX_0 0x6ce0 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_0 0x6d00 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_1 0x6d02 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_2 0x6d04 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_3 0x6d06 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_4 0x6d08 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_5 0x6d0a +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_6 0x6d0c +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_7 0x6d0e +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_8 0x6d10 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_RX_9 0x6d12 +#define IPU7_CORE_DIG_DLANE_3_R_HS_RX_0 0x6d20 +#define IPU7_CORE_DIG_DLANE_3_R_HS_RX_1 0x6d22 +#define IPU7_CORE_DIG_DLANE_3_R_HS_RX_2 0x6d24 +#define IPU7_CORE_DIG_DLANE_3_R_HS_RX_3 0x6d26 +#define IPU7_CORE_DIG_DLANE_3_R_HS_RX_4 0x6d28 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_0 0x6e00 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_1 0x6e02 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_2 0x6e04 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_3 0x6e06 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_4 0x6e08 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_5 0x6e0a +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_6 0x6e0c +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_7 0x6e0e +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_8 0x6e10 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_9 0x6e12 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_10 0x6e14 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_11 0x6e16 +#define IPU7_CORE_DIG_DLANE_3_RW_HS_TX_12 0x6e18 +#define IPU7_CORE_DIG_DLANE_CLK_RW_CFG_0 0x7000 +#define IPU7_CORE_DIG_DLANE_CLK_RW_CFG_1 0x7002 +#define IPU7_CORE_DIG_DLANE_CLK_RW_CFG_2 0x7004 +#define IPU7_CORE_DIG_DLANE_CLK_RW_LP_0 0x7080 +#define IPU7_CORE_DIG_DLANE_CLK_RW_LP_1 0x7082 +#define IPU7_CORE_DIG_DLANE_CLK_RW_LP_2 0x7084 +#define IPU7_CORE_DIG_DLANE_CLK_R_LP_0 0x70a0 +#define IPU7_CORE_DIG_DLANE_CLK_R_LP_1 0x70a2 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_TX_0 0x70e0 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_0 0x7100 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_1 0x7102 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_2 0x7104 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_3 0x7106 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_4 0x7108 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_5 0x710a +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_6 0x710c +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_7 0x710e +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_8 0x7110 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_RX_9 0x7112 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_RX_0 0x7120 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_RX_1 0x7122 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_RX_2 0x7124 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_RX_3 0x7126 +#define IPU7_CORE_DIG_DLANE_CLK_R_HS_RX_4 0x7128 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_0 0x7200 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_1 0x7202 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_2 0x7204 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_3 0x7206 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_4 0x7208 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_5 0x720a +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_6 0x720c +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_7 0x720e +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_8 0x7210 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_9 0x7212 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_10 0x7214 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_11 0x7216 +#define IPU7_CORE_DIG_DLANE_CLK_RW_HS_TX_12 0x7218 +#define IPU7_PPI_RW_CPHY_TRIO0_LBERT_0 0x8000 +#define IPU7_PPI_RW_CPHY_TRIO0_LBERT_1 0x8002 +#define IPU7_PPI_R_CPHY_TRIO0_LBERT_0 0x8004 +#define IPU7_PPI_R_CPHY_TRIO0_LBERT_1 0x8006 +#define IPU7_PPI_RW_CPHY_TRIO0_SPARE 0x8008 +#define IPU7_PPI_RW_CPHY_TRIO1_LBERT_0 0x8400 +#define IPU7_PPI_RW_CPHY_TRIO1_LBERT_1 0x8402 +#define IPU7_PPI_R_CPHY_TRIO1_LBERT_0 0x8404 +#define IPU7_PPI_R_CPHY_TRIO1_LBERT_1 0x8406 +#define IPU7_PPI_RW_CPHY_TRIO1_SPARE 0x8408 +#define IPU7_PPI_RW_CPHY_TRIO2_LBERT_0 0x8800 +#define IPU7_PPI_RW_CPHY_TRIO2_LBERT_1 0x8802 +#define IPU7_PPI_R_CPHY_TRIO2_LBERT_0 0x8804 +#define IPU7_PPI_R_CPHY_TRIO2_LBERT_1 0x8806 +#define IPU7_PPI_RW_CPHY_TRIO2_SPARE 0x8808 +#define IPU7_CORE_DIG_CLANE_0_RW_CFG_0 0xa000 +#define IPU7_CORE_DIG_CLANE_0_RW_CFG_2 0xa004 +#define IPU7_CORE_DIG_CLANE_0_RW_LP_0 0xa080 +#define IPU7_CORE_DIG_CLANE_0_RW_LP_1 0xa082 +#define IPU7_CORE_DIG_CLANE_0_RW_LP_2 0xa084 +#define IPU7_CORE_DIG_CLANE_0_R_LP_0 0xa0a0 +#define IPU7_CORE_DIG_CLANE_0_R_LP_1 0xa0a2 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_0 0xa100 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_1 0xa102 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_2 0xa104 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_3 0xa106 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_4 0xa108 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_5 0xa10a +#define IPU7_CORE_DIG_CLANE_0_RW_HS_RX_6 0xa10c +#define IPU7_CORE_DIG_CLANE_0_R_RX_0 0xa120 +#define IPU7_CORE_DIG_CLANE_0_R_RX_1 0xa122 +#define IPU7_CORE_DIG_CLANE_0_R_TX_0 0xa124 +#define IPU7_CORE_DIG_CLANE_0_R_RX_2 0xa126 +#define IPU7_CORE_DIG_CLANE_0_R_RX_3 0xa128 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_0 0xa200 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_1 0xa202 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_2 0xa204 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_3 0xa206 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_4 0xa208 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_5 0xa20a +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_6 0xa20c +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_7 0xa20e +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_8 0xa210 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_9 0xa212 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_10 0xa214 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_11 0xa216 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_12 0xa218 +#define IPU7_CORE_DIG_CLANE_0_RW_HS_TX_13 0xa21a +#define IPU7_CORE_DIG_CLANE_1_RW_CFG_0 0xa400 +#define IPU7_CORE_DIG_CLANE_1_RW_CFG_2 0xa404 +#define IPU7_CORE_DIG_CLANE_1_RW_LP_0 0xa480 +#define IPU7_CORE_DIG_CLANE_1_RW_LP_1 0xa482 +#define IPU7_CORE_DIG_CLANE_1_RW_LP_2 0xa484 +#define IPU7_CORE_DIG_CLANE_1_R_LP_0 0xa4a0 +#define IPU7_CORE_DIG_CLANE_1_R_LP_1 0xa4a2 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_0 0xa500 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_1 0xa502 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_2 0xa504 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_3 0xa506 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_4 0xa508 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_5 0xa50a +#define IPU7_CORE_DIG_CLANE_1_RW_HS_RX_6 0xa50c +#define IPU7_CORE_DIG_CLANE_1_R_RX_0 0xa520 +#define IPU7_CORE_DIG_CLANE_1_R_RX_1 0xa522 +#define IPU7_CORE_DIG_CLANE_1_R_TX_0 0xa524 +#define IPU7_CORE_DIG_CLANE_1_R_RX_2 0xa526 +#define IPU7_CORE_DIG_CLANE_1_R_RX_3 0xa528 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_0 0xa600 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_1 0xa602 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_2 0xa604 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_3 0xa606 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_4 0xa608 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_5 0xa60a +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_6 0xa60c +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_7 0xa60e +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_8 0xa610 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_9 0xa612 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_10 0xa614 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_11 0xa616 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_12 0xa618 +#define IPU7_CORE_DIG_CLANE_1_RW_HS_TX_13 0xa61a +#define IPU7_CORE_DIG_CLANE_2_RW_CFG_0 0xa800 +#define IPU7_CORE_DIG_CLANE_2_RW_CFG_2 0xa804 +#define IPU7_CORE_DIG_CLANE_2_RW_LP_0 0xa880 +#define IPU7_CORE_DIG_CLANE_2_RW_LP_1 0xa882 +#define IPU7_CORE_DIG_CLANE_2_RW_LP_2 0xa884 +#define IPU7_CORE_DIG_CLANE_2_R_LP_0 0xa8a0 +#define IPU7_CORE_DIG_CLANE_2_R_LP_1 0xa8a2 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_0 0xa900 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_1 0xa902 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_2 0xa904 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_3 0xa906 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_4 0xa908 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_5 0xa90a +#define IPU7_CORE_DIG_CLANE_2_RW_HS_RX_6 0xa90c +#define IPU7_CORE_DIG_CLANE_2_R_RX_0 0xa920 +#define IPU7_CORE_DIG_CLANE_2_R_RX_1 0xa922 +#define IPU7_CORE_DIG_CLANE_2_R_TX_0 0xa924 +#define IPU7_CORE_DIG_CLANE_2_R_RX_2 0xa926 +#define IPU7_CORE_DIG_CLANE_2_R_RX_3 0xa928 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_0 0xaa00 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_1 0xaa02 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_2 0xaa04 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_3 0xaa06 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_4 0xaa08 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_5 0xaa0a +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_6 0xaa0c +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_7 0xaa0e +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_8 0xaa10 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_9 0xaa12 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_10 0xaa14 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_11 0xaa16 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_12 0xaa18 +#define IPU7_CORE_DIG_CLANE_2_RW_HS_TX_13 0xaa1a + +/* dwc csi host controller registers */ +#define IPU7_IS_IO_CSI2_HOST_BASE (i) (IPU7_IS_IO_BASE + 0x40000 + \ + 0x2000 * (i)) +#define IPU7_VERSION 0x0 +#define IPU7_N_LANES 0x4 +#define IPU7_CSI2_RESETN 0x8 +#define IPU7_INT_ST_MAIN 0xc +#define IPU7_DATA_IDS_1 0x10 +#define IPU7_DATA_IDS_2 0x14 +#define IPU7_CDPHY_MODE 0x1c +#define IPU7_DATA_IDS_VC_1 0x30 +#define IPU7_DATA_IDS_VC_2 0x34 +#define IPU7_PHY_SHUTDOWNZ 0x40 +#define IPU7_DPHY_RSTZ 0x44 +#define IPU7_PHY_RX 0x48 +#define IPU7_PHY_STOPSTATE 0x4c +#define IPU7_PHY_TEST_CTRL0 0x50 +#define IPU7_PHY_TEST_CTRL1 0x54 +#define IPU7_PPI_PG_PATTERN_VRES 0x60 +#define IPU7_PPI_PG_PATTERN_HRES 0x64 +#define IPU7_PPI_PG_CONFIG 0x68 +#define IPU7_PPI_PG_ENABLE 0x6c +#define IPU7_PPI_PG_STATUS 0x70 +#define IPU7_VC_EXTENSION 0xc8 +#define IPU7_PHY_CAL 0xcc +#define IPU7_INT_ST_PHY_FATAL 0xe0 +#define IPU7_INT_MSK_PHY_FATAL 0xe4 +#define IPU7_INT_FORCE_PHY_FATAL 0xe8 +#define IPU7_INT_ST_PKT_FATAL 0xf0 +#define IPU7_INT_MSK_PKT_FATAL 0xf4 +#define IPU7_INT_FORCE_PKT_FATAL 0xf8 +#define IPU7_INT_ST_PHY 0x110 +#define IPU7_INT_MSK_PHY 0x114 +#define IPU7_INT_FORCE_PHY 0x118 +#define IPU7_INT_ST_LINE 0x130 +#define IPU7_INT_MSK_LINE 0x134 +#define IPU7_INT_FORCE_LINE 0x138 +#define IPU7_INT_ST_BNDRY_FRAME_FATAL 0x280 +#define IPU7_INT_MSK_BNDRY_FRAME_FATAL 0x284 +#define IPU7_INT_FORCE_BNDRY_FRAME_FATAL 0x288 +#define IPU7_INT_ST_SEQ_FRAME_FATAL 0x290 +#define IPU7_INT_MSK_SEQ_FRAME_FATAL 0x294 +#define IPU7_INT_FORCE_SEQ_FRAME_FATAL 0x298 +#define IPU7_INT_ST_CRC_FRAME_FATAL 0x2a0 +#define IPU7_INT_MSK_CRC_FRAME_FATAL 0x2a4 +#define IPU7_INT_FORCE_CRC_FRAME_FATAL 0x2a8 +#define IPU7_INT_ST_PLD_CRC_FATAL 0x2b0 +#define IPU7_INT_MSK_PLD_CRC_FATAL 0x2b4 +#define IPU7_INT_FORCE_PLD_CRC_FATAL 0x2b8 +#define IPU7_INT_ST_DATA_ID 0x2c0 +#define IPU7_INT_MSK_DATA_ID 0x2c4 +#define IPU7_INT_FORCE_DATA_ID 0x2c8 +#define IPU7_INT_ST_ECC_CORRECTED 0x2d0 +#define IPU7_INT_MSK_ECC_CORRECTED 0x2d4 +#define IPU7_INT_FORCE_ECC_CORRECTED 0x2d8 +#define IPU7_SCRAMBLING 0x300 +#define IPU7_SCRAMBLING_SEED1 0x304 +#define IPU7_SCRAMBLING_SEED2 0x308 +#define IPU7_SCRAMBLING_SEED3 0x30c +#define IPU7_SCRAMBLING_SEED4 0x310 +#define IPU7_SCRAMBLING 0x300 + +#define IPU7_IS_IO_CSI2_ADPL_PORT_BASE (i) (IPU7_IS_IO_BASE + 0x40800 + \ + 0x2000 * (i)) +#define IPU7_CSI2_ADPL_INPUT_MODE 0x0 +#define IPU7_CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN 0x4 +#define IPU7_CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_ADDR 0x8 +#define IPU7_CSI2_ADPL_CSI_RX_ERR_IRQ_STATUS 0xc +#define IPU7_CSI2_ADPL_IRQ_CTL_COMMON_STATUS 0xa4 +#define IPU7_CSI2_ADPL_IRQ_CTL_COMMON_CLEAR 0xa8 +#define IPU7_CSI2_ADPL_IRQ_CTL_COMMON_ENABLE 0xac +#define IPU7_CSI2_ADPL_IRQ_CTL_FS_STATUS 0xbc +#define IPU7_CSI2_ADPL_IRQ_CTL_FS_CLEAR 0xc0 +#define IPU7_CSI2_ADPL_IRQ_CTL_FS_ENABLE 0xc4 +#define IPU7_CSI2_ADPL_IRQ_CTL_FE_STATUS 0xc8 +#define IPU7_CSI2_ADPL_IRQ_CTL_FE_CLEAR 0xcc +#define IPU7_CSI2_ADPL_IRQ_CTL_FE_ENABLE 0xd0 + +/* software control the legacy csi irq */ +#define IPU7_IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE (i) (IPU7_IS_IO_BASE + \ + 0x40c00 + 0x2000 * (i)) +#define IPU7_IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE (i) (IPU7_IS_IO_BASE + \ + 0x40d00 + 0x2000 * (i)) +#define IPU7_IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE (IPU7_IS_IO_BASE + \ + 0x49000) +#define IPU7_IS_IO_CSI2_IRQ_CTRL_BASE (IPU7_IS_IO_BASE + 0x4e100) + +#define IPU7_IRQ_CTL_EDGE 0x0 +#define IPU7_IRQ_CTL_MASK 0x4 +#define IPU7_IRQ_CTL_STATUS 0x8 +#define IPU7_IRQ_CTL_CLEAR 0xc +#define IPU7_IRQ_CTL_ENABLE 0x10 +/* FE irq for PTL */ +#define IPU7_IRQ1_CTL_MASK 0x14 +#define IPU7_IRQ1_CTL_STATUS 0x18 +#define IPU7_IRQ1_CTL_CLEAR 0x1c +#define IPU7_IRQ1_CTL_ENABLE 0x20 + +/* software to set the clock gate to use the port or mgc */ +#define IPU7_IS_IO_GPREGS_BASE (IPU7_IS_IO_BASE + 0x49200) +#define IPU7_SRST_PORT_ARB 0x0 +#define IPU7_SRST_MGC 0x4 +#define IPU7_SRST_WIDTH_CONV 0x8 +#define IPU7_SRST_CSI_IRQ 0xc +#define IPU7_SRST_CSI_LEGACY_IRQ 0x10 +#define IPU7_CLK_EN_TXCLKESC 0x14 +#define IPU7_CLK_DIV_FACTOR_IS_CLK 0x18 +#define IPU7_CLK_DIV_FACTOR_APB_CLK 0x1c +#define IPU7_CSI_PORT_CLK_GATE 0x20 +#define IPU7_CSI_PORTAB_AGGREGATION 0x24 +#define IPU7_MGC_CLK_GATE 0x2c +#define IPU7_CG_CTRL_BITS 0x3c +#define IPU7_SPARE_RW 0xf8 +#define IPU7_SPARE_RO 0xfc + +#define IPU7_IS_IO_CSI2_MPF_PORT_BASE (i) (IPU7_IS_IO_BASE + 0x53000 + \ + 0x1000 * (i)) +#define IPU7_MPF_16_IRQ_CNTRL_STATUS 0x238 +#define IPU7_MPF_16_IRQ_CNTRL_CLEAR 0x23c +#define IPU7_MPF_16_IRQ_CNTRL_ENABLE 0x240 + +/* software config the phy */ +#define IPU7_IS_IO_CSI2_GPREGS_BASE (IPU7_IS_IO_BASE + 0x53400) +#define IPU8_IS_IO_CSI2_GPREGS_BASE (IPU7_IS_IO_BASE + 0x40e00) +#define IPU7_CSI_ADAPT_LAYER_SRST 0x0 +#define IPU7_MPF_SRST_RST 0x4 +#define IPU7_CSI_ERR_IRQ_CTRL_SRST 0x8 +#define IPU7_CSI_SYNC_RC_SRST 0xc +#define IPU7_CSI_CG_CTRL_BITS 0x10 +#define IPU7_SOC_CSI2HOST_SELECT 0x14 +#define IPU7_PHY_RESET 0x18 +#define IPU7_PHY_SHUTDOWN 0x1c +#define IPU7_PHY_MODE 0x20 +#define IPU7_PHY_READY 0x24 +#define IPU7_PHY_CLK_LANE_FORCE_CONTROL 0x28 +#define IPU7_PHY_CLK_LANE_CONTROL 0x2c +#define IPU7_PHY_CLK_LANE_STATUS 0x30 +#define IPU7_PHY_LANE_RX_ESC_REQ 0x34 +#define IPU7_PHY_LANE_RX_ESC_DATA 0x38 +#define IPU7_PHY_LANE_TURNDISABLE 0x3c +#define IPU7_PHY_LANE_DIRECTION 0x40 +#define IPU7_PHY_LANE_FORCE_CONTROL 0x44 +#define IPU7_PHY_LANE_CONTROL_EN 0x48 +#define IPU7_PHY_LANE_CONTROL_DATAWIDTH 0x4c +#define IPU7_PHY_LANE_STATUS 0x50 +#define IPU7_PHY_LANE_ERR 0x54 +#define IPU7_PHY_LANE_RXALP 0x58 +#define IPU7_PHY_LANE_RXALP_NIBBLE 0x5c +#define IPU7_PHY_PARITY_ERROR 0x60 +#define IPU7_PHY_DEBUG_REGS_CLK_GATE_EN 0x64 +#define IPU7_SPARE_RW 0xf8 +#define IPU7_SPARE_RO 0xfc + +/* software not touch */ +#define IPU7_PORT_ARB_BASE (IPU7_IS_IO_BASE + 0x4e000) +#define IPU7_PORT_ARB_IRQ_CTL_STATUS 0x4 +#define IPU7_PORT_ARB_IRQ_CTL_CLEAR 0x8 +#define IPU7_PORT_ARB_IRQ_CTL_ENABLE 0xc + +#define IPU7_MGC_PPC 4U +#define IPU7_MGC_DTYPE_RAW (i) (((i) - 8) / 2) +#define IPU7_IS_IO_MGC_BASE (IPU7_IS_IO_BASE + 0x48000) +#define IPU7_MGC_KICK 0x0 +#define IPU7_MGC_ASYNC_STOP 0x4 +#define IPU7_MGC_PORT_OFFSET 0x100 +#define IPU7_MGC_CSI_PORT_MAP (i) (0x8 + (i) * 0x4) +#define IPU7_MGC_MG_PORT (i) (IPU7_IS_IO_MGC_BASE + \ + (i) * IPU7_MGC_PORT_OFFSET) +/* per mgc instance */ +#define IPU7_MGC_MG_CSI_ADAPT_LAYER_TYPE 0x28 +#define IPU7_MGC_MG_MODE 0x2c +#define IPU7_MGC_MG_INIT_COUNTER 0x30 +#define IPU7_MGC_MG_MIPI_VC 0x34 +#define IPU7_MGC_MG_MIPI_DTYPES 0x38 +#define IPU7_MGC_MG_MULTI_DTYPES_MODE 0x3c +#define IPU7_MGC_MG_NOF_FRAMES 0x40 +#define IPU7_MGC_MG_FRAME_DIM 0x44 +#define IPU7_MGC_MG_HBLANK 0x48 +#define IPU7_MGC_MG_VBLANK 0x4c +#define IPU7_MGC_MG_TPG_MODE 0x50 +#define IPU7_MGC_MG_TPG_R0 0x54 +#define IPU7_MGC_MG_TPG_G0 0x58 +#define IPU7_MGC_MG_TPG_B0 0x5c +#define IPU7_MGC_MG_TPG_R1 0x60 +#define IPU7_MGC_MG_TPG_G1 0x64 +#define IPU7_MGC_MG_TPG_B1 0x68 +#define IPU7_MGC_MG_TPG_FACTORS 0x6c +#define IPU7_MGC_MG_TPG_MASKS 0x70 +#define IPU7_MGC_MG_TPG_XY_MASK 0x74 +#define IPU7_MGC_MG_TPG_TILE_DIM 0x78 +#define IPU7_MGC_MG_PRBS_LFSR_INIT_0 0x7c +#define IPU7_MGC_MG_PRBS_LFSR_INIT_1 0x80 +#define IPU7_MGC_MG_SYNC_STOP_POINT 0x84 +#define IPU7_MGC_MG_SYNC_STOP_POINT_LOC 0x88 +#define IPU7_MGC_MG_ERR_INJECT 0x8c +#define IPU7_MGC_MG_ERR_LOCATION 0x90 +#define IPU7_MGC_MG_DTO_SPEED_CTRL_EN 0x94 +#define IPU7_MGC_MG_DTO_SPEED_CTRL_INCR_VAL 0x98 +#define IPU7_MGC_MG_HOR_LOC_STTS 0x9c +#define IPU7_MGC_MG_VER_LOC_STTS 0xa0 +#define IPU7_MGC_MG_FRAME_NUM_STTS 0xa4 +#define IPU7_MGC_MG_BUSY_STTS 0xa8 +#define IPU7_MGC_MG_STOPPED_STTS 0xac +/* tile width and height in pixels for Chess board and Color palette */ +#define IPU7_MGC_TPG_TILE_WIDTH 64U +#define IPU7_MGC_TPG_TILE_HEIGHT 64U + +#define IPU7_CSI_PORT_A_ADDR_OFFSET 0x0 +#define IPU7_CSI_PORT_B_ADDR_OFFSET 0x0 +#define IPU7_CSI_PORT_C_ADDR_OFFSET 0x0 +#define IPU7_CSI_PORT_D_ADDR_OFFSET 0x0 + +/* +* 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; +* 11 - Port ARB FIFO 3 overflow; +* 12 - isys_cfgnoc_err_probe_intl; +* 13-15 - reserved +*/ +#define IPU7_CSI_IS_IO_IRQ_MASK 0xffff + +/* Adapter layer irq */ +#define IPU7_CSI_ADPL_IRQ_MASK 0xffff + +/* sw irq from legacy irq control +* 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 0x1ff + +/* 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 0xfff + +/* +* 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 0x0 +#define IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK 0x0 + +#define IPU7_CSI_RX_NUM_ERRORS_IN_IRQ 12U +#define IPU7_CSI_RX_NUM_SYNC_IN_IRQ 32U + +enum IPU7_MGC_CSI_ADPL_TYPE { +IPU7_MGC_MAPPED_2_LANES =0 , +IPU7_MGC_MAPPED_4_LANES =1 , +}; + +enum IPU7_CSI2HOST_SELECTION { +IPU7_CSI2HOST_SEL_SOC =0 , +IPU7_CSI2HOST_SEL_CSI2HOST =1 , +}; + +#define IPU7_CSI_LEGACY_IRQ_MASK (port) (0x3 << ((port) * 2)) +#define IPU7P5_CSI_LEGACY_IRQ_MASK (port) (0x7 << ((port) * 3)) + +#define IPU7_ISYS_LEGACY_IRQ_CSI2 (port) (0x3 << (port)) +#define IPU7P5_ISYS_LEGACY_IRQ_CSI2 (port) (0x7 << (port)) + +/* ---------------------------------------------------------------- */ +#define IPU7_CSI_REG_BASE 0x220000 +#define IPU7_CSI_REG_BASE_PORT (id) ((id) * 0x1000) + +/* CSI Port General Purpose Registers */ +#define IPU7_CSI_REG_PORT_GPREG_SRST 0x0 +#define IPU7_CSI_REG_PORT_GPREG_CSI2_SLV_REG_SRST 0x4 +#define IPU7_CSI_REG_PORT_GPREG_CSI2_PORT_CONTROL 0x8 + +#define IPU7_CSI_RX_SYNC_FS_VC 0x55555555 +#define IPU7_CSI_RX_SYNC_FE_VC 0xaaaaaaaa +#define IPU7P5_CSI_RX_SYNC_FS_VC 0xffff +#define IPU7P5_CSI_RX_SYNC_FE_VC 0xffff + +#endif /* IPU7_ISYS_CSI2_REG_H */
Signature · 1 line
2.55.0
PATCH v2 26/44 media: ipu6: Add ipu7 isr handler
In reply to Antti LaaksoAdd ipu7 interrupt handler for software and CSI events.
--- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h | 1 + drivers/media/pci/intel/ipu6/ipu6-isys.c | 2 +- drivers/media/pci/intel/ipu6/ipu7-fw-isys.c | 330 +++++++++++++++++- drivers/media/pci/intel/ipu6/ipu7-fw-isys.h | 38 ++ .../media/pci/intel/ipu6/ipu7-platform-regs.h | 20 ++ 5 files changed, 386 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h +1 -0
@@ -43,6 +43,7 @@ struct ipu6_isys_csi2 {u32 receiver_errors;unsigned int nlanes;unsigned int port; +u32 legacy_irq_mask; };struct ipu6_isys_csi2_timing {
drivers/media/pci/intel/ipu6/ipu6-isys.c +1 -1
@@ -1075,7 +1075,7 @@ static const struct ipu6_auxdrv_data ipu6_isys_auxdrv_data = { };static const struct ipu6_auxdrv_data ipu7_isys_auxdrv_data = { - .isr = ipu6_isys_isr, + .isr = ipu7_isys_isr, .isr_threaded =NULL , .wake_isr_thread = false, .fw_ops = &ipu7_fw_isys_ops,
drivers/media/pci/intel/ipu6/ipu7-fw-isys.c +326 -4
369 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-fw-isys.h +38 -0
@@ -117,6 +117,43 @@ enum ipu7_insys_mipi_dt_rename_mode {N_IPU7_INSYS_MIPI_DT_MODE }; +enum insys_msg_err_capture { +INSYS_MSG_ERR_CAPTURE_OK =0 , +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 =0 , +INSYS_MSG_ERR_GROUP_GENERAL =1 , +INSYS_MSG_ERR_GROUP_STREAM =2 , +INSYS_MSG_ERR_GROUP_CAPTURE =3 , +INSYS_MSG_ERR_GROUP_N , +}; +struct ipu7_fw_isys_logger_config {u8 use_source_severity;u8 source_severity[IPU7_FWLOG_MAX_LOGGER_SOURCES ];
@@ -254,5 +291,6 @@ struct ipu7_fw_isys_frame_buff_set { } __packed;struct ipu6_fw_isys_ops *ipu7_fw_isys_get_ops (void ); +irqreturn_t ipu7_isys_isr (struct ipu6_bus_device *adev);#endif
drivers/media/pci/intel/ipu6/ipu7-platform-regs.h +20 -0
@@ -9,4 +9,24 @@#define IPU7_PS_UC_CTRL_BASE 0x130000#define IPU7_PSYS_DMEM_OFFSET 0x100000 +#define IPU7_IS_IO_BASE 0x280000 +#define IPU7_IS_IO_CSI2_GPREGS_BASE (IPU7_IS_IO_BASE + 0x53400) + +#define IPU7_IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE (IPU7_IS_IO_BASE + 0x49000) +#define IPU7_IRQ_CTL_EDGE 0x0 +#define IPU7_IRQ_CTL_MASK 0x4 +#define IPU7_IRQ_CTL_STATUS 0x8 +#define IPU7_IRQ_CTL_CLEAR 0xc +#define IPU7_IRQ_CTL_ENABLE 0x10 +#define IPU7_CSI_RX_LEGACY_IRQ_MASK 0x1ff + +#define IPU7_TO_SW_IRQ_CNTL_EDGE 0x4000 +#define IPU7_TO_SW_IRQ_CNTL_MASK_N 0x4004 +#define IPU7_TO_SW_IRQ_CNTL_STATUS 0x4008 +#define IPU7_TO_SW_IRQ_CNTL_CLEAR 0x400c +#define IPU7_TO_SW_IRQ_CNTL_ENABLE 0x4010 +#define IPU7_IS_UC_TO_SW_IRQ_MASK 0xf +#define IPU7_TO_SW_IRQ_FW BIT(0) +#define IPU7_REG_PRINTF_AXI_CNTL 0x301c +#endif
Signature · 1 line
2.55.0
PATCH v2 27/44 media: ipu6: Add ipu7 csi phy driver
In reply to Antti LaaksoThe csi receiver is completely different in ipu7 compared to ipu6, add a driver for it.
--- drivers/media/pci/intel/ipu6/Makefile | 3 +- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h | 4 + drivers/media/pci/intel/ipu6/ipu6-isys.c | 7 +- drivers/media/pci/intel/ipu6/ipu6-isys.h | 1 + drivers/media/pci/intel/ipu6/ipu6.c | 6 + drivers/media/pci/intel/ipu6/ipu6.h | 2 + .../media/pci/intel/ipu6/ipu7-isys-csi-phy.c | 1072 +++++++++++++++++ .../media/pci/intel/ipu6/ipu7-isys-csi-phy.h | 16 + 8 files changed, 1109 insertions(+), 2 deletions(-) create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c create mode 100644 drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.h
drivers/media/pci/intel/ipu6/Makefile +2 -1
@@ -23,6 +23,7 @@ intel-ipu6-isys-y := ipu6-isys.o \ ipu6-isys-subdev.o \ ipu6-isys-mcd-phy.o \ ipu6-isys-jsl-phy.o \ - ipu6-isys-dwc-phy.o + ipu6-isys-dwc-phy.o \ + ipu7-isys-csi-phy.o obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6-isys.o
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h +4 -0
@@ -16,6 +16,9 @@ struct ipu6_isys_video;struct ipu6_isys ;struct ipu6_isys_stream ; +#define PHY_MODE_DPHY 0 +#define PHY_MODE_CPHY 1 +#define NR_OF_CSI2_VC 16#define INVALID_VC_ID -1#define NR_OF_CSI2_SINK_PADS 1
@@ -44,6 +47,7 @@ struct ipu6_isys_csi2 {unsigned int nlanes;unsigned int port;u32 legacy_irq_mask; +unsigned int phy_mode; };struct ipu6_isys_csi2_timing {
drivers/media/pci/intel/ipu6/ipu6-isys.c +6 -1
@@ -41,6 +41,9 @@#include "ipu6-platform-buttress-regs.h" #include "ipu6-platform-isys-csi2-reg.h" #include "ipu6-platform-regs.h" +#include "ipu7-isys-csi-phy.h" +#include "ipu7-isys-csi2-regs.h" +#include "ipu7-platform-regs.h" #define IPU6_BUTTRESS_FABIC_CONTROL 0x68#define GDA_ENABLE_IWAKE_INDEX 2
@@ -1004,7 +1007,9 @@ static int isys_probe(struct auxiliary_device *auxdev,isys_iwake_watermark_init (isys); -if (IS_IPU6SE (adev->isp)) +if (IS_IPU7 (adev->isp)) + isys->phy_set_power = ipu7_isys_csi_phy_set_power; +else if (IS_IPU6SE (adev->isp)) isys->phy_set_power = ipu6_isys_jsl_phy_set_power;else if (IS_IPU6EP_MTL (adev->isp)) isys->phy_set_power = ipu6_isys_dwc_phy_set_power;
drivers/media/pci/intel/ipu6/ipu6-isys.h +1 -0
@@ -138,6 +138,7 @@ struct ipu6_isys {int streams_ref_count[IPU6_ISYS_MAX_STREAMS ];void *fwctx;u32 phy_termcal_val; +u32 phy_rext_cal;bool need_reset;bool icache_prefetch;bool csi2_cse_ipc_not_supported;
drivers/media/pci/intel/ipu6/ipu6.c +6 -0
@@ -32,6 +32,7 @@#include "ipu6-platform-buttress-regs.h" #include "ipu6-platform-isys-csi2-reg.h" #include "ipu6-platform-regs.h" +#include "ipu7-isys-csi2-regs.h" #define IPU6_PCI_BAR 0#define IPU7_PCI_PBBAR 4
@@ -325,6 +326,11 @@ static void ipu6_internal_pdata_init(struct ipu6_device *isp) isys_ipdata.max_devq_size =IPU6SE_DEV_SEND_QUEUE_SIZE ; psys_ipdata.hw_variant.spc_offset =IPU6SE_PSYS_SPC_OFFSET ; } + +if (IS_IPU7 (isp)) { + isys_ipdata.csi2.gpreg =IPU7_IS_IO_CSI2_GPREGS_BASE ; + isys_ipdata.csi2.nports =4 ; + } } static struct ipu6_bus_device *
drivers/media/pci/intel/ipu6/ipu6.h +2 -0
@@ -136,6 +136,8 @@ struct ipu6_isys_internal_csi2_pdata {u32 ctrl0_irq_lnp;u32 ctrl0_irq_status;u32 fw_access_port_ofs; +/* IPU7-specific field */ +u32 gpreg; };struct ipu6_isys_internal_tpg_pdata {
drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c new file +1072 -0
1,072 lines not on this page · raw message
drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2026 Intel Corporation */ + +#ifndef IPU7_ISYS_CSI_PHY_H +#define IPU7_ISYS_CSI_PHY_H + +struct ipu6_isys ; +struct ipu6_isys_csi2_config ; +struct ipu6_isys_csi2_timing ; + +int ipu7_isys_csi_phy_set_power (struct ipu6_isys *isys, +struct ipu6_isys_csi2_config *cfg, +const struct ipu6_isys_csi2_timing *timing, +bool on); + +#endif /* IPU7_ISYS_CSI_PHY_H */
Signature · 1 line
2.55.0
PATCH v2 28/44 media: ipu6: Split ipu6 csi2 stream enable/disable
In reply to Antti LaaksoInstead of single function, split csi2 receiver stream enable and disable into own functions. This make it easier to add ipu7 support.
--- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 98 ++++++++----------- 1 file changed, 43 insertions(+), 55 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c +43 -55
@@ -228,64 +228,55 @@ void ipu6_isys_csi2_error(struct ipu6_isys_csi2 *csi2) } } -static int ipu6_isys_csi2_set_stream (struct v4l2_subdev *sd, -const struct ipu6_isys_csi2_timing *timing, -unsigned int nlanes,int enable) +static void ipu6_isys_csi2_stream_disable (struct ipu6_isys_csi2 *csi2) { -struct ipu6_isys_subdev *asd =to_ipu6_isys_subdev (sd); -struct ipu6_isys_csi2 *csi2 =to_ipu6_isys_csi2 (asd);struct ipu6_isys *isys = csi2->isys; -struct device *dev = &isys->adev->auxdev.dev;struct ipu6_isys_csi2_config cfg; -unsigned int nports; -int ret =0 ; -u32 mask =0 ; -u32 i; +u32 mask = isys->pdata->ipdata->csi2.irq_mask; + + cfg.port = csi2->port; + cfg.nlanes = csi2->nlanes; + +writel (0 , csi2->base +CSI_REG_CSI_FE_ENABLE ); +writel (0 , csi2->base +CSI_REG_PPI2CSI_ENABLE ); +writel (0 , csi2->base +CSI_PORT_REG_BASE_IRQ_CSI + +CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET ); +writel (mask, csi2->base +CSI_PORT_REG_BASE_IRQ_CSI + +CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET ); +writel (0 , csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + +CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET ); +writel (0xffffffff , csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + +CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET ); -dev_dbg (dev,"stream %s CSI2-%u with %u lanes\n" , enable ?"on" :"off" , - csi2->port, nlanes); + isys->phy_set_power (isys, &cfg,NULL , false); + +writel (0 , isys->pdata->base +CSI_REG_HUB_FW_ACCESS_PORT + (isys->pdata->ipdata->csi2.fw_access_port_ofs, csi2->port)); +writel (0 , isys->pdata->base +CSI_REG_HUB_DRV_ACCESS_PORT (csi2->port)); +} + +static int ipu6_isys_csi2_stream_enable (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys *isys = csi2->isys; +struct ipu6_isys_csi2_timing timing = { }; +struct ipu6_isys_csi2_config cfg; +unsigned int nports; +u32 mask; +int ret; cfg.port = csi2->port; - cfg.nlanes = nlanes; + cfg.nlanes = csi2->nlanes; mask = isys->pdata->ipdata->csi2.irq_mask; nports = isys->pdata->ipdata->csi2.nports; -if (!enable) { -writel (0 , csi2->base +CSI_REG_CSI_FE_ENABLE ); -writel (0 , csi2->base +CSI_REG_PPI2CSI_ENABLE ); - -writel (0 , - csi2->base +CSI_PORT_REG_BASE_IRQ_CSI + -CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET ); -writel (mask, - csi2->base +CSI_PORT_REG_BASE_IRQ_CSI + -CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET ); -writel (0 , - csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + -CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET ); -writel (0xffffffff , - csi2->base +CSI_PORT_REG_BASE_IRQ_CSI_SYNC + -CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET ); - - isys->phy_set_power (isys, &cfg, timing, false); - -writel (0 , isys->pdata->base +CSI_REG_HUB_FW_ACCESS_PORT - (isys->pdata->ipdata->csi2.fw_access_port_ofs, - csi2->port)); -writel (0 , isys->pdata->base + -CSI_REG_HUB_DRV_ACCESS_PORT (csi2->port)); - -return ret; - } -/* reset port reset */ writel (0x1 , csi2->base +CSI_REG_PORT_GPREG_SRST );usleep_range (100 ,200 );writel (0x0 , csi2->base +CSI_REG_PORT_GPREG_SRST );/* enable port clock */ -for (i =0 ; i < nports; i++) { +for (unsigned int i =0 ; i < nports; i++) {writel (1 , isys->pdata->base +CSI_REG_HUB_DRV_ACCESS_PORT (i));writel (1 , isys->pdata->base +CSI_REG_HUB_FW_ACCESS_PORT (isys->pdata->ipdata->csi2.fw_access_port_ofs, i));
@@ -329,18 +320,18 @@ static int ipu6_isys_csi2_set_stream(struct v4l2_subdev *sd,writel (CSI_SENSOR_INPUT , csi2->base +CSI_REG_CSI_FE_MUX_CTRL );writel (CSI_CNTR_SENSOR_LINE_ID |CSI_CNTR_SENSOR_FRAME_ID , csi2->base +CSI_REG_CSI_FE_SYNC_CNTR_SEL ); -writel (FIELD_PREP (PPI_INTF_CONFIG_NOF_ENABLED_DLANES_MASK , nlanes -1 ), +writel (FIELD_PREP (PPI_INTF_CONFIG_NOF_ENABLED_DLANES_MASK , + csi2->nlanes -1 ), csi2->base +CSI_REG_PPI2CSI_CONFIG_PPI_INTF );writel (1 , csi2->base +CSI_REG_PPI2CSI_ENABLE );writel (1 , csi2->base +CSI_REG_CSI_FE_ENABLE ); - ret = isys->phy_set_power (isys, &cfg, timing, true); + ret =ipu6_isys_csi2_calc_timing (csi2, &timing,CSI2_ACCINV );if (ret) -dev_err (dev,"csi-%d phy power up failed %d\n" , csi2->port, - ret); +return ret; -return ret; +return isys->phy_set_power (isys, &cfg, &timing, true); } static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
@@ -349,7 +340,6 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd, {struct ipu6_isys_subdev *asd =to_ipu6_isys_subdev (sd);struct ipu6_isys_csi2 *csi2 =to_ipu6_isys_csi2 (asd); -struct ipu6_isys_csi2_timing timing = { };struct v4l2_subdev *remote_sd;struct media_pad *remote_pad;u64 sink_streams;
@@ -362,18 +352,14 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,v4l2_subdev_state_xlate_streams (state, pad,CSI2_PAD_SINK , &streams_mask); - ret =ipu6_isys_csi2_calc_timing (csi2, &timing,CSI2_ACCINV ); -if (ret) -return ret; - - ret =ipu6_isys_csi2_set_stream (sd, &timing, csi2->nlanes, true); + ret =ipu6_isys_csi2_stream_enable (csi2);if (ret)return ret; ret =v4l2_subdev_enable_streams (remote_sd, remote_pad->index, sink_streams);if (ret) { -ipu6_isys_csi2_set_stream (sd,NULL ,0 , false); +ipu6_isys_csi2_stream_disable (csi2);return ret; }
@@ -384,6 +370,8 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,struct v4l2_subdev_state *state, u32 pad, u64 streams_mask) { + struct ipu6_isys_subdev *asd = to_ipu6_isys_subdev(sd); +struct ipu6_isys_csi2 *csi2 =to_ipu6_isys_csi2 (asd);struct v4l2_subdev *remote_sd;struct media_pad *remote_pad;u64 sink_streams;
@@ -395,7 +383,7 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd, remote_pad =media_pad_remote_pad_first (&sd->entity.pads[CSI2_PAD_SINK ]); remote_sd =media_entity_to_v4l2_subdev (remote_pad->entity); -ipu6_isys_csi2_set_stream (sd,NULL ,0 , false); +ipu6_isys_csi2_stream_disable (csi2);v4l2_subdev_disable_streams (remote_sd, remote_pad->index, sink_streams);
Signature · 1 line
2.55.0
PATCH v2 29/44 media: ipu6: Add support for ipu7 csi2 receiver
In reply to Antti LaaksoThe csi2 receiver is different in ipu7, add support for it.
--- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 119 +++++++++++++++++- 1 file changed, 114 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c +114 -5
@@ -24,6 +24,7 @@#include "ipu6-isys-csi2.h" #include "ipu6-isys-subdev.h" #include "ipu6-platform-isys-csi2-reg.h" +#include "ipu7-isys-csi2-regs.h" static const u32 csi2_supported_codes[] = {MEDIA_BUS_FMT_RGB565_1X16 ,
@@ -267,6 +268,10 @@ static int ipu6_isys_csi2_stream_enable(struct ipu6_isys_csi2 *csi2) cfg.port = csi2->port; cfg.nlanes = csi2->nlanes; + ret =ipu6_isys_csi2_calc_timing (csi2, &timing,CSI2_ACCINV ); +if (ret) +return ret; + mask = isys->pdata->ipdata->csi2.irq_mask; nports = isys->pdata->ipdata->csi2.nports;
@@ -327,11 +332,106 @@ static int ipu6_isys_csi2_stream_enable(struct ipu6_isys_csi2 *csi2)writel (1 , csi2->base +CSI_REG_PPI2CSI_ENABLE );writel (1 , csi2->base +CSI_REG_CSI_FE_ENABLE ); - ret =ipu6_isys_csi2_calc_timing (csi2, &timing,CSI2_ACCINV ); +return isys->phy_set_power (isys, &cfg, &timing, true); +} + +static void ipu7_csi2_irq_enable (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys *isys = csi2->isys; +unsigned int offset, mask; + +/* enable CSI2 legacy error irq */ + offset =IPU7_IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE (csi2->port); + mask =IPU7_CSI_RX_ERROR_IRQ_MASK ; +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_CLEAR ); +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_MASK ); +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_ENABLE ); + +/* enable CSI2 legacy sync irq */ + offset =IPU7_IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE (csi2->port); + mask =IPU7_CSI_RX_SYNC_IRQ_MASK ; +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_CLEAR ); +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_MASK ); +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_ENABLE ); + +if (!IS_IPU7_MTL (isys->adev->isp)) { + mask =IPU7P5_CSI_RX_SYNC_FE_IRQ_MASK ; +writel (mask, csi2->base + offset +IPU7_IRQ1_CTL_CLEAR ); +writel (mask, csi2->base + offset +IPU7_IRQ1_CTL_MASK ); +writel (mask, csi2->base + offset +IPU7_IRQ1_CTL_ENABLE ); + } +} + +static void ipu7_csi2_irq_disable (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys *isys = csi2->isys; +unsigned int offset, mask; + +/* disable CSI2 legacy error irq */ + offset =IPU7_IS_IO_CSI2_ERR_LEGACY_IRQ_CTL_BASE (csi2->port); + mask =IPU7_CSI_RX_ERROR_IRQ_MASK ; +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_CLEAR ); +writel (0 , csi2->base + offset +IPU7_IRQ_CTL_MASK ); +writel (0 , csi2->base + offset +IPU7_IRQ_CTL_ENABLE ); + +/* disable CSI2 legacy sync irq */ + offset =IPU7_IS_IO_CSI2_SYNC_LEGACY_IRQ_CTL_BASE (csi2->port); + mask =IPU7_CSI_RX_SYNC_IRQ_MASK ; +writel (mask, csi2->base + offset +IPU7_IRQ_CTL_CLEAR ); +writel (0 , csi2->base + offset +IPU7_IRQ_CTL_MASK ); +writel (0 , csi2->base + offset +IPU7_IRQ_CTL_ENABLE ); + +if (!IS_IPU7_MTL (isys->adev->isp)) { +writel (mask, csi2->base + offset +IPU7_IRQ1_CTL_CLEAR ); +writel (0 , csi2->base + offset +IPU7_IRQ1_CTL_MASK ); +writel (0 , csi2->base + offset +IPU7_IRQ1_CTL_ENABLE ); + } +} + +static void ipu7_isys_csi2_stream_disable (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys *isys = csi2->isys; +void __iomem *base = isys->pdata->base; +struct ipu6_isys_csi2_config cfg; + + cfg.port = csi2->port; + cfg.nlanes = csi2->nlanes; + + isys->phy_set_power (isys, &cfg,NULL , false); + +writel (0x4 , + base +IPU7_IS_IO_GPREGS_BASE +IPU7_CLK_DIV_FACTOR_APB_CLK ); +ipu7_csi2_irq_disable (csi2); +} + +static int ipu7_isys_csi2_stream_enable (struct ipu6_isys_csi2 *csi2) +{ +struct ipu6_isys *isys = csi2->isys; +void __iomem *base = isys->pdata->base; +struct ipu6_isys_csi2_config cfg; +unsigned int offset =IPU7_IS_IO_GPREGS_BASE ; +int ret; + +writel (0x2 , base + offset +IPU7_CLK_DIV_FACTOR_APB_CLK ); +if (csi2->port ==0U && csi2->nlanes ==4U && + !IS_IPU7_MTL (isys->adev->isp)) +writel (0x1 , base + offset +IPU7_CSI_PORTAB_AGGREGATION ); + +/* input is coming from CSI receiver (sensor) */ + offset =IPU7_IS_IO_CSI2_ADPL_PORT_BASE (csi2->port); +writel (CSI_SENSOR_INPUT , base + offset +IPU7_CSI2_ADPL_INPUT_MODE ); +writel (1 , base + offset +IPU7_CSI2_ADPL_CSI_RX_ERR_IRQ_CLEAR_EN ); + + cfg.port = csi2->port; + cfg.nlanes = csi2->nlanes; + + ret = isys->phy_set_power (isys, &cfg,NULL , true);if (ret)return ret; -return isys->phy_set_power (isys, &cfg, &timing, true); +ipu7_csi2_irq_enable (csi2); + +return 0 ; } static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
@@ -340,6 +440,7 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd, {struct ipu6_isys_subdev *asd =to_ipu6_isys_subdev (sd);struct ipu6_isys_csi2 *csi2 =to_ipu6_isys_csi2 (asd); +struct ipu6_device *isp = asd->isys->adev->isp;struct v4l2_subdev *remote_sd;struct media_pad *remote_pad;u64 sink_streams;
@@ -352,14 +453,18 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,v4l2_subdev_state_xlate_streams (state, pad,CSI2_PAD_SINK , &streams_mask); - ret =ipu6_isys_csi2_stream_enable (csi2); + ret =IS_IPU7 (isp) ?ipu7_isys_csi2_stream_enable (csi2) : +ipu6_isys_csi2_stream_enable (csi2);if (ret)return ret; ret =v4l2_subdev_enable_streams (remote_sd, remote_pad->index, sink_streams);if (ret) { -ipu6_isys_csi2_stream_disable (csi2); + if IS_IPU7(isp) +ipu7_isys_csi2_stream_disable (csi2); + else +ipu6_isys_csi2_stream_disable (csi2 );return ret; }
@@ -372,6 +477,7 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd, {struct ipu6_isys_subdev *asd =to_ipu6_isys_subdev (sd);struct ipu6_isys_csi2 *csi2 =to_ipu6_isys_csi2 (asd); +struct ipu6_device *isp = asd->isys->adev->isp;struct v4l2_subdev *remote_sd;struct media_pad *remote_pad;u64 sink_streams;
@@ -383,7 +489,10 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd, remote_pad =media_pad_remote_pad_first (&sd->entity.pads[CSI2_PAD_SINK ]); remote_sd =media_entity_to_v4l2_subdev (remote_pad->entity); -ipu6_isys_csi2_stream_disable (csi2); + if IS_IPU7(isp) +ipu7_isys_csi2_stream_disable (csi2); + else +ipu6_isys_csi2_stream_disable (csi2 );v4l2_subdev_disable_streams (remote_sd, remote_pad->index, sink_streams);
Signature · 1 line
2.55.0
PATCH v2 30/44 media: ipu6: Parse bus type for ipu7
In reply to Antti LaaksoFor ipu7 bus type can be CPHY or DPHY.
--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 8 ++++++++ drivers/media/pci/intel/ipu6/ipu6-isys.h | 2 ++ 2 files changed, 10 insertions(+)
drivers/media/pci/intel/ipu6/ipu6-isys.c +8 -0
@@ -133,6 +133,9 @@ isys_complete_ext_device_registration(struct ipu6_isys *isys, } isys->csi2[csi2->port].nlanes = csi2->nlanes; + isys->csi2[csi2->port].phy_mode = + csi2->bus_type ==V4L2_MBUS_CSI2_DPHY ? +PHY_MODE_DPHY :PHY_MODE_CPHY ;return 0 ;
@@ -639,6 +642,10 @@ static int isys_notifier_init(struct ipu6_isys *isys)continue ; ret =v4l2_fwnode_endpoint_parse (ep, &vep); +if (ret &&IS_IPU7 (isp)) { + vep.bus_type =V4L2_MBUS_CSI2_CPHY ; + ret =v4l2_fwnode_endpoint_parse (ep, &vep); + }if (ret) {dev_err (dev,"fwnode endpoint parse failed: %d\n" , ret); goto err_parse;
@@ -654,6 +661,7 @@ static int isys_notifier_init(struct ipu6_isys *isys) s_asd->csi2.port = vep.base.port; s_asd->csi2.nlanes = vep.bus.mipi_csi2.num_data_lanes; + s_asd->csi2.bus_type = vep.bus_type;dev_dbg (dev,"remote endpoint port %d with %d lanes added\n" , s_asd->csi2.port, s_asd->csi2.nlanes);
drivers/media/pci/intel/ipu6/ipu6-isys.h +2 -0
@@ -14,6 +14,7 @@#include <media/media-device.h> #include <media/v4l2-async.h> #include <media/v4l2-device.h> +#include <media/v4l2-mediabus.h> #include "ipu6.h" #include "ipu6-fw-isys.h"
@@ -96,6 +97,7 @@ struct isys_iwake_watermark {struct ipu6_isys_csi2_config {u32 nlanes;u32 port; +enum v4l2_mbus_type bus_type; };struct sensor_async_sd {
Signature · 1 line
2.55.0
PATCH v2 31/44 media: ipu6: Enable ipu7 isys interrupts
In reply to Antti LaaksoAdd ipu7 specific isys initialization of clocks and enabling interrupts.
--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 56 +++++++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys.c +49 -7
@@ -180,13 +180,23 @@ static int isys_csi2_register_subdevices(struct ipu6_isys *isys)int ret;for (i =0 ; i < csi2_pdata->nports; i++) { - ret =ipu6_isys_csi2_init (&isys->csi2[i], isys, - isys->pdata->base + -CSI_REG_PORT_BASE (i), i); +void __iomem *base = isys->pdata->base; + +if (IS_IPU7 (isys->adev->isp)) { +u32 mask =IS_IPU7_MTL (isys->adev->isp) ? +IPU7_CSI_LEGACY_IRQ_MASK (i) : +IPU7P5_CSI_LEGACY_IRQ_MASK (i); + + isys->isr_csi2_bits |= mask; + isys->csi2[i].legacy_irq_mask = mask; + }else { + base +=CSI_REG_PORT_BASE (i); + isys->isr_csi2_bits |=IPU6_ISYS_UNISPART_IRQ_CSI2 (i); + } + + ret =ipu6_isys_csi2_init (&isys->csi2[i], isys, base, i);if (ret) goto fail; - - isys->isr_csi2_bits |=IPU6_ISYS_UNISPART_IRQ_CSI2 (i); }return 0 ;
@@ -273,7 +283,36 @@ static int isys_register_video_devices(struct ipu6_isys *isys)return ret; } -static void isys_setup_hw (struct ipu6_isys *isys) +static void ipu7_isys_setup_hw (struct ipu6_isys *isys) +{ +u32 offset, mask; +void __iomem *base = isys->pdata->base; + + offset =IPU7_IS_IO_GPREGS_BASE ; + +writel (0x0 , base + offset +IPU7_CLK_EN_TXCLKESC ); +/* Update if ISYS freq updated (0: 400/1, 1:400/2, 63:400/64) */ +writel (0x0 , base + offset +IPU7_CLK_DIV_FACTOR_IS_CLK ); +/* correct the initial printf configuration */ +writel (0x200 , base +IPU7_IS_UC_CTRL_BASE +IPU7_REG_PRINTF_AXI_CNTL ); + + offset =IPU7_IS_UC_CTRL_BASE ; + mask =IPU7_IS_UC_TO_SW_IRQ_MASK ; + +writel (mask, base + offset +IPU7_TO_SW_IRQ_CNTL_CLEAR ); +writel (mask, base + offset +IPU7_TO_SW_IRQ_CNTL_MASK_N ); +writel (mask, base + offset +IPU7_TO_SW_IRQ_CNTL_ENABLE ); + + offset =IPU7_IS_IO_CSI2_LEGACY_IRQ_CTRL_BASE ; + mask =IPU7_CSI_RX_LEGACY_IRQ_MASK ; + +writel (mask, base + offset +IPU7_IRQ_CTL_EDGE ); +writel (mask, base + offset +IPU7_IRQ_CTL_CLEAR ); +writel (mask, base + offset +IPU7_IRQ_CTL_MASK ); +writel (mask, base + offset +IPU7_IRQ_CTL_ENABLE ); +} + +static void ipu6_isys_setup_hw (struct ipu6_isys *isys) {void __iomem *base = isys->pdata->base;const u8 *thd = isys->pdata->ipdata->hw_variant.cdc_fifo_threshold;
@@ -783,7 +822,10 @@ static int isys_runtime_pm_resume(struct device *dev) isys->power =1 ;spin_unlock_irqrestore (&isys->power_lock, flags); -isys_setup_hw (isys); +if (IS_IPU7 (isp)) +ipu7_isys_setup_hw (isys); +else +ipu6_isys_setup_hw (isys);set_iwake_ltrdid (isys,0 ,0 ,LTR_ISYS_ON );
Signature · 1 line
2.55.0
PATCH v2 32/44 media: ipu6: Skip watermark configuration for ipu7
In reply to Antti LaaksoThe ipu7 don't have watermark nor LTR support, skip it.
--- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 4 +++- drivers/media/pci/intel/ipu6/ipu6-isys.c | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +3 -1
@@ -727,8 +727,10 @@ void ipu6_isys_update_stream_watermark(struct ipu6_isys_video *av, bool state) {struct isys_iwake_watermark *iwake_watermark = &av->isys->iwake_watermark; +struct ipu6_device *isp = av->isys->adev->isp; -if (!av->watermark.pixel_rate) +if (IS_IPU7 (isp) || + !av->watermark.pixel_rate)return ;if (state) {
drivers/media/pci/intel/ipu6/ipu6-isys.c +7 -5
@@ -822,12 +822,12 @@ static int isys_runtime_pm_resume(struct device *dev) isys->power =1 ;spin_unlock_irqrestore (&isys->power_lock, flags); -if (IS_IPU7 (isp)) +if (IS_IPU7 (isp)) {ipu7_isys_setup_hw (isys); -else + }else {ipu6_isys_setup_hw (isys); - -set_iwake_ltrdid (isys,0 ,0 ,LTR_ISYS_ON ); +set_iwake_ltrdid (isys,0 ,0 ,LTR_ISYS_ON ); + }return 0 ; }
@@ -836,6 +836,7 @@ static int isys_runtime_pm_suspend(struct device *dev) {struct ipu6_bus_device *adev =to_ipu6_bus_device (dev);struct ipu6_isys *isys =dev_get_drvdata (dev); +struct ipu6_device *isp = adev->isp;unsigned long flags;spin_lock_irqsave (&isys->power_lock, flags);
@@ -849,7 +850,8 @@ static int isys_runtime_pm_suspend(struct device *dev) isys->phy_termcal_val =0 ;cpu_latency_qos_update_request (&isys->pm_qos,PM_QOS_DEFAULT_VALUE ); -set_iwake_ltrdid (isys,0 ,0 ,LTR_ISYS_OFF ); +if (!IS_IPU7 (isp)) +set_iwake_ltrdid (isys,0 ,0 ,LTR_ISYS_OFF );ipu6_mmu_hw_cleanup (adev->mmu);
Signature · 1 line
2.55.0
PATCH v2 33/44 media: ipu6: The SPC init is valid only for ipu6
In reply to Antti LaaksoThe ipu7 don't have SPC.
--- drivers/media/pci/intel/ipu6/ipu6.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/pci/intel/ipu6/ipu6.c +8 -2
@@ -232,10 +232,16 @@ void ipu6_configure_spc(struct ipu6_device *isp, int pkg_dir_idx, void __iomem *base, u64 *pkg_dir, dma_addr_t pkg_dir_dma_addr) { - void __iomem *dmem_base = base + hw_variant->dmem_offset; -void __iomem *spc_regs_base = base + hw_variant->spc_offset; + void __iomem *dmem_base; +void __iomem *spc_regs_base;u32 val; +if (IS_IPU7 (isp)) +return ; + + dmem_base = base + hw_variant->dmem_offset; + spc_regs_base = base + hw_variant->spc_offset; + val =readl (spc_regs_base +IPU6_PSYS_REG_SPC_STATUS_CTRL ); val |=IPU6_PSYS_SPC_STATUS_CTRL_ICACHE_INVALIDATE ;writel (val, spc_regs_base +IPU6_PSYS_REG_SPC_STATUS_CTRL );
Signature · 1 line
2.55.0
PATCH v2 34/44 media: ipu6: The VC arbitration mechanism is ipu6 only
In reply to Antti LaaksoThe ipu7 doesn't support the VC arbitration mechanism that exist in ipu6.
--- drivers/media/pci/intel/ipu6/ipu6.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu6/ipu6.c +6 -1
@@ -447,7 +447,12 @@ static int ipu6_pci_config_setup(struct pci_dev *dev)static void ipu6_configure_vc_mechanism (struct ipu6_device *isp) { -u32 val =readl (isp->base +BUTTRESS_REG_BTRS_CTRL ); +u32 val; + +if (IS_IPU7 (isp)) +return ; + + val =readl (isp->base +BUTTRESS_REG_BTRS_CTRL );if (IPU6_BTRS_ARB_STALL_MODE_VC0 ==IPU6_BTRS_ARB_MODE_TYPE_STALL ) val |=BUTTRESS_REG_BTRS_CTRL_STALL_MODE_VC0 ;
Signature · 1 line
2.55.0
PATCH v2 35/44 media: ipu6: Move buttress mem alloc out from probe
In reply to Antti LaaksoButtress registers are stored in separate buffer, which is passed down to bus driver. Move allocation of this buffer to subsystem init to cleanup pci probe function a bit.
--- drivers/media/pci/intel/ipu6/ipu6.c | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-)
drivers/media/pci/intel/ipu6/ipu6.c +22 -21
@@ -90,7 +90,7 @@ static struct ipu6_psys_internal_pdata psys_ipdata = { }, }; -static const struct ipu6_buttress_ctrl isys_buttress_ctrl = { +static const struct ipu6_buttress_ctrl ipu6_isys_buttress_ctrl = { .subsys_id =IPU_ISYS , .ratio =IPU6_IS_FREQ_CTL_DEFAULT_RATIO , .qos_floor =IPU6_IS_FREQ_CTL_DEFAULT_QOS_FLOOR_RATIO ,
@@ -101,7 +101,7 @@ static const struct ipu6_buttress_ctrl isys_buttress_ctrl = { .pwr_sts_off = IPU6_BUTTRESS_PWR_STATE_DN_DONE, }; -static const struct ipu6_buttress_ctrl psys_buttress_ctrl = { +static const struct ipu6_buttress_ctrl ipu6_psys_buttress_ctrl = { .subsys_id =IPU_PSYS , .ratio =IPU6_PS_FREQ_CTL_DEFAULT_RATIO , .qos_floor =IPU6_PS_FREQ_CTL_DEFAULT_QOS_FLOOR_RATIO ,
@@ -341,11 +341,12 @@ static void ipu6_internal_pdata_init(struct ipu6_device *isp)static struct ipu6_bus_device *ipu6_isys_init (struct pci_dev *pdev,struct device *parent, -struct ipu6_buttress_ctrl *ctrl,void __iomem *base, +const struct ipu6_buttress_ctrl *ctrl,void __iomem *base,const struct ipu6_isys_internal_pdata *ipdata) {struct device *dev = &pdev->dev;struct ipu6_bus_device *isys_adev; +struct ipu6_buttress_ctrl *devm_ctrl;struct ipu6_isys_pdata *pdata;int ret;
@@ -355,6 +356,10 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent,return ERR_PTR (ret); } + devm_ctrl =devm_kmemdup (dev, ctrl,sizeof (*ctrl),GFP_KERNEL ); +if (!devm_ctrl) +return ERR_PTR (-ENOMEM ); + pdata =kzalloc_obj (*pdata);if (!pdata)return ERR_PTR (-ENOMEM );
@@ -362,7 +367,7 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent, pdata->base = base; pdata->ipdata = ipdata; - isys_adev =ipu6_bus_initialize_device (pdev, parent, pdata, ctrl, + isys_adev =ipu6_bus_initialize_device (pdev, parent, pdata, devm_ctrl,IPU6_ISYS_NAME );if (IS_ERR (isys_adev)) {kfree (pdata);
@@ -388,13 +393,19 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent,static struct ipu6_bus_device *ipu6_psys_init (struct pci_dev *pdev,struct device *parent, -struct ipu6_buttress_ctrl *ctrl,void __iomem *base, +const struct ipu6_buttress_ctrl *ctrl,void __iomem *base,const struct ipu6_psys_internal_pdata *ipdata) { +struct device *dev = &pdev->dev;struct ipu6_bus_device *psys_adev; +struct ipu6_buttress_ctrl *devm_ctrl;struct ipu6_psys_pdata *pdata;int ret; + devm_ctrl =devm_kmemdup (dev, ctrl,sizeof (*ctrl),GFP_KERNEL ); +if (!devm_ctrl) +return ERR_PTR (-ENOMEM ); + pdata =kzalloc_obj (*pdata);if (!pdata)return ERR_PTR (-ENOMEM );
@@ -402,7 +413,7 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent, pdata->base = base; pdata->ipdata = ipdata; - psys_adev =ipu6_bus_initialize_device (pdev, parent, pdata, ctrl, + psys_adev =ipu6_bus_initialize_device (pdev, parent, pdata, devm_ctrl,IPU6_PSYS_NAME );if (IS_ERR (psys_adev)) {kfree (pdata);
@@ -469,7 +480,7 @@ static void ipu6_configure_vc_mechanism(struct ipu6_device *isp)static int ipu6_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -struct ipu6_buttress_ctrl *isys_ctrl =NULL , *psys_ctrl =NULL ; +const struct ipu6_buttress_ctrl *isys_ctrl, *psys_ctrl;struct device *dev = &pdev->dev;void __iomem *isys_base =NULL ;void __iomem *psys_base =NULL ;
@@ -484,6 +495,8 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) isp->cpd_metadata_cmpnt_size =sizeof (struct ipu6_cpd_metadata_cmpnt ); isp->buttress.regs = &ipu6_buttress_regs; + isys_ctrl = &ipu6_isys_buttress_ctrl; + psys_ctrl = &ipu6_psys_buttress_ctrl;switch (id->device) {case PCI_DEVICE_ID_INTEL_IPU6 :
@@ -513,6 +526,8 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) isp->hw_ver =IPU_VERSION_7 ; isp->cpd_fw_name =IPU7_FIRMWARE_NAME ; isp->buttress.regs = &ipu7_buttress_regs; + isys_ctrl = &ipu7_isys_buttress_ctrl; + psys_ctrl = &ipu7_psys_buttress_ctrl;break ;default : return dev_err_probe(dev, -ENODEV,
@@ -582,13 +597,6 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_bus_del_devices; } - isys_ctrl =devm_kmemdup (dev, &isys_buttress_ctrl, -sizeof (isys_buttress_ctrl),GFP_KERNEL ); -if (!isys_ctrl) { - ret = -ENOMEM ; - goto out_ipu6_bus_del_devices; - } - isp->isys =ipu6_isys_init (pdev, dev, isys_ctrl, isys_base, &isys_ipdata);if (IS_ERR (isp->isys)) {
@@ -596,13 +604,6 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_bus_del_devices; } - psys_ctrl =devm_kmemdup (dev, &psys_buttress_ctrl, -sizeof (psys_buttress_ctrl),GFP_KERNEL ); -if (!psys_ctrl) { - ret = -ENOMEM ; - goto out_ipu6_bus_del_devices; - } - isp->psys =ipu6_psys_init (pdev, &isp->isys->auxdev.dev, psys_ctrl, psys_base, &psys_ipdata);if (IS_ERR (isp->psys)) {
Signature · 1 line
2.55.0
PATCH v2 36/44 media: ipu6: Read correct SKU ID for ipu7
In reply to Antti LaaksoAdd SKU ID to buttress register map to get correct ID for both IPUs.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 1 + drivers/media/pci/intel/ipu6/ipu6.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.h +1 -0
@@ -54,6 +54,7 @@ struct ipu6_buttress_registers {u32 db0_out;u32 data0_in;u32 data0_out; +u32 sku_id;/* Bitmasks */ u32 irq_is;
drivers/media/pci/intel/ipu6/ipu6.c +3 -1
@@ -153,6 +153,7 @@ static const struct ipu6_buttress_registers ipu6_buttress_regs = { .db0_out = BUTTRESS_REG_IU2CSEDB0, .data0_in = BUTTRESS_REG_CSE2IUDATA0, .data0_out = BUTTRESS_REG_IU2CSEDATA0, + .sku_id = BUTTRESS_REG_SKU,/* Bitmasks */ .irq_is = BUTTRESS_ISR_IS_IRQ,
@@ -182,6 +183,7 @@ static const struct ipu6_buttress_registers ipu7_buttress_regs = { .db0_out = IPU7_BUTTRESS_REG_IU2CSEDB0, .data0_in = IPU7_BUTTRESS_REG_CSE2IUDATA0, .data0_out = IPU7_BUTTRESS_REG_IU2CSEDATA0, + .sku_id = IPU7_BUTTRESS_REG_SKU,/* Bitmasks */ .irq_is = IPU7_BUTTRESS_IRQ_IS_IRQ,
@@ -657,7 +659,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)/* Configure the arbitration mechanisms for VC requests */ ipu6_configure_vc_mechanism (isp); - val =readl (isp->base +BUTTRESS_REG_SKU ); + val =readl (isp->base + isp->buttress.regs->sku_id); sku_id =FIELD_GET (GENMASK (6 ,4 ), val); version =FIELD_GET (GENMASK (3 ,0 ), val); dev_info(dev, "IPU%u-v%u[%x] hardware version %d\n", version, sku_id,
Signature · 1 line
2.55.0
PATCH v2 37/44 media: ipu6: Add support for fixed iova region
In reply to Antti LaaksoThe ipu7 need specific region for firmware in non-secure mode, add support for it.
--- drivers/media/pci/intel/ipu6/ipu6-dma.c | 20 +++++++++++++++++--- drivers/media/pci/intel/ipu6/ipu6-dma.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-dma.c +17 -3
@@ -371,6 +371,17 @@ void ipu6_dma_unmap_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist, }EXPORT_SYMBOL_NS_GPL (ipu6_dma_unmap_sg,"INTEL_IPU6" ); +static struct iova *ipu7_get_fw_code_region (struct ipu6_bus_device *sys) +{ +struct ipu6_mmu *mmu = sys->mmu; +unsigned long lo, hi; + + lo =iova_pfn (&mmu->dmap->iovad,IPU7_FW_CODE_REGION_START ); + hi =iova_pfn (&mmu->dmap->iovad,IPU7_FW_CODE_REGION_END ) -1U ; + +return reserve_iova (&mmu->dmap->iovad, lo, hi); +} +int ipu6_dma_map_sg (struct ipu6_bus_device *sys,struct scatterlist *sglist,int nents,enum dma_data_direction dir,unsigned long attrs)
@@ -397,10 +408,13 @@ int ipu6_dma_map_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,dev_dbg (dev,"dmamap trying to map %d ents %zu pages\n" , nents, npages); - iova =alloc_iova (&mmu->dmap->iovad, npages, -PHYS_PFN (mmu->dmap->mmu_info->aperture_end),0 ); +if (attrs &DMA_ATTR_RESERVE_REGION ) + iova =ipu7_get_fw_code_region (sys); +else + iova =alloc_iova (&mmu->dmap->iovad, npages, +PHYS_PFN (mmu->dmap->mmu_info->aperture_end),0 );if (!iova) -return 0 ; +return -ENOMEM ;dev_dbg (dev,"dmamap: iova low pfn %lu, high pfn %lu\n" , iova->pfn_lo, iova->pfn_hi);
drivers/media/pci/intel/ipu6/ipu6-dma.h +2 -0
@@ -10,6 +10,8 @@#include "ipu6-bus.h" +#define DMA_ATTR_RESERVE_REGION BIT(31) +struct ipu6_mmu_info ;struct ipu6_dma_mapping {
Signature · 1 line
2.55.0
PATCH v2 38/44 media: ipu6: Make fw mapping function reusable
In reply to Antti LaaksoMake ipu6_map_fw_region reusable as for ipu7 we want to map other buffers too, not only firmware. Also add DMA data direction and mapping attributes as arguments as these are different for ipu7.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 40 ++++++++++---------- drivers/media/pci/intel/ipu6/ipu6-buttress.h | 10 ++--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 7 ++-- drivers/media/pci/intel/ipu6/ipu6.c | 8 ++-- 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +20 -20
@@ -676,55 +676,55 @@ int ipu6_buttress_reset_authentication(struct ipu6_device *isp)return 0 ; } -int ipu6_buttress_map_fw_image (struct ipu6_bus_device *sys, -const struct firmware *fw,struct sg_table *sgt) +int ipu6_map_fw_region (struct ipu6_bus_device *sys,const void *data, +size_t size,enum dma_data_direction dir, +unsigned long attrs) { -bool is_vmalloc =is_vmalloc_addr (fw->data); +bool is_vmalloc =is_vmalloc_addr (data);struct pci_dev *pdev = sys->isp->pdev; +struct sg_table *sgt = &sys->fw_sgt;struct page **pages; -const void *addr;unsigned long n_pages;unsigned int i;int ret; -if (!is_vmalloc && !virt_addr_valid (fw->data)) +if (!is_vmalloc && !virt_addr_valid (data))return -EDOM ; - n_pages =PFN_UP (fw->size); + n_pages =PFN_UP (size); pages =kmalloc_objs (*pages, n_pages);if (!pages)return -ENOMEM ; - addr = fw->data;for (i =0 ; i < n_pages; i++) {struct page *p = is_vmalloc ? -vmalloc_to_page (addr) :virt_to_page (addr); +vmalloc_to_page (data) :virt_to_page (data);if (!p) { ret = -ENOMEM ; goto out; } pages[i] = p; - addr +=PAGE_SIZE ; + data +=PAGE_SIZE ; } - ret =sg_alloc_table_from_pages (sgt, pages, n_pages,0 , fw->size, + ret =sg_alloc_table_from_pages (sgt, pages, n_pages,0 , size,GFP_KERNEL );if (ret) { ret = -ENOMEM ; goto out; } - ret =dma_map_sgtable (&pdev->dev, sgt,DMA_TO_DEVICE ,0 ); + ret =dma_map_sgtable (&pdev->dev, sgt, dir,0 );if (ret) {sg_free_table (sgt); goto out; } - ret =ipu6_dma_map_sgtable (sys, sgt,DMA_TO_DEVICE ,0 ); + ret =ipu6_dma_map_sgtable (sys, sgt, dir, attrs);if (ret) { -dma_unmap_sgtable (&pdev->dev, sgt,DMA_TO_DEVICE ,0 ); +dma_unmap_sgtable (&pdev->dev, sgt, dir,0 );sg_free_table (sgt); goto out; }
@@ -736,18 +736,18 @@ int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys,return ret; } -EXPORT_SYMBOL_NS_GPL (ipu6_buttress_map_fw_image,"INTEL_IPU6" ); +EXPORT_SYMBOL_NS_GPL (ipu6_map_fw_region,"INTEL_IPU6" ); -void ipu6_buttress_unmap_fw_image (struct ipu6_bus_device *sys, -struct sg_table *sgt) +void ipu6_unmap_fw_region (struct ipu6_bus_device *sys, +enum dma_data_direction dir) {struct pci_dev *pdev = sys->isp->pdev; -ipu6_dma_unmap_sgtable (sys, sgt,DMA_TO_DEVICE ,0 ); -dma_unmap_sgtable (&pdev->dev, sgt,DMA_TO_DEVICE ,0 ); -sg_free_table (sgt); +ipu6_dma_unmap_sgtable (sys, &sys->fw_sgt, dir,0 ); +dma_unmap_sgtable (&pdev->dev, &sys->fw_sgt, dir,0 ); +sg_free_table (&sys->fw_sgt); } -EXPORT_SYMBOL_NS_GPL (ipu6_buttress_unmap_fw_image,"INTEL_IPU6" ); +EXPORT_SYMBOL_NS_GPL (ipu6_unmap_fw_region,"INTEL_IPU6" );int ipu6_buttress_authenticate (struct ipu6_device *isp) {
drivers/media/pci/intel/ipu6/ipu6-buttress.h +5 -5
@@ -84,11 +84,11 @@ struct ipu6_ipc_buttress_bulk_msg { };int ipu6_buttress_ipc_reset (struct ipu6_device *isp); -int ipu6_buttress_map_fw_image (struct ipu6_bus_device *sys, -const struct firmware *fw, -struct sg_table *sgt); -void ipu6_buttress_unmap_fw_image (struct ipu6_bus_device *sys, -struct sg_table *sgt); +int ipu6_map_fw_region (struct ipu6_bus_device *sys,const void *data, +size_t size,enum dma_data_direction dir, +unsigned long attrs); +void ipu6_unmap_fw_region (struct ipu6_bus_device *sys, +enum dma_data_direction dir);int ipu6_buttress_power (struct device *dev,const struct ipu6_buttress_ctrl *ctrl,bool on);bool ipu6_buttress_get_secure_mode (struct ipu6_device *isp);
drivers/media/pci/intel/ipu6/ipu6-isys.c +4 -3
@@ -1042,7 +1042,8 @@ static int isys_probe(struct auxiliary_device *auxdev,if (!isp->secure_mode) { fw = isp->cpd_fw; - ret =ipu6_buttress_map_fw_image (adev, fw, &adev->fw_sgt); + ret =ipu6_map_fw_region (adev, fw->data, fw->size, +DMA_TO_DEVICE ,0 );if (ret) goto release_firmware;
@@ -1082,7 +1083,7 @@ static int isys_probe(struct auxiliary_device *auxdev,ipu6_cpd_free_pkg_dir (adev); remove_shared_buffer:if (!isp->secure_mode) -ipu6_buttress_unmap_fw_image (adev, &adev->fw_sgt); +ipu6_unmap_fw_region (adev,DMA_TO_DEVICE ); release_firmware:if (!isp->secure_mode)release_firmware (adev->fw);
@@ -1112,7 +1113,7 @@ static void isys_remove(struct auxiliary_device *auxdev)if (!isp->secure_mode) {ipu6_cpd_free_pkg_dir (adev); -ipu6_buttress_unmap_fw_image (adev, &adev->fw_sgt); +ipu6_unmap_fw_region (adev,DMA_TO_DEVICE );release_firmware (adev->fw); }
drivers/media/pci/intel/ipu6/ipu6.c +4 -4
@@ -624,8 +624,8 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_rpm_put; } - ret =ipu6_buttress_map_fw_image (isp->psys, isp->cpd_fw, - &isp->psys->fw_sgt); + ret =ipu6_map_fw_region (isp->psys, isp->cpd_fw->data, + isp->cpd_fw->size,DMA_TO_DEVICE ,0 );if (ret) {dev_err_probe (&isp->pdev->dev, ret,"failed to map fw image\n" ); goto out_ipu6_rpm_put;
@@ -679,7 +679,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_ipu6_bus_del_devices:if (!IS_ERR_OR_NULL (isp->psys)) {ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_buttress_unmap_fw_image (isp->psys, &isp->psys->fw_sgt); +ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); }if (!IS_ERR_OR_NULL (isp->psys) && !IS_ERR_OR_NULL (isp->psys->mmu))ipu6_mmu_cleanup (isp->psys->mmu);
@@ -702,7 +702,7 @@ static void ipu6_pci_remove(struct pci_dev *pdev)devm_free_irq (&pdev->dev, pdev->irq, isp);ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_buttress_unmap_fw_image (isp->psys, &isp->psys->fw_sgt); +ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE );ipu6_buttress_exit (isp);ipu6_bus_del_devices (pdev);
Signature · 1 line
2.55.0
PATCH v2 39/44 media: ipu6: Move isys fw mapping to pci_probe
In reply to Antti LaaksoWe are bout to add ipu7 firmware mapping. It is slightly different from ipu6. Handling this and possible errors is easier when both isys and psys mapping is in one place.
--- drivers/media/pci/intel/ipu6/ipu6-bus.h | 1 - drivers/media/pci/intel/ipu6/ipu6-isys.c | 29 ----------- drivers/media/pci/intel/ipu6/ipu6.c | 63 +++++++++++++++++++----- 3 files changed, 50 insertions(+), 43 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-bus.h +0 -1
@@ -26,7 +26,6 @@ struct ipu6_bus_device {struct ipu6_mmu *mmu;struct ipu6_device *isp;const struct ipu6_buttress_ctrl *ctrl; -const struct firmware *fw;struct sg_table fw_sgt;u64 *pkg_dir;dma_addr_t pkg_dir_dma_addr;
drivers/media/pci/intel/ipu6/ipu6-isys.c +0 -29
@@ -995,7 +995,6 @@ static int isys_probe(struct auxiliary_device *auxdev,const struct ipu6_isys_internal_csi2_pdata *csi2_pdata;struct ipu6_bus_device *adev =auxdev_to_adev (auxdev);struct ipu6_device *isp = adev->isp; -const struct firmware *fw;struct ipu6_isys *isys;unsigned int i;int ret;
@@ -1040,18 +1039,6 @@ static int isys_probe(struct auxiliary_device *auxdev,isys_stream_init (isys); -if (!isp->secure_mode) { - fw = isp->cpd_fw; - ret =ipu6_map_fw_region (adev, fw->data, fw->size, -DMA_TO_DEVICE ,0 ); -if (ret) - goto release_firmware; - - ret =ipu6_cpd_create_pkg_dir (adev, isp->cpd_fw->data); -if (ret) - goto remove_shared_buffer; - } -cpu_latency_qos_add_request (&isys->pm_qos,PM_QOS_DEFAULT_VALUE ); ret =alloc_fw_msg_bufs (isys,20 );
@@ -1079,14 +1066,6 @@ static int isys_probe(struct auxiliary_device *auxdev,free_fw_msg_bufs (isys); out_remove_pkg_dir_shared_buffer:cpu_latency_qos_remove_request (&isys->pm_qos); -if (!isp->secure_mode) -ipu6_cpd_free_pkg_dir (adev); -remove_shared_buffer: -if (!isp->secure_mode) -ipu6_unmap_fw_region (adev,DMA_TO_DEVICE ); -release_firmware: -if (!isp->secure_mode) -release_firmware (adev->fw);for (i =0 ; i <IPU6_ISYS_MAX_STREAMS ; i++)mutex_destroy (&isys->streams[i].mutex);
@@ -1099,9 +1078,7 @@ static int isys_probe(struct auxiliary_device *auxdev,static void isys_remove (struct auxiliary_device *auxdev) { -struct ipu6_bus_device *adev =auxdev_to_adev (auxdev);struct ipu6_isys *isys =dev_get_drvdata (&auxdev->dev); -struct ipu6_device *isp = adev->isp;unsigned int i;free_fw_msg_bufs (isys);
@@ -1111,12 +1088,6 @@ static void isys_remove(struct auxiliary_device *auxdev)cpu_latency_qos_remove_request (&isys->pm_qos); -if (!isp->secure_mode) { -ipu6_cpd_free_pkg_dir (adev); -ipu6_unmap_fw_region (adev,DMA_TO_DEVICE ); -release_firmware (adev->fw); - } -for (i =0 ; i <IPU6_ISYS_MAX_STREAMS ; i++)mutex_destroy (&isys->streams[i].mutex);
drivers/media/pci/intel/ipu6/ipu6.c +50 -13
88 lines not on this page · raw message
Signature · 1 line
2.55.0
Sakari Ailus
maintainerRe: [PATCH v2 39/44] media: ipu6: Move isys fw mapping to pci_probe
Moi,
Thanks for the update!
Quoted 1 line · Antti Laakso
We are bout to add ipu7 firmware mapping. It is slightly different from
s/bout/about/
Quoted 96 lines
ipu6. Handling this and possible errors is easier when both isys and psys mapping is in one place.
Signed-off-by Antti Laakso <[email protected]>--- drivers/media/pci/intel/ipu6/ipu6-bus.h | 1 - drivers/media/pci/intel/ipu6/ipu6-isys.c | 29 ----------- drivers/media/pci/intel/ipu6/ipu6.c | 63 +++++++++++++++++++----- 3 files changed, 50 insertions(+), 43 deletions(-)drivers/media/pci/intel/ipu6/ipu6-bus.h +0
-1@@ -26,7 +26,6 @@ struct ipu6_bus_device {struct ipu6_mmu *mmu;struct ipu6_device *isp;const struct ipu6_buttress_ctrl *ctrl; -const struct firmware *fw;struct sg_table fw_sgt;u64 *pkg_dir;dma_addr_t pkg_dir_dma_addr;drivers/media/pci/intel/ipu6/ipu6-isys.c +0
-29@@ -995,7 +995,6 @@ static int isys_probe(struct auxiliary_device *auxdev,const struct ipu6_isys_internal_csi2_pdata *csi2_pdata;struct ipu6_bus_device *adev =auxdev_to_adev (auxdev);struct ipu6_device *isp = adev->isp; -const struct firmware *fw;struct ipu6_isys *isys;unsigned int i;int ret;@@ -1040,18 +1039,6 @@ static int isys_probe(struct auxiliary_device *auxdev,isys_stream_init (isys); -if (!isp->secure_mode) { - fw = isp->cpd_fw; - ret =ipu6_map_fw_region (adev, fw->data, fw->size, -DMA_TO_DEVICE ,0 ); -if (ret) - goto release_firmware; - - ret =ipu6_cpd_create_pkg_dir (adev, isp->cpd_fw->data); -if (ret) - goto remove_shared_buffer; - } -cpu_latency_qos_add_request (&isys->pm_qos,PM_QOS_DEFAULT_VALUE ); ret =alloc_fw_msg_bufs (isys,20 );@@ -1079,14 +1066,6 @@ static int isys_probe(struct auxiliary_device *auxdev,free_fw_msg_bufs (isys); out_remove_pkg_dir_shared_buffer:cpu_latency_qos_remove_request (&isys->pm_qos); -if (!isp->secure_mode) -ipu6_cpd_free_pkg_dir (adev); -remove_shared_buffer: -if (!isp->secure_mode) -ipu6_unmap_fw_region (adev,DMA_TO_DEVICE ); -release_firmware: -if (!isp->secure_mode) -release_firmware (adev->fw);for (i =0 ; i <IPU6_ISYS_MAX_STREAMS ; i++)mutex_destroy (&isys->streams[i].mutex);@@ -1099,9 +1078,7 @@ static int isys_probe(struct auxiliary_device *auxdev,static void isys_remove (struct auxiliary_device *auxdev) { -struct ipu6_bus_device *adev =auxdev_to_adev (auxdev);struct ipu6_isys *isys =dev_get_drvdata (&auxdev->dev); -struct ipu6_device *isp = adev->isp;unsigned int i;free_fw_msg_bufs (isys);@@ -1111,12 +1088,6 @@ static void isys_remove(struct auxiliary_device *auxdev)cpu_latency_qos_remove_request (&isys->pm_qos); -if (!isp->secure_mode) { -ipu6_cpd_free_pkg_dir (adev); -ipu6_unmap_fw_region (adev,DMA_TO_DEVICE ); -release_firmware (adev->fw); - } -for (i =0 ; i <IPU6_ISYS_MAX_STREAMS ; i++)mutex_destroy (&isys->streams[i].mutex);drivers/media/pci/intel/ipu6/ipu6.c +0
-0
drivers/media/pci/intel/ipu6/ipu6.c static void ipu6_configure_vc_mechanism(struct ipu6_device *isp) · line 485
Quoted 6 lines
drivers/media/pci/intel/ipu6/ipu6.c +3
-0@@ -480,6 +480,40 @@ static void ipu6_configure_vc_mechanism(struct ipu6_device *isp)writel (val, isp->base +BUTTRESS_REG_BTRS_CTRL ); } +static int __ipu6_map_fw_by_sys (struct ipu6_device *isp,struct ipu6_bus_device *adev) +{ + int ret = ipu6_map_fw_region(adev, isp->cpd_fw->data, isp->cpd_fw->size,
Please avoid assigning variables in declaration block when there are errors to check.
Quoted 11 lines
drivers/media/pci/intel/ipu6/ipu6.c +11
-0+ DMA_TO_DEVICE, 0); + +if (ret) { +dev_err_probe (&isp->pdev->dev, ret, +"Firmware mapping failed\n" ); +return ret; + } + + ret =ipu6_cpd_create_pkg_dir (adev, isp->cpd_fw->data); +if (ret) { + dev_err_probe(&isp->pdev->dev, ret,
drivers/media/pci/intel/ipu6/ipu6.c static void ipu6_configure_vc_mechanism(struct ipu6_device *isp) · line 506
Quoted 10 lines
drivers/media/pci/intel/ipu6/ipu6.c +10
-0+ "failed to create pkg dir\n"); +return ret; + } + +return 0 ; +} + +static int ipu6_map_fw (struct ipu6_device *isp) +{ +int ret =__ipu6_map_fw_by_sys (isp, isp->psys);
Ditto.
Quoted 64 lines
drivers/media/pci/intel/ipu6/ipu6.c +26
-13+ +if (ret) +return ret; + +if (!isp->secure_mode) +return __ipu6_map_fw_by_sys (isp, isp->isys); + +return 0 ; +} +static int ipu6_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {const struct ipu6_buttress_ctrl *isys_ctrl, *psys_ctrl;@@ -624,19 +658,9 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_rpm_put; } - ret =ipu6_map_fw_region (isp->psys, isp->cpd_fw->data, - isp->cpd_fw->size,DMA_TO_DEVICE ,0 ); -if (ret) { -dev_err_probe (&isp->pdev->dev, ret,"failed to map fw image\n" ); - goto out_ipu6_rpm_put; - } - - ret =ipu6_cpd_create_pkg_dir (isp->psys, isp->cpd_fw->data); -if (ret) { -dev_err_probe (&isp->pdev->dev, ret, -"failed to create pkg dir\n" ); + ret =ipu6_map_fw (isp); +if (ret) goto out_ipu6_rpm_put; - } ret = devm_request_threaded_irq(dev, pdev->irq, ipu6_buttress_isr, ipu6_buttress_isr_threaded,@@ -679,7 +703,13 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_ipu6_bus_del_devices:if (!IS_ERR_OR_NULL (isp->psys)) {ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); +if (isp->psys->fw_sgt.nents) +ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + } +if (!IS_ERR_OR_NULL (isp->isys)) { +ipu6_cpd_free_pkg_dir (isp->isys); +if (isp->isys->fw_sgt.nents) +ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); }if (!IS_ERR_OR_NULL (isp->psys) && !IS_ERR_OR_NULL (isp->psys->mmu))ipu6_mmu_cleanup (isp->psys->mmu);@@ -703,6 +733,13 @@ static void ipu6_pci_remove(struct pci_dev *pdev)ipu6_cpd_free_pkg_dir (isp->psys);ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + +if (isp->isys) { +ipu6_cpd_free_pkg_dir (isp->isys); +if (isp->isys->fw_sgt.nents) +ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); + } +ipu6_buttress_exit (isp);ipu6_bus_del_devices (pdev);
Signature · 3 lines
Terveisin, Sakari Ailus
PATCH v2 40/44 media: ipu6: Map ipu7 firmware
In reply to Antti LaaksoMapping of ipu7 firmware is slightly different compared to ipu6. Add helpers for it and call them similar to ipu6.
--- drivers/media/pci/intel/ipu6/ipu6.c | 75 ++++++++++++++++++++++++++--- drivers/media/pci/intel/ipu6/ipu6.h | 1 + 2 files changed, 70 insertions(+), 6 deletions(-)
drivers/media/pci/intel/ipu6/ipu6.c +69 -6
@@ -19,6 +19,7 @@#include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/types.h> +#include <linux/vmalloc.h> #include <media/ipu-bridge.h> #include <media/ipu6-pci-table.h>
@@ -27,6 +28,7 @@#include "ipu6-bus.h" #include "ipu6-buttress.h" #include "ipu6-cpd.h" +#include "ipu6-dma.h" #include "ipu6-isys.h" #include "ipu6-mmu.h" #include "ipu6-platform-buttress-regs.h"
@@ -514,6 +516,57 @@ static int ipu6_map_fw(struct ipu6_device *isp)return 0 ; } +static int __ipu7_map_fw_non_secure (struct ipu6_device *isp) +{ +int ret; + +/* +* Allocate and map memory for running the firmware. Not +* required in secure mode, in which firmware runs in IMR. +*/ + isp->fw_code_region =vmalloc (IPU7_FW_CODE_REGION_SIZE ); +if (!isp->fw_code_region) +return -ENOMEM ; + + ret =ipu7_cpd_copy_binary (isp->cpd_fw->data,"isys" , + isp->fw_code_region, &isp->isys->fw_entry); +if (ret) +return ret; + + ret =ipu6_map_fw_region (isp->isys, isp->fw_code_region, +IPU7_FW_CODE_REGION_SIZE ,DMA_BIDIRECTIONAL , +DMA_ATTR_RESERVE_REGION ); +if (ret) +return ret; + + ret =ipu7_cpd_copy_binary (isp->cpd_fw->data,"psys" , + isp->fw_code_region, &isp->psys->fw_entry); +if (ret) +return ret; + +return ipu6_map_fw_region (isp->psys, isp->fw_code_region, +IPU7_FW_CODE_REGION_SIZE ,DMA_BIDIRECTIONAL , +DMA_ATTR_RESERVE_REGION ); +} + +static int ipu7_map_fw (struct ipu6_device *isp) +{ +int ret; + + ret = isp->secure_mode ? +ipu6_map_fw_region (isp->psys, isp->cpd_fw->data, + isp->cpd_fw->size,DMA_BIDIRECTIONAL ,0 ) : +__ipu7_map_fw_non_secure (isp); + +if (ret) { +dev_err_probe (&isp->pdev->dev, ret, +"Failed to init ipu7 firmware region\n" ); +return ret; + } + +return 0 ; +} +static int ipu6_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {const struct ipu6_buttress_ctrl *isys_ctrl, *psys_ctrl;
@@ -523,6 +576,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)struct ipu6_device *isp;phys_addr_t phys;u32 val, version, sku_id; +unsigned long dir;int ret; isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL );
@@ -658,7 +712,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_rpm_put; } - ret =ipu6_map_fw (isp); + ret =IS_IPU7 (isp) ?ipu7_map_fw (isp) :ipu6_map_fw (isp);if (ret) goto out_ipu6_rpm_put;
@@ -701,15 +755,20 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_ipu6_rpm_put:pm_runtime_put_sync (&isp->psys->auxdev.dev); out_ipu6_bus_del_devices: + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;if (!IS_ERR_OR_NULL (isp->psys)) {ipu6_cpd_free_pkg_dir (isp->psys);if (isp->psys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->psys, dir); }if (!IS_ERR_OR_NULL (isp->isys)) {ipu6_cpd_free_pkg_dir (isp->isys);if (isp->isys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->isys, dir); + } +if (isp->fw_code_region) { +vfree (isp->fw_code_region); + isp->fw_code_region =NULL ; }if (!IS_ERR_OR_NULL (isp->psys) && !IS_ERR_OR_NULL (isp->psys->mmu))ipu6_mmu_cleanup (isp->psys->mmu);
@@ -728,18 +787,22 @@ static void ipu6_pci_remove(struct pci_dev *pdev)struct ipu6_device *isp =pci_get_drvdata (pdev);struct ipu6_mmu *isys_mmu = isp->isys->mmu;struct ipu6_mmu *psys_mmu = isp->psys->mmu; +unsigned long dir;devm_free_irq (&pdev->dev, pdev->irq, isp); -ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ; +ipu6_cpd_free_pkg_dir (isp->psys); +ipu6_unmap_fw_region (isp->psys, dir);if (isp->isys) {ipu6_cpd_free_pkg_dir (isp->isys);if (isp->isys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->isys, dir); } +vfree (isp->fw_code_region); +ipu6_buttress_exit (isp);ipu6_bus_del_devices (pdev);
drivers/media/pci/intel/ipu6/ipu6.h +1 -0
@@ -70,6 +70,7 @@ struct ipu6_device {bool secure_mode;u8 hw_ver;bool bus_ready_to_probe; +u32 *fw_code_region; };#define IPU_PSYS 0
Signature · 1 line
2.55.0
Sakari Ailus
maintainerRe: [PATCH v2 40/44] media: ipu6: Map ipu7 firmware
Moi,
Quoted 65 lines · Antti Laakso
Mapping of ipu7 firmware is slightly different compared to ipu6. Add helpers for it and call them similar to ipu6.
Signed-off-by Antti Laakso <[email protected]>--- drivers/media/pci/intel/ipu6/ipu6.c | 75 ++++++++++++++++++++++++++--- drivers/media/pci/intel/ipu6/ipu6.h | 1 + 2 files changed, 70 insertions(+), 6 deletions(-)drivers/media/pci/intel/ipu6/ipu6.c +34
-0@@ -19,6 +19,7 @@#include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/types.h> +#include <linux/vmalloc.h> #include <media/ipu-bridge.h> #include <media/ipu6-pci-table.h> @@ -27,6 +28,7 @@#include "ipu6-bus.h" #include "ipu6-buttress.h" #include "ipu6-cpd.h" +#include "ipu6-dma.h" #include "ipu6-isys.h" #include "ipu6-mmu.h" #include "ipu6-platform-buttress-regs.h" @@ -514,6 +516,57 @@ static int ipu6_map_fw(struct ipu6_device *isp)return 0 ; } +static int __ipu7_map_fw_non_secure (struct ipu6_device *isp) +{ +int ret; + +/* +* Allocate and map memory for running the firmware. Not +* required in secure mode, in which firmware runs in IMR. +*/ + isp->fw_code_region =vmalloc (IPU7_FW_CODE_REGION_SIZE ); +if (!isp->fw_code_region) +return -ENOMEM ; + + ret =ipu7_cpd_copy_binary (isp->cpd_fw->data,"isys" , + isp->fw_code_region, &isp->isys->fw_entry); +if (ret) +return ret; + + ret =ipu6_map_fw_region (isp->isys, isp->fw_code_region, +IPU7_FW_CODE_REGION_SIZE ,DMA_BIDIRECTIONAL , +DMA_ATTR_RESERVE_REGION ); +if (ret) +return ret; + + ret =ipu7_cpd_copy_binary (isp->cpd_fw->data,"psys" , + isp->fw_code_region, &isp->psys->fw_entry); +if (ret) +return ret; + +return ipu6_map_fw_region (isp->psys, isp->fw_code_region, +IPU7_FW_CODE_REGION_SIZE ,DMA_BIDIRECTIONAL , +DMA_ATTR_RESERVE_REGION ); +}
drivers/media/pci/intel/ipu6/ipu6.c static int ipu6_map_fw(struct ipu6_device *isp) · line 560
Quoted 10 lines
drivers/media/pci/intel/ipu6/ipu6.c +10
-0+ +static int ipu7_map_fw (struct ipu6_device *isp) +{ +int ret; + + ret = isp->secure_mode ? +ipu6_map_fw_region (isp->psys, isp->cpd_fw->data, + isp->cpd_fw->size,DMA_BIDIRECTIONAL ,0 ) : +__ipu7_map_fw_non_secure (isp); +
No newline needed here.
Quoted 39 lines
drivers/media/pci/intel/ipu6/ipu6.c +13
-2+if (ret) { +dev_err_probe (&isp->pdev->dev, ret, +"Failed to init ipu7 firmware region\n" ); +return ret; + } + +return 0 ; +} +static int ipu6_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {const struct ipu6_buttress_ctrl *isys_ctrl, *psys_ctrl;@@ -523,6 +576,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)struct ipu6_device *isp;phys_addr_t phys;u32 val, version, sku_id; +unsigned long dir;int ret; isp =devm_kzalloc (dev,sizeof (*isp),GFP_KERNEL );@@ -658,7 +712,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_ipu6_rpm_put; } - ret =ipu6_map_fw (isp); + ret =IS_IPU7 (isp) ?ipu7_map_fw (isp) :ipu6_map_fw (isp);if (ret) goto out_ipu6_rpm_put;@@ -701,15 +755,20 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_ipu6_rpm_put:pm_runtime_put_sync (&isp->psys->auxdev.dev); out_ipu6_bus_del_devices: + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;if (!IS_ERR_OR_NULL (isp->psys)) {ipu6_cpd_free_pkg_dir (isp->psys);if (isp->psys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->psys, dir);
drivers/media/pci/intel/ipu6/ipu6.c static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 771
Quoted 10 lines
drivers/media/pci/intel/ipu6/ipu6.c +5
-1}if (!IS_ERR_OR_NULL (isp->isys)) {ipu6_cpd_free_pkg_dir (isp->isys);if (isp->isys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->isys, dir); + } +if (isp->fw_code_region) { +vfree (isp->fw_code_region); + isp->fw_code_region =NULL ;
This can be done unconditionally -- as in the remove callback.
Quoted 4 lines
drivers/media/pci/intel/ipu6/ipu6.c +0
-0}if (!IS_ERR_OR_NULL (isp->psys) && !IS_ERR_OR_NULL (isp->psys->mmu))ipu6_mmu_cleanup (isp->psys->mmu);
drivers/media/pci/intel/ipu6/ipu6.c static void ipu6_pci_remove(struct pci_dev *pdev) · line 794
Quoted 10 lines
drivers/media/pci/intel/ipu6/ipu6.c +2
-2@@ -728,18 +787,22 @@ static void ipu6_pci_remove(struct pci_dev *pdev)struct ipu6_device *isp =pci_get_drvdata (pdev);struct ipu6_mmu *isys_mmu = isp->isys->mmu;struct ipu6_mmu *psys_mmu = isp->psys->mmu; +unsigned long dir;devm_free_irq (&pdev->dev, pdev->irq, isp); -ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;
Why is there a need for a bi-directional mapping for ipu7?
Quoted 27 lines
drivers/media/pci/intel/ipu6/ipu6.c +5
-1+ipu6_cpd_free_pkg_dir (isp->psys); +ipu6_unmap_fw_region (isp->psys, dir);if (isp->isys) {ipu6_cpd_free_pkg_dir (isp->isys);if (isp->isys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->isys, dir); } +vfree (isp->fw_code_region); +ipu6_buttress_exit (isp);ipu6_bus_del_devices (pdev);drivers/media/pci/intel/ipu6/ipu6.h +1
-0@@ -70,6 +70,7 @@ struct ipu6_device {bool secure_mode;u8 hw_ver;bool bus_ready_to_probe; +u32 *fw_code_region; };#define IPU_PSYS 0
Signature · 3 lines
Terveisin, Sakari Ailus
Re: [PATCH v2 40/44] media: ipu6: Map ipu7 firmware
Moi,
Quoted 6 lines · Sakari Ailus
Quoted 6 lines
drivers/media/pci/intel/ipu6/ipu6.c +1
-0@@ -728,18 +787,22 @@ static void ipu6_pci_remove(struct pci_dev *pdev)struct ipu6_device *isp =pci_get_drvdata (pdev);struct ipu6_mmu *isys_mmu = isp->isys->mmu;struct ipu6_mmu *psys_mmu = isp->psys->mmu; +unsigned long dir;
Quoted 8 lines
drivers/media/pci/intel/ipu6/ipu6.c static void ipu6_pci_remove(struct pci_dev *pdev) · line 794
Quoted 5 lines
drivers/media/pci/intel/ipu6/ipu6.c +1
-2devm_free_irq (&pdev->dev, pdev->irq, isp); -ipu6_cpd_free_pkg_dir (isp->psys); -ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;Why is there a need for a bi-directional mapping for ipu7?
In un-secure mode the mapped area includes firmware data window, thus bi-directional. In secure mode the firmware can be read-only. I'll adjust and limit the bi-directional mapping to un-secure mode only.
Quoted 33 lines
Quoted 27 lines
drivers/media/pci/intel/ipu6/ipu6.c +5
-1+ipu6_cpd_free_pkg_dir (isp->psys); +ipu6_unmap_fw_region (isp->psys, dir);if (isp->isys) {ipu6_cpd_free_pkg_dir (isp->isys);if (isp->isys->fw_sgt.nents) -ipu6_unmap_fw_region (isp->isys,DMA_TO_DEVICE ); +ipu6_unmap_fw_region (isp->isys, dir); } +vfree (isp->fw_code_region); +ipu6_buttress_exit (isp);ipu6_bus_del_devices (pdev);drivers/media/pci/intel/ipu6/ipu6.h +1
-0@@ -70,6 +70,7 @@ struct ipu6_device {bool secure_mode;u8 hw_ver;bool bus_ready_to_probe; +u32 *fw_code_region; };#define IPU_PSYS 0Signature · 3 lines
Terveisin, Sakari Ailus
Sakari Ailus
maintainerRe: [PATCH v2 40/44] media: ipu6: Map ipu7 firmware
Quoted 11 lines · Antti Laakso
Moi,
Quoted 9 lines · Sakari Ailus
Quoted 9 lines
drivers/media/pci/intel/ipu6/ipu6.c +1
-1@@ -728,18 +787,22 @@ static void ipu6_pci_remove(struct pci_dev *pdev)struct ipu6_device *isp =pci_get_drvdata (pdev);struct ipu6_mmu *isys_mmu = isp->isys->mmu;struct ipu6_mmu *psys_mmu = isp->psys->mmu; +unsigned long dir;devm_free_irq (&pdev->dev, pdev->irq, isp); -ipu6_cpd_free_pkg_dir (isp->psys);
Quoted 8 lines
Quoted 5 lines
drivers/media/pci/intel/ipu6/ipu6.c static void ipu6_pci_remove(struct pci_dev *pdev) · line 794
Quoted 2 lines
drivers/media/pci/intel/ipu6/ipu6.c +1
-1-ipu6_unmap_fw_region (isp->psys,DMA_TO_DEVICE ); + dir =IS_IPU7 (isp) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;Why is there a need for a bi-directional mapping for ipu7?
In un-secure mode the mapped area includes firmware data window, thus bi-directional. In secure mode the firmware can be read-only. I'll adjust and limit the bi-directional mapping to un-secure mode only.
Ack; sounds good!
Perhaps a small comment on the matter would be nice?
Signature · 1 line
Sakari Ailus
PATCH v2 41/44 media: ipu6: Set model name for ipu7
In reply to Antti LaaksoWe are about to enable support for ipu7 hardware, set model name accordingly.
--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 2 +- drivers/media/pci/intel/ipu6/ipu6.c | 2 ++ drivers/media/pci/intel/ipu6/ipu6.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu6/ipu6-isys.c +1 -1
@@ -739,7 +739,7 @@ static int isys_register_devices(struct ipu6_isys *isys) isys->media_dev.dev = dev;media_device_pci_init (&isys->media_dev, - pdev,IPU6_MEDIA_DEV_MODEL_NAME ); + pdev, isys->adev->isp->model_name);strscpy (isys->v4l2_dev.name, isys->media_dev.model,sizeof (isys->v4l2_dev.name));
drivers/media/pci/intel/ipu6/ipu6.c +2 -0
@@ -585,6 +585,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) isp->cpd_metadata_cmpnt_size =sizeof (struct ipu6_cpd_metadata_cmpnt ); isp->buttress.regs = &ipu6_buttress_regs; + isp->model_name =IPU6_MEDIA_DEV_MODEL_NAME ; isys_ctrl = &ipu6_isys_buttress_ctrl; psys_ctrl = &ipu6_psys_buttress_ctrl;
@@ -615,6 +616,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)case PCI_DEVICE_ID_INTEL_IPU7 : isp->hw_ver =IPU_VERSION_7 ; isp->cpd_fw_name =IPU7_FIRMWARE_NAME ; + isp->model_name =IPU7_MEDIA_DEV_MODEL_NAME ; isp->buttress.regs = &ipu7_buttress_regs; isys_ctrl = &ipu7_isys_buttress_ctrl; psys_ctrl = &ipu7_psys_buttress_ctrl;
drivers/media/pci/intel/ipu6/ipu6.h +3 -0
@@ -16,6 +16,8 @@ struct ipu6_bus_device;#define IPU6_NAME "intel-ipu6"#define IPU6_MEDIA_DEV_MODEL_NAME "ipu6" +#define IPU7_MEDIA_DEV_MODEL_NAME "ipu7" +#define IPU7P5_MEDIA_DEV_MODEL_NAME "ipu7.5"#define IPU6SE_FIRMWARE_NAME "intel/ipu/ipu6se_fw.bin"#define IPU6EP_FIRMWARE_NAME "intel/ipu/ipu6ep_fw.bin"
@@ -63,6 +65,7 @@ struct ipu6_device {const struct firmware *cpd_fw;const char *cpd_fw_name;u32 cpd_metadata_cmpnt_size; +const char *model_name;void __iomem *base;void __iomem *pb_base;
Signature · 1 line
2.55.0
PATCH v2 42/44 media: ipu6: Add ipu7.5 buttress support
In reply to Antti LaaksoThe ipu7.5 buttress differs from ipu7 slightly, add support for ipu7.5.
Also set hardware version, firmware and model names for ipu7.5.
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 53 +++++++++++++++++-- .../intel/ipu6/ipu6-platform-buttress-regs.h | 7 +++ drivers/media/pci/intel/ipu6/ipu6.c | 38 +++++++++++++ drivers/media/pci/intel/ipu6/ipu6.h | 1 + 4 files changed, 94 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +48 -5
@@ -3,6 +3,7 @@* Copyright (C) 2013--2024 Intel Corporation */ +#include <asm/cpu_device_id.h> #include <linux/bitfield.h> #include <linux/bits.h> #include <linux/completion.h>
@@ -900,11 +901,30 @@ static int ipu6_buttress_send_tsc_request(struct ipu6_device *isp)return ret; } -int ipu6_buttress_start_tsc_sync (struct ipu6_device *isp) +static int __ipu7p5_start_tsc_sync (struct ipu6_device *isp) { -unsigned int i; +u32 val; + + val =readl (isp->base +IPU7_BUTTRESS_REG_TSC_CTL ); + val |=IPU7_BUTTRESS_SEL_PB_TIMESTAMP ; +writel (val, isp->base +IPU7_BUTTRESS_REG_TSC_CTL ); + +for (unsigned int i =0 ; i <BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX ; i++) { + val =readl (isp->base +IPU7_BUTTRESS_REG_PB_TIMESTAMP_VALID ); +if (val ==1 ) +return 0 ; + +usleep_range (40 ,50 ); + } + +dev_err (&isp->pdev->dev,"TSC sync failed (timeout)\n" ); + +return -ETIMEDOUT ; +} -for (i =0 ; i <BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX ; i++) { +static int __ipu6_start_tsc_sync (struct ipu6_device *isp) +{ +for (unsigned int i =0 ; i <BUTTRESS_TSC_SYNC_RESET_TRIAL_MAX ; i++) {u32 val;int ret;
@@ -925,6 +945,14 @@ int ipu6_buttress_start_tsc_sync(struct ipu6_device *isp)return -ETIMEDOUT ; } + +int ipu6_buttress_start_tsc_sync (struct ipu6_device *isp) +{ +if (IS_IPU7P5 (isp)) +return __ipu7p5_start_tsc_sync (isp); + +return __ipu6_start_tsc_sync (isp); +}EXPORT_SYMBOL_NS_GPL (ipu6_buttress_start_tsc_sync,"INTEL_IPU6" );void ipu6_buttress_tsc_read (struct ipu6_device *isp,u64 *val)
@@ -987,6 +1015,13 @@ u32 ipu7_buttress_get_isys_freq(struct ipu6_device *isp) }EXPORT_SYMBOL_NS_GPL (ipu7_buttress_get_isys_freq,"INTEL_IPU6" ); +static const struct x86_cpu_id ipu7_misc_cfg_exclusion[] = { +X86_MATCH_VFM_STEPS (INTEL_PANTHERLAKE_L ,0x1 ,0x1 ,0 ), + {}, +}; + +#define IPU7_WRXREQOP_OVRD_VAL_MASK GENMASK(22, 19) +static void ipu7_buttress_setup (struct ipu6_device *isp) {struct ipu6_buttress *b = &isp->buttress;
@@ -995,12 +1030,20 @@ static void ipu7_buttress_setup(struct ipu6_device *isp)/* program PB BAR */ writel (0 , isp->pb_base +IPU7_GLOBAL_INTERRUPT_MASK ); val =readl (isp->pb_base +IPU7_BAR2_MISC_CONFIG ); + val |=0x100U ; +if (!IS_IPU7_MTL (isp) && !x86_match_cpu (ipu7_misc_cfg_exclusion)) + val |=FIELD_PREP (IPU7_WRXREQOP_OVRD_VAL_MASK ,0xf ) |BIT (18 );writel (val, isp->pb_base +IPU7_BAR2_MISC_CONFIG ); -writel (BIT (22 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_63_32 ); -writel (BIT (1 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_127_96 ); +if (IS_IPU7P5 (isp)) { +writel (BIT (14 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_63_32 ); +writel (BIT (9 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_95_64 ); + }else { +writel (BIT (22 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_63_32 ); +writel (BIT (1 ), isp->pb_base +IPU7_TLBID_HASH_ENABLE_127_96 ); + }writel (b->regs->irq_all, isp->base + b->regs->irq_clear);writel (b->regs->irq_all, isp->base +IPU7_BUTTRESS_REG_IRQ_MASK );
drivers/media/pci/intel/ipu6/ipu6-platform-buttress-regs.h +7 -0
@@ -233,6 +233,8 @@ enum {#define IPU7_BUTTRESS_REG_TSC_CMD 0x2014#define IPU7_BUTTRESS_REG_TSC_CTL 0x2018#define IPU7_BUTTRESS_REG_TSC_LO 0x201c +#define IPU7_BUTTRESS_REG_PB_TIMESTAMP_LO 0x2030 +#define IPU7_BUTTRESS_REG_PB_TIMESTAMP_VALID 0x2038#define IPU7_BUTTRESS_REG_IS_WORKPOINT_REQ 0x2104#define IPU7_BUTTRESS_REG_PS_WORKPOINT_REQ 0x2100#define IPU7_BUTTRESS_REG_IDLE_WDT 0x218c
@@ -319,8 +321,13 @@ enum {/* PB registers */ #define IPU7_GLOBAL_INTERRUPT_MASK 0x8 +#define IPU7_TLBID_HASH_ENABLE_31_0 0x30#define IPU7_TLBID_HASH_ENABLE_63_32 0x34 +#define IPU7_TLBID_HASH_ENABLE_95_64 0x38#define IPU7_TLBID_HASH_ENABLE_127_96 0x3c#define IPU7_BAR2_MISC_CONFIG 0x64 +/* IPU7.5 */ +#define IPU7_BUTTRESS_SEL_PB_TIMESTAMP BIT(9) +#endif /* IPU6_PLATFORM_BUTTRESS_REGS_H */
drivers/media/pci/intel/ipu6/ipu6.c +38 -0
@@ -197,6 +197,36 @@ static const struct ipu6_buttress_registers ipu7_buttress_regs = { .irq_sai = IPU7_BUTTRESS_IRQ_SAI_VIOLATION, }; +static const struct ipu6_buttress_registers ipu7p5_buttress_regs = { +/* Registers */ + .irq_status =IPU7_BUTTRESS_REG_IRQ_STATUS , + .irq_clear =IPU7_BUTTRESS_REG_IRQ_CLEAR , + .irq_enable =IPU7_BUTTRESS_REG_IRQ_ENABLE , + .pwr_status =IPU7_BUTTRESS_REG_PWR_STATUS , + .security_ctl =IPU7_BUTTRESS_REG_SECURITY_CTL , + .fw_reset_ctl =IPU7_BUTTRESS_REG_FW_RESET_CTL , + .fabric_cmd =IPU7_BUTTRESS_REG_TSC_CMD , + .tsw_ctl =IPU7_BUTTRESS_REG_TSC_CTL , + .tsc_lo =IPU7_BUTTRESS_REG_PB_TIMESTAMP_LO , + .wdt =IPU7_BUTTRESS_REG_IDLE_WDT , + .csr_in =IPU7_BUTTRESS_REG_CSE2IUCSR , + .csr_out =IPU7_BUTTRESS_REG_IU2CSECSR , + .db0_in =IPU7_BUTTRESS_REG_CSE2IUDB0 , + .db0_out =IPU7_BUTTRESS_REG_IU2CSEDB0 , + .data0_in =IPU7_BUTTRESS_REG_CSE2IUDATA0 , + .data0_out =IPU7_BUTTRESS_REG_IU2CSEDATA0 , + .sku_id =IPU7_BUTTRESS_REG_SKU , + +/* Bitmasks */ + .irq_is =IPU7_BUTTRESS_IRQ_IS_IRQ , + .irq_ps =IPU7_BUTTRESS_IRQ_PS_IRQ , + .irq_all =IPU7_BUTTRESS_IRQS , + .irq_events =IPU7_BUTTRESS_IRQS , + .irq_cse_ipc =IPU7_BUTTRESS_IRQ_IPC_FROM_CSE_IS_WAITING , + .irq_exec_done =IPU7_BUTTRESS_IRQ_IPC_EXEC_DONE_BY_CSE , + .irq_sai =IPU7_BUTTRESS_IRQ_SAI_VIOLATION , +}; + static void ipu6_pkg_dir_configure_spc(struct ipu6_device *isp, const struct ipu6_hw_variants *hw_variant,
@@ -621,6 +651,14 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) isys_ctrl = &ipu7_isys_buttress_ctrl; psys_ctrl = &ipu7_psys_buttress_ctrl;break ; +case PCI_DEVICE_ID_INTEL_IPU7P5 : + isp->hw_ver =IPU_VERSION_7P5 ; + isp->cpd_fw_name =IPU7P5_FIRMWARE_NAME ; + isp->model_name =IPU7P5_MEDIA_DEV_MODEL_NAME ; + isp->buttress.regs = &ipu7p5_buttress_regs; + isys_ctrl = &ipu7_isys_buttress_ctrl; + psys_ctrl = &ipu7_psys_buttress_ctrl; +break ;default : return dev_err_probe(dev, -ENODEV, "Unsupported IPU6 device %x\n",
drivers/media/pci/intel/ipu6/ipu6.h +1 -0
@@ -25,6 +25,7 @@ struct ipu6_bus_device;#define IPU6EPMTL_FIRMWARE_NAME "intel/ipu/ipu6epmtl_fw.bin"#define IPU6EPADLN_FIRMWARE_NAME "intel/ipu/ipu6epadln_fw.bin"#define IPU7_FIRMWARE_NAME "intel/ipu/ipu7_fw.bin" +#define IPU7P5_FIRMWARE_NAME "intel/ipu/ipu7ptl_fw.bin"#define IPU_VERSION_6 BIT(0)/* TGL */ #define IPU_VERSION_6SE BIT(1)/* JSL */
Signature · 1 line
2.55.0
PATCH v2 43/44 media: ipu6: Add ipu7.5 mmu initialization data
In reply to Antti LaaksoThe ipu7.5 mmu is different compared to ipu7.
--- drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c | 261 ++++++++++++++++++++- drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h | 99 ++++++++ 2 files changed, 359 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c +260 -1
@@ -431,6 +431,250 @@ static struct ipu7_mmu_hw ipu7_psys_mmu_hwdata[] = { }, }; +static struct ipu7_mmu_hw ipu7p5_isys_mmu_hwdata[] = { + { + .name ="IS_FW_RD" , + .offset =IPU7P5_IS_MMU_FW_RD_OFFSET , + .zlx_offset =IPU7P5_IS_ZLX_UC_RD_OFFSET , + .uao_offset =IPU7P5_IS_UAO_UC_RD_OFFSET , + .info_bits =0x20005101 , + .refill =0x00002726 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_IS_MMU_FW_RD_L1_BLOCKNR_REG , + .l2_block =IPU7P5_IS_MMU_FW_RD_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_IS_MMU_FW_RD_STREAM_NUM , + .nr_l2streams =IPU7P5_IS_MMU_FW_RD_STREAM_NUM , + .l1_block_sz = {0x0 ,0x8 ,0xa }, + .l2_block_sz = {0x0 ,0x2 ,0x4 }, + .zlx_nr =IPU7P5_IS_ZLX_UC_RD_NUM , + .zlx_axi_pool = {0x00000f30 }, + .zlx_en = {0 ,1 ,0 ,0 }, + .zlx_conf = {0x0 }, + .uao_p_num =IPU7P5_IS_UAO_UC_RD_PLANENUM , + .uao_p2tlb = {0x49 ,0x4c ,0x4d ,0x0 }, + }, + { + .name ="IS_FW_WR" , + .offset =IPU7P5_IS_MMU_FW_WR_OFFSET , + .zlx_offset =IPU7P5_IS_ZLX_UC_WR_OFFSET , + .uao_offset =IPU7P5_IS_UAO_UC_WR_OFFSET , + .info_bits =0x20005001 , + .refill =0x00002524 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_IS_MMU_FW_WR_L1_BLOCKNR_REG , + .l2_block =IPU7P5_IS_MMU_FW_WR_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_IS_MMU_FW_WR_STREAM_NUM , + .nr_l2streams =IPU7P5_IS_MMU_FW_WR_STREAM_NUM , + .l1_block_sz = {0x0 ,0x8 ,0xa }, + .l2_block_sz = {0x0 ,0x2 ,0x4 }, + .zlx_nr =IPU7P5_IS_ZLX_UC_WR_NUM , + .zlx_axi_pool = {0x00000f20 }, + .zlx_en = {0 ,1 ,1 ,0 }, + .zlx_conf = {0x0 ,0x00010101 ,0x00010101 ,0x0 }, + .uao_p_num =IPU7P5_IS_UAO_UC_WR_PLANENUM , + .uao_p2tlb = {0x49 ,0x4a ,0x4b ,0x0 }, + }, + { + .name ="IS_DATA_WR_ISOC" , + .offset =IPU7P5_IS_MMU_M0_OFFSET , + .zlx_offset =IPU7P5_IS_ZLX_M0_OFFSET , + .uao_offset =IPU7P5_IS_UAO_M0_WR_OFFSET , + .info_bits =0x20004e01 , + .refill =0x00002120 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_IS_MMU_M0_L1_BLOCKNR_REG , + .l2_block =IPU7P5_IS_MMU_M0_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_IS_MMU_M0_STREAM_NUM , + .nr_l2streams =IPU7P5_IS_MMU_M0_STREAM_NUM , + .l1_block_sz = {0x0 ,0x2 ,0x4 ,0x6 ,0x8 ,0xa ,0xc ,0xe ,0x10 , +0x12 ,0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x01e }, + .l2_block_sz = {0x0 ,0x2 ,0x4 ,0x6 ,0x8 ,0xa ,0xc ,0xe ,0x10 , +0x12 ,0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e }, + .zlx_nr =IPU7P5_IS_ZLX_M0_NUM , + .zlx_axi_pool = {0x00000f10 }, + .zlx_en = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 }, + .zlx_conf = {0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 }, + .uao_p_num =IPU7P5_IS_UAO_M0_WR_PLANENUM , + .uao_p2tlb = {0x00000041 ,0x00000042 ,0x00000043 ,0x00000044 , +0x00000041 ,0x00000042 ,0x00000043 ,0x00000044 , +0x00000041 ,0x00000042 ,0x00000043 ,0x00000044 , +0x00000041 ,0x00000042 ,0x00000043 ,0x00000044 }, + }, + { + .name ="IS_DATA_WR_SNOOP" , + .offset =IPU7P5_IS_MMU_M1_OFFSET , + .zlx_offset =IPU7P5_IS_ZLX_M1_OFFSET , + .uao_offset =IPU7P5_IS_UAO_M1_WR_OFFSET , + .info_bits =0x20004f01 , + .refill =0x00002322 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_IS_MMU_M1_L1_BLOCKNR_REG , + .l2_block =IPU7P5_IS_MMU_M1_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_IS_MMU_M1_STREAM_NUM , + .nr_l2streams =IPU7P5_IS_MMU_M1_STREAM_NUM , + .l1_block_sz = {0x0 ,0x2 ,0x4 ,0x6 ,0x8 ,0xa ,0xc ,0xe ,0x10 , +0x12 ,0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e }, + .l2_block_sz = {0x0 ,0x2 ,0x4 ,0x6 ,0x8 ,0xa ,0xc ,0xe ,0x10 , +0x12 ,0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e }, + .zlx_nr =IPU7P5_IS_ZLX_M1_NUM , + .zlx_axi_pool = {0x00000f20 }, + .zlx_en = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 }, + .zlx_conf = {0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 , +0x00010103 ,0x00010103 ,0x00010103 ,0x00010103 }, + .uao_p_num =IPU7P5_IS_UAO_M1_WR_PLANENUM , + .uao_p2tlb = {0x00000045 ,0x00000046 ,0x00000047 ,0x00000048 , +0x00000045 ,0x00000046 ,0x00000047 ,0x00000048 , +0x00000045 ,0x00000046 ,0x00000047 ,0x00000048 , +0x00000045 ,0x00000046 ,0x00000047 ,0x00000048 }, + }, +}; + +static struct ipu7_mmu_hw ipu7p5_psys_mmu_hwdata[] = { + { + .name ="PS_FW_RD" , + .offset =IPU7P5_PS_MMU_FW_RD_OFFSET , + .zlx_offset =IPU7P5_PS_ZLX_FW_RD_OFFSET , + .uao_offset =IPU7P5_PS_UAO_FW_RD_OFFSET , + .info_bits =0x20004001 , + .refill =0x00002726 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_PS_MMU_FW_RD_L1_BLOCKNR_REG , + .l2_block =IPU7P5_PS_MMU_FW_RD_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_PS_MMU_FW_RD_STREAM_NUM , + .nr_l2streams =IPU7P5_PS_MMU_FW_RD_STREAM_NUM , + .l1_block_sz = {0x00 ,0x08 ,0x0a ,0x0c ,0x0d ,0x0f ,0x11 , +0x12 ,0x13 ,0x14 ,0x16 ,0x18 ,0x19 ,0x1a , +0x1a ,0x1a }, + .l2_block_sz = {0x00 ,0x02 ,0x04 ,0x06 ,0x08 ,0x0a ,0x0c , +0x0e ,0x10 ,0x12 ,0x14 ,0x16 ,0x18 ,0x1a , +0x1c ,0x1e }, + .zlx_nr =IPU7P5_PS_ZLX_FW_RD_NUM , + .zlx_axi_pool = {0x00000f30 }, + .zlx_en = {0 ,1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 }, + .zlx_conf = {0x00000000 ,0x00010101 ,0x00000000 ,0x00000000 , +0x00010101 ,0x00010101 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00010101 ,0x00010101 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, + .uao_p_num =IPU7P5_PS_UAO_FW_RD_PLANENUM , + .uao_p2tlb = {0x2e ,0x35 ,0x36 ,0x31 ,0x37 ,0x38 ,0x39 ,0x32 , +0x33 ,0x3a ,0x3b ,0x3c ,0x34 ,0x00 ,0x00 ,0x00 }, + }, + { + .name ="PS_FW_WR" , + .offset =IPU7P5_PS_MMU_FW_WR_OFFSET , + .zlx_offset =IPU7P5_PS_ZLX_FW_WR_OFFSET , + .uao_offset =IPU7P5_PS_UAO_FW_WR_OFFSET , + .info_bits =0x20003e01 , + .refill =0x00002322 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_PS_MMU_FW_WR_L1_BLOCKNR_REG , + .l2_block =IPU7P5_PS_MMU_FW_WR_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_PS_MMU_FW_WR_STREAM_NUM , + .nr_l2streams =IPU7P5_PS_MMU_FW_WR_STREAM_NUM , + .l1_block_sz = {0x00 ,0x08 ,0x0a ,0x0c ,0x0d ,0x0e ,0x0f ,0x10 , +0x10 ,0x10 }, + .l2_block_sz = {0x00 ,0x02 ,0x04 ,0x06 ,0x08 ,0x0a ,0x0c ,0x0e , +0x10 ,0x12 }, + .zlx_nr =IPU7P5_PS_ZLX_FW_WR_NUM , + .zlx_axi_pool = {0x00000f20 }, + .zlx_en = {0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }, + .zlx_conf = {0x00000000 ,0x00010101 ,0x00010101 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 }, + .uao_p_num =IPU7P5_PS_UAO_FW_WR_PLANENUM , + .uao_p2tlb = {0x0000002e ,0x0000002f ,0x00000030 ,0x00000031 , +0x00000032 ,0x00000033 ,0x00000034 ,0x00000000 , +0x00000000 ,0x00000000 }, + }, + { + .name ="PS_DATA_RD" , + .offset =IPU7P5_PS_MMU_SRT_RD_OFFSET , + .zlx_offset =IPU7P5_PS_ZLX_DATA_RD_OFFSET , + .uao_offset =IPU7P5_PS_UAO_SRT_RD_OFFSET , + .info_bits =0x20003f01 , + .refill =0x00002524 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_PS_MMU_SRT_RD_L1_BLOCKNR_REG , + .l2_block =IPU7P5_PS_MMU_SRT_RD_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_PS_MMU_SRT_RD_STREAM_NUM , + .nr_l2streams =IPU7P5_PS_MMU_SRT_RD_STREAM_NUM , + .l1_block_sz = {0x00 ,0x04 ,0x06 ,0x08 ,0x0b ,0x0d ,0x0f ,0x13 , +0x17 ,0x19 ,0x1b ,0x1d ,0x1f ,0x2b ,0x33 ,0x3f , +0x47 ,0x49 ,0x4b ,0x4c ,0x4d ,0x4e }, + .l2_block_sz = {0x00 ,0x02 ,0x04 ,0x06 ,0x08 ,0x0a ,0x0c ,0x0e , +0x10 ,0x12 ,0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e , +0x20 ,0x22 ,0x24 ,0x26 ,0x28 ,0x2a }, + .zlx_nr =IPU7P5_PS_ZLX_DATA_RD_NUM , + .zlx_axi_pool = {0x00000f30 }, + .zlx_en = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , +1 ,1 ,0 ,0 ,0 ,0 }, + .zlx_conf = {0x00030303 ,0x00010101 ,0x00010101 ,0x00030202 , +0x00010101 ,0x00010101 ,0x00030303 ,0x00030303 , +0x00010101 ,0x00030800 ,0x00030500 ,0x00020101 , +0x00042000 ,0x00031000 ,0x00042000 ,0x00031000 , +0x00020400 ,0x00010101 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 }, + .uao_p_num =IPU7P5_PS_UAO_SRT_RD_PLANENUM , + .uao_p2tlb = {0x0000001c ,0x0000001d ,0x0000001e ,0x0000001f , +0x00000020 ,0x00000021 ,0x00000022 ,0x00000023 , +0x00000024 ,0x00000025 ,0x00000026 ,0x00000027 , +0x00000028 ,0x00000029 ,0x0000002a ,0x0000002b , +0x0000002c ,0x0000002d ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 }, + }, + { + .name ="PS_DATA_WR" , + .offset =IPU7P5_PS_MMU_SRT_WR_OFFSET , + .zlx_offset =IPU7P5_PS_ZLX_DATA_WR_OFFSET , + .uao_offset =IPU7P5_PS_UAO_SRT_WR_OFFSET , + .info_bits =0x20003d01 , + .refill =0x00002120 , + .collapse_en_bitmap =0x1 , + .at_sp_arb_cfg =0x1 , + .l1_block =IPU7P5_PS_MMU_SRT_WR_L1_BLOCKNR_REG , + .l2_block =IPU7P5_PS_MMU_SRT_WR_L2_BLOCKNR_REG , + .nr_l1streams =IPU7P5_PS_MMU_SRT_WR_STREAM_NUM , + .nr_l2streams =IPU7P5_PS_MMU_SRT_WR_STREAM_NUM , + .l1_block_sz = {0x00 ,0x02 ,0x06 ,0x0a ,0x0c ,0x0e ,0x10 ,0x12 , +0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e ,0x20 ,0x22 , +0x24 ,0x28 ,0x2a ,0x36 ,0x3e ,0x40 ,0x42 ,0x4e , +0x56 ,0x5c ,0x68 ,0x70 ,0x76 ,0x77 ,0x78 ,0x79 }, + .l2_block_sz = {0x00 ,0x02 ,0x06 ,0x0a ,0x0c ,0x0e ,0x10 ,0x12 , +0x14 ,0x16 ,0x18 ,0x1a ,0x1c ,0x1e ,0x20 ,0x22 , +0x24 ,0x28 ,0x2a ,0x36 ,0x3e ,0x40 ,0x42 ,0x4e , +0x56 ,0x5c ,0x68 ,0x70 ,0x76 ,0x77 ,0x78 ,0x79 }, + .zlx_nr =IPU7P5_PS_ZLX_DATA_WR_NUM , + .zlx_axi_pool = {0x00000f50 }, + .zlx_en = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 , +1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 }, + .zlx_conf = {0x00010102 ,0x00030103 ,0x00030103 ,0x00010101 , +0x00010101 ,0x00030101 ,0x00010101 ,0x38010101 , +0x00000000 ,0x00000000 ,0x38010101 ,0x38010101 , +0x38010101 ,0x38010101 ,0x38010101 ,0x38010101 , +0x00030303 ,0x00010101 ,0x00042000 ,0x00031000 , +0x00010101 ,0x00010101 ,0x00042000 ,0x00031000 , +0x00031000 ,0x00042000 ,0x00031000 ,0x00031000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, + .uao_p_num =IPU7P5_PS_UAO_SRT_WR_PLANENUM , + .uao_p2tlb = {0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 , +0x08 ,0x09 ,0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f , +0x10 ,0x11 ,0x12 ,0x13 ,0x14 ,0x15 ,0x16 ,0x17 , +0x18 ,0x19 ,0x1a ,0x1b ,0x00 ,0x00 ,0x00 ,0x00 }, + }, +}; +static const struct ipu7_mmu_hwdata ipu7_mmu_hwdata_lookup[IPU_SUBSYS_NUM ] = { [IPU_PSYS ] = { .hwdata = ipu7_psys_mmu_hwdata,
@@ -442,6 +686,17 @@ static const struct ipu7_mmu_hwdata ipu7_mmu_hwdata_lookup[IPU_SUBSYS_NUM] = { }, }; +static const struct ipu7_mmu_hwdata ipu7p5_mmu_hwdata_lookup[IPU_SUBSYS_NUM ] = { + [IPU_PSYS ] = { + .hwdata = ipu7p5_psys_mmu_hwdata, + .nr_mmus =ARRAY_SIZE (ipu7p5_psys_mmu_hwdata), + }, + [IPU_ISYS ] = { + .hwdata = ipu7p5_isys_mmu_hwdata, + .nr_mmus =ARRAY_SIZE (ipu7p5_isys_mmu_hwdata), + }, +}; +static void __ipu7_tlb_invalidate (struct ipu6_mmu *mmu) {struct ipu7_mmu_hw *mmu_hw = mmu->ipu7_mmu_hw;
@@ -561,13 +816,17 @@ static int __ipu7_mmu_hw_init(struct ipu6_mmu *mmu)static int __ipu7_mmu_init_hw_data (struct ipu6_mmu *mmu,struct device *dev,void __iomem *base) { -const struct ipu7_mmu_hwdata *lookup = ipu7_mmu_hwdata_lookup; +struct ipu6_device *isp =pci_get_drvdata (to_pci_dev (dev)); +const struct ipu7_mmu_hwdata *lookup;struct ipu7_mmu_hw *mmu_hw, *src;unsigned int i, nr_mmus;if (mmu->mmid >=IPU_SUBSYS_NUM )return -EINVAL ; + lookup =IS_IPU7P5 (isp) ? ipu7p5_mmu_hwdata_lookup : + ipu7_mmu_hwdata_lookup; + src = lookup[mmu->mmid].hwdata; nr_mmus = lookup[mmu->mmid].nr_mmus;
drivers/media/pci/intel/ipu6/ipu7-mmu-hw.h +99 -0
105 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v2 44/44 media: ipu6: Enable ipu7 and ipu7.5
In reply to Antti LaaksoThe driver have now support for ipu7 and 7.5.
--- include/media/ipu6-pci-table.h | 2 ++ 1 file changed, 2 insertions(+)
include/media/ipu6-pci-table.h +2 -0
@@ -24,6 +24,8 @@ static const struct pci_device_id ipu6_pci_tbl[] = { { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IPU6EP_ADLN) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IPU6EP_RPLP) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IPU6EP_MTL) }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IPU7) }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IPU7P5) }, { } };
Signature · 1 line
2.55.0