1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (C) 2019-2020 PHYTEC Messtechnik GmbH 4 * Author: Teresa Remmet <t.remmet@phytec.de> 5 */ 6 7#include <common.h> 8#include <asm/arch/sys_proto.h> 9#include <asm/global_data.h> 10#include <asm/io.h> 11#include <asm/mach-imx/boot_mode.h> 12#include <env.h> 13#include <miiphy.h> 14 15DECLARE_GLOBAL_DATA_PTR; 16 17static int setup_fec(void) 18{ 19 struct iomuxc_gpr_base_regs *gpr = 20 (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; 21 22 /* Use 125M anatop REF_CLK1 for ENET1, not from external */ 23 clrsetbits_le32(&gpr->gpr[1], 0x2000, 0); 24 25 return 0; 26} 27 28int board_init(void) 29{ 30 setup_fec(); 31 32 return 0; 33} 34 35int board_mmc_get_env_dev(int devno) 36{ 37 return devno; 38} 39 40int board_late_init(void) 41{ 42 switch (get_boot_device()) { 43 case SD2_BOOT: 44 env_set_ulong("mmcdev", 1); 45 break; 46 case MMC3_BOOT: 47 env_set_ulong("mmcdev", 2); 48 break; 49 default: 50 break; 51 } 52 53 return 0; 54} 55