Patchwork [U-Boot] am335x_evm: Fix CPSW ethernet on GP EVM and EVM-SK

login
register
mail settings
Submitter Tom Rini
Date Feb. 12, 2013, 8:07 p.m.
Message ID <1360699663-30242-1-git-send-email-trini@ti.com>
Download mbox | patch
Permalink /patch/219945/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Tom Rini - Feb. 12, 2013, 8:07 p.m.
In commit cfd4ff6 we implemented part of advisory 1.0.10 (internal delay
for RGMII mode not supported).  This in turn however requires that we
set the tx clock delay feature in the PHY itself.

Signed-off-by: Tom Rini <trini@ti.com>
---
 board/ti/am335x/board.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
Tom Rini - Feb. 19, 2013, 4:14 p.m.
On Tue, Feb 12, 2013 at 03:07:43PM -0500, Tom Rini wrote:

> In commit cfd4ff6 we implemented part of advisory 1.0.10 (internal delay
> for RGMII mode not supported).  This in turn however requires that we
> set the tx clock delay feature in the PHY itself.
> 
> Signed-off-by: Tom Rini <trini@ti.com>

Applied to u-boot-ti/master.

Patch

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index b9ac1d5..48e6896 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -73,6 +73,11 @@  static inline int board_is_idk(void)
 	return !strncmp(header.config, "SKU#02", 6);
 }
 
+static int board_is_gp_evm(void)
+{
+	return !strncmp("A33515BB", header.name, 8);
+}
+
 int board_is_evm_15_or_later(void)
 {
 	return (!strncmp("A33515BB", header.name, 8) &&
@@ -466,6 +471,28 @@  int board_eth_init(bd_t *bis)
 		printf("Error %d registering CPSW switch\n", rv);
 	else
 		n += rv;
+
+	/*
+	 *
+	 * CPSW RGMII Internal Delay Mode is not supported in all PVT
+	 * operating points.  So we must set the TX clock delay feature
+	 * in the AR8051 PHY.  Since we only support a single ethernet
+	 * device in U-Boot, we only do this for the first instance.
+	 */
+#define AR8051_PHY_DEBUG_ADDR_REG	0x1d
+#define AR8051_PHY_DEBUG_DATA_REG	0x1e
+#define AR8051_DEBUG_RGMII_CLK_DLY_REG	0x5
+#define AR8051_RGMII_TX_CLK_DLY		0x100
+
+	if (board_is_evm_sk() || board_is_gp_evm()) {
+		const char *devname;
+		devname = miiphy_get_current_dev();
+
+		miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_ADDR_REG,
+				AR8051_DEBUG_RGMII_CLK_DLY_REG);
+		miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_DATA_REG,
+				AR8051_RGMII_TX_CLK_DLY);
+	}
 #endif
 try_usbether:
 #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_SPL_BUILD)