From patchwork Mon Jan 17 14:11:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1580785 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=C424+jYO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jcv4C4Smdz9s9c for ; Tue, 18 Jan 2022 01:12:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D2ACA82C6D; Mon, 17 Jan 2022 15:12:21 +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="C424+jYO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E01A82DA1; Mon, 17 Jan 2022 15:12:19 +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,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 6324780F56 for ; Mon, 17 Jan 2022 15:12:16 +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-x535.google.com with SMTP id k15so66005805edk.13 for ; Mon, 17 Jan 2022 06:12:16 -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=qTJfMWXE1a6iwjJPqxFgb38MUGC1aZOnEpwjdSpxY2w=; b=C424+jYOO4AyfHGEs4OfXH7oabfUa58a4tWVmOSgXhjOQJ9lQpnSRXs1auVpgHovbO LZmebHTbdL5KCi8Ef7BBat1Y2tCPtc9K4AXwSIbffm9hw/CmWU1NquhJaAVfcrLYFg3u ++To33JI3kC7YA/e1TVxgjJoCwDEObRZNV6udag5fLjhiEIWN5jot8Kky23S0TKmmgf7 FKm4Gm7BhQ8M0pbIithnIFv1sY9qb3SAu1gT59IVj5/WT9bsVYEQLwkxBdbhdtoQFPSh VgoyWcZXXWzYNfX4GixZFrSrp8DqEBJdv92QUc90rpPWf0GzRrkACbOE9MGqP7mI23sd b6pw== 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=qTJfMWXE1a6iwjJPqxFgb38MUGC1aZOnEpwjdSpxY2w=; b=PuZN1VoE6Y5NuWxe15BDKP2zxWa9UouyPcMCtL+BkkU9p0yNSQ1Nhn42KUcPQh4hFu MTncrHMA0gO5HzHJRcrjoEDkm5NSI2Jos51DJMqhgFIIhQcDfsBGINQJtn1X7g02dyye Hdqq1ivpN1CbDts5Ct6icg6dTbhZ76zwoyBxzqeBx4MssPv+dRG+PSzyTALS3u83Tj5n PQcWMDCvPjhh+RNuFzyQtz0YWJ5q6OdUDTzfrwOvECnSwIks5we98EaFY8yX/OIQpjtZ J9ReuPtZ9FUTS4B420dMEd8fB2X0rZ99Ru25sJMWGV5S+6lbcJnFuz+SAiNhyazVFtdq ivhA== X-Gm-Message-State: AOAM533Q77jLeALK0XSaraUNm4ntjqEH2mwHj6raecKEk+4AG5quBA1R GbeQ5aR2/91vSb+hrHSr+5+nvjJEabXrxA== X-Google-Smtp-Source: ABdhPJzdAht4GexhI1ipNh37gxUv9cFXJx49sF+KCVFzlOrO7TIkEv1URFAeAykO4Nt+5vH0C0xUZQ== X-Received: by 2002:aa7:c1c1:: with SMTP id d1mr20752910edp.416.1642428735797; Mon, 17 Jan 2022 06:12:15 -0800 (PST) Received: from hthiery.kontron.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id pk10sm4454821ejb.84.2022.01.17.06.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 06:12:15 -0800 (PST) From: Heiko Thiery To: u-boot@lists.denx.de Cc: Michael Walle , Heiko Thiery Subject: [PATCH v2] spl: add support for custom boot method names Date: Mon, 17 Jan 2022 15:11:48 +0100 Message-Id: <20220117141147.34568-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.2 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.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 common/spl/spl.c | 5 +++++ include/spl.h | 16 +++++++++++++++- 2 files changed, 20 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..e7b2ef0693 100644 --- a/include/spl.h +++ b/include/spl.h @@ -459,6 +459,18 @@ 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 the MMC driver 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 +553,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