public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/12] net: phy: ti: Recover from "port mirroring" N/A MODE4
Date: Fri, 15 Jun 2018 09:24:34 +0200	[thread overview]
Message-ID: <20180615092434.3e1d65e2@jawa> (raw)
In-Reply-To: <1528969736-44037-6-git-send-email-j.hagemann@phytec.de>

Hi Janine,

> 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
> 
> Based on commit 'ac6e058b75be71208e98a5808453aae9a17be480' of
> mainline linux kernel.
> 

Thanks for bringing it into u-boot.

Acked-by: Lukasz Majewski <lukma@denx.de>

> Signed-off-by: Janine Hagemann <j.hagemann@phytec.de>
> ---
>  drivers/net/phy/ti.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index 086ea4a..16c8929 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -26,6 +26,7 @@ DECLARE_GLOBAL_DATA_PTR;
>  /* Extended Registers */
>  #define DP83867_CFG4		0x0031
>  #define DP83867_RGMIICTL	0x0032
> +#define DP83867_STRAP_STS1	0x006E
>  #define DP83867_RGMIIDCTL	0x0086
>  #define DP83867_IO_MUX_CFG	0x0170
>  
> @@ -50,6 +51,9 @@ DECLARE_GLOBAL_DATA_PTR;
>  #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)
> @@ -251,7 +255,7 @@ static int dp83867_config(struct phy_device
> *phydev) {
>  	struct dp83867_private *dp83867;
>  	unsigned int val, delay, cfg2;
> -	int ret;
> +	int ret, bs;
>  
>  	if (!phydev->priv) {
>  		dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
> @@ -282,6 +286,24 @@ static int dp83867_config(struct phy_device
> *phydev) 
>  		if (ret)
>  			goto err_out;
> +
> +		/* 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,
> phydev->addr);
> +		if (bs & DP83867_STRAP_STS1_RESERVED)
> +			val &= ~DP83867_PHYCR_RESERVED_MASK;
> +
> +		phy_write(phydev, MDIO_DEVAD_NONE,
> MII_DP83867_PHYCTRL, val); +
>  	} else if (phy_interface_is_sgmii(phydev)) {
>  		phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
>  			  (BMCR_ANENABLE | BMCR_FULLDPLX |
> BMCR_SPEED1000));




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180615/0a5302e5/attachment-0001.sig>

  parent reply	other threads:[~2018-06-15  7:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14  9:48 [U-Boot] [PATCH 01/12] arch: arm: mach-rockchip: rk3288: Enable regulators in board_init Janine Hagemann
2018-06-14  9:48 ` [U-Boot] [PATCH 02/12] config: phycore-rk3288_defconfig: add PHY_TI Janine Hagemann
2018-06-14  9:48 ` [U-Boot] [PATCH 03/12] net: gmac_rockchip: Fix a register write in rk3328_gmac_set_to_rgmii Janine Hagemann
2018-06-14 17:39   ` Joe Hershberger
2018-06-14 18:12     ` Dr. Philipp Tomsich
2018-06-14 18:26       ` Joe Hershberger
2018-07-13 10:42         ` Dr. Philipp Tomsich
2018-06-14  9:48 ` [U-Boot] [PATCH 04/12] Net: phy: ti: Fix fifo_depth register write Janine Hagemann
2018-06-14  9:48 ` [U-Boot] [PATCH 05/12] net: phy: ti: Add lane swapping support in the DP83867 TI's PHY driver Janine Hagemann
2018-06-14 17:47   ` Joe Hershberger
2018-06-15  7:24   ` Lukasz Majewski
2018-06-14  9:48 ` [U-Boot] [PATCH 06/12] net: phy: ti: Recover from "port mirroring" N/A MODE4 Janine Hagemann
2018-06-14 17:49   ` Joe Hershberger
2018-06-15  7:24   ` Lukasz Majewski [this message]
2018-06-14  9:48 ` [U-Boot] [PATCH 07/12] net: phy: ti: add workaround for incorrect RX_CTRL pin strap Janine Hagemann
2018-06-14 17:51   ` Joe Hershberger
2018-06-14  9:48 ` [U-Boot] [PATCH 08/12] net: gmac_rockchip: Add handeling for RGMII_ID/RXID/TXID Janine Hagemann
2018-06-14 17:53   ` Joe Hershberger
2018-06-14  9:48 ` [U-Boot] [PATCH 09/12] drivers: net: designware: Add reading of DT phy-handle node Janine Hagemann
2018-06-14 17:53   ` Joe Hershberger
2018-06-14  9:48 ` [U-Boot] [PATCH 10/12] net: phy: ti: Add binding for the CLK_OUT pin muxing Janine Hagemann
2018-06-14 18:01   ` Joe Hershberger
2018-06-14  9:48 ` [U-Boot] [PATCH 11/12] ARM: dts: rockchip: ADD dp83867 CLK_OUT muxing Janine Hagemann
2018-06-14  9:48 ` [U-Boot] [PATCH 12/12] rockchip: rk3288-phycore: set flash1 iodomain to 1.8V Janine Hagemann

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=20180615092434.3e1d65e2@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /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