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 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 43308C76188 for ; Mon, 3 Apr 2023 21:26:17 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iVHXO98HDfJ22OSYoKrmQPXYRgkRKIXePM+KVOKnohs=; b=K7mFW9d1ewTzU3 1gCCLbtI4XvszbW9/Ht18VKu4VGT3PT0Ii5cxZIPMNbmLECqSE9Mqn9ssWul1gmH3aTOOpj3gR41R 1MdLCa9auMNjXxNjNA9Z9DWxFFJrd8M0Cs79ZxKy78GSjRr1K6sYGE6iJdL2PYA01TAGPoyokZW8u byF0PpBnf3FM+ArtfUdbkR8z2JmTJNgEJHJvxM8zdf5Yix/pGtsK6VbPDag6C3tmdxwOoOuiBD6sE uguKSmDlu/l47flOUWC+/6dJOCZeA+QhT4XY1BNuSuQw20Kq1O4WLF8huKrbKsQhlDNkXu8u2nKj/ d2WktYQpOaLTkVsY7Qqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pjRgA-00Gthc-17; Mon, 03 Apr 2023 21:25:30 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pjRg7-00Gtf2-1u for linux-arm-kernel@lists.infradead.org; Mon, 03 Apr 2023 21:25:29 +0000 Received: by mail-wm1-x32a.google.com with SMTP id l37so17863710wms.2 for ; Mon, 03 Apr 2023 14:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; t=1680557123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VIR23tVTvNCqVdOLn9EZ+Au8EAUJ7AiO6u6/9Nuexhc=; b=NfT05tNQvxCUfD2aerk9b1zGCfDZSUJHGA9DhvC76SDQcKo2ztcfkMJODvLFwdcGIe k37WdPTfn6c1QciK7LFx/Dy9hAEB1Hcu0phVqroV6ZMfpSgDwsCzG9J+vDq3azM6AuGy 0F2QOD13dz7f4fJwZ9f7CWYiVca8IIYoxec8s2/BoeLNR2sTeI69/Cs+NHv0MGOMTDFd wrwEbAIi50OyV1xv1vugxyvWi/Y4RCJxf5p/sm8o5swl+7jvkE41H9i+yzXijUbBZDXF 9y4Gq45/uIadFK2X/J4Jvjs77il7Z2jrJLkbnkM8kmcWYE1QMifxN81cK4o79m1MtVbH H2sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680557123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VIR23tVTvNCqVdOLn9EZ+Au8EAUJ7AiO6u6/9Nuexhc=; b=sgCne4rDT7CG4YcbZ1QbGYgLN5GxTzOpqEXVBpHxjvTXHsQNuSwmf3tYuWaCR2FXZ1 fjvzf23Q/qhZwoRgt8/Qo3zUxkYSnd/e6GWBZwB7DDsVbJdVJVCKzI+P78Q+b/Jf9gFT UmQpgzW1uXi21Gk1IE4scWtnfuTAQiNUkRo2L70PDAyEmf6EPXJDsS0XVqRrt7xN+Tqp zQBAfuNzquPRsLJOi8OVHvtn7/4VQeA9CGD/Or9ougH+tSrLt7Yuf9bh7FEF2SNeIylI vgOPV7bHnwDpfJGGjQ6YdhWm2fcy/RRMjO+ei5Z/5DHFV4efq+/NjD8Jmm9yL+6MeelE Z/lA== X-Gm-Message-State: AAQBX9c2LN+4SdqpvY6pbNJGuTiqUoMiWq821RVq9ojVGZcfb2Z06ny6 Supla8R2YPs917g2GJ/Yroc= X-Google-Smtp-Source: AKy350bZY6EtR7wvHBKIrt7OS1qjTi8Wveiqtqxq+rdf48JdfURnCCSj2CHGoO8P92DrFcHB1L9uPw== X-Received: by 2002:a7b:c5cd:0:b0:3ea:d611:f8 with SMTP id n13-20020a7bc5cd000000b003ead61100f8mr531737wmk.38.1680557122734; Mon, 03 Apr 2023 14:25:22 -0700 (PDT) Received: from localhost.localdomain (dynamic-2a01-0c22-7651-4500-0000-0000-0000-0e63.c22.pool.telefonica.de. [2a01:c22:7651:4500::e63]) by smtp.googlemail.com with ESMTPSA id g19-20020a05600c311300b003ee74c25f12sm20405564wmo.35.2023.04.03.14.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 14:25:22 -0700 (PDT) From: Martin Blumenstingl To: michael.wei.hong.sit@intel.com Cc: alexandre.torgue@foss.st.com, andrew@lunn.ch, boon.leong.ong@intel.com, davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com, hong.aun.looi@intel.com, joabreu@synopsys.com, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux@armlinux.org.uk, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, pabeni@redhat.com, peppe.cavallaro@st.com, peter.jun.ann.lai@intel.com, weifeng.voon@intel.com Subject: RE [PATCH net v5 2/3] net: stmmac: check if MAC needs to attach to a PHY Date: Mon, 3 Apr 2023 23:24:34 +0200 Message-Id: <20230403212434.296975-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330091404.3293431-3-michael.wei.hong.sit@intel.com> References: <20230330091404.3293431-3-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230403_142527_648727_2BAEC58D X-CRM114-Status: GOOD ( 16.90 ) 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 Hello, [...] > @@ -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) { Unfortunately this breaks Ethernet on my X96 Air board (the .dts file can be found upstream in: arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-gbit.dts) Working boot-log: # dmesg | grep dwmac [ 3.699961] meson8b-dwmac ff3f0000.ethernet: IRQ eth_wake_irq not found [ 3.700944] meson8b-dwmac ff3f0000.ethernet: IRQ eth_lpi not found [ 3.707196] meson8b-dwmac ff3f0000.ethernet: PTP uses main clock [ 3.713688] meson8b-dwmac ff3f0000.ethernet: User ID: 0x11, Synopsys ID: 0x37 [ 3.720201] meson8b-dwmac ff3f0000.ethernet: DWMAC1000 [ 3.725387] meson8b-dwmac ff3f0000.ethernet: DMA HW capability register supported [ 3.732832] meson8b-dwmac ff3f0000.ethernet: RX Checksum Offload Engine supported [ 3.740301] meson8b-dwmac ff3f0000.ethernet: COE Type 2 [ 3.745491] meson8b-dwmac ff3f0000.ethernet: TX Checksum insertion supported [ 3.752504] meson8b-dwmac ff3f0000.ethernet: Wake-Up On Lan supported [ 3.758993] meson8b-dwmac ff3f0000.ethernet: Normal descriptors [ 3.764813] meson8b-dwmac ff3f0000.ethernet: Ring mode enabled [ 3.770629] meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer [ 13.565781] meson8b-dwmac ff3f0000.ethernet end0: renamed from eth0 [ 14.036061] meson8b-dwmac ff3f0000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 14.255617] meson8b-dwmac ff3f0000.ethernet end0: PHY [mdio_mux-0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=33) [ 14.265404] meson8b-dwmac ff3f0000.ethernet end0: No Safety Features support found [ 14.267977] meson8b-dwmac ff3f0000.ethernet end0: PTP not supported by HW [ 14.275723] meson8b-dwmac ff3f0000.ethernet end0: configuring for phy/rgmii-txid link mode [ 17.394262] meson8b-dwmac ff3f0000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx Non-working boot-log: # dmesg | grep dwmac [ 3.730072] meson8b-dwmac ff3f0000.ethernet: IRQ eth_wake_irq not found [ 3.731053] meson8b-dwmac ff3f0000.ethernet: IRQ eth_lpi not found [ 3.737303] meson8b-dwmac ff3f0000.ethernet: PTP uses main clock [ 3.743795] meson8b-dwmac ff3f0000.ethernet: User ID: 0x11, Synopsys ID: 0x37 [ 3.750311] meson8b-dwmac ff3f0000.ethernet: DWMAC1000 [ 3.755498] meson8b-dwmac ff3f0000.ethernet: DMA HW capability register supported [ 3.762944] meson8b-dwmac ff3f0000.ethernet: RX Checksum Offload Engine supported [ 3.770412] meson8b-dwmac ff3f0000.ethernet: COE Type 2 [ 3.775603] meson8b-dwmac ff3f0000.ethernet: TX Checksum insertion supported [ 3.782615] meson8b-dwmac ff3f0000.ethernet: Wake-Up On Lan supported [ 3.789106] meson8b-dwmac ff3f0000.ethernet: Normal descriptors [ 3.794924] meson8b-dwmac ff3f0000.ethernet: Ring mode enabled [ 3.800738] meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer [ 13.052942] meson8b-dwmac ff3f0000.ethernet end0: renamed from eth0 [ 13.594285] meson8b-dwmac ff3f0000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 13.825578] meson8b-dwmac ff3f0000.ethernet end0: PHY [mdio_mux-0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=33) [ 13.831358] meson8b-dwmac ff3f0000.ethernet end0: no phy found [ 13.836229] meson8b-dwmac ff3f0000.ethernet end0: __stmmac_open: Cannot attach to PHY (error: -19) Reverting this patch fixes that problem. I think the reason is a logic error in the patch: As you can see the PHY is found and attached (my understanding is that this happens through phylink_fwnode_phy_connect()). But we now also go to that if block below even fwnode != NULL && ret == 0 (which indicates that phylink_fwnode_phy_connect() was successful). Inside that if block priv->plat->phy_addr then has the default value (-1) that was set in stmmac_probe_config_dt(). I am running out of time for today. Could you please look into this and follow up with a patch (on top of this one, as this one has already been applied) that considers your original issues as well as the case of my board (I suspect that all Amlogic boards that are supported upstream are affected)? Please keep me Cc'ed so I can test your additional patch and then add my Tested-by. Thank you! Martin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel