18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/drivers/video/sstfb.h -- voodoo graphics frame buffer 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2000,2001 Ghozlane Toumi <gtoumi@messel.emse.fr> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Created 28 Aug 2001 by Ghozlane Toumi 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef _SSTFB_H_ 128c2ecf20Sopenharmony_ci#define _SSTFB_H_ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * Debug Stuff 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifdef SST_DEBUG 218c2ecf20Sopenharmony_ci# define dprintk(X...) printk("sstfb: " X) 228c2ecf20Sopenharmony_ci# define SST_DEBUG_REG 1 238c2ecf20Sopenharmony_ci# define SST_DEBUG_FUNC 1 248c2ecf20Sopenharmony_ci# define SST_DEBUG_VAR 1 258c2ecf20Sopenharmony_ci#else 268c2ecf20Sopenharmony_ci# define dprintk(X...) 278c2ecf20Sopenharmony_ci# define SST_DEBUG_REG 0 288c2ecf20Sopenharmony_ci# define SST_DEBUG_FUNC 0 298c2ecf20Sopenharmony_ci# define SST_DEBUG_VAR 0 308c2ecf20Sopenharmony_ci#endif 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#if (SST_DEBUG_REG > 0) 338c2ecf20Sopenharmony_ci# define r_dprintk(X...) dprintk(X) 348c2ecf20Sopenharmony_ci#else 358c2ecf20Sopenharmony_ci# define r_dprintk(X...) 368c2ecf20Sopenharmony_ci#endif 378c2ecf20Sopenharmony_ci#if (SST_DEBUG_REG > 1) 388c2ecf20Sopenharmony_ci# define r_ddprintk(X...) dprintk(" " X) 398c2ecf20Sopenharmony_ci#else 408c2ecf20Sopenharmony_ci# define r_ddprintk(X...) 418c2ecf20Sopenharmony_ci#endif 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#if (SST_DEBUG_FUNC > 0) 448c2ecf20Sopenharmony_ci# define f_dprintk(X...) dprintk(X) 458c2ecf20Sopenharmony_ci#else 468c2ecf20Sopenharmony_ci# define f_dprintk(X...) 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci#if (SST_DEBUG_FUNC > 1) 498c2ecf20Sopenharmony_ci# define f_ddprintk(X...) dprintk(" " X) 508c2ecf20Sopenharmony_ci#else 518c2ecf20Sopenharmony_ci# define f_ddprintk(X...) 528c2ecf20Sopenharmony_ci#endif 538c2ecf20Sopenharmony_ci#if (SST_DEBUG_FUNC > 2) 548c2ecf20Sopenharmony_ci# define f_dddprintk(X...) dprintk(" " X) 558c2ecf20Sopenharmony_ci#else 568c2ecf20Sopenharmony_ci# define f_dddprintk(X...) 578c2ecf20Sopenharmony_ci#endif 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#if (SST_DEBUG_VAR > 0) 608c2ecf20Sopenharmony_ci# define v_dprintk(X...) dprintk(X) 618c2ecf20Sopenharmony_ci# define print_var(V, X...) \ 628c2ecf20Sopenharmony_ci { \ 638c2ecf20Sopenharmony_ci dprintk(X); \ 648c2ecf20Sopenharmony_ci printk(" :\n"); \ 658c2ecf20Sopenharmony_ci sst_dbg_print_var(V); \ 668c2ecf20Sopenharmony_ci } 678c2ecf20Sopenharmony_ci#else 688c2ecf20Sopenharmony_ci# define v_dprintk(X...) 698c2ecf20Sopenharmony_ci# define print_var(X,Y...) 708c2ecf20Sopenharmony_ci#endif 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define POW2(x) (1ul<<(x)) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* 758c2ecf20Sopenharmony_ci * 768c2ecf20Sopenharmony_ci * Const 778c2ecf20Sopenharmony_ci * 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* pci stuff */ 818c2ecf20Sopenharmony_ci#define PCI_INIT_ENABLE 0x40 828c2ecf20Sopenharmony_ci# define PCI_EN_INIT_WR BIT(0) 838c2ecf20Sopenharmony_ci# define PCI_EN_FIFO_WR BIT(1) 848c2ecf20Sopenharmony_ci# define PCI_REMAP_DAC BIT(2) 858c2ecf20Sopenharmony_ci#define PCI_VCLK_ENABLE 0xc0 /* enable video */ 868c2ecf20Sopenharmony_ci#define PCI_VCLK_DISABLE 0xe0 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* register offsets from memBaseAddr */ 898c2ecf20Sopenharmony_ci#define STATUS 0x0000 908c2ecf20Sopenharmony_ci# define STATUS_FBI_BUSY BIT(7) 918c2ecf20Sopenharmony_ci#define FBZMODE 0x0110 928c2ecf20Sopenharmony_ci# define EN_CLIPPING BIT(0) /* enable clipping */ 938c2ecf20Sopenharmony_ci# define EN_RGB_WRITE BIT(9) /* enable writes to rgb area */ 948c2ecf20Sopenharmony_ci# define EN_ALPHA_WRITE BIT(10) 958c2ecf20Sopenharmony_ci# define ENGINE_INVERT_Y BIT(17) /* invert Y origin (pipe) */ 968c2ecf20Sopenharmony_ci#define LFBMODE 0x0114 978c2ecf20Sopenharmony_ci# define LFB_565 0 /* bits 3:0 .16 bits RGB */ 988c2ecf20Sopenharmony_ci# define LFB_888 4 /* 24 bits RGB */ 998c2ecf20Sopenharmony_ci# define LFB_8888 5 /* 32 bits ARGB */ 1008c2ecf20Sopenharmony_ci# define WR_BUFF_FRONT 0 /* write buf select (front) */ 1018c2ecf20Sopenharmony_ci# define WR_BUFF_BACK (1 << 4) /* back */ 1028c2ecf20Sopenharmony_ci# define RD_BUFF_FRONT 0 /* read buff select (front) */ 1038c2ecf20Sopenharmony_ci# define RD_BUFF_BACK (1 << 6) /* back */ 1048c2ecf20Sopenharmony_ci# define EN_PXL_PIPELINE BIT(8) /* pixel pipeline (clip..)*/ 1058c2ecf20Sopenharmony_ci# define LFB_WORD_SWIZZLE_WR BIT(11) /* enable write-wordswap (big-endian) */ 1068c2ecf20Sopenharmony_ci# define LFB_BYTE_SWIZZLE_WR BIT(12) /* enable write-byteswap (big-endian) */ 1078c2ecf20Sopenharmony_ci# define LFB_INVERT_Y BIT(13) /* invert Y origin (LFB) */ 1088c2ecf20Sopenharmony_ci# define LFB_WORD_SWIZZLE_RD BIT(15) /* enable read-wordswap (big-endian) */ 1098c2ecf20Sopenharmony_ci# define LFB_BYTE_SWIZZLE_RD BIT(16) /* enable read-byteswap (big-endian) */ 1108c2ecf20Sopenharmony_ci#define CLIP_LEFT_RIGHT 0x0118 1118c2ecf20Sopenharmony_ci#define CLIP_LOWY_HIGHY 0x011c 1128c2ecf20Sopenharmony_ci#define NOPCMD 0x0120 1138c2ecf20Sopenharmony_ci#define FASTFILLCMD 0x0124 1148c2ecf20Sopenharmony_ci#define SWAPBUFFCMD 0x0128 1158c2ecf20Sopenharmony_ci#define FBIINIT4 0x0200 /* misc controls */ 1168c2ecf20Sopenharmony_ci# define FAST_PCI_READS 0 /* 1 waitstate */ 1178c2ecf20Sopenharmony_ci# define SLOW_PCI_READS BIT(0) /* 2 ws */ 1188c2ecf20Sopenharmony_ci# define LFB_READ_AHEAD BIT(1) 1198c2ecf20Sopenharmony_ci#define BACKPORCH 0x0208 1208c2ecf20Sopenharmony_ci#define VIDEODIMENSIONS 0x020c 1218c2ecf20Sopenharmony_ci#define FBIINIT0 0x0210 /* misc+fifo controls */ 1228c2ecf20Sopenharmony_ci# define DIS_VGA_PASSTHROUGH BIT(0) 1238c2ecf20Sopenharmony_ci# define FBI_RESET BIT(1) 1248c2ecf20Sopenharmony_ci# define FIFO_RESET BIT(2) 1258c2ecf20Sopenharmony_ci#define FBIINIT1 0x0214 /* PCI + video controls */ 1268c2ecf20Sopenharmony_ci# define VIDEO_MASK 0x8080010f /* masks video related bits V1+V2*/ 1278c2ecf20Sopenharmony_ci# define FAST_PCI_WRITES 0 /* 0 ws */ 1288c2ecf20Sopenharmony_ci# define SLOW_PCI_WRITES BIT(1) /* 1 ws */ 1298c2ecf20Sopenharmony_ci# define EN_LFB_READ BIT(3) 1308c2ecf20Sopenharmony_ci# define TILES_IN_X_SHIFT 4 1318c2ecf20Sopenharmony_ci# define VIDEO_RESET BIT(8) 1328c2ecf20Sopenharmony_ci# define EN_BLANKING BIT(12) 1338c2ecf20Sopenharmony_ci# define EN_DATA_OE BIT(13) 1348c2ecf20Sopenharmony_ci# define EN_BLANK_OE BIT(14) 1358c2ecf20Sopenharmony_ci# define EN_HVSYNC_OE BIT(15) 1368c2ecf20Sopenharmony_ci# define EN_DCLK_OE BIT(16) 1378c2ecf20Sopenharmony_ci# define SEL_INPUT_VCLK_2X 0 /* bit 17 */ 1388c2ecf20Sopenharmony_ci# define SEL_INPUT_VCLK_SLAVE BIT(17) 1398c2ecf20Sopenharmony_ci# define SEL_SOURCE_VCLK_SLAVE 0 /* bits 21:20 */ 1408c2ecf20Sopenharmony_ci# define SEL_SOURCE_VCLK_2X_DIV2 (0x01 << 20) 1418c2ecf20Sopenharmony_ci# define SEL_SOURCE_VCLK_2X_SEL (0x02 << 20) 1428c2ecf20Sopenharmony_ci# define EN_24BPP BIT(22) 1438c2ecf20Sopenharmony_ci# define TILES_IN_X_MSB_SHIFT 24 /* v2 */ 1448c2ecf20Sopenharmony_ci# define VCLK_2X_SEL_DEL_SHIFT 27 /* vclk out delay 0,4,6,8ns */ 1458c2ecf20Sopenharmony_ci# define VCLK_DEL_SHIFT 29 /* vclk in delay */ 1468c2ecf20Sopenharmony_ci#define FBIINIT2 0x0218 /* Dram controls */ 1478c2ecf20Sopenharmony_ci# define EN_FAST_RAS_READ BIT(5) 1488c2ecf20Sopenharmony_ci# define EN_DRAM_OE BIT(6) 1498c2ecf20Sopenharmony_ci# define EN_FAST_RD_AHEAD_WR BIT(7) 1508c2ecf20Sopenharmony_ci# define VIDEO_OFFSET_SHIFT 11 /* unit: #rows tile 64x16/2 */ 1518c2ecf20Sopenharmony_ci# define SWAP_DACVSYNC 0 1528c2ecf20Sopenharmony_ci# define SWAP_DACDATA0 (1 << 9) 1538c2ecf20Sopenharmony_ci# define SWAP_FIFO_STALL (2 << 9) 1548c2ecf20Sopenharmony_ci# define EN_RD_AHEAD_FIFO BIT(21) 1558c2ecf20Sopenharmony_ci# define EN_DRAM_REFRESH BIT(22) 1568c2ecf20Sopenharmony_ci# define DRAM_REFRESH_16 (0x30 << 23) /* dram 16 ms */ 1578c2ecf20Sopenharmony_ci#define DAC_READ FBIINIT2 /* in remap mode */ 1588c2ecf20Sopenharmony_ci#define FBIINIT3 0x021c /* fbi controls */ 1598c2ecf20Sopenharmony_ci# define DISABLE_TEXTURE BIT(6) 1608c2ecf20Sopenharmony_ci# define Y_SWAP_ORIGIN_SHIFT 22 /* Y swap subtraction value */ 1618c2ecf20Sopenharmony_ci#define HSYNC 0x0220 1628c2ecf20Sopenharmony_ci#define VSYNC 0x0224 1638c2ecf20Sopenharmony_ci#define DAC_DATA 0x022c 1648c2ecf20Sopenharmony_ci# define DAC_READ_CMD BIT(11) /* set read dacreg mode */ 1658c2ecf20Sopenharmony_ci#define FBIINIT5 0x0244 /* v2 specific */ 1668c2ecf20Sopenharmony_ci# define FBIINIT5_MASK 0xfa40ffff /* mask video bits*/ 1678c2ecf20Sopenharmony_ci# define HDOUBLESCAN BIT(20) 1688c2ecf20Sopenharmony_ci# define VDOUBLESCAN BIT(21) 1698c2ecf20Sopenharmony_ci# define HSYNC_HIGH BIT(23) 1708c2ecf20Sopenharmony_ci# define VSYNC_HIGH BIT(24) 1718c2ecf20Sopenharmony_ci# define INTERLACE BIT(26) 1728c2ecf20Sopenharmony_ci#define FBIINIT6 0x0248 /* v2 specific */ 1738c2ecf20Sopenharmony_ci# define TILES_IN_X_LSB_SHIFT 30 /* v2 */ 1748c2ecf20Sopenharmony_ci#define FBIINIT7 0x024c /* v2 specific */ 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define BLTSRCBASEADDR 0x02c0 /* BitBLT Source base address */ 1778c2ecf20Sopenharmony_ci#define BLTDSTBASEADDR 0x02c4 /* BitBLT Destination base address */ 1788c2ecf20Sopenharmony_ci#define BLTXYSTRIDES 0x02c8 /* BitBLT Source and Destination strides */ 1798c2ecf20Sopenharmony_ci#define BLTSRCCHROMARANGE 0x02cc /* BitBLT Source Chroma key range */ 1808c2ecf20Sopenharmony_ci#define BLTDSTCHROMARANGE 0x02d0 /* BitBLT Destination Chroma key range */ 1818c2ecf20Sopenharmony_ci#define BLTCLIPX 0x02d4 /* BitBLT Min/Max X clip values */ 1828c2ecf20Sopenharmony_ci#define BLTCLIPY 0x02d8 /* BitBLT Min/Max Y clip values */ 1838c2ecf20Sopenharmony_ci#define BLTSRCXY 0x02e0 /* BitBLT Source starting XY coordinates */ 1848c2ecf20Sopenharmony_ci#define BLTDSTXY 0x02e4 /* BitBLT Destination starting XY coordinates */ 1858c2ecf20Sopenharmony_ci#define BLTSIZE 0x02e8 /* BitBLT width and height */ 1868c2ecf20Sopenharmony_ci#define BLTROP 0x02ec /* BitBLT Raster operations */ 1878c2ecf20Sopenharmony_ci# define BLTROP_COPY 0x0cccc 1888c2ecf20Sopenharmony_ci# define BLTROP_INVERT 0x05555 1898c2ecf20Sopenharmony_ci# define BLTROP_XOR 0x06666 1908c2ecf20Sopenharmony_ci#define BLTCOLOR 0x02f0 /* BitBLT and foreground background colors */ 1918c2ecf20Sopenharmony_ci#define BLTCOMMAND 0x02f8 /* BitBLT command mode (v2 specific) */ 1928c2ecf20Sopenharmony_ci# define BLT_SCR2SCR_BITBLT 0 /* Screen-to-Screen BitBLT */ 1938c2ecf20Sopenharmony_ci# define BLT_CPU2SCR_BITBLT 1 /* CPU-to-screen BitBLT */ 1948c2ecf20Sopenharmony_ci# define BLT_RECFILL_BITBLT 2 /* BitBLT Rectangle Fill */ 1958c2ecf20Sopenharmony_ci# define BLT_16BPP_FMT 2 /* 16 BPP (5-6-5 RGB) */ 1968c2ecf20Sopenharmony_ci#define BLTDATA 0x02fc /* BitBLT data for CPU-to-Screen BitBLTs */ 1978c2ecf20Sopenharmony_ci# define LAUNCH_BITBLT BIT(31) /* Launch BitBLT in BltCommand, bltDstXY or bltSize */ 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci/* Dac Registers */ 2008c2ecf20Sopenharmony_ci#define DACREG_WMA 0x0 /* pixel write mode address */ 2018c2ecf20Sopenharmony_ci#define DACREG_LUT 0x01 /* color value */ 2028c2ecf20Sopenharmony_ci#define DACREG_RMR 0x02 /* pixel mask */ 2038c2ecf20Sopenharmony_ci#define DACREG_RMA 0x03 /* pixel read mode address */ 2048c2ecf20Sopenharmony_ci/*Dac registers in indexed mode (TI, ATT dacs) */ 2058c2ecf20Sopenharmony_ci#define DACREG_ADDR_I DACREG_WMA 2068c2ecf20Sopenharmony_ci#define DACREG_DATA_I DACREG_RMR 2078c2ecf20Sopenharmony_ci#define DACREG_RMR_I 0x00 2088c2ecf20Sopenharmony_ci#define DACREG_CR0_I 0x01 2098c2ecf20Sopenharmony_ci# define DACREG_CR0_EN_INDEXED BIT(0) /* enable indexec mode */ 2108c2ecf20Sopenharmony_ci# define DACREG_CR0_8BIT BIT(1) /* set dac to 8 bits/read */ 2118c2ecf20Sopenharmony_ci# define DACREG_CR0_PWDOWN BIT(3) /* powerdown dac */ 2128c2ecf20Sopenharmony_ci# define DACREG_CR0_16BPP 0x30 /* mode 3 */ 2138c2ecf20Sopenharmony_ci# define DACREG_CR0_24BPP 0x50 /* mode 5 */ 2148c2ecf20Sopenharmony_ci#define DACREG_CR1_I 0x05 2158c2ecf20Sopenharmony_ci#define DACREG_CC_I 0x06 2168c2ecf20Sopenharmony_ci# define DACREG_CC_CLKA BIT(7) /* clk A controlled by regs */ 2178c2ecf20Sopenharmony_ci# define DACREG_CC_CLKA_C (2<<4) /* clk A uses reg C */ 2188c2ecf20Sopenharmony_ci# define DACREG_CC_CLKB BIT(3) /* clk B controlled by regs */ 2198c2ecf20Sopenharmony_ci# define DACREG_CC_CLKB_D 3 /* clkB uses reg D */ 2208c2ecf20Sopenharmony_ci#define DACREG_AC0_I 0x48 /* clock A reg C */ 2218c2ecf20Sopenharmony_ci#define DACREG_AC1_I 0x49 2228c2ecf20Sopenharmony_ci#define DACREG_BD0_I 0x6c /* clock B reg D */ 2238c2ecf20Sopenharmony_ci#define DACREG_BD1_I 0x6d 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* identification constants */ 2268c2ecf20Sopenharmony_ci#define DACREG_MIR_TI 0x97 2278c2ecf20Sopenharmony_ci#define DACREG_DIR_TI 0x09 2288c2ecf20Sopenharmony_ci#define DACREG_MIR_ATT 0x84 2298c2ecf20Sopenharmony_ci#define DACREG_DIR_ATT 0x09 2308c2ecf20Sopenharmony_ci/* ics dac specific registers */ 2318c2ecf20Sopenharmony_ci#define DACREG_ICS_PLLWMA 0x04 /* PLL write mode address */ 2328c2ecf20Sopenharmony_ci#define DACREG_ICS_PLLDATA 0x05 /* PLL data /parameter */ 2338c2ecf20Sopenharmony_ci#define DACREG_ICS_CMD 0x06 /* command */ 2348c2ecf20Sopenharmony_ci# define DACREG_ICS_CMD_16BPP 0x50 /* ics color mode 6 (16bpp bypass)*/ 2358c2ecf20Sopenharmony_ci# define DACREG_ICS_CMD_24BPP 0x70 /* ics color mode 7 (24bpp bypass)*/ 2368c2ecf20Sopenharmony_ci# define DACREG_ICS_CMD_PWDOWN BIT(0) /* powerdown dac */ 2378c2ecf20Sopenharmony_ci#define DACREG_ICS_PLLRMA 0x07 /* PLL read mode address */ 2388c2ecf20Sopenharmony_ci/* 2398c2ecf20Sopenharmony_ci * pll parameter register: 2408c2ecf20Sopenharmony_ci * indexed : write addr to PLLWMA, write data in PLLDATA. 2418c2ecf20Sopenharmony_ci * for reads use PLLRMA . 2428c2ecf20Sopenharmony_ci * 8 freq registers (0-7) for video clock (CLK0) 2438c2ecf20Sopenharmony_ci * 2 freq registers (a-b) for graphic clock (CLK1) 2448c2ecf20Sopenharmony_ci */ 2458c2ecf20Sopenharmony_ci#define DACREG_ICS_PLL_CLK0_1_INI 0x55 /* initial pll M value for freq f1 */ 2468c2ecf20Sopenharmony_ci#define DACREG_ICS_PLL_CLK0_7_INI 0x71 /* f7 */ 2478c2ecf20Sopenharmony_ci#define DACREG_ICS_PLL_CLK1_B_INI 0x79 /* fb */ 2488c2ecf20Sopenharmony_ci#define DACREG_ICS_PLL_CTRL 0x0e 2498c2ecf20Sopenharmony_ci# define DACREG_ICS_CLK0 BIT(5) 2508c2ecf20Sopenharmony_ci# define DACREG_ICS_CLK0_0 0 2518c2ecf20Sopenharmony_ci# define DACREG_ICS_CLK1_A 0 /* bit4 */ 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci/* sst default init registers */ 2548c2ecf20Sopenharmony_ci#define FBIINIT0_DEFAULT DIS_VGA_PASSTHROUGH 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#define FBIINIT1_DEFAULT \ 2578c2ecf20Sopenharmony_ci ( \ 2588c2ecf20Sopenharmony_ci FAST_PCI_WRITES \ 2598c2ecf20Sopenharmony_ci/* SLOW_PCI_WRITES*/ \ 2608c2ecf20Sopenharmony_ci | VIDEO_RESET \ 2618c2ecf20Sopenharmony_ci | 10 << TILES_IN_X_SHIFT\ 2628c2ecf20Sopenharmony_ci | SEL_SOURCE_VCLK_2X_SEL\ 2638c2ecf20Sopenharmony_ci | EN_LFB_READ \ 2648c2ecf20Sopenharmony_ci ) 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci#define FBIINIT2_DEFAULT \ 2678c2ecf20Sopenharmony_ci ( \ 2688c2ecf20Sopenharmony_ci SWAP_DACVSYNC \ 2698c2ecf20Sopenharmony_ci | EN_DRAM_OE \ 2708c2ecf20Sopenharmony_ci | DRAM_REFRESH_16 \ 2718c2ecf20Sopenharmony_ci | EN_DRAM_REFRESH \ 2728c2ecf20Sopenharmony_ci | EN_FAST_RAS_READ \ 2738c2ecf20Sopenharmony_ci | EN_RD_AHEAD_FIFO \ 2748c2ecf20Sopenharmony_ci | EN_FAST_RD_AHEAD_WR \ 2758c2ecf20Sopenharmony_ci ) 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci#define FBIINIT3_DEFAULT \ 2788c2ecf20Sopenharmony_ci ( DISABLE_TEXTURE ) 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci#define FBIINIT4_DEFAULT \ 2818c2ecf20Sopenharmony_ci ( \ 2828c2ecf20Sopenharmony_ci FAST_PCI_READS \ 2838c2ecf20Sopenharmony_ci/* SLOW_PCI_READS*/ \ 2848c2ecf20Sopenharmony_ci | LFB_READ_AHEAD \ 2858c2ecf20Sopenharmony_ci ) 2868c2ecf20Sopenharmony_ci/* Careful with this one : writing back the data just read will trash the DAC 2878c2ecf20Sopenharmony_ci reading some fields give logic value on pins, but setting this field will 2888c2ecf20Sopenharmony_ci set the source signal driving the pin. conclusion : just use the default 2898c2ecf20Sopenharmony_ci as a base before writing back . 2908c2ecf20Sopenharmony_ci*/ 2918c2ecf20Sopenharmony_ci#define FBIINIT6_DEFAULT (0x0) 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci/* 2948c2ecf20Sopenharmony_ci * 2958c2ecf20Sopenharmony_ci * Misc Const 2968c2ecf20Sopenharmony_ci * 2978c2ecf20Sopenharmony_ci */ 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* ioctl to enable/disable VGA passthrough */ 3008c2ecf20Sopenharmony_ci#define SSTFB_SET_VGAPASS _IOW('F', 0xdd, __u32) 3018c2ecf20Sopenharmony_ci#define SSTFB_GET_VGAPASS _IOR('F', 0xdd, __u32) 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci/* used to know witch clock to set */ 3058c2ecf20Sopenharmony_cienum { 3068c2ecf20Sopenharmony_ci VID_CLOCK=0, 3078c2ecf20Sopenharmony_ci GFX_CLOCK=1, 3088c2ecf20Sopenharmony_ci}; 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci/* freq max */ 3118c2ecf20Sopenharmony_ci#define DAC_FREF 14318 /* DAC reference freq (Khz) */ 3128c2ecf20Sopenharmony_ci#define VCO_MAX 260000 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci/* 3158c2ecf20Sopenharmony_ci * driver structs 3168c2ecf20Sopenharmony_ci */ 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistruct pll_timing { 3198c2ecf20Sopenharmony_ci unsigned int m; 3208c2ecf20Sopenharmony_ci unsigned int n; 3218c2ecf20Sopenharmony_ci unsigned int p; 3228c2ecf20Sopenharmony_ci}; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_cistruct dac_switch { 3258c2ecf20Sopenharmony_ci const char *name; 3268c2ecf20Sopenharmony_ci int (*detect) (struct fb_info *info); 3278c2ecf20Sopenharmony_ci int (*set_pll) (struct fb_info *info, const struct pll_timing *t, const int clock); 3288c2ecf20Sopenharmony_ci void (*set_vidmod) (struct fb_info *info, const int bpp); 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistruct sst_spec { 3328c2ecf20Sopenharmony_ci char * name; 3338c2ecf20Sopenharmony_ci int default_gfx_clock; /* 50000 for voodoo1, 75000 for voodoo2 */ 3348c2ecf20Sopenharmony_ci int max_gfxclk; /* ! in Mhz ie 60 for voodoo 1 */ 3358c2ecf20Sopenharmony_ci}; 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_cistruct sstfb_par { 3388c2ecf20Sopenharmony_ci u32 palette[16]; 3398c2ecf20Sopenharmony_ci unsigned int yDim; 3408c2ecf20Sopenharmony_ci unsigned int hSyncOn; /* hsync_len */ 3418c2ecf20Sopenharmony_ci unsigned int hSyncOff; /* left_margin + xres + right_margin */ 3428c2ecf20Sopenharmony_ci unsigned int hBackPorch;/* left_margin */ 3438c2ecf20Sopenharmony_ci unsigned int vSyncOn; 3448c2ecf20Sopenharmony_ci unsigned int vSyncOff; 3458c2ecf20Sopenharmony_ci unsigned int vBackPorch; 3468c2ecf20Sopenharmony_ci struct pll_timing pll; 3478c2ecf20Sopenharmony_ci unsigned int tiles_in_X;/* num of tiles in X res */ 3488c2ecf20Sopenharmony_ci u8 __iomem *mmio_vbase; 3498c2ecf20Sopenharmony_ci struct dac_switch dac_sw; /* dac specific functions */ 3508c2ecf20Sopenharmony_ci struct pci_dev *dev; 3518c2ecf20Sopenharmony_ci int type; 3528c2ecf20Sopenharmony_ci u8 revision; 3538c2ecf20Sopenharmony_ci u8 vgapass; /* VGA pass through: 1=enabled, 0=disabled */ 3548c2ecf20Sopenharmony_ci}; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci#endif /* _SSTFB_H_ */ 357