247 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2 3/*4 * Copyright (C) 2017-2020 Raspberry Pi Trading.5 * Dave Stevenson <dave.stevenson@raspberrypi.com>6 */7 8#ifndef VC4_REGS_UNICAM_H9#define VC4_REGS_UNICAM_H10 11#include <linux/bits.h>12 13/*14 * The following values are taken from files found within the code drop15 * made by Broadcom for the BCM21553 Graphics Driver, predominantly in16 * brcm_usrlib/dag/vmcsx/vcinclude/hardware_vc4.h.17 * They have been modified to be only the register offset.18 */19#define UNICAM_CTRL 0x00020#define UNICAM_STA 0x00421#define UNICAM_ANA 0x00822#define UNICAM_PRI 0x00c23#define UNICAM_CLK 0x01024#define UNICAM_CLT 0x01425#define UNICAM_DAT0 0x01826#define UNICAM_DAT1 0x01c27#define UNICAM_DAT2 0x02028#define UNICAM_DAT3 0x02429#define UNICAM_DLT 0x02830#define UNICAM_CMP0 0x02c31#define UNICAM_CMP1 0x03032#define UNICAM_CAP0 0x03433#define UNICAM_CAP1 0x03834#define UNICAM_ICTL 0x10035#define UNICAM_ISTA 0x10436#define UNICAM_IDI0 0x10837#define UNICAM_IPIPE 0x10c38#define UNICAM_IBSA0 0x11039#define UNICAM_IBEA0 0x11440#define UNICAM_IBLS 0x11841#define UNICAM_IBWP 0x11c42#define UNICAM_IHWIN 0x12043#define UNICAM_IHSTA 0x12444#define UNICAM_IVWIN 0x12845#define UNICAM_IVSTA 0x12c46#define UNICAM_ICC 0x13047#define UNICAM_ICS 0x13448#define UNICAM_IDC 0x13849#define UNICAM_IDPO 0x13c50#define UNICAM_IDCA 0x14051#define UNICAM_IDCD 0x14452#define UNICAM_IDS 0x14853#define UNICAM_DCS 0x20054#define UNICAM_DBSA0 0x20455#define UNICAM_DBEA0 0x20856#define UNICAM_DBWP 0x20c57#define UNICAM_DBCTL 0x30058#define UNICAM_IBSA1 0x30459#define UNICAM_IBEA1 0x30860#define UNICAM_IDI1 0x30c61#define UNICAM_DBSA1 0x31062#define UNICAM_DBEA1 0x31463#define UNICAM_MISC 0x40064 65/*66 * The following bitmasks are from the kernel released by Broadcom67 * for Android - https://android.googlesource.com/kernel/bcm/68 * The Rhea, Hawaii, and Java chips all contain the same VideoCore469 * Unicam block as BCM2835, as defined in eg70 * arch/arm/mach-rhea/include/mach/rdb_A0/brcm_rdb_cam.h and similar.71 * Values reworked to use the kernel BIT and GENMASK macros.72 *73 * Some of the bit mnenomics have been amended to match the datasheet.74 */75/* UNICAM_CTRL Register */76#define UNICAM_CPE BIT(0)77#define UNICAM_MEM BIT(1)78#define UNICAM_CPR BIT(2)79#define UNICAM_CPM_MASK GENMASK(3, 3)80#define UNICAM_CPM_CSI2 081#define UNICAM_CPM_CCP2 182#define UNICAM_SOE BIT(4)83#define UNICAM_DCM_MASK GENMASK(5, 5)84#define UNICAM_DCM_STROBE 085#define UNICAM_DCM_DATA 186#define UNICAM_SLS BIT(6)87#define UNICAM_PFT_MASK GENMASK(11, 8)88#define UNICAM_OET_MASK GENMASK(20, 12)89 90/* UNICAM_STA Register */91#define UNICAM_SYN BIT(0)92#define UNICAM_CS BIT(1)93#define UNICAM_SBE BIT(2)94#define UNICAM_PBE BIT(3)95#define UNICAM_HOE BIT(4)96#define UNICAM_PLE BIT(5)97#define UNICAM_SSC BIT(6)98#define UNICAM_CRCE BIT(7)99#define UNICAM_OES BIT(8)100#define UNICAM_IFO BIT(9)101#define UNICAM_OFO BIT(10)102#define UNICAM_BFO BIT(11)103#define UNICAM_DL BIT(12)104#define UNICAM_PS BIT(13)105#define UNICAM_IS BIT(14)106#define UNICAM_PI0 BIT(15)107#define UNICAM_PI1 BIT(16)108#define UNICAM_FSI_S BIT(17)109#define UNICAM_FEI_S BIT(18)110#define UNICAM_LCI_S BIT(19)111#define UNICAM_BUF0_RDY BIT(20)112#define UNICAM_BUF0_NO BIT(21)113#define UNICAM_BUF1_RDY BIT(22)114#define UNICAM_BUF1_NO BIT(23)115#define UNICAM_DI BIT(24)116 117#define UNICAM_STA_MASK_ALL \118 (UNICAM_SBE | UNICAM_PBE | UNICAM_HOE | UNICAM_PLE | UNICAM_SSC | \119 UNICAM_CRCE | UNICAM_IFO | UNICAM_OFO | UNICAM_DL | UNICAM_PS | \120 UNICAM_PI0 | UNICAM_PI1)121 122/* UNICAM_ANA Register */123#define UNICAM_APD BIT(0)124#define UNICAM_BPD BIT(1)125#define UNICAM_AR BIT(2)126#define UNICAM_DDL BIT(3)127#define UNICAM_CTATADJ_MASK GENMASK(7, 4)128#define UNICAM_PTATADJ_MASK GENMASK(11, 8)129 130/* UNICAM_PRI Register */131#define UNICAM_PE BIT(0)132#define UNICAM_PT_MASK GENMASK(2, 1)133#define UNICAM_NP_MASK GENMASK(7, 4)134#define UNICAM_PP_MASK GENMASK(11, 8)135#define UNICAM_BS_MASK GENMASK(15, 12)136#define UNICAM_BL_MASK GENMASK(17, 16)137 138/* UNICAM_CLK Register */139#define UNICAM_CLE BIT(0)140#define UNICAM_CLPD BIT(1)141#define UNICAM_CLLPE BIT(2)142#define UNICAM_CLHSE BIT(3)143#define UNICAM_CLTRE BIT(4)144#define UNICAM_CLAC_MASK GENMASK(8, 5)145#define UNICAM_CLSTE BIT(29)146 147/* UNICAM_CLT Register */148#define UNICAM_CLT1_MASK GENMASK(7, 0)149#define UNICAM_CLT2_MASK GENMASK(15, 8)150 151/* UNICAM_DATn Registers */152#define UNICAM_DLE BIT(0)153#define UNICAM_DLPD BIT(1)154#define UNICAM_DLLPE BIT(2)155#define UNICAM_DLHSE BIT(3)156#define UNICAM_DLTRE BIT(4)157#define UNICAM_DLSM BIT(5)158#define UNICAM_DLFO BIT(28)159#define UNICAM_DLSTE BIT(29)160 161#define UNICAM_DAT_MASK_ALL (UNICAM_DLSTE | UNICAM_DLFO)162 163/* UNICAM_DLT Register */164#define UNICAM_DLT1_MASK GENMASK(7, 0)165#define UNICAM_DLT2_MASK GENMASK(15, 8)166#define UNICAM_DLT3_MASK GENMASK(23, 16)167 168/* UNICAM_ICTL Register */169#define UNICAM_FSIE BIT(0)170#define UNICAM_FEIE BIT(1)171#define UNICAM_IBOB BIT(2)172#define UNICAM_FCM BIT(3)173#define UNICAM_TFC BIT(4)174#define UNICAM_LIP_MASK GENMASK(6, 5)175#define UNICAM_LCIE_MASK GENMASK(28, 16)176 177/* UNICAM_IDI0/1 Register */178#define UNICAM_ID0_MASK GENMASK(7, 0)179#define UNICAM_ID1_MASK GENMASK(15, 8)180#define UNICAM_ID2_MASK GENMASK(23, 16)181#define UNICAM_ID3_MASK GENMASK(31, 24)182 183/* UNICAM_ISTA Register */184#define UNICAM_FSI BIT(0)185#define UNICAM_FEI BIT(1)186#define UNICAM_LCI BIT(2)187 188#define UNICAM_ISTA_MASK_ALL (UNICAM_FSI | UNICAM_FEI | UNICAM_LCI)189 190/* UNICAM_IPIPE Register */191#define UNICAM_PUM_MASK GENMASK(2, 0)192/* Unpacking modes */193#define UNICAM_PUM_NONE 0194#define UNICAM_PUM_UNPACK6 1195#define UNICAM_PUM_UNPACK7 2196#define UNICAM_PUM_UNPACK8 3197#define UNICAM_PUM_UNPACK10 4198#define UNICAM_PUM_UNPACK12 5199#define UNICAM_PUM_UNPACK14 6200#define UNICAM_PUM_UNPACK16 7201#define UNICAM_DDM_MASK GENMASK(6, 3)202#define UNICAM_PPM_MASK GENMASK(9, 7)203/* Packing modes */204#define UNICAM_PPM_NONE 0205#define UNICAM_PPM_PACK8 1206#define UNICAM_PPM_PACK10 2207#define UNICAM_PPM_PACK12 3208#define UNICAM_PPM_PACK14 4209#define UNICAM_PPM_PACK16 5210#define UNICAM_DEM_MASK GENMASK(11, 10)211#define UNICAM_DEBL_MASK GENMASK(14, 12)212#define UNICAM_ICM_MASK GENMASK(16, 15)213#define UNICAM_IDM_MASK GENMASK(17, 17)214 215/* UNICAM_ICC Register */216#define UNICAM_ICFL_MASK GENMASK(4, 0)217#define UNICAM_ICFH_MASK GENMASK(9, 5)218#define UNICAM_ICST_MASK GENMASK(12, 10)219#define UNICAM_ICLT_MASK GENMASK(15, 13)220#define UNICAM_ICLL_MASK GENMASK(31, 16)221 222/* UNICAM_DCS Register */223#define UNICAM_DIE BIT(0)224#define UNICAM_DIM BIT(1)225#define UNICAM_DBOB BIT(3)226#define UNICAM_FDE BIT(4)227#define UNICAM_LDP BIT(5)228#define UNICAM_EDL_MASK GENMASK(15, 8)229 230/* UNICAM_DBCTL Register */231#define UNICAM_DBEN BIT(0)232#define UNICAM_BUF0_IE BIT(1)233#define UNICAM_BUF1_IE BIT(2)234 235/* UNICAM_CMP[0,1] register */236#define UNICAM_PCE BIT(31)237#define UNICAM_GI BIT(9)238#define UNICAM_CPH BIT(8)239#define UNICAM_PCVC_MASK GENMASK(7, 6)240#define UNICAM_PCDT_MASK GENMASK(5, 0)241 242/* UNICAM_MISC register */243#define UNICAM_FL0 BIT(6)244#define UNICAM_FL1 BIT(9)245 246#endif247