From patchwork Fri Oct 21 15:08:29 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: 13014892 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 7BB2BC43219 for ; Fri, 21 Oct 2022 15:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbiJUPIl (ORCPT ); Fri, 21 Oct 2022 11:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbiJUPIj (ORCPT ); Fri, 21 Oct 2022 11:08:39 -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 80FC826103; Fri, 21 Oct 2022 08:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GOAGy8/6xEfh0KekibQjm9pbCbT1mmXCmKJqDE3M+nU=; b=Zfe9ZmaGlXLOWHC+DwN0yNa/XH fAL/I3Z4TCUwg0WZe0TpNZJJ1y8gRnSX4SPYhbjTezVmWNgI/N6VnKMPGjQ5ILgDUkVkX559yxY9u 3XNCpoQjU1cALZLH+fhwahtxWptUFQ+GXayvt3GpAJTrQWqXaEzLCy5LijSBE5Wyroo6CTOzJ6dmM 3NMg93OBMoRMUfMdHtZeUuSp0iRyvVqTRmxOMxMiKsrKNz+3etVLyAmNisF5jDxwDdi6KmWnpr9xA 5IzvMnB4t98ZenN6G0Y3aVDibxFKQV2Lm4vvWTteaMuOvv/hakF/jwtlNjVYHlEV+3nLh8M/kC9Fb miAL2j7A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34868) 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 1oltdQ-0000Ln-2P; Fri, 21 Oct 2022 16:08:32 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oltdN-0004FO-Ne; Fri, 21 Oct 2022 16:08:29 +0100 Date: Fri, 21 Oct 2022 16:08:29 +0100 From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski Cc: Andrew Lunn , devicetree@vger.kernel.org, Eric Dumazet , Heiner Kallweit , Krzysztof Kozlowski , netdev@vger.kernel.org, Paolo Abeni , Rob Herring Subject: [PATCH net-next v2 0/7] net: sfp: improve high power module implementation Message-ID: MIME-Version: 1.0 Content-Disposition: inline Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Hi, This series aims to improve the power level switching between standard level 1 and the higher power levels. The first patch updates the DT binding documentation to include the minimum and default of 1W, which is the base level that every SFP cage must support. Hence, it makes sense to document this in the binding. The second patch enforces a minimum of 1W when parsing the firmware description, and optimises the code for that case; there's no need to check for SFF8472 compliance since we will not need to touch the A2h registers. Patch 3 validates that the module supports SFF-8472 rev 10.2 before checking for power level 2 - rev 10.2 is where support for power levels was introduced, so if the module doesn't support this revision, it doesn't support power levels. Setting the power level 2 declaration bit is likely to be spurious. Patch 4 does the same for power level 3, except this was introduced in SFF-8472 rev 11.9. The revision code was never updated, so we use the rev 11.4 to signify this. Patch 5 cleans up the code - rather than using BIT(0), we now use a properly named value for the power level select bit. Patch 6 introduces a read-modify-write helper. Patch 7 gets rid of the DM7052 hack (which sets a power level declaration bit but is not compatible with SFF-8472 rev 10.2, and the module does not implement the A2h I2C address.) Series tested with my DM7052. v2: update sff.sfp.yaml with Rob's feedback Documentation/devicetree/bindings/net/sff,sfp.yaml | 3 +- drivers/net/phy/sfp.c | 85 +++++++++++----------- include/linux/sfp.h | 2 + 3 files changed, 48 insertions(+), 42 deletions(-)