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