sync hh.org
[hh.org.git] / include / video / w100fb.h
bloba7157eae194573e0eb8f895112137d6eaf069dcd
1 /*
2 * Support for the w100 frame buffer.
4 * Copyright (c) 2004-2005 Richard Purdie
5 * Copyright (c) 2005 Ian Molton
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #define W100_GPIO_PORT_A 0
13 #define W100_GPIO_PORT_B 1
15 #define CLK_SRC_XTAL 0
16 #define CLK_SRC_PLL 1
18 struct w100fb_par;
20 unsigned long w100fb_gpio_read(int port);
21 void w100fb_gpio_write(int port, unsigned long value);
22 unsigned long w100fb_gpcntl_read(int port);
23 void w100fb_gpcntl_write(int port, unsigned long value);
24 unsigned long w100fb_get_hsynclen(struct device *dev);
26 /* LCD Specific Routines and Config */
27 struct w100_tg_info {
28 void (*change)(struct w100fb_par*);
29 void (*suspend)(struct w100fb_par*);
30 void (*resume)(struct w100fb_par*);
33 /* General Platform Specific w100 Register Values */
34 struct w100_gen_regs {
35 unsigned long lcd_format;
36 unsigned long lcdd_cntl1;
37 unsigned long lcdd_cntl2;
38 unsigned long genlcd_cntl1;
39 unsigned long genlcd_cntl2;
40 unsigned long genlcd_cntl3;
43 struct w100_gpio_regs {
44 unsigned long init_data1;
45 unsigned long init_data2;
46 unsigned long gpio_dir1;
47 unsigned long gpio_oe1;
48 unsigned long gpio_dir2;
49 unsigned long gpio_oe2;
52 /* Optional External Memory Configuration */
53 struct w100_mem_info {
54 unsigned long ext_cntl;
55 unsigned long sdram_mode_reg;
56 unsigned long ext_timing_cntl;
57 unsigned long io_cntl;
58 unsigned int size;
61 struct w100_bm_mem_info {
62 unsigned long ext_mem_bw;
63 unsigned long offset;
64 unsigned long ext_timing_ctl;
65 unsigned long ext_cntl;
66 unsigned long mode_reg;
67 unsigned long io_cntl;
68 unsigned long config;
71 /* LCD Mode definition */
72 struct w100_mode {
73 unsigned int xres;
74 unsigned int yres;
75 unsigned short left_margin;
76 unsigned short right_margin;
77 unsigned short upper_margin;
78 unsigned short lower_margin;
79 unsigned long crtc_ss;
80 unsigned long crtc_ls;
81 unsigned long crtc_gs;
82 unsigned long crtc_vpos_gs;
83 unsigned long crtc_rev;
84 unsigned long crtc_dclk;
85 unsigned long crtc_gclk;
86 unsigned long crtc_goe;
87 unsigned long crtc_ps1_active;
88 char pll_freq;
89 char fast_pll_freq;
90 int sysclk_src;
91 int sysclk_divider;
92 int pixclk_src;
93 int pixclk_divider;
94 int pixclk_divider_rotated;
97 struct w100_pll_info {
98 uint16_t freq; /* desired Fout for PLL (Mhz) */
99 uint8_t M; /* input divider */
100 uint8_t N_int; /* VCO multiplier */
101 uint8_t N_fac; /* VCO multiplier fractional part */
102 uint8_t tfgoal;
103 uint8_t lock_time;
106 /* Initial Video mode orientation flags */
107 #define INIT_MODE_ROTATED 0x1
108 #define INIT_MODE_FLIPPED 0x2
111 * This structure describes the machine which we are running on.
112 * It is set by machine specific code and used in the probe routine
113 * of drivers/video/w100fb.c
115 struct w100fb_mach_info {
116 /* General Platform Specific Registers */
117 struct w100_gen_regs *regs;
118 /* Table of modes the LCD is capable of */
119 struct w100_mode *modelist;
120 unsigned int num_modes;
121 /* Hooks for any platform specific tg/lcd code (optional) */
122 struct w100_tg_info *tg;
123 /* External memory definition (if present) */
124 struct w100_mem_info *mem;
125 /* Additional External memory definition (if present) */
126 struct w100_bm_mem_info *bm_mem;
127 /* GPIO definitions (optional) */
128 struct w100_gpio_regs *gpio;
129 /* Initial Mode flags */
130 unsigned int init_mode;
131 /* Xtal Frequency */
132 unsigned int xtal_freq;
133 /* Enable Xtal input doubler (1 == enable) */
134 unsigned int xtal_dbl;
137 /* General frame buffer data structure */
138 struct w100fb_par {
139 unsigned int chip_id;
140 unsigned int xres;
141 unsigned int yres;
142 unsigned int extmem_active;
143 unsigned int flip;
144 unsigned int blanked;
145 unsigned int fastpll_mode;
146 unsigned long hsync_len;
147 struct w100_mode *mode;
148 struct w100_pll_info *pll_table;
149 struct w100fb_mach_info *mach;
150 uint32_t *saved_intmem;
151 uint32_t *saved_extmem;