// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2016 Amarula Solutions B.V. * Copyright (C) 2016 Engicam S.r.l. * Author: Jagan Teki */ #include #include #include #include #include #include #include #include #include #include #include DECLARE_GLOBAL_DATA_PTR; #if IS_ENABLED(CONFIG_FEC_MXC) #define FEC_RST_PAD IMX_GPIO_NR(3, 7) static iomux_v3_cfg_t const fec1_rst_pads[] = { IMX8MM_PAD_NAND_DATA01_GPIO3_IO7 | MUX_PAD_CTRL(NO_PAD_CTRL), }; static void setup_fec(void) { imx_iomux_v3_setup_multiple_pads(fec1_rst_pads, ARRAY_SIZE(fec1_rst_pads)); gpio_request(FEC_RST_PAD, "fec1_rst"); gpio_direction_output(FEC_RST_PAD, 0); udelay(500); gpio_direction_output(FEC_RST_PAD, 1); } int board_phy_config(struct phy_device *phydev) { /* enable rgmii rxc skew and phy mode select to RGMII copper */ phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8); phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee); phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); if (phydev->drv->config) phydev->drv->config(phydev); return 0; } #endif int board_init(void) { if (IS_ENABLED(CONFIG_FEC_MXC)) setup_fec(); return 0; } int board_mmc_get_env_dev(int devno) { return devno; }