1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 292af6549SJohn Schmoller /* 392af6549SJohn Schmoller * Copyright 2008 Extreme Engineering Solutions, Inc. 492af6549SJohn Schmoller */ 592af6549SJohn Schmoller 692af6549SJohn Schmoller #include <common.h> 792af6549SJohn Schmoller #include <asm/mmu.h> 872fb68d5SJohn Schmoller #ifdef CONFIG_PCA953X 972fb68d5SJohn Schmoller #include <pca953x.h> 1072fb68d5SJohn Schmoller 1172fb68d5SJohn Schmoller /* 1272fb68d5SJohn Schmoller * Determine if a board's flashes are write protected 1372fb68d5SJohn Schmoller */ board_flash_wp_on(void)1472fb68d5SJohn Schmollerint board_flash_wp_on(void) 1572fb68d5SJohn Schmoller { 1672fb68d5SJohn Schmoller if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) & 1772fb68d5SJohn Schmoller CONFIG_SYS_PCA953X_NVM_WP) 1872fb68d5SJohn Schmoller return 1; 1972fb68d5SJohn Schmoller 2072fb68d5SJohn Schmoller return 0; 2172fb68d5SJohn Schmoller } 2272fb68d5SJohn Schmoller #endif 2392af6549SJohn Schmoller 2492af6549SJohn Schmoller /* 2592af6549SJohn Schmoller * Return a board's derivative model number. For example: 2692af6549SJohn Schmoller * return 2 for the XPedite5372 and return 1 for the XPedite5201. 2792af6549SJohn Schmoller */ get_board_derivative(void)2892af6549SJohn Schmolleruint get_board_derivative(void) 2992af6549SJohn Schmoller { 3092af6549SJohn Schmoller #if defined(CONFIG_MPC85xx) 3192af6549SJohn Schmoller volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; 3292af6549SJohn Schmoller #elif defined(CONFIG_MPC86xx) 3392af6549SJohn Schmoller volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR; 3492af6549SJohn Schmoller volatile ccsr_gur_t *gur = &immap->im_gur; 3592af6549SJohn Schmoller #endif 3692af6549SJohn Schmoller 3792af6549SJohn Schmoller /* 3892af6549SJohn Schmoller * The top 4 lines of the local bus address are pulled low/high and 3992af6549SJohn Schmoller * can be read to determine the least significant digit of a board's 4092af6549SJohn Schmoller * model number. 4192af6549SJohn Schmoller */ 4292af6549SJohn Schmoller return gur->gpporcr >> 28; 4392af6549SJohn Schmoller } 44