From patchwork Wed Feb 2 01:08:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 539307 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1191803imr; Tue, 1 Feb 2022 17:11:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3pba6oSE/94T9nLVKxWIJJPJrl4wk6sYXmSv/KpwCgsY/SGxxz52bemTY/oeGuZbRpbnk X-Received: by 2002:aa7:da44:: with SMTP id w4mr27737742eds.146.1643764283636; Tue, 01 Feb 2022 17:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643764283; cv=none; d=google.com; s=arc-20160816; b=M78TshKTsYrMTZCOpM0UoZcnznZ5xKPXXnPJ+iV8VuZadyoYD5JsQxdQSykqqhsUy4 ovwHuwO4EGv5HFEua4Z9VR6jhdMQfM8Y7w8Cz7du4w2fUOkGWaHHgv3b24ogzumgDDae nRjjDWDGSKe7pSBz5JKtqqXlv2ocHzvJcbW7cBHLA6ApdGERsGX5pNt3kvQyrwUW/zZe rTxPlzm92x0MflIKR6c/hHmENcoW4E/NEU1h6CDiolOaMck1kNHIKzLliOMsG+VBSvFd qzsrj6eMQ1NET7oUZPDPGgPCmXgTrbx+UVIbqMCiTq1hlerUpjbtxZ5beewqlU/Doov6 fiyQ== 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=tzYKj0DnTmjTUPdBVrRqbg9xnk+rMjSK/Bftseh2960=; b=sHfmnC72sImox68OUigJXJRmn7P2Tq46nU7I6hO30D1vqHeBOBjuaxIuF67PT4qX5u KZQ3upaoCUrfSfi20PoS+aN3efVrtBkDnZ4gy5bmfb7NjS5+Qpki2QOIGxTTRZcNma6f Zwll++BcoC8s633EPEnKiyK+MzJ+iDljAyQinuYHZmRA4TvfSmXvtpUZRm2YnGf3aFft RSCjuAW5mJM7P0etFslm2ZPcu7QMfLz+oXuT/evL3Wkz5ZlLwbtOjBpgueZ+MFZN6aP2 KKtNTcUVeTVW+7xgZE5L64Ed26FjHQDhdZnLTf84cLS5PGjp7zOc7jMcYFQwDCMhIayl ITgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XkwiShZN; 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 sa21si10815788ejc.979.2022.02.01.17.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 17:11:23 -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=XkwiShZN; 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 01FD0838D5; Wed, 2 Feb 2022 02:10:09 +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="XkwiShZN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D4B4C838D5; Wed, 2 Feb 2022 02:10:06 +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=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 2240F838B6 for ; Wed, 2 Feb 2022 02:09:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52a.google.com with SMTP id j10so16970575pgc.6 for ; Tue, 01 Feb 2022 17:09:52 -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=tzYKj0DnTmjTUPdBVrRqbg9xnk+rMjSK/Bftseh2960=; b=XkwiShZNxtUBVlzdt+mv5YYeMMlmMVdAl4eGGCrQ7hEB2lb2o/AQGH/AmjzQAcjN91 /nF+jT30jjEFeVR2O5FWPuF/wIkDvPF+T/Rn1gwTJA0BABPJM7iO6+PS8+bcPQ9SlAn2 NMfnD9n00Um4oBzB1lWwZbyopEZbCsPzag3nMX6mCH/IcWS7cIL1KeNW1Bza4qYbgVbA n/E6g5IPVqdyjZlxJO7no/9mdyKnYs/QTwW5dyyZKiBHrc0rH8edzyjQbo4fm+PtdQQS bGaxdYePnbNvsna4nrLxgvEd3FcPFNgwF1gX0kVHcOnzTaWD2oXDX05bPSp+hwBVuvPu 6KPw== 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=tzYKj0DnTmjTUPdBVrRqbg9xnk+rMjSK/Bftseh2960=; b=nZi1pBH8D7kHvvdaC4hD+BxlFADxLX+U9LS0ijXOx1O/NEGZu7IhUXQdx/98pob/H5 0qvVisLq64VvVcz80IPxpN6tpWedtYN9Fnvz/jyQ3s48qukEt2OQoo1oWn9l++Q5thH9 bS54d9sIGpdVtgMtSxG7R+0F2MMhfGgISpsGJ9cX/gigoGAO2olKOvhqzXQGNEYgvLuH tnLjPg2Ly+u/0iKYds4N4RjabjKk6voGamrfD7BY1T8GKTOs0G2fQWWjgXIysCBICeXK uv3u2phfgIRDxiLVALHR/CDDQ9fGwWsNXlJQx8PbXtWQkqVvdqeycltxROBOltVf4IjH we+A== X-Gm-Message-State: AOAM5323wjRqqZ339TufoL5MIUz+rikHVQD+iIhToLfcbhE9aBZgtqEq zCuHPlXQdGwhJkAlDLPi2kOu+A== X-Received: by 2002:a05:6a00:1256:: with SMTP id u22mr28165848pfi.82.1643764185524; Tue, 01 Feb 2022 17:09:45 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:314e:b83b:fa90:7f2e]) by smtp.gmail.com with ESMTPSA id f5sm10761429pfc.0.2022.02.01.17.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 17:09:45 -0800 (PST) From: AKASHI Takahiro To: lukma@denx.de, peng.fan@nxp.com, jh80.chung@samsung.com, bmeng.cn@gmail.com, peng.ma@nxp.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 05/19] sata: call device_probe() after scanning Date: Wed, 2 Feb 2022 10:08:39 +0900 Message-Id: <20220202010853.40405-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220202010853.40405-1-takahiro.akashi@linaro.org> References: <20220202010853.40405-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..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)