Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52B1AC433F5 for ; Sun, 5 Sep 2021 21:49:09 +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 75A8660F21 for ; Sun, 5 Sep 2021 21:49:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 75A8660F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 7ABE082E4C; Sun, 5 Sep 2021 23:49:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="VJ3QVxPF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 355FC82F4C; Sun, 5 Sep 2021 23:49:03 +0200 (CEST) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (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 1340682E4C for ; Sun, 5 Sep 2021 23:49:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-qt1-x82b.google.com with SMTP id d11so4061296qtw.3 for ; Sun, 05 Sep 2021 14:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ysGUiaVOl3tcc4bu9qTxMNqDiPNmTcUKxk5Fm2Jab+8=; b=VJ3QVxPFqE3nE1rYjDXHuP+pJD6OYL5UQvJee+VYkWJwej4pgKOt5yjnfIQyNCgUzu I+ID8ykxigPPY6Tp+ZnDKcj3I+iijXvyCy2NEzBVo5+9/Kz/frwNY8lwFtpTBv2bcqWK DGiUFyKHBHj1pPh+Q1s8T4neDi7ZIkAbs+VQZoVOlsIPwUHnsL1h7FnsDBRLq9BUezC2 /v5FKRdirVQKnu3M08R3ITFLoTBwXKj1H1p6jeXGuIlI0GWr0P+GOrq58Fplx9pNSUMh B0LL7b0fsgltUdREJTbbskZJXs/bq9mVWzFlwBkijkIeljGDFTYkttjcf7eAkkdUtsS5 9HgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ysGUiaVOl3tcc4bu9qTxMNqDiPNmTcUKxk5Fm2Jab+8=; b=A2FBsjKlIUUgtEGuh8e9AhVtgg4aZZP/CsTlsQYuCF3Cy7Oe0BxaepGj2DeUqdFSd3 VdfcVypne6i+G4sGdVwF1+dszGqw+pip56PneBZngBT/9Sagx6OJSLQj+3Sxl/D4SdU5 CGJW1gXE+JmuHqWSzhPkSR6HgIJZeWr37FxUcCDZMKbWRFOtB0RySZjUuOm9jqmvQNuX VqHCcq2LQHNB29RsA2m+R0URSpxHP6raNi9vtgLA9G7zRgSvSy+RjuIxghHGrwxQdFoj 8FQPtYw85N7n4kUrGXyAFXf7iYNhYA1FEQDau5rRi9xhQIsVKdAA9/LzOTHWQKrgJQ6R TVYw== X-Gm-Message-State: AOAM530DTYjOgt3vXowHs32tmA3/p6ihHNZXvynFxnUE0ntVd57HRxYJ uIAiSfyeNq4pGTXGyZqfhdVVV66u7po= X-Google-Smtp-Source: ABdhPJzOxaCRSDBoPzeim717aQtXd/GWGYZCe3PDcMF3V6dn+cOyVQhA65IVp5crXTgPkU+7djW4lQ== X-Received: by 2002:ac8:d1:: with SMTP id d17mr8349841qtg.311.1630878538528; Sun, 05 Sep 2021 14:48:58 -0700 (PDT) Received: from localhost.localdomain ([66.218.48.244]) by smtp.gmail.com with ESMTPSA id l11sm4031664qtv.88.2021.09.05.14.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 14:48:58 -0700 (PDT) From: Tony Dinh To: U-Boot Mailing List , Stefan Roese Cc: Tom Rini , Simon Glass , Tony Dinh Subject: [PATCH] arm: mvebu : sata_mv should probe all ports Date: Sun, 5 Sep 2021 14:48:25 -0700 Message-Id: <20210905214825.28269-1-mibodhi@gmail.com> X-Mailer: git-send-email 2.20.1 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 While a board could have multiple SATA ports, some of the ports might not have a disk attached to them. So while probing for disks, sata_mv_probe() should continue probing all ports, and skip one with no disk attached. Tests with: - Seagate Goflex Net (Marvell Kirkwood 88F6281) out-of-tree u-boot. - Zyxel NSA325 (Marvell Kirkwood 88F6282 out-of-tree u-boot. Observation: If a board has 2 or more SATA ports, and there is only one disk attached to one of the ports, sata_mv_probe() does not return a successful probe status. And if only one disk is attached to the 2nd port (i.e. port 1), it is not probed at all. Patch Description: Let sata_mv_probe() continues probing all ports, even if there is error in probing a given port, and then return a successful status if there is at least one port was probed successfully. Signed-off-by: Tony Dinh --- drivers/ata/sata_mv.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index dadb2c7c2e..003222d47b 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -1068,6 +1068,7 @@ static int sata_mv_probe(struct udevice *dev) int nr_ports; int ret; int i; + int status = -ENODEV; /* If the probe fails to detected any SATA port */ /* Get number of ports of this SATA controller */ nr_ports = min(fdtdec_get_int(blob, node, "nr-ports", -1), @@ -1078,7 +1079,7 @@ static int sata_mv_probe(struct udevice *dev) IF_TYPE_SATA, -1, 512, 0, &blk); if (ret) { debug("Can't create device\n"); - return ret; + continue; } priv = dev_get_plat(blk); @@ -1088,18 +1089,23 @@ static int sata_mv_probe(struct udevice *dev) ret = sata_mv_init_sata(blk, i); if (ret) { debug("%s: Failed to init bus\n", __func__); - return ret; + continue; } /* Scan SATA port */ ret = sata_mv_scan_sata(blk, i); if (ret) { debug("%s: Failed to scan bus\n", __func__); - return ret; + continue; } + + /* If we got here, the current SATA port was probed + * successfully, so set the probe status to successful. + */ + status = 0; } - return 0; + return status; } static int sata_mv_scan(struct udevice *dev) -- 2.20.1