blob: 2899e1117dd9874b824d8cba7080f6f9acb77e20 [file] [log] [blame]
John Schmollerd9c2dd52010-10-22 00:20:24 -05001/*
2 * Copyright 2008 Extreme Engineering Solutions, Inc.
3 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +02004 * SPDX-License-Identifier: GPL-2.0+
John Schmollerd9c2dd52010-10-22 00:20:24 -05005 */
6
7#include <common.h>
8#include <asm/mmu.h>
John Schmoller876e9912010-10-22 00:20:25 -05009#ifdef CONFIG_PCA953X
10#include <pca953x.h>
11
12/*
13 * Determine if a board's flashes are write protected
14 */
15int 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 Schmollerd9c2dd52010-10-22 00:20:24 -050024
25/*
26 * Return a board's derivative model number. For example:
27 * return 2 for the XPedite5372 and return 1 for the XPedite5201.
28 */
29uint 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 Denk1136f692010-10-27 22:48:30 +020039 * 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 Schmollerd9c2dd52010-10-22 00:20:24 -050043 return gur->gpporcr >> 28;
44}