xref: /openbmc/u-boot/board/spear/spear310/spear310.c (revision 080cfee7)
1*080cfee7SVipin KUMAR /*
2*080cfee7SVipin KUMAR  * (C) Copyright 2009
3*080cfee7SVipin KUMAR  * Ryan Chen, ST Micoelectronics, ryan.chen@st.com.
4*080cfee7SVipin KUMAR  * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
5*080cfee7SVipin KUMAR  *
6*080cfee7SVipin KUMAR  * See file CREDITS for list of people who contributed to this
7*080cfee7SVipin KUMAR  * project.
8*080cfee7SVipin KUMAR  *
9*080cfee7SVipin KUMAR  * This program is free software; you can redistribute it and/or
10*080cfee7SVipin KUMAR  * modify it under the terms of the GNU General Public License as
11*080cfee7SVipin KUMAR  * published by the Free Software Foundation; either version 2 of
12*080cfee7SVipin KUMAR  * the License, or (at your option) any later version.
13*080cfee7SVipin KUMAR  *
14*080cfee7SVipin KUMAR  * This program is distributed in the hope that it will be useful,
15*080cfee7SVipin KUMAR  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*080cfee7SVipin KUMAR  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*080cfee7SVipin KUMAR  * GNU General Public License for more details.
18*080cfee7SVipin KUMAR  *
19*080cfee7SVipin KUMAR  * You should have received a copy of the GNU General Public License
20*080cfee7SVipin KUMAR  * along with this program; if not, write to the Free Software
21*080cfee7SVipin KUMAR  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22*080cfee7SVipin KUMAR  * MA 02111-1307 USA
23*080cfee7SVipin KUMAR  */
24*080cfee7SVipin KUMAR 
25*080cfee7SVipin KUMAR #include <common.h>
26*080cfee7SVipin KUMAR #include <nand.h>
27*080cfee7SVipin KUMAR #include <asm/io.h>
28*080cfee7SVipin KUMAR #include <asm/arch/hardware.h>
29*080cfee7SVipin KUMAR #include <asm/arch/spr_defs.h>
30*080cfee7SVipin KUMAR #include <asm/arch/spr_misc.h>
31*080cfee7SVipin KUMAR #include <asm/arch/spr_nand.h>
32*080cfee7SVipin KUMAR 
33*080cfee7SVipin KUMAR int board_init(void)
34*080cfee7SVipin KUMAR {
35*080cfee7SVipin KUMAR 	return spear_board_init(MACH_TYPE_SPEAR300);
36*080cfee7SVipin KUMAR }
37*080cfee7SVipin KUMAR 
38*080cfee7SVipin KUMAR /*
39*080cfee7SVipin KUMAR  * board_nand_init - Board specific NAND initialization
40*080cfee7SVipin KUMAR  * @nand:	mtd private chip structure
41*080cfee7SVipin KUMAR  *
42*080cfee7SVipin KUMAR  * Called by nand_init_chip to initialize the board specific functions
43*080cfee7SVipin KUMAR  */
44*080cfee7SVipin KUMAR 
45*080cfee7SVipin KUMAR int board_nand_init(struct nand_chip *nand)
46*080cfee7SVipin KUMAR {
47*080cfee7SVipin KUMAR 	struct misc_regs *const misc_regs_p =
48*080cfee7SVipin KUMAR 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
49*080cfee7SVipin KUMAR 
50*080cfee7SVipin KUMAR 	if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
51*080cfee7SVipin KUMAR 	     MISC_SOCCFG30) ||
52*080cfee7SVipin KUMAR 	    ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
53*080cfee7SVipin KUMAR 	     MISC_SOCCFG31)) {
54*080cfee7SVipin KUMAR 
55*080cfee7SVipin KUMAR 		return spear_nand_init(nand);
56*080cfee7SVipin KUMAR 	}
57*080cfee7SVipin KUMAR 
58*080cfee7SVipin KUMAR 	return -1;
59*080cfee7SVipin KUMAR }
60