From patchwork Wed Feb 10 21:08:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 12081745 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3EF0C433E9 for ; Wed, 10 Feb 2021 21:10:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABF1C64EDC for ; Wed, 10 Feb 2021 21:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233561AbhBJVKn (ORCPT ); Wed, 10 Feb 2021 16:10:43 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:35211 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbhBJVJC (ORCPT ); Wed, 10 Feb 2021 16:09:02 -0500 Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id C928023E79; Wed, 10 Feb 2021 22:08:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1612991300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7SGmR1b124kFMup1lsRUfWs7YWWxzAWy9HWqUpTt6Gk=; b=FTLRFq9B6UtGgBriACGB7lv5SYY7BkFTKU1kRgAqJnisi5igUErwylJZndUuy3z7EfPVsB RGcObMWSsP77tKsudqXCFJmI3LJ9cw2aQpuhpxiDCd83XaL/38kPkqgcVHUIVLgycTfwKk I5RR+NIPKp4pP6TcMg1w7z1IV55KT7s= From: Michael Walle To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Michael Walle Subject: [PATCH net-next v3 6/9] net: phy: icplus: don't set APS_EN bit on IP101G Date: Wed, 10 Feb 2021 22:08:06 +0100 Message-Id: <20210210210809.30125-7-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210210809.30125-1-michael@walle.cc> References: <20210210210809.30125-1-michael@walle.cc> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This bit is reserved as 'always-write-1'. While this is not a particular error, because we are only setting it, guard it by checking the model to prevent errors in the future. Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn --- Changes since v2: - none Changes since v1: - dropped the model check. Instead use two different functions. Andrew, I've dropped your Reviewed-by because of this. drivers/net/phy/icplus.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index dee4f4d988a2..bc2b58061507 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -208,10 +208,10 @@ static int ip101a_g_probe(struct phy_device *phydev) return 0; } -static int ip101a_g_config_init(struct phy_device *phydev) +static int ip101a_g_config_intr_pin(struct phy_device *phydev) { struct ip101a_g_phy_priv *priv = phydev->priv; - int err, c; + int err; /* configure the RXER/INTR_32 pin of the 32-pin IP101GR if needed: */ switch (priv->sel_intr32) { @@ -241,11 +241,24 @@ static int ip101a_g_config_init(struct phy_device *phydev) break; } + return 0; +} + +static int ip101a_config_init(struct phy_device *phydev) +{ + int ret; + /* Enable Auto Power Saving mode */ - c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); - c |= IP101A_G_APS_ON; + ret = phy_set_bits(phydev, IP10XX_SPEC_CTRL_STATUS, IP101A_G_APS_ON); + if (ret) + return ret; - return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); + return ip101a_g_config_intr_pin(phydev); +} + +static int ip101g_config_init(struct phy_device *phydev) +{ + return ip101a_g_config_intr_pin(phydev); } static int ip101a_g_ack_interrupt(struct phy_device *phydev) @@ -379,7 +392,7 @@ static struct phy_driver icplus_driver[] = { .probe = ip101a_g_probe, .config_intr = ip101a_g_config_intr, .handle_interrupt = ip101a_g_handle_interrupt, - .config_init = ip101a_g_config_init, + .config_init = ip101a_config_init, .soft_reset = genphy_soft_reset, .suspend = genphy_suspend, .resume = genphy_resume, @@ -389,7 +402,7 @@ static struct phy_driver icplus_driver[] = { .probe = ip101a_g_probe, .config_intr = ip101a_g_config_intr, .handle_interrupt = ip101a_g_handle_interrupt, - .config_init = ip101a_g_config_init, + .config_init = ip101g_config_init, .soft_reset = genphy_soft_reset, .suspend = genphy_suspend, .resume = genphy_resume,