Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 1 | /* |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 2 | * (C) Copyright 2007 - 2008 |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <mpc8260.h> |
| 26 | #include <ioports.h> |
Heiko Schocher | 9661bf9 | 2008-10-15 09:36:03 +0200 | [diff] [blame] | 27 | #include <malloc.h> |
Heiko Schocher | 9e29919 | 2008-10-17 12:15:55 +0200 | [diff] [blame] | 28 | #include <asm/io.h> |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 29 | |
| 30 | #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) |
| 31 | #include <libfdt.h> |
| 32 | #endif |
| 33 | |
Heiko Schocher | 9661bf9 | 2008-10-15 09:36:03 +0200 | [diff] [blame] | 34 | #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) |
| 35 | #include <i2c.h> |
| 36 | #endif |
| 37 | |
Heiko Schocher | 210c8c0 | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 38 | #include "../common/common.h" |
| 39 | |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 40 | /* |
| 41 | * I/O Port configuration table |
| 42 | * |
| 43 | * if conf is 1, then that port pin will be configured at boot time |
| 44 | * according to the five values podr/pdir/ppar/psor/pdat for that entry |
| 45 | */ |
| 46 | const iop_conf_t iop_conf_tab[4][32] = { |
| 47 | |
| 48 | /* Port A */ |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 49 | { /* conf ppar psor pdir podr pdat */ |
| 50 | /* PA31 */ { 0, 0, 0, 0, 0, 0 }, /* PA31 */ |
| 51 | /* PA30 */ { 0, 0, 0, 0, 0, 0 }, /* PA30 */ |
| 52 | /* PA29 */ { 0, 0, 0, 0, 0, 0 }, /* PA29 */ |
| 53 | /* PA28 */ { 0, 0, 0, 0, 0, 0 }, /* PA28 */ |
| 54 | /* PA27 */ { 0, 0, 0, 0, 0, 0 }, /* PA27 */ |
| 55 | /* PA26 */ { 0, 0, 0, 0, 0, 0 }, /* PA26 */ |
| 56 | /* PA25 */ { 0, 0, 0, 0, 0, 0 }, /* PA25 */ |
| 57 | /* PA24 */ { 0, 0, 0, 0, 0, 0 }, /* PA24 */ |
| 58 | /* PA23 */ { 0, 0, 0, 0, 0, 0 }, /* PA23 */ |
| 59 | /* PA22 */ { 0, 0, 0, 0, 0, 0 }, /* PA22 */ |
| 60 | /* PA21 */ { 0, 0, 0, 0, 0, 0 }, /* PA21 */ |
| 61 | /* PA20 */ { 0, 0, 0, 0, 0, 0 }, /* PA20 */ |
| 62 | /* PA19 */ { 0, 0, 0, 0, 0, 0 }, /* PA19 */ |
| 63 | /* PA18 */ { 0, 0, 0, 0, 0, 0 }, /* PA18 */ |
| 64 | /* PA17 */ { 0, 0, 0, 0, 0, 0 }, /* PA17 */ |
| 65 | /* PA16 */ { 0, 0, 0, 0, 0, 0 }, /* PA16 */ |
| 66 | /* PA15 */ { 0, 0, 0, 0, 0, 0 }, /* PA15 */ |
| 67 | /* PA14 */ { 0, 0, 0, 0, 0, 0 }, /* PA14 */ |
| 68 | /* PA13 */ { 0, 0, 0, 0, 0, 0 }, /* PA13 */ |
| 69 | /* PA12 */ { 0, 0, 0, 0, 0, 0 }, /* PA12 */ |
| 70 | /* PA11 */ { 0, 0, 0, 0, 0, 0 }, /* PA11 */ |
| 71 | /* PA10 */ { 0, 0, 0, 0, 0, 0 }, /* PA10 */ |
| 72 | /* PA9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC2 TxD */ |
| 73 | /* PA8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC2 RxD */ |
| 74 | /* PA7 */ { 0, 0, 0, 0, 0, 0 }, /* PA7 */ |
| 75 | /* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */ |
| 76 | /* PA5 */ { 0, 0, 0, 0, 0, 0 }, /* PA5 */ |
| 77 | /* PA4 */ { 0, 0, 0, 0, 0, 0 }, /* PA4 */ |
| 78 | /* PA3 */ { 0, 0, 0, 0, 0, 0 }, /* PA3 */ |
| 79 | /* PA2 */ { 0, 0, 0, 0, 0, 0 }, /* PA2 */ |
| 80 | /* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */ |
| 81 | /* PA0 */ { 0, 0, 0, 0, 0, 0 } /* PA0 */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 82 | }, |
| 83 | |
| 84 | /* Port B */ |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 85 | { /* conf ppar psor pdir podr pdat */ |
| 86 | /* PB31 */ { 0, 0, 0, 0, 0, 0 }, /* PB31 */ |
| 87 | /* PB30 */ { 0, 0, 0, 0, 0, 0 }, /* PB30 */ |
| 88 | /* PB29 */ { 0, 0, 0, 0, 0, 0 }, /* PB29 */ |
| 89 | /* PB28 */ { 0, 0, 0, 0, 0, 0 }, /* PB28 */ |
| 90 | /* PB27 */ { 0, 0, 0, 0, 0, 0 }, /* PB27 */ |
| 91 | /* PB26 */ { 0, 0, 0, 0, 0, 0 }, /* PB26 */ |
| 92 | /* PB25 */ { 0, 0, 0, 0, 0, 0 }, /* PB25 */ |
| 93 | /* PB24 */ { 0, 0, 0, 0, 0, 0 }, /* PB24 */ |
| 94 | /* PB23 */ { 0, 0, 0, 0, 0, 0 }, /* PB23 */ |
| 95 | /* PB22 */ { 0, 0, 0, 0, 0, 0 }, /* PB22 */ |
| 96 | /* PB21 */ { 0, 0, 0, 0, 0, 0 }, /* PB21 */ |
| 97 | /* PB20 */ { 0, 0, 0, 0, 0, 0 }, /* PB20 */ |
| 98 | /* PB19 */ { 0, 0, 0, 0, 0, 0 }, /* PB19 */ |
| 99 | /* PB18 */ { 0, 0, 0, 0, 0, 0 }, /* PB18 */ |
| 100 | /* PB17 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 101 | /* PB16 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 102 | /* PB15 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 103 | /* PB14 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 104 | /* PB13 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 105 | /* PB12 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 106 | /* PB11 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 107 | /* PB10 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 108 | /* PB9 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 109 | /* PB8 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 110 | /* PB7 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 111 | /* PB6 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 112 | /* PB5 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 113 | /* PB4 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 114 | /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 115 | /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 116 | /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 117 | /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* non-existent */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 118 | }, |
| 119 | |
| 120 | /* Port C */ |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 121 | { /* conf ppar psor pdir podr pdat */ |
| 122 | /* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */ |
| 123 | /* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */ |
| 124 | /* PC29 */ { 0, 0, 0, 0, 0, 0 }, /* PC29 */ |
| 125 | /* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */ |
| 126 | /* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */ |
| 127 | /* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */ |
| 128 | /* PC25 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4 RxClk */ |
| 129 | /* PC24 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4 TxClk */ |
| 130 | /* PC23 */ { 0, 0, 0, 0, 0, 0 }, /* PC23 */ |
| 131 | /* PC22 */ { 0, 0, 0, 0, 0, 0 }, /* PC22 */ |
| 132 | /* PC21 */ { 0, 0, 0, 0, 0, 0 }, /* PC21 */ |
| 133 | /* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */ |
| 134 | /* PC19 */ { 0, 0, 0, 0, 0, 0 }, /* PC19 */ |
| 135 | /* PC18 */ { 0, 0, 0, 0, 0, 0 }, /* PC18 */ |
| 136 | /* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */ |
| 137 | /* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */ |
| 138 | /* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */ |
| 139 | /* PC14 */ { 0, 0, 0, 0, 0, 0 }, /* PC14 */ |
| 140 | /* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */ |
| 141 | /* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */ |
| 142 | /* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */ |
| 143 | /* PC10 */ { 0, 0, 0, 0, 0, 0 }, /* PC10 */ |
| 144 | /* PC9 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: CTS */ |
| 145 | /* PC8 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: CD */ |
| 146 | /* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */ |
| 147 | /* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */ |
| 148 | /* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */ |
| 149 | /* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */ |
| 150 | /* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */ |
| 151 | /* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */ |
| 152 | /* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */ |
| 153 | /* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 154 | }, |
| 155 | |
| 156 | /* Port D */ |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 157 | { /* conf ppar psor pdir podr pdat */ |
| 158 | /* PD31 */ { 0, 0, 0, 0, 0, 0 }, /* PD31 */ |
| 159 | /* PD30 */ { 0, 0, 0, 0, 0, 0 }, /* PD30 */ |
| 160 | /* PD29 */ { 0, 0, 0, 0, 0, 0 }, /* PD29 */ |
| 161 | /* PD28 */ { 0, 0, 0, 0, 0, 0 }, /* PD28 */ |
| 162 | /* PD27 */ { 0, 0, 0, 0, 0, 0 }, /* PD27 */ |
| 163 | /* PD26 */ { 0, 0, 0, 0, 0, 0 }, /* PD26 */ |
| 164 | /* PD25 */ { 0, 0, 0, 0, 0, 0 }, /* PD25 */ |
| 165 | /* PD24 */ { 0, 0, 0, 0, 0, 0 }, /* PD24 */ |
| 166 | /* PD23 */ { 0, 0, 0, 0, 0, 0 }, /* PD23 */ |
| 167 | /* PD22 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: RXD */ |
| 168 | /* PD21 */ { 1, 1, 0, 1, 0, 0 }, /* SCC4: TXD */ |
| 169 | /* PD20 */ { 1, 1, 0, 1, 0, 0 }, /* SCC4: RTS */ |
| 170 | /* PD19 */ { 0, 0, 0, 0, 0, 0 }, /* PD19 */ |
| 171 | /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */ |
| 172 | /* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */ |
| 173 | /* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */ |
Heiko Schocher | 9661bf9 | 2008-10-15 09:36:03 +0200 | [diff] [blame] | 174 | #if defined(CONFIG_HARD_I2C) |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 175 | /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */ |
| 176 | /* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */ |
Heiko Schocher | 9661bf9 | 2008-10-15 09:36:03 +0200 | [diff] [blame] | 177 | #else |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 178 | /* PD15 */ { 1, 0, 0, 0, 1, 1 }, /* PD15 */ |
| 179 | /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* PD14 */ |
Heiko Schocher | 9661bf9 | 2008-10-15 09:36:03 +0200 | [diff] [blame] | 180 | #endif |
Wolfgang Denk | 3cbd823 | 2008-11-02 16:14:22 +0100 | [diff] [blame] | 181 | /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */ |
| 182 | /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */ |
| 183 | /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */ |
| 184 | /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */ |
| 185 | /* PD9 */ { 0, 0, 0, 0, 0, 0 }, /* PD9 */ |
| 186 | /* PD8 */ { 0, 0, 0, 0, 0, 0 }, /* PD8 */ |
| 187 | /* PD7 */ { 0, 0, 0, 0, 0, 0 }, /* PD7 */ |
| 188 | /* PD6 */ { 0, 0, 0, 0, 0, 0 }, /* PD6 */ |
| 189 | /* PD5 */ { 0, 0, 0, 0, 0, 0 }, /* PD5 */ |
| 190 | /* PD4 */ { 0, 0, 0, 0, 0, 0 }, /* PD4 */ |
| 191 | /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 192 | /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 193 | /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ |
| 194 | /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* non-existent */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 195 | } |
| 196 | }; |
| 197 | |
| 198 | /* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx |
| 199 | * |
| 200 | * This routine performs standard 8260 initialization sequence |
| 201 | * and calculates the available memory size. It may be called |
| 202 | * several times to try different SDRAM configurations on both |
| 203 | * 60x and local buses. |
| 204 | */ |
| 205 | static long int try_init (volatile memctl8260_t * memctl, ulong sdmr, |
| 206 | ulong orx, volatile uchar * base) |
| 207 | { |
| 208 | volatile uchar c = 0xff; |
| 209 | volatile uint *sdmr_ptr; |
| 210 | volatile uint *orx_ptr; |
| 211 | ulong maxsize, size; |
| 212 | int i; |
| 213 | |
| 214 | /* We must be able to test a location outsize the maximum legal size |
| 215 | * to find out THAT we are outside; but this address still has to be |
| 216 | * mapped by the controller. That means, that the initial mapping has |
| 217 | * to be (at least) twice as large as the maximum expected size. |
| 218 | */ |
| 219 | maxsize = (1 + (~orx | 0x7fff))/* / 2*/; |
| 220 | |
| 221 | sdmr_ptr = &memctl->memc_psdmr; |
| 222 | orx_ptr = &memctl->memc_or1; |
| 223 | |
| 224 | *orx_ptr = orx; |
| 225 | |
| 226 | /* |
| 227 | * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35): |
| 228 | * |
| 229 | * "At system reset, initialization software must set up the |
| 230 | * programmable parameters in the memory controller banks registers |
| 231 | * (ORx, BRx, P/LSDMR). After all memory parameters are configured, |
| 232 | * system software should execute the following initialization sequence |
| 233 | * for each SDRAM device. |
| 234 | * |
| 235 | * 1. Issue a PRECHARGE-ALL-BANKS command |
| 236 | * 2. Issue eight CBR REFRESH commands |
| 237 | * 3. Issue a MODE-SET command to initialize the mode register |
| 238 | * |
| 239 | * The initial commands are executed by setting P/LSDMR[OP] and |
| 240 | * accessing the SDRAM with a single-byte transaction." |
| 241 | * |
| 242 | * The appropriate BRx/ORx registers have already been set when we |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 243 | * get here. The SDRAM can be accessed at the address CONFIG_SYS_SDRAM_BASE. |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 244 | */ |
| 245 | |
| 246 | *sdmr_ptr = sdmr | PSDMR_OP_PREA; |
| 247 | *base = c; |
| 248 | |
| 249 | *sdmr_ptr = sdmr | PSDMR_OP_CBRR; |
| 250 | for (i = 0; i < 8; i++) |
| 251 | *base = c; |
| 252 | |
| 253 | *sdmr_ptr = sdmr | PSDMR_OP_MRW; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 254 | *(base + CONFIG_SYS_MRS_OFFS) = c; /* setting MR on address lines */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 255 | |
| 256 | *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN; |
| 257 | *base = c; |
| 258 | |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 259 | size = get_ram_size ((long *)base, maxsize); |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 260 | *orx_ptr = orx | ~(size - 1); |
| 261 | |
| 262 | return (size); |
| 263 | } |
| 264 | |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 265 | phys_size_t initdram (int board_type) |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 266 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 267 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 268 | volatile memctl8260_t *memctl = &immap->im_memctl; |
| 269 | |
| 270 | long psize; |
| 271 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 272 | memctl->memc_psrt = CONFIG_SYS_PSRT; |
| 273 | memctl->memc_mptpr = CONFIG_SYS_MPTPR; |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 274 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 275 | #ifndef CONFIG_SYS_RAMBOOT |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 276 | /* 60x SDRAM setup: |
| 277 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 278 | psize = try_init (memctl, CONFIG_SYS_PSDMR, CONFIG_SYS_OR1, |
| 279 | (uchar *) CONFIG_SYS_SDRAM_BASE); |
| 280 | #endif /* CONFIG_SYS_RAMBOOT */ |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 281 | |
| 282 | icache_enable (); |
| 283 | |
| 284 | return (psize); |
| 285 | } |
| 286 | |
| 287 | int checkboard(void) |
| 288 | { |
Heiko Schocher | 210c8c0 | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 289 | puts ("Board: Keymile mgcoge"); |
| 290 | if (ethernet_present ()) |
| 291 | puts (" with PIGGY."); |
| 292 | puts ("\n"); |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 293 | return 0; |
| 294 | } |
| 295 | |
Heiko Schocher | e492c90 | 2008-03-07 08:13:41 +0100 | [diff] [blame] | 296 | /* |
| 297 | * Early board initalization. |
| 298 | */ |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 299 | int board_early_init_r (void) |
Heiko Schocher | e492c90 | 2008-03-07 08:13:41 +0100 | [diff] [blame] | 300 | { |
| 301 | /* setup the UPIOx */ |
Heiko Schocher | 4897ee3 | 2010-01-07 08:55:50 +0100 | [diff] [blame] | 302 | /* General Unit Reset disabled, Flash Bank enabled, UnitLed on */ |
| 303 | out_8((u8 *)(CONFIG_SYS_PIGGY_BASE + 0x02), 0xc2); |
| 304 | /* SCC4 enable, halfduplex, FCC1 powerdown */ |
Heiko Schocher | 9e29919 | 2008-10-17 12:15:55 +0200 | [diff] [blame] | 305 | out_8((u8 *)(CONFIG_SYS_PIGGY_BASE + 0x03), 0x15); |
Heiko Schocher | e492c90 | 2008-03-07 08:13:41 +0100 | [diff] [blame] | 306 | return 0; |
| 307 | } |
| 308 | |
Heiko Schocher | 8f64da7 | 2008-10-15 09:41:00 +0200 | [diff] [blame] | 309 | int hush_init_var (void) |
| 310 | { |
| 311 | ivm_read_eeprom (); |
| 312 | return 0; |
| 313 | } |
| 314 | |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 315 | #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 316 | void ft_board_setup (void *blob, bd_t *bd) |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 317 | { |
Heiko Schocher | 0809ea2 | 2008-10-15 09:34:05 +0200 | [diff] [blame] | 318 | ft_cpu_setup (blob, bd); |
Heiko Schocher | ac9db06 | 2008-01-11 01:12:08 +0100 | [diff] [blame] | 319 | } |
| 320 | #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ |