1*92af6549SJohn Schmoller /*
2*92af6549SJohn Schmoller  * Copyright 2008 Extreme Engineering Solutions, Inc.
3*92af6549SJohn Schmoller  *
4*92af6549SJohn Schmoller  * See file CREDITS for list of people who contributed to this
5*92af6549SJohn Schmoller  * project.
6*92af6549SJohn Schmoller  *
7*92af6549SJohn Schmoller  * This program is free software; you can redistribute it and/or
8*92af6549SJohn Schmoller  * modify it under the terms of the GNU General Public License as
9*92af6549SJohn Schmoller  * published by the Free Software Foundation; either version 2 of
10*92af6549SJohn Schmoller  * the License, or (at your option) any later version.
11*92af6549SJohn Schmoller  *
12*92af6549SJohn Schmoller  * This program is distributed in the hope that it will be useful,
13*92af6549SJohn Schmoller  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14*92af6549SJohn Schmoller  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
15*92af6549SJohn Schmoller  * GNU General Public License for more details.
16*92af6549SJohn Schmoller  *
17*92af6549SJohn Schmoller  * You should have received a copy of the GNU General Public License
18*92af6549SJohn Schmoller  * along with this program; if not, write to the Free Software
19*92af6549SJohn Schmoller  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20*92af6549SJohn Schmoller  * MA 02111-1307 USA
21*92af6549SJohn Schmoller  */
22*92af6549SJohn Schmoller 
23*92af6549SJohn Schmoller #include <common.h>
24*92af6549SJohn Schmoller #include <asm/mmu.h>
25*92af6549SJohn Schmoller 
26*92af6549SJohn Schmoller /*
27*92af6549SJohn Schmoller  * Return a board's derivative model number.  For example:
28*92af6549SJohn Schmoller  * return 2 for the XPedite5372 and return 1 for the XPedite5201.
29*92af6549SJohn Schmoller  */
30*92af6549SJohn Schmoller uint get_board_derivative(void)
31*92af6549SJohn Schmoller {
32*92af6549SJohn Schmoller #if defined(CONFIG_MPC85xx)
33*92af6549SJohn Schmoller        volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
34*92af6549SJohn Schmoller #elif defined(CONFIG_MPC86xx)
35*92af6549SJohn Schmoller        volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR;
36*92af6549SJohn Schmoller        volatile ccsr_gur_t *gur = &immap->im_gur;
37*92af6549SJohn Schmoller #endif
38*92af6549SJohn Schmoller 
39*92af6549SJohn Schmoller        /*
40*92af6549SJohn Schmoller         * The top 4 lines of the local bus address are pulled low/high and
41*92af6549SJohn Schmoller         * can be read to determine the least significant digit of a board's
42*92af6549SJohn Schmoller         * model number.
43*92af6549SJohn Schmoller         */
44*92af6549SJohn Schmoller        return gur->gpporcr >> 28;
45*92af6549SJohn Schmoller }
46*92af6549SJohn Schmoller 
47*92af6549SJohn Schmoller 
48