Hi JJ,

On 05/11/19 5:20 PM, Jean-Jacques Hiblot wrote:
> This will probe the multiplexer devices that have a "u-boot,mux-autoprobe"
> property. As a consequence they will be put in their idle state.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhib...@ti.com>
> 
> ---
[...]
> diff --git a/drivers/mux/mux-uclass.c b/drivers/mux/mux-uclass.c
> index 6aaf4dc964..71392e9e50 100644
> --- a/drivers/mux/mux-uclass.c
> +++ b/drivers/mux/mux-uclass.c
> @@ -262,6 +262,28 @@ int mux_uclass_post_probe(struct udevice *dev)
>       return 0;
>  }
>  
> +void dm_mux_init(void)
> +{
> +     struct uclass *uc;
> +     struct udevice *dev;
> +     int ret;
> +
> +     ret = uclass_get(UCLASS_MUX, &uc);
> +     if (ret < 0) {
> +             debug("unable to get MUX uclass\n");
> +             return;
> +     }
> +     uclass_foreach_dev(dev, uc) {
> +             if (dev_read_bool(dev, "u-boot,mux-autoprobe")) {
> +                     ret = device_probe(dev);
> +                     if (ret)
> +                             debug("unable to probe device %s\n", dev->name);
> +             } else {
> +                     printf("not found for dev %s\n", dev->name);
> +             }

Is "u-boot,mux-autoprobe" a required property? The fact that its in DT
makes me think its optional. If that's the case, above printf() should
be reduced to debug() to avoid confusion

> +     }
> +}
> +
>  UCLASS_DRIVER(mux) = {
>       .id             = UCLASS_MUX,
>       .name           = "mux",
> diff --git a/include/mux.h b/include/mux.h
> index 060f71a47c..2467723951 100644
> --- a/include/mux.h
> +++ b/include/mux.h
> @@ -75,6 +75,8 @@ void mux_control_put(struct mux_control *mux);
>  
>  struct mux_control *devm_mux_control_get(struct udevice *dev,
>                                        const char *mux_name);
> +void dm_mux_init(void);
> +
>  #else
>  unsigned int mux_control_states(struct mux_control *mux)
>  {
> 

-- 
Regards
Vignesh
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to