#define CFREG_REV 0x0000
#define CR_REV_MASK 0x03
#define CR_REV_SHIFT 0
#define CR_PRODUCT_MASK 0xfc
#define CR_PRODUCT_SHIFT 2
#define PRODUCT_S1D13806 0x07
#define CFREG_MISC 0x0001
#define CM_MEMSEL 0x00
#define CM_REGSEL 0x80
#define CFREG_GPIO_CONF 0x0004
#define CFREG_GPIO_CTRL 0x0008
#define CFREG_STATUS 0x000c
#define CFREG_MEMCLK 0x0010
#define MEMCLK_DIVIDE 0x10
#define MEMCLK_SRC_CLKI 0x00
#define MEMCLK_SRC_BUSCLK 0x01
#define MEMCLK_SRC_CLK3 0x02
#define CFREG_LCD_PCLK 0x0014
#define LCD_PCLK_SRC_CLKI 0x00
#define LCD_PCLK_SRC_BUSCLK 0x01
#define LCD_PCLK_SRC_CLKI2 0x02
#define LCD_PCLK_SRC_MCLK 0x03
#define LCD_PCLK_DIV_1 0x00
#define LCD_PCLK_DIV_2 0x10
#define LCD_PCLK_DIV_3 0x20
#define LCD_PCLK_DIV_4 0x30
#define CFREG_CRTTV_PCLK 0x0018
#define CRT_PCLK_SRC_CLKI 0x00
#define CRT_PCLK_SRC_BUSCLK 0x01
#define CRT_PCLK_SRC_CLKI2 0x02
#define CRT_PCLK_SRC_MCLK 0x03
#define CRT_PCLK_DIV_1 0x00
#define CRT_PCLK_DIV_2 0x10
#define CRT_PCLK_DIV_3 0x20
#define CRT_PCLK_DIV_4 0x30
#define CRT_PCLK_DOUBLE 0x80
#define CFREG_MPLUG_CLK 0x001c
#define MPLUG_PCLK_SRC_CLKI 0x00
#define MPLUG_PCLK_SRC_BUSCLK 0x01
#define MPLUG_PCLK_SRC_CLKI2 0x02
#define MPLUG_PCLK_SRC_MCLK 0x03
#define MPLUG_PCLK_DIV_1 0x00
#define MPLUG_PCLK_DIV_2 0x10
#define MPLUG_PCLK_DIV_3 0x20
#define MPLUG_PCLK_DIV_4 0x30
#define CFREG_WSTATE 0x001e
#define WSTATE_NONE 0x00
#define WSTATE_DUAL_MCLK 0x01
#define WSTATE_MCLK 0x02
#define CFREG_MEMCNF 0x0020
#define MEMCNF_SDRAM_INIT 0x80
#define CFREG_DRAM_RFRSH 0x0021
#define DRAM_RFRSH_8MHZ 0x00
#define DRAM_RFRSH_16MHZ 0x01
#define DRAM_RFRSH_32MHZ 0x02
#define DRAM_RFRSH_50MHZ 0x03
#define CFREG_DRAM_TIMING 0x002a
#define DRAM_TIMING_33MHZ 0x0311
#define DRAM_TIMING_44MHZ 0x0200
#define DRAM_TIMING_50MHZ 0x0100
#define CFREG_PANEL 0x0030
#define PANEL_PASSIVE 0x00
#define PANEL_TFT 0x01
#define PANEL_SINGLE 0x00
#define PANEL_DUAL 0x02
#define PANEL_MONO 0x00
#define PANEL_COLOR 0x04
#define PANEL_FORMAT_1X 0x00
#define PANEL_FORMAT_2X 0x08
#define PANEL_WIDTH_4_9 0x00
#define PANEL_WIDTH_8_12 0x10
#define PANEL_WIDTH_16_18 0x20
#define CFREG_MODRATE 0x0031
#define CFREG_LCD_HWIDTH 0x0032
#define CFREG_LCD_HNDISP 0x0034
#define CFREG_TFT_FPLINE_START 0x0035
#define CFREG_TFT_FPLINE_WIDTH 0x0036
#define TFT_FPLINE_POL_TFT_LOW 0x00
#define TFT_FPLINE_POL_TFT_HIGH 0x80
#define TFT_FPLINE_POL_PASSIVE_LOW 0x80
#define TFT_FPLINE_POL_PASSIVE_HIGH 0x00
#define CFREG_LCD_VHEIGHT 0x0038
#define CFREG_LCD_VNDISP 0x003a
#define LCD_VNDISP_STATUS 0x80
#define CFREG_TFT_FPFRAME_START 0x003b
#define CFREG_TFT_FPFRAME_WIDTH 0x003c
#define TFT_FPFRAME_POL_TFT_LOW 0x00
#define TFT_FPFRAME_POL_TFT_HIGH 0x80
#define TFT_FPFRAME_POL_PASSIVE_LOW 0x80
#define TFT_FPFRAME_POL_PASSIVE_HIGH 0x00
#define CFREG_LCD_LINECNT 0x003e
#define CFREG_LCD_MODE 0x0040
#define LCD_MODE_4BPP 0x02
#define LCD_MODE_8BPP 0x03
#define LCD_MODE_15BPP 0x04
#define LCD_MODE_16BPP 0x05
#define LCD_MODE_SWIVEL_BIT1 0x10
#define LCD_MODE_BLANK 0x80
#define CFREG_LCD_MISC 0x0041
#define LCD_MISC_DUAL_PANEL_BUFFER_DISABLE 0x01
#define LCD_MISC_DITHERING_DISABLE 0x02
#define CFREG_LCD_START_LOW 0x0042
#define CFREG_LCD_START_HIGH 0x0044
#define CFREG_LCD_MEMORY 0x0046
#define CFREG_LCD_PANNING 0x0048
#define PIXEL_PANNING_MASK_4BPP 0x03
#define PIXEL_PANNING_MASK_8BPP 0x01
#define PIXEL_PANNING_MASK_15BPP 0x00
#define PIXEL_PANNING_MASK_16BPP 0x00
#define CFREG_LCD_FIFO_THRESHOLD_HIGH 0x004a
#define CFREG_LCD_FIFO_THRESHOLD_LOW 0x004b
#define CFREG_CRT_HWIDTH 0x0050
#define CFREG_CRT_HNDISP 0x0052
#define CFREG_CRT_HSTART 0x0053
#define CFREG_CRT_HPULSE 0x0054
#define HRTC_POLARITY 0x80
#define CFREG_CRT_VHEIGHT 0x0056
#define CFREG_CRT_VNDISP 0x0058
#define CRT_VNDISP_STATUS 0x80
#define CFREG_CRT_VSTART 0x0059
#define CFREG_CRT_VPULSE 0x005a
#define CFREG_TV_CONTROL 0x005b
#define TV_NTSC_OUTPUT 0x00
#define TV_PAL_OUTPUT 0x01
#define TV_COMPOSITE_OUTPUT 0x00
#define TV_SVIDEO_OUTPUT 0x02
#define TV_DAC_OUTPUT_HIGH 0x00
#define TV_DAC_OUTPUT_LOW 0x08
#define TV_LUMINANCE_FILTER 0x10
#define TV_CHROMINANCE_FILTER 0x20
#define CFREG_CRT_LINECNT 0x005e
#define CFREG_CRT_MODE 0x0060
#define CRT_MODE_4BPP 0x02
#define CRT_MODE_8BPP 0x03
#define CRT_MODE_15BPP 0x04
#define CRT_MODE_16BPP 0x05
#define CRT_MODE_BLANK 0x80
#define CFREG_CRT_START_LOW 0x0062
#define CFREG_CRT_START_HIGH 0x0064
#define CFREG_CRT_MEMORY 0x0066
#define CFREG_CRT_PANNING 0x0068
#define CFREG_CRT_FIFO_THRESHOLD_HIGH 0x006a
#define CFREG_CRT_FIFO_THRESHOLD_LOW 0x006b
#define CFREG_LCD_CURSOR_CONTROL 0x0070
#define CURSOR_INACTIVE 0x00
#define CURSOR_CURSOR 0x01
#define CURSOR_INK 0x02
#define CFREG_LCD_CURSOR_ADDRESS 0x0071
#define CFREG_LCD_CURSOR_X 0x0072
#define LCD_CURSOR_X_SIGN 0x8000
#define CFREG_LCD_CURSOR_Y 0x0074
#define LCD_CURSOR_Y_SIGN 0x8000
#define CFREG_LCD_CURSOR_B0 0x0076
#define CFREG_LCD_CURSOR_G0 0x0077
#define CFREG_LCD_CURSOR_R0 0x0078
#define CFREG_LCD_CURSOR_B1 0x007a
#define CFREG_LCD_CURSOR_G1 0x007b
#define CFREG_LCD_CURSOR_R1 0x007c
#define CFREG_LCD_CURSOR_FIFO 0x007e
#define CFREG_CRT_CURSOR_CONTROL 0x0080
#define CFREG_CRT_CURSOR_ADDRESS 0x0081
#define CFREG_CRT_CURSOR_X 0x0082
#define CRT_CURSOR_X_SIGN 0x8000
#define CFREG_CRT_CURSOR_Y 0x0084
#define CRT_CURSOR_Y_SIGN 0x8000
#define CFREG_CRT_CURSOR_B0 0x0086
#define CFREG_CRT_CURSOR_G0 0x0087
#define CFREG_CRT_CURSOR_R0 0x0088
#define CFREG_CRT_CURSOR_B1 0x008a
#define CFREG_CRT_CURSOR_G1 0x008b
#define CFREG_CRT_CURSOR_R1 0x008c
#define CFREG_CRT_CURSOR_FIFO 0x008e
#define CFREG_BITBLT_CONTROL 0x0100
#define BITBLT_SRC_LINEAR 0x0001
#define BITBLT_DST_LINEAR 0x0002
#define BITBLT_FIFO_FULL 0x0010
#define BITBLT_FIFO_HALF_FULL 0x0020
#define BITBLT_FIFO_NOT_EMPTY 0x0040
#define BITBLT_ACTIVE 0x0080
#define BITBLT_COLOR_8 0x0000
#define BITBLT_COLOR_16 0x0100
#define CFREG_BITBLT_ROP 0x0102
#define CFREG_COLOR_EXPANSION 0x0102
#define ROP_ZERO 0x00
#define ROP_DST 0x0a
#define ROP_SRC 0x0c
#define ROP_ONES 0x0f
#define CFREG_BITBLT_OPERATION 0x103
#define OP_WRITE_ROP 0x00
#define OP_READ 0x01
#define OP_MOVE_POSITIVE_ROP 0x02
#define OP_MOVE_NEGATIVE_ROP 0x03
#define OP_TRANSPARENT_WRITE 0x04
#define OP_TRANSPARENT_MOVE_POSITIVE 0x05
#define OP_PATTERN_FILL_ROP 0x06
#define OP_PATTERN_FILL_TRANSPARENCY 0x07
#define OP_COLOR_EXPANSION 0x08
#define OP_COLOR_EXPANSION_TRANSPARENCY 0x09
#define OP_MOVE_COLOR_EXPANSION 0x0a
#define OP_MOVE_COLOR_EXPANSION_TRANSPARENCY 0x0b
#define OP_SOLID_FILL 0x0c
#define CFREG_BITBLT_SRC_LOW 0x104
#define CFREG_BITBLT_SRC_HIGH 0x106
#define CFREG_BITBLT_DST_LOW 0x108
#define CFREG_BITBLT_DST_HIGH 0x10a
#define CFREG_BITBLT_OFFSET 0x10c
#define CFREG_BITBLT_WIDTH 0x110
#define CFREG_BITBLT_HEIGHT 0x112
#define CFREG_BITBLT_BG 0x114
#define CFREG_BITBLT_FG 0x118
#define CFREG_LUT_MODE 0x1e0
#define LUT_BOTH 0x00
#define LUT_LCD 0x01
#define LUT_CRT 0x02
#define CFREG_LUT_ADDRESS 0x1e2
#define CFREG_LUT_DATA 0x1e4
#define CFREG_POWER_CONF 0x1f0
#define POWERSAVE_ENABLE 0x01
#define POWERSAVE_MBO 0x10
#define CFREG_POWER_STATUS 0x1f1
#define POWERSAVE_STATUS 0x01
#define LCD_POWERSAVE_STATUS 0x02
#define CFREG_WATCHDOG 0x1f4
#define CFREG_MODE 0x1fc
#define MODE_NO_DISPLAY 0x00
#define MODE_LCD 0x01
#define MODE_CRT 0x02
#define MODE_TV_NO_FLICKER 0x04
#define MODE_TV_FLICKER 0x06
#define LCD_MODE_SWIVEL_BIT_0 0x40
#define CFREG_BITBLT_DATA 0x0400
#ifdef _KERNEL
#define CFXGA_MEM_RANGE 0x0800
#endif