e0b6a8586e53c4db841d030052287cfcabcb10db
[platform/kernel/u-boot.git] / arch / powerpc / include / asm / ppc405ep.h
1 /*
2  * (C) Copyright 2010
3  * Stefan Roese, DENX Software Engineering, sr@denx.de.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA
19  */
20
21 #ifndef _PPC405EP_H_
22 #define _PPC405EP_H_
23
24 #define CONFIG_SDRAM_PPC4xx_IBM_SDRAM   /* IBM SDRAM controller */
25
26 /* Memory mapped register */
27 #define GPIO0_BASE      0xef600700
28
29 /* DCR */
30 #define OCM0_ISCNTL     0x0019  /* OCM I-side control reg */
31 #define OCM0_DSARC      0x001a  /* OCM D-side address compare */
32 #define OCM0_DSCNTL     0x001b  /* OCM D-side control */
33 #define CPC0_PLLMR0     0x00f0  /* PLL mode  register 0 */
34 #define CPC0_BOOT       0x00f1  /* Clock status register        */
35 #define CPC0_CR1        0x00f2  /* Chip Control 1 register */
36 #define CPC0_EPCTL      0x00f3  /* EMAC to PHY control register */
37 #define CPC0_PLLMR1     0x00f4  /* PLL mode  register 1 */
38 #define CPC0_UCR        0x00f5  /* UART control register        */
39 #define CPC0_SRR        0x00f6  /* Soft Reset register */
40 #define CPC0_PCI        0x00f9  /* PCI control register */
41
42 /* Defines for CPC0_EPCTL register */
43 #define CPC0_EPCTL_E0NFE        0x80000000
44 #define CPC0_EPCTL_E1NFE        0x40000000
45
46 /* Defines for CPC0_PCI Register */
47 #define CPC0_PCI_SPE            0x00000010      /* PCIINT/WE select      */
48 #define CPC0_PCI_HOST_CFG_EN    0x00000008      /* PCI host config Enable */
49 #define CPC0_PCI_ARBIT_EN       0x00000001      /* PCI Internal Arb Enabled */
50
51 /* Defines for CPC0_BOOR Register */
52 #define CPC0_BOOT_SEP           0x00000002      /* serial EEPROM present */
53
54 /* Bit definitions */
55 #define PLLMR0_CPU_DIV_MASK     0x00300000      /* CPU clock divider */
56 #define PLLMR0_CPU_DIV_BYPASS   0x00000000
57 #define PLLMR0_CPU_DIV_2        0x00100000
58 #define PLLMR0_CPU_DIV_3        0x00200000
59 #define PLLMR0_CPU_DIV_4        0x00300000
60
61 #define PLLMR0_CPU_TO_PLB_MASK  0x00030000      /* CPU:PLB Frequency Divisor */
62 #define PLLMR0_CPU_PLB_DIV_1    0x00000000
63 #define PLLMR0_CPU_PLB_DIV_2    0x00010000
64 #define PLLMR0_CPU_PLB_DIV_3    0x00020000
65 #define PLLMR0_CPU_PLB_DIV_4    0x00030000
66
67 #define PLLMR0_OPB_TO_PLB_MASK  0x00003000      /* OPB:PLB Frequency Divisor */
68 #define PLLMR0_OPB_PLB_DIV_1    0x00000000
69 #define PLLMR0_OPB_PLB_DIV_2    0x00001000
70 #define PLLMR0_OPB_PLB_DIV_3    0x00002000
71 #define PLLMR0_OPB_PLB_DIV_4    0x00003000
72
73 #define PLLMR0_EXB_TO_PLB_MASK  0x00000300      /* External Bus:PLB Divisor */
74 #define PLLMR0_EXB_PLB_DIV_2    0x00000000
75 #define PLLMR0_EXB_PLB_DIV_3    0x00000100
76 #define PLLMR0_EXB_PLB_DIV_4    0x00000200
77 #define PLLMR0_EXB_PLB_DIV_5    0x00000300
78
79 #define PLLMR0_MAL_TO_PLB_MASK  0x00000030      /* MAL:PLB Divisor */
80 #define PLLMR0_MAL_PLB_DIV_1    0x00000000
81 #define PLLMR0_MAL_PLB_DIV_2    0x00000010
82 #define PLLMR0_MAL_PLB_DIV_3    0x00000020
83 #define PLLMR0_MAL_PLB_DIV_4    0x00000030
84
85 #define PLLMR0_PCI_TO_PLB_MASK  0x00000003      /* PCI:PLB Frequency Divisor */
86 #define PLLMR0_PCI_PLB_DIV_1    0x00000000
87 #define PLLMR0_PCI_PLB_DIV_2    0x00000001
88 #define PLLMR0_PCI_PLB_DIV_3    0x00000002
89 #define PLLMR0_PCI_PLB_DIV_4    0x00000003
90
91 #define PLLMR1_SSCS_MASK        0x80000000      /* Select system clock source */
92 #define PLLMR1_PLLR_MASK        0x40000000      /* PLL reset */
93 #define PLLMR1_FBMUL_MASK       0x00F00000      /* PLL feedback multiplier value */
94
95 #define PLLMR1_FWDVA_MASK       0x00070000      /* PLL forward divider A value */
96 #define PLLMR1_FWDVB_MASK       0x00007000      /* PLL forward divider B value */
97 #define PLLMR1_TUNING_MASK      0x000003FF      /* PLL tune bits */
98
99 /* Defines for CPC0_PLLMR1 Register fields */
100 #define PLL_ACTIVE              0x80000000
101 #define CPC0_PLLMR1_SSCS        0x80000000
102 #define PLL_RESET               0x40000000
103 #define CPC0_PLLMR1_PLLR        0x40000000
104 /* Feedback multiplier */
105 #define PLL_FBKDIV              0x00F00000
106 #define CPC0_PLLMR1_FBDV        0x00F00000
107 #define PLL_FBKDIV_16           0x00000000
108 #define PLL_FBKDIV_1            0x00100000
109 #define PLL_FBKDIV_2            0x00200000
110 #define PLL_FBKDIV_3            0x00300000
111 #define PLL_FBKDIV_4            0x00400000
112 #define PLL_FBKDIV_5            0x00500000
113 #define PLL_FBKDIV_6            0x00600000
114 #define PLL_FBKDIV_7            0x00700000
115 #define PLL_FBKDIV_8            0x00800000
116 #define PLL_FBKDIV_9            0x00900000
117 #define PLL_FBKDIV_10           0x00A00000
118 #define PLL_FBKDIV_11           0x00B00000
119 #define PLL_FBKDIV_12           0x00C00000
120 #define PLL_FBKDIV_13           0x00D00000
121 #define PLL_FBKDIV_14           0x00E00000
122 #define PLL_FBKDIV_15           0x00F00000
123 /* Forward A divisor */
124 #define PLL_FWDDIVA             0x00070000
125 #define CPC0_PLLMR1_FWDVA       0x00070000
126 #define PLL_FWDDIVA_8           0x00000000
127 #define PLL_FWDDIVA_7           0x00010000
128 #define PLL_FWDDIVA_6           0x00020000
129 #define PLL_FWDDIVA_5           0x00030000
130 #define PLL_FWDDIVA_4           0x00040000
131 #define PLL_FWDDIVA_3           0x00050000
132 #define PLL_FWDDIVA_2           0x00060000
133 #define PLL_FWDDIVA_1           0x00070000
134 /* Forward B divisor */
135 #define PLL_FWDDIVB             0x00007000
136 #define CPC0_PLLMR1_FWDVB       0x00007000
137 #define PLL_FWDDIVB_8           0x00000000
138 #define PLL_FWDDIVB_7           0x00001000
139 #define PLL_FWDDIVB_6           0x00002000
140 #define PLL_FWDDIVB_5           0x00003000
141 #define PLL_FWDDIVB_4           0x00004000
142 #define PLL_FWDDIVB_3           0x00005000
143 #define PLL_FWDDIVB_2           0x00006000
144 #define PLL_FWDDIVB_1           0x00007000
145 /* PLL tune bits */
146 #define PLL_TUNE_MASK           0x000003FF
147 #define PLL_TUNE_2_M_3          0x00000133      /*  2 <= M <= 3 */
148 #define PLL_TUNE_4_M_6          0x00000134      /*  3 <  M <= 6 */
149 #define PLL_TUNE_7_M_10         0x00000138      /*  6 <  M <= 10 */
150 #define PLL_TUNE_11_M_14        0x0000013C      /* 10 <  M <= 14 */
151 #define PLL_TUNE_15_M_40        0x0000023E      /* 14 <  M <= 40 */
152 #define PLL_TUNE_VCO_LOW        0x00000000      /* 500MHz <= VCO <=  800MHz */
153 #define PLL_TUNE_VCO_HI         0x00000080      /* 800MHz <  VCO <= 1000MHz */
154
155 /* Defines for CPC0_PLLMR0 Register fields */
156 /* CPU divisor */
157 #define PLL_CPUDIV              0x00300000
158 #define CPC0_PLLMR0_CCDV        0x00300000
159 #define PLL_CPUDIV_1            0x00000000
160 #define PLL_CPUDIV_2            0x00100000
161 #define PLL_CPUDIV_3            0x00200000
162 #define PLL_CPUDIV_4            0x00300000
163 /* PLB divisor */
164 #define PLL_PLBDIV              0x00030000
165 #define CPC0_PLLMR0_CBDV        0x00030000
166 #define PLL_PLBDIV_1            0x00000000
167 #define PLL_PLBDIV_2            0x00010000
168 #define PLL_PLBDIV_3            0x00020000
169 #define PLL_PLBDIV_4            0x00030000
170 /* OPB divisor */
171 #define PLL_OPBDIV              0x00003000
172 #define CPC0_PLLMR0_OPDV        0x00003000
173 #define PLL_OPBDIV_1            0x00000000
174 #define PLL_OPBDIV_2            0x00001000
175 #define PLL_OPBDIV_3            0x00002000
176 #define PLL_OPBDIV_4            0x00003000
177 /* EBC divisor */
178 #define PLL_EXTBUSDIV           0x00000300
179 #define CPC0_PLLMR0_EPDV        0x00000300
180 #define PLL_EXTBUSDIV_2         0x00000000
181 #define PLL_EXTBUSDIV_3         0x00000100
182 #define PLL_EXTBUSDIV_4         0x00000200
183 #define PLL_EXTBUSDIV_5         0x00000300
184 /* MAL divisor */
185 #define PLL_MALDIV              0x00000030
186 #define CPC0_PLLMR0_MPDV        0x00000030
187 #define PLL_MALDIV_1            0x00000000
188 #define PLL_MALDIV_2            0x00000010
189 #define PLL_MALDIV_3            0x00000020
190 #define PLL_MALDIV_4            0x00000030
191 /* PCI divisor */
192 #define PLL_PCIDIV              0x00000003
193 #define CPC0_PLLMR0_PPFD        0x00000003
194 #define PLL_PCIDIV_1            0x00000000
195 #define PLL_PCIDIV_2            0x00000001
196 #define PLL_PCIDIV_3            0x00000002
197 #define PLL_PCIDIV_4            0x00000003
198
199 /*
200  * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
201  * assuming a 33.3MHz input clock to the 405EP.
202  */
203 #define PLLMR0_266_133_66       (PLL_CPUDIV_1 | PLL_PLBDIV_2 |     \
204                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
205                                  PLL_MALDIV_1 | PLL_PCIDIV_4)
206 #define PLLMR1_266_133_66       (PLL_FBKDIV_8  |                        \
207                                  PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |        \
208                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
209
210 #define PLLMR0_133_66_66_33     (PLL_CPUDIV_1 | PLL_PLBDIV_1 |          \
211                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |       \
212                                  PLL_MALDIV_1 | PLL_PCIDIV_4)
213 #define PLLMR1_133_66_66_33     (PLL_FBKDIV_4  |                        \
214                                  PLL_FWDDIVA_6 | PLL_FWDDIVB_6 |        \
215                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
216 #define PLLMR0_200_100_50_33    (PLL_CPUDIV_1 | PLL_PLBDIV_2 |          \
217                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 |       \
218                                  PLL_MALDIV_1 | PLL_PCIDIV_4)
219 #define PLLMR1_200_100_50_33    (PLL_FBKDIV_6  |                        \
220                                  PLL_FWDDIVA_4 | PLL_FWDDIVB_4 |        \
221                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
222 #define PLLMR0_266_133_66_33    (PLL_CPUDIV_1 | PLL_PLBDIV_2 |          \
223                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |       \
224                                  PLL_MALDIV_1 | PLL_PCIDIV_4)
225 #define PLLMR1_266_133_66_33    (PLL_FBKDIV_8  |                        \
226                                  PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |        \
227                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
228 #define PLLMR0_266_66_33_33     (PLL_CPUDIV_1 | PLL_PLBDIV_4 |          \
229                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |       \
230                                  PLL_MALDIV_1 | PLL_PCIDIV_2)
231 #define PLLMR1_266_66_33_33     (PLL_FBKDIV_8  |                        \
232                                  PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |        \
233                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
234 #define PLLMR0_333_111_55_37    (PLL_CPUDIV_1 | PLL_PLBDIV_3 |          \
235                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |       \
236                                  PLL_MALDIV_1 | PLL_PCIDIV_3)
237 #define PLLMR1_333_111_55_37    (PLL_FBKDIV_10  |                       \
238                                  PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |        \
239                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
240 #define PLLMR0_333_111_55_111   (PLL_CPUDIV_1 | PLL_PLBDIV_3 |          \
241                                  PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |       \
242                                  PLL_MALDIV_1 | PLL_PCIDIV_1)
243 #define PLLMR1_333_111_55_111   (PLL_FBKDIV_10  |                       \
244                                  PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |        \
245                                  PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
246
247 #endif /* _PPC405EP_H_ */