18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/drivers/video/acornfb.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 1998,1999 Russell King 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Frame buffer code for Acorn platforms 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#if defined(HAS_VIDC20) 108c2ecf20Sopenharmony_ci#include <asm/hardware/iomd.h> 118c2ecf20Sopenharmony_ci#define VIDC_PALETTE_SIZE 256 128c2ecf20Sopenharmony_ci#define VIDC_NAME "VIDC20" 138c2ecf20Sopenharmony_ci#endif 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define EXTEND8(x) ((x)|(x)<<8) 168c2ecf20Sopenharmony_ci#define EXTEND4(x) ((x)|(x)<<4|(x)<<8|(x)<<12) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistruct vidc20_palette { 198c2ecf20Sopenharmony_ci u_int red:8; 208c2ecf20Sopenharmony_ci u_int green:8; 218c2ecf20Sopenharmony_ci u_int blue:8; 228c2ecf20Sopenharmony_ci u_int ext:4; 238c2ecf20Sopenharmony_ci u_int unused:4; 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistruct vidc_palette { 278c2ecf20Sopenharmony_ci u_int red:4; 288c2ecf20Sopenharmony_ci u_int green:4; 298c2ecf20Sopenharmony_ci u_int blue:4; 308c2ecf20Sopenharmony_ci u_int trans:1; 318c2ecf20Sopenharmony_ci u_int sbz1:13; 328c2ecf20Sopenharmony_ci u_int reg:4; 338c2ecf20Sopenharmony_ci u_int sbz2:2; 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciunion palette { 378c2ecf20Sopenharmony_ci struct vidc20_palette vidc20; 388c2ecf20Sopenharmony_ci struct vidc_palette vidc; 398c2ecf20Sopenharmony_ci u_int p; 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistruct acornfb_par { 438c2ecf20Sopenharmony_ci struct device *dev; 448c2ecf20Sopenharmony_ci unsigned long screen_end; 458c2ecf20Sopenharmony_ci unsigned int dram_size; 468c2ecf20Sopenharmony_ci unsigned int vram_half_sam; 478c2ecf20Sopenharmony_ci unsigned int palette_size; 488c2ecf20Sopenharmony_ci signed int montype; 498c2ecf20Sopenharmony_ci unsigned int using_vram : 1; 508c2ecf20Sopenharmony_ci unsigned int dpms : 1; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci union palette palette[VIDC_PALETTE_SIZE]; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci u32 pseudo_palette[16]; 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistruct vidc_timing { 588c2ecf20Sopenharmony_ci u_int h_cycle; 598c2ecf20Sopenharmony_ci u_int h_sync_width; 608c2ecf20Sopenharmony_ci u_int h_border_start; 618c2ecf20Sopenharmony_ci u_int h_display_start; 628c2ecf20Sopenharmony_ci u_int h_display_end; 638c2ecf20Sopenharmony_ci u_int h_border_end; 648c2ecf20Sopenharmony_ci u_int h_interlace; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci u_int v_cycle; 678c2ecf20Sopenharmony_ci u_int v_sync_width; 688c2ecf20Sopenharmony_ci u_int v_border_start; 698c2ecf20Sopenharmony_ci u_int v_display_start; 708c2ecf20Sopenharmony_ci u_int v_display_end; 718c2ecf20Sopenharmony_ci u_int v_border_end; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci u_int control; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci /* VIDC20 only */ 768c2ecf20Sopenharmony_ci u_int pll_ctl; 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistruct modey_params { 808c2ecf20Sopenharmony_ci u_int y_res; 818c2ecf20Sopenharmony_ci u_int u_margin; 828c2ecf20Sopenharmony_ci u_int b_margin; 838c2ecf20Sopenharmony_ci u_int vsync_len; 848c2ecf20Sopenharmony_ci u_int vf; 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistruct modex_params { 888c2ecf20Sopenharmony_ci u_int x_res; 898c2ecf20Sopenharmony_ci u_int l_margin; 908c2ecf20Sopenharmony_ci u_int r_margin; 918c2ecf20Sopenharmony_ci u_int hsync_len; 928c2ecf20Sopenharmony_ci u_int clock; 938c2ecf20Sopenharmony_ci u_int hf; 948c2ecf20Sopenharmony_ci const struct modey_params *modey; 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#ifdef HAS_VIDC20 988c2ecf20Sopenharmony_ci/* 998c2ecf20Sopenharmony_ci * VIDC20 registers 1008c2ecf20Sopenharmony_ci */ 1018c2ecf20Sopenharmony_ci#define VIDC20_CTRL 0xe0000000 1028c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_VCLK (0 << 0) 1038c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_HCLK (1 << 0) 1048c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_RCLK (2 << 0) 1058c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK (0 << 2) 1068c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK2 (1 << 2) 1078c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK3 (2 << 2) 1088c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK4 (3 << 2) 1098c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK5 (4 << 2) 1108c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK6 (5 << 2) 1118c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK7 (6 << 2) 1128c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PIX_CK8 (7 << 2) 1138c2ecf20Sopenharmony_ci#define VIDC20_CTRL_1BPP (0 << 5) 1148c2ecf20Sopenharmony_ci#define VIDC20_CTRL_2BPP (1 << 5) 1158c2ecf20Sopenharmony_ci#define VIDC20_CTRL_4BPP (2 << 5) 1168c2ecf20Sopenharmony_ci#define VIDC20_CTRL_8BPP (3 << 5) 1178c2ecf20Sopenharmony_ci#define VIDC20_CTRL_16BPP (4 << 5) 1188c2ecf20Sopenharmony_ci#define VIDC20_CTRL_32BPP (6 << 5) 1198c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_NS (0 << 8) 1208c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_4 (1 << 8) 1218c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_8 (2 << 8) 1228c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_12 (3 << 8) 1238c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_16 (4 << 8) 1248c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_20 (5 << 8) 1258c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_24 (6 << 8) 1268c2ecf20Sopenharmony_ci#define VIDC20_CTRL_FIFO_28 (7 << 8) 1278c2ecf20Sopenharmony_ci#define VIDC20_CTRL_INT (1 << 12) 1288c2ecf20Sopenharmony_ci#define VIDC20_CTRL_DUP (1 << 13) 1298c2ecf20Sopenharmony_ci#define VIDC20_CTRL_PDOWN (1 << 14) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define VIDC20_ECTL 0xc0000000 1328c2ecf20Sopenharmony_ci#define VIDC20_ECTL_REG(x) ((x) & 0xf3) 1338c2ecf20Sopenharmony_ci#define VIDC20_ECTL_ECK (1 << 2) 1348c2ecf20Sopenharmony_ci#define VIDC20_ECTL_REDPED (1 << 8) 1358c2ecf20Sopenharmony_ci#define VIDC20_ECTL_GREENPED (1 << 9) 1368c2ecf20Sopenharmony_ci#define VIDC20_ECTL_BLUEPED (1 << 10) 1378c2ecf20Sopenharmony_ci#define VIDC20_ECTL_DAC (1 << 12) 1388c2ecf20Sopenharmony_ci#define VIDC20_ECTL_LCDGS (1 << 13) 1398c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HRM (1 << 14) 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HS_MASK (3 << 16) 1428c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HS_HSYNC (0 << 16) 1438c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HS_NHSYNC (1 << 16) 1448c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HS_CSYNC (2 << 16) 1458c2ecf20Sopenharmony_ci#define VIDC20_ECTL_HS_NCSYNC (3 << 16) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define VIDC20_ECTL_VS_MASK (3 << 18) 1488c2ecf20Sopenharmony_ci#define VIDC20_ECTL_VS_VSYNC (0 << 18) 1498c2ecf20Sopenharmony_ci#define VIDC20_ECTL_VS_NVSYNC (1 << 18) 1508c2ecf20Sopenharmony_ci#define VIDC20_ECTL_VS_CSYNC (2 << 18) 1518c2ecf20Sopenharmony_ci#define VIDC20_ECTL_VS_NCSYNC (3 << 18) 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define VIDC20_DCTL 0xf0000000 1548c2ecf20Sopenharmony_ci/* 0-9 = number of words in scanline */ 1558c2ecf20Sopenharmony_ci#define VIDC20_DCTL_SNA (1 << 12) 1568c2ecf20Sopenharmony_ci#define VIDC20_DCTL_HDIS (1 << 13) 1578c2ecf20Sopenharmony_ci#define VIDC20_DCTL_BUS_NS (0 << 16) 1588c2ecf20Sopenharmony_ci#define VIDC20_DCTL_BUS_D31_0 (1 << 16) 1598c2ecf20Sopenharmony_ci#define VIDC20_DCTL_BUS_D63_32 (2 << 16) 1608c2ecf20Sopenharmony_ci#define VIDC20_DCTL_BUS_D63_0 (3 << 16) 1618c2ecf20Sopenharmony_ci#define VIDC20_DCTL_VRAM_DIS (0 << 18) 1628c2ecf20Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK (1 << 18) 1638c2ecf20Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK2 (2 << 18) 1648c2ecf20Sopenharmony_ci#define VIDC20_DCTL_VRAM_PXCLK4 (3 << 18) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#endif 167