Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9934215rwr; Fri, 12 May 2023 01:05:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+QLW0Xoiuxii29orRiU9fh2kM6Iw38wKOnqP++cBt34bbSQIS08Hokrk/HKrHWYndwGu6 X-Received: by 2002:aa7:88c8:0:b0:64a:2dd6:4f18 with SMTP id k8-20020aa788c8000000b0064a2dd64f18mr4996783pff.13.1683878750681; Fri, 12 May 2023 01:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683878750; cv=none; d=google.com; s=arc-20160816; b=HhZJiACiCetS08O8NvqMJpr7dAZRiFeF4+BBEImDre6hjxLsxzxyXdwqvAJokDgEqV GdmeA+bFbA7BHIt+apHUa836Ar4Iqn5BIFW8Lkyes8MvVN/967zfd74hZy84IR4WgQ5+ 4ngkSs7BdvgaCvlRXb44EnRXpxt3rg9sFZ+K2jHwx590rKynxUlMJtnai6rK3UmTWka+ PlZJlOn4CM3E7GKQiaM3W9S0m8EQqkZr8jK934dnaC8NzPuDvuNzrtXp5smk/0Ii9P/n zN/+ehYqI1kHmWSdtfko+l1UNpIRfy761CzdUqgkV0M967rMXrWrQgLbWiJ19GYjg0Tx ezUg== 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=umOcZNydYWMkIf5mbEUP8/J6HKiH1xlOF3VU6GTvq9Q=; b=lyiVtJ6fxnyH5WaEizaICjq4Z1DUZr4GWPSiZ2UDekIzzrb8avWRkK4bT3E9KiCTAY BV4oWerlEvpFSzexSN245dSLXshBMpsxNAjXbPTSItcIiFBy8rKscOu224i9arZ+IeJc 1FcLMXjXnMJaMtRDdgOCbhmUSMA86KuodRM6yHuyawJ1y1rLQ8K6ojca2dbLdASqA4ce SSUsZxszwRpTsxeTaXBmA+Z4wdmNaMd0gEt9Ea4dRXntFp/16MSZrb1yL6VIpdUX3te+ +4m9wiEl8oE74RYLyjwHf6werc3G1B3AMhvyiYY+DVkSSH9AvRQpNbztWAA10wsGhsoC ux/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="GoCKd/Z5"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=dj6TTamw; 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 z13-20020aa79f8d000000b0063b8dce6141si9831286pfr.353.2023.05.12.01.05.36; Fri, 12 May 2023 01:05:50 -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="GoCKd/Z5"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=dj6TTamw; 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 S240256AbjELIAO (ORCPT + 99 others); Fri, 12 May 2023 04:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240134AbjELIAB (ORCPT ); Fri, 12 May 2023 04:00:01 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820AC1BCA; Fri, 12 May 2023 00:59:58 -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=1683878398; x=1715414398; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=umOcZNydYWMkIf5mbEUP8/J6HKiH1xlOF3VU6GTvq9Q=; b=GoCKd/Z5FyFXbnjWFdXIN8ATYMDTFwIZ+pQXY4LbVs3m5Pto25jAYVpS shQDooZeD+mGFUZDFNLQF9SumoJThXHMWhRSYZf2Ep9zsYEcrAE26WcKd S6PowUNULF9D6wvhRex4toxAxivzqGMANuo5InAOMug8jcnKt/SCxweko 6xn2i3l7Y7Mgj3NB0KpQF1ZtnyOZ1TPi7KtSQ8BZMgIN2ltB0/ugYYr3f VmczkzUzUr1jRsNiKfeW/qnGcUzkSWzk4Hm/3l52I/9NEzmtAQ5KtgUwr AbXYM/P7Ko/lWbF1sdS5dM13qoprPBpJ2xf0CpA6oNhUQ3VNwJ5sBmBGF A==; X-IronPort-AV: E=Sophos;i="5.99,269,1677538800"; d="scan'208";a="30870394" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 12 May 2023 09:59:56 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 12 May 2023 09:59:56 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 12 May 2023 09:59:56 +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=1683878396; x=1715414396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=umOcZNydYWMkIf5mbEUP8/J6HKiH1xlOF3VU6GTvq9Q=; b=dj6TTamwow7wlhhjaudDKc/UlUfbtW78wjIKMMDnIMZ4stG7qVfqmkH2 zgwfHXbXxK5lLI2e92paY6xa+YzT69beReMdf9i/Wqmvoew5XrlTaLG0X aAuKXFBCDk7VkR1wpcdJzbJZ9B//Y9ZdrDF1L7+A/BpYW+XJF7Yt06wRZ EW8J6ehKESLKzDJaQI5NjfqQVNb03giy/IFUI/0gugBKANjeDkWIRnacD rcyf5c4iBI1MWOQNKI+SQPBg1JfPjBIOU6+5qIDydjFdgj//ZR5zODP5Y pFVYK8vIXQQRsy9FWA7vqhuQTFu+Pa+HTKSc1UJ8LVCKsHTKtwGbizYJ4 w==; X-IronPort-AV: E=Sophos;i="5.99,269,1677538800"; d="scan'208";a="30870393" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 12 May 2023 09:59:56 +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 E0C33280056; Fri, 12 May 2023 09:59:55 +0200 (CEST) From: Alexander Stein To: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, Yan Wang Cc: Yan Wang Subject: Re: [PATCH v4] net: mdiobus: Add a function to deassert reset Date: Fri, 12 May 2023 09:59:56 +0200 Message-ID: <1858925.CQOukoFCf9@steina-w> Organization: TQ-Systems GmbH In-Reply-To: References: 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 Donnerstag, 11. Mai 2023, 08:59:09 CEST schrieb Yan Wang: > It is possible to mount multiple sub-devices on the mido 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 not be scanned. >=20 > So,before adding a reset to the scan, make sure the device is in 'So, before'. One space after , > normal working mode. >=20 > Reported-by: kernel test robot > Link: > https://lore.kernel.org/oe-kbuild-all/202305101702.4xW6vT72-lkp@intel.com/ > Signed-off-by: Yan Wang > --- > v4: > - Get pulse width and settling time from the device tree > - Add logic for processing (PTR_ERR(reset) =3D=3D -EPROBE_DEFER) > - included > - fixed commit message > v3: > https://lore.kernel.org/all/KL1PR01MB5448A33A549CDAD7D68945B9E6779@KL1PR0= 1M > B5448.apcprd01.prod.exchangelabs.com/ - fixed commit message > v2: > https://lore.kernel.org/all/KL1PR01MB54482416A8BE0D80EA27223CE6779@KL1PR0= 1M > B5448.apcprd01.prod.exchangelabs.com/ - 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 | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) >=20 > diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdi= o.c > index 1183ef5e203e..9d7df6393059 100644 > --- a/drivers/net/mdio/fwnode_mdio.c > +++ b/drivers/net/mdio/fwnode_mdio.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include Please sort alphabetically. >=20 > MODULE_AUTHOR("Calvin Johnson "); > MODULE_LICENSE("GPL"); > @@ -57,6 +58,35 @@ 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; > + unsigned int reset_assert_delay; > + unsigned int reset_deassert_delay; > + > + reset =3D fwnode_gpiod_get_index(fwnode, "reset", 0, GPIOD_OUT_LOW,=20 NULL); > + if (IS_ERR(reset)) { > + if (PTR_ERR(reset) =3D=3D -EPROBE_DEFER) > + pr_debug("%pOFn: %s: GPIOs not yet available,=20 retry later\n", > + to_of_node(fwnode), __func__); You are not dealing with this error at all. pr_debug is (mostly) not even=20 printed in kernel log, despite the code registering the PHY ignoring the=20 deferral completely. > + else > + pr_err("%pOFn: %s: Can't get reset line=20 property\n", > + to_of_node(fwnode), __func__); > + This error also gets ignored. > + return; > + } > + fwnode_property_read_u32(fwnode, "reset-assert-us", > + &reset_assert_delay); > + fwnode_property_read_u32(fwnode, "reset-deassert-us", > + &reset_deassert_delay); These are currently read in fwnode_mdiobus_phy_device_register(). There is = no=20 need to read them twice. It should be moved to a location where it just nee= d=20 to be read once. Regards, Alexander > + gpiod_set_value_cansleep(reset, 1); > + fsleep(reset_assert_delay); > + gpiod_set_value_cansleep(reset, 0); > + fsleep(reset_deassert_delay); > + /*Release phy's reset line, mdiobus_register_gpiod() need to request=20 it*/ > + 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 +149,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/