1 /*
2  * controlfb_hw.h: Constants of all sorts for controlfb
3  *
4  * Copyright (C) 1998 Daniel Jacobowitz <dan@debian.org>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  *
11  * Based on an awful lot of code, including:
12  *
13  * control.c: Console support for PowerMac "control" display adaptor.
14  * Copyright (C) 1996 Paul Mackerras.
15  *
16  * The so far unpublished platinumfb.c
17  * Copyright (C) 1998 Jon Howell
18  */
19 
20 /*
21  * Structure of the registers for the RADACAL colormap device.
22  */
23 struct cmap_regs {
24 	unsigned char addr;	/* index for both cmap and misc registers */
25 	char pad1[15];
26 	unsigned char crsr;	/* cursor palette */
27 	char pad2[15];
28 	unsigned char dat;	/* RADACAL misc register data */
29 	char pad3[15];
30 	unsigned char lut;	/* cmap data */
31 	char pad4[15];
32 };
33 
34 /*
35  * Structure of the registers for the "control" display adaptor.
36  */
37 #define PAD(x)	char x[12]
38 
39 struct preg {			/* padded register */
40 	unsigned r;
41 	char pad[12];
42 };
43 
44 struct control_regs {
45 	struct preg vcount;	/* vertical counter */
46 	/* Vertical parameters are in units of 1/2 scan line */
47 	struct preg vswin;	/* between vsblank and vssync */
48 	struct preg vsblank;	/* vert start blank */
49 	struct preg veblank;	/* vert end blank (display start) */
50 	struct preg vewin;	/* between vesync and veblank */
51 	struct preg vesync;	/* vert end sync */
52 	struct preg vssync;	/* vert start sync */
53 	struct preg vperiod;	/* vert period */
54 	struct preg piped;	/* pipe delay hardware cursor */
55 	/* Horizontal params are in units of 2 pixels */
56 	struct preg hperiod;	/* horiz period - 2 */
57 	struct preg hsblank;	/* horiz start blank */
58 	struct preg heblank;	/* horiz end blank */
59 	struct preg hesync;	/* horiz end sync */
60 	struct preg hssync;	/* horiz start sync */
61 	struct preg heq;	/* half horiz sync len */
62 	struct preg hlfln;	/* half horiz period */
63 	struct preg hserr;	/* horiz period - horiz sync len */
64 	struct preg cnttst;
65 	struct preg ctrl;	/* display control */
66 	struct preg start_addr;	/* start address: 5 lsbs zero */
67 	struct preg pitch;	/* addrs diff between scan lines */
68 	struct preg mon_sense;	/* monitor sense bits */
69 	struct preg vram_attr;	/* enable vram banks */
70 	struct preg mode;
71 	struct preg rfrcnt;	/* refresh count */
72 	struct preg intr_ena;	/* interrupt enable */
73 	struct preg intr_stat;	/* interrupt status */
74 	struct preg res[5];
75 };
76 
77 struct control_regints {
78 	/* Vertical parameters are in units of 1/2 scan line */
79 	unsigned vswin;	/* between vsblank and vssync */
80 	unsigned vsblank;	/* vert start blank */
81 	unsigned veblank;	/* vert end blank (display start) */
82 	unsigned vewin;	/* between vesync and veblank */
83 	unsigned vesync;	/* vert end sync */
84 	unsigned vssync;	/* vert start sync */
85 	unsigned vperiod;	/* vert period */
86 	unsigned piped;		/* pipe delay hardware cursor */
87 	/* Horizontal params are in units of 2 pixels */
88 	/* Except, apparently, for hres > 1024 (or == 1280?) */
89 	unsigned hperiod;	/* horiz period - 2 */
90 	unsigned hsblank;	/* horiz start blank */
91 	unsigned heblank;	/* horiz end blank */
92 	unsigned hesync;	/* horiz end sync */
93 	unsigned hssync;	/* horiz start sync */
94 	unsigned heq;		/* half horiz sync len */
95 	unsigned hlfln;		/* half horiz period */
96 	unsigned hserr;		/* horiz period - horiz sync len */
97 };
98 
99 /*
100  * Dot clock rate is
101  * 3.9064MHz * 2**clock_params[2] * clock_params[1] / clock_params[0].
102  */
103 struct control_regvals {
104 	unsigned regs[16];		/* for vswin .. hserr */
105 	unsigned char mode;
106 	unsigned char radacal_ctrl;
107 	unsigned char clock_params[3];
108 };
109 
110 #define CTRLFB_OFF 16	/* position of pixel 0 in frame buffer */
111 
112 
113 /*
114  * Best cmode supported by control
115  */
116 struct max_cmodes {
117 	int m[2];	/* 0: 2MB vram, 1: 4MB vram */
118 };
119 
120 /*
121  * Video modes supported by macmodes.c
122  */
123 static struct max_cmodes control_mac_modes[] = {
124 	{{-1,-1}},	/* 512x384, 60Hz interlaced (NTSC) */
125 	{{-1,-1}},	/* 512x384, 60Hz */
126 	{{-1,-1}},	/* 640x480, 50Hz interlaced (PAL) */
127 	{{-1,-1}},	/* 640x480, 60Hz interlaced (NTSC) */
128 	{{ 2, 2}},	/* 640x480, 60Hz (VGA) */
129 	{{ 2, 2}},	/* 640x480, 67Hz */
130 	{{-1,-1}},	/* 640x870, 75Hz (portrait) */
131 	{{-1,-1}},	/* 768x576, 50Hz (PAL full frame) */
132 	{{ 2, 2}},	/* 800x600, 56Hz */
133 	{{ 2, 2}},	/* 800x600, 60Hz */
134 	{{ 2, 2}},	/* 800x600, 72Hz */
135 	{{ 2, 2}},	/* 800x600, 75Hz */
136 	{{ 1, 2}},	/* 832x624, 75Hz */
137 	{{ 1, 2}},	/* 1024x768, 60Hz */
138 	{{ 1, 2}},	/* 1024x768, 70Hz (or 72Hz?) */
139 	{{ 1, 2}},	/* 1024x768, 75Hz (VESA) */
140 	{{ 1, 2}},	/* 1024x768, 75Hz */
141 	{{ 1, 2}},	/* 1152x870, 75Hz */
142 	{{ 0, 1}},	/* 1280x960, 75Hz */
143 	{{ 0, 1}},	/* 1280x1024, 75Hz */
144 };
145 
146