From patchwork Wed Apr 15 14:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Seiler X-Patchwork-Id: 237800 List-Id: U-Boot discussion From: hws at denx.de (Harald Seiler) Date: Wed, 15 Apr 2020 16:01:37 +0200 Subject: [PATCH] ARM: imx6: DHCOM i.MX6 PDK: Convert to DM_ETH Message-ID: <20200415140137.252222-1-hws@denx.de> Use DM_ETH instead of legacy networking. Signed-off-by: Harald Seiler --- Notes: I am unsure whether I converted 'enough' of the board_eth_init() function to DM. I think the reset GPIO in particular could be handled by the DM driver if I add the following to the device-tree (did not try it yet): phy-reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; phy-reset-duration = <1>; phy-reset-post-delay = <10>; Is it preferred to change the device-tree here or should I keep the reset from board_init() like I have it now? If I should use the dt, is there a similar way for dealing with VIO? board/dhelectronics/dh_imx6/dh_imx6.c | 26 +++++--------------------- configs/dh_imx6_defconfig | 2 ++ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c index 33ce7e8ff115..aafb9f1b341f 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6.c +++ b/board/dhelectronics/dh_imx6/dh_imx6.c @@ -28,10 +28,7 @@ #include #include #include -#include #include -#include -#include #include #include @@ -80,31 +77,14 @@ static int setup_fec_clock(void) return enable_fec_anatop_clock(0, ENET_50MHZ); } -int board_eth_init(bd_t *bis) +static void setup_fec(void) { - uint32_t base = IMX_FEC_BASE; - struct mii_dev *bus = NULL; - struct phy_device *phydev = NULL; - gpio_request(IMX_GPIO_NR(5, 0), "PHY-reset"); gpio_request(IMX_GPIO_NR(1, 7), "VIO"); setup_fec_clock(); eth_phy_reset(); - - bus = fec_get_miibus(base, -1); - if (!bus) - return -EINVAL; - - /* Scan PHY 0 */ - phydev = phy_find_by_mask(bus, 0xf, PHY_INTERFACE_MODE_RGMII); - if (!phydev) { - printf("Ethernet PHY not found!\n"); - return -EINVAL; - } - - return fec_probe(bis, -1, base, bus, phydev); } #endif @@ -190,6 +170,10 @@ int board_init(void) setup_dhcom_mac_from_fuse(); +#ifdef CONFIG_FEC_MXC + setup_fec(); +#endif + return 0; } diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig index cbfc3c394e7d..40de1d82031b 100644 --- a/configs/dh_imx6_defconfig +++ b/configs/dh_imx6_defconfig @@ -74,6 +74,8 @@ CONFIG_SPI_FLASH_MTD=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y