diff mbox

[U-Boot,6/8] imx: mx7dsabresd: reset ENET_RST_B

Message ID 1491825091-29966-6-git-send-email-peng.fan@nxp.com
State Accepted
Commit 709fef513120cfc9a18bfcee42d466bd3d04b3a4
Delegated to: Stefano Babic
Headers show

Commit Message

Peng Fan April 10, 2017, 11:51 a.m. UTC
Reset ENET_RST_B to make ENET function stable.
Since DM_GPIO enabled, we use "gpio_spi@0_5" which corresponds
to ENET_RST_B.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 board/freescale/mx7dsabresd/mx7dsabresd.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Fabio Estevam April 10, 2017, 12:03 p.m. UTC | #1
On Mon, Apr 10, 2017 at 8:51 AM, Peng Fan <peng.fan@nxp.com> wrote:
> Reset ENET_RST_B to make ENET function stable.
> Since DM_GPIO enabled, we use "gpio_spi@0_5" which corresponds
> to ENET_RST_B.

This should better be handled like the kernel: the FEC driver uses the
"phy-reset-gpios" property and perform the reset.
Peng Fan April 10, 2017, 12:18 p.m. UTC | #2
Hi Fabio,

> -----Original Message-----

> From: Fabio Estevam [mailto:festevam@gmail.com]

> Sent: Monday, April 10, 2017 8:04 PM

> To: Peng Fan <peng.fan@nxp.com>

> Cc: Stefano Babic <sbabic@denx.de>; U-Boot-Denx <u-boot@lists.denx.de>

> Subject: Re: [U-Boot] [PATCH 6/8] imx: mx7dsabresd: reset ENET_RST_B

> 

> On Mon, Apr 10, 2017 at 8:51 AM, Peng Fan <peng.fan@nxp.com> wrote:

> > Reset ENET_RST_B to make ENET function stable.

> > Since DM_GPIO enabled, we use "gpio_spi@0_5" which corresponds to

> > ENET_RST_B.

> 

> This should better be handled like the kernel: the FEC driver uses the "phy-

> reset-gpios" property and perform the reset.


I have not switch to enable FEC DM now. when FEC DM enabled,
I could drop this piece code.

Thanks,
Peng.
diff mbox

Patch

diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
index d6ba364..2c5eb25 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -232,6 +232,23 @@  int mmc_map_to_kernel_blk(int dev_no)
 int board_eth_init(bd_t *bis)
 {
 	int ret;
+	unsigned int gpio;
+
+	ret = gpio_lookup_name("gpio_spi@0_5", NULL, NULL, &gpio);
+	if (ret) {
+		printf("GPIO: 'gpio_spi@0_5' not found\n");
+		return -ENODEV;
+	}
+
+	ret = gpio_request(gpio, "fec_rst");
+	if (ret && ret != -EBUSY) {
+		printf("gpio: requesting pin %u failed\n", gpio);
+		return ret;
+	}
+
+	gpio_direction_output(gpio, 0);
+	udelay(500);
+	gpio_direction_output(gpio, 1);
 
 	setup_iomux_fec();