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/io.h> 10#include <asm/mach-imx/boot_mode.h> 11#include <env.h> 12#include <miiphy.h> 13 14DECLARE_GLOBAL_DATA_PTR; 15 16static int setup_fec(void) 17{ 18 struct iomuxc_gpr_base_regs *gpr = 19 (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; 20 21 /* Use 125M anatop REF_CLK1 for ENET1, not from external */ 22 clrsetbits_le32(&gpr->gpr[1], 0x2000, 0); 23 24 return 0; 25} 26 27int board_init(void) 28{ 29 setup_fec(); 30 31 return 0; 32} 33 34int board_mmc_get_env_dev(int devno) 35{ 36 return devno; 37} 38 39int board_late_init(void) 40{ 41 switch (get_boot_device()) { 42 case SD2_BOOT: 43 env_set_ulong("mmcdev", 1); 44 break; 45 case MMC3_BOOT: 46 env_set_ulong("mmcdev", 2); 47 break; 48 default: 49 break; 50 } 51 52 return 0; 53} 54