From patchwork Wed Oct 19 13:28:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13011786 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98603C4332F for ; Wed, 19 Oct 2022 13:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbiJSNm0 (ORCPT ); Wed, 19 Oct 2022 09:42:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJSNlq (ORCPT ); Wed, 19 Oct 2022 09:41:46 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC98710AA for ; Wed, 19 Oct 2022 06:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6rqIsGiuGIbdm1Qj9PHgbZHxsJ3BDKwgjZR6ybGW1JM=; b=ojrZNNq6T8N9/HnXv+VurFk6QS C2F2xdAvk1e+PCHbnhkwP2kNAZDZAlgtCas3tzkB0YwR2u/pi93ad21DeQKOcgLE1l+vwikasNrVz c7R/mGeb4KQL0rqLlB8u6Diu9l4X9mwVcRQXMYMz1uxoVHHRUfV/6+ymOK1v84D9vlz9gWCd93rrs no3kS6lLt0+dX9hiovmXDJCUfhfcaTNvAaL8ajszGTWwg8ccAyCiZCcGj3ReXBLN56Lwog8uPWBhf +Q+HIwDbsyv6R4ZyyXJXe59xxCsNO2brdYKdhy+jK17TfVGii8NmGpsAzcd+BOzIRXmf01JrJybKt iXd2oBbg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55782 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ol97w-0005jQ-Ue; Wed, 19 Oct 2022 14:28:56 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ol97w-00EDSd-CI; Wed, 19 Oct 2022 14:28:56 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski Cc: Andrew Lunn , Heiner Kallweit , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH net-next 3/7] net: sfp: ignore power level 2 prior to SFF-8472 Rev 10.2 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 19 Oct 2022 14:28:56 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Power level 2 was introduced by SFF-8472 revision 10.2. Ignore the power declaration bit for modules that are not compliant with at least this revision. This should remove any spurious indication of 1.5W modules. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- drivers/net/phy/sfp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index f7ad4d5d9041..a7635b02524a 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1761,7 +1761,8 @@ static int sfp_module_parse_power(struct sfp *sfp) u32 power_mW = 1000; bool supports_a2; - if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_POWER_DECL)) + if (sfp->id.ext.sff8472_compliance >= SFP_SFF8472_COMPLIANCE_REV10_2 && + sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_POWER_DECL)) power_mW = 1500; if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_HIGH_POWER_LEVEL)) power_mW = 2000;