blob: e6da2d7ded8cfa7a0a5c1d16ae1e732b98af996a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Support for the w100 frame buffer.
3 *
Richard Purdieaac51f02005-09-06 15:19:03 -07004 * Copyright (c) 2004-2005 Richard Purdie
5 * Copyright (c) 2005 Ian Molton
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
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.
10 */
11
Richard Purdieaac51f02005-09-06 15:19:03 -070012#define W100_GPIO_PORT_A 0
13#define W100_GPIO_PORT_B 1
14
15#define CLK_SRC_XTAL 0
16#define CLK_SRC_PLL 1
17
18struct w100fb_par;
19
20unsigned long w100fb_gpio_read(int port);
21void w100fb_gpio_write(int port, unsigned long value);
22
23/* LCD Specific Routines and Config */
24struct w100_tg_info {
25 void (*change)(struct w100fb_par*);
26 void (*suspend)(struct w100fb_par*);
27 void (*resume)(struct w100fb_par*);
28};
29
30/* General Platform Specific w100 Register Values */
31struct w100_gen_regs {
32 unsigned long lcd_format;
33 unsigned long lcdd_cntl1;
34 unsigned long lcdd_cntl2;
35 unsigned long genlcd_cntl1;
36 unsigned long genlcd_cntl2;
37 unsigned long genlcd_cntl3;
38};
39
40struct w100_gpio_regs {
41 unsigned long init_data1;
42 unsigned long init_data2;
43 unsigned long gpio_dir1;
44 unsigned long gpio_oe1;
45 unsigned long gpio_dir2;
46 unsigned long gpio_oe2;
47};
48
49/* Optional External Memory Configuration */
50struct w100_mem_info {
51 unsigned long ext_cntl;
52 unsigned long sdram_mode_reg;
53 unsigned long ext_timing_cntl;
54 unsigned long io_cntl;
55 unsigned int size;
56};
57
58struct w100_bm_mem_info {
59 unsigned long ext_mem_bw;
60 unsigned long offset;
61 unsigned long ext_timing_ctl;
62 unsigned long ext_cntl;
63 unsigned long mode_reg;
64 unsigned long io_cntl;
65 unsigned long config;
66};
67
68/* LCD Mode definition */
69struct w100_mode {
70 unsigned int xres;
71 unsigned int yres;
72 unsigned short left_margin;
73 unsigned short right_margin;
74 unsigned short upper_margin;
75 unsigned short lower_margin;
76 unsigned long crtc_ss;
77 unsigned long crtc_ls;
78 unsigned long crtc_gs;
79 unsigned long crtc_vpos_gs;
80 unsigned long crtc_rev;
81 unsigned long crtc_dclk;
82 unsigned long crtc_gclk;
83 unsigned long crtc_goe;
84 unsigned long crtc_ps1_active;
85 char pll_freq;
86 char fast_pll_freq;
87 int sysclk_src;
88 int sysclk_divider;
89 int pixclk_src;
90 int pixclk_divider;
91 int pixclk_divider_rotated;
92};
93
94struct w100_pll_info {
95 uint16_t freq; /* desired Fout for PLL (Mhz) */
96 uint8_t M; /* input divider */
97 uint8_t N_int; /* VCO multiplier */
98 uint8_t N_fac; /* VCO multiplier fractional part */
99 uint8_t tfgoal;
100 uint8_t lock_time;
101};
102
103/* Initial Video mode orientation flags */
104#define INIT_MODE_ROTATED 0x1
105#define INIT_MODE_FLIPPED 0x2
106
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107/*
108 * This structure describes the machine which we are running on.
109 * It is set by machine specific code and used in the probe routine
110 * of drivers/video/w100fb.c
111 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112struct w100fb_mach_info {
Richard Purdieaac51f02005-09-06 15:19:03 -0700113 /* General Platform Specific Registers */
114 struct w100_gen_regs *regs;
115 /* Table of modes the LCD is capable of */
116 struct w100_mode *modelist;
117 unsigned int num_modes;
118 /* Hooks for any platform specific tg/lcd code (optional) */
119 struct w100_tg_info *tg;
120 /* External memory definition (if present) */
121 struct w100_mem_info *mem;
122 /* Additional External memory definition (if present) */
123 struct w100_bm_mem_info *bm_mem;
124 /* GPIO definitions (optional) */
125 struct w100_gpio_regs *gpio;
126 /* Initial Mode flags */
127 unsigned int init_mode;
128 /* Xtal Frequency */
129 unsigned int xtal_freq;
130 /* Enable Xtal input doubler (1 == enable) */
131 unsigned int xtal_dbl;
132};
133
134/* General frame buffer data structure */
135struct w100fb_par {
136 unsigned int chip_id;
137 unsigned int xres;
138 unsigned int yres;
139 unsigned int extmem_active;
140 unsigned int flip;
141 unsigned int blanked;
142 unsigned int fastpll_mode;
143 unsigned long hsync_len;
144 struct w100_mode *mode;
145 struct w100_pll_info *pll_table;
146 struct w100fb_mach_info *mach;
147 uint32_t *saved_intmem;
148 uint32_t *saved_extmem;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149};