From patchwork Mon Oct 4 03:44:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515134 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062039imy; Sun, 3 Oct 2021 20:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytZe+QKN6T6hd17PsdVN2D49+4QrsBuu7YyxL5oxe3lc1jkeM24WalKaTattcHIuU+wTCh X-Received: by 2002:a17:906:1405:: with SMTP id p5mr14581852ejc.197.1633319165616; Sun, 03 Oct 2021 20:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319165; cv=none; d=google.com; s=arc-20160816; b=LVCpkbKGRQ1vSAgH97ckmbjJlF2g2k8IPrAkofiJlEcUdhdKZVK/kLMACbBDZ1Ie3Y eqSCcd+ig6g3+gPquomxDHGn1uTIjxkaFVuE+HqxApBXvaQMhESDhmZtSSUEGXbXNta4 pgnzlhfS+z8GfHacS0E0An8bLf8SEJFhoqLYz72TNLgAkee2vfZ12vjl6XIpoRKRvyvz rWyaJj7ivZgicTjGS0VQutMbjxTd+UsrVnzVMdYUqxPcFSY1H5tdSaVx6cuJFlWOIldF 4tG/bfNEtj7+ac50rVredzMQ8MoSbKPSnHaxsNwW1+HHVeQjbK6ULxTO7cZwSFdh/Eq6 Ltkg== 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=hTQZP0zGzDOXpv9MmGmnYy+69vLzI1CpzsuDhJQ4rIeovleYBdGncPCZuOldJsTFKD ymdjB//+HiHx8zMn9Kr3JzLbClJeqYMoSG+wZupNjM7OwPYQc8rd3920GT/zgbLLaYmG ZRH2pFx7oJjOm5/65JR1Mg5JR150hBPhdWBWKxvHwuTdllpeTDGzrj70hYz4/R2erolm C3hrILDod2Yy+chCAKKQ1crtoSDdSj/ne5AWlMAOXZIzy+8BuhpewnkjOC7lMkHdYziy eRlaf2QF7B0glOAhyagGePS7EQPR+izI1R4NZTsolDPyJs9K948eR7JqwYH65ZJf+Pjw XIYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hoV6GEw9; 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 v7si15948473ejv.617.2021.10.03.20.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:05 -0700 (PDT) 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=hoV6GEw9; 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 1B2388356B; Mon, 4 Oct 2021 05:45:40 +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="hoV6GEw9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51A6383539; Mon, 4 Oct 2021 05:45: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-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 0C16383548 for ; Mon, 4 Oct 2021 05:45:29 +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-pj1-x102d.google.com with SMTP id np13so574364pjb.4 for ; Sun, 03 Oct 2021 20:45: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=hoV6GEw9g64DFbUQpXkjti4vlIImoNQnbaKZMFsy7gkVR+/4X753dBh4wktrmcdCUU STY+i/oAWXteVtSwoigIVTZXKicGU/63XEhTOKFBBvcPaLzc5c+hY56kYKYpeloC9ct0 pV6nsBZTaLihqqkMbBUSTjHObqGMH67vtqWdrqluWuT73bkmVfoWgCV1hcqtw5DwA4BY nsFF2QRuOpUA986nqb9UDeKY8jaGXI7PfJ6GHvpou/YkOVtcsF0Zx0ugNGTOnXtvb0T4 KZYorJ66maXRBDB0r7t/igj9Z4XwfJJ9FA3fg6DK7knRYb9mLI7J3tJXSLeGP1hbKaxx FWSA== 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=UNGeMx1Xfn+s7vFBtdOu7AuUQQViWu+5VzzKs1Nq6UtO3k9+Ht7Elmgy7zOBOcGPz4 1vPAzsqZklYqETDve7pJAEUqyKrlsLBBfgquGgb8iMJL1tXKWsBIuOCzsnFqzk/KDIgk 7k8JGCRLxrGWyipMJvl0EkVilcPmWN9XqWceX6pa/lMqAWAt2YuzHmI0uYecOckGOtSa I4y0wsj/rv51tUV0mrNy4CHcIDFJ6Py6AJuiAtKO7vlErfcByI5sfPn7koGybW/Qlt6x M9yjY4xI9gaWLmKyBo4krB4d4gLYJJ5hjsqsrvm5fhWJeIRKwKScD9dWZZY/xeEyuUgw KYFA== X-Gm-Message-State: AOAM532DArB/0if5mU2+VgIQKN2tm7aYW5zsCkbpD2XrTUEgMV6VbogV Vqdr2I/GHA7n2EW4PURkB/lADw== X-Received: by 2002:a17:902:d2c6:b0:13e:9bc9:1ae3 with SMTP id n6-20020a170902d2c600b0013e9bc91ae3mr9520610plc.87.1633319127374; Sun, 03 Oct 2021 20:45:27 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45: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: [resent RFC 06/22] sata: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:14 +0900 Message-Id: <20211004034430.41355-7-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-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)