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 512DBC433EF for ; Thu, 24 Mar 2022 10:12:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8B7D8407A; Thu, 24 Mar 2022 11:12:35 +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="nGHZ2c2a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AA4AC8406C; Thu, 24 Mar 2022 11:12:33 +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 8FFB78407A for ; Thu, 24 Mar 2022 11:12:29 +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 dellmb (unknown [IPv6:2001:1488:fffe:6:8747:7254:5571:3010]) by mail.nic.cz (Postfix) with ESMTPSA id 25DAA1407BC; Thu, 24 Mar 2022 11:12:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1648116749; bh=WfKeZevaEpgNtOJmOJXuf5DMmwaPdd0TzpFXqNHhH7o=; h=Date:From:To; b=nGHZ2c2aElrwtBzwSc/VQ66Ur7BVdul1krCrgxKqDhA0u09oWHZWvblH2h7eDuw0O g/yCYgpfAlbS1Dw5owlTLWlVV6W0SCBGz0zCN6WRJyeLORHmolWdf12CU75WZQtNF1 1Z0M2CG+kHbDN9F3AZZkRv+g5yYR0zaEc0b/WqBo= Date: Thu, 24 Mar 2022 11:12:28 +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 v3 2/4] net: mvneta: add SFP TX disable handling Message-ID: <20220324111228.01e9f2d4@dellmb> In-Reply-To: <20220324095739.1162965-2-robert.marko@sartura.hr> References: <20220324095739.1162965-1-robert.marko@sartura.hr> <20220324095739.1162965-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=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Thu, 24 Mar 2022 10:57:37 +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. >=20 > This allows using ethernet on SFP only boards. >=20 > Signed-off-by: Robert Marko > --- > Changes in v3: > * Check whether the SFP node is enabled >=20 > Changes in v2: > * Parse the standard SFP node for TX disable GPIO instead of using a > custom property >=20 > drivers/net/mvneta.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c > index 4a4268c2b2..edd818338c 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 =3D dev_get_plat(dev); > struct mvneta_port *pp =3D dev_get_priv(dev); > +#if CONFIG_IS_ENABLED(DM_GPIO) > + struct ofnode_phandle_args sfp_args; > +#endif > void *blob =3D (void *)gd->fdt_blob; > int node =3D dev_of_offset(dev); > struct mii_dev *bus; > @@ -1767,6 +1771,11 @@ static int mvneta_probe(struct udevice *dev) > return ret; > =20 > #if CONFIG_IS_ENABLED(DM_GPIO) > + ret =3D dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args); > + if (!ret && ofnode_is_enabled(sfp_args.node)) > + gpio_request_by_name_nodev(sfp_args.node, "tx-disable-gpio", 0, > + &pp->sfp_tx_disable_gpio, GPIOD_IS_OUT); > + > gpio_request_by_name(dev, "phy-reset-gpios", 0, > &pp->phy_reset_gpio, GPIOD_IS_OUT); > =20 > @@ -1775,6 +1784,9 @@ static int mvneta_probe(struct udevice *dev) > mdelay(10); > dm_gpio_set_value(&pp->phy_reset_gpio, 0); > } > + > + if (dm_gpio_is_valid(&pp->sfp_tx_disable_gpio)) > + dm_gpio_set_value(&pp->sfp_tx_disable_gpio, 0); > #endif > =20 > return board_network_enable(bus); Reviewed-by: Marek Beh=C3=BAn Robert, I am wondering if it would make sense to add driver .remove() method (and flag DM_FLAG_OS_PREPARE so that the .remove() method is called before booting kernel), and disable TX again in this method... Marek