public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] mx6cuboxi: Make Ethernet functional
Date: Mon,  4 Jan 2016 14:36:18 -0200	[thread overview]
Message-ID: <1451925378-14121-2-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1451925378-14121-1-git-send-email-festevam@gmail.com>

From: Fabio Estevam <fabio.estevam@nxp.com>

Since commit 59370f3fcd1350 ("net: phy: delay only if reset handler is
registered") Ethernet is no longer functional:

Booting from net ...                                                            
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !             
BOOTP broadcast 1                                                               
BOOTP broadcast 2                                                               
BOOTP broadcast 3                                                               
BOOTP broadcast 4 

This commit does not have an issue in itself, but it revelead a problem
with the Ethernet initialization.
                                         
Configure the AR8035 PHY in the same manner as done in mx6sabresd
and wandboard, so that we can get a reliable Ethernet operation.  

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 20faffc..3bb7573 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -147,8 +147,33 @@ static void setup_iomux_enet(void)
 	gpio_set_value(ETH_PHY_RESET, 1);
 }
 
+static int mx6_rgmii_rework(struct phy_device *phydev)
+{
+	unsigned short val;
+
+	/* Enable AR8035 ouput a 125MHz clk from CLK_25M */
+	phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
+
+	val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe);
+	val &= 0xffe3;
+	val |= 0x18;
+	phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val);
+
+	/* introduce tx clock delay */
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5);
+	val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
+	val |= 0x0100;
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val);
+
+	return 0;
+}
+
 int board_phy_config(struct phy_device *phydev)
 {
+	mx6_rgmii_rework(phydev);
+
 	if (phydev->drv->config)
 		phydev->drv->config(phydev);
 
-- 
1.9.1

  reply	other threads:[~2016-01-04 16:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 16:36 [U-Boot] [PATCH 1/2] mx6cuboxi: Fix the delay for the AR8035 PHY Fabio Estevam
2016-01-04 16:36 ` Fabio Estevam [this message]
2016-01-04 19:59   ` [U-Boot] [PATCH 2/2] mx6cuboxi: Make Ethernet functional Tom Rini
2016-01-04 20:40   ` Troy Kisky
2016-01-04 21:50     ` Fabio Estevam
2016-01-04 22:06       ` Troy Kisky
2016-01-04 22:08         ` Fabio Estevam
2016-01-04 22:10           ` Fabio Estevam
2016-01-04 22:45             ` Troy Kisky
2016-01-04 22:50               ` Fabio Estevam
2016-01-04 23:11                 ` Troy Kisky
2016-01-04 23:26                   ` Fabio Estevam
2016-01-04 22:30           ` Troy Kisky
2016-01-04 19:59 ` [U-Boot] [PATCH 1/2] mx6cuboxi: Fix the delay for the AR8035 PHY Tom Rini

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=1451925378-14121-2-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --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