Skip to contentSkip to conversation

mx51evk: Provide a proper reset for the Ethernet PHY

PATCH New Fabio Estevam 2 participants 5 messages Aug 19, 2010 – Aug 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx51evk: Provide a proper reset for the Ethernet PHY

Provide a proper reset for the Ethernet PHY (LAN8700) on the MX51EVK.

---
 board/freescale/mx51evk/mx51evk.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
board/freescale/mx51evk/mx51evk.c +4 -0
index 75d642b..70cce55 100644
@@ -261,6 +261,10 @@ static void power_init(void)
 
 	/* Reset the ethernet controller over GPIO */
 	writel(0x1, IOMUXC_BASE_ADDR + 0x0AC);
+	udelay(200);
+	reg = readl(GPIO2_BASE_ADDR + 0x0);
+	reg |= 0x4000;  /* Set reset line to high*/
+	writel(reg, GPIO2_BASE_ADDR + 0x0);
 
 	/* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
 	val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 mx51evk: Provide a proper reset for the Ethernet PHY

Quoted 2 lines · Fabio Estevam

Provide a proper reset for the Ethernet PHY (LAN8700) on the MX51EVK.

Hi Fabio,

Quoted 10 lines
---
 board/freescale/mx51evk/mx51evk.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
board/freescale/mx51evk/mx51evk.c +0 -0
index 75d642b..70cce55 100644

board/freescale/mx51evk/mx51evk.c static void power_init(void) · line 267

Quoted 7 lines
board/freescale/mx51evk/mx51evk.c +4 -0
@@ -261,6 +261,10 @@ static void power_init(void)
 
 	/* Reset the ethernet controller over GPIO */
 	writel(0x1, IOMUXC_BASE_ADDR + 0x0AC);
+	udelay(200);
+	reg = readl(GPIO2_BASE_ADDR + 0x0);
+	reg |= 0x4000;  /* Set reset line to high*/
+	writel(reg, GPIO2_BASE_ADDR + 0x0);

I know I am responsible for this usage, because I forget to add some accessors for the gpio pins - as I see your patch, I have sent a patch to support it. However, a direct access to registers using offsets is not allowed in u-boot. If we use some kind of accessors, your code will be easier to read it. Everything could be changed as (0X4000 --> gpio 46, if I am not wrong):

	udelay(200);
	mxc_gpio_set(46);

What do you think ?

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 mx51evk: Provide a proper reset for the Ethernet PHY

Hi Stefano,

--- On Fri, 8/20/10, Stefano Babic <[email protected]> wrote:
...

Quoted 13 lines

I know I am responsible for this usage, because I forget to add some
accessors for the gpio pins - as I see your patch, I have sent a patch
to support it. However, a direct access to registers using offsets is
not allowed in u-boot. If we use some kind of accessors, your code will
be easier to read it. Everything could be changed as (0X4000 --> gpio
46, if I am not wrong):

Quoted 4 lines

??? udelay(200);
??? mxc_gpio_set(46);

What do you think ?

Yes, I agree. Do you plan to send a patch for mx51evk using this approach?

If you do, then I can re-submit my patch after your update.

Regards,

Fabio Estevam

#3 lore raw

PATCH 1/1 mx51evk: Provide a proper reset for the Ethernet PHY

Quoted 2 lines · Fabio Estevam

Hi Stefano,

Hi Fabio,

Quoted 2 lines
Quoted 2 lines
    udelay(200);
    mxc_gpio_set(46);

This must be,

Quoted 6 lines
Quoted 2 lines

What do you think ?

Yes, I agree. Do you plan to send a patch for mx51evk using this approach?

If you do, then I can re-submit my patch after your update.

I sent today a patch adding a common way to access gpios for i.MX31 and i.MX51:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/83163

I have another issue. It seems to me that the lines you want to add are already in the code, only some lines later:

263 /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
264 val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
265 VVIDEOEN | VAUDIOEN | VSDEN;
266 pmic_reg_write(REG_MODE_1, val);
267
268 udelay(500);
269

270         reg = readl(GPIO2_BASE_ADDR + 0x0);
271         reg |= 0x4000;
272         writel(reg, GPIO2_BASE_ADDR + 0x0);

This is exactly what you want to add, only after setting the regulators. Why do we need to set the gpio twice ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#4 lore raw

PATCH 1/1 mx51evk: Provide a proper reset for the Ethernet PHY

--- On Fri, 8/20/10, Stefano Babic <[email protected]> wrote:
...

Quoted 4 lines

This is exactly what you want to add, only after setting the regulators.
Why do we need to set the gpio twice ?

You are right. Please disregard my patch.

Regards,

Fabio Estevam