linux/drivers/media/pci/intel/ipu6/ipu6-platform-isys-csi2-reg.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (C) 2023--2024 Intel Corporation */

#ifndef IPU6_PLATFORM_ISYS_CSI2_REG_H
#define IPU6_PLATFORM_ISYS_CSI2_REG_H

#include <linux/bits.h>

#define CSI_REG_BASE
#define CSI_REG_PORT_BASE(id)

/* CSI Port Genral Purpose Registers */
#define CSI_REG_PORT_GPREG_SRST
#define CSI_REG_PORT_GPREG_CSI2_SLV_REG_SRST
#define CSI_REG_PORT_GPREG_CSI2_PORT_CONTROL

/*
 * Port IRQs mapping events:
 * IRQ0 - CSI_FE event
 * IRQ1 - CSI_SYNC
 * IRQ2 - S2M_SIDS0TO7
 * IRQ3 - S2M_SIDS8TO15
 */
#define CSI_PORT_REG_BASE_IRQ_CSI
#define CSI_PORT_REG_BASE_IRQ_CSI_SYNC
#define CSI_PORT_REG_BASE_IRQ_S2M_SIDS0TOS7
#define CSI_PORT_REG_BASE_IRQ_S2M_SIDS8TOS15

#define CSI_PORT_REG_BASE_IRQ_EDGE_OFFSET
#define CSI_PORT_REG_BASE_IRQ_MASK_OFFSET
#define CSI_PORT_REG_BASE_IRQ_STATUS_OFFSET
#define CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET
#define CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET
#define CSI_PORT_REG_BASE_IRQ_LEVEL_NOT_PULSE_OFFSET

#define IPU6SE_CSI_RX_ERROR_IRQ_MASK
#define IPU6_CSI_RX_ERROR_IRQ_MASK

#define CSI_RX_NUM_ERRORS_IN_IRQ
#define CSI_RX_NUM_IRQ

#define IPU_CSI_RX_IRQ_FS_VC(chn)
#define IPU_CSI_RX_IRQ_FE_VC(chn)

/* PPI2CSI */
#define CSI_REG_PPI2CSI_ENABLE
#define CSI_REG_PPI2CSI_CONFIG_PPI_INTF
#define PPI_INTF_CONFIG_NOF_ENABLED_DLANES_MASK
#define CSI_REG_PPI2CSI_CONFIG_CSI_FEATURE

enum CSI_PPI2CSI_CTRL {};

/* CSI_FE */
#define CSI_REG_CSI_FE_ENABLE
#define CSI_REG_CSI_FE_MODE
#define CSI_REG_CSI_FE_MUX_CTRL
#define CSI_REG_CSI_FE_SYNC_CNTR_SEL

enum CSI_FE_ENABLE_TYPE {};

enum CSI_FE_MODE_TYPE {};

enum CSI_FE_INPUT_SELECTOR {};

enum CSI_FE_SYNC_CNTR_SEL_TYPE {};

/* CSI HUB General Purpose Registers */
#define CSI_REG_HUB_GPREG_SRST
#define CSI_REG_HUB_GPREG_SLV_REG_SRST

#define CSI_REG_HUB_DRV_ACCESS_PORT(id)
#define CSI_REG_HUB_FW_ACCESS_PORT_OFS
#define CSI_REG_HUB_FW_ACCESS_PORT_V6OFS
#define CSI_REG_HUB_FW_ACCESS_PORT(ofs, id)

enum CSI_PORT_CLK_GATING_SWITCH {};

#define CSI_REG_BASE_HUB_IRQ

#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_EDGE
#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_MASK
#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_STATUS
#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_CLEAR
#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_ENABLE
#define IPU6_REG_ISYS_CSI_TOP_CTRL0_IRQ_LEVEL_NOT_PULSE

#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_EDGE
#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_MASK
#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_STATUS
#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_CLEAR
#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_ENABLE
#define IPU6_REG_ISYS_CSI_TOP_CTRL1_IRQ_LEVEL_NOT_PULSE

/* MTL IPU6V6 irq ctrl0 & ctrl1 */
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_EDGE
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_MASK
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_STATUS
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_CLEAR
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_ENABLE
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL0_IRQ_LEVEL_NOT_PULSE

#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_EDGE
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_MASK
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_STATUS
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_CLEAR
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_ENABLE
#define IPU6V6_REG_ISYS_CSI_TOP_CTRL1_IRQ_LEVEL_NOT_PULSE

/*
 * 3:0 CSI_PORT.irq_out[3:0] CSI_PORT_CTRL0 IRQ outputs (4bits)
 * [0] CSI_PORT.IRQ_CTRL0_csi
 * [1] CSI_PORT.IRQ_CTRL1_csi_sync
 * [2] CSI_PORT.IRQ_CTRL2_s2m_sids0to7
 * [3] CSI_PORT.IRQ_CTRL3_s2m_sids8to15
 */
#define IPU6_ISYS_UNISPART_IRQ_CSI2(port)

/*
 * ipu6se support 2 front ends, 2 port per front end, 4 ports 0..3
 * sip0 - 0, 1
 * sip1 - 2, 3
 * 0 and 2 support 4 data lanes, 1 and 3 support 2 data lanes
 * all offset are base from isys base address
 */

#define CSI2_HUB_GPREG_SIP_SRST(sip)
#define CSI2_HUB_GPREG_SIP_FB_PORT_CFG(sip)

#define CSI2_HUB_GPREG_DPHY_TIMER_INCR
#define CSI2_HUB_GPREG_HPLL_FREQ
#define CSI2_HUB_GPREG_IS_CLK_RATIO
#define CSI2_HUB_GPREG_HPLL_FREQ_ISCLK_RATE_OVERRIDE
#define CSI2_HUB_GPREG_PORT_CLKGATING_DISABLE
#define CSI2_HUB_GPREG_SIP0_CSI_RX_A_CONTROL
#define CSI2_HUB_GPREG_SIP0_CSI_RX_B_CONTROL
#define CSI2_HUB_GPREG_SIP1_CSI_RX_A_CONTROL
#define CSI2_HUB_GPREG_SIP1_CSI_RX_B_CONTROL

#define CSI2_SIP_TOP_CSI_RX_BASE(sip)
#define CSI2_SIP_TOP_CSI_RX_PORT_BASE_0(port)
#define CSI2_SIP_TOP_CSI_RX_PORT_BASE_1(port)

/* offset from port base */
#define CSI2_SIP_TOP_CSI_RX_PORT_CONTROL
#define CSI2_SIP_TOP_CSI_RX_DLY_CNT_TERMEN_CLANE
#define CSI2_SIP_TOP_CSI_RX_DLY_CNT_SETTLE_CLANE
#define CSI2_SIP_TOP_CSI_RX_DLY_CNT_TERMEN_DLANE(lane)
#define CSI2_SIP_TOP_CSI_RX_DLY_CNT_SETTLE_DLANE(lane)

#endif /* IPU6_ISYS_CSI2_REG_H */