Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / m68k / include / asm / amigahw.h
blob7a19b5686a4a69255f94c96aab86c382d461e482
1 /*
2 ** asm-m68k/amigahw.h -- This header defines some macros and pointers for
3 ** the various Amiga custom hardware registers.
4 ** The naming conventions used here conform to those
5 ** used in the Amiga Hardware Reference Manual, 3rd Edition
6 **
7 ** Copyright 1992 by Greg Harp
8 **
9 ** This file is subject to the terms and conditions of the GNU General Public
10 ** License. See the file COPYING in the main directory of this archive
11 ** for more details.
13 ** Created: 9/24/92 by Greg Harp
16 #ifndef _M68K_AMIGAHW_H
17 #define _M68K_AMIGAHW_H
19 #include <linux/ioport.h>
22 * Different Amiga models
25 #define AMI_UNKNOWN (0)
26 #define AMI_500 (1)
27 #define AMI_500PLUS (2)
28 #define AMI_600 (3)
29 #define AMI_1000 (4)
30 #define AMI_1200 (5)
31 #define AMI_2000 (6)
32 #define AMI_2500 (7)
33 #define AMI_3000 (8)
34 #define AMI_3000T (9)
35 #define AMI_3000PLUS (10)
36 #define AMI_4000 (11)
37 #define AMI_4000T (12)
38 #define AMI_CDTV (13)
39 #define AMI_CD32 (14)
40 #define AMI_DRACO (15)
44 * Chipsets
47 extern unsigned long amiga_chipset;
49 #define CS_STONEAGE (0)
50 #define CS_OCS (1)
51 #define CS_ECS (2)
52 #define CS_AGA (3)
56 * Miscellaneous
59 extern unsigned long amiga_eclock; /* 700 kHz E Peripheral Clock */
60 extern unsigned long amiga_colorclock; /* 3.5 MHz Color Clock */
61 extern unsigned long amiga_chip_size; /* Chip RAM Size (bytes) */
62 extern unsigned char amiga_vblank; /* VBLANK Frequency */
65 #define AMIGAHW_DECLARE(name) unsigned name : 1
66 #define AMIGAHW_SET(name) (amiga_hw_present.name = 1)
67 #define AMIGAHW_PRESENT(name) (amiga_hw_present.name)
69 struct amiga_hw_present {
70 /* video hardware */
71 AMIGAHW_DECLARE(AMI_VIDEO); /* Amiga Video */
72 AMIGAHW_DECLARE(AMI_BLITTER); /* Amiga Blitter */
73 AMIGAHW_DECLARE(AMBER_FF); /* Amber Flicker Fixer */
74 /* sound hardware */
75 AMIGAHW_DECLARE(AMI_AUDIO); /* Amiga Audio */
76 /* disk storage interfaces */
77 AMIGAHW_DECLARE(AMI_FLOPPY); /* Amiga Floppy */
78 AMIGAHW_DECLARE(A3000_SCSI); /* SCSI (wd33c93, A3000 alike) */
79 AMIGAHW_DECLARE(A4000_SCSI); /* SCSI (ncr53c710, A4000T alike) */
80 AMIGAHW_DECLARE(A1200_IDE); /* IDE (A1200 alike) */
81 AMIGAHW_DECLARE(A4000_IDE); /* IDE (A4000 alike) */
82 AMIGAHW_DECLARE(CD_ROM); /* CD ROM drive */
83 /* other I/O hardware */
84 AMIGAHW_DECLARE(AMI_KEYBOARD); /* Amiga Keyboard */
85 AMIGAHW_DECLARE(AMI_MOUSE); /* Amiga Mouse */
86 AMIGAHW_DECLARE(AMI_SERIAL); /* Amiga Serial */
87 AMIGAHW_DECLARE(AMI_PARALLEL); /* Amiga Parallel */
88 /* real time clocks */
89 AMIGAHW_DECLARE(A2000_CLK); /* Hardware Clock (A2000 alike) */
90 AMIGAHW_DECLARE(A3000_CLK); /* Hardware Clock (A3000 alike) */
91 /* supporting hardware */
92 AMIGAHW_DECLARE(CHIP_RAM); /* Chip RAM */
93 AMIGAHW_DECLARE(PAULA); /* Paula (8364) */
94 AMIGAHW_DECLARE(DENISE); /* Denise (8362) */
95 AMIGAHW_DECLARE(DENISE_HR); /* Denise (8373) */
96 AMIGAHW_DECLARE(LISA); /* Lisa (8375) */
97 AMIGAHW_DECLARE(AGNUS_PAL); /* Normal/Fat PAL Agnus (8367/8371) */
98 AMIGAHW_DECLARE(AGNUS_NTSC); /* Normal/Fat NTSC Agnus (8361/8370) */
99 AMIGAHW_DECLARE(AGNUS_HR_PAL); /* Fat Hires PAL Agnus (8372) */
100 AMIGAHW_DECLARE(AGNUS_HR_NTSC); /* Fat Hires NTSC Agnus (8372) */
101 AMIGAHW_DECLARE(ALICE_PAL); /* PAL Alice (8374) */
102 AMIGAHW_DECLARE(ALICE_NTSC); /* NTSC Alice (8374) */
103 AMIGAHW_DECLARE(MAGIC_REKICK); /* A3000 Magic Hard Rekick */
104 AMIGAHW_DECLARE(PCMCIA); /* PCMCIA Slot */
105 AMIGAHW_DECLARE(ZORRO); /* Zorro AutoConfig */
106 AMIGAHW_DECLARE(ZORRO3); /* Zorro III */
109 extern struct amiga_hw_present amiga_hw_present;
111 struct CUSTOM {
112 unsigned short bltddat;
113 unsigned short dmaconr;
114 unsigned short vposr;
115 unsigned short vhposr;
116 unsigned short dskdatr;
117 unsigned short joy0dat;
118 unsigned short joy1dat;
119 unsigned short clxdat;
120 unsigned short adkconr;
121 unsigned short pot0dat;
122 unsigned short pot1dat;
123 unsigned short potgor;
124 unsigned short serdatr;
125 unsigned short dskbytr;
126 unsigned short intenar;
127 unsigned short intreqr;
128 unsigned char *dskptr;
129 unsigned short dsklen;
130 unsigned short dskdat;
131 unsigned short refptr;
132 unsigned short vposw;
133 unsigned short vhposw;
134 unsigned short copcon;
135 unsigned short serdat;
136 unsigned short serper;
137 unsigned short potgo;
138 unsigned short joytest;
139 unsigned short strequ;
140 unsigned short strvbl;
141 unsigned short strhor;
142 unsigned short strlong;
143 unsigned short bltcon0;
144 unsigned short bltcon1;
145 unsigned short bltafwm;
146 unsigned short bltalwm;
147 unsigned char *bltcpt;
148 unsigned char *bltbpt;
149 unsigned char *bltapt;
150 unsigned char *bltdpt;
151 unsigned short bltsize;
152 unsigned char pad2d;
153 unsigned char bltcon0l;
154 unsigned short bltsizv;
155 unsigned short bltsizh;
156 unsigned short bltcmod;
157 unsigned short bltbmod;
158 unsigned short bltamod;
159 unsigned short bltdmod;
160 unsigned short spare2[4];
161 unsigned short bltcdat;
162 unsigned short bltbdat;
163 unsigned short bltadat;
164 unsigned short spare3[3];
165 unsigned short deniseid;
166 unsigned short dsksync;
167 unsigned short *cop1lc;
168 unsigned short *cop2lc;
169 unsigned short copjmp1;
170 unsigned short copjmp2;
171 unsigned short copins;
172 unsigned short diwstrt;
173 unsigned short diwstop;
174 unsigned short ddfstrt;
175 unsigned short ddfstop;
176 unsigned short dmacon;
177 unsigned short clxcon;
178 unsigned short intena;
179 unsigned short intreq;
180 unsigned short adkcon;
181 struct {
182 unsigned short *audlc;
183 unsigned short audlen;
184 unsigned short audper;
185 unsigned short audvol;
186 unsigned short auddat;
187 unsigned short audspare[2];
188 } aud[4];
189 unsigned char *bplpt[8];
190 unsigned short bplcon0;
191 unsigned short bplcon1;
192 unsigned short bplcon2;
193 unsigned short bplcon3;
194 unsigned short bpl1mod;
195 unsigned short bpl2mod;
196 unsigned short bplcon4;
197 unsigned short clxcon2;
198 unsigned short bpldat[8];
199 unsigned char *sprpt[8];
200 struct {
201 unsigned short pos;
202 unsigned short ctl;
203 unsigned short dataa;
204 unsigned short datab;
205 } spr[8];
206 unsigned short color[32];
207 unsigned short htotal;
208 unsigned short hsstop;
209 unsigned short hbstrt;
210 unsigned short hbstop;
211 unsigned short vtotal;
212 unsigned short vsstop;
213 unsigned short vbstrt;
214 unsigned short vbstop;
215 unsigned short sprhstrt;
216 unsigned short sprhstop;
217 unsigned short bplhstrt;
218 unsigned short bplhstop;
219 unsigned short hhposw;
220 unsigned short hhposr;
221 unsigned short beamcon0;
222 unsigned short hsstrt;
223 unsigned short vsstrt;
224 unsigned short hcenter;
225 unsigned short diwhigh;
226 unsigned short spare4[11];
227 unsigned short fmode;
231 * DMA register bits
233 #define DMAF_SETCLR (0x8000)
234 #define DMAF_AUD0 (0x0001)
235 #define DMAF_AUD1 (0x0002)
236 #define DMAF_AUD2 (0x0004)
237 #define DMAF_AUD3 (0x0008)
238 #define DMAF_DISK (0x0010)
239 #define DMAF_SPRITE (0x0020)
240 #define DMAF_BLITTER (0x0040)
241 #define DMAF_COPPER (0x0080)
242 #define DMAF_RASTER (0x0100)
243 #define DMAF_MASTER (0x0200)
244 #define DMAF_BLITHOG (0x0400)
245 #define DMAF_BLTNZERO (0x2000)
246 #define DMAF_BLTDONE (0x4000)
247 #define DMAF_ALL (0x01FF)
249 struct CIA {
250 unsigned char pra; char pad0[0xff];
251 unsigned char prb; char pad1[0xff];
252 unsigned char ddra; char pad2[0xff];
253 unsigned char ddrb; char pad3[0xff];
254 unsigned char talo; char pad4[0xff];
255 unsigned char tahi; char pad5[0xff];
256 unsigned char tblo; char pad6[0xff];
257 unsigned char tbhi; char pad7[0xff];
258 unsigned char todlo; char pad8[0xff];
259 unsigned char todmid; char pad9[0xff];
260 unsigned char todhi; char pada[0x1ff];
261 unsigned char sdr; char padb[0xff];
262 unsigned char icr; char padc[0xff];
263 unsigned char cra; char padd[0xff];
264 unsigned char crb; char pade[0xff];
267 #define zTwoBase (0x80000000)
268 #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
269 #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
271 #define CUSTOM_PHYSADDR (0xdff000)
272 #define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
274 #define CIAA_PHYSADDR (0xbfe001)
275 #define CIAB_PHYSADDR (0xbfd000)
276 #define ciaa ((*(volatile struct CIA *)(zTwoBase + CIAA_PHYSADDR)))
277 #define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR)))
279 #define CHIP_PHYSADDR (0x000000)
281 void amiga_chip_init (void);
282 void *amiga_chip_alloc(unsigned long size, const char *name);
283 void *amiga_chip_alloc_res(unsigned long size, struct resource *res);
284 void amiga_chip_free(void *ptr);
285 unsigned long amiga_chip_avail( void ); /*MILAN*/
286 extern volatile unsigned short amiga_audio_min_period;
288 static inline void amifb_video_off(void)
290 if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) {
291 /* program Denise/Lisa for a higher maximum play rate */
292 amiga_custom.htotal = 113; /* 31 kHz */
293 amiga_custom.vtotal = 223; /* 70 Hz */
294 amiga_custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */
295 /* suspend the monitor */
296 amiga_custom.hsstrt = amiga_custom.hsstop = 116;
297 amiga_custom.vsstrt = amiga_custom.vsstop = 226;
298 amiga_audio_min_period = 57;
302 struct tod3000 {
303 unsigned int :28, second2:4; /* lower digit */
304 unsigned int :28, second1:4; /* upper digit */
305 unsigned int :28, minute2:4; /* lower digit */
306 unsigned int :28, minute1:4; /* upper digit */
307 unsigned int :28, hour2:4; /* lower digit */
308 unsigned int :28, hour1:4; /* upper digit */
309 unsigned int :28, weekday:4;
310 unsigned int :28, day2:4; /* lower digit */
311 unsigned int :28, day1:4; /* upper digit */
312 unsigned int :28, month2:4; /* lower digit */
313 unsigned int :28, month1:4; /* upper digit */
314 unsigned int :28, year2:4; /* lower digit */
315 unsigned int :28, year1:4; /* upper digit */
316 unsigned int :28, cntrl1:4; /* control-byte 1 */
317 unsigned int :28, cntrl2:4; /* control-byte 2 */
318 unsigned int :28, cntrl3:4; /* control-byte 3 */
320 #define TOD3000_CNTRL1_HOLD 0
321 #define TOD3000_CNTRL1_FREE 9
322 #define tod_3000 ((*(volatile struct tod3000 *)(zTwoBase+0xDC0000)))
324 struct tod2000 {
325 unsigned int :28, second2:4; /* lower digit */
326 unsigned int :28, second1:4; /* upper digit */
327 unsigned int :28, minute2:4; /* lower digit */
328 unsigned int :28, minute1:4; /* upper digit */
329 unsigned int :28, hour2:4; /* lower digit */
330 unsigned int :28, hour1:4; /* upper digit */
331 unsigned int :28, day2:4; /* lower digit */
332 unsigned int :28, day1:4; /* upper digit */
333 unsigned int :28, month2:4; /* lower digit */
334 unsigned int :28, month1:4; /* upper digit */
335 unsigned int :28, year2:4; /* lower digit */
336 unsigned int :28, year1:4; /* upper digit */
337 unsigned int :28, weekday:4;
338 unsigned int :28, cntrl1:4; /* control-byte 1 */
339 unsigned int :28, cntrl2:4; /* control-byte 2 */
340 unsigned int :28, cntrl3:4; /* control-byte 3 */
343 #define TOD2000_CNTRL1_HOLD (1<<0)
344 #define TOD2000_CNTRL1_BUSY (1<<1)
345 #define TOD2000_CNTRL3_24HMODE (1<<2)
346 #define TOD2000_HOUR1_PM (1<<2)
347 #define tod_2000 ((*(volatile struct tod2000 *)(zTwoBase+0xDC0000)))
349 #endif /* _M68K_AMIGAHW_H */