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 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 0950CC433F5 for ; Mon, 17 Jan 2022 15:26:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D293680636; Mon, 17 Jan 2022 16:26:00 +0100 (CET) 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="GTgauNA8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5247880F9E; Mon, 17 Jan 2022 16:25:59 +0100 (CET) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 82B408002A for ; Mon, 17 Jan 2022 16:25:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heiko.thiery@gmail.com Received: by mail-ed1-x533.google.com with SMTP id j7so18662925edr.4 for ; Mon, 17 Jan 2022 07:25:56 -0800 (PST) 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=TyYOzz1Oo2Q3AIxEqGR1PVOUWCgt/7N6hV5u1FQk7mo=; b=GTgauNA8CZITGQ9y/rEAWNU6stzrUzNLmGQQXj64aOf+Az8qy3lE3yBl7gxNMptV4D QeScrXp1CQx5zpm4offOFdSA/JnZrh+copvBoVyFx3vTPOoBb7qn3tXr8pZaD3ufBOPG vl3HmcypwgUzxduKfRwRHFBYccslr/aHPG3ndg/fWLcKYHtXn20vPzMjJUejjOEPXhBe JrrY7jp6F6eik4OrXdBw1OKVYbG3JybDpOv2VZucnU3CitfTy96n2OOXsBvnl1lPyQpv ijOcvpY6wP2vXjrPursJNPRIxdJNLhN5oVw34Al9m9tq3auuI+sI4jp/E5VCposYGmSB Mh3Q== 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:mime-version :content-transfer-encoding; bh=TyYOzz1Oo2Q3AIxEqGR1PVOUWCgt/7N6hV5u1FQk7mo=; b=1nGqS16G8CCY3nSZU57sjaZu5Nf/1UoNhlRHMgILHGMMxwwjO8ONkdJ5mmeAdEpvdx gGJa4G0FgWtsOkGF2ogadDlHJbMjRnVjNNGS/2PBBCw5UhX+a3iI9szFv6zNtY+LFOUX fQBK/OB3exjJK/27jsiH/gwYpJSate7NcRZPb889HgJN6c4H0ARfaRNxg54PgK+i7vv3 kyDaRXqTeCYALIOPcfNk1AU4zfsCxzAQ3AjAvQCzp9eYBYFSe6l4oLYldfritLXwGQ1f JJgWyfMZH0nHEhsv6AemrcXIve0dkvC5BhNEii9kewoKaqN/88NNsZKiLvZxkeNIIZWL PXvw== X-Gm-Message-State: AOAM531yLmTAfXwha7Rr+wkuEjp5N/kbukM3lq7g3eRVLz05BENV8z2Q YrKxQeJGBuAvmNzpcRrdK86qpuUIH/g6mw== X-Google-Smtp-Source: ABdhPJyWlrOWywCdbHG/fmAmVmMQQgiaCxrX0l4BkfIixjUtyzbuLdiuqYNkhfp1VD5ilGjYCQ4l+w== X-Received: by 2002:a17:906:d8a6:: with SMTP id qc6mr17678670ejb.17.1642433155962; Mon, 17 Jan 2022 07:25:55 -0800 (PST) Received: from hthiery.kontron.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id j5sm4557630ejo.171.2022.01.17.07.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 07:25:55 -0800 (PST) From: Heiko Thiery To: u-boot@lists.denx.de Cc: Michael Walle , Heiko Thiery Subject: [PATCH v3] spl: add support for custom boot method names Date: Mon, 17 Jan 2022 16:25:41 +0100 Message-Id: <20220117152539.51684-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.2 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.2 at phobos.denx.de X-Virus-Status: Clean Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To achieve more userbility here the name of the boot source can be returned. E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card". Signed-off-by: Heiko Thiery Reviewed-by: Michael Walle Tested-by: Michael Walle --- v2: - add function documenation v3: - fix in documentation common/spl/spl.c | 5 +++++ include/spl.h | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 4c101ec5d3..b7b53f352e 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -174,6 +174,11 @@ __weak void spl_board_prepare_for_optee(void *fdt) { } +__weak const char *spl_board_loader_name(u32 boot_device) +{ + return NULL; +} + #if CONFIG_IS_ENABLED(OPTEE_IMAGE) __weak void __noreturn jump_to_image_optee(struct spl_image_info *spl_image) { diff --git a/include/spl.h b/include/spl.h index 0af0ee3003..247267bfa0 100644 --- a/include/spl.h +++ b/include/spl.h @@ -459,6 +459,17 @@ void spl_board_prepare_for_boot(void); int spl_board_ubi_load_image(u32 boot_device); int spl_board_boot_device(u32 boot_device); +/** + * spl_board_loader_name() - Return a name for the loader + * + * This is a weak function which might be overridden by the board code. With + * that a board specific value for the device where the U-Boot will be loaded + * from can be set. By default it returns NULL. + * + * @boot_device: ID of the device which SPL wants to load U-Boot from. + */ +const char *spl_board_loader_name(u32 boot_device); + /** * jump_to_image_linux() - Jump to a Linux kernel from SPL * @@ -541,7 +552,9 @@ struct spl_image_loader { static inline const char *spl_loader_name(const struct spl_image_loader *loader) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT - return loader->name; + const char *name; + name = spl_board_loader_name(loader->boot_device); + return name ?: loader->name; #else return NULL; #endif -- 2.30.2