Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Stefan Roese, DENX Software Engineering, sr@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 <command.h> |
| 26 | #include <malloc.h> |
| 27 | #include <environment.h> |
| 28 | #include <logbuff.h> |
| 29 | #include <post.h> |
| 30 | |
| 31 | #include <asm/processor.h> |
| 32 | #include <asm/io.h> |
Stefan Roese | de21eab | 2010-09-16 14:30:37 +0200 | [diff] [blame] | 33 | #include <asm/ppc4xx-gpio.h> |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 34 | |
| 35 | DECLARE_GLOBAL_DATA_PTR; |
| 36 | |
| 37 | #define REBOOT_MAGIC 0x07081967 |
| 38 | #define REBOOT_NOP 0x00000000 |
| 39 | #define REBOOT_DO_POST 0x00000001 |
| 40 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 41 | extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */ |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 42 | extern env_t *env_ptr; |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 43 | |
| 44 | ulong flash_get_size(ulong base, int banknum); |
| 45 | void env_crc_update(void); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 46 | |
| 47 | static u32 start_time; |
| 48 | |
| 49 | int board_early_init_f(void) |
| 50 | { |
Stefan Roese | 707fd36 | 2009-09-24 09:55:50 +0200 | [diff] [blame] | 51 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 52 | mtdcr(UIC0ER, 0x00000000); /* disable all ints */ |
| 53 | mtdcr(UIC0CR, 0x00000000); |
| 54 | mtdcr(UIC0PR, 0xFFFF7F00); /* set int polarities */ |
| 55 | mtdcr(UIC0TR, 0x00000000); /* set int trigger levels */ |
| 56 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 57 | mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */ |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * Configure CPC0_PCI to enable PerWE as output |
| 61 | */ |
Stefan Roese | 918010a | 2009-09-09 16:25:29 +0200 | [diff] [blame] | 62 | mtdcr(CPC0_PCI, CPC0_PCI_SPE); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | int misc_init_r(void) |
| 68 | { |
| 69 | u32 pbcr; |
| 70 | int size_val = 0; |
| 71 | u32 post_magic; |
| 72 | u32 post_val; |
| 73 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 74 | post_magic = in_be32((void *)CONFIG_SYS_POST_MAGIC); |
| 75 | post_val = in_be32((void *)CONFIG_SYS_POST_VAL); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 76 | if ((post_magic == REBOOT_MAGIC) && (post_val == REBOOT_DO_POST)) { |
| 77 | /* |
| 78 | * Set special bootline bootparameter to pass this POST boot |
| 79 | * mode to Linux to reset the username/password |
| 80 | */ |
| 81 | setenv("addmisc", "setenv bootargs \\${bootargs} factory_reset=yes"); |
| 82 | |
| 83 | /* |
| 84 | * Normally don't run POST tests, only when enabled |
| 85 | * via the sw-reset button. So disable further tests |
| 86 | * upon next bootup here. |
| 87 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 88 | out_be32((void *)CONFIG_SYS_POST_VAL, REBOOT_NOP); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 89 | } else { |
| 90 | /* |
| 91 | * Only run POST when initiated via the sw-reset button mechanism |
| 92 | */ |
| 93 | post_word_store(0); |
| 94 | } |
| 95 | |
| 96 | /* |
| 97 | * Get current time |
| 98 | */ |
| 99 | start_time = get_timer(0); |
| 100 | |
| 101 | /* |
| 102 | * FLASH stuff... |
| 103 | */ |
| 104 | |
| 105 | /* Re-do sizing to get full correct info */ |
| 106 | |
| 107 | /* adjust flash start and offset */ |
Stefan Roese | 918010a | 2009-09-09 16:25:29 +0200 | [diff] [blame] | 108 | mfebc(PB0CR, pbcr); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 109 | switch (gd->bd->bi_flashsize) { |
| 110 | case 1 << 20: |
| 111 | size_val = 0; |
| 112 | break; |
| 113 | case 2 << 20: |
| 114 | size_val = 1; |
| 115 | break; |
| 116 | case 4 << 20: |
| 117 | size_val = 2; |
| 118 | break; |
| 119 | case 8 << 20: |
| 120 | size_val = 3; |
| 121 | break; |
| 122 | case 16 << 20: |
| 123 | size_val = 4; |
| 124 | break; |
| 125 | case 32 << 20: |
| 126 | size_val = 5; |
| 127 | break; |
| 128 | case 64 << 20: |
| 129 | size_val = 6; |
| 130 | break; |
| 131 | case 128 << 20: |
| 132 | size_val = 7; |
| 133 | break; |
| 134 | } |
| 135 | pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17); |
Stefan Roese | 918010a | 2009-09-09 16:25:29 +0200 | [diff] [blame] | 136 | mtebc(PB0CR, pbcr); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 137 | |
| 138 | /* |
| 139 | * Re-check to get correct base address |
| 140 | */ |
| 141 | flash_get_size(gd->bd->bi_flashstart, 0); |
| 142 | |
| 143 | /* Monitor protection ON by default */ |
| 144 | (void)flash_protect(FLAG_PROTECT_SET, |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 145 | -CONFIG_SYS_MONITOR_LEN, |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 146 | 0xffffffff, |
| 147 | &flash_info[0]); |
| 148 | |
| 149 | /* Env protection ON by default */ |
| 150 | (void)flash_protect(FLAG_PROTECT_SET, |
Jean-Christophe PLAGNIOL-VILLARD | 7e1cda6 | 2008-09-10 22:48:06 +0200 | [diff] [blame] | 151 | CONFIG_ENV_ADDR_REDUND, |
| 152 | CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1, |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 153 | &flash_info[0]); |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | /* |
| 159 | * Check Board Identity: |
| 160 | */ |
| 161 | int checkboard(void) |
| 162 | { |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 163 | char buf[64]; |
| 164 | int i = getenv_f("serial#", buf, sizeof(buf)); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 165 | |
| 166 | puts("Board: Zeus-"); |
| 167 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 168 | if (in_be32((void *)GPIO0_IR) & GPIO_VAL(CONFIG_SYS_GPIO_ZEUS_PE)) |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 169 | puts("PE"); |
| 170 | else |
| 171 | puts("CE"); |
| 172 | |
| 173 | puts(" of BulletEndPoint"); |
| 174 | |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 175 | if (i > 0) { |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 176 | puts(", serial# "); |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 177 | puts(buf); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 178 | } |
| 179 | putc('\n'); |
| 180 | |
| 181 | /* both LED's off */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 182 | gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 0); |
| 183 | gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 0); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 184 | udelay(10000); |
| 185 | /* and on again */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 186 | gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 1); |
| 187 | gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 1); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 188 | |
| 189 | return (0); |
| 190 | } |
| 191 | |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 192 | static int default_env_var(char *buf, char *var) |
| 193 | { |
| 194 | char *ptr; |
| 195 | char *val; |
| 196 | |
| 197 | /* |
| 198 | * Find env variable |
| 199 | */ |
| 200 | ptr = strstr(buf + 4, var); |
| 201 | if (ptr == NULL) { |
| 202 | printf("ERROR: %s not found!\n", var); |
| 203 | return -1; |
| 204 | } |
| 205 | ptr += strlen(var) + 1; |
| 206 | |
| 207 | /* |
| 208 | * Now the ethaddr needs to be updated in the "normal" |
| 209 | * environment storage -> redundant flash. |
| 210 | */ |
| 211 | val = ptr; |
| 212 | setenv(var, val); |
| 213 | printf("Updated %s from eeprom to %s!\n", var, val); |
| 214 | |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | static int restore_default(void) |
| 219 | { |
| 220 | char *buf; |
| 221 | char *buf_save; |
| 222 | u32 crc; |
| 223 | |
Wolfgang Denk | 460a9ff | 2010-06-20 23:33:59 +0200 | [diff] [blame] | 224 | set_default_env(""); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 225 | |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 226 | gd->env_valid = 1; |
| 227 | |
| 228 | /* |
| 229 | * Read board specific values from I2C EEPROM |
| 230 | * and set env variables accordingly |
| 231 | * -> ethaddr, eth1addr, serial# |
| 232 | */ |
| 233 | buf = buf_save = malloc(FACTORY_RESET_ENV_SIZE); |
Wolfgang Denk | 460a9ff | 2010-06-20 23:33:59 +0200 | [diff] [blame] | 234 | if (buf == NULL) { |
| 235 | printf("ERROR: malloc() failed\n"); |
| 236 | return -1; |
| 237 | } |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 238 | if (eeprom_read(FACTORY_RESET_I2C_EEPROM, FACTORY_RESET_ENV_OFFS, |
| 239 | (u8 *)buf, FACTORY_RESET_ENV_SIZE)) { |
| 240 | puts("\nError reading EEPROM!\n"); |
| 241 | } else { |
| 242 | crc = crc32(0, (u8 *)(buf + 4), FACTORY_RESET_ENV_SIZE - 4); |
| 243 | if (crc != *(u32 *)buf) { |
Stefan Roese | 251161b | 2008-07-10 09:58:06 +0200 | [diff] [blame] | 244 | printf("ERROR: crc mismatch %08x %08x\n", crc, *(u32 *)buf); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 245 | return -1; |
| 246 | } |
| 247 | |
| 248 | default_env_var(buf, "ethaddr"); |
| 249 | buf += 8 + 18; |
| 250 | default_env_var(buf, "eth1addr"); |
| 251 | buf += 9 + 18; |
| 252 | default_env_var(buf, "serial#"); |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | * Finally save updated env variables back to flash |
| 257 | */ |
| 258 | saveenv(); |
| 259 | |
| 260 | free(buf_save); |
| 261 | |
| 262 | return 0; |
| 263 | } |
| 264 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 265 | int do_set_default(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 266 | { |
| 267 | char *buf; |
| 268 | char *buf_save; |
| 269 | char str[32]; |
| 270 | u32 crc; |
| 271 | char var[32]; |
| 272 | |
| 273 | if (argc < 4) { |
| 274 | puts("ERROR!\n"); |
| 275 | return -1; |
| 276 | } |
| 277 | |
| 278 | buf = buf_save = malloc(FACTORY_RESET_ENV_SIZE); |
| 279 | memset(buf, 0, FACTORY_RESET_ENV_SIZE); |
| 280 | |
| 281 | strcpy(var, "ethaddr"); |
| 282 | printf("Setting %s to %s\n", var, argv[1]); |
| 283 | sprintf(str, "%s=%s", var, argv[1]); |
| 284 | strcpy(buf + 4, str); |
| 285 | buf += strlen(str) + 1; |
| 286 | |
| 287 | strcpy(var, "eth1addr"); |
| 288 | printf("Setting %s to %s\n", var, argv[2]); |
| 289 | sprintf(str, "%s=%s", var, argv[2]); |
| 290 | strcpy(buf + 4, str); |
| 291 | buf += strlen(str) + 1; |
| 292 | |
| 293 | strcpy(var, "serial#"); |
| 294 | printf("Setting %s to %s\n", var, argv[3]); |
| 295 | sprintf(str, "%s=%s", var, argv[3]); |
| 296 | strcpy(buf + 4, str); |
| 297 | |
| 298 | crc = crc32(0, (u8 *)(buf_save + 4), FACTORY_RESET_ENV_SIZE - 4); |
| 299 | *(u32 *)buf_save = crc; |
| 300 | |
| 301 | if (eeprom_write(FACTORY_RESET_I2C_EEPROM, FACTORY_RESET_ENV_OFFS, |
| 302 | (u8 *)buf_save, FACTORY_RESET_ENV_SIZE)) { |
| 303 | puts("\nError writing EEPROM!\n"); |
| 304 | return -1; |
| 305 | } |
| 306 | |
| 307 | free(buf_save); |
| 308 | |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | U_BOOT_CMD( |
| 313 | setdef, 4, 1, do_set_default, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 314 | "write board-specific values to EEPROM (ethaddr...)", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 315 | "ethaddr eth1addr serial#\n - write board-specific values to EEPROM" |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 316 | ); |
| 317 | |
| 318 | static inline int sw_reset_pressed(void) |
| 319 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 320 | return !(in_be32((void *)GPIO0_IR) & GPIO_VAL(CONFIG_SYS_GPIO_SW_RESET)); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 321 | } |
| 322 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 323 | int do_chkreset(cmd_tbl_t* cmdtp, int flag, int argc, char * const argv[]) |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 324 | { |
| 325 | int delta; |
| 326 | int count = 0; |
| 327 | int post = 0; |
| 328 | int factory_reset = 0; |
| 329 | |
| 330 | if (!sw_reset_pressed()) { |
| 331 | printf("SW-Reset already high (Button released)\n"); |
| 332 | printf("-> No action taken!\n"); |
| 333 | return 0; |
| 334 | } |
| 335 | |
| 336 | printf("Waiting for SW-Reset button to be released."); |
| 337 | |
| 338 | while (1) { |
| 339 | delta = get_timer(start_time); |
| 340 | if (!sw_reset_pressed()) |
| 341 | break; |
| 342 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 343 | if ((delta > CONFIG_SYS_TIME_POST) && !post) { |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 344 | printf("\nWhen released now, POST tests will be started."); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 345 | gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 0); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 346 | post = 1; |
| 347 | } |
| 348 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 349 | if ((delta > CONFIG_SYS_TIME_FACTORY_RESET) && !factory_reset) { |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 350 | printf("\nWhen released now, factory default values" |
| 351 | " will be restored."); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 352 | gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 0); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 353 | factory_reset = 1; |
| 354 | } |
| 355 | |
| 356 | udelay(1000); |
| 357 | if (!(count++ % 1000)) |
| 358 | printf("."); |
| 359 | } |
| 360 | |
| 361 | |
| 362 | printf("\nSW-Reset Button released after %d milli-seconds!\n", delta); |
| 363 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 364 | if (delta > CONFIG_SYS_TIME_FACTORY_RESET) { |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 365 | printf("Starting factory reset value restoration...\n"); |
| 366 | |
| 367 | /* |
| 368 | * Restore default setting |
| 369 | */ |
| 370 | restore_default(); |
| 371 | |
| 372 | /* |
| 373 | * Reset the board for default to become valid |
| 374 | */ |
| 375 | do_reset(NULL, 0, 0, NULL); |
| 376 | |
| 377 | return 0; |
| 378 | } |
| 379 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 380 | if (delta > CONFIG_SYS_TIME_POST) { |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 381 | printf("Starting POST configuration...\n"); |
| 382 | |
| 383 | /* |
| 384 | * Enable POST upon next bootup |
| 385 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 386 | out_be32((void *)CONFIG_SYS_POST_MAGIC, REBOOT_MAGIC); |
| 387 | out_be32((void *)CONFIG_SYS_POST_VAL, REBOOT_DO_POST); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 388 | post_bootmode_init(); |
| 389 | |
| 390 | /* |
| 391 | * Reset the logbuffer for a clean start |
| 392 | */ |
| 393 | logbuff_reset(); |
| 394 | |
| 395 | do_reset(NULL, 0, 0, NULL); |
| 396 | |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | return 0; |
| 401 | } |
| 402 | |
| 403 | U_BOOT_CMD ( |
| 404 | chkreset, 1, 1, do_chkreset, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 405 | "Check for status of SW-reset button and act accordingly", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 406 | "" |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 407 | ); |
| 408 | |
| 409 | #if defined(CONFIG_POST) |
| 410 | /* |
| 411 | * Returns 1 if keys pressed to start the power-on long-running tests |
| 412 | * Called from board_init_f(). |
| 413 | */ |
| 414 | int post_hotkeys_pressed(void) |
| 415 | { |
| 416 | u32 post_magic; |
| 417 | u32 post_val; |
| 418 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 419 | post_magic = in_be32((void *)CONFIG_SYS_POST_MAGIC); |
| 420 | post_val = in_be32((void *)CONFIG_SYS_POST_VAL); |
Stefan Roese | a5d182e | 2007-08-14 14:44:41 +0200 | [diff] [blame] | 421 | |
| 422 | if ((post_magic == REBOOT_MAGIC) && (post_val == REBOOT_DO_POST)) |
| 423 | return 1; |
| 424 | else |
| 425 | return 0; |
| 426 | } |
| 427 | #endif /* CONFIG_POST */ |