162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * drivers/video/mmp/hw/mmp_ctrl.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2012 Marvell Technology Group Ltd. 662306a36Sopenharmony_ci * Authors: Guoqing Li <ligq@marvell.com> 762306a36Sopenharmony_ci * Lisa Du <cldu@marvell.com> 862306a36Sopenharmony_ci * Zhou Zhu <zzhu3@marvell.com> 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _MMP_CTRL_H_ 1262306a36Sopenharmony_ci#define _MMP_CTRL_H_ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <video/mmp_disp.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* ------------< LCD register >------------ */ 1762306a36Sopenharmony_cistruct lcd_regs { 1862306a36Sopenharmony_ci/* TV patch register for MMP2 */ 1962306a36Sopenharmony_ci/* 32 bit TV Video Frame0 Y Starting Address */ 2062306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_Y0 (0x0000) 2162306a36Sopenharmony_ci/* 32 bit TV Video Frame0 U Starting Address */ 2262306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_U0 (0x0004) 2362306a36Sopenharmony_ci/* 32 bit TV Video Frame0 V Starting Address */ 2462306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_V0 (0x0008) 2562306a36Sopenharmony_ci/* 32 bit TV Video Frame0 Command Starting Address */ 2662306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_C0 (0x000C) 2762306a36Sopenharmony_ci/* 32 bit TV Video Frame1 Y Starting Address Register*/ 2862306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_Y1 (0x0010) 2962306a36Sopenharmony_ci/* 32 bit TV Video Frame1 U Starting Address Register*/ 3062306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_U1 (0x0014) 3162306a36Sopenharmony_ci/* 32 bit TV Video Frame1 V Starting Address Register*/ 3262306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_V1 (0x0018) 3362306a36Sopenharmony_ci/* 32 bit TV Video Frame1 Command Starting Address Register*/ 3462306a36Sopenharmony_ci#define LCD_TVD_START_ADDR_C1 (0x001C) 3562306a36Sopenharmony_ci/* 32 bit TV Video Y andC Line Length(Pitch)Register*/ 3662306a36Sopenharmony_ci#define LCD_TVD_PITCH_YC (0x0020) 3762306a36Sopenharmony_ci/* 32 bit TV Video U andV Line Length(Pitch)Register*/ 3862306a36Sopenharmony_ci#define LCD_TVD_PITCH_UV (0x0024) 3962306a36Sopenharmony_ci/* 32 bit TV Video Starting Point on Screen Register*/ 4062306a36Sopenharmony_ci#define LCD_TVD_OVSA_HPXL_VLN (0x0028) 4162306a36Sopenharmony_ci/* 32 bit TV Video Source Size Register*/ 4262306a36Sopenharmony_ci#define LCD_TVD_HPXL_VLN (0x002C) 4362306a36Sopenharmony_ci/* 32 bit TV Video Destination Size (After Zooming)Register*/ 4462306a36Sopenharmony_ci#define LCD_TVDZM_HPXL_VLN (0x0030) 4562306a36Sopenharmony_ci u32 v_y0; 4662306a36Sopenharmony_ci u32 v_u0; 4762306a36Sopenharmony_ci u32 v_v0; 4862306a36Sopenharmony_ci u32 v_c0; 4962306a36Sopenharmony_ci u32 v_y1; 5062306a36Sopenharmony_ci u32 v_u1; 5162306a36Sopenharmony_ci u32 v_v1; 5262306a36Sopenharmony_ci u32 v_c1; 5362306a36Sopenharmony_ci u32 v_pitch_yc; /* Video Y and C Line Length (Pitch) */ 5462306a36Sopenharmony_ci u32 v_pitch_uv; /* Video U and V Line Length (Pitch) */ 5562306a36Sopenharmony_ci u32 v_start; /* Video Starting Point on Screen */ 5662306a36Sopenharmony_ci u32 v_size; /* Video Source Size */ 5762306a36Sopenharmony_ci u32 v_size_z; /* Video Destination Size (After Zooming) */ 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* 32 bit TV Graphic Frame 0 Starting Address Register*/ 6062306a36Sopenharmony_ci#define LCD_TVG_START_ADDR0 (0x0034) 6162306a36Sopenharmony_ci/* 32 bit TV Graphic Frame 1 Starting Address Register*/ 6262306a36Sopenharmony_ci#define LCD_TVG_START_ADDR1 (0x0038) 6362306a36Sopenharmony_ci/* 32 bit TV Graphic Line Length(Pitch)Register*/ 6462306a36Sopenharmony_ci#define LCD_TVG_PITCH (0x003C) 6562306a36Sopenharmony_ci/* 32 bit TV Graphic Starting Point on Screen Register*/ 6662306a36Sopenharmony_ci#define LCD_TVG_OVSA_HPXL_VLN (0x0040) 6762306a36Sopenharmony_ci/* 32 bit TV Graphic Source Size Register*/ 6862306a36Sopenharmony_ci#define LCD_TVG_HPXL_VLN (0x0044) 6962306a36Sopenharmony_ci/* 32 bit TV Graphic Destination size (after Zooming)Register*/ 7062306a36Sopenharmony_ci#define LCD_TVGZM_HPXL_VLN (0x0048) 7162306a36Sopenharmony_ci u32 g_0; /* Graphic Frame 0/1 Starting Address */ 7262306a36Sopenharmony_ci u32 g_1; 7362306a36Sopenharmony_ci u32 g_pitch; /* Graphic Line Length (Pitch) */ 7462306a36Sopenharmony_ci u32 g_start; /* Graphic Starting Point on Screen */ 7562306a36Sopenharmony_ci u32 g_size; /* Graphic Source Size */ 7662306a36Sopenharmony_ci u32 g_size_z; /* Graphic Destination Size (After Zooming) */ 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci/* 32 bit TV Hardware Cursor Starting Point on screen Register*/ 7962306a36Sopenharmony_ci#define LCD_TVC_OVSA_HPXL_VLN (0x004C) 8062306a36Sopenharmony_ci/* 32 bit TV Hardware Cursor Size Register */ 8162306a36Sopenharmony_ci#define LCD_TVC_HPXL_VLN (0x0050) 8262306a36Sopenharmony_ci u32 hc_start; /* Hardware Cursor */ 8362306a36Sopenharmony_ci u32 hc_size; /* Hardware Cursor */ 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci/* 32 bit TV Total Screen Size Register*/ 8662306a36Sopenharmony_ci#define LCD_TV_V_H_TOTAL (0x0054) 8762306a36Sopenharmony_ci/* 32 bit TV Screen Active Size Register*/ 8862306a36Sopenharmony_ci#define LCD_TV_V_H_ACTIVE (0x0058) 8962306a36Sopenharmony_ci/* 32 bit TV Screen Horizontal Porch Register*/ 9062306a36Sopenharmony_ci#define LCD_TV_H_PORCH (0x005C) 9162306a36Sopenharmony_ci/* 32 bit TV Screen Vertical Porch Register*/ 9262306a36Sopenharmony_ci#define LCD_TV_V_PORCH (0x0060) 9362306a36Sopenharmony_ci u32 screen_size; /* Screen Total Size */ 9462306a36Sopenharmony_ci u32 screen_active; /* Screen Active Size */ 9562306a36Sopenharmony_ci u32 screen_h_porch; /* Screen Horizontal Porch */ 9662306a36Sopenharmony_ci u32 screen_v_porch; /* Screen Vertical Porch */ 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci/* 32 bit TV Screen Blank Color Register*/ 9962306a36Sopenharmony_ci#define LCD_TV_BLANKCOLOR (0x0064) 10062306a36Sopenharmony_ci/* 32 bit TV Hardware Cursor Color1 Register*/ 10162306a36Sopenharmony_ci#define LCD_TV_ALPHA_COLOR1 (0x0068) 10262306a36Sopenharmony_ci/* 32 bit TV Hardware Cursor Color2 Register*/ 10362306a36Sopenharmony_ci#define LCD_TV_ALPHA_COLOR2 (0x006C) 10462306a36Sopenharmony_ci u32 blank_color; /* Screen Blank Color */ 10562306a36Sopenharmony_ci u32 hc_Alpha_color1; /* Hardware Cursor Color1 */ 10662306a36Sopenharmony_ci u32 hc_Alpha_color2; /* Hardware Cursor Color2 */ 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci/* 32 bit TV Video Y Color Key Control*/ 10962306a36Sopenharmony_ci#define LCD_TV_COLORKEY_Y (0x0070) 11062306a36Sopenharmony_ci/* 32 bit TV Video U Color Key Control*/ 11162306a36Sopenharmony_ci#define LCD_TV_COLORKEY_U (0x0074) 11262306a36Sopenharmony_ci/* 32 bit TV Video V Color Key Control*/ 11362306a36Sopenharmony_ci#define LCD_TV_COLORKEY_V (0x0078) 11462306a36Sopenharmony_ci u32 v_colorkey_y; /* Video Y Color Key Control */ 11562306a36Sopenharmony_ci u32 v_colorkey_u; /* Video U Color Key Control */ 11662306a36Sopenharmony_ci u32 v_colorkey_v; /* Video V Color Key Control */ 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci/* 32 bit TV VSYNC PulsePixel Edge Control Register*/ 11962306a36Sopenharmony_ci#define LCD_TV_SEPXLCNT (0x007C) 12062306a36Sopenharmony_ci u32 vsync_ctrl; /* VSYNC PulsePixel Edge Control */ 12162306a36Sopenharmony_ci}; 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci#define intf_ctrl(id) ((id) ? (((id) & 1) ? LCD_TVIF_CTRL : \ 12462306a36Sopenharmony_ci LCD_DUMB2_CTRL) : LCD_SPU_DUMB_CTRL) 12562306a36Sopenharmony_ci#define dma_ctrl0(id) ((id) ? (((id) & 1) ? LCD_TV_CTRL0 : \ 12662306a36Sopenharmony_ci LCD_PN2_CTRL0) : LCD_SPU_DMA_CTRL0) 12762306a36Sopenharmony_ci#define dma_ctrl1(id) ((id) ? (((id) & 1) ? LCD_TV_CTRL1 : \ 12862306a36Sopenharmony_ci LCD_PN2_CTRL1) : LCD_SPU_DMA_CTRL1) 12962306a36Sopenharmony_ci#define dma_ctrl(ctrl1, id) (ctrl1 ? dma_ctrl1(id) : dma_ctrl0(id)) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci/* 32 bit TV Path DMA Control 0*/ 13262306a36Sopenharmony_ci#define LCD_TV_CTRL0 (0x0080) 13362306a36Sopenharmony_ci/* 32 bit TV Path DMA Control 1*/ 13462306a36Sopenharmony_ci#define LCD_TV_CTRL1 (0x0084) 13562306a36Sopenharmony_ci/* 32 bit TV Path Video Contrast*/ 13662306a36Sopenharmony_ci#define LCD_TV_CONTRAST (0x0088) 13762306a36Sopenharmony_ci/* 32 bit TV Path Video Saturation*/ 13862306a36Sopenharmony_ci#define LCD_TV_SATURATION (0x008C) 13962306a36Sopenharmony_ci/* 32 bit TV Path Video Hue Adjust*/ 14062306a36Sopenharmony_ci#define LCD_TV_CBSH_HUE (0x0090) 14162306a36Sopenharmony_ci/* 32 bit TV Path TVIF Control Register */ 14262306a36Sopenharmony_ci#define LCD_TVIF_CTRL (0x0094) 14362306a36Sopenharmony_ci#define TV_VBLNK_VALID_EN (1 << 12) 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci/* 32 bit TV Path I/O Pad Control*/ 14662306a36Sopenharmony_ci#define LCD_TVIOPAD_CTRL (0x0098) 14762306a36Sopenharmony_ci/* 32 bit TV Path Cloc Divider */ 14862306a36Sopenharmony_ci#define LCD_TCLK_DIV (0x009C) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define LCD_SCLK(path) ((PATH_PN == path->id) ? LCD_CFG_SCLK_DIV :\ 15162306a36Sopenharmony_ci ((PATH_TV == path->id) ? LCD_TCLK_DIV : LCD_PN2_SCLK_DIV)) 15262306a36Sopenharmony_ci#define intf_rbswap_ctrl(id) ((id) ? (((id) & 1) ? LCD_TVIF_CTRL : \ 15362306a36Sopenharmony_ci PN2_IOPAD_CONTROL) : LCD_TOP_CTRL) 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/* dither configure */ 15662306a36Sopenharmony_ci#define LCD_DITHER_CTRL (0x00A0) 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci#define DITHER_TBL_INDEX_SEL(s) ((s) << 16) 15962306a36Sopenharmony_ci#define DITHER_MODE2(m) ((m) << 12) 16062306a36Sopenharmony_ci#define DITHER_MODE2_SHIFT (12) 16162306a36Sopenharmony_ci#define DITHER_4X8_EN2 (1 << 9) 16262306a36Sopenharmony_ci#define DITHER_4X8_EN2_SHIFT (9) 16362306a36Sopenharmony_ci#define DITHER_EN2 (1 << 8) 16462306a36Sopenharmony_ci#define DITHER_MODE1(m) ((m) << 4) 16562306a36Sopenharmony_ci#define DITHER_MODE1_SHIFT (4) 16662306a36Sopenharmony_ci#define DITHER_4X8_EN1 (1 << 1) 16762306a36Sopenharmony_ci#define DITHER_4X8_EN1_SHIFT (1) 16862306a36Sopenharmony_ci#define DITHER_EN1 (1) 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci/* dither table data was fixed by video bpp of input and output*/ 17162306a36Sopenharmony_ci#define DITHER_TB_4X4_INDEX0 (0x3b19f7d5) 17262306a36Sopenharmony_ci#define DITHER_TB_4X4_INDEX1 (0x082ac4e6) 17362306a36Sopenharmony_ci#define DITHER_TB_4X8_INDEX0 (0xf7d508e6) 17462306a36Sopenharmony_ci#define DITHER_TB_4X8_INDEX1 (0x3b194c2a) 17562306a36Sopenharmony_ci#define DITHER_TB_4X8_INDEX2 (0xc4e6d5f7) 17662306a36Sopenharmony_ci#define DITHER_TB_4X8_INDEX3 (0x082a193b) 17762306a36Sopenharmony_ci#define LCD_DITHER_TBL_DATA (0x00A4) 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci/* Video Frame 0&1 start address registers */ 18062306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_Y0 0x00C0 18162306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_U0 0x00C4 18262306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_V0 0x00C8 18362306a36Sopenharmony_ci#define LCD_CFG_DMA_START_ADDR_0 0x00CC /* Cmd address */ 18462306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_Y1 0x00D0 18562306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_U1 0x00D4 18662306a36Sopenharmony_ci#define LCD_SPU_DMA_START_ADDR_V1 0x00D8 18762306a36Sopenharmony_ci#define LCD_CFG_DMA_START_ADDR_1 0x00DC /* Cmd address */ 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci/* YC & UV Pitch */ 19062306a36Sopenharmony_ci#define LCD_SPU_DMA_PITCH_YC 0x00E0 19162306a36Sopenharmony_ci#define SPU_DMA_PITCH_C(c) ((c)<<16) 19262306a36Sopenharmony_ci#define SPU_DMA_PITCH_Y(y) (y) 19362306a36Sopenharmony_ci#define LCD_SPU_DMA_PITCH_UV 0x00E4 19462306a36Sopenharmony_ci#define SPU_DMA_PITCH_V(v) ((v)<<16) 19562306a36Sopenharmony_ci#define SPU_DMA_PITCH_U(u) (u) 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci/* Video Starting Point on Screen Register */ 19862306a36Sopenharmony_ci#define LCD_SPUT_DMA_OVSA_HPXL_VLN 0x00E8 19962306a36Sopenharmony_ci#define CFG_DMA_OVSA_VLN(y) ((y)<<16) /* 0~0xfff */ 20062306a36Sopenharmony_ci#define CFG_DMA_OVSA_HPXL(x) (x) /* 0~0xfff */ 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci/* Video Size Register */ 20362306a36Sopenharmony_ci#define LCD_SPU_DMA_HPXL_VLN 0x00EC 20462306a36Sopenharmony_ci#define CFG_DMA_VLN(y) ((y)<<16) 20562306a36Sopenharmony_ci#define CFG_DMA_HPXL(x) (x) 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci/* Video Size After zooming Register */ 20862306a36Sopenharmony_ci#define LCD_SPU_DZM_HPXL_VLN 0x00F0 20962306a36Sopenharmony_ci#define CFG_DZM_VLN(y) ((y)<<16) 21062306a36Sopenharmony_ci#define CFG_DZM_HPXL(x) (x) 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci/* Graphic Frame 0&1 Starting Address Register */ 21362306a36Sopenharmony_ci#define LCD_CFG_GRA_START_ADDR0 0x00F4 21462306a36Sopenharmony_ci#define LCD_CFG_GRA_START_ADDR1 0x00F8 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci/* Graphic Frame Pitch */ 21762306a36Sopenharmony_ci#define LCD_CFG_GRA_PITCH 0x00FC 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci/* Graphic Starting Point on Screen Register */ 22062306a36Sopenharmony_ci#define LCD_SPU_GRA_OVSA_HPXL_VLN 0x0100 22162306a36Sopenharmony_ci#define CFG_GRA_OVSA_VLN(y) ((y)<<16) 22262306a36Sopenharmony_ci#define CFG_GRA_OVSA_HPXL(x) (x) 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci/* Graphic Size Register */ 22562306a36Sopenharmony_ci#define LCD_SPU_GRA_HPXL_VLN 0x0104 22662306a36Sopenharmony_ci#define CFG_GRA_VLN(y) ((y)<<16) 22762306a36Sopenharmony_ci#define CFG_GRA_HPXL(x) (x) 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci/* Graphic Size after Zooming Register */ 23062306a36Sopenharmony_ci#define LCD_SPU_GZM_HPXL_VLN 0x0108 23162306a36Sopenharmony_ci#define CFG_GZM_VLN(y) ((y)<<16) 23262306a36Sopenharmony_ci#define CFG_GZM_HPXL(x) (x) 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci/* HW Cursor Starting Point on Screen Register */ 23562306a36Sopenharmony_ci#define LCD_SPU_HWC_OVSA_HPXL_VLN 0x010C 23662306a36Sopenharmony_ci#define CFG_HWC_OVSA_VLN(y) ((y)<<16) 23762306a36Sopenharmony_ci#define CFG_HWC_OVSA_HPXL(x) (x) 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/* HW Cursor Size */ 24062306a36Sopenharmony_ci#define LCD_SPU_HWC_HPXL_VLN 0x0110 24162306a36Sopenharmony_ci#define CFG_HWC_VLN(y) ((y)<<16) 24262306a36Sopenharmony_ci#define CFG_HWC_HPXL(x) (x) 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/* Total Screen Size Register */ 24562306a36Sopenharmony_ci#define LCD_SPUT_V_H_TOTAL 0x0114 24662306a36Sopenharmony_ci#define CFG_V_TOTAL(y) ((y)<<16) 24762306a36Sopenharmony_ci#define CFG_H_TOTAL(x) (x) 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci/* Total Screen Active Size Register */ 25062306a36Sopenharmony_ci#define LCD_SPU_V_H_ACTIVE 0x0118 25162306a36Sopenharmony_ci#define CFG_V_ACTIVE(y) ((y)<<16) 25262306a36Sopenharmony_ci#define CFG_H_ACTIVE(x) (x) 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/* Screen H&V Porch Register */ 25562306a36Sopenharmony_ci#define LCD_SPU_H_PORCH 0x011C 25662306a36Sopenharmony_ci#define CFG_H_BACK_PORCH(b) ((b)<<16) 25762306a36Sopenharmony_ci#define CFG_H_FRONT_PORCH(f) (f) 25862306a36Sopenharmony_ci#define LCD_SPU_V_PORCH 0x0120 25962306a36Sopenharmony_ci#define CFG_V_BACK_PORCH(b) ((b)<<16) 26062306a36Sopenharmony_ci#define CFG_V_FRONT_PORCH(f) (f) 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci/* Screen Blank Color Register */ 26362306a36Sopenharmony_ci#define LCD_SPU_BLANKCOLOR 0x0124 26462306a36Sopenharmony_ci#define CFG_BLANKCOLOR_MASK 0x00FFFFFF 26562306a36Sopenharmony_ci#define CFG_BLANKCOLOR_R_MASK 0x000000FF 26662306a36Sopenharmony_ci#define CFG_BLANKCOLOR_G_MASK 0x0000FF00 26762306a36Sopenharmony_ci#define CFG_BLANKCOLOR_B_MASK 0x00FF0000 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci/* HW Cursor Color 1&2 Register */ 27062306a36Sopenharmony_ci#define LCD_SPU_ALPHA_COLOR1 0x0128 27162306a36Sopenharmony_ci#define CFG_HWC_COLOR1 0x00FFFFFF 27262306a36Sopenharmony_ci#define CFG_HWC_COLOR1_R(red) ((red)<<16) 27362306a36Sopenharmony_ci#define CFG_HWC_COLOR1_G(green) ((green)<<8) 27462306a36Sopenharmony_ci#define CFG_HWC_COLOR1_B(blue) (blue) 27562306a36Sopenharmony_ci#define CFG_HWC_COLOR1_R_MASK 0x000000FF 27662306a36Sopenharmony_ci#define CFG_HWC_COLOR1_G_MASK 0x0000FF00 27762306a36Sopenharmony_ci#define CFG_HWC_COLOR1_B_MASK 0x00FF0000 27862306a36Sopenharmony_ci#define LCD_SPU_ALPHA_COLOR2 0x012C 27962306a36Sopenharmony_ci#define CFG_HWC_COLOR2 0x00FFFFFF 28062306a36Sopenharmony_ci#define CFG_HWC_COLOR2_R_MASK 0x000000FF 28162306a36Sopenharmony_ci#define CFG_HWC_COLOR2_G_MASK 0x0000FF00 28262306a36Sopenharmony_ci#define CFG_HWC_COLOR2_B_MASK 0x00FF0000 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci/* Video YUV Color Key Control */ 28562306a36Sopenharmony_ci#define LCD_SPU_COLORKEY_Y 0x0130 28662306a36Sopenharmony_ci#define CFG_CKEY_Y2(y2) ((y2)<<24) 28762306a36Sopenharmony_ci#define CFG_CKEY_Y2_MASK 0xFF000000 28862306a36Sopenharmony_ci#define CFG_CKEY_Y1(y1) ((y1)<<16) 28962306a36Sopenharmony_ci#define CFG_CKEY_Y1_MASK 0x00FF0000 29062306a36Sopenharmony_ci#define CFG_CKEY_Y(y) ((y)<<8) 29162306a36Sopenharmony_ci#define CFG_CKEY_Y_MASK 0x0000FF00 29262306a36Sopenharmony_ci#define CFG_ALPHA_Y(y) (y) 29362306a36Sopenharmony_ci#define CFG_ALPHA_Y_MASK 0x000000FF 29462306a36Sopenharmony_ci#define LCD_SPU_COLORKEY_U 0x0134 29562306a36Sopenharmony_ci#define CFG_CKEY_U2(u2) ((u2)<<24) 29662306a36Sopenharmony_ci#define CFG_CKEY_U2_MASK 0xFF000000 29762306a36Sopenharmony_ci#define CFG_CKEY_U1(u1) ((u1)<<16) 29862306a36Sopenharmony_ci#define CFG_CKEY_U1_MASK 0x00FF0000 29962306a36Sopenharmony_ci#define CFG_CKEY_U(u) ((u)<<8) 30062306a36Sopenharmony_ci#define CFG_CKEY_U_MASK 0x0000FF00 30162306a36Sopenharmony_ci#define CFG_ALPHA_U(u) (u) 30262306a36Sopenharmony_ci#define CFG_ALPHA_U_MASK 0x000000FF 30362306a36Sopenharmony_ci#define LCD_SPU_COLORKEY_V 0x0138 30462306a36Sopenharmony_ci#define CFG_CKEY_V2(v2) ((v2)<<24) 30562306a36Sopenharmony_ci#define CFG_CKEY_V2_MASK 0xFF000000 30662306a36Sopenharmony_ci#define CFG_CKEY_V1(v1) ((v1)<<16) 30762306a36Sopenharmony_ci#define CFG_CKEY_V1_MASK 0x00FF0000 30862306a36Sopenharmony_ci#define CFG_CKEY_V(v) ((v)<<8) 30962306a36Sopenharmony_ci#define CFG_CKEY_V_MASK 0x0000FF00 31062306a36Sopenharmony_ci#define CFG_ALPHA_V(v) (v) 31162306a36Sopenharmony_ci#define CFG_ALPHA_V_MASK 0x000000FF 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci/* Graphics/Video DMA color key enable bits in LCD_TV_CTRL1 */ 31462306a36Sopenharmony_ci#define CFG_CKEY_GRA 0x2 31562306a36Sopenharmony_ci#define CFG_CKEY_DMA 0x1 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci/* Interlace mode enable bits in LCD_TV_CTRL1 */ 31862306a36Sopenharmony_ci#define CFG_TV_INTERLACE_EN (1 << 22) 31962306a36Sopenharmony_ci#define CFG_TV_NIB (1 << 0) 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci#define LCD_PN_SEPXLCNT 0x013c /* MMP2 */ 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci/* SPI Read Data Register */ 32462306a36Sopenharmony_ci#define LCD_SPU_SPI_RXDATA 0x0140 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/* Smart Panel Read Data Register */ 32762306a36Sopenharmony_ci#define LCD_SPU_ISA_RSDATA 0x0144 32862306a36Sopenharmony_ci#define ISA_RXDATA_16BIT_1_DATA_MASK 0x000000FF 32962306a36Sopenharmony_ci#define ISA_RXDATA_16BIT_2_DATA_MASK 0x0000FF00 33062306a36Sopenharmony_ci#define ISA_RXDATA_16BIT_3_DATA_MASK 0x00FF0000 33162306a36Sopenharmony_ci#define ISA_RXDATA_16BIT_4_DATA_MASK 0xFF000000 33262306a36Sopenharmony_ci#define ISA_RXDATA_32BIT_1_DATA_MASK 0x00FFFFFF 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci#define LCD_SPU_DBG_ISA (0x0148) /* TTC */ 33562306a36Sopenharmony_ci#define LCD_SPU_DMAVLD_YC (0x014C) 33662306a36Sopenharmony_ci#define LCD_SPU_DMAVLD_UV (0x0150) 33762306a36Sopenharmony_ci#define LCD_SPU_DMAVLD_UVSPU_GRAVLD (0x0154) 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci#define LCD_READ_IOPAD (0x0148) /* MMP2*/ 34062306a36Sopenharmony_ci#define LCD_DMAVLD_YC (0x014C) 34162306a36Sopenharmony_ci#define LCD_DMAVLD_UV (0x0150) 34262306a36Sopenharmony_ci#define LCD_TVGGRAVLD_HLEN (0x0154) 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci/* HWC SRAM Read Data Register */ 34562306a36Sopenharmony_ci#define LCD_SPU_HWC_RDDAT 0x0158 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci/* Gamma Table SRAM Read Data Register */ 34862306a36Sopenharmony_ci#define LCD_SPU_GAMMA_RDDAT 0x015c 34962306a36Sopenharmony_ci#define CFG_GAMMA_RDDAT_MASK 0x000000FF 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci/* Palette Table SRAM Read Data Register */ 35262306a36Sopenharmony_ci#define LCD_SPU_PALETTE_RDDAT 0x0160 35362306a36Sopenharmony_ci#define CFG_PALETTE_RDDAT_MASK 0x00FFFFFF 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci#define LCD_SPU_DBG_DMATOP (0x0164) /* TTC */ 35662306a36Sopenharmony_ci#define LCD_SPU_DBG_GRATOP (0x0168) 35762306a36Sopenharmony_ci#define LCD_SPU_DBG_TXCTRL (0x016C) 35862306a36Sopenharmony_ci#define LCD_SPU_DBG_SLVTOP (0x0170) 35962306a36Sopenharmony_ci#define LCD_SPU_DBG_MUXTOP (0x0174) 36062306a36Sopenharmony_ci 36162306a36Sopenharmony_ci#define LCD_SLV_DBG (0x0164) /* MMP2 */ 36262306a36Sopenharmony_ci#define LCD_TVDVLD_YC (0x0168) 36362306a36Sopenharmony_ci#define LCD_TVDVLD_UV (0x016C) 36462306a36Sopenharmony_ci#define LCD_TVC_RDDAT (0x0170) 36562306a36Sopenharmony_ci#define LCD_TV_GAMMA_RDDAT (0x0174) 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci/* I/O Pads Input Read Only Register */ 36862306a36Sopenharmony_ci#define LCD_SPU_IOPAD_IN 0x0178 36962306a36Sopenharmony_ci#define CFG_IOPAD_IN_MASK 0x0FFFFFFF 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci#define LCD_TV_PALETTE_RDDAT (0x0178) /* MMP2 */ 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci/* Reserved Read Only Registers */ 37462306a36Sopenharmony_ci#define LCD_CFG_RDREG5F 0x017C 37562306a36Sopenharmony_ci#define IRE_FRAME_CNT_MASK 0x000000C0 37662306a36Sopenharmony_ci#define IPE_FRAME_CNT_MASK 0x00000030 37762306a36Sopenharmony_ci#define GRA_FRAME_CNT_MASK 0x0000000C /* Graphic */ 37862306a36Sopenharmony_ci#define DMA_FRAME_CNT_MASK 0x00000003 /* Video */ 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci#define LCD_FRAME_CNT (0x017C) /* MMP2 */ 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci/* SPI Control Register. */ 38362306a36Sopenharmony_ci#define LCD_SPU_SPI_CTRL 0x0180 38462306a36Sopenharmony_ci#define CFG_SCLKCNT(div) ((div)<<24) /* 0xFF~0x2 */ 38562306a36Sopenharmony_ci#define CFG_SCLKCNT_MASK 0xFF000000 38662306a36Sopenharmony_ci#define CFG_RXBITS(rx) (((rx) - 1)<<16) /* 0x1F~0x1 */ 38762306a36Sopenharmony_ci#define CFG_RXBITS_MASK 0x00FF0000 38862306a36Sopenharmony_ci#define CFG_TXBITS(tx) (((tx) - 1)<<8) /* 0x1F~0x1 */ 38962306a36Sopenharmony_ci#define CFG_TXBITS_MASK 0x0000FF00 39062306a36Sopenharmony_ci#define CFG_CLKINV(clk) ((clk)<<7) 39162306a36Sopenharmony_ci#define CFG_CLKINV_MASK 0x00000080 39262306a36Sopenharmony_ci#define CFG_KEEPXFER(transfer) ((transfer)<<6) 39362306a36Sopenharmony_ci#define CFG_KEEPXFER_MASK 0x00000040 39462306a36Sopenharmony_ci#define CFG_RXBITSTO0(rx) ((rx)<<5) 39562306a36Sopenharmony_ci#define CFG_RXBITSTO0_MASK 0x00000020 39662306a36Sopenharmony_ci#define CFG_TXBITSTO0(tx) ((tx)<<4) 39762306a36Sopenharmony_ci#define CFG_TXBITSTO0_MASK 0x00000010 39862306a36Sopenharmony_ci#define CFG_SPI_ENA(spi) ((spi)<<3) 39962306a36Sopenharmony_ci#define CFG_SPI_ENA_MASK 0x00000008 40062306a36Sopenharmony_ci#define CFG_SPI_SEL(spi) ((spi)<<2) 40162306a36Sopenharmony_ci#define CFG_SPI_SEL_MASK 0x00000004 40262306a36Sopenharmony_ci#define CFG_SPI_3W4WB(wire) ((wire)<<1) 40362306a36Sopenharmony_ci#define CFG_SPI_3W4WB_MASK 0x00000002 40462306a36Sopenharmony_ci#define CFG_SPI_START(start) (start) 40562306a36Sopenharmony_ci#define CFG_SPI_START_MASK 0x00000001 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci/* SPI Tx Data Register */ 40862306a36Sopenharmony_ci#define LCD_SPU_SPI_TXDATA 0x0184 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci/* 41162306a36Sopenharmony_ci 1. Smart Pannel 8-bit Bus Control Register. 41262306a36Sopenharmony_ci 2. AHB Slave Path Data Port Register 41362306a36Sopenharmony_ci*/ 41462306a36Sopenharmony_ci#define LCD_SPU_SMPN_CTRL 0x0188 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci/* DMA Control 0 Register */ 41762306a36Sopenharmony_ci#define LCD_SPU_DMA_CTRL0 0x0190 41862306a36Sopenharmony_ci#define CFG_NOBLENDING(nb) ((nb)<<31) 41962306a36Sopenharmony_ci#define CFG_NOBLENDING_MASK 0x80000000 42062306a36Sopenharmony_ci#define CFG_GAMMA_ENA(gn) ((gn)<<30) 42162306a36Sopenharmony_ci#define CFG_GAMMA_ENA_MASK 0x40000000 42262306a36Sopenharmony_ci#define CFG_CBSH_ENA(cn) ((cn)<<29) 42362306a36Sopenharmony_ci#define CFG_CBSH_ENA_MASK 0x20000000 42462306a36Sopenharmony_ci#define CFG_PALETTE_ENA(pn) ((pn)<<28) 42562306a36Sopenharmony_ci#define CFG_PALETTE_ENA_MASK 0x10000000 42662306a36Sopenharmony_ci#define CFG_ARBFAST_ENA(an) ((an)<<27) 42762306a36Sopenharmony_ci#define CFG_ARBFAST_ENA_MASK 0x08000000 42862306a36Sopenharmony_ci#define CFG_HWC_1BITMOD(mode) ((mode)<<26) 42962306a36Sopenharmony_ci#define CFG_HWC_1BITMOD_MASK 0x04000000 43062306a36Sopenharmony_ci#define CFG_HWC_1BITENA(mn) ((mn)<<25) 43162306a36Sopenharmony_ci#define CFG_HWC_1BITENA_MASK 0x02000000 43262306a36Sopenharmony_ci#define CFG_HWC_ENA(cn) ((cn)<<24) 43362306a36Sopenharmony_ci#define CFG_HWC_ENA_MASK 0x01000000 43462306a36Sopenharmony_ci#define CFG_DMAFORMAT(dmaformat) ((dmaformat)<<20) 43562306a36Sopenharmony_ci#define CFG_DMAFORMAT_MASK 0x00F00000 43662306a36Sopenharmony_ci#define CFG_GRAFORMAT(graformat) ((graformat)<<16) 43762306a36Sopenharmony_ci#define CFG_GRAFORMAT_MASK 0x000F0000 43862306a36Sopenharmony_ci/* for graphic part */ 43962306a36Sopenharmony_ci#define CFG_GRA_FTOGGLE(toggle) ((toggle)<<15) 44062306a36Sopenharmony_ci#define CFG_GRA_FTOGGLE_MASK 0x00008000 44162306a36Sopenharmony_ci#define CFG_GRA_HSMOOTH(smooth) ((smooth)<<14) 44262306a36Sopenharmony_ci#define CFG_GRA_HSMOOTH_MASK 0x00004000 44362306a36Sopenharmony_ci#define CFG_GRA_TSTMODE(test) ((test)<<13) 44462306a36Sopenharmony_ci#define CFG_GRA_TSTMODE_MASK 0x00002000 44562306a36Sopenharmony_ci#define CFG_GRA_SWAPRB(swap) ((swap)<<12) 44662306a36Sopenharmony_ci#define CFG_GRA_SWAPRB_MASK 0x00001000 44762306a36Sopenharmony_ci#define CFG_GRA_SWAPUV(swap) ((swap)<<11) 44862306a36Sopenharmony_ci#define CFG_GRA_SWAPUV_MASK 0x00000800 44962306a36Sopenharmony_ci#define CFG_GRA_SWAPYU(swap) ((swap)<<10) 45062306a36Sopenharmony_ci#define CFG_GRA_SWAPYU_MASK 0x00000400 45162306a36Sopenharmony_ci#define CFG_GRA_SWAP_MASK 0x00001C00 45262306a36Sopenharmony_ci#define CFG_YUV2RGB_GRA(cvrt) ((cvrt)<<9) 45362306a36Sopenharmony_ci#define CFG_YUV2RGB_GRA_MASK 0x00000200 45462306a36Sopenharmony_ci#define CFG_GRA_ENA(gra) ((gra)<<8) 45562306a36Sopenharmony_ci#define CFG_GRA_ENA_MASK 0x00000100 45662306a36Sopenharmony_ci#define dma0_gfx_masks (CFG_GRAFORMAT_MASK | CFG_GRA_FTOGGLE_MASK | \ 45762306a36Sopenharmony_ci CFG_GRA_HSMOOTH_MASK | CFG_GRA_TSTMODE_MASK | CFG_GRA_SWAP_MASK | \ 45862306a36Sopenharmony_ci CFG_YUV2RGB_GRA_MASK | CFG_GRA_ENA_MASK) 45962306a36Sopenharmony_ci/* for video part */ 46062306a36Sopenharmony_ci#define CFG_DMA_FTOGGLE(toggle) ((toggle)<<7) 46162306a36Sopenharmony_ci#define CFG_DMA_FTOGGLE_MASK 0x00000080 46262306a36Sopenharmony_ci#define CFG_DMA_HSMOOTH(smooth) ((smooth)<<6) 46362306a36Sopenharmony_ci#define CFG_DMA_HSMOOTH_MASK 0x00000040 46462306a36Sopenharmony_ci#define CFG_DMA_TSTMODE(test) ((test)<<5) 46562306a36Sopenharmony_ci#define CFG_DMA_TSTMODE_MASK 0x00000020 46662306a36Sopenharmony_ci#define CFG_DMA_SWAPRB(swap) ((swap)<<4) 46762306a36Sopenharmony_ci#define CFG_DMA_SWAPRB_MASK 0x00000010 46862306a36Sopenharmony_ci#define CFG_DMA_SWAPUV(swap) ((swap)<<3) 46962306a36Sopenharmony_ci#define CFG_DMA_SWAPUV_MASK 0x00000008 47062306a36Sopenharmony_ci#define CFG_DMA_SWAPYU(swap) ((swap)<<2) 47162306a36Sopenharmony_ci#define CFG_DMA_SWAPYU_MASK 0x00000004 47262306a36Sopenharmony_ci#define CFG_DMA_SWAP_MASK 0x0000001C 47362306a36Sopenharmony_ci#define CFG_YUV2RGB_DMA(cvrt) ((cvrt)<<1) 47462306a36Sopenharmony_ci#define CFG_YUV2RGB_DMA_MASK 0x00000002 47562306a36Sopenharmony_ci#define CFG_DMA_ENA(video) (video) 47662306a36Sopenharmony_ci#define CFG_DMA_ENA_MASK 0x00000001 47762306a36Sopenharmony_ci#define dma0_vid_masks (CFG_DMAFORMAT_MASK | CFG_DMA_FTOGGLE_MASK | \ 47862306a36Sopenharmony_ci CFG_DMA_HSMOOTH_MASK | CFG_DMA_TSTMODE_MASK | CFG_DMA_SWAP_MASK | \ 47962306a36Sopenharmony_ci CFG_YUV2RGB_DMA_MASK | CFG_DMA_ENA_MASK) 48062306a36Sopenharmony_ci#define dma_palette(val) ((val ? 1 : 0) << 28) 48162306a36Sopenharmony_ci#define dma_fmt(vid, val) ((val & 0xf) << ((vid) ? 20 : 16)) 48262306a36Sopenharmony_ci#define dma_swaprb(vid, val) ((val ? 1 : 0) << ((vid) ? 4 : 12)) 48362306a36Sopenharmony_ci#define dma_swapuv(vid, val) ((val ? 1 : 0) << ((vid) ? 3 : 11)) 48462306a36Sopenharmony_ci#define dma_swapyuv(vid, val) ((val ? 1 : 0) << ((vid) ? 2 : 10)) 48562306a36Sopenharmony_ci#define dma_csc(vid, val) ((val ? 1 : 0) << ((vid) ? 1 : 9)) 48662306a36Sopenharmony_ci#define dma_hsmooth(vid, val) ((val ? 1 : 0) << ((vid) ? 6 : 14)) 48762306a36Sopenharmony_ci#define dma_mask(vid) (dma_palette(1) | dma_fmt(vid, 0xf) | dma_csc(vid, 1) \ 48862306a36Sopenharmony_ci | dma_swaprb(vid, 1) | dma_swapuv(vid, 1) | dma_swapyuv(vid, 1)) 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci/* DMA Control 1 Register */ 49162306a36Sopenharmony_ci#define LCD_SPU_DMA_CTRL1 0x0194 49262306a36Sopenharmony_ci#define CFG_FRAME_TRIG(trig) ((trig)<<31) 49362306a36Sopenharmony_ci#define CFG_FRAME_TRIG_MASK 0x80000000 49462306a36Sopenharmony_ci#define CFG_VSYNC_TRIG(trig) ((trig)<<28) 49562306a36Sopenharmony_ci#define CFG_VSYNC_TRIG_MASK 0x70000000 49662306a36Sopenharmony_ci#define CFG_VSYNC_INV(inv) ((inv)<<27) 49762306a36Sopenharmony_ci#define CFG_VSYNC_INV_MASK 0x08000000 49862306a36Sopenharmony_ci#define CFG_COLOR_KEY_MODE(cmode) ((cmode)<<24) 49962306a36Sopenharmony_ci#define CFG_COLOR_KEY_MASK 0x07000000 50062306a36Sopenharmony_ci#define CFG_CARRY(carry) ((carry)<<23) 50162306a36Sopenharmony_ci#define CFG_CARRY_MASK 0x00800000 50262306a36Sopenharmony_ci#define CFG_LNBUF_ENA(lnbuf) ((lnbuf)<<22) 50362306a36Sopenharmony_ci#define CFG_LNBUF_ENA_MASK 0x00400000 50462306a36Sopenharmony_ci#define CFG_GATED_ENA(gated) ((gated)<<21) 50562306a36Sopenharmony_ci#define CFG_GATED_ENA_MASK 0x00200000 50662306a36Sopenharmony_ci#define CFG_PWRDN_ENA(power) ((power)<<20) 50762306a36Sopenharmony_ci#define CFG_PWRDN_ENA_MASK 0x00100000 50862306a36Sopenharmony_ci#define CFG_DSCALE(dscale) ((dscale)<<18) 50962306a36Sopenharmony_ci#define CFG_DSCALE_MASK 0x000C0000 51062306a36Sopenharmony_ci#define CFG_ALPHA_MODE(amode) ((amode)<<16) 51162306a36Sopenharmony_ci#define CFG_ALPHA_MODE_MASK 0x00030000 51262306a36Sopenharmony_ci#define CFG_ALPHA(alpha) ((alpha)<<8) 51362306a36Sopenharmony_ci#define CFG_ALPHA_MASK 0x0000FF00 51462306a36Sopenharmony_ci#define CFG_PXLCMD(pxlcmd) (pxlcmd) 51562306a36Sopenharmony_ci#define CFG_PXLCMD_MASK 0x000000FF 51662306a36Sopenharmony_ci 51762306a36Sopenharmony_ci/* SRAM Control Register */ 51862306a36Sopenharmony_ci#define LCD_SPU_SRAM_CTRL 0x0198 51962306a36Sopenharmony_ci#define CFG_SRAM_INIT_WR_RD(mode) ((mode)<<14) 52062306a36Sopenharmony_ci#define CFG_SRAM_INIT_WR_RD_MASK 0x0000C000 52162306a36Sopenharmony_ci#define CFG_SRAM_ADDR_LCDID(id) ((id)<<8) 52262306a36Sopenharmony_ci#define CFG_SRAM_ADDR_LCDID_MASK 0x00000F00 52362306a36Sopenharmony_ci#define CFG_SRAM_ADDR(addr) (addr) 52462306a36Sopenharmony_ci#define CFG_SRAM_ADDR_MASK 0x000000FF 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci/* SRAM Write Data Register */ 52762306a36Sopenharmony_ci#define LCD_SPU_SRAM_WRDAT 0x019C 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci/* SRAM RTC/WTC Control Register */ 53062306a36Sopenharmony_ci#define LCD_SPU_SRAM_PARA0 0x01A0 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci/* SRAM Power Down Control Register */ 53362306a36Sopenharmony_ci#define LCD_SPU_SRAM_PARA1 0x01A4 53462306a36Sopenharmony_ci#define CFG_CSB_256x32(hwc) ((hwc)<<15) /* HWC */ 53562306a36Sopenharmony_ci#define CFG_CSB_256x32_MASK 0x00008000 53662306a36Sopenharmony_ci#define CFG_CSB_256x24(palette) ((palette)<<14) /* Palette */ 53762306a36Sopenharmony_ci#define CFG_CSB_256x24_MASK 0x00004000 53862306a36Sopenharmony_ci#define CFG_CSB_256x8(gamma) ((gamma)<<13) /* Gamma */ 53962306a36Sopenharmony_ci#define CFG_CSB_256x8_MASK 0x00002000 54062306a36Sopenharmony_ci#define CFG_PDWN256x32(pdwn) ((pdwn)<<7) /* HWC */ 54162306a36Sopenharmony_ci#define CFG_PDWN256x32_MASK 0x00000080 54262306a36Sopenharmony_ci#define CFG_PDWN256x24(pdwn) ((pdwn)<<6) /* Palette */ 54362306a36Sopenharmony_ci#define CFG_PDWN256x24_MASK 0x00000040 54462306a36Sopenharmony_ci#define CFG_PDWN256x8(pdwn) ((pdwn)<<5) /* Gamma */ 54562306a36Sopenharmony_ci#define CFG_PDWN256x8_MASK 0x00000020 54662306a36Sopenharmony_ci#define CFG_PDWN32x32(pdwn) ((pdwn)<<3) 54762306a36Sopenharmony_ci#define CFG_PDWN32x32_MASK 0x00000008 54862306a36Sopenharmony_ci#define CFG_PDWN16x66(pdwn) ((pdwn)<<2) 54962306a36Sopenharmony_ci#define CFG_PDWN16x66_MASK 0x00000004 55062306a36Sopenharmony_ci#define CFG_PDWN32x66(pdwn) ((pdwn)<<1) 55162306a36Sopenharmony_ci#define CFG_PDWN32x66_MASK 0x00000002 55262306a36Sopenharmony_ci#define CFG_PDWN64x66(pdwn) (pdwn) 55362306a36Sopenharmony_ci#define CFG_PDWN64x66_MASK 0x00000001 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_ci/* Smart or Dumb Panel Clock Divider */ 55662306a36Sopenharmony_ci#define LCD_CFG_SCLK_DIV 0x01A8 55762306a36Sopenharmony_ci#define SCLK_SRC_SEL(src) ((src)<<31) 55862306a36Sopenharmony_ci#define SCLK_SRC_SEL_MASK 0x80000000 55962306a36Sopenharmony_ci#define SCLK_DISABLE (1<<28) 56062306a36Sopenharmony_ci#define CLK_FRACDIV(frac) ((frac)<<16) 56162306a36Sopenharmony_ci#define CLK_FRACDIV_MASK 0x0FFF0000 56262306a36Sopenharmony_ci#define DSI1_BITCLK_DIV(div) (div<<8) 56362306a36Sopenharmony_ci#define DSI1_BITCLK_DIV_MASK 0x00000F00 56462306a36Sopenharmony_ci#define CLK_INT_DIV(div) (div) 56562306a36Sopenharmony_ci#define CLK_INT_DIV_MASK 0x000000FF 56662306a36Sopenharmony_ci 56762306a36Sopenharmony_ci/* Video Contrast Register */ 56862306a36Sopenharmony_ci#define LCD_SPU_CONTRAST 0x01AC 56962306a36Sopenharmony_ci#define CFG_BRIGHTNESS(bright) ((bright)<<16) 57062306a36Sopenharmony_ci#define CFG_BRIGHTNESS_MASK 0xFFFF0000 57162306a36Sopenharmony_ci#define CFG_CONTRAST(contrast) (contrast) 57262306a36Sopenharmony_ci#define CFG_CONTRAST_MASK 0x0000FFFF 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci/* Video Saturation Register */ 57562306a36Sopenharmony_ci#define LCD_SPU_SATURATION 0x01B0 57662306a36Sopenharmony_ci#define CFG_C_MULTS(mult) ((mult)<<16) 57762306a36Sopenharmony_ci#define CFG_C_MULTS_MASK 0xFFFF0000 57862306a36Sopenharmony_ci#define CFG_SATURATION(sat) (sat) 57962306a36Sopenharmony_ci#define CFG_SATURATION_MASK 0x0000FFFF 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci/* Video Hue Adjust Register */ 58262306a36Sopenharmony_ci#define LCD_SPU_CBSH_HUE 0x01B4 58362306a36Sopenharmony_ci#define CFG_SIN0(sin0) ((sin0)<<16) 58462306a36Sopenharmony_ci#define CFG_SIN0_MASK 0xFFFF0000 58562306a36Sopenharmony_ci#define CFG_COS0(con0) (con0) 58662306a36Sopenharmony_ci#define CFG_COS0_MASK 0x0000FFFF 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci/* Dump LCD Panel Control Register */ 58962306a36Sopenharmony_ci#define LCD_SPU_DUMB_CTRL 0x01B8 59062306a36Sopenharmony_ci#define CFG_DUMBMODE(mode) ((mode)<<28) 59162306a36Sopenharmony_ci#define CFG_DUMBMODE_MASK 0xF0000000 59262306a36Sopenharmony_ci#define CFG_INTFRBSWAP(mode) ((mode)<<24) 59362306a36Sopenharmony_ci#define CFG_INTFRBSWAP_MASK 0x0F000000 59462306a36Sopenharmony_ci#define CFG_LCDGPIO_O(data) ((data)<<20) 59562306a36Sopenharmony_ci#define CFG_LCDGPIO_O_MASK 0x0FF00000 59662306a36Sopenharmony_ci#define CFG_LCDGPIO_ENA(gpio) ((gpio)<<12) 59762306a36Sopenharmony_ci#define CFG_LCDGPIO_ENA_MASK 0x000FF000 59862306a36Sopenharmony_ci#define CFG_BIAS_OUT(bias) ((bias)<<8) 59962306a36Sopenharmony_ci#define CFG_BIAS_OUT_MASK 0x00000100 60062306a36Sopenharmony_ci#define CFG_REVERSE_RGB(RGB) ((RGB)<<7) 60162306a36Sopenharmony_ci#define CFG_REVERSE_RGB_MASK 0x00000080 60262306a36Sopenharmony_ci#define CFG_INV_COMPBLANK(blank) ((blank)<<6) 60362306a36Sopenharmony_ci#define CFG_INV_COMPBLANK_MASK 0x00000040 60462306a36Sopenharmony_ci#define CFG_INV_COMPSYNC(sync) ((sync)<<5) 60562306a36Sopenharmony_ci#define CFG_INV_COMPSYNC_MASK 0x00000020 60662306a36Sopenharmony_ci#define CFG_INV_HENA(hena) ((hena)<<4) 60762306a36Sopenharmony_ci#define CFG_INV_HENA_MASK 0x00000010 60862306a36Sopenharmony_ci#define CFG_INV_VSYNC(vsync) ((vsync)<<3) 60962306a36Sopenharmony_ci#define CFG_INV_VSYNC_MASK 0x00000008 61062306a36Sopenharmony_ci#define CFG_INV_HSYNC(hsync) ((hsync)<<2) 61162306a36Sopenharmony_ci#define CFG_INV_HSYNC_MASK 0x00000004 61262306a36Sopenharmony_ci#define CFG_INV_PCLK(pclk) ((pclk)<<1) 61362306a36Sopenharmony_ci#define CFG_INV_PCLK_MASK 0x00000002 61462306a36Sopenharmony_ci#define CFG_DUMB_ENA(dumb) (dumb) 61562306a36Sopenharmony_ci#define CFG_DUMB_ENA_MASK 0x00000001 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_ci/* LCD I/O Pads Control Register */ 61862306a36Sopenharmony_ci#define SPU_IOPAD_CONTROL 0x01BC 61962306a36Sopenharmony_ci#define CFG_GRA_VM_ENA(vm) ((vm)<<15) 62062306a36Sopenharmony_ci#define CFG_GRA_VM_ENA_MASK 0x00008000 62162306a36Sopenharmony_ci#define CFG_DMA_VM_ENA(vm) ((vm)<<13) 62262306a36Sopenharmony_ci#define CFG_DMA_VM_ENA_MASK 0x00002000 62362306a36Sopenharmony_ci#define CFG_CMD_VM_ENA(vm) ((vm)<<12) 62462306a36Sopenharmony_ci#define CFG_CMD_VM_ENA_MASK 0x00001000 62562306a36Sopenharmony_ci#define CFG_CSC(csc) ((csc)<<8) 62662306a36Sopenharmony_ci#define CFG_CSC_MASK 0x00000300 62762306a36Sopenharmony_ci#define CFG_BOUNDARY(size) ((size)<<5) 62862306a36Sopenharmony_ci#define CFG_BOUNDARY_MASK 0x00000020 62962306a36Sopenharmony_ci#define CFG_BURST(len) ((len)<<4) 63062306a36Sopenharmony_ci#define CFG_BURST_MASK 0x00000010 63162306a36Sopenharmony_ci#define CFG_IOPADMODE(iopad) (iopad) 63262306a36Sopenharmony_ci#define CFG_IOPADMODE_MASK 0x0000000F 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci/* LCD Interrupt Control Register */ 63562306a36Sopenharmony_ci#define SPU_IRQ_ENA 0x01C0 63662306a36Sopenharmony_ci#define DMA_FRAME_IRQ0_ENA(irq) ((irq)<<31) 63762306a36Sopenharmony_ci#define DMA_FRAME_IRQ0_ENA_MASK 0x80000000 63862306a36Sopenharmony_ci#define DMA_FRAME_IRQ1_ENA(irq) ((irq)<<30) 63962306a36Sopenharmony_ci#define DMA_FRAME_IRQ1_ENA_MASK 0x40000000 64062306a36Sopenharmony_ci#define DMA_FF_UNDERFLOW_ENA(ff) ((ff)<<29) 64162306a36Sopenharmony_ci#define DMA_FF_UNDERFLOW_ENA_MASK 0x20000000 64262306a36Sopenharmony_ci#define AXI_BUS_ERROR_IRQ_ENA(irq) ((irq)<<28) 64362306a36Sopenharmony_ci#define AXI_BUS_ERROR_IRQ_ENA_MASK 0x10000000 64462306a36Sopenharmony_ci#define GRA_FRAME_IRQ0_ENA(irq) ((irq)<<27) 64562306a36Sopenharmony_ci#define GRA_FRAME_IRQ0_ENA_MASK 0x08000000 64662306a36Sopenharmony_ci#define GRA_FRAME_IRQ1_ENA(irq) ((irq)<<26) 64762306a36Sopenharmony_ci#define GRA_FRAME_IRQ1_ENA_MASK 0x04000000 64862306a36Sopenharmony_ci#define GRA_FF_UNDERFLOW_ENA(ff) ((ff)<<25) 64962306a36Sopenharmony_ci#define GRA_FF_UNDERFLOW_ENA_MASK 0x02000000 65062306a36Sopenharmony_ci#define VSYNC_IRQ_ENA(vsync_irq) ((vsync_irq)<<23) 65162306a36Sopenharmony_ci#define VSYNC_IRQ_ENA_MASK 0x00800000 65262306a36Sopenharmony_ci#define DUMB_FRAMEDONE_ENA(fdone) ((fdone)<<22) 65362306a36Sopenharmony_ci#define DUMB_FRAMEDONE_ENA_MASK 0x00400000 65462306a36Sopenharmony_ci#define TWC_FRAMEDONE_ENA(fdone) ((fdone)<<21) 65562306a36Sopenharmony_ci#define TWC_FRAMEDONE_ENA_MASK 0x00200000 65662306a36Sopenharmony_ci#define HWC_FRAMEDONE_ENA(fdone) ((fdone)<<20) 65762306a36Sopenharmony_ci#define HWC_FRAMEDONE_ENA_MASK 0x00100000 65862306a36Sopenharmony_ci#define SLV_IRQ_ENA(irq) ((irq)<<19) 65962306a36Sopenharmony_ci#define SLV_IRQ_ENA_MASK 0x00080000 66062306a36Sopenharmony_ci#define SPI_IRQ_ENA(irq) ((irq)<<18) 66162306a36Sopenharmony_ci#define SPI_IRQ_ENA_MASK 0x00040000 66262306a36Sopenharmony_ci#define PWRDN_IRQ_ENA(irq) ((irq)<<17) 66362306a36Sopenharmony_ci#define PWRDN_IRQ_ENA_MASK 0x00020000 66462306a36Sopenharmony_ci#define AXI_LATENCY_TOO_LONG_IRQ_ENA(irq) ((irq)<<16) 66562306a36Sopenharmony_ci#define AXI_LATENCY_TOO_LONG_IRQ_ENA_MASK 0x00010000 66662306a36Sopenharmony_ci#define CLEAN_SPU_IRQ_ISR(irq) (irq) 66762306a36Sopenharmony_ci#define CLEAN_SPU_IRQ_ISR_MASK 0x0000FFFF 66862306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ0_ENA(irq) ((irq)<<15) 66962306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ0_ENA_MASK 0x00008000 67062306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ1_ENA(irq) ((irq)<<14) 67162306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ1_ENA_MASK 0x00004000 67262306a36Sopenharmony_ci#define TV_DMA_FF_UNDERFLOW_ENA(unerrun) ((unerrun)<<13) 67362306a36Sopenharmony_ci#define TV_DMA_FF_UNDERFLOW_ENA_MASK 0x00002000 67462306a36Sopenharmony_ci#define TVSYNC_IRQ_ENA(irq) ((irq)<<12) 67562306a36Sopenharmony_ci#define TVSYNC_IRQ_ENA_MASK 0x00001000 67662306a36Sopenharmony_ci#define TV_FRAME_IRQ0_ENA(irq) ((irq)<<11) 67762306a36Sopenharmony_ci#define TV_FRAME_IRQ0_ENA_MASK 0x00000800 67862306a36Sopenharmony_ci#define TV_FRAME_IRQ1_ENA(irq) ((irq)<<10) 67962306a36Sopenharmony_ci#define TV_FRAME_IRQ1_ENA_MASK 0x00000400 68062306a36Sopenharmony_ci#define TV_GRA_FF_UNDERFLOW_ENA(unerrun) ((unerrun)<<9) 68162306a36Sopenharmony_ci#define TV_GRA_FF_UNDERFLOW_ENA_MASK 0x00000200 68262306a36Sopenharmony_ci#define TV_FRAMEDONE_ENA(irq) ((irq)<<8) 68362306a36Sopenharmony_ci#define TV_FRAMEDONE_ENA_MASK 0x00000100 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci/* FIXME - JUST GUESS */ 68662306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ0_ENA(irq) ((irq)<<7) 68762306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ0_ENA_MASK 0x00000080 68862306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ1_ENA(irq) ((irq)<<6) 68962306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ1_ENA_MASK 0x00000040 69062306a36Sopenharmony_ci#define PN2_DMA_FF_UNDERFLOW_ENA(ff) ((ff)<<5) 69162306a36Sopenharmony_ci#define PN2_DMA_FF_UNDERFLOW_ENA_MASK 0x00000020 69262306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ0_ENA(irq) ((irq)<<3) 69362306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ0_ENA_MASK 0x00000008 69462306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ1_ENA(irq) ((irq)<<2) 69562306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ1_ENA_MASK 0x04000004 69662306a36Sopenharmony_ci#define PN2_GRA_FF_UNDERFLOW_ENA(ff) ((ff)<<1) 69762306a36Sopenharmony_ci#define PN2_GRA_FF_UNDERFLOW_ENA_MASK 0x00000002 69862306a36Sopenharmony_ci#define PN2_VSYNC_IRQ_ENA(irq) ((irq)<<0) 69962306a36Sopenharmony_ci#define PN2_SYNC_IRQ_ENA_MASK 0x00000001 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_ci#define gf0_imask(id) ((id) ? (((id) & 1) ? TV_FRAME_IRQ0_ENA_MASK \ 70262306a36Sopenharmony_ci : PN2_GRA_FRAME_IRQ0_ENA_MASK) : GRA_FRAME_IRQ0_ENA_MASK) 70362306a36Sopenharmony_ci#define gf1_imask(id) ((id) ? (((id) & 1) ? TV_FRAME_IRQ1_ENA_MASK \ 70462306a36Sopenharmony_ci : PN2_GRA_FRAME_IRQ1_ENA_MASK) : GRA_FRAME_IRQ1_ENA_MASK) 70562306a36Sopenharmony_ci#define vsync_imask(id) ((id) ? (((id) & 1) ? TVSYNC_IRQ_ENA_MASK \ 70662306a36Sopenharmony_ci : PN2_SYNC_IRQ_ENA_MASK) : VSYNC_IRQ_ENA_MASK) 70762306a36Sopenharmony_ci#define vsync_imasks (vsync_imask(0) | vsync_imask(1)) 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_ci#define display_done_imask(id) ((id) ? (((id) & 1) ? TV_FRAMEDONE_ENA_MASK\ 71062306a36Sopenharmony_ci : (PN2_DMA_FRAME_IRQ0_ENA_MASK | PN2_DMA_FRAME_IRQ1_ENA_MASK))\ 71162306a36Sopenharmony_ci : DUMB_FRAMEDONE_ENA_MASK) 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_ci#define display_done_imasks (display_done_imask(0) | display_done_imask(1)) 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci#define vf0_imask(id) ((id) ? (((id) & 1) ? TV_DMA_FRAME_IRQ0_ENA_MASK \ 71662306a36Sopenharmony_ci : PN2_DMA_FRAME_IRQ0_ENA_MASK) : DMA_FRAME_IRQ0_ENA_MASK) 71762306a36Sopenharmony_ci#define vf1_imask(id) ((id) ? (((id) & 1) ? TV_DMA_FRAME_IRQ1_ENA_MASK \ 71862306a36Sopenharmony_ci : PN2_DMA_FRAME_IRQ1_ENA_MASK) : DMA_FRAME_IRQ1_ENA_MASK) 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_ci#define gfx_imasks (gf0_imask(0) | gf1_imask(0) | gf0_imask(1) | \ 72162306a36Sopenharmony_ci gf1_imask(1)) 72262306a36Sopenharmony_ci#define vid_imasks (vf0_imask(0) | vf1_imask(0) | vf0_imask(1) | \ 72362306a36Sopenharmony_ci vf1_imask(1)) 72462306a36Sopenharmony_ci#define vid_imask(id) (display_done_imask(id)) 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_ci#define pn1_imasks (gf0_imask(0) | gf1_imask(0) | vsync_imask(0) | \ 72762306a36Sopenharmony_ci display_done_imask(0) | vf0_imask(0) | vf1_imask(0)) 72862306a36Sopenharmony_ci#define tv_imasks (gf0_imask(1) | gf1_imask(1) | vsync_imask(1) | \ 72962306a36Sopenharmony_ci display_done_imask(1) | vf0_imask(1) | vf1_imask(1)) 73062306a36Sopenharmony_ci#define path_imasks(id) ((id) ? (tv_imasks) : (pn1_imasks)) 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ci/* error indications */ 73362306a36Sopenharmony_ci#define vid_udflow_imask(id) ((id) ? (((id) & 1) ? \ 73462306a36Sopenharmony_ci (TV_DMA_FF_UNDERFLOW_ENA_MASK) : (PN2_DMA_FF_UNDERFLOW_ENA_MASK)) : \ 73562306a36Sopenharmony_ci (DMA_FF_UNDERFLOW_ENA_MASK)) 73662306a36Sopenharmony_ci#define gfx_udflow_imask(id) ((id) ? (((id) & 1) ? \ 73762306a36Sopenharmony_ci (TV_GRA_FF_UNDERFLOW_ENA_MASK) : (PN2_GRA_FF_UNDERFLOW_ENA_MASK)) : \ 73862306a36Sopenharmony_ci (GRA_FF_UNDERFLOW_ENA_MASK)) 73962306a36Sopenharmony_ci 74062306a36Sopenharmony_ci#define err_imask(id) (vid_udflow_imask(id) | gfx_udflow_imask(id) | \ 74162306a36Sopenharmony_ci AXI_BUS_ERROR_IRQ_ENA_MASK | AXI_LATENCY_TOO_LONG_IRQ_ENA_MASK) 74262306a36Sopenharmony_ci#define err_imasks (err_imask(0) | err_imask(1) | err_imask(2)) 74362306a36Sopenharmony_ci/* LCD Interrupt Status Register */ 74462306a36Sopenharmony_ci#define SPU_IRQ_ISR 0x01C4 74562306a36Sopenharmony_ci#define DMA_FRAME_IRQ0(irq) ((irq)<<31) 74662306a36Sopenharmony_ci#define DMA_FRAME_IRQ0_MASK 0x80000000 74762306a36Sopenharmony_ci#define DMA_FRAME_IRQ1(irq) ((irq)<<30) 74862306a36Sopenharmony_ci#define DMA_FRAME_IRQ1_MASK 0x40000000 74962306a36Sopenharmony_ci#define DMA_FF_UNDERFLOW(ff) ((ff)<<29) 75062306a36Sopenharmony_ci#define DMA_FF_UNDERFLOW_MASK 0x20000000 75162306a36Sopenharmony_ci#define AXI_BUS_ERROR_IRQ(irq) ((irq)<<28) 75262306a36Sopenharmony_ci#define AXI_BUS_ERROR_IRQ_MASK 0x10000000 75362306a36Sopenharmony_ci#define GRA_FRAME_IRQ0(irq) ((irq)<<27) 75462306a36Sopenharmony_ci#define GRA_FRAME_IRQ0_MASK 0x08000000 75562306a36Sopenharmony_ci#define GRA_FRAME_IRQ1(irq) ((irq)<<26) 75662306a36Sopenharmony_ci#define GRA_FRAME_IRQ1_MASK 0x04000000 75762306a36Sopenharmony_ci#define GRA_FF_UNDERFLOW(ff) ((ff)<<25) 75862306a36Sopenharmony_ci#define GRA_FF_UNDERFLOW_MASK 0x02000000 75962306a36Sopenharmony_ci#define VSYNC_IRQ(vsync_irq) ((vsync_irq)<<23) 76062306a36Sopenharmony_ci#define VSYNC_IRQ_MASK 0x00800000 76162306a36Sopenharmony_ci#define DUMB_FRAMEDONE(fdone) ((fdone)<<22) 76262306a36Sopenharmony_ci#define DUMB_FRAMEDONE_MASK 0x00400000 76362306a36Sopenharmony_ci#define TWC_FRAMEDONE(fdone) ((fdone)<<21) 76462306a36Sopenharmony_ci#define TWC_FRAMEDONE_MASK 0x00200000 76562306a36Sopenharmony_ci#define HWC_FRAMEDONE(fdone) ((fdone)<<20) 76662306a36Sopenharmony_ci#define HWC_FRAMEDONE_MASK 0x00100000 76762306a36Sopenharmony_ci#define SLV_IRQ(irq) ((irq)<<19) 76862306a36Sopenharmony_ci#define SLV_IRQ_MASK 0x00080000 76962306a36Sopenharmony_ci#define SPI_IRQ(irq) ((irq)<<18) 77062306a36Sopenharmony_ci#define SPI_IRQ_MASK 0x00040000 77162306a36Sopenharmony_ci#define PWRDN_IRQ(irq) ((irq)<<17) 77262306a36Sopenharmony_ci#define PWRDN_IRQ_MASK 0x00020000 77362306a36Sopenharmony_ci#define AXI_LATENCY_TOO_LONGR_IRQ(irq) ((irq)<<16) 77462306a36Sopenharmony_ci#define AXI_LATENCY_TOO_LONGR_IRQ_MASK 0x00010000 77562306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ0(irq) ((irq)<<15) 77662306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ0_MASK 0x00008000 77762306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ1(irq) ((irq)<<14) 77862306a36Sopenharmony_ci#define TV_DMA_FRAME_IRQ1_MASK 0x00004000 77962306a36Sopenharmony_ci#define TV_DMA_FF_UNDERFLOW(unerrun) ((unerrun)<<13) 78062306a36Sopenharmony_ci#define TV_DMA_FF_UNDERFLOW_MASK 0x00002000 78162306a36Sopenharmony_ci#define TVSYNC_IRQ(irq) ((irq)<<12) 78262306a36Sopenharmony_ci#define TVSYNC_IRQ_MASK 0x00001000 78362306a36Sopenharmony_ci#define TV_FRAME_IRQ0(irq) ((irq)<<11) 78462306a36Sopenharmony_ci#define TV_FRAME_IRQ0_MASK 0x00000800 78562306a36Sopenharmony_ci#define TV_FRAME_IRQ1(irq) ((irq)<<10) 78662306a36Sopenharmony_ci#define TV_FRAME_IRQ1_MASK 0x00000400 78762306a36Sopenharmony_ci#define TV_GRA_FF_UNDERFLOW(unerrun) ((unerrun)<<9) 78862306a36Sopenharmony_ci#define TV_GRA_FF_UNDERFLOW_MASK 0x00000200 78962306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ0(irq) ((irq)<<7) 79062306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ0_MASK 0x00000080 79162306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ1(irq) ((irq)<<6) 79262306a36Sopenharmony_ci#define PN2_DMA_FRAME_IRQ1_MASK 0x00000040 79362306a36Sopenharmony_ci#define PN2_DMA_FF_UNDERFLOW(ff) ((ff)<<5) 79462306a36Sopenharmony_ci#define PN2_DMA_FF_UNDERFLOW_MASK 0x00000020 79562306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ0(irq) ((irq)<<3) 79662306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ0_MASK 0x00000008 79762306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ1(irq) ((irq)<<2) 79862306a36Sopenharmony_ci#define PN2_GRA_FRAME_IRQ1_MASK 0x04000004 79962306a36Sopenharmony_ci#define PN2_GRA_FF_UNDERFLOW(ff) ((ff)<<1) 80062306a36Sopenharmony_ci#define PN2_GRA_FF_UNDERFLOW_MASK 0x00000002 80162306a36Sopenharmony_ci#define PN2_VSYNC_IRQ(irq) ((irq)<<0) 80262306a36Sopenharmony_ci#define PN2_SYNC_IRQ_MASK 0x00000001 80362306a36Sopenharmony_ci 80462306a36Sopenharmony_ci/* LCD FIFO Depth register */ 80562306a36Sopenharmony_ci#define LCD_FIFO_DEPTH 0x01c8 80662306a36Sopenharmony_ci#define VIDEO_FIFO(fi) ((fi) << 0) 80762306a36Sopenharmony_ci#define VIDEO_FIFO_MASK 0x00000003 80862306a36Sopenharmony_ci#define GRAPHIC_FIFO(fi) ((fi) << 2) 80962306a36Sopenharmony_ci#define GRAPHIC_FIFO_MASK 0x0000000c 81062306a36Sopenharmony_ci 81162306a36Sopenharmony_ci/* read-only */ 81262306a36Sopenharmony_ci#define DMA_FRAME_IRQ0_LEVEL_MASK 0x00008000 81362306a36Sopenharmony_ci#define DMA_FRAME_IRQ1_LEVEL_MASK 0x00004000 81462306a36Sopenharmony_ci#define DMA_FRAME_CNT_ISR_MASK 0x00003000 81562306a36Sopenharmony_ci#define GRA_FRAME_IRQ0_LEVEL_MASK 0x00000800 81662306a36Sopenharmony_ci#define GRA_FRAME_IRQ1_LEVEL_MASK 0x00000400 81762306a36Sopenharmony_ci#define GRA_FRAME_CNT_ISR_MASK 0x00000300 81862306a36Sopenharmony_ci#define VSYNC_IRQ_LEVEL_MASK 0x00000080 81962306a36Sopenharmony_ci#define DUMB_FRAMEDONE_LEVEL_MASK 0x00000040 82062306a36Sopenharmony_ci#define TWC_FRAMEDONE_LEVEL_MASK 0x00000020 82162306a36Sopenharmony_ci#define HWC_FRAMEDONE_LEVEL_MASK 0x00000010 82262306a36Sopenharmony_ci#define SLV_FF_EMPTY_MASK 0x00000008 82362306a36Sopenharmony_ci#define DMA_FF_ALLEMPTY_MASK 0x00000004 82462306a36Sopenharmony_ci#define GRA_FF_ALLEMPTY_MASK 0x00000002 82562306a36Sopenharmony_ci#define PWRDN_IRQ_LEVEL_MASK 0x00000001 82662306a36Sopenharmony_ci 82762306a36Sopenharmony_ci/* 32 bit LCD Interrupt Reset Status*/ 82862306a36Sopenharmony_ci#define SPU_IRQ_RSR (0x01C8) 82962306a36Sopenharmony_ci/* 32 bit Panel Path Graphic Partial Display Horizontal Control Register*/ 83062306a36Sopenharmony_ci#define LCD_GRA_CUTHPXL (0x01CC) 83162306a36Sopenharmony_ci/* 32 bit Panel Path Graphic Partial Display Vertical Control Register*/ 83262306a36Sopenharmony_ci#define LCD_GRA_CUTVLN (0x01D0) 83362306a36Sopenharmony_ci/* 32 bit TV Path Graphic Partial Display Horizontal Control Register*/ 83462306a36Sopenharmony_ci#define LCD_TVG_CUTHPXL (0x01D4) 83562306a36Sopenharmony_ci/* 32 bit TV Path Graphic Partial Display Vertical Control Register*/ 83662306a36Sopenharmony_ci#define LCD_TVG_CUTVLN (0x01D8) 83762306a36Sopenharmony_ci/* 32 bit LCD Global Control Register*/ 83862306a36Sopenharmony_ci#define LCD_TOP_CTRL (0x01DC) 83962306a36Sopenharmony_ci/* 32 bit LCD SQU Line Buffer Control Register 1*/ 84062306a36Sopenharmony_ci#define LCD_SQULN1_CTRL (0x01E0) 84162306a36Sopenharmony_ci/* 32 bit LCD SQU Line Buffer Control Register 2*/ 84262306a36Sopenharmony_ci#define LCD_SQULN2_CTRL (0x01E4) 84362306a36Sopenharmony_ci#define squln_ctrl(id) ((id) ? (((id) & 1) ? LCD_SQULN2_CTRL : \ 84462306a36Sopenharmony_ci LCD_PN2_SQULN1_CTRL) : LCD_SQULN1_CTRL) 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci/* 32 bit LCD Mixed Overlay Control Register */ 84762306a36Sopenharmony_ci#define LCD_AFA_ALL2ONE (0x01E8) 84862306a36Sopenharmony_ci 84962306a36Sopenharmony_ci#define LCD_PN2_SCLK_DIV (0x01EC) 85062306a36Sopenharmony_ci#define LCD_PN2_TCLK_DIV (0x01F0) 85162306a36Sopenharmony_ci#define LCD_LVDS_SCLK_DIV_WR (0x01F4) 85262306a36Sopenharmony_ci#define LCD_LVDS_SCLK_DIV_RD (0x01FC) 85362306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_Y0 (0x0200) 85462306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_U0 (0x0204) 85562306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_V0 (0x0208) 85662306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_C0 (0x020C) 85762306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_Y1 (0x0210) 85862306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_U1 (0x0214) 85962306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_V1 (0x0218) 86062306a36Sopenharmony_ci#define PN2_LCD_DMA_START_ADDR_C1 (0x021C) 86162306a36Sopenharmony_ci#define PN2_LCD_DMA_PITCH_YC (0x0220) 86262306a36Sopenharmony_ci#define PN2_LCD_DMA_PITCH_UV (0x0224) 86362306a36Sopenharmony_ci#define PN2_LCD_DMA_OVSA_HPXL_VLN (0x0228) 86462306a36Sopenharmony_ci#define PN2_LCD_DMA_HPXL_VLN (0x022C) 86562306a36Sopenharmony_ci#define PN2_LCD_DMAZM_HPXL_VLN (0x0230) 86662306a36Sopenharmony_ci#define PN2_LCD_GRA_START_ADDR0 (0x0234) 86762306a36Sopenharmony_ci#define PN2_LCD_GRA_START_ADDR1 (0x0238) 86862306a36Sopenharmony_ci#define PN2_LCD_GRA_PITCH (0x023C) 86962306a36Sopenharmony_ci#define PN2_LCD_GRA_OVSA_HPXL_VLN (0x0240) 87062306a36Sopenharmony_ci#define PN2_LCD_GRA_HPXL_VLN (0x0244) 87162306a36Sopenharmony_ci#define PN2_LCD_GRAZM_HPXL_VLN (0x0248) 87262306a36Sopenharmony_ci#define PN2_LCD_HWC_OVSA_HPXL_VLN (0x024C) 87362306a36Sopenharmony_ci#define PN2_LCD_HWC_HPXL_VLN (0x0250) 87462306a36Sopenharmony_ci#define LCD_PN2_V_H_TOTAL (0x0254) 87562306a36Sopenharmony_ci#define LCD_PN2_V_H_ACTIVE (0x0258) 87662306a36Sopenharmony_ci#define LCD_PN2_H_PORCH (0x025C) 87762306a36Sopenharmony_ci#define LCD_PN2_V_PORCH (0x0260) 87862306a36Sopenharmony_ci#define LCD_PN2_BLANKCOLOR (0x0264) 87962306a36Sopenharmony_ci#define LCD_PN2_ALPHA_COLOR1 (0x0268) 88062306a36Sopenharmony_ci#define LCD_PN2_ALPHA_COLOR2 (0x026C) 88162306a36Sopenharmony_ci#define LCD_PN2_COLORKEY_Y (0x0270) 88262306a36Sopenharmony_ci#define LCD_PN2_COLORKEY_U (0x0274) 88362306a36Sopenharmony_ci#define LCD_PN2_COLORKEY_V (0x0278) 88462306a36Sopenharmony_ci#define LCD_PN2_SEPXLCNT (0x027C) 88562306a36Sopenharmony_ci#define LCD_TV_V_H_TOTAL_FLD (0x0280) 88662306a36Sopenharmony_ci#define LCD_TV_V_PORCH_FLD (0x0284) 88762306a36Sopenharmony_ci#define LCD_TV_SEPXLCNT_FLD (0x0288) 88862306a36Sopenharmony_ci 88962306a36Sopenharmony_ci#define LCD_2ND_ALPHA (0x0294) 89062306a36Sopenharmony_ci#define LCD_PN2_CONTRAST (0x0298) 89162306a36Sopenharmony_ci#define LCD_PN2_SATURATION (0x029c) 89262306a36Sopenharmony_ci#define LCD_PN2_CBSH_HUE (0x02a0) 89362306a36Sopenharmony_ci#define LCD_TIMING_EXT (0x02C0) 89462306a36Sopenharmony_ci#define LCD_PN2_LAYER_ALPHA_SEL1 (0x02c4) 89562306a36Sopenharmony_ci#define LCD_PN2_CTRL0 (0x02C8) 89662306a36Sopenharmony_ci#define TV_LAYER_ALPHA_SEL1 (0x02cc) 89762306a36Sopenharmony_ci#define LCD_SMPN2_CTRL (0x02D0) 89862306a36Sopenharmony_ci#define LCD_IO_OVERL_MAP_CTRL (0x02D4) 89962306a36Sopenharmony_ci#define LCD_DUMB2_CTRL (0x02d8) 90062306a36Sopenharmony_ci#define LCD_PN2_CTRL1 (0x02DC) 90162306a36Sopenharmony_ci#define PN2_IOPAD_CONTROL (0x02E0) 90262306a36Sopenharmony_ci#define LCD_PN2_SQULN1_CTRL (0x02E4) 90362306a36Sopenharmony_ci#define PN2_LCD_GRA_CUTHPXL (0x02e8) 90462306a36Sopenharmony_ci#define PN2_LCD_GRA_CUTVLN (0x02ec) 90562306a36Sopenharmony_ci#define LCD_PN2_SQULN2_CTRL (0x02F0) 90662306a36Sopenharmony_ci#define ALL_LAYER_ALPHA_SEL (0x02F4) 90762306a36Sopenharmony_ci 90862306a36Sopenharmony_ci#define TIMING_MASTER_CONTROL (0x02F8) 90962306a36Sopenharmony_ci#define MASTER_ENH(id) (1 << (id)) 91062306a36Sopenharmony_ci#define MASTER_ENV(id) (1 << ((id) + 4)) 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci#define DSI_START_SEL_SHIFT(id) (((id) << 1) + 8) 91362306a36Sopenharmony_ci#define timing_master_config(path, dsi_id, lcd_id) \ 91462306a36Sopenharmony_ci (MASTER_ENH(path) | MASTER_ENV(path) | \ 91562306a36Sopenharmony_ci (((lcd_id) + ((dsi_id) << 1)) << DSI_START_SEL_SHIFT(path))) 91662306a36Sopenharmony_ci 91762306a36Sopenharmony_ci#define LCD_2ND_BLD_CTL (0x02Fc) 91862306a36Sopenharmony_ci#define LVDS_SRC_MASK (3 << 30) 91962306a36Sopenharmony_ci#define LVDS_SRC_SHIFT (30) 92062306a36Sopenharmony_ci#define LVDS_FMT_MASK (1 << 28) 92162306a36Sopenharmony_ci#define LVDS_FMT_SHIFT (28) 92262306a36Sopenharmony_ci 92362306a36Sopenharmony_ci#define CLK_SCLK (1 << 0) 92462306a36Sopenharmony_ci#define CLK_LVDS_RD (1 << 1) 92562306a36Sopenharmony_ci#define CLK_LVDS_WR (1 << 2) 92662306a36Sopenharmony_ci 92762306a36Sopenharmony_ci#define gra_partdisp_ctrl_hor(id) ((id) ? (((id) & 1) ? \ 92862306a36Sopenharmony_ci LCD_TVG_CUTHPXL : PN2_LCD_GRA_CUTHPXL) : LCD_GRA_CUTHPXL) 92962306a36Sopenharmony_ci#define gra_partdisp_ctrl_ver(id) ((id) ? (((id) & 1) ? \ 93062306a36Sopenharmony_ci LCD_TVG_CUTVLN : PN2_LCD_GRA_CUTVLN) : LCD_GRA_CUTVLN) 93162306a36Sopenharmony_ci 93262306a36Sopenharmony_ci/* 93362306a36Sopenharmony_ci * defined for Configure Dumb Mode 93462306a36Sopenharmony_ci * defined for Configure Dumb Mode 93562306a36Sopenharmony_ci * DUMB LCD Panel bit[31:28] 93662306a36Sopenharmony_ci */ 93762306a36Sopenharmony_ci#define DUMB16_RGB565_0 0x0 93862306a36Sopenharmony_ci#define DUMB16_RGB565_1 0x1 93962306a36Sopenharmony_ci#define DUMB18_RGB666_0 0x2 94062306a36Sopenharmony_ci#define DUMB18_RGB666_1 0x3 94162306a36Sopenharmony_ci#define DUMB12_RGB444_0 0x4 94262306a36Sopenharmony_ci#define DUMB12_RGB444_1 0x5 94362306a36Sopenharmony_ci#define DUMB24_RGB888_0 0x6 94462306a36Sopenharmony_ci#define DUMB_BLANK 0x7 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci/* 94762306a36Sopenharmony_ci * defined for Configure I/O Pin Allocation Mode 94862306a36Sopenharmony_ci * LCD LCD I/O Pads control register bit[3:0] 94962306a36Sopenharmony_ci */ 95062306a36Sopenharmony_ci#define IOPAD_DUMB24 0x0 95162306a36Sopenharmony_ci#define IOPAD_DUMB18SPI 0x1 95262306a36Sopenharmony_ci#define IOPAD_DUMB18GPIO 0x2 95362306a36Sopenharmony_ci#define IOPAD_DUMB16SPI 0x3 95462306a36Sopenharmony_ci#define IOPAD_DUMB16GPIO 0x4 95562306a36Sopenharmony_ci#define IOPAD_DUMB12 0x5 95662306a36Sopenharmony_ci#define IOPAD_SMART18SPI 0x6 95762306a36Sopenharmony_ci#define IOPAD_SMART16SPI 0x7 95862306a36Sopenharmony_ci#define IOPAD_SMART8BOTH 0x8 95962306a36Sopenharmony_ci#define IOPAD_DUMB18_SMART8 0x9 96062306a36Sopenharmony_ci#define IOPAD_DUMB16_SMART8SPI 0xa 96162306a36Sopenharmony_ci#define IOPAD_DUMB16_SMART8GPIO 0xb 96262306a36Sopenharmony_ci#define IOPAD_DUMB16_DUMB16 0xc 96362306a36Sopenharmony_ci#define IOPAD_SMART8_SMART8 0xc 96462306a36Sopenharmony_ci 96562306a36Sopenharmony_ci/* 96662306a36Sopenharmony_ci *defined for indicating boundary and cycle burst length 96762306a36Sopenharmony_ci */ 96862306a36Sopenharmony_ci#define CFG_BOUNDARY_1KB (1<<5) 96962306a36Sopenharmony_ci#define CFG_BOUNDARY_4KB (0<<5) 97062306a36Sopenharmony_ci#define CFG_CYC_BURST_LEN16 (1<<4) 97162306a36Sopenharmony_ci#define CFG_CYC_BURST_LEN8 (0<<4) 97262306a36Sopenharmony_ci 97362306a36Sopenharmony_ci/* SRAM ID */ 97462306a36Sopenharmony_ci#define SRAMID_GAMMA_YR 0x0 97562306a36Sopenharmony_ci#define SRAMID_GAMMA_UG 0x1 97662306a36Sopenharmony_ci#define SRAMID_GAMMA_VB 0x2 97762306a36Sopenharmony_ci#define SRAMID_PALATTE 0x3 97862306a36Sopenharmony_ci#define SRAMID_HWC 0xf 97962306a36Sopenharmony_ci 98062306a36Sopenharmony_ci/* SRAM INIT Read/Write */ 98162306a36Sopenharmony_ci#define SRAMID_INIT_READ 0x0 98262306a36Sopenharmony_ci#define SRAMID_INIT_WRITE 0x2 98362306a36Sopenharmony_ci#define SRAMID_INIT_DEFAULT 0x3 98462306a36Sopenharmony_ci 98562306a36Sopenharmony_ci/* 98662306a36Sopenharmony_ci * defined VSYNC selection mode for DMA control 1 register 98762306a36Sopenharmony_ci * DMA1 bit[30:28] 98862306a36Sopenharmony_ci */ 98962306a36Sopenharmony_ci#define VMODE_SMPN 0x0 99062306a36Sopenharmony_ci#define VMODE_SMPNIRQ 0x1 99162306a36Sopenharmony_ci#define VMODE_DUMB 0x2 99262306a36Sopenharmony_ci#define VMODE_IPE 0x3 99362306a36Sopenharmony_ci#define VMODE_IRE 0x4 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_ci/* 99662306a36Sopenharmony_ci * defined Configure Alpha and Alpha mode for DMA control 1 register 99762306a36Sopenharmony_ci * DMA1 bit[15:08](alpha) / bit[17:16](alpha mode) 99862306a36Sopenharmony_ci */ 99962306a36Sopenharmony_ci/* ALPHA mode */ 100062306a36Sopenharmony_ci#define MODE_ALPHA_DMA 0x0 100162306a36Sopenharmony_ci#define MODE_ALPHA_GRA 0x1 100262306a36Sopenharmony_ci#define MODE_ALPHA_CFG 0x2 100362306a36Sopenharmony_ci 100462306a36Sopenharmony_ci/* alpha value */ 100562306a36Sopenharmony_ci#define ALPHA_NOGRAPHIC 0xFF /* all video, no graphic */ 100662306a36Sopenharmony_ci#define ALPHA_NOVIDEO 0x00 /* all graphic, no video */ 100762306a36Sopenharmony_ci#define ALPHA_GRAPHNVIDEO 0x0F /* Selects graphic & video */ 100862306a36Sopenharmony_ci 100962306a36Sopenharmony_ci/* 101062306a36Sopenharmony_ci * defined Pixel Command for DMA control 1 register 101162306a36Sopenharmony_ci * DMA1 bit[07:00] 101262306a36Sopenharmony_ci */ 101362306a36Sopenharmony_ci#define PIXEL_CMD 0x81 101462306a36Sopenharmony_ci 101562306a36Sopenharmony_ci/* DSI */ 101662306a36Sopenharmony_ci/* DSI1 - 4 Lane Controller base */ 101762306a36Sopenharmony_ci#define DSI1_REGS_PHYSICAL_BASE 0xD420B800 101862306a36Sopenharmony_ci/* DSI2 - 3 Lane Controller base */ 101962306a36Sopenharmony_ci#define DSI2_REGS_PHYSICAL_BASE 0xD420BA00 102062306a36Sopenharmony_ci 102162306a36Sopenharmony_ci/* DSI Controller Registers */ 102262306a36Sopenharmony_cistruct dsi_lcd_regs { 102362306a36Sopenharmony_ci#define DSI_LCD1_CTRL_0 0x100 /* DSI Active Panel 1 Control register 0 */ 102462306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1 0x104 /* DSI Active Panel 1 Control register 1 */ 102562306a36Sopenharmony_ci u32 ctrl0; 102662306a36Sopenharmony_ci u32 ctrl1; 102762306a36Sopenharmony_ci u32 reserved1[2]; 102862306a36Sopenharmony_ci 102962306a36Sopenharmony_ci#define DSI_LCD1_TIMING_0 0x110 /* Timing register 0 */ 103062306a36Sopenharmony_ci#define DSI_LCD1_TIMING_1 0x114 /* Timing register 1 */ 103162306a36Sopenharmony_ci#define DSI_LCD1_TIMING_2 0x118 /* Timing register 2 */ 103262306a36Sopenharmony_ci#define DSI_LCD1_TIMING_3 0x11C /* Timing register 3 */ 103362306a36Sopenharmony_ci#define DSI_LCD1_WC_0 0x120 /* Word Count register 0 */ 103462306a36Sopenharmony_ci#define DSI_LCD1_WC_1 0x124 /* Word Count register 1 */ 103562306a36Sopenharmony_ci#define DSI_LCD1_WC_2 0x128 /* Word Count register 2 */ 103662306a36Sopenharmony_ci u32 timing0; 103762306a36Sopenharmony_ci u32 timing1; 103862306a36Sopenharmony_ci u32 timing2; 103962306a36Sopenharmony_ci u32 timing3; 104062306a36Sopenharmony_ci u32 wc0; 104162306a36Sopenharmony_ci u32 wc1; 104262306a36Sopenharmony_ci u32 wc2; 104362306a36Sopenharmony_ci u32 reserved2[1]; 104462306a36Sopenharmony_ci u32 slot_cnt0; 104562306a36Sopenharmony_ci u32 slot_cnt1; 104662306a36Sopenharmony_ci u32 reserved3[2]; 104762306a36Sopenharmony_ci u32 status_0; 104862306a36Sopenharmony_ci u32 status_1; 104962306a36Sopenharmony_ci u32 status_2; 105062306a36Sopenharmony_ci u32 status_3; 105162306a36Sopenharmony_ci u32 status_4; 105262306a36Sopenharmony_ci}; 105362306a36Sopenharmony_ci 105462306a36Sopenharmony_cistruct dsi_regs { 105562306a36Sopenharmony_ci#define DSI_CTRL_0 0x000 /* DSI control register 0 */ 105662306a36Sopenharmony_ci#define DSI_CTRL_1 0x004 /* DSI control register 1 */ 105762306a36Sopenharmony_ci u32 ctrl0; 105862306a36Sopenharmony_ci u32 ctrl1; 105962306a36Sopenharmony_ci u32 reserved1[2]; 106062306a36Sopenharmony_ci u32 irq_status; 106162306a36Sopenharmony_ci u32 irq_mask; 106262306a36Sopenharmony_ci u32 reserved2[2]; 106362306a36Sopenharmony_ci 106462306a36Sopenharmony_ci#define DSI_CPU_CMD_0 0x020 /* DSI CPU packet command register 0 */ 106562306a36Sopenharmony_ci#define DSI_CPU_CMD_1 0x024 /* DSU CPU Packet Command Register 1 */ 106662306a36Sopenharmony_ci#define DSI_CPU_CMD_3 0x02C /* DSU CPU Packet Command Register 3 */ 106762306a36Sopenharmony_ci#define DSI_CPU_WDAT_0 0x030 /* DSI CUP */ 106862306a36Sopenharmony_ci u32 cmd0; 106962306a36Sopenharmony_ci u32 cmd1; 107062306a36Sopenharmony_ci u32 cmd2; 107162306a36Sopenharmony_ci u32 cmd3; 107262306a36Sopenharmony_ci u32 dat0; 107362306a36Sopenharmony_ci u32 status0; 107462306a36Sopenharmony_ci u32 status1; 107562306a36Sopenharmony_ci u32 status2; 107662306a36Sopenharmony_ci u32 status3; 107762306a36Sopenharmony_ci u32 status4; 107862306a36Sopenharmony_ci u32 reserved3[2]; 107962306a36Sopenharmony_ci 108062306a36Sopenharmony_ci u32 smt_cmd; 108162306a36Sopenharmony_ci u32 smt_ctrl0; 108262306a36Sopenharmony_ci u32 smt_ctrl1; 108362306a36Sopenharmony_ci u32 reserved4[1]; 108462306a36Sopenharmony_ci 108562306a36Sopenharmony_ci u32 rx0_status; 108662306a36Sopenharmony_ci 108762306a36Sopenharmony_ci/* Rx Packet Header - data from slave device */ 108862306a36Sopenharmony_ci#define DSI_RX_PKT_HDR_0 0x064 108962306a36Sopenharmony_ci u32 rx0_header; 109062306a36Sopenharmony_ci u32 rx1_status; 109162306a36Sopenharmony_ci u32 rx1_header; 109262306a36Sopenharmony_ci u32 rx_ctrl; 109362306a36Sopenharmony_ci u32 rx_ctrl1; 109462306a36Sopenharmony_ci u32 rx2_status; 109562306a36Sopenharmony_ci u32 rx2_header; 109662306a36Sopenharmony_ci u32 reserved5[1]; 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci u32 phy_ctrl1; 109962306a36Sopenharmony_ci#define DSI_PHY_CTRL_2 0x088 /* DSI DPHI Control Register 2 */ 110062306a36Sopenharmony_ci#define DSI_PHY_CTRL_3 0x08C /* DPHY Control Register 3 */ 110162306a36Sopenharmony_ci u32 phy_ctrl2; 110262306a36Sopenharmony_ci u32 phy_ctrl3; 110362306a36Sopenharmony_ci u32 phy_status0; 110462306a36Sopenharmony_ci u32 phy_status1; 110562306a36Sopenharmony_ci u32 reserved6[5]; 110662306a36Sopenharmony_ci u32 phy_status2; 110762306a36Sopenharmony_ci 110862306a36Sopenharmony_ci#define DSI_PHY_RCOMP_0 0x0B0 /* DPHY Rcomp Control Register */ 110962306a36Sopenharmony_ci u32 phy_rcomp0; 111062306a36Sopenharmony_ci u32 reserved7[3]; 111162306a36Sopenharmony_ci#define DSI_PHY_TIME_0 0x0C0 /* DPHY Timing Control Register 0 */ 111262306a36Sopenharmony_ci#define DSI_PHY_TIME_1 0x0C4 /* DPHY Timing Control Register 1 */ 111362306a36Sopenharmony_ci#define DSI_PHY_TIME_2 0x0C8 /* DPHY Timing Control Register 2 */ 111462306a36Sopenharmony_ci#define DSI_PHY_TIME_3 0x0CC /* DPHY Timing Control Register 3 */ 111562306a36Sopenharmony_ci#define DSI_PHY_TIME_4 0x0D0 /* DPHY Timing Control Register 4 */ 111662306a36Sopenharmony_ci#define DSI_PHY_TIME_5 0x0D4 /* DPHY Timing Control Register 5 */ 111762306a36Sopenharmony_ci u32 phy_timing0; 111862306a36Sopenharmony_ci u32 phy_timing1; 111962306a36Sopenharmony_ci u32 phy_timing2; 112062306a36Sopenharmony_ci u32 phy_timing3; 112162306a36Sopenharmony_ci u32 phy_code_0; 112262306a36Sopenharmony_ci u32 phy_code_1; 112362306a36Sopenharmony_ci u32 reserved8[2]; 112462306a36Sopenharmony_ci u32 mem_ctrl; 112562306a36Sopenharmony_ci u32 tx_timer; 112662306a36Sopenharmony_ci u32 rx_timer; 112762306a36Sopenharmony_ci u32 turn_timer; 112862306a36Sopenharmony_ci u32 reserved9[4]; 112962306a36Sopenharmony_ci 113062306a36Sopenharmony_ci#define DSI_LCD1_CTRL_0 0x100 /* DSI Active Panel 1 Control register 0 */ 113162306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1 0x104 /* DSI Active Panel 1 Control register 1 */ 113262306a36Sopenharmony_ci#define DSI_LCD1_TIMING_0 0x110 /* Timing register 0 */ 113362306a36Sopenharmony_ci#define DSI_LCD1_TIMING_1 0x114 /* Timing register 1 */ 113462306a36Sopenharmony_ci#define DSI_LCD1_TIMING_2 0x118 /* Timing register 2 */ 113562306a36Sopenharmony_ci#define DSI_LCD1_TIMING_3 0x11C /* Timing register 3 */ 113662306a36Sopenharmony_ci#define DSI_LCD1_WC_0 0x120 /* Word Count register 0 */ 113762306a36Sopenharmony_ci#define DSI_LCD1_WC_1 0x124 /* Word Count register 1 */ 113862306a36Sopenharmony_ci#define DSI_LCD1_WC_2 0x128 /* Word Count register 2 */ 113962306a36Sopenharmony_ci struct dsi_lcd_regs lcd1; 114062306a36Sopenharmony_ci u32 reserved10[11]; 114162306a36Sopenharmony_ci struct dsi_lcd_regs lcd2; 114262306a36Sopenharmony_ci}; 114362306a36Sopenharmony_ci 114462306a36Sopenharmony_ci#define DSI_LCD2_CTRL_0 0x180 /* DSI Active Panel 2 Control register 0 */ 114562306a36Sopenharmony_ci#define DSI_LCD2_CTRL_1 0x184 /* DSI Active Panel 2 Control register 1 */ 114662306a36Sopenharmony_ci#define DSI_LCD2_TIMING_0 0x190 /* Timing register 0 */ 114762306a36Sopenharmony_ci#define DSI_LCD2_TIMING_1 0x194 /* Timing register 1 */ 114862306a36Sopenharmony_ci#define DSI_LCD2_TIMING_2 0x198 /* Timing register 2 */ 114962306a36Sopenharmony_ci#define DSI_LCD2_TIMING_3 0x19C /* Timing register 3 */ 115062306a36Sopenharmony_ci#define DSI_LCD2_WC_0 0x1A0 /* Word Count register 0 */ 115162306a36Sopenharmony_ci#define DSI_LCD2_WC_1 0x1A4 /* Word Count register 1 */ 115262306a36Sopenharmony_ci#define DSI_LCD2_WC_2 0x1A8 /* Word Count register 2 */ 115362306a36Sopenharmony_ci 115462306a36Sopenharmony_ci/* DSI_CTRL_0 0x0000 DSI Control Register 0 */ 115562306a36Sopenharmony_ci#define DSI_CTRL_0_CFG_SOFT_RST (1<<31) 115662306a36Sopenharmony_ci#define DSI_CTRL_0_CFG_SOFT_RST_REG (1<<30) 115762306a36Sopenharmony_ci#define DSI_CTRL_0_CFG_LCD1_TX_EN (1<<8) 115862306a36Sopenharmony_ci#define DSI_CTRL_0_CFG_LCD1_SLV (1<<4) 115962306a36Sopenharmony_ci#define DSI_CTRL_0_CFG_LCD1_EN (1<<0) 116062306a36Sopenharmony_ci 116162306a36Sopenharmony_ci/* DSI_CTRL_1 0x0004 DSI Control Register 1 */ 116262306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_EOTP (1<<8) 116362306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_RSVD (2<<4) 116462306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_LCD2_VCH_NO_MASK (3<<2) 116562306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_LCD2_VCH_NO_SHIFT 2 116662306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_LCD1_VCH_NO_MASK (3<<0) 116762306a36Sopenharmony_ci#define DSI_CTRL_1_CFG_LCD1_VCH_NO_SHIFT 0 116862306a36Sopenharmony_ci 116962306a36Sopenharmony_ci/* DSI_LCD1_CTRL_1 0x0104 DSI Active Panel 1 Control Register 1 */ 117062306a36Sopenharmony_ci/* LCD 1 Vsync Reset Enable */ 117162306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_VSYNC_RST_EN (1<<31) 117262306a36Sopenharmony_ci/* LCD 1 2K Pixel Buffer Mode Enable */ 117362306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_M2K_EN (1<<30) 117462306a36Sopenharmony_ci/* Bit(s) DSI_LCD1_CTRL_1_RSRV_29_23 reserved */ 117562306a36Sopenharmony_ci/* Long Blanking Packet Enable */ 117662306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HLP_PKT_EN (1<<22) 117762306a36Sopenharmony_ci/* Extra Long Blanking Packet Enable */ 117862306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HEX_PKT_EN (1<<21) 117962306a36Sopenharmony_ci/* Front Porch Packet Enable */ 118062306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HFP_PKT_EN (1<<20) 118162306a36Sopenharmony_ci/* hact Packet Enable */ 118262306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HACT_PKT_EN (1<<19) 118362306a36Sopenharmony_ci/* Back Porch Packet Enable */ 118462306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HBP_PKT_EN (1<<18) 118562306a36Sopenharmony_ci/* hse Packet Enable */ 118662306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HSE_PKT_EN (1<<17) 118762306a36Sopenharmony_ci/* hsa Packet Enable */ 118862306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HSA_PKT_EN (1<<16) 118962306a36Sopenharmony_ci/* All Item Enable after Pixel Data */ 119062306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_ALL_SLOT_EN (1<<15) 119162306a36Sopenharmony_ci/* Extra Long Packet Enable after Pixel Data */ 119262306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_HEX_SLOT_EN (1<<14) 119362306a36Sopenharmony_ci/* Bit(s) DSI_LCD1_CTRL_1_RSRV_13_11 reserved */ 119462306a36Sopenharmony_ci/* Turn Around Bus at Last h Line */ 119562306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_LAST_LINE_TURN (1<<10) 119662306a36Sopenharmony_ci/* Go to Low Power Every Frame */ 119762306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_LPM_FRAME_EN (1<<9) 119862306a36Sopenharmony_ci/* Go to Low Power Every Line */ 119962306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_LPM_LINE_EN (1<<8) 120062306a36Sopenharmony_ci/* Bit(s) DSI_LCD1_CTRL_1_RSRV_7_4 reserved */ 120162306a36Sopenharmony_ci/* DSI Transmission Mode for LCD 1 */ 120262306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_BURST_MODE_SHIFT 2 120362306a36Sopenharmony_ci#define DSI_LCD1_CTRL_1_CFG_L1_BURST_MODE_MASK (3<<2) 120462306a36Sopenharmony_ci/* LCD 1 Input Data RGB Mode for LCD 1 */ 120562306a36Sopenharmony_ci#define DSI_LCD2_CTRL_1_CFG_L1_RGB_TYPE_SHIFT 0 120662306a36Sopenharmony_ci#define DSI_LCD2_CTRL_1_CFG_L1_RGB_TYPE_MASK (3<<2) 120762306a36Sopenharmony_ci 120862306a36Sopenharmony_ci/* DSI_PHY_CTRL_2 0x0088 DPHY Control Register 2 */ 120962306a36Sopenharmony_ci/* Bit(s) DSI_PHY_CTRL_2_RSRV_31_12 reserved */ 121062306a36Sopenharmony_ci/* DPHY LP Receiver Enable */ 121162306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_RESC_EN_MASK (0xf<<8) 121262306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_RESC_EN_SHIFT 8 121362306a36Sopenharmony_ci/* DPHY Data Lane Enable */ 121462306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_EN_MASK (0xf<<4) 121562306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_EN_SHIFT 4 121662306a36Sopenharmony_ci/* DPHY Bus Turn Around */ 121762306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_TURN_MASK (0xf) 121862306a36Sopenharmony_ci#define DSI_PHY_CTRL_2_CFG_CSR_LANE_TURN_SHIFT 0 121962306a36Sopenharmony_ci 122062306a36Sopenharmony_ci/* DSI_CPU_CMD_1 0x0024 DSI CPU Packet Command Register 1 */ 122162306a36Sopenharmony_ci/* Bit(s) DSI_CPU_CMD_1_RSRV_31_24 reserved */ 122262306a36Sopenharmony_ci/* LPDT TX Enable */ 122362306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_LPDT_MASK (0xf<<20) 122462306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_LPDT_SHIFT 20 122562306a36Sopenharmony_ci/* ULPS TX Enable */ 122662306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_ULPS_MASK (0xf<<16) 122762306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_ULPS_SHIFT 16 122862306a36Sopenharmony_ci/* Low Power TX Trigger Code */ 122962306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_TRIGGER_CODE_MASK (0xffff) 123062306a36Sopenharmony_ci#define DSI_CPU_CMD_1_CFG_TXLP_TRIGGER_CODE_SHIFT 0 123162306a36Sopenharmony_ci 123262306a36Sopenharmony_ci/* DSI_PHY_TIME_0 0x00c0 DPHY Timing Control Register 0 */ 123362306a36Sopenharmony_ci/* Length of HS Exit Period in tx_clk_esc Cycles */ 123462306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_EXIT_MASK (0xff<<24) 123562306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_EXIT_SHIFT 24 123662306a36Sopenharmony_ci/* DPHY HS Trail Period Length */ 123762306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_TRAIL_MASK (0xff<<16) 123862306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_TRAIL_SHIFT 16 123962306a36Sopenharmony_ci/* DPHY HS Zero State Length */ 124062306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CDG_CSR_TIME_HS_ZERO_MASK (0xff<<8) 124162306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CDG_CSR_TIME_HS_ZERO_SHIFT 8 124262306a36Sopenharmony_ci/* DPHY HS Prepare State Length */ 124362306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_PREP_MASK (0xff) 124462306a36Sopenharmony_ci#define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_PREP_SHIFT 0 124562306a36Sopenharmony_ci 124662306a36Sopenharmony_ci/* DSI_PHY_TIME_1 0x00c4 DPHY Timing Control Register 1 */ 124762306a36Sopenharmony_ci/* Time to Drive LP-00 by New Transmitter */ 124862306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GET_MASK (0xff<<24) 124962306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GET_SHIFT 24 125062306a36Sopenharmony_ci/* Time to Drive LP-00 after Turn Request */ 125162306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GO_MASK (0xff<<16) 125262306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GO_SHIFT 16 125362306a36Sopenharmony_ci/* DPHY HS Wakeup Period Length */ 125462306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_WAKEUP_MASK (0xffff) 125562306a36Sopenharmony_ci#define DSI_PHY_TIME_1_CFG_CSR_TIME_WAKEUP_SHIFT 0 125662306a36Sopenharmony_ci 125762306a36Sopenharmony_ci/* DSI_PHY_TIME_2 0x00c8 DPHY Timing Control Register 2 */ 125862306a36Sopenharmony_ci/* DPHY CLK Exit Period Length */ 125962306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_EXIT_MASK (0xff<<24) 126062306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_EXIT_SHIFT 24 126162306a36Sopenharmony_ci/* DPHY CLK Trail Period Length */ 126262306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_TRAIL_MASK (0xff<<16) 126362306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_TRAIL_SHIFT 16 126462306a36Sopenharmony_ci/* DPHY CLK Zero State Length */ 126562306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_ZERO_MASK (0xff<<8) 126662306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_ZERO_SHIFT 8 126762306a36Sopenharmony_ci/* DPHY CLK LP Length */ 126862306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_LPX_MASK (0xff) 126962306a36Sopenharmony_ci#define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_LPX_SHIFT 0 127062306a36Sopenharmony_ci 127162306a36Sopenharmony_ci/* DSI_PHY_TIME_3 0x00cc DPHY Timing Control Register 3 */ 127262306a36Sopenharmony_ci/* Bit(s) DSI_PHY_TIME_3_RSRV_31_16 reserved */ 127362306a36Sopenharmony_ci/* DPHY LP Length */ 127462306a36Sopenharmony_ci#define DSI_PHY_TIME_3_CFG_CSR_TIME_LPX_MASK (0xff<<8) 127562306a36Sopenharmony_ci#define DSI_PHY_TIME_3_CFG_CSR_TIME_LPX_SHIFT 8 127662306a36Sopenharmony_ci/* DPHY HS req to rdy Length */ 127762306a36Sopenharmony_ci#define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_MASK (0xff) 127862306a36Sopenharmony_ci#define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_SHIFT 0 127962306a36Sopenharmony_ci 128062306a36Sopenharmony_ci#define DSI_ESC_CLK 66 /* Unit: Mhz */ 128162306a36Sopenharmony_ci#define DSI_ESC_CLK_T 15 /* Unit: ns */ 128262306a36Sopenharmony_ci 128362306a36Sopenharmony_ci/* LVDS */ 128462306a36Sopenharmony_ci/* LVDS_PHY_CTRL */ 128562306a36Sopenharmony_ci#define LVDS_PHY_CTL 0x2A4 128662306a36Sopenharmony_ci#define LVDS_PLL_LOCK (1 << 31) 128762306a36Sopenharmony_ci#define LVDS_PHY_EXT_MASK (7 << 28) 128862306a36Sopenharmony_ci#define LVDS_PHY_EXT_SHIFT (28) 128962306a36Sopenharmony_ci#define LVDS_CLK_PHASE_MASK (0x7f << 16) 129062306a36Sopenharmony_ci#define LVDS_CLK_PHASE_SHIFT (16) 129162306a36Sopenharmony_ci#define LVDS_SSC_RESET_EXT (1 << 13) 129262306a36Sopenharmony_ci#define LVDS_SSC_MODE_DOWN_SPREAD (1 << 12) 129362306a36Sopenharmony_ci#define LVDS_SSC_EN (1 << 11) 129462306a36Sopenharmony_ci#define LVDS_PU_PLL (1 << 10) 129562306a36Sopenharmony_ci#define LVDS_PU_TX (1 << 9) 129662306a36Sopenharmony_ci#define LVDS_PU_IVREF (1 << 8) 129762306a36Sopenharmony_ci#define LVDS_CLK_SEL (1 << 7) 129862306a36Sopenharmony_ci#define LVDS_CLK_SEL_LVDS_PCLK (1 << 7) 129962306a36Sopenharmony_ci#define LVDS_PD_CH_MASK (0x3f << 1) 130062306a36Sopenharmony_ci#define LVDS_PD_CH(ch) ((ch) << 1) 130162306a36Sopenharmony_ci#define LVDS_RST (1 << 0) 130262306a36Sopenharmony_ci 130362306a36Sopenharmony_ci#define LVDS_PHY_CTL_EXT 0x2A8 130462306a36Sopenharmony_ci 130562306a36Sopenharmony_ci/* LVDS_PHY_CTRL_EXT1 */ 130662306a36Sopenharmony_ci#define LVDS_SSC_RNGE_MASK (0x7ff << 16) 130762306a36Sopenharmony_ci#define LVDS_SSC_RNGE_SHIFT (16) 130862306a36Sopenharmony_ci#define LVDS_RESERVE_IN_MASK (0xf << 12) 130962306a36Sopenharmony_ci#define LVDS_RESERVE_IN_SHIFT (12) 131062306a36Sopenharmony_ci#define LVDS_TEST_MON_MASK (0x7 << 8) 131162306a36Sopenharmony_ci#define LVDS_TEST_MON_SHIFT (8) 131262306a36Sopenharmony_ci#define LVDS_POL_SWAP_MASK (0x3f << 0) 131362306a36Sopenharmony_ci#define LVDS_POL_SWAP_SHIFT (0) 131462306a36Sopenharmony_ci 131562306a36Sopenharmony_ci/* LVDS_PHY_CTRL_EXT2 */ 131662306a36Sopenharmony_ci#define LVDS_TX_DIF_AMP_MASK (0xf << 24) 131762306a36Sopenharmony_ci#define LVDS_TX_DIF_AMP_SHIFT (24) 131862306a36Sopenharmony_ci#define LVDS_TX_DIF_CM_MASK (0x3 << 22) 131962306a36Sopenharmony_ci#define LVDS_TX_DIF_CM_SHIFT (22) 132062306a36Sopenharmony_ci#define LVDS_SELLV_TXCLK_MASK (0x1f << 16) 132162306a36Sopenharmony_ci#define LVDS_SELLV_TXCLK_SHIFT (16) 132262306a36Sopenharmony_ci#define LVDS_TX_CMFB_EN (0x1 << 15) 132362306a36Sopenharmony_ci#define LVDS_TX_TERM_EN (0x1 << 14) 132462306a36Sopenharmony_ci#define LVDS_SELLV_TXDATA_MASK (0x1f << 8) 132562306a36Sopenharmony_ci#define LVDS_SELLV_TXDATA_SHIFT (8) 132662306a36Sopenharmony_ci#define LVDS_SELLV_OP7_MASK (0x3 << 6) 132762306a36Sopenharmony_ci#define LVDS_SELLV_OP7_SHIFT (6) 132862306a36Sopenharmony_ci#define LVDS_SELLV_OP6_MASK (0x3 << 4) 132962306a36Sopenharmony_ci#define LVDS_SELLV_OP6_SHIFT (4) 133062306a36Sopenharmony_ci#define LVDS_SELLV_OP9_MASK (0x3 << 2) 133162306a36Sopenharmony_ci#define LVDS_SELLV_OP9_SHIFT (2) 133262306a36Sopenharmony_ci#define LVDS_STRESSTST_EN (0x1 << 0) 133362306a36Sopenharmony_ci 133462306a36Sopenharmony_ci/* LVDS_PHY_CTRL_EXT3 */ 133562306a36Sopenharmony_ci#define LVDS_KVCO_MASK (0xf << 28) 133662306a36Sopenharmony_ci#define LVDS_KVCO_SHIFT (28) 133762306a36Sopenharmony_ci#define LVDS_CTUNE_MASK (0x3 << 26) 133862306a36Sopenharmony_ci#define LVDS_CTUNE_SHIFT (26) 133962306a36Sopenharmony_ci#define LVDS_VREG_IVREF_MASK (0x3 << 24) 134062306a36Sopenharmony_ci#define LVDS_VREG_IVREF_SHIFT (24) 134162306a36Sopenharmony_ci#define LVDS_VDDL_MASK (0xf << 20) 134262306a36Sopenharmony_ci#define LVDS_VDDL_SHIFT (20) 134362306a36Sopenharmony_ci#define LVDS_VDDM_MASK (0x3 << 18) 134462306a36Sopenharmony_ci#define LVDS_VDDM_SHIFT (18) 134562306a36Sopenharmony_ci#define LVDS_FBDIV_MASK (0xf << 8) 134662306a36Sopenharmony_ci#define LVDS_FBDIV_SHIFT (8) 134762306a36Sopenharmony_ci#define LVDS_REFDIV_MASK (0x7f << 0) 134862306a36Sopenharmony_ci#define LVDS_REFDIV_SHIFT (0) 134962306a36Sopenharmony_ci 135062306a36Sopenharmony_ci/* LVDS_PHY_CTRL_EXT4 */ 135162306a36Sopenharmony_ci#define LVDS_SSC_FREQ_DIV_MASK (0xffff << 16) 135262306a36Sopenharmony_ci#define LVDS_SSC_FREQ_DIV_SHIFT (16) 135362306a36Sopenharmony_ci#define LVDS_INTPI_MASK (0xf << 12) 135462306a36Sopenharmony_ci#define LVDS_INTPI_SHIFT (12) 135562306a36Sopenharmony_ci#define LVDS_VCODIV_SEL_SE_MASK (0xf << 8) 135662306a36Sopenharmony_ci#define LVDS_VCODIV_SEL_SE_SHIFT (8) 135762306a36Sopenharmony_ci#define LVDS_RESET_INTP_EXT (0x1 << 7) 135862306a36Sopenharmony_ci#define LVDS_VCO_VRNG_MASK (0x7 << 4) 135962306a36Sopenharmony_ci#define LVDS_VCO_VRNG_SHIFT (4) 136062306a36Sopenharmony_ci#define LVDS_PI_EN (0x1 << 3) 136162306a36Sopenharmony_ci#define LVDS_ICP_MASK (0x7 << 0) 136262306a36Sopenharmony_ci#define LVDS_ICP_SHIFT (0) 136362306a36Sopenharmony_ci 136462306a36Sopenharmony_ci/* LVDS_PHY_CTRL_EXT5 */ 136562306a36Sopenharmony_ci#define LVDS_FREQ_OFFSET_MASK (0x1ffff << 15) 136662306a36Sopenharmony_ci#define LVDS_FREQ_OFFSET_SHIFT (15) 136762306a36Sopenharmony_ci#define LVDS_FREQ_OFFSET_VALID (0x1 << 2) 136862306a36Sopenharmony_ci#define LVDS_FREQ_OFFSET_MODE_CK_DIV4_OUT (0x1 << 1) 136962306a36Sopenharmony_ci#define LVDS_FREQ_OFFSET_MODE_EN (0x1 << 0) 137062306a36Sopenharmony_ci 137162306a36Sopenharmony_cienum { 137262306a36Sopenharmony_ci PATH_PN = 0, 137362306a36Sopenharmony_ci PATH_TV, 137462306a36Sopenharmony_ci PATH_P2, 137562306a36Sopenharmony_ci}; 137662306a36Sopenharmony_ci 137762306a36Sopenharmony_ci/* 137862306a36Sopenharmony_ci * mmp path describes part of mmp path related info: 137962306a36Sopenharmony_ci * which is hiden in display driver and not exported to buffer driver 138062306a36Sopenharmony_ci */ 138162306a36Sopenharmony_cistruct mmphw_ctrl; 138262306a36Sopenharmony_cistruct mmphw_path_plat { 138362306a36Sopenharmony_ci int id; 138462306a36Sopenharmony_ci struct mmphw_ctrl *ctrl; 138562306a36Sopenharmony_ci struct mmp_path *path; 138662306a36Sopenharmony_ci u32 path_config; 138762306a36Sopenharmony_ci u32 link_config; 138862306a36Sopenharmony_ci u32 dsi_rbswap; 138962306a36Sopenharmony_ci}; 139062306a36Sopenharmony_ci 139162306a36Sopenharmony_ci/* mmp ctrl describes mmp controller related info */ 139262306a36Sopenharmony_cistruct mmphw_ctrl { 139362306a36Sopenharmony_ci /* platform related, get from config */ 139462306a36Sopenharmony_ci const char *name; 139562306a36Sopenharmony_ci int irq; 139662306a36Sopenharmony_ci void __iomem *reg_base; 139762306a36Sopenharmony_ci struct clk *clk; 139862306a36Sopenharmony_ci 139962306a36Sopenharmony_ci /* sys info */ 140062306a36Sopenharmony_ci struct device *dev; 140162306a36Sopenharmony_ci 140262306a36Sopenharmony_ci /* state */ 140362306a36Sopenharmony_ci int open_count; 140462306a36Sopenharmony_ci int status; 140562306a36Sopenharmony_ci struct mutex access_ok; 140662306a36Sopenharmony_ci 140762306a36Sopenharmony_ci /*pathes*/ 140862306a36Sopenharmony_ci int path_num; 140962306a36Sopenharmony_ci struct mmphw_path_plat path_plats[] __counted_by(path_num); 141062306a36Sopenharmony_ci}; 141162306a36Sopenharmony_ci 141262306a36Sopenharmony_cistatic inline int overlay_is_vid(struct mmp_overlay *overlay) 141362306a36Sopenharmony_ci{ 141462306a36Sopenharmony_ci return overlay->dmafetch_id & 1; 141562306a36Sopenharmony_ci} 141662306a36Sopenharmony_ci 141762306a36Sopenharmony_cistatic inline struct mmphw_path_plat *path_to_path_plat(struct mmp_path *path) 141862306a36Sopenharmony_ci{ 141962306a36Sopenharmony_ci return (struct mmphw_path_plat *)path->plat_data; 142062306a36Sopenharmony_ci} 142162306a36Sopenharmony_ci 142262306a36Sopenharmony_cistatic inline struct mmphw_ctrl *path_to_ctrl(struct mmp_path *path) 142362306a36Sopenharmony_ci{ 142462306a36Sopenharmony_ci return path_to_path_plat(path)->ctrl; 142562306a36Sopenharmony_ci} 142662306a36Sopenharmony_ci 142762306a36Sopenharmony_cistatic inline struct mmphw_ctrl *overlay_to_ctrl(struct mmp_overlay *overlay) 142862306a36Sopenharmony_ci{ 142962306a36Sopenharmony_ci return path_to_ctrl(overlay->path); 143062306a36Sopenharmony_ci} 143162306a36Sopenharmony_ci 143262306a36Sopenharmony_cistatic inline void __iomem *ctrl_regs(struct mmp_path *path) 143362306a36Sopenharmony_ci{ 143462306a36Sopenharmony_ci return path_to_ctrl(path)->reg_base; 143562306a36Sopenharmony_ci} 143662306a36Sopenharmony_ci 143762306a36Sopenharmony_ci/* path regs, for regs symmetrical for both pathes */ 143862306a36Sopenharmony_cistatic inline struct lcd_regs *path_regs(struct mmp_path *path) 143962306a36Sopenharmony_ci{ 144062306a36Sopenharmony_ci if (path->id == PATH_PN) 144162306a36Sopenharmony_ci return (struct lcd_regs __force *)(ctrl_regs(path) + 0xc0); 144262306a36Sopenharmony_ci else if (path->id == PATH_TV) 144362306a36Sopenharmony_ci return (struct lcd_regs __force *)ctrl_regs(path); 144462306a36Sopenharmony_ci else if (path->id == PATH_P2) 144562306a36Sopenharmony_ci return (struct lcd_regs __force *)(ctrl_regs(path) + 0x200); 144662306a36Sopenharmony_ci else { 144762306a36Sopenharmony_ci dev_err(path->dev, "path id %d invalid\n", path->id); 144862306a36Sopenharmony_ci BUG_ON(1); 144962306a36Sopenharmony_ci return NULL; 145062306a36Sopenharmony_ci } 145162306a36Sopenharmony_ci} 145262306a36Sopenharmony_ci 145362306a36Sopenharmony_ci#ifdef CONFIG_MMP_DISP_SPI 145462306a36Sopenharmony_ciextern int lcd_spi_register(struct mmphw_ctrl *ctrl); 145562306a36Sopenharmony_ci#endif 145662306a36Sopenharmony_ci#endif /* _MMP_CTRL_H_ */ 1457