diff mbox

[U-Boot] ftgmac100: reset fix when supports wake on lan

Message ID 1316584472-24031-1-git-send-email-macpaul@andestech.com
State Accepted
Commit 55b438a919901e486fae1618e7498cf5e63c2b86
Headers show

Commit Message

Macpaul Lin Sept. 21, 2011, 5:54 a.m. UTC
This patch move the reset function from initialization to
driver register procedure.

Some embedded system supports wake on lan nowadays. On this kind of system,
the ftgmac100 will be still supplied power after the system has been
shut-down by Linux. Hence the register used by linux won't be clear
when the system has been powered-off.

The origin ftgmac100 driver in u-boot will only register
driver and functions to network stack and won't reset the ftgmac100
hardware if the network won't be used during boot-up.
This will lead ftgmac100 continue receiving packets and then might corrupt
linux kernel when booting up.

So we reorder the hardware reset function earlier to force the hardware
to be reset whether it will be used or not.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
---
 drivers/net/ftgmac100.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Oct. 21, 2011, 10:36 p.m. UTC | #1
Dear Macpaul Lin,

In message <1316584472-24031-1-git-send-email-macpaul@andestech.com> you wrote:
> This patch move the reset function from initialization to
> driver register procedure.
> 
> Some embedded system supports wake on lan nowadays. On this kind of system,
> the ftgmac100 will be still supplied power after the system has been
> shut-down by Linux. Hence the register used by linux won't be clear
> when the system has been powered-off.
> 
> The origin ftgmac100 driver in u-boot will only register
> driver and functions to network stack and won't reset the ftgmac100
> hardware if the network won't be used during boot-up.
> This will lead ftgmac100 continue receiving packets and then might corrupt
> linux kernel when booting up.
> 
> So we reorder the hardware reset function earlier to force the hardware
> to be reset whether it will be used or not.
> 
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> ---
>  drivers/net/ftgmac100.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index dc7a80e..821840f 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -384,8 +384,6 @@  static int ftgmac100_init(struct eth_device *dev, bd_t *bd)
 
 	debug("%s()\n", __func__);
 
-	ftgmac100_reset(dev);
-
 	/* set the ethernet address */
 	ftgmac100_set_mac_from_env(dev);
 
@@ -561,6 +559,8 @@  int ftgmac100_initialize(bd_t *bd)
 
 	eth_register(dev);
 
+	ftgmac100_reset(dev);
+
 	return 1;
 
 free_dev: