1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2080cfee7SVipin KUMAR /*
3080cfee7SVipin KUMAR * (C) Copyright 2009
4080cfee7SVipin KUMAR * Ryan Chen, ST Micoelectronics, ryan.chen@st.com.
5080cfee7SVipin KUMAR * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
6080cfee7SVipin KUMAR */
7080cfee7SVipin KUMAR
8080cfee7SVipin KUMAR #include <common.h>
99afc1af0SVipin Kumar #include <miiphy.h>
10deb00562SVipin KUMAR #include <netdev.h>
11080cfee7SVipin KUMAR #include <nand.h>
12080cfee7SVipin KUMAR #include <asm/io.h>
131fa943b9SVipin KUMAR #include <linux/mtd/fsmc_nand.h>
14c62db35dSSimon Glass #include <asm/mach-types.h>
15080cfee7SVipin KUMAR #include <asm/arch/hardware.h>
16080cfee7SVipin KUMAR #include <asm/arch/spr_defs.h>
17080cfee7SVipin KUMAR #include <asm/arch/spr_misc.h>
181fa943b9SVipin KUMAR
191fa943b9SVipin KUMAR static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
20080cfee7SVipin KUMAR
board_init(void)21080cfee7SVipin KUMAR int board_init(void)
22080cfee7SVipin KUMAR {
239d69e33dSVipin Kumar return spear_board_init(MACH_TYPE_SPEAR310);
24080cfee7SVipin KUMAR }
25080cfee7SVipin KUMAR
26080cfee7SVipin KUMAR /*
27080cfee7SVipin KUMAR * board_nand_init - Board specific NAND initialization
28080cfee7SVipin KUMAR * @nand: mtd private chip structure
29080cfee7SVipin KUMAR *
30080cfee7SVipin KUMAR * Called by nand_init_chip to initialize the board specific functions
31080cfee7SVipin KUMAR */
32080cfee7SVipin KUMAR
board_nand_init()331fa943b9SVipin KUMAR void board_nand_init()
34080cfee7SVipin KUMAR {
35080cfee7SVipin KUMAR struct misc_regs *const misc_regs_p =
36080cfee7SVipin KUMAR (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
371fa943b9SVipin KUMAR struct nand_chip *nand = &nand_chip[0];
38080cfee7SVipin KUMAR
391fa943b9SVipin KUMAR #if defined(CONFIG_NAND_FSMC)
40080cfee7SVipin KUMAR if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
41080cfee7SVipin KUMAR MISC_SOCCFG30) ||
42080cfee7SVipin KUMAR ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
43080cfee7SVipin KUMAR MISC_SOCCFG31)) {
44080cfee7SVipin KUMAR
451fa943b9SVipin KUMAR fsmc_nand_init(nand);
46080cfee7SVipin KUMAR }
471fa943b9SVipin KUMAR #endif
481fa943b9SVipin KUMAR return;
49080cfee7SVipin KUMAR }
50deb00562SVipin KUMAR
board_eth_init(bd_t * bis)51deb00562SVipin KUMAR int board_eth_init(bd_t *bis)
52deb00562SVipin KUMAR {
538eb0ee6aSVipin KUMAR int ret = 0;
548eb0ee6aSVipin KUMAR
55ef48f6ddSSimon Glass #if defined(CONFIG_ETH_DESIGNWARE)
569afc1af0SVipin Kumar u32 interface = PHY_INTERFACE_MODE_MII;
5792a190aaSAlexey Brodkin if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
589afc1af0SVipin Kumar ret++;
59deb00562SVipin KUMAR #endif
608eb0ee6aSVipin KUMAR #if defined(CONFIG_MACB)
618eb0ee6aSVipin KUMAR if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
629afc1af0SVipin Kumar CONFIG_MACB0_PHY) >= 0)
639afc1af0SVipin Kumar ret++;
648eb0ee6aSVipin KUMAR
658eb0ee6aSVipin KUMAR if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE,
669afc1af0SVipin Kumar CONFIG_MACB1_PHY) >= 0)
679afc1af0SVipin Kumar ret++;
688eb0ee6aSVipin KUMAR
698eb0ee6aSVipin KUMAR if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE,
709afc1af0SVipin Kumar CONFIG_MACB2_PHY) >= 0)
719afc1af0SVipin Kumar ret++;
728eb0ee6aSVipin KUMAR
738eb0ee6aSVipin KUMAR if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE,
749afc1af0SVipin Kumar CONFIG_MACB3_PHY) >= 0)
759afc1af0SVipin Kumar ret++;
768eb0ee6aSVipin KUMAR #endif
778eb0ee6aSVipin KUMAR return ret;
78deb00562SVipin KUMAR }
79