xref: /openbmc/u-boot/board/spear/spear310/spear310.c (revision 9d69e33d)
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>
28080cfee7SVipin KUMAR #include <asm/arch/hardware.h>
29080cfee7SVipin KUMAR #include <asm/arch/spr_defs.h>
30080cfee7SVipin KUMAR #include <asm/arch/spr_misc.h>
31080cfee7SVipin KUMAR #include <asm/arch/spr_nand.h>
32080cfee7SVipin KUMAR 
33080cfee7SVipin KUMAR int board_init(void)
34080cfee7SVipin KUMAR {
35*9d69e33dSVipin Kumar 	return spear_board_init(MACH_TYPE_SPEAR310);
36080cfee7SVipin KUMAR }
37080cfee7SVipin KUMAR 
38080cfee7SVipin KUMAR /*
39080cfee7SVipin KUMAR  * board_nand_init - Board specific NAND initialization
40080cfee7SVipin KUMAR  * @nand:	mtd private chip structure
41080cfee7SVipin KUMAR  *
42080cfee7SVipin KUMAR  * Called by nand_init_chip to initialize the board specific functions
43080cfee7SVipin KUMAR  */
44080cfee7SVipin KUMAR 
45080cfee7SVipin KUMAR int board_nand_init(struct nand_chip *nand)
46080cfee7SVipin KUMAR {
47080cfee7SVipin KUMAR 	struct misc_regs *const misc_regs_p =
48080cfee7SVipin KUMAR 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
49080cfee7SVipin KUMAR 
50080cfee7SVipin KUMAR 	if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
51080cfee7SVipin KUMAR 	     MISC_SOCCFG30) ||
52080cfee7SVipin KUMAR 	    ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
53080cfee7SVipin KUMAR 	     MISC_SOCCFG31)) {
54080cfee7SVipin KUMAR 
55080cfee7SVipin KUMAR 		return spear_nand_init(nand);
56080cfee7SVipin KUMAR 	}
57080cfee7SVipin KUMAR 
58080cfee7SVipin KUMAR 	return -1;
59080cfee7SVipin KUMAR }
60