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

Jean-Jacques Hiblot jjhiblot at ti.com
Fri Mar 24 12:24:45 UTC 2017


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
+	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



More information about the U-Boot mailing list