diff options
author | Ben Warren <bwarren@qstreams.com> | 2006-10-26 14:38:25 -0400 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2006-10-26 21:17:25 +0200 |
commit | 4653f91c13ed51c21cc4c3855745d69a3fb1817f (patch) | |
tree | 6a4fe52a841834ec8842eafeb7b9737721305c1c | |
parent | b985b5d6e4fb88f508f7aa0f126c2e27ada2b999 (diff) | |
download | u-boot-imx-4653f91c13ed51c21cc4c3855745d69a3fb1817f.zip u-boot-imx-4653f91c13ed51c21cc4c3855745d69a3fb1817f.tar.gz u-boot-imx-4653f91c13ed51c21cc4c3855745d69a3fb1817f.tar.bz2 |
Fix TSEC driver (now for real): avoid crashes if PHY is not attached
to a TSEC (e.g. a switch is connected via RMII) or
if the PHY is defective/incorrectly configured.
Signed-off-by: Ben Warren <bwarren@qstreams.com>
-rw-r--r-- | drivers/tsec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/tsec.c b/drivers/tsec.c index 770517b..400e593 100644 --- a/drivers/tsec.c +++ b/drivers/tsec.c @@ -313,7 +313,8 @@ static int init_phy(struct eth_device *dev) * PHY */ curphy = get_phy_info(dev); - if (NULL == curphy) { + if (curphy == NULL) { + priv->phyinfo = NULL; printf("%s: No PHY found\n", dev->name); return 0; @@ -661,7 +662,8 @@ static void startup_tsec(struct eth_device *dev) rtx.txbd[TX_BUF_CNT - 1].status |= TXBD_WRAP; /* Start up the PHY */ - phy_run_commands(priv, priv->phyinfo->startup); + if(priv->phyinfo) + phy_run_commands(priv, priv->phyinfo->startup); adjust_link(dev); /* Enable Transmit and Receive */ @@ -765,7 +767,8 @@ static void tsec_halt(struct eth_device *dev) regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN); /* Shut down the PHY, as needed */ - phy_run_commands(priv, priv->phyinfo->shutdown); + if(priv->phyinfo) + phy_run_commands(priv, priv->phyinfo->shutdown); } struct phy_info phy_info_M88E1011S = { |