[U-Boot] [PATCH 5/7] dm: scsi: ahci: fill max_lun and max_id members of scsi_platdata

Simon Glass sjg at chromium.org
Sat Apr 1 04:21:59 UTC 2017


Hi,

On 24 March 2017 at 06:24, Jean-Jacques Hiblot <jjhiblot at ti.com> wrote:
> Those 2 values are required for proper operation of the DM_SCSI version of
> scsi_scan().
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
> ---
>  drivers/block/ahci.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
> index 3fa14a7..3c5359f 100644
> --- a/drivers/block/ahci.c
> +++ b/drivers/block/ahci.c
> @@ -971,7 +971,9 @@ void scsi_low_level_init(int busdevfunc)
>  {
>         int i;
>         u32 linkmap;
> -
> +#ifdef CONFIG_DM_SCSI
> +       struct scsi_platdata *plat = dev_get_platdata(dev);
> +#endif
>  #ifndef CONFIG_SCSI_AHCI_PLAT
>  # if defined(CONFIG_DM_PCI)
>         struct udevice *dev;
> @@ -990,6 +992,13 @@ void scsi_low_level_init(int busdevfunc)
>
>         linkmap = probe_ent->link_port_map;
>
> +#ifdef CONFIG_DM_SCSI

We should not be touching or using scsi_low_level_init() with DM.
There is a patch I just reviewed which seems to do a similar thing:

scsi: move base, max_lun and max_id to uclass plat data

> +       if (plat) {
> +               plat->max_lun = 1;
> +               plat->max_id = ffs(linkmap);
> +       }
> +#endif
> +
>         for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
>                 if (((linkmap >> i) & 0x01)) {
>                         if (ahci_port_start((u8) i)) {
> @@ -1047,6 +1056,7 @@ err_out:
>
>  void __weak scsi_init(void)
>  {
> +       printf("AHCI\n");
>  }
>
>  #endif
> --
> 1.9.1
>

Regards,
Simon


More information about the U-Boot mailing list