]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/xes/common/fsl_8xxx_misc.c
dfd6946b5f3d4d45228ba368317e23b803716d0e
[karo-tx-uboot.git] / board / xes / common / fsl_8xxx_misc.c
1 /*
2  * Copyright 2008 Extreme Engineering Solutions, Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+ 
5  */
6
7 #include <common.h>
8 #include <asm/mmu.h>
9 #ifdef CONFIG_PCA953X
10 #include <pca953x.h>
11
12 /*
13  * Determine if a board's flashes are write protected
14  */
15 int 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
24
25 /*
26  * Return a board's derivative model number.  For example:
27  * return 2 for the XPedite5372 and return 1 for the XPedite5201.
28  */
29 uint 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        /*
39         * 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         */
43        return gur->gpporcr >> 28;
44 }