ppc4xx: Enable Primordial Stack for 40x and Unify ECC Handling
[oweals/u-boot.git] / include / ppc4xx.h
1 /*----------------------------------------------------------------------------+
2 |
3 |       This source code has been made available to you by IBM on an AS-IS
4 |       basis.  Anyone receiving this source is licensed under IBM
5 |       copyrights to use it in any way he or she deems fit, including
6 |       copying it, modifying it, compiling it, and redistributing it either
7 |       with or without modifications.  No license under IBM patents or
8 |       patent applications is to be implied by the copyright license.
9 |
10 |       Any user of this software should understand that IBM cannot provide
11 |       technical support for this software and will not be responsible for
12 |       any consequences resulting from the use of this software.
13 |
14 |       Any person who transfers this source code or any derivative work
15 |       must include the IBM copyright notice, this paragraph, and the
16 |       preceding two paragraphs in the transferred software.
17 |
18 |       COPYRIGHT   I B M   CORPORATION 1999
19 |       LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M
20 +----------------------------------------------------------------------------*/
21
22 #ifndef __PPC4XX_H__
23 #define __PPC4XX_H__
24
25 #if defined(CONFIG_440)
26 #include <ppc440.h>
27 #else
28 #include <ppc405.h>
29 #endif
30
31 /*
32  * Macro for generating register field mnemonics
33  */
34 #define PPC_REG_BITS            32
35 #define PPC_REG_VAL(bit, value) ((value) << ((PPC_REG_BITS - 1) - (bit)))
36
37 /*
38  * Elide casts when assembling register mnemonics
39  */
40 #ifndef __ASSEMBLY__
41 #define static_cast(type, val)  (type)(val)
42 #else
43 #define static_cast(type, val)  (val)
44 #endif
45
46 /*
47  * Common stuff for 4xx (405 and 440)
48  */
49
50 #define EXC_OFF_SYS_RESET       0x0100  /* System reset                         */
51 #define _START_OFFSET           (EXC_OFF_SYS_RESET + 0x2000)
52
53 #define RESET_VECTOR    0xfffffffc
54 #define CACHELINE_MASK  (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
55                                                      line aligned data. */
56
57 #define CPR0_DCR_BASE   0x0C
58 #define cprcfga         (CPR0_DCR_BASE+0x0)
59 #define cprcfgd         (CPR0_DCR_BASE+0x1)
60
61 #define SDR_DCR_BASE    0x0E
62 #define sdrcfga         (SDR_DCR_BASE+0x0)
63 #define sdrcfgd         (SDR_DCR_BASE+0x1)
64
65 #define SDRAM_DCR_BASE  0x10
66 #define memcfga         (SDRAM_DCR_BASE+0x0)
67 #define memcfgd         (SDRAM_DCR_BASE+0x1)
68
69 #define EBC_DCR_BASE    0x12
70 #define ebccfga         (EBC_DCR_BASE+0x0)
71 #define ebccfgd         (EBC_DCR_BASE+0x1)
72
73 /*
74  * Macros for indirect DCR access
75  */
76 #define mtcpr(reg, d)   do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,d); } while (0)
77 #define mfcpr(reg, d)   do { mtdcr(cprcfga,reg);d = mfdcr(cprcfgd); } while (0)
78
79 #define mtebc(reg, d)   do { mtdcr(ebccfga,reg);mtdcr(ebccfgd,d); } while (0)
80 #define mfebc(reg, d)   do { mtdcr(ebccfga,reg);d = mfdcr(ebccfgd); } while (0)
81
82 #define mtsdram(reg, d) do { mtdcr(memcfga,reg);mtdcr(memcfgd,d); } while (0)
83 #define mfsdram(reg, d) do { mtdcr(memcfga,reg);d = mfdcr(memcfgd); } while (0)
84
85 #define mtsdr(reg, d)   do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,d); } while (0)
86 #define mfsdr(reg, d)   do { mtdcr(sdrcfga,reg);d = mfdcr(sdrcfgd); } while (0)
87
88 #ifndef __ASSEMBLY__
89
90 typedef struct
91 {
92         unsigned long freqDDR;
93         unsigned long freqEBC;
94         unsigned long freqOPB;
95         unsigned long freqPCI;
96         unsigned long freqPLB;
97         unsigned long freqTmrClk;
98         unsigned long freqUART;
99         unsigned long freqProcessor;
100         unsigned long freqVCOHz;
101         unsigned long freqVCOMhz;       /* in MHz                          */
102         unsigned long pciClkSync;       /* PCI clock is synchronous        */
103         unsigned long pciIntArbEn;      /* Internal PCI arbiter is enabled */
104         unsigned long pllExtBusDiv;
105         unsigned long pllFbkDiv;
106         unsigned long pllFwdDiv;
107         unsigned long pllFwdDivA;
108         unsigned long pllFwdDivB;
109         unsigned long pllOpbDiv;
110         unsigned long pllPciDiv;
111         unsigned long pllPlbDiv;
112 } PPC4xx_SYS_INFO;
113
114 #endif  /* __ASSEMBLY__ */
115
116 #endif  /* __PPC4XX_H__ */