Commit 2973b098baf6fcb49d9fb7a2ed187e6a65532175

Authored by Valentin Longchamp
Committed by Tom Rini
1 parent f32b3d3fce

82xx/km82xx: read the IVM eeprom earlier

This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>

Showing 2 changed files with 11 additions and 1 deletions Inline Diff

board/keymile/km82xx/km82xx.c
1 /* 1 /*
2 * (C) Copyright 2007 - 2008 2 * (C) Copyright 2007 - 2008
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #include <common.h> 8 #include <common.h>
9 #include <mpc8260.h> 9 #include <mpc8260.h>
10 #include <ioports.h> 10 #include <ioports.h>
11 #include <malloc.h> 11 #include <malloc.h>
12 #include <asm/io.h> 12 #include <asm/io.h>
13 13
14 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) 14 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
15 #include <libfdt.h> 15 #include <libfdt.h>
16 #endif 16 #endif
17 17
18 #include <i2c.h> 18 #include <i2c.h>
19 #include "../common/common.h" 19 #include "../common/common.h"
20 20
21 static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
22
21 /* 23 /*
22 * I/O Port configuration table 24 * I/O Port configuration table
23 * 25 *
24 * if conf is 1, then that port pin will be configured at boot time 26 * if conf is 1, then that port pin will be configured at boot time
25 * according to the five values podr/pdir/ppar/psor/pdat for that entry 27 * according to the five values podr/pdir/ppar/psor/pdat for that entry
26 */ 28 */
27 const iop_conf_t iop_conf_tab[4][32] = { 29 const iop_conf_t iop_conf_tab[4][32] = {
28 30
29 /* Port A */ 31 /* Port A */
30 { /* conf ppar psor pdir podr pdat */ 32 { /* conf ppar psor pdir podr pdat */
31 { 0, 0, 0, 0, 0, 0 }, /* PA31 */ 33 { 0, 0, 0, 0, 0, 0 }, /* PA31 */
32 { 0, 0, 0, 0, 0, 0 }, /* PA30 */ 34 { 0, 0, 0, 0, 0, 0 }, /* PA30 */
33 { 0, 0, 0, 0, 0, 0 }, /* PA29 */ 35 { 0, 0, 0, 0, 0, 0 }, /* PA29 */
34 { 0, 0, 0, 0, 0, 0 }, /* PA28 */ 36 { 0, 0, 0, 0, 0, 0 }, /* PA28 */
35 { 0, 0, 0, 0, 0, 0 }, /* PA27 */ 37 { 0, 0, 0, 0, 0, 0 }, /* PA27 */
36 { 0, 0, 0, 0, 0, 0 }, /* PA26 */ 38 { 0, 0, 0, 0, 0, 0 }, /* PA26 */
37 { 0, 0, 0, 0, 0, 0 }, /* PA25 */ 39 { 0, 0, 0, 0, 0, 0 }, /* PA25 */
38 { 0, 0, 0, 0, 0, 0 }, /* PA24 */ 40 { 0, 0, 0, 0, 0, 0 }, /* PA24 */
39 { 0, 0, 0, 0, 0, 0 }, /* PA23 */ 41 { 0, 0, 0, 0, 0, 0 }, /* PA23 */
40 { 0, 0, 0, 0, 0, 0 }, /* PA22 */ 42 { 0, 0, 0, 0, 0, 0 }, /* PA22 */
41 { 0, 0, 0, 0, 0, 0 }, /* PA21 */ 43 { 0, 0, 0, 0, 0, 0 }, /* PA21 */
42 { 0, 0, 0, 0, 0, 0 }, /* PA20 */ 44 { 0, 0, 0, 0, 0, 0 }, /* PA20 */
43 { 0, 0, 0, 0, 0, 0 }, /* PA19 */ 45 { 0, 0, 0, 0, 0, 0 }, /* PA19 */
44 { 0, 0, 0, 0, 0, 0 }, /* PA18 */ 46 { 0, 0, 0, 0, 0, 0 }, /* PA18 */
45 { 0, 0, 0, 0, 0, 0 }, /* PA17 */ 47 { 0, 0, 0, 0, 0, 0 }, /* PA17 */
46 { 0, 0, 0, 0, 0, 0 }, /* PA16 */ 48 { 0, 0, 0, 0, 0, 0 }, /* PA16 */
47 { 0, 0, 0, 0, 0, 0 }, /* PA15 */ 49 { 0, 0, 0, 0, 0, 0 }, /* PA15 */
48 { 0, 0, 0, 0, 0, 0 }, /* PA14 */ 50 { 0, 0, 0, 0, 0, 0 }, /* PA14 */
49 { 0, 0, 0, 0, 0, 0 }, /* PA13 */ 51 { 0, 0, 0, 0, 0, 0 }, /* PA13 */
50 { 0, 0, 0, 0, 0, 0 }, /* PA12 */ 52 { 0, 0, 0, 0, 0, 0 }, /* PA12 */
51 { 0, 0, 0, 0, 0, 0 }, /* PA11 */ 53 { 0, 0, 0, 0, 0, 0 }, /* PA11 */
52 { 0, 0, 0, 0, 0, 0 }, /* PA10 */ 54 { 0, 0, 0, 0, 0, 0 }, /* PA10 */
53 { 1, 1, 0, 1, 0, 0 }, /* PA9 SMC2 TxD */ 55 { 1, 1, 0, 1, 0, 0 }, /* PA9 SMC2 TxD */
54 { 1, 1, 0, 0, 0, 0 }, /* PA8 SMC2 RxD */ 56 { 1, 1, 0, 0, 0, 0 }, /* PA8 SMC2 RxD */
55 { 0, 0, 0, 0, 0, 0 }, /* PA7 */ 57 { 0, 0, 0, 0, 0, 0 }, /* PA7 */
56 { 0, 0, 0, 0, 0, 0 }, /* PA6 */ 58 { 0, 0, 0, 0, 0, 0 }, /* PA6 */
57 { 0, 0, 0, 0, 0, 0 }, /* PA5 */ 59 { 0, 0, 0, 0, 0, 0 }, /* PA5 */
58 { 0, 0, 0, 0, 0, 0 }, /* PA4 */ 60 { 0, 0, 0, 0, 0, 0 }, /* PA4 */
59 { 0, 0, 0, 0, 0, 0 }, /* PA3 */ 61 { 0, 0, 0, 0, 0, 0 }, /* PA3 */
60 { 0, 0, 0, 0, 0, 0 }, /* PA2 */ 62 { 0, 0, 0, 0, 0, 0 }, /* PA2 */
61 { 0, 0, 0, 0, 0, 0 }, /* PA1 */ 63 { 0, 0, 0, 0, 0, 0 }, /* PA1 */
62 { 0, 0, 0, 0, 0, 0 } /* PA0 */ 64 { 0, 0, 0, 0, 0, 0 } /* PA0 */
63 }, 65 },
64 66
65 /* Port B */ 67 /* Port B */
66 { /* conf ppar psor pdir podr pdat */ 68 { /* conf ppar psor pdir podr pdat */
67 { 0, 0, 0, 0, 0, 0 }, /* PB31 */ 69 { 0, 0, 0, 0, 0, 0 }, /* PB31 */
68 { 0, 0, 0, 0, 0, 0 }, /* PB30 */ 70 { 0, 0, 0, 0, 0, 0 }, /* PB30 */
69 { 0, 0, 0, 0, 0, 0 }, /* PB29 */ 71 { 0, 0, 0, 0, 0, 0 }, /* PB29 */
70 { 0, 0, 0, 0, 0, 0 }, /* PB28 */ 72 { 0, 0, 0, 0, 0, 0 }, /* PB28 */
71 { 0, 0, 0, 0, 0, 0 }, /* PB27 */ 73 { 0, 0, 0, 0, 0, 0 }, /* PB27 */
72 { 0, 0, 0, 0, 0, 0 }, /* PB26 */ 74 { 0, 0, 0, 0, 0, 0 }, /* PB26 */
73 { 0, 0, 0, 0, 0, 0 }, /* PB25 */ 75 { 0, 0, 0, 0, 0, 0 }, /* PB25 */
74 { 0, 0, 0, 0, 0, 0 }, /* PB24 */ 76 { 0, 0, 0, 0, 0, 0 }, /* PB24 */
75 { 0, 0, 0, 0, 0, 0 }, /* PB23 */ 77 { 0, 0, 0, 0, 0, 0 }, /* PB23 */
76 { 0, 0, 0, 0, 0, 0 }, /* PB22 */ 78 { 0, 0, 0, 0, 0, 0 }, /* PB22 */
77 { 0, 0, 0, 0, 0, 0 }, /* PB21 */ 79 { 0, 0, 0, 0, 0, 0 }, /* PB21 */
78 { 0, 0, 0, 0, 0, 0 }, /* PB20 */ 80 { 0, 0, 0, 0, 0, 0 }, /* PB20 */
79 { 0, 0, 0, 0, 0, 0 }, /* PB19 */ 81 { 0, 0, 0, 0, 0, 0 }, /* PB19 */
80 { 0, 0, 0, 0, 0, 0 }, /* PB18 */ 82 { 0, 0, 0, 0, 0, 0 }, /* PB18 */
81 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 83 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
82 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 84 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
83 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 85 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
84 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 86 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
85 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 87 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
86 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 88 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
87 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 89 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
88 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 90 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
89 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 91 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
90 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 92 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
91 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 93 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
92 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 94 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
93 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 95 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
94 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 96 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
95 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 97 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
96 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 98 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
97 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 99 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
98 { 0, 0, 0, 0, 0, 0 } /* non-existent */ 100 { 0, 0, 0, 0, 0, 0 } /* non-existent */
99 }, 101 },
100 102
101 /* Port C */ 103 /* Port C */
102 { /* conf ppar psor pdir podr pdat */ 104 { /* conf ppar psor pdir podr pdat */
103 { 0, 0, 0, 0, 0, 0 }, /* PC31 */ 105 { 0, 0, 0, 0, 0, 0 }, /* PC31 */
104 { 0, 0, 0, 0, 0, 0 }, /* PC30 */ 106 { 0, 0, 0, 0, 0, 0 }, /* PC30 */
105 { 0, 0, 0, 0, 0, 0 }, /* PC29 */ 107 { 0, 0, 0, 0, 0, 0 }, /* PC29 */
106 { 0, 0, 0, 0, 0, 0 }, /* PC28 */ 108 { 0, 0, 0, 0, 0, 0 }, /* PC28 */
107 { 0, 0, 0, 0, 0, 0 }, /* PC27 */ 109 { 0, 0, 0, 0, 0, 0 }, /* PC27 */
108 { 0, 0, 0, 0, 0, 0 }, /* PC26 */ 110 { 0, 0, 0, 0, 0, 0 }, /* PC26 */
109 { 1, 1, 0, 0, 0, 0 }, /* PC25 RxClk */ 111 { 1, 1, 0, 0, 0, 0 }, /* PC25 RxClk */
110 { 1, 1, 0, 0, 0, 0 }, /* PC24 TxClk */ 112 { 1, 1, 0, 0, 0, 0 }, /* PC24 TxClk */
111 { 0, 0, 0, 0, 0, 0 }, /* PC23 */ 113 { 0, 0, 0, 0, 0, 0 }, /* PC23 */
112 { 0, 0, 0, 0, 0, 0 }, /* PC22 */ 114 { 0, 0, 0, 0, 0, 0 }, /* PC22 */
113 { 0, 0, 0, 0, 0, 0 }, /* PC21 */ 115 { 0, 0, 0, 0, 0, 0 }, /* PC21 */
114 { 0, 0, 0, 0, 0, 0 }, /* PC20 */ 116 { 0, 0, 0, 0, 0, 0 }, /* PC20 */
115 { 0, 0, 0, 0, 0, 0 }, /* PC19 */ 117 { 0, 0, 0, 0, 0, 0 }, /* PC19 */
116 { 0, 0, 0, 0, 0, 0 }, /* PC18 */ 118 { 0, 0, 0, 0, 0, 0 }, /* PC18 */
117 { 0, 0, 0, 0, 0, 0 }, /* PC17 */ 119 { 0, 0, 0, 0, 0, 0 }, /* PC17 */
118 { 0, 0, 0, 0, 0, 0 }, /* PC16 */ 120 { 0, 0, 0, 0, 0, 0 }, /* PC16 */
119 { 0, 0, 0, 0, 0, 0 }, /* PC15 */ 121 { 0, 0, 0, 0, 0, 0 }, /* PC15 */
120 { 0, 0, 0, 0, 0, 0 }, /* PC14 */ 122 { 0, 0, 0, 0, 0, 0 }, /* PC14 */
121 { 0, 0, 0, 0, 0, 0 }, /* PC13 */ 123 { 0, 0, 0, 0, 0, 0 }, /* PC13 */
122 { 0, 0, 0, 0, 0, 0 }, /* PC12 */ 124 { 0, 0, 0, 0, 0, 0 }, /* PC12 */
123 { 0, 0, 0, 0, 0, 0 }, /* PC11 */ 125 { 0, 0, 0, 0, 0, 0 }, /* PC11 */
124 { 0, 0, 0, 0, 0, 0 }, /* PC10 */ 126 { 0, 0, 0, 0, 0, 0 }, /* PC10 */
125 { 1, 1, 0, 0, 0, 0 }, /* PC9 SCC4: CTS */ 127 { 1, 1, 0, 0, 0, 0 }, /* PC9 SCC4: CTS */
126 { 1, 1, 0, 0, 0, 0 }, /* PC8 SCC4: CD */ 128 { 1, 1, 0, 0, 0, 0 }, /* PC8 SCC4: CD */
127 { 0, 0, 0, 0, 0, 0 }, /* PC7 */ 129 { 0, 0, 0, 0, 0, 0 }, /* PC7 */
128 { 0, 0, 0, 0, 0, 0 }, /* PC6 */ 130 { 0, 0, 0, 0, 0, 0 }, /* PC6 */
129 { 0, 0, 0, 0, 0, 0 }, /* PC5 */ 131 { 0, 0, 0, 0, 0, 0 }, /* PC5 */
130 { 0, 0, 0, 0, 0, 0 }, /* PC4 */ 132 { 0, 0, 0, 0, 0, 0 }, /* PC4 */
131 { 0, 0, 0, 0, 0, 0 }, /* PC3 */ 133 { 0, 0, 0, 0, 0, 0 }, /* PC3 */
132 { 0, 0, 0, 0, 0, 0 }, /* PC2 */ 134 { 0, 0, 0, 0, 0, 0 }, /* PC2 */
133 { 0, 0, 0, 0, 0, 0 }, /* PC1 */ 135 { 0, 0, 0, 0, 0, 0 }, /* PC1 */
134 { 0, 0, 0, 0, 0, 0 }, /* PC0 */ 136 { 0, 0, 0, 0, 0, 0 }, /* PC0 */
135 }, 137 },
136 138
137 /* Port D */ 139 /* Port D */
138 { /* conf ppar psor pdir podr pdat */ 140 { /* conf ppar psor pdir podr pdat */
139 { 0, 0, 0, 0, 0, 0 }, /* PD31 */ 141 { 0, 0, 0, 0, 0, 0 }, /* PD31 */
140 { 0, 0, 0, 0, 0, 0 }, /* PD30 */ 142 { 0, 0, 0, 0, 0, 0 }, /* PD30 */
141 { 0, 0, 0, 0, 0, 0 }, /* PD29 */ 143 { 0, 0, 0, 0, 0, 0 }, /* PD29 */
142 { 0, 0, 0, 0, 0, 0 }, /* PD28 */ 144 { 0, 0, 0, 0, 0, 0 }, /* PD28 */
143 { 0, 0, 0, 0, 0, 0 }, /* PD27 */ 145 { 0, 0, 0, 0, 0, 0 }, /* PD27 */
144 { 0, 0, 0, 0, 0, 0 }, /* PD26 */ 146 { 0, 0, 0, 0, 0, 0 }, /* PD26 */
145 { 0, 0, 0, 0, 0, 0 }, /* PD25 */ 147 { 0, 0, 0, 0, 0, 0 }, /* PD25 */
146 { 0, 0, 0, 0, 0, 0 }, /* PD24 */ 148 { 0, 0, 0, 0, 0, 0 }, /* PD24 */
147 { 0, 0, 0, 0, 0, 0 }, /* PD23 */ 149 { 0, 0, 0, 0, 0, 0 }, /* PD23 */
148 { 1, 1, 0, 0, 0, 0 }, /* PD22 SCC4: RXD */ 150 { 1, 1, 0, 0, 0, 0 }, /* PD22 SCC4: RXD */
149 { 1, 1, 0, 1, 0, 0 }, /* PD21 SCC4: TXD */ 151 { 1, 1, 0, 1, 0, 0 }, /* PD21 SCC4: TXD */
150 { 1, 1, 0, 1, 0, 0 }, /* PD20 SCC4: RTS */ 152 { 1, 1, 0, 1, 0, 0 }, /* PD20 SCC4: RTS */
151 { 0, 0, 0, 0, 0, 0 }, /* PD19 */ 153 { 0, 0, 0, 0, 0, 0 }, /* PD19 */
152 { 0, 0, 0, 0, 0, 0 }, /* PD18 */ 154 { 0, 0, 0, 0, 0, 0 }, /* PD18 */
153 { 0, 0, 0, 0, 0, 0 }, /* PD17 */ 155 { 0, 0, 0, 0, 0, 0 }, /* PD17 */
154 { 0, 0, 0, 0, 0, 0 }, /* PD16 */ 156 { 0, 0, 0, 0, 0, 0 }, /* PD16 */
155 #if defined(CONFIG_HARD_I2C) 157 #if defined(CONFIG_HARD_I2C)
156 { 1, 1, 1, 0, 1, 0 }, /* PD15 I2C SDA */ 158 { 1, 1, 1, 0, 1, 0 }, /* PD15 I2C SDA */
157 { 1, 1, 1, 0, 1, 0 }, /* PD14 I2C SCL */ 159 { 1, 1, 1, 0, 1, 0 }, /* PD14 I2C SCL */
158 #else 160 #else
159 { 1, 0, 0, 0, 1, 1 }, /* PD15 */ 161 { 1, 0, 0, 0, 1, 1 }, /* PD15 */
160 { 1, 0, 0, 1, 1, 1 }, /* PD14 */ 162 { 1, 0, 0, 1, 1, 1 }, /* PD14 */
161 #endif 163 #endif
162 { 0, 0, 0, 0, 0, 0 }, /* PD13 */ 164 { 0, 0, 0, 0, 0, 0 }, /* PD13 */
163 { 0, 0, 0, 0, 0, 0 }, /* PD12 */ 165 { 0, 0, 0, 0, 0, 0 }, /* PD12 */
164 { 0, 0, 0, 0, 0, 0 }, /* PD11 */ 166 { 0, 0, 0, 0, 0, 0 }, /* PD11 */
165 { 0, 0, 0, 0, 0, 0 }, /* PD10 */ 167 { 0, 0, 0, 0, 0, 0 }, /* PD10 */
166 { 0, 0, 0, 0, 0, 0 }, /* PD9 */ 168 { 0, 0, 0, 0, 0, 0 }, /* PD9 */
167 { 0, 0, 0, 0, 0, 0 }, /* PD8 */ 169 { 0, 0, 0, 0, 0, 0 }, /* PD8 */
168 { 0, 0, 0, 0, 0, 0 }, /* PD7 */ 170 { 0, 0, 0, 0, 0, 0 }, /* PD7 */
169 { 0, 0, 0, 0, 0, 0 }, /* PD6 */ 171 { 0, 0, 0, 0, 0, 0 }, /* PD6 */
170 { 0, 0, 0, 0, 0, 0 }, /* PD5 */ 172 { 0, 0, 0, 0, 0, 0 }, /* PD5 */
171 { 0, 0, 0, 0, 0, 0 }, /* PD4 */ 173 { 0, 0, 0, 0, 0, 0 }, /* PD4 */
172 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 174 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
173 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 175 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
174 { 0, 0, 0, 0, 0, 0 }, /* non-existent */ 176 { 0, 0, 0, 0, 0, 0 }, /* non-existent */
175 { 0, 0, 0, 0, 0, 0 } /* non-existent */ 177 { 0, 0, 0, 0, 0, 0 } /* non-existent */
176 } 178 }
177 }; 179 };
178 180
179 /* 181 /*
180 * Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx 182 * Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
181 * 183 *
182 * This routine performs standard 8260 initialization sequence 184 * This routine performs standard 8260 initialization sequence
183 * and calculates the available memory size. It may be called 185 * and calculates the available memory size. It may be called
184 * several times to try different SDRAM configurations on both 186 * several times to try different SDRAM configurations on both
185 * 60x and local buses. 187 * 60x and local buses.
186 */ 188 */
187 static long int try_init(memctl8260_t *memctl, ulong sdmr, 189 static long int try_init(memctl8260_t *memctl, ulong sdmr,
188 ulong orx, uchar *base) 190 ulong orx, uchar *base)
189 { 191 {
190 uchar c = 0xff; 192 uchar c = 0xff;
191 ulong maxsize, size; 193 ulong maxsize, size;
192 int i; 194 int i;
193 195
194 /* 196 /*
195 * We must be able to test a location outsize the maximum legal size 197 * We must be able to test a location outsize the maximum legal size
196 * to find out THAT we are outside; but this address still has to be 198 * to find out THAT we are outside; but this address still has to be
197 * mapped by the controller. That means, that the initial mapping has 199 * mapped by the controller. That means, that the initial mapping has
198 * to be (at least) twice as large as the maximum expected size. 200 * to be (at least) twice as large as the maximum expected size.
199 */ 201 */
200 maxsize = (1 + (~orx | 0x7fff))/* / 2*/; 202 maxsize = (1 + (~orx | 0x7fff))/* / 2*/;
201 203
202 out_be32(&memctl->memc_or1, orx); 204 out_be32(&memctl->memc_or1, orx);
203 205
204 /* 206 /*
205 * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35): 207 * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
206 * 208 *
207 * "At system reset, initialization software must set up the 209 * "At system reset, initialization software must set up the
208 * programmable parameters in the memory controller banks registers 210 * programmable parameters in the memory controller banks registers
209 * (ORx, BRx, P/LSDMR). After all memory parameters are configured, 211 * (ORx, BRx, P/LSDMR). After all memory parameters are configured,
210 * system software should execute the following initialization sequence 212 * system software should execute the following initialization sequence
211 * for each SDRAM device. 213 * for each SDRAM device.
212 * 214 *
213 * 1. Issue a PRECHARGE-ALL-BANKS command 215 * 1. Issue a PRECHARGE-ALL-BANKS command
214 * 2. Issue eight CBR REFRESH commands 216 * 2. Issue eight CBR REFRESH commands
215 * 3. Issue a MODE-SET command to initialize the mode register 217 * 3. Issue a MODE-SET command to initialize the mode register
216 * 218 *
217 * The initial commands are executed by setting P/LSDMR[OP] and 219 * The initial commands are executed by setting P/LSDMR[OP] and
218 * accessing the SDRAM with a single-byte transaction." 220 * accessing the SDRAM with a single-byte transaction."
219 * 221 *
220 * The appropriate BRx/ORx registers have already been set when we 222 * The appropriate BRx/ORx registers have already been set when we
221 * get here. The SDRAM can be accessed at the address 223 * get here. The SDRAM can be accessed at the address
222 * CONFIG_SYS_SDRAM_BASE. 224 * CONFIG_SYS_SDRAM_BASE.
223 */ 225 */
224 226
225 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_PREA); 227 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_PREA);
226 out_8(base, c); 228 out_8(base, c);
227 229
228 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_CBRR); 230 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_CBRR);
229 for (i = 0; i < 8; i++) 231 for (i = 0; i < 8; i++)
230 out_8(base, c); 232 out_8(base, c);
231 233
232 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_MRW); 234 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_MRW);
233 /* setting MR on address lines */ 235 /* setting MR on address lines */
234 out_8((uchar *)(base + CONFIG_SYS_MRS_OFFS), c); 236 out_8((uchar *)(base + CONFIG_SYS_MRS_OFFS), c);
235 237
236 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_NORM | PSDMR_RFEN); 238 out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_NORM | PSDMR_RFEN);
237 out_8(base, c); 239 out_8(base, c);
238 240
239 size = get_ram_size((long *)base, maxsize); 241 size = get_ram_size((long *)base, maxsize);
240 out_be32(&memctl->memc_or1, orx | ~(size - 1)); 242 out_be32(&memctl->memc_or1, orx | ~(size - 1));
241 243
242 return size; 244 return size;
243 } 245 }
244 246
245 #ifdef CONFIG_SYS_SDRAM_LIST 247 #ifdef CONFIG_SYS_SDRAM_LIST
246 248
247 /* 249 /*
248 * If CONFIG_SYS_SDRAM_LIST is defined, we cycle through all SDRAM 250 * If CONFIG_SYS_SDRAM_LIST is defined, we cycle through all SDRAM
249 * configurations therein (should be from high to lower) to find the 251 * configurations therein (should be from high to lower) to find the
250 * one actually matching the current configuration. 252 * one actually matching the current configuration.
251 * CONFIG_SYS_PSDMR and CONFIG_SYS_OR1 will contain the base values which are 253 * CONFIG_SYS_PSDMR and CONFIG_SYS_OR1 will contain the base values which are
252 * common among all possible configurations; values in CONFIG_SYS_SDRAM_LIST 254 * common among all possible configurations; values in CONFIG_SYS_SDRAM_LIST
253 * (defined as the initialization value for the array of struct sdram_conf_s) 255 * (defined as the initialization value for the array of struct sdram_conf_s)
254 * will then be ORed with such base values. 256 * will then be ORed with such base values.
255 */ 257 */
256 258
257 struct sdram_conf_s { 259 struct sdram_conf_s {
258 ulong size; 260 ulong size;
259 int or1; 261 int or1;
260 int psdmr; 262 int psdmr;
261 }; 263 };
262 264
263 static struct sdram_conf_s sdram_conf[] = CONFIG_SYS_SDRAM_LIST; 265 static struct sdram_conf_s sdram_conf[] = CONFIG_SYS_SDRAM_LIST;
264 266
265 static long probe_sdram(memctl8260_t *memctl) 267 static long probe_sdram(memctl8260_t *memctl)
266 { 268 {
267 int n = 0; 269 int n = 0;
268 long psize = 0; 270 long psize = 0;
269 271
270 for (n = 0; n < ARRAY_SIZE(sdram_conf); psize = 0, n++) { 272 for (n = 0; n < ARRAY_SIZE(sdram_conf); psize = 0, n++) {
271 psize = try_init(memctl, 273 psize = try_init(memctl,
272 CONFIG_SYS_PSDMR | sdram_conf[n].psdmr, 274 CONFIG_SYS_PSDMR | sdram_conf[n].psdmr,
273 CONFIG_SYS_OR1 | sdram_conf[n].or1, 275 CONFIG_SYS_OR1 | sdram_conf[n].or1,
274 (uchar *) CONFIG_SYS_SDRAM_BASE); 276 (uchar *) CONFIG_SYS_SDRAM_BASE);
275 debug("Probing %ld bytes returned %ld\n", 277 debug("Probing %ld bytes returned %ld\n",
276 sdram_conf[n].size, psize); 278 sdram_conf[n].size, psize);
277 if (psize == sdram_conf[n].size) 279 if (psize == sdram_conf[n].size)
278 break; 280 break;
279 } 281 }
280 return psize; 282 return psize;
281 } 283 }
282 284
283 #else /* CONFIG_SYS_SDRAM_LIST */ 285 #else /* CONFIG_SYS_SDRAM_LIST */
284 286
285 static long probe_sdram(memctl8260_t *memctl) 287 static long probe_sdram(memctl8260_t *memctl)
286 { 288 {
287 return try_init(memctl, CONFIG_SYS_PSDMR, CONFIG_SYS_OR1, 289 return try_init(memctl, CONFIG_SYS_PSDMR, CONFIG_SYS_OR1,
288 (uchar *) CONFIG_SYS_SDRAM_BASE); 290 (uchar *) CONFIG_SYS_SDRAM_BASE);
289 } 291 }
290 #endif /* CONFIG_SYS_SDRAM_LIST */ 292 #endif /* CONFIG_SYS_SDRAM_LIST */
291 293
292 294
293 phys_size_t initdram(int board_type) 295 phys_size_t initdram(int board_type)
294 { 296 {
295 immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; 297 immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
296 memctl8260_t *memctl = &immap->im_memctl; 298 memctl8260_t *memctl = &immap->im_memctl;
297 299
298 long psize; 300 long psize;
299 301
300 out_8(&memctl->memc_psrt, CONFIG_SYS_PSRT); 302 out_8(&memctl->memc_psrt, CONFIG_SYS_PSRT);
301 out_be16(&memctl->memc_mptpr, CONFIG_SYS_MPTPR); 303 out_be16(&memctl->memc_mptpr, CONFIG_SYS_MPTPR);
302 304
303 /* 60x SDRAM setup: 305 /* 60x SDRAM setup:
304 */ 306 */
305 psize = probe_sdram(memctl); 307 psize = probe_sdram(memctl);
306 308
307 icache_enable(); 309 icache_enable();
308 310
309 return psize; 311 return psize;
310 } 312 }
311 313
312 int checkboard(void) 314 int checkboard(void)
313 { 315 {
314 #if defined(CONFIG_MGCOGE) 316 #if defined(CONFIG_MGCOGE)
315 puts("Board: Keymile mgcoge"); 317 puts("Board: Keymile mgcoge");
316 #else 318 #else
317 puts("Board: Keymile mgcoge3ne"); 319 puts("Board: Keymile mgcoge3ne");
318 #endif 320 #endif
319 if (ethernet_present()) 321 if (ethernet_present())
320 puts(" with PIGGY."); 322 puts(" with PIGGY.");
321 puts("\n"); 323 puts("\n");
322 return 0; 324 return 0;
323 } 325 }
324 326
325 int last_stage_init(void) 327 int last_stage_init(void)
326 { 328 {
327 struct bfticu_iomap *base = 329 struct bfticu_iomap *base =
328 (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE; 330 (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE;
329 u8 dip_switch; 331 u8 dip_switch;
330 332
331 dip_switch = in_8(&base->mswitch); 333 dip_switch = in_8(&base->mswitch);
332 dip_switch &= BFTICU_DIPSWITCH_MASK; 334 dip_switch &= BFTICU_DIPSWITCH_MASK;
333 /* dip switch 'full reset' or 'db erase' */ 335 /* dip switch 'full reset' or 'db erase' */
334 if (dip_switch & 0x1 || dip_switch & 0x2) { 336 if (dip_switch & 0x1 || dip_switch & 0x2) {
335 /* start bootloader */ 337 /* start bootloader */
336 puts("DIP: Enabled\n"); 338 puts("DIP: Enabled\n");
337 setenv("actual_bank", "0"); 339 setenv("actual_bank", "0");
338 } 340 }
339 set_km_env(); 341 set_km_env();
340 return 0; 342 return 0;
341 } 343 }
342 344
343 #ifdef CONFIG_MGCOGE3NE 345 #ifdef CONFIG_MGCOGE3NE
344 static void set_pin(int state, unsigned long mask); 346 static void set_pin(int state, unsigned long mask);
345 347
346 /* 348 /*
347 * For mgcoge3ne boards, the mgcoge3un control is controlled from 349 * For mgcoge3ne boards, the mgcoge3un control is controlled from
348 * a GPIO line on the PPC CPU. If bobcatreset is set the line 350 * a GPIO line on the PPC CPU. If bobcatreset is set the line
349 * will toggle once what forces the mgocge3un part to restart 351 * will toggle once what forces the mgocge3un part to restart
350 * immediately. 352 * immediately.
351 */ 353 */
352 static void handle_mgcoge3un_reset(void) 354 static void handle_mgcoge3un_reset(void)
353 { 355 {
354 char *bobcatreset = getenv("bobcatreset"); 356 char *bobcatreset = getenv("bobcatreset");
355 if (bobcatreset) { 357 if (bobcatreset) {
356 if (strcmp(bobcatreset, "true") == 0) { 358 if (strcmp(bobcatreset, "true") == 0) {
357 puts("Forcing bobcat reset\n"); 359 puts("Forcing bobcat reset\n");
358 set_pin(0, 0x00000004); /* clear PD29 to reset arm */ 360 set_pin(0, 0x00000004); /* clear PD29 to reset arm */
359 udelay(1000); 361 udelay(1000);
360 set_pin(1, 0x00000004); 362 set_pin(1, 0x00000004);
361 } else 363 } else
362 set_pin(1, 0x00000004); /* set PD29 to not reset arm */ 364 set_pin(1, 0x00000004); /* set PD29 to not reset arm */
363 } 365 }
364 } 366 }
365 #endif 367 #endif
366 368
367 int ethernet_present(void) 369 int ethernet_present(void)
368 { 370 {
369 struct km_bec_fpga *base = 371 struct km_bec_fpga *base =
370 (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; 372 (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE;
371 373
372 return in_8(&base->bprth) & PIGGY_PRESENT; 374 return in_8(&base->bprth) & PIGGY_PRESENT;
373 } 375 }
374 376
375 /* 377 /*
376 * Early board initalization. 378 * Early board initalization.
377 */ 379 */
378 int board_early_init_r(void) 380 int board_early_init_r(void)
379 { 381 {
380 struct km_bec_fpga *base = 382 struct km_bec_fpga *base =
381 (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; 383 (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE;
382 384
383 /* setup the UPIOx */ 385 /* setup the UPIOx */
384 /* General Unit Reset disabled, Flash Bank enabled, UnitLed on */ 386 /* General Unit Reset disabled, Flash Bank enabled, UnitLed on */
385 out_8(&base->oprth, (WRG_RESET | H_OPORTS_14 | WRG_LED)); 387 out_8(&base->oprth, (WRG_RESET | H_OPORTS_14 | WRG_LED));
386 /* SCC4 enable, halfduplex, FCC1 powerdown */ 388 /* SCC4 enable, halfduplex, FCC1 powerdown */
387 out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA | 389 out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA |
388 H_OPORTS_FCC1_PW_DWN)); 390 H_OPORTS_FCC1_PW_DWN));
389 391
390 #ifdef CONFIG_MGCOGE3NE 392 #ifdef CONFIG_MGCOGE3NE
391 handle_mgcoge3un_reset(); 393 handle_mgcoge3un_reset();
392 #endif 394 #endif
393 return 0; 395 return 0;
394 } 396 }
395 397
398 int misc_init_r(void)
399 {
400 ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
401 return 0;
402 }
403
396 int hush_init_var(void) 404 int hush_init_var(void)
397 { 405 {
398 ivm_read_eeprom(); 406 ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
399 return 0; 407 return 0;
400 } 408 }
401 409
402 #define SDA_MASK 0x00010000 410 #define SDA_MASK 0x00010000
403 #define SCL_MASK 0x00020000 411 #define SCL_MASK 0x00020000
404 412
405 static void set_pin(int state, unsigned long mask) 413 static void set_pin(int state, unsigned long mask)
406 { 414 {
407 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); 415 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
408 416
409 if (state) 417 if (state)
410 setbits_be32(&iop->pdat, mask); 418 setbits_be32(&iop->pdat, mask);
411 else 419 else
412 clrbits_be32(&iop->pdat, mask); 420 clrbits_be32(&iop->pdat, mask);
413 421
414 setbits_be32(&iop->pdir, mask); 422 setbits_be32(&iop->pdir, mask);
415 } 423 }
416 424
417 static int get_pin(unsigned long mask) 425 static int get_pin(unsigned long mask)
418 { 426 {
419 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); 427 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
420 428
421 clrbits_be32(&iop->pdir, mask); 429 clrbits_be32(&iop->pdir, mask);
422 return 0 != (in_be32(&iop->pdat) & mask); 430 return 0 != (in_be32(&iop->pdat) & mask);
423 } 431 }
424 432
425 void set_sda(int state) 433 void set_sda(int state)
426 { 434 {
427 set_pin(state, SDA_MASK); 435 set_pin(state, SDA_MASK);
428 } 436 }
429 437
430 void set_scl(int state) 438 void set_scl(int state)
431 { 439 {
432 set_pin(state, SCL_MASK); 440 set_pin(state, SCL_MASK);
433 } 441 }
434 442
435 int get_sda(void) 443 int get_sda(void)
436 { 444 {
437 return get_pin(SDA_MASK); 445 return get_pin(SDA_MASK);
438 } 446 }
439 447
440 int get_scl(void) 448 int get_scl(void)
441 { 449 {
442 return get_pin(SCL_MASK); 450 return get_pin(SCL_MASK);
443 } 451 }
444 452
445 #if defined(CONFIG_HARD_I2C) 453 #if defined(CONFIG_HARD_I2C)
446 static void setports(int gpio) 454 static void setports(int gpio)
447 { 455 {
448 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); 456 ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
449 457
450 if (gpio) { 458 if (gpio) {
451 clrbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK)); 459 clrbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK));
452 clrbits_be32(&iop->podr, (SDA_MASK | SCL_MASK)); 460 clrbits_be32(&iop->podr, (SDA_MASK | SCL_MASK));
453 } else { 461 } else {
454 setbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK)); 462 setbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK));
455 clrbits_be32(&iop->pdir, (SDA_MASK | SCL_MASK)); 463 clrbits_be32(&iop->pdir, (SDA_MASK | SCL_MASK));
456 setbits_be32(&iop->podr, (SDA_MASK | SCL_MASK)); 464 setbits_be32(&iop->podr, (SDA_MASK | SCL_MASK));
457 } 465 }
458 } 466 }
459 #endif 467 #endif
460 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) 468 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
461 int ft_board_setup(void *blob, bd_t *bd) 469 int ft_board_setup(void *blob, bd_t *bd)
462 { 470 {
463 ft_cpu_setup(blob, bd); 471 ft_cpu_setup(blob, bd);
464 472
465 return 0; 473 return 0;
466 } 474 }
467 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ 475 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
468 476
include/configs/km82xx.h
1 /* 1 /*
2 * (C) Copyright 2007-2011 2 * (C) Copyright 2007-2011
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef __CONFIG_H 8 #ifndef __CONFIG_H
9 #define __CONFIG_H 9 #define __CONFIG_H
10 10
11 /* 11 /*
12 * High Level Configuration Options 12 * High Level Configuration Options
13 * (easy to change) 13 * (easy to change)
14 */ 14 */
15 15
16 #define CONFIG_MPC8247 16 #define CONFIG_MPC8247
17 /* MGCOGE */ 17 /* MGCOGE */
18 #if defined(CONFIG_MGCOGE) 18 #if defined(CONFIG_MGCOGE)
19 #define CONFIG_HOSTNAME mgcoge 19 #define CONFIG_HOSTNAME mgcoge
20 #define CONFIG_KM_BOARD_EXTRA_ENV "" 20 #define CONFIG_KM_BOARD_EXTRA_ENV ""
21 21
22 /* MGCOGE3NE */ 22 /* MGCOGE3NE */
23 #elif defined(CONFIG_MGCOGE3NE) 23 #elif defined(CONFIG_MGCOGE3NE)
24 #define CONFIG_HOSTNAME mgcoge3ne 24 #define CONFIG_HOSTNAME mgcoge3ne
25 #define CONFIG_KM_82XX 25 #define CONFIG_KM_82XX
26 #define CONFIG_KM_BOARD_EXTRA_ENV "bobcatreset=true\0" 26 #define CONFIG_KM_BOARD_EXTRA_ENV "bobcatreset=true\0"
27 27
28 #else 28 #else
29 #error ("Board unsupported") 29 #error ("Board unsupported")
30 #endif 30 #endif
31 31
32 #define CONFIG_SYS_GENERIC_BOARD 32 #define CONFIG_SYS_GENERIC_BOARD
33 #define CONFIG_DISPLAY_BOARDINFO 33 #define CONFIG_DISPLAY_BOARDINFO
34 34
35 #define CONFIG_SYS_TEXT_BASE 0xFE000000 35 #define CONFIG_SYS_TEXT_BASE 0xFE000000
36 36
37 #define CONFIG_MISC_INIT_R
38
37 /* include common defines/options for all Keymile boards */ 39 /* include common defines/options for all Keymile boards */
38 #include "km/keymile-common.h" 40 #include "km/keymile-common.h"
39 #include "km/km-powerpc.h" 41 #include "km/km-powerpc.h"
40 42
41 #define CONFIG_SYS_SDRAM_BASE 0x00000000 43 #define CONFIG_SYS_SDRAM_BASE 0x00000000
42 #define CONFIG_SYS_FLASH_BASE 0xFE000000 44 #define CONFIG_SYS_FLASH_BASE 0xFE000000
43 #define CONFIG_SYS_FLASH_SIZE 32 45 #define CONFIG_SYS_FLASH_SIZE 32
44 #define CONFIG_SYS_FLASH_CFI 46 #define CONFIG_SYS_FLASH_CFI
45 #define CONFIG_FLASH_CFI_DRIVER 47 #define CONFIG_FLASH_CFI_DRIVER
46 48
47 /* MGCOGE */ 49 /* MGCOGE */
48 #if defined(CONFIG_MGCOGE) 50 #if defined(CONFIG_MGCOGE)
49 #define CONFIG_SYS_MAX_FLASH_BANKS 3 51 #define CONFIG_SYS_MAX_FLASH_BANKS 3
50 /* max num of sects on one chip */ 52 /* max num of sects on one chip */
51 #define CONFIG_SYS_MAX_FLASH_SECT 512 53 #define CONFIG_SYS_MAX_FLASH_SECT 512
52 54
53 #define CONFIG_SYS_FLASH_BASE_1 0x50000000 55 #define CONFIG_SYS_FLASH_BASE_1 0x50000000
54 #define CONFIG_SYS_FLASH_SIZE_1 32 56 #define CONFIG_SYS_FLASH_SIZE_1 32
55 #define CONFIG_SYS_FLASH_BASE_2 0x52000000 57 #define CONFIG_SYS_FLASH_BASE_2 0x52000000
56 #define CONFIG_SYS_FLASH_SIZE_2 32 58 #define CONFIG_SYS_FLASH_SIZE_2 32
57 59
58 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \ 60 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \
59 CONFIG_SYS_FLASH_BASE_1, \ 61 CONFIG_SYS_FLASH_BASE_1, \
60 CONFIG_SYS_FLASH_BASE_2 } 62 CONFIG_SYS_FLASH_BASE_2 }
61 #define MTDIDS_DEFAULT "nor3=app" 63 #define MTDIDS_DEFAULT "nor3=app"
62 64
63 /* 65 /*
64 * Bank 1 - 60x bus SDRAM 66 * Bank 1 - 60x bus SDRAM
65 */ 67 */
66 #define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ 68 #define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */
67 #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ 69 #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */
68 70
69 /* SDRAM initialization values 71 /* SDRAM initialization values
70 */ 72 */
71 73
72 #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ 74 #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
73 ORxS_SDAM_MSK) |\ 75 ORxS_SDAM_MSK) |\
74 ORxS_BPD_8 |\ 76 ORxS_BPD_8 |\
75 ORxS_ROWST_PBI0_A7 |\ 77 ORxS_ROWST_PBI0_A7 |\
76 ORxS_NUMR_13) 78 ORxS_NUMR_13)
77 79
78 #define CONFIG_SYS_PSDMR ( \ 80 #define CONFIG_SYS_PSDMR ( \
79 PSDMR_SDAM_A14_IS_A5 |\ 81 PSDMR_SDAM_A14_IS_A5 |\
80 PSDMR_BSMA_A14_A16 |\ 82 PSDMR_BSMA_A14_A16 |\
81 PSDMR_SDA10_PBI0_A9 |\ 83 PSDMR_SDA10_PBI0_A9 |\
82 PSDMR_RFRC_5_CLK |\ 84 PSDMR_RFRC_5_CLK |\
83 PSDMR_PRETOACT_2W |\ 85 PSDMR_PRETOACT_2W |\
84 PSDMR_ACTTORW_2W |\ 86 PSDMR_ACTTORW_2W |\
85 PSDMR_LDOTOPRE_1C |\ 87 PSDMR_LDOTOPRE_1C |\
86 PSDMR_WRC_1C |\ 88 PSDMR_WRC_1C |\
87 PSDMR_CL_2) 89 PSDMR_CL_2)
88 90
89 /* MGCOGE3NE */ 91 /* MGCOGE3NE */
90 #elif defined(CONFIG_MGCOGE3NE) 92 #elif defined(CONFIG_MGCOGE3NE)
91 #define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max num of flash banks */ 93 #define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max num of flash banks */
92 #define CONFIG_SYS_MAX_FLASH_SECT 1024 /* 94 #define CONFIG_SYS_MAX_FLASH_SECT 1024 /*
93 * max num of sects on one 95 * max num of sects on one
94 * chip 96 * chip
95 */ 97 */
96 98
97 #define CONFIG_SYS_FLASH_BASE_1 0x50000000 99 #define CONFIG_SYS_FLASH_BASE_1 0x50000000
98 #define CONFIG_SYS_FLASH_SIZE_1 128 100 #define CONFIG_SYS_FLASH_SIZE_1 128
99 101
100 #define CONFIG_SYS_FLASH_SIZE_2 0 /* dummy value to calc SYS_OR5 */ 102 #define CONFIG_SYS_FLASH_SIZE_2 0 /* dummy value to calc SYS_OR5 */
101 103
102 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \ 104 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \
103 CONFIG_SYS_FLASH_BASE_1 } 105 CONFIG_SYS_FLASH_BASE_1 }
104 106
105 #define MTDIDS_DEFAULT "nor2=app" 107 #define MTDIDS_DEFAULT "nor2=app"
106 108
107 /* 109 /*
108 * Bank 1 - 60x bus SDRAM 110 * Bank 1 - 60x bus SDRAM
109 * mgcoge3ne has 256MB 111 * mgcoge3ne has 256MB
110 * mgcoge2ne has 128MB 112 * mgcoge2ne has 128MB
111 */ 113 */
112 #define SDRAM_MAX_SIZE 0x10000000 /* max. 256 MB */ 114 #define SDRAM_MAX_SIZE 0x10000000 /* max. 256 MB */
113 #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (512 << 20) /* less than 512 MB */ 115 #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (512 << 20) /* less than 512 MB */
114 116
115 #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ 117 #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
116 ORxS_SDAM_MSK) |\ 118 ORxS_SDAM_MSK) |\
117 ORxS_BPD_4 |\ 119 ORxS_BPD_4 |\
118 ORxS_NUMR_13 |\ 120 ORxS_NUMR_13 |\
119 ORxS_IBID) 121 ORxS_IBID)
120 122
121 #define CONFIG_SYS_PSDMR ( \ 123 #define CONFIG_SYS_PSDMR ( \
122 PSDMR_PBI |\ 124 PSDMR_PBI |\
123 PSDMR_RFEN |\ 125 PSDMR_RFEN |\
124 PSDMR_BSMA_A13_A15 |\ 126 PSDMR_BSMA_A13_A15 |\
125 PSDMR_RFRC_5_CLK |\ 127 PSDMR_RFRC_5_CLK |\
126 PSDMR_PRETOACT_2W |\ 128 PSDMR_PRETOACT_2W |\
127 PSDMR_ACTTORW_2W |\ 129 PSDMR_ACTTORW_2W |\
128 PSDMR_LDOTOPRE_1C |\ 130 PSDMR_LDOTOPRE_1C |\
129 PSDMR_WRC_1C |\ 131 PSDMR_WRC_1C |\
130 PSDMR_CL_2) 132 PSDMR_CL_2)
131 133
132 #define CONFIG_SYS_SDRAM_LIST { \ 134 #define CONFIG_SYS_SDRAM_LIST { \
133 { .size = 256 << 20, \ 135 { .size = 256 << 20, \
134 .or1 = ORxS_ROWST_PBI1_A4, \ 136 .or1 = ORxS_ROWST_PBI1_A4, \
135 .psdmr = PSDMR_SDAM_A17_IS_A5 | PSDMR_SDA10_PBI1_A6, \ 137 .psdmr = PSDMR_SDAM_A17_IS_A5 | PSDMR_SDA10_PBI1_A6, \
136 }, \ 138 }, \
137 { .size = 128 << 20, \ 139 { .size = 128 << 20, \
138 .or1 = ORxS_ROWST_PBI1_A5, \ 140 .or1 = ORxS_ROWST_PBI1_A5, \
139 .psdmr = PSDMR_SDAM_A16_IS_A5 | PSDMR_SDA10_PBI1_A7, \ 141 .psdmr = PSDMR_SDAM_A16_IS_A5 | PSDMR_SDA10_PBI1_A7, \
140 }, \ 142 }, \
141 } 143 }
142 #endif /* defined(CONFIG_MGCOGE3NE) */ 144 #endif /* defined(CONFIG_MGCOGE3NE) */
143 145
144 /* include further common stuff for all keymile 82xx boards */ 146 /* include further common stuff for all keymile 82xx boards */
145 /* 147 /*
146 * Select serial console configuration 148 * Select serial console configuration
147 * 149 *
148 * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then 150 * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
149 * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4 151 * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
150 * for SCC). 152 * for SCC).
151 */ 153 */
152 #define CONFIG_CONS_ON_SMC /* Console is on SMC */ 154 #define CONFIG_CONS_ON_SMC /* Console is on SMC */
153 #undef CONFIG_CONS_ON_SCC /* It's not on SCC */ 155 #undef CONFIG_CONS_ON_SCC /* It's not on SCC */
154 #undef CONFIG_CONS_NONE /* It's not on external UART */ 156 #undef CONFIG_CONS_NONE /* It's not on external UART */
155 #define CONFIG_CONS_INDEX 2 /* SMC2 is used for console */ 157 #define CONFIG_CONS_INDEX 2 /* SMC2 is used for console */
156 #define CONFIG_SYS_SMC_RXBUFLEN 128 158 #define CONFIG_SYS_SMC_RXBUFLEN 128
157 #define CONFIG_SYS_MAXIDLE 10 159 #define CONFIG_SYS_MAXIDLE 10
158 160
159 /* 161 /*
160 * Select ethernet configuration 162 * Select ethernet configuration
161 * 163 *
162 * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, 164 * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected,
163 * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for 165 * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for
164 * SCC, 1-3 for FCC) 166 * SCC, 1-3 for FCC)
165 * 167 *
166 * If CONFIG_ETHER_NONE is defined, then either the ethernet routines 168 * If CONFIG_ETHER_NONE is defined, then either the ethernet routines
167 * must be defined elsewhere (as for the console), or CONFIG_CMD_NET 169 * must be defined elsewhere (as for the console), or CONFIG_CMD_NET
168 * must be unset. 170 * must be unset.
169 */ 171 */
170 #define CONFIG_ETHER_ON_SCC /* Ethernet is on SCC */ 172 #define CONFIG_ETHER_ON_SCC /* Ethernet is on SCC */
171 #undef CONFIG_ETHER_ON_FCC /* Ethernet is not on FCC */ 173 #undef CONFIG_ETHER_ON_FCC /* Ethernet is not on FCC */
172 #undef CONFIG_ETHER_NONE /* No external Ethernet */ 174 #undef CONFIG_ETHER_NONE /* No external Ethernet */
173 175
174 #define CONFIG_ETHER_INDEX 4 176 #define CONFIG_ETHER_INDEX 4
175 #define CONFIG_HAS_ETH0 177 #define CONFIG_HAS_ETH0
176 #define CONFIG_SYS_SCC_TOUT_LOOP 10000000 178 #define CONFIG_SYS_SCC_TOUT_LOOP 10000000
177 179
178 #define CONFIG_SYS_CMXSCR_VALUE (CMXSCR_RS4CS_CLK7 | CMXSCR_TS4CS_CLK8) 180 #define CONFIG_SYS_CMXSCR_VALUE (CMXSCR_RS4CS_CLK7 | CMXSCR_TS4CS_CLK8)
179 181
180 #ifndef CONFIG_8260_CLKIN 182 #ifndef CONFIG_8260_CLKIN
181 #define CONFIG_8260_CLKIN 66000000 /* in Hz */ 183 #define CONFIG_8260_CLKIN 66000000 /* in Hz */
182 #endif 184 #endif
183 185
184 #define BOOTFLASH_START 0xFE000000 186 #define BOOTFLASH_START 0xFE000000
185 187
186 #define CONFIG_KM_CONSOLE_TTY "ttyCPM0" 188 #define CONFIG_KM_CONSOLE_TTY "ttyCPM0"
187 189
188 #define MTDPARTS_DEFAULT "mtdparts=" \ 190 #define MTDPARTS_DEFAULT "mtdparts=" \
189 "app:" \ 191 "app:" \
190 "768k(u-boot)," \ 192 "768k(u-boot)," \
191 "128k(env)," \ 193 "128k(env)," \
192 "128k(envred)," \ 194 "128k(envred)," \
193 "3072k(free)," \ 195 "3072k(free)," \
194 "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ")" 196 "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ")"
195 197
196 /* 198 /*
197 * Default environment settings 199 * Default environment settings
198 */ 200 */
199 #define CONFIG_EXTRA_ENV_SETTINGS \ 201 #define CONFIG_EXTRA_ENV_SETTINGS \
200 CONFIG_KM_BOARD_EXTRA_ENV \ 202 CONFIG_KM_BOARD_EXTRA_ENV \
201 CONFIG_KM_DEF_ENV \ 203 CONFIG_KM_DEF_ENV \
202 "unlock=yes\0" \ 204 "unlock=yes\0" \
203 "newenv=" \ 205 "newenv=" \
204 "prot off 0xFE0C0000 +0x40000 && " \ 206 "prot off 0xFE0C0000 +0x40000 && " \
205 "era 0xFE0C0000 +0x40000\0" \ 207 "era 0xFE0C0000 +0x40000\0" \
206 "arch=ppc_82xx\0" \ 208 "arch=ppc_82xx\0" \
207 "" 209 ""
208 210
209 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE 211 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
210 212
211 #define CONFIG_SYS_MONITOR_LEN (768 << 10) 213 #define CONFIG_SYS_MONITOR_LEN (768 << 10)
212 214
213 #define CONFIG_ENV_IS_IN_FLASH 215 #define CONFIG_ENV_IS_IN_FLASH
214 216
215 #ifdef CONFIG_ENV_IS_IN_FLASH 217 #ifdef CONFIG_ENV_IS_IN_FLASH
216 #define CONFIG_ENV_SECT_SIZE 0x20000 218 #define CONFIG_ENV_SECT_SIZE 0x20000
217 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \ 219 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \
218 CONFIG_SYS_MONITOR_LEN) 220 CONFIG_SYS_MONITOR_LEN)
219 #define CONFIG_ENV_OFFSET CONFIG_SYS_MONITOR_LEN 221 #define CONFIG_ENV_OFFSET CONFIG_SYS_MONITOR_LEN
220 222
221 /* Address and size of Redundant Environment Sector */ 223 /* Address and size of Redundant Environment Sector */
222 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ 224 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
223 CONFIG_ENV_SECT_SIZE) 225 CONFIG_ENV_SECT_SIZE)
224 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) 226 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
225 #endif /* CONFIG_ENV_IS_IN_FLASH */ 227 #endif /* CONFIG_ENV_IS_IN_FLASH */
226 228
227 /* enable I2C and select the hardware/software driver */ 229 /* enable I2C and select the hardware/software driver */
228 #define CONFIG_SYS_I2C 230 #define CONFIG_SYS_I2C
229 #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ 231 #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */
230 #define CONFIG_SYS_I2C_INIT_BOARD 232 #define CONFIG_SYS_I2C_INIT_BOARD
231 #define CONFIG_SYS_NUM_I2C_BUSES 3 233 #define CONFIG_SYS_NUM_I2C_BUSES 3
232 #define CONFIG_SYS_I2C_MAX_HOPS 1 234 #define CONFIG_SYS_I2C_MAX_HOPS 1
233 #define CONFIG_SYS_I2C_SOFT_SPEED 50000 235 #define CONFIG_SYS_I2C_SOFT_SPEED 50000
234 #define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED 236 #define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED
235 #define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F 237 #define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F
236 #define CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP} }, \ 238 #define CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP} }, \
237 {0, {{I2C_MUX_PCA9542, 0x70, 0} } }, \ 239 {0, {{I2C_MUX_PCA9542, 0x70, 0} } }, \
238 {0, {{I2C_MUX_PCA9542, 0x70, 1} } } } 240 {0, {{I2C_MUX_PCA9542, 0x70, 1} } } }
239 241
240 #define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ 242 #define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/
241 #define CONFIG_KM_I2C_ABORT 243 #define CONFIG_KM_I2C_ABORT
242 244
243 /* 245 /*
244 * Software (bit-bang) I2C driver configuration 246 * Software (bit-bang) I2C driver configuration
245 */ 247 */
246 248
247 #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ 249 #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */
248 #define I2C_ACTIVE (iop->pdir |= 0x00010000) 250 #define I2C_ACTIVE (iop->pdir |= 0x00010000)
249 #define I2C_TRISTATE (iop->pdir &= ~0x00010000) 251 #define I2C_TRISTATE (iop->pdir &= ~0x00010000)
250 #define I2C_READ ((iop->pdat & 0x00010000) != 0) 252 #define I2C_READ ((iop->pdat & 0x00010000) != 0)
251 #define I2C_SDA(bit) do { \ 253 #define I2C_SDA(bit) do { \
252 if (bit) \ 254 if (bit) \
253 iop->pdat |= 0x00010000; \ 255 iop->pdat |= 0x00010000; \
254 else \ 256 else \
255 iop->pdat &= ~0x00010000; \ 257 iop->pdat &= ~0x00010000; \
256 } while (0) 258 } while (0)
257 #define I2C_SCL(bit) do { \ 259 #define I2C_SCL(bit) do { \
258 if (bit) \ 260 if (bit) \
259 iop->pdat |= 0x00020000; \ 261 iop->pdat |= 0x00020000; \
260 else \ 262 else \
261 iop->pdat &= ~0x00020000; \ 263 iop->pdat &= ~0x00020000; \
262 } while (0) 264 } while (0)
263 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ 265 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
264 266
265 #ifndef __ASSEMBLY__ 267 #ifndef __ASSEMBLY__
266 void set_sda(int state); 268 void set_sda(int state);
267 void set_scl(int state); 269 void set_scl(int state);
268 int get_sda(void); 270 int get_sda(void);
269 int get_scl(void); 271 int get_scl(void);
270 #endif 272 #endif
271 273
272 /* I2C SYSMON (LM75, AD7414 is almost compatible) */ 274 /* I2C SYSMON (LM75, AD7414 is almost compatible) */
273 #define CONFIG_DTT_LM75 /* ON Semi's LM75 */ 275 #define CONFIG_DTT_LM75 /* ON Semi's LM75 */
274 #define CONFIG_DTT_SENSORS {0} /* Sensor addresses */ 276 #define CONFIG_DTT_SENSORS {0} /* Sensor addresses */
275 #define CONFIG_SYS_DTT_MAX_TEMP 70 277 #define CONFIG_SYS_DTT_MAX_TEMP 70
276 #define CONFIG_SYS_DTT_HYSTERESIS 3 278 #define CONFIG_SYS_DTT_HYSTERESIS 3
277 #define CONFIG_SYS_DTT_BUS_NUM 2 279 #define CONFIG_SYS_DTT_BUS_NUM 2
278 280
279 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 281 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
280 282
281 #define CONFIG_SYS_IMMR 0xF0000000 283 #define CONFIG_SYS_IMMR 0xF0000000
282 284
283 #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR 285 #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR
284 #define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* used size in DPRAM */ 286 #define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* used size in DPRAM */
285 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \ 287 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
286 GENERATED_GBL_DATA_SIZE) 288 GENERATED_GBL_DATA_SIZE)
287 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET 289 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
288 290
289 /* Hard reset configuration word */ 291 /* Hard reset configuration word */
290 #define CONFIG_SYS_HRCW_MASTER 0x0604b211 292 #define CONFIG_SYS_HRCW_MASTER 0x0604b211
291 293
292 /* No slaves */ 294 /* No slaves */
293 #define CONFIG_SYS_HRCW_SLAVE1 0 295 #define CONFIG_SYS_HRCW_SLAVE1 0
294 #define CONFIG_SYS_HRCW_SLAVE2 0 296 #define CONFIG_SYS_HRCW_SLAVE2 0
295 #define CONFIG_SYS_HRCW_SLAVE3 0 297 #define CONFIG_SYS_HRCW_SLAVE3 0
296 #define CONFIG_SYS_HRCW_SLAVE4 0 298 #define CONFIG_SYS_HRCW_SLAVE4 0
297 #define CONFIG_SYS_HRCW_SLAVE5 0 299 #define CONFIG_SYS_HRCW_SLAVE5 0
298 #define CONFIG_SYS_HRCW_SLAVE6 0 300 #define CONFIG_SYS_HRCW_SLAVE6 0
299 #define CONFIG_SYS_HRCW_SLAVE7 0 301 #define CONFIG_SYS_HRCW_SLAVE7 0
300 302
301 /* Initial Memory map for Linux */ 303 /* Initial Memory map for Linux */
302 #define CONFIG_SYS_BOOTMAPSZ (8 << 20) 304 #define CONFIG_SYS_BOOTMAPSZ (8 << 20)
303 305
304 #define CONFIG_SYS_CACHELINE_SIZE 32 /* For MPC8260 CPUs */ 306 #define CONFIG_SYS_CACHELINE_SIZE 32 /* For MPC8260 CPUs */
305 #if defined(CONFIG_CMD_KGDB) 307 #if defined(CONFIG_CMD_KGDB)
306 # define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */ 308 # define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */
307 #endif 309 #endif
308 310
309 #define CONFIG_SYS_HID0_INIT 0 311 #define CONFIG_SYS_HID0_INIT 0
310 #define CONFIG_SYS_HID0_FINAL (HID0_ICE | HID0_IFEM | HID0_ABE) 312 #define CONFIG_SYS_HID0_FINAL (HID0_ICE | HID0_IFEM | HID0_ABE)
311 313
312 #define CONFIG_SYS_HID2 0 314 #define CONFIG_SYS_HID2 0
313 315
314 #define CONFIG_SYS_SIUMCR 0x4020c200 316 #define CONFIG_SYS_SIUMCR 0x4020c200
315 #define CONFIG_SYS_SYPCR 0xFFFFFF83 317 #define CONFIG_SYS_SYPCR 0xFFFFFF83
316 #define CONFIG_SYS_BCR 0x10000000 318 #define CONFIG_SYS_BCR 0x10000000
317 #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK) 319 #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK)
318 320
319 /* 321 /*
320 *----------------------------------------------------------------------- 322 *-----------------------------------------------------------------------
321 * RMR - Reset Mode Register 5-5 323 * RMR - Reset Mode Register 5-5
322 *----------------------------------------------------------------------- 324 *-----------------------------------------------------------------------
323 * turn on Checkstop Reset Enable 325 * turn on Checkstop Reset Enable
324 */ 326 */
325 #define CONFIG_SYS_RMR 0 327 #define CONFIG_SYS_RMR 0
326 328
327 /* 329 /*
328 *----------------------------------------------------------------------- 330 *-----------------------------------------------------------------------
329 * TMCNTSC - Time Counter Status and Control 4-40 331 * TMCNTSC - Time Counter Status and Control 4-40
330 *----------------------------------------------------------------------- 332 *-----------------------------------------------------------------------
331 * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk, 333 * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
332 * and enable Time Counter 334 * and enable Time Counter
333 */ 335 */
334 #define CONFIG_SYS_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE) 336 #define CONFIG_SYS_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
335 337
336 /* 338 /*
337 *----------------------------------------------------------------------- 339 *-----------------------------------------------------------------------
338 * PISCR - Periodic Interrupt Status and Control 4-42 340 * PISCR - Periodic Interrupt Status and Control 4-42
339 *----------------------------------------------------------------------- 341 *-----------------------------------------------------------------------
340 * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable 342 * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
341 * Periodic timer 343 * Periodic timer
342 */ 344 */
343 #define CONFIG_SYS_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE) 345 #define CONFIG_SYS_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
344 346
345 /* 347 /*
346 *----------------------------------------------------------------------- 348 *-----------------------------------------------------------------------
347 * RCCR - RISC Controller Configuration 13-7 349 * RCCR - RISC Controller Configuration 13-7
348 *----------------------------------------------------------------------- 350 *-----------------------------------------------------------------------
349 */ 351 */
350 #define CONFIG_SYS_RCCR 0 352 #define CONFIG_SYS_RCCR 0
351 353
352 /* 354 /*
353 * Init Memory Controller: 355 * Init Memory Controller:
354 * 356 *
355 * Bank Bus Machine PortSz Device 357 * Bank Bus Machine PortSz Device
356 * ---- --- ------- ------ ------ 358 * ---- --- ------- ------ ------
357 * 0 60x GPCM 8 bit FLASH 359 * 0 60x GPCM 8 bit FLASH
358 * 1 60x SDRAM 32 bit SDRAM 360 * 1 60x SDRAM 32 bit SDRAM
359 * 3 60x GPCM 8 bit GPIO/PIGGY 361 * 3 60x GPCM 8 bit GPIO/PIGGY
360 * 5 60x GPCM 16 bit CFG-Flash 362 * 5 60x GPCM 16 bit CFG-Flash
361 * 363 *
362 */ 364 */
363 /* Bank 0 - FLASH 365 /* Bank 0 - FLASH
364 */ 366 */
365 #define CONFIG_SYS_BR0_PRELIM ((CONFIG_SYS_FLASH_BASE & BRx_BA_MSK) |\ 367 #define CONFIG_SYS_BR0_PRELIM ((CONFIG_SYS_FLASH_BASE & BRx_BA_MSK) |\
366 BRx_PS_8 |\ 368 BRx_PS_8 |\
367 BRx_MS_GPCM_P |\ 369 BRx_MS_GPCM_P |\
368 BRx_V) 370 BRx_V)
369 371
370 #define CONFIG_SYS_OR0_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) |\ 372 #define CONFIG_SYS_OR0_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) |\
371 ORxG_CSNT |\ 373 ORxG_CSNT |\
372 ORxG_ACS_DIV2 |\ 374 ORxG_ACS_DIV2 |\
373 ORxG_SCY_5_CLK |\ 375 ORxG_SCY_5_CLK |\
374 ORxG_TRLX) 376 ORxG_TRLX)
375 377
376 #define CONFIG_SYS_MPTPR 0x1800 378 #define CONFIG_SYS_MPTPR 0x1800
377 379
378 /* 380 /*
379 *----------------------------------------------------------------------------- 381 *-----------------------------------------------------------------------------
380 * Address for Mode Register Set (MRS) command 382 * Address for Mode Register Set (MRS) command
381 *----------------------------------------------------------------------------- 383 *-----------------------------------------------------------------------------
382 */ 384 */
383 #define CONFIG_SYS_MRS_OFFS 0x00000110 385 #define CONFIG_SYS_MRS_OFFS 0x00000110
384 #define CONFIG_SYS_PSRT 0x0e 386 #define CONFIG_SYS_PSRT 0x0e
385 387
386 #define CONFIG_SYS_BR1_PRELIM ((CONFIG_SYS_SDRAM_BASE & BRx_BA_MSK) |\ 388 #define CONFIG_SYS_BR1_PRELIM ((CONFIG_SYS_SDRAM_BASE & BRx_BA_MSK) |\
387 BRx_PS_64 |\ 389 BRx_PS_64 |\
388 BRx_MS_SDRAM_P |\ 390 BRx_MS_SDRAM_P |\
389 BRx_V) 391 BRx_V)
390 392
391 #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1 393 #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1
392 394
393 /* 395 /*
394 * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values 396 * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values
395 */ 397 */
396 #define CONFIG_SYS_KMBEC_FPGA_BASE 0x30000000 398 #define CONFIG_SYS_KMBEC_FPGA_BASE 0x30000000
397 #define CONFIG_SYS_KMBEC_FPGA_SIZE 128 399 #define CONFIG_SYS_KMBEC_FPGA_SIZE 128
398 400
399 #define CONFIG_SYS_BR3_PRELIM ((CONFIG_SYS_KMBEC_FPGA_BASE & BRx_BA_MSK) |\ 401 #define CONFIG_SYS_BR3_PRELIM ((CONFIG_SYS_KMBEC_FPGA_BASE & BRx_BA_MSK) |\
400 BRx_PS_8 | BRx_MS_GPCM_P | BRx_V) 402 BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
401 403
402 #define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_KMBEC_FPGA_SIZE) |\ 404 #define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_KMBEC_FPGA_SIZE) |\
403 ORxG_CSNT | ORxG_ACS_DIV2 |\ 405 ORxG_CSNT | ORxG_ACS_DIV2 |\
404 ORxG_SCY_3_CLK | ORxG_TRLX) 406 ORxG_SCY_3_CLK | ORxG_TRLX)
405 407
406 /* 408 /*
407 * BFTICU board FPGA on CS4 initialization values 409 * BFTICU board FPGA on CS4 initialization values
408 */ 410 */
409 #define CONFIG_SYS_FPGA_BASE 0x40000000 411 #define CONFIG_SYS_FPGA_BASE 0x40000000
410 #define CONFIG_SYS_FPGA_SIZE 1 /*1KB*/ 412 #define CONFIG_SYS_FPGA_SIZE 1 /*1KB*/
411 413
412 #define CONFIG_SYS_BR4_PRELIM ((CONFIG_SYS_FPGA_BASE & BRx_BA_MSK) |\ 414 #define CONFIG_SYS_BR4_PRELIM ((CONFIG_SYS_FPGA_BASE & BRx_BA_MSK) |\
413 BRx_PS_8 | BRx_MS_GPCM_P | BRx_V) 415 BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
414 416
415 #define CONFIG_SYS_OR4_PRELIM (P2SZ_TO_AM(CONFIG_SYS_FPGA_SIZE << 10) |\ 417 #define CONFIG_SYS_OR4_PRELIM (P2SZ_TO_AM(CONFIG_SYS_FPGA_SIZE << 10) |\
416 ORxG_CSNT | ORxG_ACS_DIV2 |\ 418 ORxG_CSNT | ORxG_ACS_DIV2 |\
417 ORxG_SCY_3_CLK | ORxG_TRLX) 419 ORxG_SCY_3_CLK | ORxG_TRLX)
418 420
419 /* 421 /*
420 * CFG-Flash on CS5 initialization values 422 * CFG-Flash on CS5 initialization values
421 */ 423 */
422 #define CONFIG_SYS_BR5_PRELIM ((CONFIG_SYS_FLASH_BASE_1 & BRx_BA_MSK) |\ 424 #define CONFIG_SYS_BR5_PRELIM ((CONFIG_SYS_FLASH_BASE_1 & BRx_BA_MSK) |\
423 BRx_PS_16 | BRx_MS_GPCM_P | BRx_V) 425 BRx_PS_16 | BRx_MS_GPCM_P | BRx_V)
424 426
425 #define CONFIG_SYS_OR5_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE_1 + \ 427 #define CONFIG_SYS_OR5_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE_1 + \
426 CONFIG_SYS_FLASH_SIZE_2) |\ 428 CONFIG_SYS_FLASH_SIZE_2) |\
427 ORxG_CSNT | ORxG_ACS_DIV2 |\ 429 ORxG_CSNT | ORxG_ACS_DIV2 |\
428 ORxG_SCY_5_CLK | ORxG_TRLX) 430 ORxG_SCY_5_CLK | ORxG_TRLX)
429 431
430 #define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */ 432 #define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */
431 433
432 /* pass open firmware flat tree */ 434 /* pass open firmware flat tree */
433 #define CONFIG_FIT 1 435 #define CONFIG_FIT 1
434 #define CONFIG_OF_LIBFDT 1 436 #define CONFIG_OF_LIBFDT 1
435 #define CONFIG_OF_BOARD_SETUP 1 437 #define CONFIG_OF_BOARD_SETUP 1
436 438
437 #define OF_TBCLK (bd->bi_busfreq / 4) 439 #define OF_TBCLK (bd->bi_busfreq / 4)
438 #define OF_STDOUT_PATH "/soc/cpm/serial@11a90" 440 #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
439 441
440 #endif /* __CONFIG_H */ 442 #endif /* __CONFIG_H */
441 443