Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7165502rwr; Wed, 10 May 2023 05:00:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/9wbAu7r+k0+SVOVFVOTgRfd6SnylZPNrePh3KQm3BPX/kA0var2w8g/T4u4q/XZaG3ij X-Received: by 2002:a17:90a:6a8e:b0:234:ba34:71bf with SMTP id u14-20020a17090a6a8e00b00234ba3471bfmr17816959pjj.1.1683720038975; Wed, 10 May 2023 05:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683720038; cv=none; d=google.com; s=arc-20160816; b=QxsQyXlBr/FxQjrIaayVONqtDvbBvy1Nz9DvH/iT6h/4qa0J6+6nxlvIOw4YwMlRo4 T39kN4XGedaqNXzD1LNUuqCTfLcXfD28pm/wnRle0OuYEJw6vjEDELBiOevpT32wndWA Hu93dhBN5/9xZgIw5NFNcHQTvcngEPu3zT2Ej8qVMbpcUf0ERELA3UynVyVQGow3I+6x /i2n5VLLwSatuax8V9CWDCDD/+SkwWCtYFy9Qf7uCpSIyqgiXUDRoElQKu2sXOLjREQ5 6JH8LN8L1cFgMPe8tq4jJQ9caCmnLtr25N67h0Mfv3TCKUKmDcXnGe2JMV837yUp72PB MxyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=kX2SUuVDggIqJv7fR5xblEE13YsFSLn3Q9/AkV/oBQ8=; b=tKKenU3y3nOujZOgIpU6P7UTl/A7fhoPe7IGd+Eml2RTXW9RWafr5oLPI9Ae5XxpJl Qex7kVt3x8HNwHVKSU18KEdjDauIq8VQiosAgHQ6DCxuuZNeN7WACfn4pRO3MhcunlLN 8QVz58cHz0QBnuqWoIGHfaydYCZkjhvJcPoNWu207TDk0iKoz8bfceTMjdBO3JQikawx vTZ0gIPiLs5abmmxyNmmPW+gxck+KwnSEedvphP0UkYUUAvjZjUBjaB+muQf5lkFidV/ M26sJfBhLJ+sVzDTJVilpGsSNh3YDkvvc1feY7cEoAdlB4I5O88nHtCQ22x/wyANufOJ bpzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=DGUol04I; dkim=pass header.i=@tq-group.com header.s=key1 header.b="FK7V/ckR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i70-20020a638749000000b0051fadd81852si4033131pge.540.2023.05.10.05.00.26; Wed, 10 May 2023 05:00:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=DGUol04I; dkim=pass header.i=@tq-group.com header.s=key1 header.b="FK7V/ckR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236600AbjEJLzd (ORCPT + 99 others); Wed, 10 May 2023 07:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235982AbjEJLz3 (ORCPT ); Wed, 10 May 2023 07:55:29 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05146A24A; Wed, 10 May 2023 04:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1683719718; x=1715255718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kX2SUuVDggIqJv7fR5xblEE13YsFSLn3Q9/AkV/oBQ8=; b=DGUol04I49ZKQ4cgXIRLGD9nOVlPqZWVqljDBn4+ogd5sRu26wvSlYIM xhEl2MTc+3/HEu5bPvs8CYECZW0T2uekVlwWmLcT+8E+oNOOyiFvaXG4O AU5gG3vtPcrl6DAq3tuaq/AzwBrqY2+Fk6cUf8joTk4lsfqh/qOp96ZlT R/Quf4eT9nEhIeVCu0U0Lh++VbB2xGWzinU17Jz1rTrQqE68dwiU7e7AJ JYkfMD4fOEaxCJ3z+XKzpVB0cyStHrJj76ShP/zXyJ+lQplqR3Cf9Z+Vc VYTvNKIPXq0/a3ZNnhPlZC+TwgoCMIQfSAGZwLTZRFwiRGEElYWoJM9zi w==; X-IronPort-AV: E=Sophos;i="5.99,264,1677538800"; d="scan'208";a="30828875" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 May 2023 13:55:16 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 10 May 2023 13:55:16 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 10 May 2023 13:55:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1683719716; x=1715255716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kX2SUuVDggIqJv7fR5xblEE13YsFSLn3Q9/AkV/oBQ8=; b=FK7V/ckRDREAd05F+kCKES93Hi+kTRv6RLuP5XV8JHC90U8kcUePl7z+ fTeu38dbHtu67oS5U2ogrqGzsU6oHqBHxIHCSsyjSt2gUxhtT3zZZ2DrP ZcTYLVVQR4+EOkN2+C3NXZwceIQgimG41ms4la/MxqEnRtnTVcEXZFKOn b9l38XwLYIThPD9Z8CckKh8/qZnz0Xv6e9rdI6ssQE447yD19Ae3gqPrN lIt3L8cHwkuUlzPHhV9l4n1m+q8ypAqc51/sWIFoVFX6ls3hI3Svm/9Sp ODh2o2RWU750cVJJig2WJIwmbDZ5sWEfBXKvuD2m7Qu+FC4Z4PLhI71+x Q==; X-IronPort-AV: E=Sophos;i="5.99,264,1677538800"; d="scan'208";a="30828874" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 May 2023 13:55:15 +0200 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id A2EE7280056; Wed, 10 May 2023 13:55:15 +0200 (CEST) From: Alexander Stein To: andrew@lunn.ch, Yan Wang Cc: Yan Wang , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "open list:ETHERNET PHY LIBRARY" , open list Subject: Re: [PATCH v2] net: mdiobus: Add a function to deassert reset Date: Wed, 10 May 2023 13:55:15 +0200 Message-ID: <9107661.CDJkKcVGEf@steina-w> Organization: TQ-Systems GmbH In-Reply-To: References: <96a1b95e-d05e-40f0-ada9-1956f43010e0@lunn.ch> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Mittwoch, 10. Mai 2023, 10:02:52 CEST schrieb Yan Wang: > It is possible to mount multiple sub-devices on the mido bus. mdio bus > The hardware power-on does not necessarily reset these devices. > The device may be in an uncertain state, causing the device's ID > to be scanned. >=20 > So, before adding a reset to the scan, make sure the device is in > normal working mode. >=20 > I found that the subsequent drive registers the reset pin into the > structure of the sub-device to prevent conflicts, so release the > reset pin. >=20 > Signed-off-by: Yan Wang We had similar cases where the (single) PHY was in reset during Linux boot. Should you be able to make this work by using a "ethernet-phy-id%4x.%4x"=20 compatible? See also [1] [1] https://lkml.org/lkml/2020/10/28/1139 > --- > v2: > - fixed commit message > - Using gpiod_ replace gpio_ > v1: > https://lore.kernel.org/all/KL1PR01MB5448631F2D6F71021602117FE6769@KL1PR0= 1M > B5448.apcprd01.prod.exchangelabs.com/ - Incorrect description of commit > message. > - The gpio-api too old > --- > drivers/net/mdio/fwnode_mdio.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdi= o.c > index 1183ef5e203e..6695848b8ef2 100644 > --- a/drivers/net/mdio/fwnode_mdio.c > +++ b/drivers/net/mdio/fwnode_mdio.c > @@ -57,6 +57,20 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwno= de) > return register_mii_timestamper(arg.np, arg.args[0]); > } >=20 > +static void fwnode_mdiobus_pre_enable_phy(struct fwnode_handle *fwnode) > +{ > + struct gpio_desc *reset; > + > + reset =3D fwnode_gpiod_get_index(fwnode, "reset", 0, GPIOD_OUT_HIGH,=20 NULL); > + if (IS_ERR(reset) && PTR_ERR(reset) !=3D -EPROBE_DEFER) How are you dealing with EPROBE_DEFER if the reset line is e.g. attached to= an=20 i2c expander, which is to be probed later on? > + return; > + > + usleep_range(100, 200); How do you know a PHY's reset pulse width? > + gpiod_set_value_cansleep(reset, 0); What about post-reset stabilization times before MDIO access is allowed? > + /*Release the reset pin,it needs to be registered with the PHY.*/ /* Release [...] PHY. */ Best regards, Alexander > + gpiod_put(reset); > +} > + > int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, > struct phy_device *phy, > struct fwnode_handle *child,=20 u32 addr) > @@ -119,6 +133,8 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, > u32 phy_id; > int rc; >=20 > + fwnode_mdiobus_pre_enable_phy(child); > + > psec =3D fwnode_find_pse_control(child); > if (IS_ERR(psec)) > return PTR_ERR(psec); =2D-=20 TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/