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