blob: b26810338f8faac5ad82d2ef5825cc28e0809b1f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
John Schmollerd9c2dd52010-10-22 00:20:24 -05002/*
3 * Copyright 2008 Extreme Engineering Solutions, Inc.
John Schmollerd9c2dd52010-10-22 00:20:24 -05004 */
5
6#include <common.h>
7#include <asm/mmu.h>
John Schmoller876e9912010-10-22 00:20:25 -05008#ifdef CONFIG_PCA953X
9#include <pca953x.h>
10
11/*
12 * Determine if a board's flashes are write protected
13 */
14int board_flash_wp_on(void)
15{
16 if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
17 CONFIG_SYS_PCA953X_NVM_WP)
18 return 1;
19
20 return 0;
21}
22#endif
John Schmollerd9c2dd52010-10-22 00:20:24 -050023
24/*
25 * Return a board's derivative model number. For example:
26 * return 2 for the XPedite5372 and return 1 for the XPedite5201.
27 */
28uint get_board_derivative(void)
29{
30#if defined(CONFIG_MPC85xx)
31 volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
32#elif defined(CONFIG_MPC86xx)
33 volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR;
34 volatile ccsr_gur_t *gur = &immap->im_gur;
35#endif
36
37 /*
Wolfgang Denk1136f692010-10-27 22:48:30 +020038 * 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 Schmollerd9c2dd52010-10-22 00:20:24 -050042 return gur->gpporcr >> 28;
43}