162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * linux/drivers/video/acornfb.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 1998,1999 Russell King 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Frame buffer code for Acorn platforms 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#if defined(HAS_VIDC20) 1062306a36Sopenharmony_ci#include <asm/hardware/iomd.h> 1162306a36Sopenharmony_ci#define VIDC_PALETTE_SIZE 256 1262306a36Sopenharmony_ci#define VIDC_NAME "VIDC20" 1362306a36Sopenharmony_ci#endif 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#define EXTEND8(x) ((x)|(x)<<8) 1662306a36Sopenharmony_ci#define EXTEND4(x) ((x)|(x)<<4|(x)<<8|(x)<<12) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistruct vidc20_palette { 1962306a36Sopenharmony_ci u_int red:8; 2062306a36Sopenharmony_ci u_int green:8; 2162306a36Sopenharmony_ci u_int blue:8; 2262306a36Sopenharmony_ci u_int ext:4; 2362306a36Sopenharmony_ci u_int unused:4; 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistruct vidc_palette { 2762306a36Sopenharmony_ci u_int red:4; 2862306a36Sopenharmony_ci u_int green:4; 2962306a36Sopenharmony_ci u_int blue:4; 3062306a36Sopenharmony_ci u_int trans:1; 3162306a36Sopenharmony_ci u_int sbz1:13; 3262306a36Sopenharmony_ci u_int reg:4; 3362306a36Sopenharmony_ci u_int sbz2:2; 3462306a36Sopenharmony_ci}; 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciunion palette { 3762306a36Sopenharmony_ci struct vidc20_palette vidc20; 3862306a36Sopenharmony_ci struct vidc_palette vidc; 3962306a36Sopenharmony_ci u_int p; 4062306a36Sopenharmony_ci}; 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_cistruct acornfb_par { 4362306a36Sopenharmony_ci struct device *dev; 4462306a36Sopenharmony_ci unsigned long screen_end; 4562306a36Sopenharmony_ci unsigned int dram_size; 4662306a36Sopenharmony_ci unsigned int vram_half_sam; 4762306a36Sopenharmony_ci unsigned int palette_size; 4862306a36Sopenharmony_ci signed int montype; 4962306a36Sopenharmony_ci unsigned int using_vram : 1; 5062306a36Sopenharmony_ci unsigned int dpms : 1; 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci union palette palette[VIDC_PALETTE_SIZE]; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci u32 pseudo_palette[16]; 5562306a36Sopenharmony_ci}; 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistruct vidc_timing { 5862306a36Sopenharmony_ci u_int h_cycle; 5962306a36Sopenharmony_ci u_int h_sync_width; 6062306a36Sopenharmony_ci u_int h_border_start; 6162306a36Sopenharmony_ci u_int h_display_start; 6262306a36Sopenharmony_ci u_int h_display_end; 6362306a36Sopenharmony_ci u_int h_border_end; 6462306a36Sopenharmony_ci u_int h_interlace; 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci u_int v_cycle; 6762306a36Sopenharmony_ci u_int v_sync_width; 6862306a36Sopenharmony_ci u_int v_border_start; 6962306a36Sopenharmony_ci u_int v_display_start; 7062306a36Sopenharmony_ci u_int v_display_end; 7162306a36Sopenharmony_ci u_int v_border_end; 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci u_int control; 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci /* VIDC20 only */ 7662306a36Sopenharmony_ci u_int pll_ctl; 7762306a36Sopenharmony_ci}; 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_cistruct modey_params { 8062306a36Sopenharmony_ci u_int y_res; 8162306a36Sopenharmony_ci u_int u_margin; 8262306a36Sopenharmony_ci u_int b_margin; 8362306a36Sopenharmony_ci u_int vsync_len; 8462306a36Sopenharmony_ci u_int vf; 8562306a36Sopenharmony_ci}; 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_cistruct modex_params { 8862306a36Sopenharmony_ci u_int x_res; 8962306a36Sopenharmony_ci u_int l_margin; 9062306a36Sopenharmony_ci u_int r_margin; 9162306a36Sopenharmony_ci u_int hsync_len; 9262306a36Sopenharmony_ci u_int clock; 9362306a36Sopenharmony_ci u_int hf; 9462306a36Sopenharmony_ci const struct modey_params *modey; 9562306a36Sopenharmony_ci}; 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci#ifdef HAS_VIDC20 9862306a36Sopenharmony_ci/* 9962306a36Sopenharmony_ci * VIDC20 registers 10062306a36Sopenharmony_ci */ 10162306a36Sopenharmony_ci#define VIDC20_CTRL 0xe0000000 10262306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_VCLK (0 << 0) 10362306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_HCLK (1 << 0) 10462306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_RCLK (2 << 0) 10562306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK (0 << 2) 10662306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK2 (1 << 2) 10762306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK3 (2 << 2) 10862306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK4 (3 << 2) 10962306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK5 (4 << 2) 11062306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK6 (5 << 2) 11162306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK7 (6 << 2) 11262306a36Sopenharmony_ci#define VIDC20_CTRL_PIX_CK8 (7 << 2) 11362306a36Sopenharmony_ci#define VIDC20_CTRL_1BPP (0 << 5) 11462306a36Sopenharmony_ci#define VIDC20_CTRL_2BPP (1 << 5) 11562306a36Sopenharmony_ci#define VIDC20_CTRL_4BPP (2 << 5) 11662306a36Sopenharmony_ci#define VIDC20_CTRL_8BPP (3 << 5) 11762306a36Sopenharmony_ci#define VIDC20_CTRL_16BPP (4 << 5) 11862306a36Sopenharmony_ci#define VIDC20_CTRL_32BPP (6 << 5) 11962306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_NS (0 << 8) 12062306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_4 (1 << 8) 12162306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_8 (2 << 8) 12262306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_12 (3 << 8) 12362306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_16 (4 << 8) 12462306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_20 (5 << 8) 12562306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_24 (6 << 8) 12662306a36Sopenharmony_ci#define VIDC20_CTRL_FIFO_28 (7 << 8) 12762306a36Sopenharmony_ci#define VIDC20_CTRL_INT (1 << 12) 12862306a36Sopenharmony_ci#define VIDC20_CTRL_DUP (1 << 13) 12962306a36Sopenharmony_ci#define VIDC20_CTRL_PDOWN (1 << 14) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci#define VIDC20_ECTL 0xc0000000 13262306a36Sopenharmony_ci#define VIDC20_ECTL_REG(x) ((x) & 0xf3) 13362306a36Sopenharmony_ci#define VIDC20_ECTL_ECK (1 << 2) 13462306a36Sopenharmony_ci#define VIDC20_ECTL_REDPED (1 << 8) 13562306a36Sopenharmony_ci#define VIDC20_ECTL_GREENPED (1 << 9) 13662306a36Sopenharmony_ci#define VIDC20_ECTL_BLUEPED (1 << 10) 13762306a36Sopenharmony_ci#define VIDC20_ECTL_DAC (1 << 12) 13862306a36Sopenharmony_ci#define VIDC20_ECTL_LCDGS (1 << 13) 13962306a36Sopenharmony_ci#define VIDC20_ECTL_HRM (1 << 14) 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define VIDC20_ECTL_HS_MASK (3 << 16) 14262306a36Sopenharmony_ci#define VIDC20_ECTL_HS_HSYNC (0 << 16) 14362306a36Sopenharmony_ci#define VIDC20_ECTL_HS_NHSYNC (1 << 16) 14462306a36Sopenharmony_ci#define VIDC20_ECTL_HS_CSYNC (2 << 16) 14562306a36Sopenharmony_ci#define VIDC20_ECTL_HS_NCSYNC (3 << 16) 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#define VIDC20_ECTL_VS_MASK (3 << 18) 14862306a36Sopenharmony_ci#define VIDC20_ECTL_VS_VSYNC (0 << 18) 14962306a36Sopenharmony_ci#define VIDC20_ECTL_VS_NVSYNC (1 << 18) 15062306a36Sopenharmony_ci#define VIDC20_ECTL_VS_CSYNC (2 << 18) 15162306a36Sopenharmony_ci#define VIDC20_ECTL_VS_NCSYNC (3 << 18) 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci#define VIDC20_DCTL 0xf0000000 15462306a36Sopenharmony_ci/* 0-9 = number of words in scanline */ 15562306a36Sopenharmony_ci#define VIDC20_DCTL_SNA (1 << 12) 15662306a36Sopenharmony_ci#define VIDC20_DCTL_HDIS (1 << 13) 15762306a36Sopenharmony_ci#define VIDC20_DCTL_BUS_NS (0 << 16) 15862306a36Sopenharmony_ci#define VIDC20_DCTL_BUS_D31_0 (1 << 16) 15962306a36Sopenharmony_ci#define VIDC20_DCTL_BUS_D63_32 (2 << 16) 16062306a36Sopenharmony_ci#define VIDC20_DCTL_BUS_D63_0 (3 << 16) 16162306a36Sopenharmony_ci#define VIDC20_DCTL_VRAM_DIS (0 << 18) 16262306a36Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK (1 << 18) 16362306a36Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK2 (2 << 18) 16462306a36Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK4 (3 << 18) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#endif 167