162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Register definitions for the Atmel Image Sensor Interface. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2011 Atmel Corporation 662306a36Sopenharmony_ci * Josh Wu, <josh.wu@atmel.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Based on previous work by Lars Haring, <lars.haring@atmel.com> 962306a36Sopenharmony_ci * and Sedji Gaouaou 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci#ifndef __ATMEL_ISI_H__ 1262306a36Sopenharmony_ci#define __ATMEL_ISI_H__ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/types.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* ISI_V2 register offsets */ 1762306a36Sopenharmony_ci#define ISI_CFG1 0x0000 1862306a36Sopenharmony_ci#define ISI_CFG2 0x0004 1962306a36Sopenharmony_ci#define ISI_PSIZE 0x0008 2062306a36Sopenharmony_ci#define ISI_PDECF 0x000c 2162306a36Sopenharmony_ci#define ISI_Y2R_SET0 0x0010 2262306a36Sopenharmony_ci#define ISI_Y2R_SET1 0x0014 2362306a36Sopenharmony_ci#define ISI_R2Y_SET0 0x0018 2462306a36Sopenharmony_ci#define ISI_R2Y_SET1 0x001C 2562306a36Sopenharmony_ci#define ISI_R2Y_SET2 0x0020 2662306a36Sopenharmony_ci#define ISI_CTRL 0x0024 2762306a36Sopenharmony_ci#define ISI_STATUS 0x0028 2862306a36Sopenharmony_ci#define ISI_INTEN 0x002C 2962306a36Sopenharmony_ci#define ISI_INTDIS 0x0030 3062306a36Sopenharmony_ci#define ISI_INTMASK 0x0034 3162306a36Sopenharmony_ci#define ISI_DMA_CHER 0x0038 3262306a36Sopenharmony_ci#define ISI_DMA_CHDR 0x003C 3362306a36Sopenharmony_ci#define ISI_DMA_CHSR 0x0040 3462306a36Sopenharmony_ci#define ISI_DMA_P_ADDR 0x0044 3562306a36Sopenharmony_ci#define ISI_DMA_P_CTRL 0x0048 3662306a36Sopenharmony_ci#define ISI_DMA_P_DSCR 0x004C 3762306a36Sopenharmony_ci#define ISI_DMA_C_ADDR 0x0050 3862306a36Sopenharmony_ci#define ISI_DMA_C_CTRL 0x0054 3962306a36Sopenharmony_ci#define ISI_DMA_C_DSCR 0x0058 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* Bitfields in CFG1 */ 4262306a36Sopenharmony_ci#define ISI_CFG1_HSYNC_POL_ACTIVE_LOW (1 << 2) 4362306a36Sopenharmony_ci#define ISI_CFG1_VSYNC_POL_ACTIVE_LOW (1 << 3) 4462306a36Sopenharmony_ci#define ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING (1 << 4) 4562306a36Sopenharmony_ci#define ISI_CFG1_EMB_SYNC (1 << 6) 4662306a36Sopenharmony_ci#define ISI_CFG1_CRC_SYNC (1 << 7) 4762306a36Sopenharmony_ci/* Constants for FRATE(ISI_V2) */ 4862306a36Sopenharmony_ci#define ISI_CFG1_FRATE_CAPTURE_ALL (0 << 8) 4962306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_2 (1 << 8) 5062306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_3 (2 << 8) 5162306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_4 (3 << 8) 5262306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_5 (4 << 8) 5362306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_6 (5 << 8) 5462306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_7 (6 << 8) 5562306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_8 (7 << 8) 5662306a36Sopenharmony_ci#define ISI_CFG1_FRATE_DIV_MASK (7 << 8) 5762306a36Sopenharmony_ci#define ISI_CFG1_DISCR (1 << 11) 5862306a36Sopenharmony_ci#define ISI_CFG1_FULL_MODE (1 << 12) 5962306a36Sopenharmony_ci/* Definition for THMASK(ISI_V2) */ 6062306a36Sopenharmony_ci#define ISI_CFG1_THMASK_BEATS_4 (0 << 13) 6162306a36Sopenharmony_ci#define ISI_CFG1_THMASK_BEATS_8 (1 << 13) 6262306a36Sopenharmony_ci#define ISI_CFG1_THMASK_BEATS_16 (2 << 13) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* Bitfields in CFG2 */ 6562306a36Sopenharmony_ci#define ISI_CFG2_GS_MODE_2_PIXEL (0 << 11) 6662306a36Sopenharmony_ci#define ISI_CFG2_GS_MODE_1_PIXEL (1 << 11) 6762306a36Sopenharmony_ci#define ISI_CFG2_GRAYSCALE (1 << 13) 6862306a36Sopenharmony_ci#define ISI_CFG2_COL_SPACE_YCbCr (0 << 15) 6962306a36Sopenharmony_ci#define ISI_CFG2_COL_SPACE_RGB (1 << 15) 7062306a36Sopenharmony_ci/* Constants for YCC_SWAP(ISI_V2) */ 7162306a36Sopenharmony_ci#define ISI_CFG2_YCC_SWAP_DEFAULT (0 << 28) 7262306a36Sopenharmony_ci#define ISI_CFG2_YCC_SWAP_MODE_1 (1 << 28) 7362306a36Sopenharmony_ci#define ISI_CFG2_YCC_SWAP_MODE_2 (2 << 28) 7462306a36Sopenharmony_ci#define ISI_CFG2_YCC_SWAP_MODE_3 (3 << 28) 7562306a36Sopenharmony_ci#define ISI_CFG2_YCC_SWAP_MODE_MASK (3 << 28) 7662306a36Sopenharmony_ci#define ISI_CFG2_IM_VSIZE_OFFSET 0 7762306a36Sopenharmony_ci#define ISI_CFG2_IM_HSIZE_OFFSET 16 7862306a36Sopenharmony_ci#define ISI_CFG2_IM_VSIZE_MASK (0x7FF << ISI_CFG2_IM_VSIZE_OFFSET) 7962306a36Sopenharmony_ci#define ISI_CFG2_IM_HSIZE_MASK (0x7FF << ISI_CFG2_IM_HSIZE_OFFSET) 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci/* Bitfields in PSIZE */ 8262306a36Sopenharmony_ci#define ISI_PSIZE_PREV_VSIZE_OFFSET 0 8362306a36Sopenharmony_ci#define ISI_PSIZE_PREV_HSIZE_OFFSET 16 8462306a36Sopenharmony_ci#define ISI_PSIZE_PREV_VSIZE_MASK (0x3FF << ISI_PSIZE_PREV_VSIZE_OFFSET) 8562306a36Sopenharmony_ci#define ISI_PSIZE_PREV_HSIZE_MASK (0x3FF << ISI_PSIZE_PREV_HSIZE_OFFSET) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* Bitfields in PDECF */ 8862306a36Sopenharmony_ci#define ISI_PDECF_DEC_FACTOR_MASK (0xFF << 0) 8962306a36Sopenharmony_ci#define ISI_PDECF_NO_SAMPLING (16) 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci/* Bitfields in CTRL */ 9262306a36Sopenharmony_ci/* Also using in SR(ISI_V2) */ 9362306a36Sopenharmony_ci#define ISI_CTRL_EN (1 << 0) 9462306a36Sopenharmony_ci#define ISI_CTRL_CDC (1 << 8) 9562306a36Sopenharmony_ci/* Also using in SR/IER/IDR/IMR(ISI_V2) */ 9662306a36Sopenharmony_ci#define ISI_CTRL_DIS (1 << 1) 9762306a36Sopenharmony_ci#define ISI_CTRL_SRST (1 << 2) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* Bitfields in SR */ 10062306a36Sopenharmony_ci#define ISI_SR_SIP (1 << 19) 10162306a36Sopenharmony_ci/* Also using in SR/IER/IDR/IMR */ 10262306a36Sopenharmony_ci#define ISI_SR_VSYNC (1 << 10) 10362306a36Sopenharmony_ci#define ISI_SR_PXFR_DONE (1 << 16) 10462306a36Sopenharmony_ci#define ISI_SR_CXFR_DONE (1 << 17) 10562306a36Sopenharmony_ci#define ISI_SR_P_OVR (1 << 24) 10662306a36Sopenharmony_ci#define ISI_SR_C_OVR (1 << 25) 10762306a36Sopenharmony_ci#define ISI_SR_CRC_ERR (1 << 26) 10862306a36Sopenharmony_ci#define ISI_SR_FR_OVR (1 << 27) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci/* Bitfields in DMA_C_CTRL & in DMA_P_CTRL */ 11162306a36Sopenharmony_ci#define ISI_DMA_CTRL_FETCH (1 << 0) 11262306a36Sopenharmony_ci#define ISI_DMA_CTRL_WB (1 << 1) 11362306a36Sopenharmony_ci#define ISI_DMA_CTRL_IEN (1 << 2) 11462306a36Sopenharmony_ci#define ISI_DMA_CTRL_DONE (1 << 3) 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci/* Bitfields in DMA_CHSR/CHER/CHDR */ 11762306a36Sopenharmony_ci#define ISI_DMA_CHSR_P_CH (1 << 0) 11862306a36Sopenharmony_ci#define ISI_DMA_CHSR_C_CH (1 << 1) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* Definition for isi_platform_data */ 12162306a36Sopenharmony_ci#define ISI_DATAWIDTH_8 0x01 12262306a36Sopenharmony_ci#define ISI_DATAWIDTH_10 0x02 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_cistruct isi_platform_data { 12562306a36Sopenharmony_ci u8 has_emb_sync; 12662306a36Sopenharmony_ci u8 hsync_act_low; 12762306a36Sopenharmony_ci u8 vsync_act_low; 12862306a36Sopenharmony_ci u8 pclk_act_falling; 12962306a36Sopenharmony_ci u8 full_mode; 13062306a36Sopenharmony_ci u32 data_width_flags; 13162306a36Sopenharmony_ci /* Using for ISI_CFG1 */ 13262306a36Sopenharmony_ci u32 frate; 13362306a36Sopenharmony_ci}; 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci#endif /* __ATMEL_ISI_H__ */ 136