1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016 Engicam S.r.l.
4  * Copyright (C) 2022 Amarula Solutions(India)
5  *
6  * Authors:
7  * Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
8  * Jagan Teki <jagan@amarulasolutions.com>
9  */
10 
11 #include <env.h>
12 #include <errno.h>
13 #include <init.h>
14 #include <miiphy.h>
15 #include <netdev.h>
16 #include <linux/delay.h>
17 #include <asm/global_data.h>
18 #include <asm/mach-imx/iomux-v3.h>
19 #include <asm-generic/gpio.h>
20 #include <asm/arch/imx8mp_pins.h>
21 #include <asm/arch/clock.h>
22 #include <asm/arch/sys_proto.h>
23 #include <asm/mach-imx/gpio.h>
24 
25 DECLARE_GLOBAL_DATA_PTR;
26 
setup_fec(void)27 static void setup_fec(void)
28 {
29 	struct iomuxc_gpr_base_regs *gpr =
30 		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
31 
32 	/* Enable RGMII TX clk output */
33 	setbits_le32(&gpr->gpr[1], BIT(22));
34 }
35 
36 #if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)
board_phy_config(struct phy_device * phydev)37 int board_phy_config(struct phy_device *phydev)
38 {
39 	if (phydev->drv->config)
40 		phydev->drv->config(phydev);
41 	return 0;
42 }
43 #endif
44 
board_init(void)45 int board_init(void)
46 {
47 	if (IS_ENABLED(CONFIG_FEC_MXC))
48 		setup_fec();
49 
50 	return 0;
51 }
52 
board_late_init(void)53 int board_late_init(void)
54 {
55 	return 0;
56 }
57