This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-ppc / mpc52xx.h
1 /*
2  * include/asm-ppc/mpc52xx.h
3  * 
4  * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips
5  * May need to be cleaned as the port goes on ...
6  *
7  *
8  * Maintainer : Sylvain Munaut <tnt@246tNt.com>
9  *
10  * Originally written by Dale Farnsworth <dfarnsworth@mvista.com> 
11  * for the 2.4 kernel.
12  *
13  * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
14  * Copyright (C) 2003 MontaVista, Software, Inc.
15  *
16  * This file is licensed under the terms of the GNU General Public License
17  * version 2. This program is licensed "as is" without any warranty of any
18  * kind, whether express or implied.
19  */
20
21 #ifndef __ASM_MPC52xx_H__
22 #define __ASM_MPC52xx_H__
23
24 #ifndef __ASSEMBLY__
25 #include <asm/ppcboot.h>
26 #include <asm/types.h>
27
28 struct pt_regs;
29 struct ocp_def;
30 #endif /* __ASSEMBLY__ */
31
32
33 /* ======================================================================== */
34 /* Main registers/struct addresses                                          */
35 /* ======================================================================== */
36 /* Theses are PHYSICAL addresses !                                          */
37 /* TODO : There should be no static mapping, but it's not yet the case, so  */
38 /*        we require a 1:1 mapping                                          */
39
40 #define MPC52xx_MBAR            0xf0000000      /* Phys address */
41 #define MPC52xx_MBAR_SIZE       0x00010000
42 #define MPC52xx_MBAR_VIRT       0xf0000000      /* Virt address */
43
44 #define MPC52xx_MMAP_CTL        (MPC52xx_MBAR + 0x0000)
45 #define MPC52xx_CDM             (MPC52xx_MBAR + 0x0200)
46 #define MPC52xx_SFTRST          (MPC52xx_MBAR + 0x0220)
47 #define MPC52xx_SFTRST_BIT      0x01000000
48 #define MPC52xx_INTR            (MPC52xx_MBAR + 0x0500)
49 #define MPC52xx_GPTx(x)         (MPC52xx_MBAR + 0x0600 + ((x)<<4))
50 #define MPC52xx_RTC             (MPC52xx_MBAR + 0x0800)
51 #define MPC52xx_MSCAN1          (MPC52xx_MBAR + 0x0900)
52 #define MPC52xx_MSCAN2          (MPC52xx_MBAR + 0x0980)
53 #define MPC52xx_GPIO            (MPC52xx_MBAR + 0x0b00)
54 #define MPC52xx_PCI             (MPC52xx_MBAR + 0x0d00)
55 #define MPC52xx_USB_OHCI        (MPC52xx_MBAR + 0x1000)
56 #define MPC52xx_SDMA            (MPC52xx_MBAR + 0x1200)
57 #define MPC52xx_XLB             (MPC52xx_MBAR + 0x1f00)
58 #define MPC52xx_PSCx(x)         (MPC52xx_MBAR + 0x2000 + ((x)<<9))
59 #define MPC52xx_PSC1            (MPC52xx_MBAR + 0x2000)
60 #define MPC52xx_PSC2            (MPC52xx_MBAR + 0x2200)
61 #define MPC52xx_PSC3            (MPC52xx_MBAR + 0x2400)
62 #define MPC52xx_PSC4            (MPC52xx_MBAR + 0x2600)
63 #define MPC52xx_PSC5            (MPC52xx_MBAR + 0x2800)
64 #define MPC52xx_PSC6            (MPC52xx_MBAR + 0x2C00)
65 #define MPC52xx_FEC             (MPC52xx_MBAR + 0x3000)
66 #define MPC52xx_ATA             (MPC52xx_MBAR + 0x3a00)
67 #define MPC52xx_I2C1            (MPC52xx_MBAR + 0x3d00)
68 #define MPC52xx_I2C_MICR        (MPC52xx_MBAR + 0x3d20)
69 #define MPC52xx_I2C2            (MPC52xx_MBAR + 0x3d40)
70
71 /* SRAM used for SDMA */
72 #define MPC52xx_SRAM            (MPC52xx_MBAR + 0x8000)
73 #define MPC52xx_SRAM_SIZE       (16*1024)
74 #define MPC52xx_SDMA_MAX_TASKS  16
75
76         /* Memory allocation block size */
77 #define MPC52xx_SDRAM_UNIT      0x8000          /* 32K byte */
78
79
80 /* ======================================================================== */
81 /* IRQ mapping                                                              */
82 /* ======================================================================== */
83 /* Be sure to look at mpc52xx_pic.h if you wish for whatever reason to change
84  * this
85  */
86
87 #define MPC52xx_CRIT_IRQ_NUM    4
88 #define MPC52xx_MAIN_IRQ_NUM    17
89 #define MPC52xx_SDMA_IRQ_NUM    17
90 #define MPC52xx_PERP_IRQ_NUM    23
91
92 #define MPC52xx_CRIT_IRQ_BASE   0
93 #define MPC52xx_MAIN_IRQ_BASE   (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM)
94 #define MPC52xx_SDMA_IRQ_BASE   (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM)
95 #define MPC52xx_PERP_IRQ_BASE   (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)
96
97 #define MPC52xx_IRQ0                    (MPC52xx_CRIT_IRQ_BASE + 0)
98 #define MPC52xx_SLICE_TIMER_0_IRQ       (MPC52xx_CRIT_IRQ_BASE + 1)
99 #define MPC52xx_HI_INT_IRQ              (MPC52xx_CRIT_IRQ_BASE + 2)
100 #define MPC52xx_CCS_IRQ                 (MPC52xx_CRIT_IRQ_BASE + 3)
101
102 #define MPC52xx_IRQ1                    (MPC52xx_MAIN_IRQ_BASE + 1)
103 #define MPC52xx_IRQ2                    (MPC52xx_MAIN_IRQ_BASE + 2)
104 #define MPC52xx_IRQ3                    (MPC52xx_MAIN_IRQ_BASE + 3)
105
106 #define MPC52xx_SDMA_IRQ                (MPC52xx_PERP_IRQ_BASE + 0)
107 #define MPC52xx_PSC1_IRQ                (MPC52xx_PERP_IRQ_BASE + 1)
108 #define MPC52xx_PSC2_IRQ                (MPC52xx_PERP_IRQ_BASE + 2)
109 #define MPC52xx_PSC3_IRQ                (MPC52xx_PERP_IRQ_BASE + 3)
110 #define MPC52xx_PSC6_IRQ                (MPC52xx_PERP_IRQ_BASE + 4)
111 #define MPC52xx_IRDA_IRQ                (MPC52xx_PERP_IRQ_BASE + 4)
112 #define MPC52xx_FEC_IRQ                 (MPC52xx_PERP_IRQ_BASE + 5)
113 #define MPC52xx_USB_IRQ                 (MPC52xx_PERP_IRQ_BASE + 6)
114 #define MPC52xx_ATA_IRQ                 (MPC52xx_PERP_IRQ_BASE + 7)
115 #define MPC52xx_PCI_CNTRL_IRQ           (MPC52xx_PERP_IRQ_BASE + 8)
116 #define MPC52xx_PCI_SCIRX_IRQ           (MPC52xx_PERP_IRQ_BASE + 9)
117 #define MPC52xx_PCI_SCITX_IRQ           (MPC52xx_PERP_IRQ_BASE + 10)
118 #define MPC52xx_PSC4_IRQ                (MPC52xx_PERP_IRQ_BASE + 11)
119 #define MPC52xx_PSC5_IRQ                (MPC52xx_PERP_IRQ_BASE + 12)
120 #define MPC52xx_SPI_MODF_IRQ            (MPC52xx_PERP_IRQ_BASE + 13)
121 #define MPC52xx_SPI_SPIF_IRQ            (MPC52xx_PERP_IRQ_BASE + 14)
122 #define MPC52xx_I2C1_IRQ                (MPC52xx_PERP_IRQ_BASE + 15)
123 #define MPC52xx_I2C2_IRQ                (MPC52xx_PERP_IRQ_BASE + 16)
124 #define MPC52xx_CAN1_IRQ                (MPC52xx_PERP_IRQ_BASE + 17)
125 #define MPC52xx_CAN2_IRQ                (MPC52xx_PERP_IRQ_BASE + 18)
126 #define MPC52xx_IR_RX_IRQ               (MPC52xx_PERP_IRQ_BASE + 19)
127 #define MPC52xx_IR_TX_IRQ               (MPC52xx_PERP_IRQ_BASE + 20)
128 #define MPC52xx_XLB_ARB_IRQ             (MPC52xx_PERP_IRQ_BASE + 21)
129
130
131
132 /* ======================================================================== */
133 /* Structures mapping of some unit register set                             */
134 /* ======================================================================== */
135
136 #ifndef __ASSEMBLY__
137
138 /* Memory Mapping Control */
139 struct mpc52xx_mmap_ctl {
140         volatile u32    mbar;           /* MMAP_CTRL + 0x00 */
141
142         volatile u32    cs0_start;      /* MMAP_CTRL + 0x04 */
143         volatile u32    cs0_stop;       /* MMAP_CTRL + 0x08 */
144         volatile u32    cs1_start;      /* MMAP_CTRL + 0x0c */
145         volatile u32    cs1_stop;       /* MMAP_CTRL + 0x10 */
146         volatile u32    cs2_start;      /* MMAP_CTRL + 0x14 */
147         volatile u32    cs2_stop;       /* MMAP_CTRL + 0x18 */
148         volatile u32    cs3_start;      /* MMAP_CTRL + 0x1c */
149         volatile u32    cs3_stop;       /* MMAP_CTRL + 0x20 */
150         volatile u32    cs4_start;      /* MMAP_CTRL + 0x24 */
151         volatile u32    cs4_stop;       /* MMAP_CTRL + 0x28 */
152         volatile u32    cs5_start;      /* MMAP_CTRL + 0x2c */
153         volatile u32    cs5_stop;       /* MMAP_CTRL + 0x30 */
154
155         volatile u32    sdram0;         /* MMAP_CTRL + 0x34 */
156         volatile u32    sdram1;         /* MMAP_CTRL + 0X38 */
157
158         volatile u32    reserved[4];    /* MMAP_CTRL + 0x3c .. 0x48 */
159
160         volatile u32    boot_start;     /* MMAP_CTRL + 0x4c */
161         volatile u32    boot_stop;      /* MMAP_CTRL + 0x50 */
162         
163         volatile u32    ipbi_ws_ctrl;   /* MMAP_CTRL + 0x54 */
164         
165         volatile u32    cs6_start;      /* MMAP_CTRL + 0x58 */
166         volatile u32    cs6_stop;       /* MMAP_CTRL + 0x5c */
167         volatile u32    cs7_start;      /* MMAP_CTRL + 0x60 */
168         volatile u32    cs7_stop;       /* MMAP_CTRL + 0x60 */
169 };
170
171 /* Interrupt controller */
172 struct mpc52xx_intr {
173         volatile u32    per_mask;       /* INTR + 0x00 */
174         volatile u32    per_pri1;       /* INTR + 0x04 */
175         volatile u32    per_pri2;       /* INTR + 0x08 */
176         volatile u32    per_pri3;       /* INTR + 0x0c */
177         volatile u32    ctrl;           /* INTR + 0x10 */
178         volatile u32    main_mask;      /* INTR + 0x14 */
179         volatile u32    main_pri1;      /* INTR + 0x18 */
180         volatile u32    main_pri2;      /* INTR + 0x1c */
181         volatile u32    reserved1;      /* INTR + 0x20 */
182         volatile u32    enc_status;     /* INTR + 0x24 */
183         volatile u32    crit_status;    /* INTR + 0x28 */
184         volatile u32    main_status;    /* INTR + 0x2c */
185         volatile u32    per_status;     /* INTR + 0x30 */
186         volatile u32    reserved2;      /* INTR + 0x34 */
187         volatile u32    per_error;      /* INTR + 0x38 */
188 };
189
190 /* SDMA */
191 struct mpc52xx_sdma {
192         volatile u32    taskBar;        /* SDMA + 0x00 */
193         volatile u32    currentPointer; /* SDMA + 0x04 */
194         volatile u32    endPointer;     /* SDMA + 0x08 */
195         volatile u32    variablePointer;/* SDMA + 0x0c */
196
197         volatile u8     IntVect1;       /* SDMA + 0x10 */
198         volatile u8     IntVect2;       /* SDMA + 0x11 */
199         volatile u16    PtdCntrl;       /* SDMA + 0x12 */
200
201         volatile u32    IntPend;        /* SDMA + 0x14 */
202         volatile u32    IntMask;        /* SDMA + 0x18 */
203         
204         volatile u16    tcr[16];        /* SDMA + 0x1c .. 0x3a */
205
206         volatile u8     ipr[31];        /* SDMA + 0x3c .. 5b */
207
208         volatile u32    res1;           /* SDMA + 0x5c */
209         volatile u32    task_size0;     /* SDMA + 0x60 */
210         volatile u32    task_size1;     /* SDMA + 0x64 */
211         volatile u32    MDEDebug;       /* SDMA + 0x68 */
212         volatile u32    ADSDebug;       /* SDMA + 0x6c */
213         volatile u32    Value1;         /* SDMA + 0x70 */
214         volatile u32    Value2;         /* SDMA + 0x74 */
215         volatile u32    Control;        /* SDMA + 0x78 */
216         volatile u32    Status;         /* SDMA + 0x7c */
217 };
218
219 /* GPT */
220 struct mpc52xx_gpt {
221         volatile u32    mode;           /* GPTx + 0x00 */
222         volatile u32    count;          /* GPTx + 0x04 */
223         volatile u32    pwm;            /* GPTx + 0x08 */
224         volatile u32    status;         /* GPTx + 0X0c */
225 };
226
227 /* RTC */
228 struct mpc52xx_rtc {
229         volatile u32    time_set;       /* RTC + 0x00 */
230         volatile u32    date_set;       /* RTC + 0x04 */
231         volatile u32    stopwatch;      /* RTC + 0x08 */
232         volatile u32    int_enable;     /* RTC + 0x0c */
233         volatile u32    time;           /* RTC + 0x10 */
234         volatile u32    date;           /* RTC + 0x14 */
235         volatile u32    stopwatch_intr; /* RTC + 0x18 */
236         volatile u32    bus_error;      /* RTC + 0x1c */
237         volatile u32    dividers;       /* RTC + 0x20 */
238 };
239
240 /* GPIO */
241 struct mpc52xx_gpio {
242         volatile u32    port_config;    /* GPIO + 0x00 */
243         volatile u32    simple_gpioe;   /* GPIO + 0x04 */
244         volatile u32    simple_ode;     /* GPIO + 0x08 */
245         volatile u32    simple_ddr;     /* GPIO + 0x0c */
246         volatile u32    simple_dvo;     /* GPIO + 0x10 */
247         volatile u32    simple_ival;    /* GPIO + 0x14 */
248         volatile u8     outo_gpioe;     /* GPIO + 0x18 */
249         volatile u8     reserved1[3];   /* GPIO + 0x19 */
250         volatile u8     outo_dvo;       /* GPIO + 0x1c */
251         volatile u8     reserved2[3];   /* GPIO + 0x1d */
252         volatile u8     sint_gpioe;     /* GPIO + 0x20 */
253         volatile u8     reserved3[3];   /* GPIO + 0x21 */
254         volatile u8     sint_ode;       /* GPIO + 0x24 */
255         volatile u8     reserved4[3];   /* GPIO + 0x25 */
256         volatile u8     sint_ddr;       /* GPIO + 0x28 */
257         volatile u8     reserved5[3];   /* GPIO + 0x29 */
258         volatile u8     sint_dvo;       /* GPIO + 0x2c */
259         volatile u8     reserved6[3];   /* GPIO + 0x2d */
260         volatile u8     sint_inten;     /* GPIO + 0x30 */
261         volatile u8     reserved7[3];   /* GPIO + 0x31 */
262         volatile u16    sint_itype;     /* GPIO + 0x34 */
263         volatile u16    reserved8;      /* GPIO + 0x36 */
264         volatile u8     gpio_control;   /* GPIO + 0x38 */
265         volatile u8     reserved9[3];   /* GPIO + 0x39 */
266         volatile u8     sint_istat;     /* GPIO + 0x3c */
267         volatile u8     sint_ival;      /* GPIO + 0x3d */
268         volatile u8     bus_errs;       /* GPIO + 0x3e */
269         volatile u8     reserved10;     /* GPIO + 0x3f */
270 };
271
272 #define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD 4
273 #define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD    5
274 #define MPC52xx_GPIO_PCI_DIS                    (1<<15)
275
276 /* XLB Bus control */
277 struct mpc52xx_xlb {
278         volatile u8 reserved[0x40];
279         volatile u32 config;            /* XLB + 0x40 */
280         volatile u32 version;           /* XLB + 0x44 */
281         volatile u32 status;            /* XLB + 0x48 */
282         volatile u32 int_enable;        /* XLB + 0x4c */
283         volatile u32 addr_capture;      /* XLB + 0x50 */
284         volatile u32 bus_sig_capture;   /* XLB + 0x54 */
285         volatile u32 addr_timeout;      /* XLB + 0x58 */
286         volatile u32 data_timeout;      /* XLB + 0x5c */
287         volatile u32 bus_act_timeout;   /* XLB + 0x60 */
288         volatile u32 master_pri_enable; /* XLB + 0x64 */
289         volatile u32 master_priority;   /* XLB + 0x68 */
290         volatile u32 base_address;      /* XLB + 0x6c */
291         volatile u32 snoop_window;      /* XLB + 0x70 */
292 };
293
294
295 /* Clock Distribution control */
296 struct mpc52xx_cdm {
297         volatile u32    jtag_id;        /* MBAR_CDM + 0x00  reg0 read only */
298         volatile u32    rstcfg;         /* MBAR_CDM + 0x04  reg1 read only */
299         volatile u32    breadcrumb;     /* MBAR_CDM + 0x08  reg2 */
300
301         volatile u8     mem_clk_sel;    /* MBAR_CDM + 0x0c  reg3 byte0 */
302         volatile u8     xlb_clk_sel;    /* MBAR_CDM + 0x0d  reg3 byte1 read only */
303         volatile u8     ipb_clk_sel;    /* MBAR_CDM + 0x0e  reg3 byte2 */
304         volatile u8     pci_clk_sel;    /* MBAR_CDM + 0x0f  reg3 byte3 */
305
306         volatile u8     ext_48mhz_en;   /* MBAR_CDM + 0x10  reg4 byte0 */
307         volatile u8     fd_enable;      /* MBAR_CDM + 0x11  reg4 byte1 */
308         volatile u16    fd_counters;    /* MBAR_CDM + 0x12  reg4 byte2,3 */
309
310         volatile u32    clk_enables;    /* MBAR_CDM + 0x14  reg5 */
311
312         volatile u8     osc_disable;    /* MBAR_CDM + 0x18  reg6 byte0 */
313         volatile u8     reserved0[3];   /* MBAR_CDM + 0x19  reg6 byte1,2,3 */
314
315         volatile u8     ccs_sleep_enable;/* MBAR_CDM + 0x1c  reg7 byte0 */
316         volatile u8     osc_sleep_enable;/* MBAR_CDM + 0x1d  reg7 byte1 */
317         volatile u8     reserved1;      /* MBAR_CDM + 0x1e  reg7 byte2 */
318         volatile u8     ccs_qreq_test;  /* MBAR_CDM + 0x1f  reg7 byte3 */
319
320         volatile u8     soft_reset;     /* MBAR_CDM + 0x20  u8 byte0 */
321         volatile u8     no_ckstp;       /* MBAR_CDM + 0x21  u8 byte0 */
322         volatile u8     reserved2[2];   /* MBAR_CDM + 0x22  u8 byte1,2,3 */
323
324         volatile u8     pll_lock;       /* MBAR_CDM + 0x24  reg9 byte0 */
325         volatile u8     pll_looselock;  /* MBAR_CDM + 0x25  reg9 byte1 */
326         volatile u8     pll_sm_lockwin; /* MBAR_CDM + 0x26  reg9 byte2 */
327         volatile u8     reserved3;      /* MBAR_CDM + 0x27  reg9 byte3 */
328
329         volatile u16    reserved4;      /* MBAR_CDM + 0x28  reg10 byte0,1 */
330         volatile u16    mclken_div_psc1;/* MBAR_CDM + 0x2a  reg10 byte2,3 */
331     
332         volatile u16    reserved5;      /* MBAR_CDM + 0x2c  reg11 byte0,1 */
333         volatile u16    mclken_div_psc2;/* MBAR_CDM + 0x2e  reg11 byte2,3 */
334                 
335         volatile u16    reserved6;      /* MBAR_CDM + 0x30  reg12 byte0,1 */
336         volatile u16    mclken_div_psc3;/* MBAR_CDM + 0x32  reg12 byte2,3 */
337     
338         volatile u16    reserved7;      /* MBAR_CDM + 0x34  reg13 byte0,1 */
339         volatile u16    mclken_div_psc6;/* MBAR_CDM + 0x36  reg13 byte2,3 */
340 };
341
342 #endif /* __ASSEMBLY__ */
343
344
345 /* ========================================================================= */
346 /* Prototypes for MPC52xx syslib                                             */
347 /* ========================================================================= */
348
349 #ifndef __ASSEMBLY__
350
351 extern void mpc52xx_init_irq(void);
352 extern int mpc52xx_get_irq(struct pt_regs *regs);
353
354 extern unsigned long mpc52xx_find_end_of_memory(void);
355 extern void mpc52xx_set_bat(void);
356 extern void mpc52xx_map_io(void);
357 extern void mpc52xx_restart(char *cmd);
358 extern void mpc52xx_halt(void);
359 extern void mpc52xx_power_off(void);
360 extern void mpc52xx_progress(char *s, unsigned short hex);
361 extern void mpc52xx_calibrate_decr(void);
362 extern void mpc52xx_add_board_devices(struct ocp_def board_ocp[]);
363
364 #endif /* __ASSEMBLY__ */
365
366
367 /* ========================================================================= */
368 /* Platform configuration                                                    */
369 /* ========================================================================= */
370
371 /* The U-Boot platform information struct */
372 extern bd_t __res;
373
374 /* Platform options */
375 #if defined(CONFIG_LITE5200)
376 #include <platforms/lite5200.h>
377 #endif
378
379
380 #endif /* __ASM_MPC52xx_H__ */