From patchwork Thu Mar 31 17:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 12797483 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 36876C433F5 for ; Thu, 31 Mar 2022 17:19:57 +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: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:In-Reply-To:References: List-Owner; bh=KTup7kUoqu+pZgrQ4rGj3fFWkKKNfhMPbfVra3SVKR8=; b=3LhJJvIZ3y/vFu LTTSUEEneEfLi7fNyWKy21qila/L2/vULCuAFQvHlTlTPNRgJqtaBC8rp5tOEsFoQ+RrUzb+Q8Mhv BJCQt2M7sbhlExiaw5+rSUfFIBFm7/nTpeURAruihjD8aAAtEloJJxfwLYGifbg0DBb6PPhwyYnTq u7U6oagaulSOQi5BWQ5LeHWdKQpGWiy4xKYTFdnJLFhJ11tcETNSM2nUezuUJ/G5PJEFGdocNGWTl 38cKTM2raQt2pHmVMvh7nkIZDZ4ig4K2O+dDRnrGlKAqUm1pm0kHqSAvadeL6YB4xp0QalhmySwIe +tmhx5Og9N81MUhqsZUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZyRY-0034ul-FM; Thu, 31 Mar 2022 17:18:44 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZyRV-0034tw-HH for linux-arm-kernel@lists.infradead.org; Thu, 31 Mar 2022 17:18:42 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96E1CB8218D; Thu, 31 Mar 2022 17:18:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33390C340EE; Thu, 31 Mar 2022 17:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648747118; bh=bX62gS64xvApsIu17dQYecs3RAVYxvOTGCX0wgPFvLE=; h=From:To:Cc:Subject:Date:From; b=T1EAPTy2SLpjWFEUjuNPi92OE1y0q/0JRyCZhbiyopJjIYxJsaCJDmIm4i/6oAT28 SONVP/BEPr/y57Wleq4Ybaoc/OYFD+KDq+lBeihRRr+kooKzUtub13qzSXRfqlR0ab fke/Tfix989ZWISqNuNZNkNSrxs6Sncy1tbLlzOQxjDXhGEXyeBZaGOQl2hf5K7gtx Pjt0WVdbk0J5Vi5yYcGEPIisWKAXHQGwLEFCm//fs7HXqFebJIV7MUis33R4yyiVDL ql2eSQ34ZhXQj3iGxI0okVBaTkewtnVgs1re7kh+pk4JATXJv7QA1jn8RX6bgVtb+o sNo/nIPx3CCRw== Received: by wens.tw (Postfix, from userid 1000) id 535005FC12; Fri, 1 Apr 2022 01:18:33 +0800 (CST) From: Chen-Yu Tsai To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Chen-Yu Tsai , Russell King , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: stmmac: Fix unset max_speed difference between DT and non-DT platforms Date: Fri, 1 Apr 2022 01:18:27 +0800 Message-Id: <20220331171827.12483-1-wens@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220331_101841_763858_CAFE5E75 X-CRM114-Status: GOOD ( 15.97 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chen-Yu Tsai In commit 9cbadf094d9d ("net: stmmac: support max-speed device tree property"), when DT platforms don't set "max-speed", max_speed is set to -1; for non-DT platforms, it stays the default 0. Prior to commit eeef2f6b9f6e ("net: stmmac: Start adding phylink support"), the check for a valid max_speed setting was to check if it was greater than zero. This commit got it right, but subsequent patches just checked for non-zero, which is incorrect for DT platforms. In commit 92c3807b9ac3 ("net: stmmac: convert to phylink_get_linkmodes()") the conversion switched completely to checking for non-zero value as a valid value, which caused 1000base-T to stop getting advertised by default. Instead of trying to fix all the checks, simply leave max_speed alone if DT property parsing fails. Fixes: 9cbadf094d9d ("net: stmmac: support max-speed device tree property") Fixes: 92c3807b9ac3 ("net: stmmac: convert to phylink_get_linkmodes()") Signed-off-by: Chen-Yu Tsai Acked-by: Russell King (Oracle) --- This was first noticed on ROC-RK3399-PC, and also observed on ROC-RK3328-CC. The fix was tested on ROC-RK3328-CC and Libre Computer ALL-H5-ALL-CC. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 5d29f336315b..11e1055e8260 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -431,8 +431,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) plat->phylink_node = np; /* Get max speed of operation from device tree */ - if (of_property_read_u32(np, "max-speed", &plat->max_speed)) - plat->max_speed = -1; + of_property_read_u32(np, "max-speed", &plat->max_speed); plat->bus_id = of_alias_get_id(np, "ethernet"); if (plat->bus_id < 0)