From patchwork Tue Mar 8 11:36:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 549273 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2539380mag; Tue, 8 Mar 2022 03:39:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlLJS1jTs+i1CneO5KBFVCydjh1KfqlOMY9LO4VcBAaMSDjDweuLr0GteAtce72GVoEvmF X-Received: by 2002:a05:6402:150f:b0:416:175d:3f5d with SMTP id f15-20020a056402150f00b00416175d3f5dmr15720335edw.184.1646739556852; Tue, 08 Mar 2022 03:39:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646739556; cv=none; d=google.com; s=arc-20160816; b=u+7BrP9SbtI04sZTP7FDTya34ReMZJ1+tTTIKAHuIvhy/hW14WUTNe86j5T96T1Y3Y CICwJD/w651EOTy/lA9DlkYq1LWkQ+RcwHdRNKHL5SayhPPisPSiN6/yhHvPG9QOetA7 4GKKHS+cYkKF+ASn1CbsLDCOGSshTpGI4XkxVLlYgGUp6pCnLQSlDIBHvNG29b2MxzSZ 9UsWNgJXsByB72E6YNCAZMHdtRHNZuem+c+cy51w34k9Wib+rfWf2JdtTgwdL3SSpg9P un3FGYhrojQVOigMXwASRBlLJvrgUuNJOXmL6wFfXGS8BDuEoVj+BiW6ZCSHPXiw64As eWSA== 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=Jhgr77XtkZKEaN4vZaS9BYwlmG4uKauBORzcKgey+RY=; b=Q1onDIfScwuDP3MQFzQzvB6gZU/2KtfbKICGe1SweAv40TQQWsQ57kvly0u33LOlV3 K5C36aybFCkYvLy39YMxhY5K2Se+SIGsPEwBzjKuQde/ookFU7wVc8BcmAfcZwFP5k7p YH1+DfHTgSZ3pqBooxg5K1QIBhzdvciJ/WUNz7xHXKgguqSf+9djzG9M3+jectPj+KpW NMjXMUo5aM/yyLTkr24Cw6KspPWxEox7s+WnXskz7mPhrwxAK186+X2JZO33Xsz0jlxz spYPX1wZuj+WEgb9SitmEneaqp23HT/DpTWPtHE5bgQ8xpFUPgS9rfrIVNJlPU4+B04O K4ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4mJOD7u; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id o6-20020a170906974600b006d0fc0c1a3asi11030634ejy.817.2022.03.08.03.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:39:16 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4mJOD7u; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 D076A83994; Tue, 8 Mar 2022 12:39:13 +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="C4mJOD7u"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D13D8392D; Tue, 8 Mar 2022 12:38:45 +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, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 DD92B83829 for ; Tue, 8 Mar 2022 12:38:01 +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-x1030.google.com with SMTP id mg21-20020a17090b371500b001bef9e4657cso2013983pjb.0 for ; Tue, 08 Mar 2022 03:38:01 -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=Jhgr77XtkZKEaN4vZaS9BYwlmG4uKauBORzcKgey+RY=; b=C4mJOD7uINqKqAnsopddRXbjYLRTx/siopL+akkFaYjadnlEZqzkU+Wg7+0+3exybC rSfglwY4OZGvgTAqdBNM7DIjk7tEA7+WNglWAHn8WhT/12foFfZow0r/AAMVgizDQjax JhyXxINyjL2+oEhhWwGH4yN3oMvJjtvv+iY1ACqu2mb9ikdYI2pOUWxlUcx9X9xzUvtc VvbQvXLjbMXyTTVOGM6re75rmLy2slKIRe/wZH3pAF1kqfzIZL4nncCOaU/3l7CqP/sm ahRy1E+45+LyhlMFPjiQWCufWid0vfbRv/i5aiTqbr7JzkqXi8OS84H1QLAEx4IpkrLd DXrA== 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=Jhgr77XtkZKEaN4vZaS9BYwlmG4uKauBORzcKgey+RY=; b=gtI26z/o6Wav2cdwsTEzrekQORualF2/1lxzdAJKWrEmAU3tctvPhrO9ZUkPa9Uk/Y qgGpyMEf+x+XnIzFpAjj2ROZgaNUY32YcMadvNjPOJp2VHZJbXABWw2iSg6zFU+bwEJh vqTYFi65o7S4s1/F9WJbLdJdwrWy0P95Jn/qgKBdA0TRHemxsjQcmhDN5Ccyn5dbpa94 82akeeCmkbUauKl2Lf3lb7YJp9D6EXRVMuQkPWK3GNpJbJ1PzSWFCk5cnO9oarKLWsqd dcGoMUEEIqt/JIH6WDHUYKgXe7AoSkgTl/lADNC5GuQgQh2ugfxEQcwLJPTjYKnN59WY 5mCw== X-Gm-Message-State: AOAM532Jd5jnLiDUBKu9u2r14IX8oNY13op1xAROIur3hHzTN7+QzoDZ fjsptqEBcozBhL8N0+jQPy/96g== X-Received: by 2002:a17:90a:1197:b0:1bf:65ff:f542 with SMTP id e23-20020a17090a119700b001bf65fff542mr4167950pja.5.1646739480309; Tue, 08 Mar 2022 03:38:00 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:b94a:f47a:3d51:185c]) by smtp.gmail.com with ESMTPSA id z2-20020a17090a170200b001bf2d530d64sm3434677pjd.2.2022.03.08.03.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:37:59 -0800 (PST) From: AKASHI Takahiro To: lukma@denx.de, peng.fan@nxp.com, jh80.chung@samsung.com, bmeng.cn@gmail.com, sr@denx.de, xypron.glpk@gmx.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 05/19] sata: call device_probe() after scanning Date: Tue, 8 Mar 2022 20:36:43 +0900 Message-Id: <20220308113657.221101-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220308113657.221101-1-takahiro.akashi@linaro.org> References: <20220308113657.221101-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 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..d1bab931895a 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(dev); + if (ret < 0) { + debug("Probing %s failed (%d)\n", dev->name, ret); + 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..a187796dfcdf 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(dev); + 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 a4f0dae4bbd1..b213ebac2fb9 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c @@ -753,6 +753,18 @@ static int sil_pci_probe(struct udevice *dev) failed_number++; continue; } + + ret = device_probe(dev); + if (ret < 0) { + debug("Probing %s failed (%d)\n", dev->name, ret); + ret = sil_unbind_device(blk); + device_unbind(dev); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == sata_info.maxport)