Skip to contentSkip to conversation

am3517_evm: Ethernet activation

U-Boot New yegorslists at googlemail.com 2 participants 3 messages Dec 11, 2013 – Dec 13, 2013

lore
Share & tools
lore
#1 lore raw

PATCH v4 1/1 am3517_evm: activate Ethernet PHY

From: Yegor Yefremov <[email protected]>

Pin 30 is connected to PHY's RESET# signal, so it must be put to high. Otherwise PHY won't be found via MDIO interface.

---
Changes:
v4: as Tom Rini's patch "AM3517 EVM: Enable Ethernet" activates EMAC by default, remove #if statements
v3: use "__maybe_unused", instead of #if defined statement (Stefan Roese)
v2: put ctr and reset under #if defined statement, to avoid compiler warnings, when EMAC is not selected

 board/logicpd/am3517evm/am3517evm.c |   32 ++++++++++++++++++++++++++++++++
 board/logicpd/am3517evm/am3517evm.h |    2 +-
 include/configs/am3517_evm.h        |    5 +++++
 3 files changed, 38 insertions(+), 1 deletions(-)
board/logicpd/am3517evm/am3517evm.c +32 -0
index b6c68da..5196b5d 100644
@@ -22,6 +22,7 @@
 #include <asm/arch/musb.h>
 #include <asm/mach-types.h>
 #include <asm/errno.h>
+#include <asm/gpio.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/musb.h>
@@ -31,6 +32,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define AM3517_IP_SW_RESET	0x48002598
+#define CPGMACSS_SW_RST		(1 << 1)
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -98,6 +102,9 @@ static void am3517_evm_musb_init(void)
  */
 int misc_init_r(void)
 {
+	volatile unsigned int ctr;
+	u32 reset;
+
 #ifdef CONFIG_DRIVER_OMAP34XX_I2C
 	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
@@ -106,6 +113,31 @@ int misc_init_r(void)
 
 	am3517_evm_musb_init();
 
+	/* activate PHY reset */
+	gpio_direction_output(30, 0);
+	gpio_set_value(30, 0);
+
+	ctr  = 0;
+	do {
+		udelay(1000);
+		ctr++;
+	} while (ctr < 300);
+
+	/* deactivate PHY reset */
+	gpio_set_value(30, 1);
+
+	/* allow the PHY to stabilize and settle down */
+	ctr = 0;
+	do {
+		udelay(1000);
+		ctr++;
+	} while (ctr < 300);
+
+	/* ensure that the module is out of reset */
+	reset = readl(AM3517_IP_SW_RESET);
+	reset &= (~CPGMACSS_SW_RST);
+	writel(reset,AM3517_IP_SW_RESET);
+
 	return 0;
 }
 
board/logicpd/am3517evm/am3517evm.h +1 -1
index 704af84..d407d66 100644
@@ -315,7 +315,7 @@ const omap3_sysinfo sysinfo = {
 	MUX_VAL(CP(SYS_CLKREQ),		(IEN  | PTD | DIS | M0)) \
 	MUX_VAL(CP(SYS_NIRQ),		(IEN  | PTU | EN  | M0)) \
 	/*SYS_nRESWARM */\
-	MUX_VAL(CP(SYS_NRESWARM),     	(IDIS | PTU | DIS | M4)) \
+	MUX_VAL(CP(SYS_NRESWARM),     	(IDIS | PTU | EN | M4)) \
 							/* - GPIO30 */\
 	MUX_VAL(CP(SYS_BOOT0),		(IEN  | PTD | DIS | M4)) /*GPIO_2*/\
 							 /* - PEN_IRQ */\
include/configs/am3517_evm.h +5 -0
index 5e259f5..e22a46b 100644
@@ -58,6 +58,11 @@
  */
 
 /*
+ * OMAP GPIO configuration
+ */
+#define CONFIG_OMAP_GPIO
+
+/*
  * NS16550 Configuration
  */
 #define V_NS16550_CLK			48000000	/* 48MHz (APLL96/2) */
Signature · 1 line
1.7.7
#2 lore raw

PATCH v4 1/1 am3517_evm: activate Ethernet PHY

Quoted 6 lines · Yegor Yefremov

From: Yegor Yefremov <[email protected]>

Pin 30 is connected to PHY's RESET# signal, so it must be put to high. Otherwise PHY won't be found via MDIO interface.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131213/545ad556/attachment.pgp>