From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6624FC433F5 for ; Wed, 23 Mar 2022 22:25:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 678C883F99; Wed, 23 Mar 2022 23:25:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine 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="WV3qPVtG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8962F83FD7; Wed, 23 Mar 2022 23:25:39 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 4239B82DD7 for ; Wed, 23 Mar 2022 23:25:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPS id C7EA913FB49; Wed, 23 Mar 2022 23:25:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1648074336; bh=X1PNzNaCTzoTxb0LdjO8Caqcg8pmt15eJK1Q2PBKfUw=; h=Date:From:To; b=WV3qPVtGo1ytgGqB7LRp3Yq4Km/01W69i2Jfb2boRJ8RMk4Kel+BoVUYS9DqL8Vz6 P6zKOAp3Ccq+mXHm+c+nrCfcKvKnpaXTWusB6kTr4XGdqv3kHTn1nJsln27VMycqDu CDbJF7jkRcqksDxDf5xOGWANi6u4Js1IlF9pmWhI= Date: Wed, 23 Mar 2022 23:25:35 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Robert Marko Cc: u-boot@lists.denx.de, sr@denx.de, pali@kernel.org Subject: Re: [PATCH v2 2/4] net: mvneta: add SFP TX disable handling Message-ID: <20220323232535.6361635a@thinkpad> In-Reply-To: <20220323171910.1947852-2-robert.marko@sartura.hr> References: <20220323171910.1947852-1-robert.marko@sartura.hr> <20220323171910.1947852-2-robert.marko@sartura.hr> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean On Wed, 23 Mar 2022 18:19:08 +0100 Robert Marko wrote: > Add support for handling SFP TX disable for MVNETA in the same fashion as > to what MVPP2 is doing in order to enable using SFP-s. > > This allows using ethernet on SFP only boards. > > Signed-off-by: Robert Marko > --- > Changes in v2: > * Parse the standard SFP node for TX disable GPIO instead of using a > custom property > > drivers/net/mvneta.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c > index 4a4268c2b2..018f2da393 100644 > --- a/drivers/net/mvneta.c > +++ b/drivers/net/mvneta.c > @@ -286,6 +286,7 @@ struct mvneta_port { > struct phy_device *phydev; > #if CONFIG_IS_ENABLED(DM_GPIO) > struct gpio_desc phy_reset_gpio; > + struct gpio_desc sfp_tx_disable_gpio; > #endif > struct mii_dev *bus; > }; > @@ -1693,6 +1694,9 @@ static int mvneta_probe(struct udevice *dev) > { > struct eth_pdata *pdata = dev_get_plat(dev); > struct mvneta_port *pp = dev_get_priv(dev); > +#if CONFIG_IS_ENABLED(DM_GPIO) > + struct ofnode_phandle_args sfp_args; > +#endif > void *blob = (void *)gd->fdt_blob; > int node = dev_of_offset(dev); > struct mii_dev *bus; > @@ -1767,6 +1771,11 @@ static int mvneta_probe(struct udevice *dev) > return ret; > > #if CONFIG_IS_ENABLED(DM_GPIO) > + ret = dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args); > + if (!ret) > + gpio_request_by_name_nodev(sfp_args.node, "tx-disable-gpio", 0, > + &pp->sfp_tx_disable_gpio, GPIOD_IS_OUT); This should also check whether the sfp_args.node is not disabled: if (!ret && ofnode_is_enabled(sf_args.node)) because for example current dts for Turris Omnia in Linux' upstream has sfp node but it is disabled by default. The dev_read_phandle_with_args() function does not check whether the sfp node is disabled or not (if I am looking at the code correctly. Marek