ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc / 8xx_immap.h
1 /*
2  * MPC8xx Internal Memory Map
3  * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4  *
5  * The I/O on the MPC860 is comprised of blocks of special registers
6  * and the dual port ram for the Communication Processor Module.
7  * Within this space are functional units such as the SIU, memory
8  * controller, system timers, and other control functions.  It is
9  * a combination that I found difficult to separate into logical
10  * functional files.....but anyone else is welcome to try.  -- Dan
11  */
12 #ifdef __KERNEL__
13 #ifndef __IMMAP_8XX__
14 #define __IMMAP_8XX__
15
16 /* System configuration registers.
17 */
18 typedef struct sys_conf {
19         uint    sc_siumcr;
20         uint    sc_sypcr;
21         uint    sc_swt;
22         char    res1[2];
23         ushort  sc_swsr;
24         uint    sc_sipend;
25         uint    sc_simask;
26         uint    sc_siel;
27         uint    sc_sivec;
28         uint    sc_tesr;
29         char    res2[0xc];
30         uint    sc_sdcr;
31         char    res3[0x4c];
32 } sysconf8xx_t;
33
34 /* PCMCIA configuration registers.
35 */
36 typedef struct pcmcia_conf {
37         uint    pcmc_pbr0;
38         uint    pcmc_por0;
39         uint    pcmc_pbr1;
40         uint    pcmc_por1;
41         uint    pcmc_pbr2;
42         uint    pcmc_por2;
43         uint    pcmc_pbr3;
44         uint    pcmc_por3;
45         uint    pcmc_pbr4;
46         uint    pcmc_por4;
47         uint    pcmc_pbr5;
48         uint    pcmc_por5;
49         uint    pcmc_pbr6;
50         uint    pcmc_por6;
51         uint    pcmc_pbr7;
52         uint    pcmc_por7;
53         char    res1[0x20];
54         uint    pcmc_pgcra;
55         uint    pcmc_pgcrb;
56         uint    pcmc_pscr;
57         char    res2[4];
58         uint    pcmc_pipr;
59         char    res3[4];
60         uint    pcmc_per;
61         char    res4[4];
62 } pcmconf8xx_t;
63
64 /* Memory controller registers.
65 */
66 typedef struct  mem_ctlr {
67         uint    memc_br0;
68         uint    memc_or0;
69         uint    memc_br1;
70         uint    memc_or1;
71         uint    memc_br2;
72         uint    memc_or2;
73         uint    memc_br3;
74         uint    memc_or3;
75         uint    memc_br4;
76         uint    memc_or4;
77         uint    memc_br5;
78         uint    memc_or5;
79         uint    memc_br6;
80         uint    memc_or6;
81         uint    memc_br7;
82         uint    memc_or7;
83         char    res1[0x24];
84         uint    memc_mar;
85         uint    memc_mcr;
86         char    res2[4];
87         uint    memc_mamr;
88         uint    memc_mbmr;
89         ushort  memc_mstat;
90         ushort  memc_mptpr;
91         uint    memc_mdr;
92         char    res3[0x80];
93 } memctl8xx_t;
94
95 /* System Integration Timers.
96 */
97 typedef struct  sys_int_timers {
98         ushort  sit_tbscr;
99         uint    sit_tbreff0;
100         uint    sit_tbreff1;
101         char    res1[0x14];
102         ushort  sit_rtcsc;
103         uint    sit_rtc;
104         uint    sit_rtsec;
105         uint    sit_rtcal;
106         char    res2[0x10];
107         ushort  sit_piscr;
108         char    res3[2];
109         uint    sit_pitc;
110         uint    sit_pitr;
111         char    res4[0x34];
112 } sit8xx_t;
113
114 #define TBSCR_TBIRQ_MASK        ((ushort)0xff00)
115 #define TBSCR_REFA              ((ushort)0x0080)
116 #define TBSCR_REFB              ((ushort)0x0040)
117 #define TBSCR_REFAE             ((ushort)0x0008)
118 #define TBSCR_REFBE             ((ushort)0x0004)
119 #define TBSCR_TBF               ((ushort)0x0002)
120 #define TBSCR_TBE               ((ushort)0x0001)
121
122 #define RTCSC_RTCIRQ_MASK       ((ushort)0xff00)
123 #define RTCSC_SEC               ((ushort)0x0080)
124 #define RTCSC_ALR               ((ushort)0x0040)
125 #define RTCSC_38K               ((ushort)0x0010)
126 #define RTCSC_SIE               ((ushort)0x0008)
127 #define RTCSC_ALE               ((ushort)0x0004)
128 #define RTCSC_RTF               ((ushort)0x0002)
129 #define RTCSC_RTE               ((ushort)0x0001)
130
131 #define PISCR_PIRQ_MASK         ((ushort)0xff00)
132 #define PISCR_PS                ((ushort)0x0080)
133 #define PISCR_PIE               ((ushort)0x0004)
134 #define PISCR_PTF               ((ushort)0x0002)
135 #define PISCR_PTE               ((ushort)0x0001)
136
137 /* Clocks and Reset.
138 */
139 typedef struct clk_and_reset {
140         uint    car_sccr;
141         uint    car_plprcr;
142         uint    car_rsr;
143         char    res[0x74];        /* Reserved area                  */
144 } car8xx_t;
145
146 /* System Integration Timers keys.
147 */
148 typedef struct sitk {
149         uint    sitk_tbscrk;
150         uint    sitk_tbreff0k;
151         uint    sitk_tbreff1k;
152         uint    sitk_tbk;
153         char    res1[0x10];
154         uint    sitk_rtcsck;
155         uint    sitk_rtck;
156         uint    sitk_rtseck;
157         uint    sitk_rtcalk;
158         char    res2[0x10];
159         uint    sitk_piscrk;
160         uint    sitk_pitck;
161         char    res3[0x38];
162 } sitk8xx_t;
163
164 /* Clocks and reset keys.
165 */
166 typedef struct cark {
167         uint    cark_sccrk;
168         uint    cark_plprcrk;
169         uint    cark_rsrk;
170         char    res[0x474];
171 } cark8xx_t;
172
173 /* The key to unlock registers maintained by keep-alive power.
174 */
175 #define KAPWR_KEY       ((unsigned int)0x55ccaa33)
176
177 /* LCD interface.  MPC821 and MPC823 Only.
178 */
179 typedef struct lcd {
180         ushort  lcd_lcolr[16];
181         char    res[0x20];
182         uint    lcd_lccr;
183         uint    lcd_lchcr;
184         uint    lcd_lcvcr;
185         char    res2[4];
186         uint    lcd_lcfaa;
187         uint    lcd_lcfba;
188         char    lcd_lcsr;
189         char    res3[0x7];
190 } lcd8xx_t;
191
192 /* I2C
193 */
194 typedef struct i2c {
195         u_char  i2c_i2mod;
196         char    res1[3];
197         u_char  i2c_i2add;
198         char    res2[3];
199         u_char  i2c_i2brg;
200         char    res3[3];
201         u_char  i2c_i2com;
202         char    res4[3];
203         u_char  i2c_i2cer;
204         char    res5[3];
205         u_char  i2c_i2cmr;
206         char    res6[0x8b];
207 } i2c8xx_t;
208
209 /* DMA control/status registers.
210 */
211 typedef struct sdma_csr {
212         char    res1[4];
213         uint    sdma_sdar;
214         u_char  sdma_sdsr;
215         char    res3[3];
216         u_char  sdma_sdmr;
217         char    res4[3];
218         u_char  sdma_idsr1;
219         char    res5[3];
220         u_char  sdma_idmr1;
221         char    res6[3];
222         u_char  sdma_idsr2;
223         char    res7[3];
224         u_char  sdma_idmr2;
225         char    res8[0x13];
226 } sdma8xx_t;
227
228 /* Communication Processor Module Interrupt Controller.
229 */
230 typedef struct cpm_ic {
231         ushort  cpic_civr;
232         char    res[0xe];
233         uint    cpic_cicr;
234         uint    cpic_cipr;
235         uint    cpic_cimr;
236         uint    cpic_cisr;
237 } cpic8xx_t;
238
239 /* Input/Output Port control/status registers.
240 */
241 typedef struct io_port {
242         ushort  iop_padir;
243         ushort  iop_papar;
244         ushort  iop_paodr;
245         ushort  iop_padat;
246         char    res1[8];
247         ushort  iop_pcdir;
248         ushort  iop_pcpar;
249         ushort  iop_pcso;
250         ushort  iop_pcdat;
251         ushort  iop_pcint;
252         char    res2[6];
253         ushort  iop_pddir;
254         ushort  iop_pdpar;
255         char    res3[2];
256         ushort  iop_pddat;
257         char    res4[8];
258 } iop8xx_t;
259
260 /* Communication Processor Module Timers
261 */
262 typedef struct cpm_timers {
263         ushort  cpmt_tgcr;
264         char    res1[0xe];
265         ushort  cpmt_tmr1;
266         ushort  cpmt_tmr2;
267         ushort  cpmt_trr1;
268         ushort  cpmt_trr2;
269         ushort  cpmt_tcr1;
270         ushort  cpmt_tcr2;
271         ushort  cpmt_tcn1;
272         ushort  cpmt_tcn2;
273         ushort  cpmt_tmr3;
274         ushort  cpmt_tmr4;
275         ushort  cpmt_trr3;
276         ushort  cpmt_trr4;
277         ushort  cpmt_tcr3;
278         ushort  cpmt_tcr4;
279         ushort  cpmt_tcn3;
280         ushort  cpmt_tcn4;
281         ushort  cpmt_ter1;
282         ushort  cpmt_ter2;
283         ushort  cpmt_ter3;
284         ushort  cpmt_ter4;
285         char    res2[8];
286 } cpmtimer8xx_t;
287
288 /* Finally, the Communication Processor stuff.....
289 */
290 typedef struct scc {            /* Serial communication channels */
291         uint    scc_gsmrl;
292         uint    scc_gsmrh;
293         ushort  scc_pmsr;
294         char    res1[2];
295         ushort  scc_todr;
296         ushort  scc_dsr;
297         ushort  scc_scce;
298         char    res2[2];
299         ushort  scc_sccm;
300         char    res3;
301         u_char  scc_sccs;
302         char    res4[8];
303 } scc_t;
304
305 typedef struct smc {            /* Serial management channels */
306         char    res1[2];
307         ushort  smc_smcmr;
308         char    res2[2];
309         u_char  smc_smce;
310         char    res3[3];
311         u_char  smc_smcm;
312         char    res4[5];
313 } smc_t;
314
315 /* MPC860T Fast Ethernet Controller.  It isn't part of the CPM, but
316  * it fits within the address space.
317  */
318 typedef struct fec {
319         uint    fec_addr_low;           /* LS 32 bits of station address */
320         ushort  fec_addr_high;          /* MS 16 bits of address */
321         ushort  res1;
322         uint    fec_hash_table_high;
323         uint    fec_hash_table_low;
324         uint    fec_r_des_start;
325         uint    fec_x_des_start;
326         uint    fec_r_buff_size;
327         uint    res2[9];
328         uint    fec_ecntrl;
329         uint    fec_ievent;
330         uint    fec_imask;
331         uint    fec_ivec;
332         uint    fec_r_des_active;
333         uint    fec_x_des_active;
334         uint    res3[10];
335         uint    fec_mii_data;
336         uint    fec_mii_speed;
337         uint    res4[17];
338         uint    fec_r_bound;
339         uint    fec_r_fstart;
340         uint    res5[6];
341         uint    fec_x_fstart;
342         uint    res6[17];
343         uint    fec_fun_code;
344         uint    res7[3];
345         uint    fec_r_cntrl;
346         uint    fec_r_hash;
347         uint    res8[14];
348         uint    fec_x_cntrl;
349         uint    res9[0x1e];
350 } fec_t;
351
352 /* We need this as the fec and fb cmap use the same address space */
353 union fec_lcd {
354         fec_t   fl_un_fec;
355         u_char  fl_un_cmap[0x200];
356 };
357
358 typedef struct comm_proc {
359         /* General control and status registers.
360         */
361         ushort  cp_cpcr;
362         char    res1[2];
363         ushort  cp_rccr;
364         char    res2[6];
365         ushort  cp_cpmcr1;
366         ushort  cp_cpmcr2;
367         ushort  cp_cpmcr3;
368         ushort  cp_cpmcr4;
369         char    res3[2];
370         ushort  cp_rter;
371         char    res4[2];
372         ushort  cp_rtmr;
373         char    res5[0x14];
374
375         /* Baud rate generators.
376         */
377         uint    cp_brgc1;
378         uint    cp_brgc2;
379         uint    cp_brgc3;
380         uint    cp_brgc4;
381
382         /* Serial Communication Channels.
383         */
384         scc_t   cp_scc[4];
385
386         /* Serial Management Channels.
387         */
388         smc_t   cp_smc[2];
389
390         /* Serial Peripheral Interface.
391         */
392         ushort  cp_spmode;
393         char    res6[4];
394         u_char  cp_spie;
395         char    res7[3];
396         u_char  cp_spim;
397         char    res8[2];
398         u_char  cp_spcom;
399         char    res9[2];
400
401         /* Parallel Interface Port.
402         */
403         char    res10[2];
404         ushort  cp_pipc;
405         char    res11[2];
406         ushort  cp_ptpr;
407         uint    cp_pbdir;
408         uint    cp_pbpar;
409         char    res12[2];
410         ushort  cp_pbodr;
411         uint    cp_pbdat;
412         char    res13[0x18];
413
414         /* Serial Interface and Time Slot Assignment.
415         */
416         uint    cp_simode;
417         u_char  cp_sigmr;
418         char    res14;
419         u_char  cp_sistr;
420         u_char  cp_sicmr;
421         char    res15[4];
422         uint    cp_sicr;
423         uint    cp_sirp;
424         char    res16[0x10c];
425         u_char  cp_siram[0x200];
426
427         /* The fast ethernet controller is not really part of the CPM,
428          * but it resides in the address space.
429          *
430          * The colormap for the LCD controller is also located here
431          */
432         union   fec_lcd fl_un;
433 #define cp_fec  fl_un.fl_un_fec
434 #define lcd_cmap fl_un.fl_un_cmap
435         char    res18[0x1000];
436
437         /* Dual Ported RAM follows.
438          * There are many different formats for this memory area
439          * depending upon the devices used and options chosen.
440          */
441         u_char  cp_dpmem[0x1000];       /* BD / Data / ucode */
442         u_char  res19[0xc00];
443         u_char  cp_dparam[0x400];       /* Parameter RAM */
444 } cpm8xx_t;
445
446 /* Internal memory map.
447 */
448 typedef struct immap {
449         sysconf8xx_t    im_siu_conf;    /* SIU Configuration */
450         pcmconf8xx_t    im_pcmcia;      /* PCMCIA Configuration */
451         memctl8xx_t     im_memctl;      /* Memory Controller */
452         sit8xx_t        im_sit;         /* System integration timers */
453         car8xx_t        im_clkrst;      /* Clocks and reset */
454         sitk8xx_t       im_sitk;        /* Sys int timer keys */
455         cark8xx_t       im_clkrstk;     /* Clocks and reset keys */
456         lcd8xx_t        im_lcd;         /* LCD (821 and 823 only) */
457         i2c8xx_t        im_i2c;         /* I2C control/status */
458         sdma8xx_t       im_sdma;        /* SDMA control/status */
459         cpic8xx_t       im_cpic;        /* CPM Interrupt Controller */
460         iop8xx_t        im_ioport;      /* IO Port control/status */
461         cpmtimer8xx_t   im_cpmtimer;    /* CPM timers */
462         cpm8xx_t        im_cpm;         /* Communication processor */
463 } immap_t;
464
465 #endif /* __IMMAP_8XX__ */
466 #endif /* __KERNEL__ */