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