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