Commit 2e5f4421 authored by Marek Vasut's avatar Marek Vasut Committed by Albert ARIBAUD

FEC: Allow registering MII postconfiguration callback

Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
Cc: Ben Warren <biggerbadderben@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
parent 9e27e9dc
...@@ -153,6 +153,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr, ...@@ -153,6 +153,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,
static int miiphy_restart_aneg(struct eth_device *dev) static int miiphy_restart_aneg(struct eth_device *dev)
{ {
struct fec_priv *fec = (struct fec_priv *)dev->priv; struct fec_priv *fec = (struct fec_priv *)dev->priv;
int ret = 0;
/* /*
* Wake up from sleep if necessary * Wake up from sleep if necessary
...@@ -173,7 +174,11 @@ static int miiphy_restart_aneg(struct eth_device *dev) ...@@ -173,7 +174,11 @@ static int miiphy_restart_aneg(struct eth_device *dev)
LPA_10HALF | PHY_ANLPAR_PSB_802_3); LPA_10HALF | PHY_ANLPAR_PSB_802_3);
miiphy_write(dev->name, fec->phy_id, MII_BMCR, miiphy_write(dev->name, fec->phy_id, MII_BMCR,
BMCR_ANENABLE | BMCR_ANRESTART); BMCR_ANENABLE | BMCR_ANRESTART);
return 0;
if (fec->mii_postcall)
ret = fec->mii_postcall(fec->phy_id);
return ret;
} }
static int miiphy_wait_aneg(struct eth_device *dev) static int miiphy_wait_aneg(struct eth_device *dev)
...@@ -786,3 +791,10 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr) ...@@ -786,3 +791,10 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
return lout; return lout;
} }
int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int))
{
struct fec_priv *fec = (struct fec_priv *)dev->priv;
fec->mii_postcall = cb;
return 0;
}
...@@ -277,6 +277,7 @@ struct fec_priv { ...@@ -277,6 +277,7 @@ struct fec_priv {
void *base_ptr; void *base_ptr;
int dev_id; int dev_id;
int phy_id; int phy_id;
int (*mii_postcall)(int);
}; };
/** /**
......
...@@ -186,4 +186,9 @@ struct mv88e61xx_config { ...@@ -186,4 +186,9 @@ struct mv88e61xx_config {
int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig); int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
#endif /* CONFIG_MV88E61XX_SWITCH */ #endif /* CONFIG_MV88E61XX_SWITCH */
/*
* Allow FEC to fine-tune MII configuration on boards which require this.
*/
int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int));
#endif /* _NETDEV_H_ */ #endif /* _NETDEV_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment