From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.9 26/31] net: phy: broadcom: Fix bcm_write_exp()
Date: Tue, 12 Jun 2018 18:46:29 +0200 [thread overview]
Message-ID: <20180612164621.823639935@linuxfoundation.org> (raw)
In-Reply-To: <20180612164620.797338191@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ 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 <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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 <linux/brcmphy.h>
#include <linux/phy.h>
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)
next prev parent reply other threads:[~2018-06-12 16:47 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 16:46 [PATCH 4.9 00/31] 4.9.108-stable review Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 01/31] tpm: do not suspend/resume if power stays on Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 02/31] tpm: self test failure should not cause suspend to fail Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 03/31] mmap: introduce sane default mmap limits Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 04/31] mmap: relax file size limit for regular files Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 05/31] btrfs: define SUPER_FLAG_METADUMP_V2 Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 07/31] drm: set FMODE_UNSIGNED_OFFSET for drm files Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 08/31] bnx2x: use the right constant Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 09/31] dccp: dont free ccid2_hc_tx_sock struct in dccp_disconnect() Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 10/31] enic: set DMA mask to 47 bit Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 11/31] ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 12/31] ipv4: remove warning in ip_recv_error Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 13/31] isdn: eicon: fix a missing-check bug Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 14/31] kcm: Fix use-after-free caused by clonned sockets Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 15/31] netdev-FAQ: clarify DaveMs position for stable backports Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 16/31] net/packet: refine check for priv area size Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 18/31] packet: fix reserve calculation Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 19/31] qed: Fix mask for physical address in ILT entry Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 20/31] sctp: not allow transport timeout value less than HZ/5 for hb_timer Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 21/31] team: use netdev_features_t instead of u32 Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 22/31] vhost: synchronize IOTLB message with dev cleanup Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 23/31] vrf: check the original netdevice for generating redirect Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 24/31] net/mlx4: Fix irq-unsafe spinlock usage Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 25/31] rtnetlink: validate attributes in do_setlink() Greg Kroah-Hartman
2018-06-12 16:46 ` Greg Kroah-Hartman [this message]
2018-06-12 16:46 ` [PATCH 4.9 27/31] net: metrics: add proper netlink validation Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 28/31] KVM: VMX: Expose SSBD properly to guests, 4.9 supplement Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 29/31] dm bufio: avoid false-positive Wmaybe-uninitialized warning Greg Kroah-Hartman
2018-06-12 16:46 ` [PATCH 4.9 30/31] objtool: Fix gcov check for older versions of GCC Greg Kroah-Hartman
2018-06-12 17:10 ` [PATCH 4.9 00/31] 4.9.108-stable review Nathan Chancellor
2018-06-12 17:45 ` Greg Kroah-Hartman
2018-06-12 20:58 ` Shuah Khan
2018-06-13 4:41 ` Greg Kroah-Hartman
2018-06-13 13:49 ` Guenter Roeck
2018-06-13 14:13 ` Rafael Tinoco
2018-06-13 14:42 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180612164621.823639935@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).