Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5587102imm; Tue, 12 Jun 2018 10:02:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ1o0yt2lnP66pSiyUwHFUnrK+7sWD/AuzEkUSB3F5zU4C7M7yvWnD7SD0dF9OI8la8fiLa X-Received: by 2002:a65:6517:: with SMTP id x23-v6mr1052726pgv.268.1528822923797; Tue, 12 Jun 2018 10:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528822923; cv=none; d=google.com; s=arc-20160816; b=rLnegE8I8Xx387svGSV+A9+9BCWMxTrWxwyhMFPxkgpgnOPxtbBpThWxgU/t5CSubE nUc0t15jG8PwQiwsZNrfe1wvn+hKsfHdLgn2Ae10L4WSQ0fK80JwM4vxhYK+M+kJldHZ kJjbAXQbhFbHXusLn2he63qUhWq0vXUtsokUVigTg0dSIBX4KALI+CPw7JnuhTSSZp+V GnJV7xIL3cKpEQUcPV0BUo+Leq+paw97/+fal/YTVSBv0FJTHvn+R4aalp0GvMJbPkcs ad1oux0CAwuX+EVMTAfkVD038uyrh65DhtPBJJRjKtlL1Rb7hH24OZBEoFbGEhTXD1Ex aKmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Q/0n2YD9p+mr0VxKvGbkiNTkSmo8YAQuYnpt3PFJum0=; b=r1FAQHJ5Sd1Llt9s+Lg2S8GuxMcRqQEgX1qKDJVVVSWXXwoB9fprhKZoDxn47vETDP rFpo6KjpYwW1dreu8/N7pu1/8xcrW4r1YI8spphhieymvyinNjvXGTHM9U34HbQ5RY17 r6Un9j525aJrh3aEP2pTirgsGMXCoAdH2Bt/0nxbQbNKzamIZoJvaQr4rPYpATvdUae0 PIPmhVY44TXSwGOQZp3SJNMDrtWQVDbD6q/OTIYWhWljtRs3LPAdbRvASBDAUkQk4J7g v1idMiT0KsO9LmtWplKM7Xcf0+ni1BydlAES1y4TP851hkDs51nYTG3STLVCK8/D18ak XAMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dIAMP8Si; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2-v6si499023pff.18.2018.06.12.10.01.49; Tue, 12 Jun 2018 10:02:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dIAMP8Si; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934725AbeFLQxo (ORCPT + 99 others); Tue, 12 Jun 2018 12:53:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:53462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933929AbeFLQxl (ORCPT ); Tue, 12 Jun 2018 12:53:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B745208B9; Tue, 12 Jun 2018 16:53:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528822420; bh=xmDCKy64HBWBABCzuuSAkqoE+Fith57GE2vBPtrXCSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIAMP8SiAcuaHasfYEsOiRlx8CbozXMXcmcRJW328qwBupWmrFuOhr7NkvnUckGzP DqO67HmyfBhocPMjJEDy1ZCL/KB0awPtzEJLPKHlwf096OcbT+Np+XSpS5Z43TAry4 W18dTRwuVgk7vok2MTlezXuycN4nQlTu/9yfkSLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 4.4 23/24] net: phy: broadcom: Fix bcm_write_exp() Date: Tue, 12 Jun 2018 18:52:07 +0200 Message-Id: <20180612164817.823135174@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612164816.587001852@linuxfoundation.org> References: <20180612164816.587001852@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit 79fb218d97980d4fee9a64f4c8ff05289364ba25 ] On newer PHYs, we need to select the expansion register to write with setting bits [11:8] to 0xf. This was done correctly by bcm7xxx.c prior to being migrated to generic code under bcm-phy-lib.c which unfortunately used the older implementation from the BCM54xx days. Fix this by creating an inline stub: bcm_write_exp_sel() which adds the correct value (MII_BCM54XX_EXP_SEL_ER) and update both the Cygnus PHY and BCM7xxx PHY drivers which require setting these bits. broadcom.c is unchanged because some PHYs even use a different selector method, so let them specify it directly (e.g: SerDes secondary selector). Fixes: a1cba5613edf ("net: phy: Add Broadcom phy library for common interfaces") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/bcm-cygnus.c | 6 +++--- drivers/net/phy/bcm-phy-lib.h | 7 +++++++ drivers/net/phy/bcm7xxx.c | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) --- a/drivers/net/phy/bcm-cygnus.c +++ b/drivers/net/phy/bcm-cygnus.c @@ -61,17 +61,17 @@ static int bcm_cygnus_afe_config(struct return rc; /* make rcal=100, since rdb default is 000 */ - rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB1, 0x10); + rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB1, 0x10); if (rc < 0) return rc; /* CORE_EXPB0, Reset R_CAL/RC_CAL Engine */ - rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB0, 0x10); + rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x10); if (rc < 0) return rc; /* CORE_EXPB0, Disable Reset R_CAL/RC_CAL Engine */ - rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB0, 0x00); + rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x00); return 0; } --- a/drivers/net/phy/bcm-phy-lib.h +++ b/drivers/net/phy/bcm-phy-lib.h @@ -14,11 +14,18 @@ #ifndef _LINUX_BCM_PHY_LIB_H #define _LINUX_BCM_PHY_LIB_H +#include #include int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val); int bcm_phy_read_exp(struct phy_device *phydev, u16 reg); +static inline int bcm_phy_write_exp_sel(struct phy_device *phydev, + u16 reg, u16 val) +{ + return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val); +} + int bcm_phy_write_misc(struct phy_device *phydev, u16 reg, u16 chl, u16 value); int bcm_phy_read_misc(struct phy_device *phydev, --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c @@ -48,10 +48,10 @@ static void r_rc_cal_reset(struct phy_device *phydev) { /* Reset R_CAL/RC_CAL Engine */ - bcm_phy_write_exp(phydev, 0x00b0, 0x0010); + bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0010); /* Disable Reset R_AL/RC_CAL Engine */ - bcm_phy_write_exp(phydev, 0x00b0, 0x0000); + bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0000); } static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev)