[U-Boot] [PATCH 05/10] net: designware: Add a post-started hook
Sjoerd Simons
sjoerd.simons at collabora.co.uk
Thu Oct 1 11:48:08 CEST 2015
Add the ability for e.g. drivers subclassing to register a function to
be called after ethernet initialisation. This is useful if e.g. the
driver needs to change configuration based on the negotiated speed.
Signed-off-by: Sjoerd Simons <sjoerd.simons at collabora.co.uk>
---
drivers/net/designware.c | 11 ++++++++++-
drivers/net/designware.h | 4 ++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 0b7adc9..da27041 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -564,8 +564,17 @@ int designware_initialize(ulong base_addr, u32 interface)
static int designware_eth_start(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
+ struct dw_eth_dev *priv = dev_get_priv(dev);
+ int ret;
- return _dw_eth_init(dev->priv, pdata->enetaddr);
+ ret = _dw_eth_init(priv, pdata->enetaddr);
+ if (ret)
+ return ret;
+
+ if (priv->started)
+ ret = priv->started(dev);
+
+ return ret;
}
static int designware_eth_send(struct udevice *dev, void *packet, int length)
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index 47e727b..b45599b 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -236,6 +236,10 @@ struct dw_eth_dev {
#endif
struct phy_device *phydev;
struct mii_dev *bus;
+
+#ifdef CONFIG_DM_ETH
+ int (*started)(struct udevice *dev);
+#endif
};
#ifdef CONFIG_DM_ETH
--
2.5.3
More information about the U-Boot
mailing list