From patchwork Thu Feb 10 08:11:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 541399 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp2038845imo; Thu, 10 Feb 2022 00:13:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEwd3AWTWkKqg+47tsgZ0KXmEK4IYw6tQfHcHHSyFvxZCQLT82wtXtJ6z2wvHg6aFMremp X-Received: by 2002:a05:6402:1a52:: with SMTP id bf18mr7109973edb.428.1644480798813; Thu, 10 Feb 2022 00:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644480798; cv=none; d=google.com; s=arc-20160816; b=04BhSJAvZz6npmJZOY7944toc2ItEmApgYfTw3FWpQLIcpT+0ndBudpzmbuMR4CgeN UC8sN+mcIr1NJwDnqqXU2LBM6TEoe6xF49E5M00+VZVns5Eo9+ioImjpnbSGQ0Hq/8EN TaD4gu0XMs4ur9cO5DosVBdfEU3mt4Y3dv0tfwK2jWIzuiAagbzh1C3Vdx/tu1KMpeNA jJrRx+k1MW+fUaseGpqVptp3WDgXt7fE8Br7aYzPC6+mG6ejFwil2FHXQG1YWuw1IPRi 9pnLOUzSR53T4vvGd8ohazsdtCLoaUkigKOhlwQS2ay9PecTf87Dqx0nJIT2sus4aDpq Rgwg== 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=pcaNr8OceKx1o+wZH+Av/BHFeWyqQYvQxkcV8HghPX8=; b=V8bF9Kg54G6dmrFpdDFpa4fi2Ok9rqtEn696J8UkqJd5VeU7OPox5RP/n9yekLBq4h uMQGT0YKLGPhUgX+eGmlp1gyWUhWZo6GaWDj+KkU+d6qq78COl94qVDCfyei1JqbvVIz PTwx728d283NQvytEd9/ibxM7HvH/xa2CmW4Urn3cdXFv/etfL1DN7i4S+iMU37LoCOB CU4jBwFna8L0bt4tuD7gkXClTaa3je0+ArcUxZXdvVJ5o7p4qFFha75imAMte8qllsW/ DJ6iczS7oHT4FR/hmvGfEEt/cUYNPSgHx4SAbqXnGwQUZ6HhfsqbJn3oCXMwbUOuIGJ/ caKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lI2KPruU; 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 nc1si7860905ejc.151.2022.02.10.00.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 00:13:18 -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=lI2KPruU; 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 0390D83764; Thu, 10 Feb 2022 09:12:50 +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="lI2KPruU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8BC6982F5E; Thu, 10 Feb 2022 09:12:42 +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=ham 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 E63B08319C for ; Thu, 10 Feb 2022 09:12:31 +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 y9so4497579pjf.1 for ; Thu, 10 Feb 2022 00:12:31 -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=pcaNr8OceKx1o+wZH+Av/BHFeWyqQYvQxkcV8HghPX8=; b=lI2KPruU3R9S+udrnRUQEIN+NHnEezfryrD34Cz4KiUXMHr5HmfNWujrdJIaTovw09 HXyY/jAcODIrEfbJLU2voyA09IhD5aQPRNGoyZyTzUyGN4vL0ShkMWz0s2jm0JFEXhNf BSXA/LMxYxaKgz5coED+GDzsHyQA1SyJowuvRj/+obbA9ihrQ0vyKsJWAAn9dSfeQsQw Y9adv6m//cLdmRzGyKZ2Q+tplStoB2t1mmdtyTjdXsWAzuyQKPKnDObX3IxXKjsWkgff p2iyal5MlaLT+v65pRUKoZagG9xcvV6E+Hlax4ZK0eawsmO/TyKJYyye1elforZp5RHE uLHQ== 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=pcaNr8OceKx1o+wZH+Av/BHFeWyqQYvQxkcV8HghPX8=; b=r1TRAjKhU0UOepK6ekHM0vIkAJSW6YLcFuicdHaAcQLt+xvlv3fIRxNpWUAuOylREW XcckmUYIWFjyJjd3gP0wKvFyBhJSWBuwLb1SoLajqZ3+rUCaOpG79gzndue2+HBZU/eT nOcc2U8YELnLJwNNt8hNbU+mfx57pcdtYc700YEB/T7Sb/u45VT9HipKAl88YNJci9wT 8A7SLUCbEBuz7tUEmdxHFrVIkfKju8l6nJ7/SKBQp9aDXxwrw9SkwxEJ7Oz71pBNo7uM nl77+OTPe1mbxGkwDyufguheeaph2FiBz8frvLihFXCCfrNXWTjLwZYv5VGyneIVDgi9 iLEQ== X-Gm-Message-State: AOAM530IgN71Q4VYEFXSXEQeaIiBc8xuKfHQIHibhQoDyUJFJKSsaAFL HJeDavEMkc2BFidUUV8F2rSwaLyB3myrZA== X-Received: by 2002:a17:90b:3852:: with SMTP id nl18mr1567832pjb.228.1644480750256; Thu, 10 Feb 2022 00:12:30 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:412e:384:fab9:f24]) by smtp.gmail.com with ESMTPSA id lk8sm1529208pjb.40.2022.02.10.00.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 00:12:29 -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 v2 05/20] sata: call device_probe() after scanning Date: Thu, 10 Feb 2022 17:11:09 +0900 Message-Id: <20220210081124.86612-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220210081124.86612-1-takahiro.akashi@linaro.org> References: <20220210081124.86612-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..7b2d62d7581b 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 dda712f42cb2..cffeb01561b1 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(dev); + if (ret < 0) { + debug("Probing %s failed (%d)\n", dev, ret); + ret = sil_unbind_device(blk); + device_unbind(dev); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == sata_info.maxport)