[U-Boot] [EXT] Re: [PATCH 3/7] scsi: call children devices' probe functions automatically

Ken Ma make at marvell.com
Wed Apr 5 08:47:58 UTC 2017


Hi Simon

Please see my inline reply, thanks a lot!

Yours,
Ken

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: 2017年4月1日 12:22
To: Ken Ma
Cc: U-Boot Mailing List; Stefan Roese; Michal Simek
Subject: [EXT] Re: [PATCH 3/7] scsi: call children devices' probe functions automatically

External Email

----------------------------------------------------------------------
Hi,

On 23 March 2017 at 03:29,  <make at marvell.com> wrote:
> From: Ken Ma <make at marvell.com>
>
> - For the purpose of accessing peripheral devices through SCSI, the
>   peripheral devices need to be probed to finish low level
>   initialization, for example, ahci controller needs to do the ahci
>   initialization;
> - scsi_low_level_init() calling is removed since the detailed scsi low
>   level initialization work is up to the peripheral scsi devices, for
>   example, sata controller may do AHCI initialization while scanner
>   controller may do ISIS initialization; the work should be done in
>   children devices probe when scsi controller acts as bus or be done
>   in the pure SAS controller's probe when SCSI controller is a SAS
>   and works as an on-board component on the motherboard;
> - Since u-boot initialization does not probe devices by default, SCSI
>   children devices can be probed automatically in SCSI post probe
>   function when SCSI controller acts as a bus.

Do you have to probe everything? The idea in DM is to probe devices only when they are first used.
[Ken] If we do not probe SCSI' children nodes such as sata hdds scsi devices, then "scsi scan" will fail since command "scsi scan" only probes SCSI host controllers but not SCSI devices which are SCSI node's children nodes; otherwise we should add SCSI node's children devices' probe to "scsi scan".
How do you think about it? Thanks!

(Also please use 'U-Boot' everywhere consistently)
[Ken] got it, thanks!

>
> Signed-off-by: Ken Ma <make at marvell.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Stefan Roese <sr at denx.de>
> Cc: Michal Simek <michal.simek at xilinx.com>
> Reviewed-on: http://vgitil04.il.marvell.com:8080/35426
> Tested-by: iSoC Platform CI <ykjenk at marvell.com>
> Reviewed-by: Omri Itach <omrii at marvell.com>
> Reviewed-by: Kostya Porotchkin <kostap at marvell.com>
> ---
>  drivers/block/scsi-uclass.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/scsi-uclass.c b/drivers/block/scsi-uclass.c 
> index 86eddfc..119ba53 100644
> --- a/drivers/block/scsi-uclass.c
> +++ b/drivers/block/scsi-uclass.c
> @@ -18,8 +18,26 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  static int scsi_post_probe(struct udevice *dev)  {
> +       struct udevice *child_dev;
> +       int ret;
> +
>         debug("%s: device %p\n", __func__, dev);
> -       scsi_low_level_init(0, dev);
> +
> +       /*
> +        * For the purpose of accessing peripheral devices through SCSI, the
> +        * peripheral devices need to be probed to finish low level
> +        * initialization, for example, ahci controller needs to do the ahci
> +        * initialization;
> +        * Since u-boot initialization does not probe devices by 
> + default, SCSI

U-Boot

> +        * children devices can be probed automatically in SCSI post probe
> +        * function when SCSI controller acts as a bus.
> +        */
> +       list_for_each_entry(child_dev, &dev->child_head, sibling_node) {
> +               ret = device_probe(child_dev);
> +               if (ret)
> +                       return ret;
> +       }
> +
>         return 0;
>  }
>
> @@ -54,6 +72,6 @@ UCLASS_DRIVER(scsi) = {
>         .id             = UCLASS_SCSI,
>         .name           = "scsi",
>         .post_bind      = scsi_post_bind,
> -       .post_probe      = scsi_post_probe,
> +       .post_probe     = scsi_post_probe,
>         .per_device_platdata_auto_alloc_size = sizeof(struct 
> scsi_platdata),  };
> --
> 1.9.1
>

Regards,
Simon


More information about the U-Boot mailing list