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

make at marvell.com make at marvell.com
Thu Mar 23 09:29:03 UTC 2017


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.

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



More information about the U-Boot mailing list