xref: /openbmc/u-boot/board/spear/spear600/spear600.c (revision 1fa943b9)
1566c9c16SVipin KUMAR /*
2566c9c16SVipin KUMAR  * (C) Copyright 2009
3566c9c16SVipin KUMAR  * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
4566c9c16SVipin KUMAR  *
5566c9c16SVipin KUMAR  * See file CREDITS for list of people who contributed to this
6566c9c16SVipin KUMAR  * project.
7566c9c16SVipin KUMAR  *
8566c9c16SVipin KUMAR  * This program is free software; you can redistribute it and/or
9566c9c16SVipin KUMAR  * modify it under the terms of the GNU General Public License as
10566c9c16SVipin KUMAR  * published by the Free Software Foundation; either version 2 of
11566c9c16SVipin KUMAR  * the License, or (at your option) any later version.
12566c9c16SVipin KUMAR  *
13566c9c16SVipin KUMAR  * This program is distributed in the hope that it will be useful,
14566c9c16SVipin KUMAR  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15566c9c16SVipin KUMAR  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16566c9c16SVipin KUMAR  * GNU General Public License for more details.
17566c9c16SVipin KUMAR  *
18566c9c16SVipin KUMAR  * You should have received a copy of the GNU General Public License
19566c9c16SVipin KUMAR  * along with this program; if not, write to the Free Software
20566c9c16SVipin KUMAR  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21566c9c16SVipin KUMAR  * MA 02111-1307 USA
22566c9c16SVipin KUMAR  */
23566c9c16SVipin KUMAR 
24566c9c16SVipin KUMAR #include <common.h>
25566c9c16SVipin KUMAR #include <nand.h>
26566c9c16SVipin KUMAR #include <asm/io.h>
27*1fa943b9SVipin KUMAR #include <linux/mtd/fsmc_nand.h>
28566c9c16SVipin KUMAR #include <asm/arch/hardware.h>
29566c9c16SVipin KUMAR #include <asm/arch/spr_defs.h>
30566c9c16SVipin KUMAR #include <asm/arch/spr_misc.h>
31*1fa943b9SVipin KUMAR 
32*1fa943b9SVipin KUMAR static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
33566c9c16SVipin KUMAR 
34566c9c16SVipin KUMAR int board_init(void)
35566c9c16SVipin KUMAR {
36566c9c16SVipin KUMAR 	return spear_board_init(MACH_TYPE_SPEAR600);
37566c9c16SVipin KUMAR }
38566c9c16SVipin KUMAR 
39566c9c16SVipin KUMAR /*
40566c9c16SVipin KUMAR  * board_nand_init - Board specific NAND initialization
41566c9c16SVipin KUMAR  * @nand:	mtd private chip structure
42566c9c16SVipin KUMAR  *
43566c9c16SVipin KUMAR  * Called by nand_init_chip to initialize the board specific functions
44566c9c16SVipin KUMAR  */
45566c9c16SVipin KUMAR 
46*1fa943b9SVipin KUMAR void board_nand_init()
47566c9c16SVipin KUMAR {
48566c9c16SVipin KUMAR 	struct misc_regs *const misc_regs_p =
49566c9c16SVipin KUMAR 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
50*1fa943b9SVipin KUMAR 	struct nand_chip *nand = &nand_chip[0];
51566c9c16SVipin KUMAR 
52*1fa943b9SVipin KUMAR #if defined(CONFIG_NAND_FSMC)
53566c9c16SVipin KUMAR 	if (!(readl(&misc_regs_p->auto_cfg_reg) & MISC_NANDDIS))
54*1fa943b9SVipin KUMAR 		fsmc_nand_init(nand);
55*1fa943b9SVipin KUMAR #endif
56*1fa943b9SVipin KUMAR 	return;
57566c9c16SVipin KUMAR }
58