Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1464345pxb; Wed, 10 Feb 2021 08:55:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCUugca1QHLCQs6NUwErer4/v0toJgWje6T0UQyMaRc32VBrcK7PtNBOXWEWQca+Q6R/1q X-Received: by 2002:a17:906:1613:: with SMTP id m19mr3876141ejd.344.1612976111803; Wed, 10 Feb 2021 08:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612976111; cv=none; d=google.com; s=arc-20160816; b=G4BNtlMD/NLNvkP7hspvYM5cN1eB++MPnnQKCAJUvzSPe2IW/hppj5fe42qIYcKZDx R79NQbAvNhZYe5ZQwyGOkJTgJjs+PQKrFXOuUQg9xWJXCv6Uu43b71CvyMmy5XldmZFu WGBgsPFD9quvMzSULLbKGHqK77YFqP8M8ognAVP510N18C9nstbuI6iAqN4VM4rY2PxQ WeSdYBz24wmhxckDtYyCphk7shuFj/nEUH04Enf1oSoCe7aaUa78EC8PkzOTcKzIYH7s WKvBpcvNiGvaHW3BAOC8je6RSRyrEqLRPvlzpj+z+ZX3vbTxRKXvA7XYsSeudU1OBX3a ZWRg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8z74YA9u7OTNH86B6ykAGcC3JMF/hpZrJUUUCN8w2Ac=; b=La0BvpOhcyKPRTRNwh0hi6aShM4Evt+8YhG9KbBfUyUHglcKiCMRDp0fB3qfAY4QqI idihbZHmlJXFewJHq8S+IC9A9L7Q3tlfuP6rRs+WjSOaM8EKjXlMau0BbA/46R4UQGHb 0GpEXNfOQiyEzyLgJfRpvx2XeZ5CiFX0rzWh8j2AWb1PYFWqWJ+W8Xr7h7nGc46Cuyzp rDVe77pxSA6Vz2Kkqxt+sNqxLA2VirlUZGMSkH+qJQipHdFa/xNWB7LjWE5N9Ew6npQq 2+0gXYvBgl38W01f+rje6VrYOof4WoO6HcQtZlwtKgg9xecabRpqrgzQ5whrxSEnIFAJ qPxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=igsGsim5; 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 a12si1759207edn.568.2021.02.10.08.54.48; Wed, 10 Feb 2021 08:55:11 -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; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=igsGsim5; 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 S232323AbhBJQxc (ORCPT + 99 others); Wed, 10 Feb 2021 11:53:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233097AbhBJQt4 (ORCPT ); Wed, 10 Feb 2021 11:49:56 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D8C3C06174A; Wed, 10 Feb 2021 08:49:16 -0800 (PST) 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 97C2C23E79; Wed, 10 Feb 2021 17:47:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1612975679; 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=8z74YA9u7OTNH86B6ykAGcC3JMF/hpZrJUUUCN8w2Ac=; b=igsGsim5nyL8O3oFtmDZr/9eu3cqmLQD+0ItFt9W71ToGsgI9YpBmMi6LVGkGfq2Eh1ODm BMtuIDxJOkZmxH0nU4zjQQFkmBWuvXtavQikkvDNoSLkFklS8mbsAAakYKpeReB3kBFbn6 jI9UJdwVQybX6KZ0JLBvhDehZ/ClCIc= 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 v2 6/9] net: phy: icplus: don't set APS_EN bit on IP101G Date: Wed, 10 Feb 2021 17:47:43 +0100 Message-Id: <20210210164746.26336-7-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210164746.26336-1-michael@walle.cc> References: <20210210164746.26336-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 --- 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 1bc9baa9048f..2108f1dfa158 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) @@ -380,7 +393,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, @@ -391,7 +404,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, -- 2.20.1