xref: /openbmc/u-boot/board/spear/spear310/spear310.c (revision 1fa943b9)
1080cfee7SVipin KUMAR /*
2080cfee7SVipin KUMAR  * (C) Copyright 2009
3080cfee7SVipin KUMAR  * Ryan Chen, ST Micoelectronics, ryan.chen@st.com.
4080cfee7SVipin KUMAR  * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
5080cfee7SVipin KUMAR  *
6080cfee7SVipin KUMAR  * See file CREDITS for list of people who contributed to this
7080cfee7SVipin KUMAR  * project.
8080cfee7SVipin KUMAR  *
9080cfee7SVipin KUMAR  * This program is free software; you can redistribute it and/or
10080cfee7SVipin KUMAR  * modify it under the terms of the GNU General Public License as
11080cfee7SVipin KUMAR  * published by the Free Software Foundation; either version 2 of
12080cfee7SVipin KUMAR  * the License, or (at your option) any later version.
13080cfee7SVipin KUMAR  *
14080cfee7SVipin KUMAR  * This program is distributed in the hope that it will be useful,
15080cfee7SVipin KUMAR  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16080cfee7SVipin KUMAR  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17080cfee7SVipin KUMAR  * GNU General Public License for more details.
18080cfee7SVipin KUMAR  *
19080cfee7SVipin KUMAR  * You should have received a copy of the GNU General Public License
20080cfee7SVipin KUMAR  * along with this program; if not, write to the Free Software
21080cfee7SVipin KUMAR  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22080cfee7SVipin KUMAR  * MA 02111-1307 USA
23080cfee7SVipin KUMAR  */
24080cfee7SVipin KUMAR 
25080cfee7SVipin KUMAR #include <common.h>
26080cfee7SVipin KUMAR #include <nand.h>
27080cfee7SVipin KUMAR #include <asm/io.h>
28*1fa943b9SVipin KUMAR #include <linux/mtd/fsmc_nand.h>
29080cfee7SVipin KUMAR #include <asm/arch/hardware.h>
30080cfee7SVipin KUMAR #include <asm/arch/spr_defs.h>
31080cfee7SVipin KUMAR #include <asm/arch/spr_misc.h>
32*1fa943b9SVipin KUMAR 
33*1fa943b9SVipin KUMAR static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
34080cfee7SVipin KUMAR 
35080cfee7SVipin KUMAR int board_init(void)
36080cfee7SVipin KUMAR {
379d69e33dSVipin Kumar 	return spear_board_init(MACH_TYPE_SPEAR310);
38080cfee7SVipin KUMAR }
39080cfee7SVipin KUMAR 
40080cfee7SVipin KUMAR /*
41080cfee7SVipin KUMAR  * board_nand_init - Board specific NAND initialization
42080cfee7SVipin KUMAR  * @nand:	mtd private chip structure
43080cfee7SVipin KUMAR  *
44080cfee7SVipin KUMAR  * Called by nand_init_chip to initialize the board specific functions
45080cfee7SVipin KUMAR  */
46080cfee7SVipin KUMAR 
47*1fa943b9SVipin KUMAR void board_nand_init()
48080cfee7SVipin KUMAR {
49080cfee7SVipin KUMAR 	struct misc_regs *const misc_regs_p =
50080cfee7SVipin KUMAR 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
51*1fa943b9SVipin KUMAR 	struct nand_chip *nand = &nand_chip[0];
52080cfee7SVipin KUMAR 
53*1fa943b9SVipin KUMAR #if defined(CONFIG_NAND_FSMC)
54080cfee7SVipin KUMAR 	if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
55080cfee7SVipin KUMAR 	     MISC_SOCCFG30) ||
56080cfee7SVipin KUMAR 	    ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
57080cfee7SVipin KUMAR 	     MISC_SOCCFG31)) {
58080cfee7SVipin KUMAR 
59*1fa943b9SVipin KUMAR 		fsmc_nand_init(nand);
60080cfee7SVipin KUMAR 	}
61*1fa943b9SVipin KUMAR #endif
62*1fa943b9SVipin KUMAR 	return;
63080cfee7SVipin KUMAR }
64