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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 616FDC001B0 for ; Sun, 13 Aug 2023 14:30:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E7B18699B; Sun, 13 Aug 2023 16:27:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NNUoy05q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 377A68609B; Sun, 13 Aug 2023 16:27:43 +0200 (CEST) Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 091D386985 for ; Sun, 13 Aug 2023 16:27:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-349a94f3d69so2499565ab.1 for ; Sun, 13 Aug 2023 07:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691936859; x=1692541659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LG+GTuFp8O/6uaHRAfI2OnOmbbt1TCOFyJONXn4cJ2A=; b=NNUoy05q6pgn03GsaTpwBfxAM4+JJyBoiIOunvkAh3D/ZJ8LnyhUA4ygNxCcnOKqda 5n5Z6HWMoGpuIjwyL+/WWfeq4CH8DtpSq/5flAqKmMax/p/16x7RdEonFvhtQWEEwusM adltc1eD+53p3yxzBbpBu0DS2SsGtdcBKxmU0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691936859; x=1692541659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LG+GTuFp8O/6uaHRAfI2OnOmbbt1TCOFyJONXn4cJ2A=; b=Nj7IQ63k3orwvm72Qz/vpWJxPU5RCDOlWAwbrBK2A+jWfpqBpqQ+PBkC2QgNSTWud+ tgYN6vcYEvYmoDw5knFVbKiizIP5eQApqqcqLFrmcQtRx0VbLgNCQd56oaIZI1mj+l0e QeufgFcCgPD9kMuok7yTCWsLivjytvJsPvW8uz8fA8Hbdf8V1rxujKWBm4t3khwfw+Ry 97e2cxM3BKlTp1ehGbNvaXnpx343VKIAy6d01hyEMl0JgRJBrsJbbNsryHi/GWsG1ltk 5/1ykZY7Tk14LgdEqJwiHTCluO+jXA/nruHQyhD+6Ooe+v3yGtxk07uT6THydgmm01s0 4/Jw== X-Gm-Message-State: AOJu0YyaAAA9SyJdLR3j4dGnIRqTuEyT+YZbNIYl5OLbehucj2ZxVWfj JBn70pvFllVugds2DBAIg9AUYmrgP8J/EJPOoK0= X-Google-Smtp-Source: AGHT+IHocZ2sPnod4ssefE119FEieuuivYNYXNhhrQ8lHCni+GWdt7d/dYln1FwgZA4ORuK8nInuQw== X-Received: by 2002:a05:6e02:1d8f:b0:346:390a:1ce6 with SMTP id h15-20020a056e021d8f00b00346390a1ce6mr13489628ila.8.1691936859679; Sun, 13 Aug 2023 07:27:39 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id w7-20020a02cf87000000b00430cf006d9bsm2280952jar.30.2023.08.13.07.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:27:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 18/24] bootstd: test: Allow binding and using any mmc device Date: Sun, 13 Aug 2023 08:26:46 -0600 Message-ID: <20230813142708.361456-19-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230813142708.361456-1-sjg@chromium.org> References: <20230813142708.361456-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean We currently use mmc4 for tests. Update the function which sets this up so that it can handle any device. Signed-off-by: Simon Glass --- test/boot/bootflow.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 649237a9e229..54a878c4bd5d 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -508,21 +508,24 @@ static int bootflow_cmd_boot(struct unit_test_state *uts) BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT); /** - * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian + * prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros * * @uts: Unit test state + * @mmc_dev: MMC device to use, e.g. "mmc4" * Returns 0 on success, -ve on failure */ -static int prep_mmc4_bootdev(struct unit_test_state *uts) +static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev) { - static const char *order[] = {"mmc2", "mmc1", "mmc4", NULL}; + const char *order[] = {"mmc2", "mmc1", mmc_dev, NULL}; struct udevice *dev, *bootstd; struct bootstd_priv *std; const char **old_order; - ofnode node; + ofnode root, node; /* Enable the mmc4 node since we need a second bootflow */ - node = ofnode_path("/mmc4"); + root = oftree_root(oftree_default()); + node = ofnode_find_subnode(root, mmc_dev); + ut_assert(ofnode_valid(node)); ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false)); /* Enable the script bootmeth too */ @@ -530,7 +533,7 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_script), "bootmeth_script", 0, ofnode_null(), &dev)); - /* Change the order to include mmc4 */ + /* Change the order to include the device */ std = dev_get_priv(bootstd); old_order = std->bootdev_order; std->bootdev_order = order; @@ -545,6 +548,19 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) return 0; } +/** + * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian + * + * @uts: Unit test state + * Returns 0 on success, -ve on failure + */ +static int prep_mmc4_bootdev(struct unit_test_state *uts) +{ + ut_assertok(prep_mmc_bootdev(uts, "mmc4")); + + return 0; +} + /* Check 'bootflow menu' to select a bootflow */ static int bootflow_cmd_menu(struct unit_test_state *uts) { -- 2.41.0.640.ga95def55d0-goog