[U-Boot] [PATCH 05/10] net: designware: Add a post-started hook

Simon Glass sjg at chromium.org
Sat Oct 3 16:30:17 CEST 2015


Hi Sjoerd,

On 1 October 2015 at 10:48, Sjoerd Simons <sjoerd.simons at collabora.co.uk> wrote:
> 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

With driver model we should not need to add such hooks. is this needed
because we don't have a PHY uclass yet?

>  };
>
>  #ifdef CONFIG_DM_ETH
> --
> 2.5.3
>

Regards,
Simon


More information about the U-Boot mailing list