From mboxrd@z Thu Jan 1 00:00:00 1970 From: make at marvell.com Date: Thu, 23 Mar 2017 17:29:03 +0800 Subject: [U-Boot] [PATCH 3/7] scsi: call children devices' probe functions automatically In-Reply-To: <1490261347-11896-1-git-send-email-make@marvell.com> References: <1490261347-11896-1-git-send-email-make@marvell.com> Message-ID: <1490261347-11896-4-git-send-email-make@marvell.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Ken Ma - 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 Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35426 Tested-by: iSoC Platform CI Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin --- 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