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