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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 404C5C7619A for ; Wed, 5 Apr 2023 17:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jrvp4ghxlsRYvqDvNgqMGaQwcGYiuyZtghEf07m0BNw=; b=QCgAgnQBaQoaKr 25LTgovYBU9g/uiIYe1gW5ZkPUp4csRD2LHRxD+/CwgGIYwcmqpg1VZwhU9UXLX2yVa0+w2Z53Vo7 5/DS2WXI8aLa4yGF2Qpr4DclNpQ0+Hv7G3ndfb2zLRH6hD+ZPQSiQ2RdEo10r1Ks+lIfD6RbOI6Yl YxjW91g2OFI/n18K2hUqdBQfvfLmO6BdJxrt+uUMcEqXMebz2Nzyz+AeRudO26Cw8QGOq9dkTE1ML JzONmx4TqUnCv9DnxEAHwvLcRBrUBzTj+atcT7z6C2kOFAMWApClVkWznX3UgZeUsLC6dFH8CZFw5 QLOAv1rEnNINcRoAsm0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pk6Wf-005DOs-0f; Wed, 05 Apr 2023 17:02:25 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pk6Wb-005DOT-2f for linux-arm-kernel@lists.infradead.org; Wed, 05 Apr 2023 17:02:23 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-177ca271cb8so39235005fac.2 for ; Wed, 05 Apr 2023 10:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680714139; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=wJdooDkKozVkmq/jE5ZIJWHR45XBypuBSfKalkLMI0w=; b=lhndkTBq464U/Xt0gXIA3bzt6cy6hrEA9CqJAkmYdK2UONW6KBlkuDpUphZApxzZ9o yH+WHRlywqpAaRY1ZtroZg+JfQkLAfyKahIkrCYlwB8BXLszNLKTUN0LxaTxuFJpxv/J S2qbhbPM09ZG6KYFJPTlz29MDb3EjQCWPS/ogkmwnK4Ok3hQVrUk8DaF1hLSvfHFz2MM IN/5d8GU44EBeqpNMLWKF4dmwjDfDmJYym1vvYwa+NWi0bSwStQADBYpJ2H27HZ2SAUm +VswydxOZfluEWZLiH8oDcX3aCdtzHI8rUg8jISF3gXISZ067fWckPPrRZxI4ec1rMwD FOHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680714139; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wJdooDkKozVkmq/jE5ZIJWHR45XBypuBSfKalkLMI0w=; b=arta1wC8M5sNPY6K0cXeOI1Qi2JmlGKDm4wIMX7QiZyG/8RXmS318gW8ggVIL3mNh5 LwBdJ8UZAFn9yTi/arojpLY24vRJ/wgpcs9uiUoRAr7mWZIaJ69vWeF0c5MD+l668tXY zkFws25jv+AH2tjkwTdR7Kvm47CjmSJDFN9Dc2zjolOT1ZBZTNvPhWeT/SJu05b/IlGR 2gOe2H5WtWLFf8pgV/2x0VHO4jtap8eF+wkQtUUqoLbpgKszMdAhdEYdDTC8tMYwBn/D +B4+g40ovE8SOkAnnIvGCpMBf6oEoL0BFNeZwmA+7dPvBYtlqGNTDH3Cqdb9ahW+vZlj P7Ow== X-Gm-Message-State: AAQBX9d4k6NdheMN0DoqqZ2u+OQzAGCY+L9AxoMw1R3rh1B42UFaTggm jJqm7aTv3tplx4JkHVfODUM= X-Google-Smtp-Source: AKy350Y+q+FZUc+o6NJRWKav1W5Jicca/zmUWi5GHYLjZcSC8DIl2a9Q6sS0FbYDYCYe31KADbNeuQ== X-Received: by 2002:a05:6870:6025:b0:17a:cb34:758a with SMTP id t37-20020a056870602500b0017acb34758amr4109941oaa.34.1680714139060; Wed, 05 Apr 2023 10:02:19 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s15-20020a0568301e0f00b006a1508d348dsm7177806otr.22.2023.04.05.10.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 10:02:18 -0700 (PDT) Date: Wed, 5 Apr 2023 10:02:16 -0700 From: Guenter Roeck To: Michael Sit Wei Hong Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: Re: [PATCH net v3 2/3] net: stmmac: check if MAC needs to attach to a PHY Message-ID: <5bb39f85-7ef0-4cbb-a06b-0d6431ab09b7@roeck-us.net> References: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> <20230324081656.2969663-3-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230324081656.2969663-3-michael.wei.hong.sit@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230405_100221_891839_7FD8EA9B X-CRM114-Status: GOOD ( 24.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Fri, Mar 24, 2023 at 04:16:55PM +0800, Michael Sit Wei Hong wrote: > After the introduction of the fixed-link support, the MAC driver > no longer attempt to scan for a PHY to attach to. This causes the > non fixed-link setups to stop working. > > Using the phylink_expects_phy() to check and determine if the MAC > should expect and attach a PHY. > > Fixes: ab21cf920928 ("net: stmmac: make mdio register skips PHY scanning for fixed-link") > Signed-off-by: Michael Sit Wei Hong > Signed-off-by: Lai Peter Jun Ann With this patch in linux-next, the orangepi-pc qemu emulation fails to bring up the Ethernet interface. The following error is seen. [ 12.482401] dwmac-sun8i 1c30000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 12.487789] dwmac-sun8i 1c30000.ethernet eth0: PHY [mdio_mux-0.1:01] driver [Generic PHY] (irq=POLL) [ 12.488177] dwmac-sun8i 1c30000.ethernet eth0: no phy found [ 12.488295] dwmac-sun8i 1c30000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19) Reverting this patch fixes the problem. > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 8f543c3ab5c5..41f0f3b74933 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1135,6 +1135,7 @@ static int stmmac_init_phy(struct net_device *dev) > { > struct stmmac_priv *priv = netdev_priv(dev); > struct fwnode_handle *fwnode; > + bool phy_needed; > int ret; > > fwnode = of_fwnode_handle(priv->plat->phylink_node); > @@ -1144,10 +1145,11 @@ static int stmmac_init_phy(struct net_device *dev) > if (fwnode) > ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0); > > + phy_needed = phylink_expects_phy(priv->phylink); > /* Some DT bindings do not set-up the PHY handle. Let's try to > * manually parse it > */ > - if (!fwnode || ret) { > + if (!fwnode || phy_needed || ret) { I don't really understand this condition. It starts taking this path even if ret == 0 and fwnode != NULL if phy_needed is set. That means this path is now taken even if phylink_fwnode_phy_connect() returned no error. That seems odd. Guenter > int addr = priv->plat->phy_addr; > struct phy_device *phydev; > > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel