Re: [U-Boot] pre_probe under struct driver

2019-06-24 Thread Keerthy



On 23/06/19 12:40 AM, Simon Glass wrote:

Hi Keerthy,

On Tue, 4 Jun 2019 at 14:01, Keerthy  wrote:


Hi Simon/Tom,

I am looking at the device_probe function in drivers/core/device.c

ret = uclass_pre_probe_device(dev);
  if (ret)
  goto fail;

  if (dev->parent && dev->parent->driver->child_pre_probe) {
  ret = dev->parent->driver->child_pre_probe(dev);
  if (ret)
  goto fail;
  }

  if (drv->ofdata_to_platdata && dev_has_of_node(dev)) {
  ret = drv->ofdata_to_platdata(dev);
  if (ret)
  goto fail;
  }

  /* Process 'assigned-{clocks/clock-parents/clock-rates}'
properties */
  ret = clk_set_defaults(dev);

In case of a device like MPU we would like setup voltage before setting
the clocks and i was looking if we can have a pre_probe for a driver
to do things before driver gets probed. Neither uclass_pre_probe_device
nor dev->parent->driver->child_pre_probe benefit me in this case.

Does my situation warrant adding a new hook to struct driver? Or are
there instances of such handling already in u-boot.


For now, is it enough to probe the power driver from the clock driver?


Simon,

Thanks for your response. We came up with clock driver notifying the 
voltage driver before changing the frequency. So this particular case is 
resolved with it.


- Keerthy



Regards,
Simon


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


Re: [U-Boot] pre_probe under struct driver

2019-06-22 Thread Simon Glass
Hi Keerthy,

On Tue, 4 Jun 2019 at 14:01, Keerthy  wrote:
>
> Hi Simon/Tom,
>
> I am looking at the device_probe function in drivers/core/device.c
>
> ret = uclass_pre_probe_device(dev);
>  if (ret)
>  goto fail;
>
>  if (dev->parent && dev->parent->driver->child_pre_probe) {
>  ret = dev->parent->driver->child_pre_probe(dev);
>  if (ret)
>  goto fail;
>  }
>
>  if (drv->ofdata_to_platdata && dev_has_of_node(dev)) {
>  ret = drv->ofdata_to_platdata(dev);
>  if (ret)
>  goto fail;
>  }
>
>  /* Process 'assigned-{clocks/clock-parents/clock-rates}'
> properties */
>  ret = clk_set_defaults(dev);
>
> In case of a device like MPU we would like setup voltage before setting
> the clocks and i was looking if we can have a pre_probe for a driver
> to do things before driver gets probed. Neither uclass_pre_probe_device
> nor dev->parent->driver->child_pre_probe benefit me in this case.
>
> Does my situation warrant adding a new hook to struct driver? Or are
> there instances of such handling already in u-boot.

For now, is it enough to probe the power driver from the clock driver?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot