linux/drivers/media/platform/broadcom/bcm2835-unicam-regs.h

/* SPDX-License-Identifier: GPL-2.0-only */

/*
 * Copyright (C) 2017-2020 Raspberry Pi Trading.
 * Dave Stevenson <[email protected]>
 */

#ifndef VC4_REGS_UNICAM_H
#define VC4_REGS_UNICAM_H

#include <linux/bits.h>

/*
 * The following values are taken from files found within the code drop
 * made by Broadcom for the BCM21553 Graphics Driver, predominantly in
 * brcm_usrlib/dag/vmcsx/vcinclude/hardware_vc4.h.
 * They have been modified to be only the register offset.
 */
#define UNICAM_CTRL
#define UNICAM_STA
#define UNICAM_ANA
#define UNICAM_PRI
#define UNICAM_CLK
#define UNICAM_CLT
#define UNICAM_DAT0
#define UNICAM_DAT1
#define UNICAM_DAT2
#define UNICAM_DAT3
#define UNICAM_DLT
#define UNICAM_CMP0
#define UNICAM_CMP1
#define UNICAM_CAP0
#define UNICAM_CAP1
#define UNICAM_ICTL
#define UNICAM_ISTA
#define UNICAM_IDI0
#define UNICAM_IPIPE
#define UNICAM_IBSA0
#define UNICAM_IBEA0
#define UNICAM_IBLS
#define UNICAM_IBWP
#define UNICAM_IHWIN
#define UNICAM_IHSTA
#define UNICAM_IVWIN
#define UNICAM_IVSTA
#define UNICAM_ICC
#define UNICAM_ICS
#define UNICAM_IDC
#define UNICAM_IDPO
#define UNICAM_IDCA
#define UNICAM_IDCD
#define UNICAM_IDS
#define UNICAM_DCS
#define UNICAM_DBSA0
#define UNICAM_DBEA0
#define UNICAM_DBWP
#define UNICAM_DBCTL
#define UNICAM_IBSA1
#define UNICAM_IBEA1
#define UNICAM_IDI1
#define UNICAM_DBSA1
#define UNICAM_DBEA1
#define UNICAM_MISC

/*
 * The following bitmasks are from the kernel released by Broadcom
 * for Android - https://android.googlesource.com/kernel/bcm/
 * The Rhea, Hawaii, and Java chips all contain the same VideoCore4
 * Unicam block as BCM2835, as defined in eg
 * arch/arm/mach-rhea/include/mach/rdb_A0/brcm_rdb_cam.h and similar.
 * Values reworked to use the kernel BIT and GENMASK macros.
 *
 * Some of the bit mnenomics have been amended to match the datasheet.
 */
/* UNICAM_CTRL Register */
#define UNICAM_CPE
#define UNICAM_MEM
#define UNICAM_CPR
#define UNICAM_CPM_MASK
#define UNICAM_CPM_CSI2
#define UNICAM_CPM_CCP2
#define UNICAM_SOE
#define UNICAM_DCM_MASK
#define UNICAM_DCM_STROBE
#define UNICAM_DCM_DATA
#define UNICAM_SLS
#define UNICAM_PFT_MASK
#define UNICAM_OET_MASK

/* UNICAM_STA Register */
#define UNICAM_SYN
#define UNICAM_CS
#define UNICAM_SBE
#define UNICAM_PBE
#define UNICAM_HOE
#define UNICAM_PLE
#define UNICAM_SSC
#define UNICAM_CRCE
#define UNICAM_OES
#define UNICAM_IFO
#define UNICAM_OFO
#define UNICAM_BFO
#define UNICAM_DL
#define UNICAM_PS
#define UNICAM_IS
#define UNICAM_PI0
#define UNICAM_PI1
#define UNICAM_FSI_S
#define UNICAM_FEI_S
#define UNICAM_LCI_S
#define UNICAM_BUF0_RDY
#define UNICAM_BUF0_NO
#define UNICAM_BUF1_RDY
#define UNICAM_BUF1_NO
#define UNICAM_DI

#define UNICAM_STA_MASK_ALL

/* UNICAM_ANA Register */
#define UNICAM_APD
#define UNICAM_BPD
#define UNICAM_AR
#define UNICAM_DDL
#define UNICAM_CTATADJ_MASK
#define UNICAM_PTATADJ_MASK

/* UNICAM_PRI Register */
#define UNICAM_PE
#define UNICAM_PT_MASK
#define UNICAM_NP_MASK
#define UNICAM_PP_MASK
#define UNICAM_BS_MASK
#define UNICAM_BL_MASK

/* UNICAM_CLK Register */
#define UNICAM_CLE
#define UNICAM_CLPD
#define UNICAM_CLLPE
#define UNICAM_CLHSE
#define UNICAM_CLTRE
#define UNICAM_CLAC_MASK
#define UNICAM_CLSTE

/* UNICAM_CLT Register */
#define UNICAM_CLT1_MASK
#define UNICAM_CLT2_MASK

/* UNICAM_DATn Registers */
#define UNICAM_DLE
#define UNICAM_DLPD
#define UNICAM_DLLPE
#define UNICAM_DLHSE
#define UNICAM_DLTRE
#define UNICAM_DLSM
#define UNICAM_DLFO
#define UNICAM_DLSTE

#define UNICAM_DAT_MASK_ALL

/* UNICAM_DLT Register */
#define UNICAM_DLT1_MASK
#define UNICAM_DLT2_MASK
#define UNICAM_DLT3_MASK

/* UNICAM_ICTL Register */
#define UNICAM_FSIE
#define UNICAM_FEIE
#define UNICAM_IBOB
#define UNICAM_FCM
#define UNICAM_TFC
#define UNICAM_LIP_MASK
#define UNICAM_LCIE_MASK

/* UNICAM_IDI0/1 Register */
#define UNICAM_ID0_MASK
#define UNICAM_ID1_MASK
#define UNICAM_ID2_MASK
#define UNICAM_ID3_MASK

/* UNICAM_ISTA Register */
#define UNICAM_FSI
#define UNICAM_FEI
#define UNICAM_LCI

#define UNICAM_ISTA_MASK_ALL

/* UNICAM_IPIPE Register */
#define UNICAM_PUM_MASK
/* Unpacking modes */
#define UNICAM_PUM_NONE
#define UNICAM_PUM_UNPACK6
#define UNICAM_PUM_UNPACK7
#define UNICAM_PUM_UNPACK8
#define UNICAM_PUM_UNPACK10
#define UNICAM_PUM_UNPACK12
#define UNICAM_PUM_UNPACK14
#define UNICAM_PUM_UNPACK16
#define UNICAM_DDM_MASK
#define UNICAM_PPM_MASK
/* Packing modes */
#define UNICAM_PPM_NONE
#define UNICAM_PPM_PACK8
#define UNICAM_PPM_PACK10
#define UNICAM_PPM_PACK12
#define UNICAM_PPM_PACK14
#define UNICAM_PPM_PACK16
#define UNICAM_DEM_MASK
#define UNICAM_DEBL_MASK
#define UNICAM_ICM_MASK
#define UNICAM_IDM_MASK

/* UNICAM_ICC Register */
#define UNICAM_ICFL_MASK
#define UNICAM_ICFH_MASK
#define UNICAM_ICST_MASK
#define UNICAM_ICLT_MASK
#define UNICAM_ICLL_MASK

/* UNICAM_DCS Register */
#define UNICAM_DIE
#define UNICAM_DIM
#define UNICAM_DBOB
#define UNICAM_FDE
#define UNICAM_LDP
#define UNICAM_EDL_MASK

/* UNICAM_DBCTL Register */
#define UNICAM_DBEN
#define UNICAM_BUF0_IE
#define UNICAM_BUF1_IE

/* UNICAM_CMP[0,1] register */
#define UNICAM_PCE
#define UNICAM_GI
#define UNICAM_CPH
#define UNICAM_PCVC_MASK
#define UNICAM_PCDT_MASK

/* UNICAM_MISC register */
#define UNICAM_FL0
#define UNICAM_FL1

#endif