From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 389E5C433EF for ; Fri, 1 Oct 2021 05:04:52 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AED84611C1 for ; Fri, 1 Oct 2021 05:04:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AED84611C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84D4383216; Fri, 1 Oct 2021 07:03:43 +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="OVsxbRS7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7EE8D81EE5; Fri, 1 Oct 2021 07:03:27 +0200 (CEST) Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 32BA08169E for ; Fri, 1 Oct 2021 07:03:22 +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-x432.google.com with SMTP id h1so2797713pfv.12 for ; Thu, 30 Sep 2021 22:03:22 -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=OVsxbRS7zdh85OVqEA4Z8ZBO4jKth47K9YLiyiCsZVxhW9QdYNfHMND9IyXlToOx1/ 7B3Bt4NKhUj33W70hetj6MA5zON3LnnXGwqw01/+oztwTLrkK16G0haBTgOSWMG723nF CSlTVLV/K/BZiAtP9bDgK0tXdOCTyzKiaVrJm/OrHzxY6IxyVnwGzARhnmfoAx+AbGG0 tUGiGXER8FFpRc+obv66feTcTIUeymvGcTDNQIKFIfoNfHWNbBwVbZ9tu8L/O12vwk68 erNAgfuhJQdNRZY0FZ44EcM9q+TTCyG79BRKC0zy8WrdLDESyONFjzDeoehgcDF7g+WS o84Q== 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=5cSs2yYmIpZ4LpcT5U71leBI78WianUascVW4eXJ7aD0j8zfIR56oP5Qk3+IOp55/q p6ihrEYos8DQqoXqe2ZFzI0iBHvFs2v/9SVzJnPU3acdM+VwCA2t/f7ApyRLqTn07Agv +DtaBWwXDNEhuFUGTsaU7I2DmnGE4IXA8MkuMWiqnJaMOMS2nruJ7NBwT655+AYXw58z h7ryS3eV2eWAUlsmOVcJNZZBdIltyrsodNyV17ku+9R7D0JczyJFtK6HMQ4ISGxkz/av Em5xf7MG3+SMweKYimALjk/SeoLNT6KQnm54DeqvQMPPGLp74QIFJbgkIp7bqc0jXX8s PBUQ== X-Gm-Message-State: AOAM5303LzLdsHhQLTvuKHKnUa8gO5OHrG2WcKQZ/GraO+zx0KtZPVvO X4QCN1fau9xkrtEy0oa+QzZsug== X-Google-Smtp-Source: ABdhPJyaYyB+QksnKsUxO2YFCZYEQrQI+7K4cwGXAP919PbSvs9IQIOr+gkRNV9bhPb8vS1p8kxmDA== X-Received: by 2002:a63:f80a:: with SMTP id n10mr8045593pgh.303.1633064600308; Thu, 30 Sep 2021 22:03:20 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:19 -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 05/22] sata: call device_probe() after scanning Date: Fri, 1 Oct 2021 14:01:54 +0900 Message-Id: <20211001050228.55183-11-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 Content-Transfer-Encoding: 8bit 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(+) 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) -- 2.33.0