mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
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>
This commit is contained in:
parent
b985b5d6e4
commit
4653f91c13
1 changed files with 6 additions and 3 deletions
|
@ -313,7 +313,8 @@ static int init_phy(struct eth_device *dev)
|
||||||
* PHY */
|
* PHY */
|
||||||
curphy = get_phy_info(dev);
|
curphy = get_phy_info(dev);
|
||||||
|
|
||||||
if (NULL == curphy) {
|
if (curphy == NULL) {
|
||||||
|
priv->phyinfo = NULL;
|
||||||
printf("%s: No PHY found\n", dev->name);
|
printf("%s: No PHY found\n", dev->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -661,7 +662,8 @@ static void startup_tsec(struct eth_device *dev)
|
||||||
rtx.txbd[TX_BUF_CNT - 1].status |= TXBD_WRAP;
|
rtx.txbd[TX_BUF_CNT - 1].status |= TXBD_WRAP;
|
||||||
|
|
||||||
/* Start up the PHY */
|
/* Start up the PHY */
|
||||||
phy_run_commands(priv, priv->phyinfo->startup);
|
if(priv->phyinfo)
|
||||||
|
phy_run_commands(priv, priv->phyinfo->startup);
|
||||||
adjust_link(dev);
|
adjust_link(dev);
|
||||||
|
|
||||||
/* Enable Transmit and Receive */
|
/* Enable Transmit and Receive */
|
||||||
|
@ -765,7 +767,8 @@ static void tsec_halt(struct eth_device *dev)
|
||||||
regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
|
regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
|
||||||
|
|
||||||
/* Shut down the PHY, as needed */
|
/* 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 = {
|
struct phy_info phy_info_M88E1011S = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue