blob: 091c9a59a52b66bbe63b044cc34b20fcd52c187f [file] [log] [blame]
Fabio Estevam2ef69ef2023-01-10 17:18:08 -03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 NXP
4 */
5
Fabio Estevam2ef69ef2023-01-10 17:18:08 -03006#include <env.h>
7#include <init.h>
8#include <miiphy.h>
9#include <netdev.h>
10#include <asm/global_data.h>
11
12#include <asm/arch/clock.h>
13#include <asm/arch/sys_proto.h>
14#include <asm/io.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18static int setup_fec(void)
19{
20 struct iomuxc_gpr_base_regs *gpr =
21 (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
22
23 /* Use 125MHz anatop REF_CLK1 for ENET1, not from external */
24 clrsetbits_le32(&gpr->gpr[1], 0x2000, 0);
25
26 return 0;
27}
28
29int board_init(void)
30{
31 setup_fec();
32
33 return 0;
34}
35
36int board_late_init(void)
37{
38 if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) {
39 env_set("board_name", "PHG");
40 env_set("board_rev", "iMX8MM");
41 }
42
43 if (is_usb_boot()) {
44 env_set("bootcmd", "ums 0 mmc 0");
45 env_set("bootdelay", "0");
46 }
47
48 return 0;
49}