Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2182246pxb; Sat, 14 Nov 2020 17:04:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzl6kNMA9ExHH2Le8xVbXnEZH4sM+zbkgnzV9bBHa4WyjX9LGpsGlqskWg8I67fNLc6J1ug X-Received: by 2002:a17:906:374b:: with SMTP id e11mr8385046ejc.339.1605402250882; Sat, 14 Nov 2020 17:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605402250; cv=none; d=google.com; s=arc-20160816; b=uXlugKFawDdrOY+nzGhM37Qd8cgILomQA9v7rh1Sxpm7zaDYGI1M7CdohrPw7wkJ8x ivrHy1MU0D1aVTw886bgcsuLQPmynnp4EdoBhJSD/i1XGgZE0AS9QTH/lM0AvQTDre4K G/VCbBU8SN+VYBvi1Y0aS19NgHFfbl4JcfShiDf+d7Tpsib19Typs+quGArRdiXLHF4A bdfw4S035DuwbhianJKyLCuTdLtJSVYjIL2DAbpuP5T0SBqvPy/OIlfRUy1wfRJRUG/z YcKUJdYL2kf4vJTBNeba/5SSSCtgbUGfBIXVdXQ2DbqKWPHh835sJ+D88c7KhfpzgiE1 Xj/g== 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 :message-id:date:subject:cc:to:from; bh=PxyWQimYUI4GP95IQcQ55Y3n+hVGISkOqIUFz7wpR0s=; b=I0UzeIiLpCSiusULMW4+edbpgbBiHiobCMEHjFZINogrUh/fhqms2vZFhj/A/OgA68 Gb8LOM8jkEA8vhVe59gNfnwH80g+BQQpwk+ieWJuTMj2D6T4HKhAc7kS20MMpHYV7AD8 NMtxEoepP0zs3JtZOoKcfY2pFNOcW57slG9lTo2fFMHx7BlWeIqIsEi1Pv3mp84MrccQ Vme/iIT6d2azPUkTvPZa9e/0zG/9IUO7HjLFLGt0sZvOazGv3IFN/6yYi08iPywoXTJ9 DL9SrzCg2tJ8KwBN7z5eRH2ZvA0QubeXX501zdyX2v4k+UuIoia9iQCqRpZ1gnpQLJYX EzNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si9731418edp.431.2020.11.14.17.03.47; Sat, 14 Nov 2020 17:04:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726356AbgKOAmH (ORCPT + 99 others); Sat, 14 Nov 2020 19:42:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:50546 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgKOAmG (ORCPT ); Sat, 14 Nov 2020 19:42:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7AEDAAD43; Sun, 15 Nov 2020 00:42:04 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: "David S . Miller" , Thomas Petazzoni Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Michal Hrusecki , Tomas Hlavacek , =?UTF-8?q?Bed=C5=99icha=20Ko=C5=A1atu?= , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Sascha Hauer , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Andrew Lunn , Jason Cooper , Gregory CLEMENT , Jakub Kicinski , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: mvneta: Fix validation of 2.5G HSGMII without comphy Date: Sun, 15 Nov 2020 01:41:51 +0100 Message-Id: <20201115004151.12899-1-afaerber@suse.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 1a642ca7f38992b086101fe204a1ae3c90ed8016 (net: ethernet: mvneta: Add 2500BaseX support for SoCs without comphy) added support for 2500BaseX. In case a comphy is not provided, mvneta_validate()'s check state->interface == PHY_INTERFACE_MODE_2500BASEX could never be true (it would've returned with empty bitmask before), so that 2500baseT_Full and 2500baseX_Full do net get added to the mask. This causes phylink_sfp_config() to fail validation of 2.5G SFP support. Address this by adding 2500baseX_Full and 2500baseT_Full to the mask for state->interface == PHY_INTERFACE_MODE_NA as well. Also handle PHY_INTERFACE_MODE_2500BASEX in two checks for allowed modes and update a comment. Tested with 2.5G and 1G SFPs on Turris Omnia before assigning comphy. Fixes: 1a642ca7f389 ("net: ethernet: mvneta: Add 2500BaseX support for SoCs without comphy") Cc: Sascha Hauer Cc: David S. Miller Cc: Marek Behún Cc: Andrew Lunn Cc: Uwe Kleine-König Cc: Jason Cooper Cc: Gregory CLEMENT Signed-off-by: Andreas Färber --- drivers/net/ethernet/marvell/mvneta.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 54b0bf574c05..c5016036de3a 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3812,10 +3812,11 @@ static void mvneta_validate(struct phylink_config *config, struct mvneta_port *pp = netdev_priv(ndev); __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - /* We only support QSGMII, SGMII, 802.3z and RGMII modes */ + /* We only support QSGMII, SGMII, HSGMII, 802.3z and RGMII modes */ if (state->interface != PHY_INTERFACE_MODE_NA && state->interface != PHY_INTERFACE_MODE_QSGMII && state->interface != PHY_INTERFACE_MODE_SGMII && + state->interface != PHY_INTERFACE_MODE_2500BASEX && !phy_interface_mode_is_8023z(state->interface) && !phy_interface_mode_is_rgmii(state->interface)) { bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); @@ -3834,7 +3835,8 @@ static void mvneta_validate(struct phylink_config *config, phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseX_Full); } - if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) { + if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX + || state->interface == PHY_INTERFACE_MODE_NA) { phylink_set(mask, 2500baseT_Full); phylink_set(mask, 2500baseX_Full); } @@ -5038,6 +5040,7 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) if (phy_mode != PHY_INTERFACE_MODE_QSGMII && phy_mode != PHY_INTERFACE_MODE_SGMII && + phy_mode != PHY_INTERFACE_MODE_2500BASEX && !phy_interface_mode_is_8023z(phy_mode) && !phy_interface_mode_is_rgmii(phy_mode)) return -EINVAL; -- 2.28.0