[U-Boot] [PATCH 4/5] net: sandbox-raw: Convert raw eth driver to livetree

Simon Glass sjg at chromium.org
Tue Jun 26 23:18:26 UTC 2018


Hi Joe,

On 26 June 2018 at 14:19, Joe Hershberger <joe.hershberger at ni.com> wrote:
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
>
>  drivers/net/sandbox-raw.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

>
> diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
> index 3f8020f629..f835a6a7f3 100644
> --- a/drivers/net/sandbox-raw.c
> +++ b/drivers/net/sandbox-raw.c
> @@ -25,17 +25,19 @@ static int sb_eth_raw_start(struct udevice *dev)
>
>         debug("eth_sandbox_raw: Start\n");
>
> -       interface = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
> -                                           "host-raw-interface", NULL);
> -       if (interface == NULL)
> -               return -EINVAL;
> -
> -       if (strcmp(interface, "lo") == 0) {
> -               priv->local = 1;
> -               env_set("ipaddr", "127.0.0.1");
> -               env_set("serverip", "127.0.0.1");
> +       interface = dev_read_prop(dev, "host-raw-interface", NULL);

dev_read_string() ?

> +       if (interface) {

Can you do:

if (!interface)
   return -EINVAL;

> +               printf("eth_sandbox_raw: Using %s from DT\n", interface);
> +               if (strcmp(interface, "lo") == 0) {
> +                       priv->local = 1;
> +                       env_set("ipaddr", "127.0.0.1");
> +                       env_set("serverip", "127.0.0.1");
> +               }
> +               return sandbox_eth_raw_os_start(interface, pdata->enetaddr,
> +                                               priv);
>         }
> -       return sandbox_eth_raw_os_start(interface, pdata->enetaddr, priv);
> +
> +       return -EINVAL;
>  }
>
>  static int sb_eth_raw_send(struct udevice *dev, void *packet, int length)
> @@ -144,7 +146,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
>  {
>         struct eth_pdata *pdata = dev_get_platdata(dev);
>
> -       pdata->iobase = devfdt_get_addr(dev);
> +       pdata->iobase = dev_read_addr(dev);
>         return 0;
>  }
>
> --
> 2.11.0
>

Regards,
Simon


More information about the U-Boot mailing list