mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Lukasz Majewski <lukma@denx.de>,
	"David S . Miller" <davem@davemloft.net>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Subject: [PATCH review for 4.9 23/50] net: phy: dp83867: Recover from "port mirroring" N/A MODE4
Date: Sat, 7 Oct 2017 22:36:51 +0000	[thread overview]
Message-ID: <20171007223636.24797-23-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171007223636.24797-1-alexander.levin@verizon.com>

From: Lukasz Majewski <lukma@denx.de>

[ Upstream commit ac6e058b75be71208e98a5808453aae9a17be480 ]

The DP83867 when not properly bootstrapped - especially with LED_0 pin -
can enter N/A MODE4 for "port mirroring" feature.

To provide normal operation of the PHY, one needs not only to explicitly
disable the port mirroring feature, but as well stop some IC internal
testing (which disables RGMII communication).

To do that the STRAP_STS1 (0x006E) register must be read and RESERVED bit
11 examined. When it is set, the another RESERVED bit (11) at PHYCR
(0x0010) register must be clear to disable testing mode and enable RGMII
communication.

Thorough explanation of the problem can be found at following e2e thread:
"DP83867IR: Problem with RESERVED bits in PHY Control Register (PHYCR) -
Linux driver"

https://e2e.ti.com/support/interface/ethernet/f/903/p/571313/2096954#2096954

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/phy/dp83867.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 01cf094bee18..8f8496102926 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -33,6 +33,7 @@
 
 /* Extended Registers */
 #define DP83867_RGMIICTL	0x0032
+#define DP83867_STRAP_STS1	0x006E
 #define DP83867_RGMIIDCTL	0x0086
 
 #define DP83867_SW_RESET	BIT(15)
@@ -56,9 +57,13 @@
 #define DP83867_RGMII_TX_CLK_DELAY_EN		BIT(1)
 #define DP83867_RGMII_RX_CLK_DELAY_EN		BIT(0)
 
+/* STRAP_STS1 bits */
+#define DP83867_STRAP_STS1_RESERVED		BIT(11)
+
 /* PHY CTRL bits */
 #define DP83867_PHYCR_FIFO_DEPTH_SHIFT		14
 #define DP83867_PHYCR_FIFO_DEPTH_MASK		(3 << 14)
+#define DP83867_PHYCR_RESERVED_MASK		BIT(11)
 
 /* RGMIIDCTL bits */
 #define DP83867_RGMII_TX_CLK_DELAY_SHIFT	4
@@ -141,7 +146,7 @@ static int dp83867_of_init(struct phy_device *phydev)
 static int dp83867_config_init(struct phy_device *phydev)
 {
 	struct dp83867_private *dp83867;
-	int ret, val;
+	int ret, val, bs;
 	u16 delay;
 
 	if (!phydev->priv) {
@@ -164,6 +169,22 @@ static int dp83867_config_init(struct phy_device *phydev)
 			return val;
 		val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
 		val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);
+
+		/* The code below checks if "port mirroring" N/A MODE4 has been
+		 * enabled during power on bootstrap.
+		 *
+		 * Such N/A mode enabled by mistake can put PHY IC in some
+		 * internal testing mode and disable RGMII transmission.
+		 *
+		 * In this particular case one needs to check STRAP_STS1
+		 * register's bit 11 (marked as RESERVED).
+		 */
+
+		bs = phy_read_mmd_indirect(phydev, DP83867_STRAP_STS1,
+					   DP83867_DEVADDR);
+		if (bs & DP83867_STRAP_STS1_RESERVED)
+			val &= ~DP83867_PHYCR_RESERVED_MASK;
+
 		ret = phy_write(phydev, MII_DP83867_PHYCTRL, val);
 		if (ret)
 			return ret;
-- 
2.11.0

  parent reply	other threads:[~2017-10-07 22:48 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07 22:36 [PATCH review for 4.9 01/50] cpufreq: Do not clear real_cpus mask on policy init Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 03/50] staging: fsl-mc: Add missing header Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 02/50] crypto: ccp - Set the AES size field for all modes Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 07/50] mmc: s3cmci: include linux/interrupt.h for tasklet_struct Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 04/50] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 05/50] PM / wakeirq: report a wakeup_event on dedicated wekup irq Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 06/50] scsi: megaraid_sas: Do not set fp_possible if TM capable for non-RW syspdIO, change fp_possible to bool Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 08/50] mfd: ab8500-sysctrl: Handle probe deferral Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 10/50] bnxt_en: Added PCI IDs for BCM57452 and BCM57454 ASICs Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 09/50] mfd: axp20x: Fix axp288 PEK_DBR and PEK_DBF irqs being swapped Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 11/50] staging: rtl8712u: Fix endian settings for structs describing network packets Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 15/50] ext4: do not use stripe_width if it is not set Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 14/50] ext4: fix stripe-unaligned allocations Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 13/50] net: mvneta: fix build errors when linux/phy*.h is removed from net/dsa.h Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 12/50] PCI/MSI: Return failure when msix_setup_entries() fails Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 18/50] drm/amdgpu: when dpm disabled, also need to stop/start vce Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 17/50] i2c: riic: correctly finish transfers Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 19/50] perf tools: Only increase index if perf_evsel__new_idx() succeeds Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 16/50] net/ena: change driver's default timeouts Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 21/50] drm/fsl-dcu: check for clk_prepare_enable() error Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` Levin, Alexander (Sasha Levin) [this message]
2017-10-07 22:36 ` [PATCH review for 4.9 20/50] iwlwifi: mvm: use the PROBE_RESP_QUEUE to send deauth to unknown station Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 22/50] clocksource/drivers/arm_arch_timer: Add dt binding for hisilicon-161010101 erratum Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 24/50] [media] cx231xx: Fix I2C on Internal Master 3 Bus Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 26/50] clk: sunxi-ng: Check kzalloc() for errors and cleanup error path Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 25/50] ath10k: fix reading sram contents for QCA4019 Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 27/50] drm/msm/dsi: Set msm_dsi->encoders before initializing bridge Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 28/50] mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events() Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 29/50] dmaengine: sun6i: allow build on ARM64 platforms (sun50i) Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 30/50] gpio: mcp23s08: Select REGMAP/REGMAP_I2C to fix build error Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 32/50] scsi: aacraid: Process Error for response I/O Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 31/50] xen/manage: correct return value check on xenbus_scanf() Levin, Alexander (Sasha Levin)
2017-10-10 12:49   ` Boris Ostrovsky
2017-10-24  1:39     ` Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 33/50] platform/x86: intel_mid_thermal: Fix module autoload Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 35/50] staging: lustre: hsm: stack overrun in hai_dump_data_field Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 36/50] staging: lustre: ptlrpc: skip lock if export failed Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 34/50] staging: lustre: llite: don't invoke direct_IO for the EOF case Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 40/50] vfs: open() with O_CREAT should not create inodes with unknown ids Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 37/50] staging: lustre: lmv: Error not handled for lmv_find_target Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 38/50] brcmfmac: check brcmf_bus_get_memdump result for error Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 39/50] ASoC: omap-mcbsp: Add PM QoS support for McBSP to prevent glitches Levin, Alexander (Sasha Levin)
2017-10-09  8:36   ` Mark Brown
2017-10-24  2:12     ` Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 44/50] s390/dasd: check for device error pointer within state change interrupts Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 41/50] ASoC: Intel: boards: remove .pm_ops in all Atom/DPCM machine drivers Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 43/50] mei: return error on notification request to a disconnected client Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 42/50] [media] exynos4-is: fimc-is: Unmap region obtained by of_iomap() Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 45/50] s390/prng: Adjust generation of entropy to produce real 256 bits Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 47/50] [media] bt8xx: fix memory leak Levin, Alexander (Sasha Levin)
2017-10-07 22:36 ` [PATCH review for 4.9 46/50] s390/crypto: Extend key length check for AES-XTS in fips mode Levin, Alexander (Sasha Levin)

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=20171007223636.24797-23-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukma@denx.de \
    --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

all inboxes | Powered by JetHome®