From patchwork Fri Dec 10 06:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 522730 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp2169255imb; Thu, 9 Dec 2021 22:51:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2k3XYWQLIzdXoYCAS3k9aYn8RmWRiK7KQnnHhi1S1BxWSzTcA9J9uG0i6aaSSsU8XWkNL X-Received: by 2002:a17:906:3c46:: with SMTP id i6mr21043068ejg.371.1639119097493; Thu, 09 Dec 2021 22:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639119097; cv=none; d=google.com; s=arc-20160816; b=hLstRWwkPG3tIrOEPl24HihhDfpQjPDeVIVwI6mnHu6sBrnp+j3D9N/gHTyFAtmkyh 6t8OVBIUfODxOI/iam66Ow4bKh0WjYeGdGsyCPt4NR0KLKgsak43Qj1PmU3Zk/Frupod R+GhWWrgggtj5qaLugxMcnftXdq2CZ4/qvwRxeBj0I/r8N5gPCfdoBUyRkTGnmDphXrs axm0P5RxbtNghdCXSxpai00AxWyNzACmMU9P61TCZQcocRzMewyRcImT3PBWH3I1shSk bnzk8HzeVCokJnV798nGxIEuTWB6EJCn83bFeAskYFm6JM1qUYikVME2rrZChpS1y/LM FOfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c86AUGw9p8OP3Ujy+6u4RxbpzSXHf7b/TNv4ldBBLdk=; b=QBLBDgjRe/kZFQW3ZNl5lxlrCEAK6gB3ebChD6E+IceiD/j+Ma81UxJnWBWDHyWg7b BpSwOxcFk7bSZnkQwYWBoAOXIq6vPYglYThzCS1ZpX6tqh7bU+RRQLFrG+kMhX1KHd4k IzL9unrbwIeAgOBs6nbPbCvYEUlDBGqEwyUkEIN3+9VwghYaOAiQ5MXb9xamWX/Irt5r quDCJGp67erOR+NIN7Jsh0FDJTna2/6VifBrDwAIzbvrXnh/EJL3rcr2fR5m5LQ78FKH a33UfTIwNXJjs9lAHMLjqKHm5OVJkZszld0s9zyT6u/OJ89yixLDquZz226HCO0vp0Tx +k6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KXwXq55v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id dz11si4356573edb.569.2021.12.09.22.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 22:51:37 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KXwXq55v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD1268345C; Fri, 10 Dec 2021 07:50:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KXwXq55v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD58E830A2; Fri, 10 Dec 2021 07:50:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BD8CE830A7 for ; Fri, 10 Dec 2021 07:50:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102b.google.com with SMTP id iq11so6158967pjb.3 for ; Thu, 09 Dec 2021 22:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c86AUGw9p8OP3Ujy+6u4RxbpzSXHf7b/TNv4ldBBLdk=; b=KXwXq55vCbwtFkH/Goe3p9qcL7+YfeE56rlqEgaCmNL/VtPwEidWCzdO03a+XbaD4k GxdvnumgHF2U6Zrie3DSpuWVOE57ZdFh1tRKB9NIBmQHeG6Ql81y/WcYLpMTq26N9kQd SQjrZ/hjJPWvuDnDY05Of3X4Kvg5eR9C8ML5aF/u/bviY32/qJ2czat4OTJEK9ekpQI6 jZXJoPEyyP0l6Hu9v6gENj3Fo3O4Ee9fcU036HH5yJLA6jB3HJ8cx8kL6eWxxMH84nxF bU5hkvC70wHYWq51qqMdALxjrhHDtYbm5HxBZWhP025SdHizlKzS91wUib4F4OULhbua r5/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c86AUGw9p8OP3Ujy+6u4RxbpzSXHf7b/TNv4ldBBLdk=; b=fDSXqjHW2gSXGzCBAokSbmEsXg0hmMC2hhaDdiBUCL7svHoA9l7h/mPhQo41hhYB52 i7jS0+ejr5f8WXi+T+ywCibFr50nFVNBVRJWlQAd1FwBjfuQKKrsS63JU2r1lgG/Vr4v ziusEBHI+RjPuHKuzO40SDSfkyjbbBrmFG5THNHNDnpy2hmDNPNx0vESFdLD9x3h669E d/FhIPBLT9bz/nKlLF+LgrBLblvXZDjIPPPv/r49G29n7g+korqX9+NMt83ug59dflAa ZBp/Ael5HNMieZmyhgAnbyagq+Ain/SEsZMXZUWkm3dPXAAiyHiquEk5cqcq3xrVNizp ZbSA== X-Gm-Message-State: AOAM532BesHvEhVwwQ1v1nA6BRamxNWja1TYVWkVwTGj2Kt0HOAYQPvO tpQzMx7XnXxDFok4qF3OZ75urA== X-Received: by 2002:a17:902:d88b:b0:142:8acf:615b with SMTP id b11-20020a170902d88b00b001428acf615bmr73878041plz.62.1639119039200; Thu, 09 Dec 2021 22:50:39 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:75dd:4e0e:4542:936e]) by smtp.gmail.com with ESMTPSA id nn4sm1639035pjb.38.2021.12.09.22.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 22:50:38 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC v2 07/20] sata: call device_probe() after scanning Date: Fri, 10 Dec 2021 15:49:34 +0900 Message-Id: <20211210064947.73361-8-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211210064947.73361-1-takahiro.akashi@linaro.org> References: <20211210064947.73361-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Every time a sata bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- drivers/ata/dwc_ahsata.c | 5 +++++ drivers/ata/fsl_sata.c | 11 +++++++++++ drivers/ata/sata_mv.c | 5 +++++ drivers/ata/sata_sil.c | 12 ++++++++++++ 4 files changed, 33 insertions(+) diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index 6d42548087b3..d9fd850c6fae 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -1026,6 +1026,11 @@ int dwc_ahsata_scan(struct udevice *dev) return ret; } + ret = blk_probe_or_unbind(dev); + if (ret < 0) + /* TODO: undo create */ + return ret; + return 0; } diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c index e44db0a37458..346e9298b4c5 100644 --- a/drivers/ata/fsl_sata.c +++ b/drivers/ata/fsl_sata.c @@ -982,6 +982,17 @@ static int fsl_ata_probe(struct udevice *dev) failed_number++; continue; } + + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + ret = fsl_unbind_device(blk); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == nr_ports) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 003222d47be6..60666d551434 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -1099,6 +1099,11 @@ static int sata_mv_probe(struct udevice *dev) continue; } + ret = blk_probe_or_unbind(bdev); + if (ret < 0) + /* TODO: undo create */ + continue; + /* If we got here, the current SATA port was probed * successfully, so set the probe status to successful. */ diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index dda712f42cb2..295f7ca72303 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c @@ -864,6 +864,18 @@ static int sil_pci_probe(struct udevice *dev) failed_number++; continue; } + + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + ret = sil_unbind_device(blk); + device_unbind(bdev); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == sata_info.maxport)