dm: scsi: Scan the actual number of ports
authorPark, Aiden <aiden.park@intel.com>
Tue, 20 Aug 2019 16:47:42 +0000 (16:47 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 26 Aug 2019 15:46:20 +0000 (11:46 -0400)
The scsi_scan_dev() is looping over the number of uc_plat->max_id.
The number of actual ports a AHCI controller has can be greater than
max_id. Update uc_plat->max_id to make SCSI scan all detected ports.

Signed-off-by: Aiden Park <aiden.park@intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/ata/ahci.c

index e3135bb..9a08575 100644 (file)
@@ -1167,6 +1167,14 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
        if (ret)
                return ret;
 
+       /*
+        * scsi_scan_dev() scans devices up-to the number of max_id.
+        * Update max_id if the number of detected ports exceeds max_id.
+        * This allows SCSI to scan all detected ports.
+        */
+       uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports,
+                               uc_plat->max_id);
+
        return 0;
 }