From patchwork Sun Apr 19 15:48:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1272952 X-Patchwork-Delegate: trini@ti.com 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=nic.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.a=rsa-sha256 header.s=default header.b=wp8Ifiw9; 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 494vSb46JXz9sRN for ; Mon, 20 Apr 2020 01:51:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9A14881A2F; Sun, 19 Apr 2020 17:50:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="wp8Ifiw9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A42E80721; Sun, 19 Apr 2020 17:49:25 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (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 1D6B0815F4 for ; Sun, 19 Apr 2020 17:48:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marek.behun@nic.cz Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 9CCC4140F0C; Sun, 19 Apr 2020 17:48:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1587311336; bh=eYGYwwrb5qIhwNWlWy83iDQMaEgeMnhydWGSpswNdHE=; h=From:To:Date; b=wp8Ifiw9n9vU3WBS9iYEFSd4cZGpuuxAU2Vi12KSnoVk7b/QCC0DLDWISQTMekIi1 obrhzkUMcQpKwOkcpgTmk+R66YzN/Pep4pAAAKdWwHwx1ioGTjMHKGq/YctXxaOqrV Fb2mAcSnCdPlzCSxePf0O44UByEd234G1k57E7To= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, Konstantin Porotchkin , make@marvell.com, Vladimir Vid , "Matwey V . Kornilov" , Miquel Raynal , Gregory CLEMENT , Andrew Lunn , Thomas Petazzoni , Tomasz Maciej Nowak , Ellie Reeves , Vladimir Oltean , Marek Vasut , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 09/11] net: mvneta: add PHY support Date: Sun, 19 Apr 2020 17:48:48 +0200 Message-Id: <20200419154850.25868-10-marek.behun@nic.cz> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200419154850.25868-1-marek.behun@nic.cz> References: <20200419154850.25868-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Spamd-Bar: / 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 generic-phy API to power on comphy in mvneta driver. Signed-off-by: Marek BehĂșn --- drivers/net/mvneta.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index d737400a20..31548445d7 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -274,6 +275,7 @@ struct mvneta_port { unsigned int link; unsigned int duplex; unsigned int speed; + struct phy comphy; int init; int phyaddr; @@ -1150,8 +1152,22 @@ static int mvneta_setup_txqs(struct mvneta_port *pp) return 0; } +static int mvneta_comphy_init(struct mvneta_port *pp) +{ + int ret; + + ret = generic_phy_set_mode(&pp->comphy, PHY_MODE_ETHERNET, + pp->phy_interface); + if (ret) + return ret; + + return generic_phy_power_on(&pp->comphy); +} + static void mvneta_start_dev(struct mvneta_port *pp) { + mvneta_comphy_init(pp); + /* start the Rx/Tx activity */ mvneta_port_enable(pp); } @@ -1723,6 +1739,12 @@ static int mvneta_probe(struct udevice *dev) else mvneta_conf_mbus_windows(pp); + ret = generic_phy_get_by_index(dev, 0, &pp->comphy); + if (ret && ret != -ENOENT) { + printf("cannot get comphy in mvneta\n"); + return ret; + } + /* PHY interface is already decoded in mvneta_ofdata_to_platdata() */ pp->phy_interface = pdata->phy_interface; @@ -1776,6 +1798,7 @@ static void mvneta_stop(struct udevice *dev) mvneta_port_down(pp); mvneta_port_disable(pp); + generic_phy_power_off(&pp->comphy); } static const struct eth_ops mvneta_ops = {