From: Marek Vasut Date: Thu, 8 Sep 2011 22:37:19 +0200 Subject: [U-Boot] [PATCH 08/11] FEC: Allow registering MII postconfiguration callback In-Reply-To: <1315514242-18998-1-git-send-email-marek.vasut@gmail.com> References: <1315514242-18998-1-git-send-email-marek.vasut@gmail.com> Message-ID: <1315514242-18998-9-git-send-email-marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Marek Vasut Cc: Ben Warren Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/net/fec_mxc.c | 14 +++++++++++++- drivers/net/fec_mxc.h | 1 + include/netdev.h | 5 +++++ 3 files changed, 19 insertions(+), 1 deletions(-) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 44b7919..989e7b4 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -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) { struct fec_priv *fec = (struct fec_priv *)dev->priv; + int ret = 0; /* * Wake up from sleep if necessary @@ -173,7 +174,11 @@ static int miiphy_restart_aneg(struct eth_device *dev) LPA_10HALF | PHY_ANLPAR_PSB_802_3); miiphy_write(dev->name, fec->phy_id, MII_BMCR, 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) @@ -786,3 +791,10 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr) 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; +} diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h index e436c22..1a20388 100644 --- a/drivers/net/fec_mxc.h +++ b/drivers/net/fec_mxc.h @@ -277,6 +277,7 @@ struct fec_priv { void *base_ptr; int dev_id; int phy_id; + int (*mii_postcall)(int); }; /** diff --git a/include/netdev.h b/include/netdev.h index 6e70341..1e7f5c1 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -184,4 +184,9 @@ struct mv88e61xx_config { int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig); #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_ */ -- 1.7.5.4