xref: /rk3399_rockchip-uboot/board/spear/spear310/spear310.c (revision deb005622782bf568a4daa8daeb8adf95b606492)
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>
26*deb00562SVipin KUMAR #include <netdev.h>
27080cfee7SVipin KUMAR #include <nand.h>
28080cfee7SVipin KUMAR #include <asm/io.h>
291fa943b9SVipin KUMAR #include <linux/mtd/fsmc_nand.h>
30080cfee7SVipin KUMAR #include <asm/arch/hardware.h>
31080cfee7SVipin KUMAR #include <asm/arch/spr_defs.h>
32080cfee7SVipin KUMAR #include <asm/arch/spr_misc.h>
331fa943b9SVipin KUMAR 
341fa943b9SVipin KUMAR static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
35080cfee7SVipin KUMAR 
36080cfee7SVipin KUMAR int board_init(void)
37080cfee7SVipin KUMAR {
389d69e33dSVipin Kumar 	return spear_board_init(MACH_TYPE_SPEAR310);
39080cfee7SVipin KUMAR }
40080cfee7SVipin KUMAR 
41080cfee7SVipin KUMAR /*
42080cfee7SVipin KUMAR  * board_nand_init - Board specific NAND initialization
43080cfee7SVipin KUMAR  * @nand:	mtd private chip structure
44080cfee7SVipin KUMAR  *
45080cfee7SVipin KUMAR  * Called by nand_init_chip to initialize the board specific functions
46080cfee7SVipin KUMAR  */
47080cfee7SVipin KUMAR 
481fa943b9SVipin KUMAR void board_nand_init()
49080cfee7SVipin KUMAR {
50080cfee7SVipin KUMAR 	struct misc_regs *const misc_regs_p =
51080cfee7SVipin KUMAR 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
521fa943b9SVipin KUMAR 	struct nand_chip *nand = &nand_chip[0];
53080cfee7SVipin KUMAR 
541fa943b9SVipin KUMAR #if defined(CONFIG_NAND_FSMC)
55080cfee7SVipin KUMAR 	if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
56080cfee7SVipin KUMAR 	     MISC_SOCCFG30) ||
57080cfee7SVipin KUMAR 	    ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
58080cfee7SVipin KUMAR 	     MISC_SOCCFG31)) {
59080cfee7SVipin KUMAR 
601fa943b9SVipin KUMAR 		fsmc_nand_init(nand);
61080cfee7SVipin KUMAR 	}
621fa943b9SVipin KUMAR #endif
631fa943b9SVipin KUMAR 	return;
64080cfee7SVipin KUMAR }
65*deb00562SVipin KUMAR 
66*deb00562SVipin KUMAR int board_eth_init(bd_t *bis)
67*deb00562SVipin KUMAR {
68*deb00562SVipin KUMAR #if defined(CONFIG_DESIGNWARE_ETH)
69*deb00562SVipin KUMAR 	return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
70*deb00562SVipin KUMAR #else
71*deb00562SVipin KUMAR 	return -1;
72*deb00562SVipin KUMAR #endif
73*deb00562SVipin KUMAR }
74