From patchwork Fri Oct 1 05:01:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514989 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp451925jaf; Thu, 30 Sep 2021 22:05:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydL1vX1MUhytvggncDL7OttAaIU0TLxxkZpnT1zn1C9TlWB4Cp3DuJmzumB+wlYvrqmkUF X-Received: by 2002:a17:906:3fc8:: with SMTP id k8mr3889681ejj.217.1633064717478; Thu, 30 Sep 2021 22:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064717; cv=none; d=google.com; s=arc-20160816; b=cqKdBvfxoUlUe/SnLr0DRs5Qp9BP0oy0m6kdiepotSU8bvoHZXPtf/rA871MtLSXzv qPCrdG85v8tj11q9kIGpJbDPsGtIV3ZO/rQd4AmmTUwehflwVaWqTEiXpkrESvWJtZmL d1Plp9lB6lvd/XDCbosb9119phFd0Dzxe936B0XyXZ0JCjGBXLIQpk0q7dY6J61EbAnm TZiBsMCC3Ll4Qz6vaixnuKnO0UIraGAoxWqnICoHojjhRngh1lUUlRf2Vv7k4rC198oz KydYoe04gjKXrOCNdWTSuIQO/0wKjBu8QB9NBIsYjLPBH/kU91Tx44X9uHY2f2r2Z041 x7LA== 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=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=yNK0piGgCyMGX5i89jA7aM+aiTprYUduU/eu8aEodyXe4OwEvSmeBufwsdl6kNZaor xvYqeaEva2kFUNOa7O6R9fkmavPNMvEW1d2otC28wvBdms6Yppyt6HUEME4loFnLDZ4z P+PRknNLSH5qAcws9Y1xM+IOYX7DFZV86jr04GiZxevtyKb85Wtgnizw4k2D2KZSDBno kp3iNRp7O2rYx40+3er6VmVwwFRVpcBQo2zF38jpOQtO9JzVJ1EUDA3k2lZb7nQi9IIB cVFOmcFmUJkmeuuqVoZ+g+SXRAH97TiQEnv9Bj6lq4umM3sNUhVDuji5+4RIS5bcIGps kwVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t6giJy3p; 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 d13si5790746edo.317.2021.09.30.22.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:05:17 -0700 (PDT) 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=t6giJy3p; 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 50A15831B2; Fri, 1 Oct 2021 07:03:50 +0200 (CEST) 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="t6giJy3p"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36ACF820ED; Fri, 1 Oct 2021 07:03:35 +0200 (CEST) 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-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 7423482FC5 for ; Fri, 1 Oct 2021 07:03:28 +0200 (CEST) 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-pf1-x42c.google.com with SMTP id g14so6921302pfm.1 for ; Thu, 30 Sep 2021 22:03:28 -0700 (PDT) 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=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=t6giJy3pp/8Id/EwGFJMSKfPwq8bg26L+WPvA4w64BWmG0Pi8KJxJ6Jo+TtuM6r38i TYKuTJdqX11nNB4soYv5d7XI5gXLuFbtgiv/MHzH7Iqn2Yut7TWA51eQZDV+64mMSqiG dppyhCV3y9cWe5iGrOJUF/z550kUvNW2NiaUG7hKW1U5LrXcZNrjqTHi+ek/kcGW7UFi oerHrYjwx3EXzU4n/gHt7bb17FlBRKF22QNLIywbYfaXbs7gZKdgbKg7UrPxupOfT3b7 9AuVnItMHgwyFaHQsGYXk1uw+Zf/u1DcRno+KJmyrYe1mSUBhMDH0DEq5FjgkDAJs0xK B9EQ== 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=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=ONkTKPBhfka6I7VmKhAuwbLMhHdL9jrC1tK9Flu1zqet6HfnvLhB5vuMrhFNc82Tgp Rq71+aWUX5xWgx+WeB4DTlSWZ3itw9jgOzME3TnRfv1hJvQ7/55xZArlYWHe9UarR2NH uKHUroOWAk7qjYmQMBuCpE1CxLL1eDf6WS8Q/6xmCDFfmdgHzeVHAAsDlhBunBCkTNAQ obEuRkV/+xBlwieH413jnwphpcCEIUL4kbUcxxsUyS09F4zwh4khCAXCF6HaLkDuYUwa VdS2eO+ak2a92InCsgowwpYH4MZgfYIc2NlEcM6+p4Rm+EgbbkK2U2cUt2q11laxDuhO I5oQ== X-Gm-Message-State: AOAM533+WV6LxrcM7aQw0V4bw5eGyWz9oOIr7UlsQYpjT/6llWstAJ7T +4DVaTtZopCRq9KAe3m6GsHn5g== X-Received: by 2002:a63:be4e:: with SMTP id g14mr8301382pgo.194.1633064606538; Thu, 30 Sep 2021 22:03:26 -0700 (PDT) Received: from localhost.localdomain (122-100-26-52m5.mineo.jp. [122.100.26.52]) by smtp.gmail.com with ESMTPSA id z8sm4615113pgc.53.2021.09.30.22.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:26 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC 06/22] sata: call device_probe() after scanning Date: Fri, 1 Oct 2021 14:01:56 +0900 Message-Id: <20211001050228.55183-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211001050228.55183-1-takahiro.akashi@linaro.org> References: <20211001050228.55183-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 --- drivers/ata/dwc_ahsata.c | 10 ++++++++++ drivers/ata/fsl_sata.c | 11 +++++++++++ drivers/ata/sata_mv.c | 9 +++++++++ drivers/ata/sata_sil.c | 12 ++++++++++++ 4 files changed, 42 insertions(+) -- 2.33.0 diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index 6d42548087b3..6a51c70d1170 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -1026,6 +1026,16 @@ int dwc_ahsata_scan(struct udevice *dev) return ret; } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + device_unbind(bdev); + + 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..09b735779ebf 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -1099,6 +1099,15 @@ static int sata_mv_probe(struct udevice *dev) continue; } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + device_unbind(bdev); + 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)