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: 1271195 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=pbGr4t66; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 492PDp4Gh5z9sPF for ; Thu, 16 Apr 2020 00:02:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FEEB80857; Wed, 15 Apr 2020 16:02:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1586959333; bh=R3dfUbWWHB/utyFzAw3rQKR2tT3m9/R+nCpad0zw1tM=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=pbGr4t66m+HG0hOjjawDp5ZXl9M14Ix62ct/Wd9WLsmlBaKkDsy3NtQR+1GDym9Ql SCQii0ByELpmRuacEVuBVp56Z9lBlI6pymszakTMVwkz6UTPWMvj1IMWEDGYNOqHAh VCSPqx3U85ZZ8+eYKHU6QwKdPk2VtOcvLe3abOwfzyICTL5KjTuWueJiTj0+brDoXl 59ThDt56+ClkkA48AGo1uQ6I34cDEQy50Xd72qxQaz+/7/Cgdq3ChMrseus/CEkka6 cHiwOMpqR4YY1o6ChI8gpXb7CKcwnjThgYP10a79vhVrk+bzGeycqGa2jlBDk3m47l pI5KbqvfNG7Pw== Received: by phobos.denx.de (Postfix, from userid 109) id 7407281009; Wed, 15 Apr 2020 16:02:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9116C8047E for ; Wed, 15 Apr 2020 16:02:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=hws@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 492PDX13M5z1r4bR; Wed, 15 Apr 2020 16:02:04 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 492PDX0YL8z1qtwh; Wed, 15 Apr 2020 16:02:04 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id BNIGchOMRzAt; Wed, 15 Apr 2020 16:02:02 +0200 (CEST) X-Auth-Info: NcApNT2W6J8Nest7ug/zIH/BnoWLkzBnFgWEc0C5Dq0= Received: from localhost.localdomain (p54847A6E.dip0.t-ipconnect.de [84.132.122.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 15 Apr 2020 16:02:02 +0200 (CEST) From: Harald Seiler To: u-boot@lists.denx.de Cc: Harald Seiler , Andreas Geisreiter , Ludwig Zenz , Marek Vasut , Stefano Babic Subject: [PATCH] ARM: imx6: DHCOM i.MX6 PDK: Convert to DM_ETH Date: Wed, 15 Apr 2020 16:01:37 +0200 Message-Id: <20200415140137.252222-1-hws@denx.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean 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