18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * controlfb_hw.h: Constants of all sorts for controlfb
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1998 Daniel Jacobowitz <dan@debian.org>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Based on an awful lot of code, including:
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * control.c: Console support for PowerMac "control" display adaptor.
108c2ecf20Sopenharmony_ci * Copyright (C) 1996 Paul Mackerras.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * The so far unpublished platinumfb.c
138c2ecf20Sopenharmony_ci * Copyright (C) 1998 Jon Howell
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Structure of the registers for the RADACAL colormap device.
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_cistruct cmap_regs {
208c2ecf20Sopenharmony_ci	unsigned char addr;	/* index for both cmap and misc registers */
218c2ecf20Sopenharmony_ci	char pad1[15];
228c2ecf20Sopenharmony_ci	unsigned char crsr;	/* cursor palette */
238c2ecf20Sopenharmony_ci	char pad2[15];
248c2ecf20Sopenharmony_ci	unsigned char dat;	/* RADACAL misc register data */
258c2ecf20Sopenharmony_ci	char pad3[15];
268c2ecf20Sopenharmony_ci	unsigned char lut;	/* cmap data */
278c2ecf20Sopenharmony_ci	char pad4[15];
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * Structure of the registers for the "control" display adaptor.
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci#define PAD(x)	char x[12]
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct preg {			/* padded register */
368c2ecf20Sopenharmony_ci	unsigned r;
378c2ecf20Sopenharmony_ci	char pad[12];
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistruct control_regs {
418c2ecf20Sopenharmony_ci	struct preg vcount;	/* vertical counter */
428c2ecf20Sopenharmony_ci	/* Vertical parameters are in units of 1/2 scan line */
438c2ecf20Sopenharmony_ci	struct preg vswin;	/* between vsblank and vssync */
448c2ecf20Sopenharmony_ci	struct preg vsblank;	/* vert start blank */
458c2ecf20Sopenharmony_ci	struct preg veblank;	/* vert end blank (display start) */
468c2ecf20Sopenharmony_ci	struct preg vewin;	/* between vesync and veblank */
478c2ecf20Sopenharmony_ci	struct preg vesync;	/* vert end sync */
488c2ecf20Sopenharmony_ci	struct preg vssync;	/* vert start sync */
498c2ecf20Sopenharmony_ci	struct preg vperiod;	/* vert period */
508c2ecf20Sopenharmony_ci	struct preg piped;	/* pipe delay hardware cursor */
518c2ecf20Sopenharmony_ci	/* Horizontal params are in units of 2 pixels */
528c2ecf20Sopenharmony_ci	struct preg hperiod;	/* horiz period - 2 */
538c2ecf20Sopenharmony_ci	struct preg hsblank;	/* horiz start blank */
548c2ecf20Sopenharmony_ci	struct preg heblank;	/* horiz end blank */
558c2ecf20Sopenharmony_ci	struct preg hesync;	/* horiz end sync */
568c2ecf20Sopenharmony_ci	struct preg hssync;	/* horiz start sync */
578c2ecf20Sopenharmony_ci	struct preg heq;	/* half horiz sync len */
588c2ecf20Sopenharmony_ci	struct preg hlfln;	/* half horiz period */
598c2ecf20Sopenharmony_ci	struct preg hserr;	/* horiz period - horiz sync len */
608c2ecf20Sopenharmony_ci	struct preg cnttst;
618c2ecf20Sopenharmony_ci	struct preg ctrl;	/* display control */
628c2ecf20Sopenharmony_ci	struct preg start_addr;	/* start address: 5 lsbs zero */
638c2ecf20Sopenharmony_ci	struct preg pitch;	/* addrs diff between scan lines */
648c2ecf20Sopenharmony_ci	struct preg mon_sense;	/* monitor sense bits */
658c2ecf20Sopenharmony_ci	struct preg vram_attr;	/* enable vram banks */
668c2ecf20Sopenharmony_ci	struct preg mode;
678c2ecf20Sopenharmony_ci	struct preg rfrcnt;	/* refresh count */
688c2ecf20Sopenharmony_ci	struct preg intr_ena;	/* interrupt enable */
698c2ecf20Sopenharmony_ci	struct preg intr_stat;	/* interrupt status */
708c2ecf20Sopenharmony_ci	struct preg res[5];
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistruct control_regints {
748c2ecf20Sopenharmony_ci	/* Vertical parameters are in units of 1/2 scan line */
758c2ecf20Sopenharmony_ci	unsigned vswin;	/* between vsblank and vssync */
768c2ecf20Sopenharmony_ci	unsigned vsblank;	/* vert start blank */
778c2ecf20Sopenharmony_ci	unsigned veblank;	/* vert end blank (display start) */
788c2ecf20Sopenharmony_ci	unsigned vewin;	/* between vesync and veblank */
798c2ecf20Sopenharmony_ci	unsigned vesync;	/* vert end sync */
808c2ecf20Sopenharmony_ci	unsigned vssync;	/* vert start sync */
818c2ecf20Sopenharmony_ci	unsigned vperiod;	/* vert period */
828c2ecf20Sopenharmony_ci	unsigned piped;		/* pipe delay hardware cursor */
838c2ecf20Sopenharmony_ci	/* Horizontal params are in units of 2 pixels */
848c2ecf20Sopenharmony_ci	/* Except, apparently, for hres > 1024 (or == 1280?) */
858c2ecf20Sopenharmony_ci	unsigned hperiod;	/* horiz period - 2 */
868c2ecf20Sopenharmony_ci	unsigned hsblank;	/* horiz start blank */
878c2ecf20Sopenharmony_ci	unsigned heblank;	/* horiz end blank */
888c2ecf20Sopenharmony_ci	unsigned hesync;	/* horiz end sync */
898c2ecf20Sopenharmony_ci	unsigned hssync;	/* horiz start sync */
908c2ecf20Sopenharmony_ci	unsigned heq;		/* half horiz sync len */
918c2ecf20Sopenharmony_ci	unsigned hlfln;		/* half horiz period */
928c2ecf20Sopenharmony_ci	unsigned hserr;		/* horiz period - horiz sync len */
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci * Dot clock rate is
978c2ecf20Sopenharmony_ci * 3.9064MHz * 2**clock_params[2] * clock_params[1] / clock_params[0].
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_cistruct control_regvals {
1008c2ecf20Sopenharmony_ci	unsigned regs[16];		/* for vswin .. hserr */
1018c2ecf20Sopenharmony_ci	unsigned char mode;
1028c2ecf20Sopenharmony_ci	unsigned char radacal_ctrl;
1038c2ecf20Sopenharmony_ci	unsigned char clock_params[3];
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define CTRLFB_OFF 16	/* position of pixel 0 in frame buffer */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/*
1108c2ecf20Sopenharmony_ci * Best cmode supported by control
1118c2ecf20Sopenharmony_ci */
1128c2ecf20Sopenharmony_cistruct max_cmodes {
1138c2ecf20Sopenharmony_ci	int m[2];	/* 0: 2MB vram, 1: 4MB vram */
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/*
1178c2ecf20Sopenharmony_ci * Video modes supported by macmodes.c
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_cistatic struct max_cmodes control_mac_modes[] = {
1208c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 512x384, 60Hz interlaced (NTSC) */
1218c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 512x384, 60Hz */
1228c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 640x480, 50Hz interlaced (PAL) */
1238c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 640x480, 60Hz interlaced (NTSC) */
1248c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 640x480, 60Hz (VGA) */
1258c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 640x480, 67Hz */
1268c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 640x870, 75Hz (portrait) */
1278c2ecf20Sopenharmony_ci	{{-1,-1}},	/* 768x576, 50Hz (PAL full frame) */
1288c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 800x600, 56Hz */
1298c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 800x600, 60Hz */
1308c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 800x600, 72Hz */
1318c2ecf20Sopenharmony_ci	{{ 2, 2}},	/* 800x600, 75Hz */
1328c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 832x624, 75Hz */
1338c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1024x768, 60Hz */
1348c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1024x768, 70Hz (or 72Hz?) */
1358c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1024x768, 75Hz (VESA) */
1368c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1024x768, 75Hz */
1378c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1152x870, 75Hz */
1388c2ecf20Sopenharmony_ci	{{ 0, 1}},	/* 1280x960, 75Hz */
1398c2ecf20Sopenharmony_ci	{{ 0, 1}},	/* 1280x1024, 75Hz */
1408c2ecf20Sopenharmony_ci	{{ 1, 2}},	/* 1152x768, 60Hz */
1418c2ecf20Sopenharmony_ci	{{ 0, 1}},	/* 1600x1024, 60Hz */
1428c2ecf20Sopenharmony_ci};
1438c2ecf20Sopenharmony_ci
144