John Schmoller | 92af6549 | 2010-10-22 00:20:24 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Extreme Engineering Solutions, Inc. |
| 3 | * |
Wolfgang Denk | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
John Schmoller | 92af6549 | 2010-10-22 00:20:24 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <asm/mmu.h> |
John Schmoller | 72fb68d | 2010-10-22 00:20:25 -0500 | [diff] [blame] | 9 | #ifdef CONFIG_PCA953X |
| 10 | #include <pca953x.h> |
| 11 | |
| 12 | /* |
| 13 | * Determine if a board's flashes are write protected |
| 14 | */ |
| 15 | int board_flash_wp_on(void) |
| 16 | { |
| 17 | if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) & |
| 18 | CONFIG_SYS_PCA953X_NVM_WP) |
| 19 | return 1; |
| 20 | |
| 21 | return 0; |
| 22 | } |
| 23 | #endif |
John Schmoller | 92af6549 | 2010-10-22 00:20:24 -0500 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * Return a board's derivative model number. For example: |
| 27 | * return 2 for the XPedite5372 and return 1 for the XPedite5201. |
| 28 | */ |
| 29 | uint get_board_derivative(void) |
| 30 | { |
| 31 | #if defined(CONFIG_MPC85xx) |
| 32 | volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; |
| 33 | #elif defined(CONFIG_MPC86xx) |
| 34 | volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR; |
| 35 | volatile ccsr_gur_t *gur = &immap->im_gur; |
| 36 | #endif |
| 37 | |
| 38 | /* |
Wolfgang Denk | 071bc92 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 39 | * The top 4 lines of the local bus address are pulled low/high and |
| 40 | * can be read to determine the least significant digit of a board's |
| 41 | * model number. |
| 42 | */ |
John Schmoller | 92af6549 | 2010-10-22 00:20:24 -0500 | [diff] [blame] | 43 | return gur->gpporcr >> 28; |
| 44 | } |