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.8 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 7C3AEC432BE for ; Thu, 26 Aug 2021 21:42:51 +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 D4A7C60F39 for ; Thu, 26 Aug 2021 21:42:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D4A7C60F39 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 50B9483212; Thu, 26 Aug 2021 23:42:41 +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="krBwuFRy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1DD8183211; Thu, 26 Aug 2021 23:42:25 +0200 (CEST) Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (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 7432B83212 for ; Thu, 26 Aug 2021 23:42:16 +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=mr.nuke.me@gmail.com Received: by mail-oi1-x232.google.com with SMTP id s20so6707685oiw.3 for ; Thu, 26 Aug 2021 14:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vw+arTQIh94R/1Rhi/R3AjpUyEdnGQADcjj5LoFpCeI=; b=krBwuFRyg0OR0Qg45Ildt4XuQKw5hvm8n3wXHlOdaC+t/e51TT1A+zQnWurSHPGGAj V5wljJ+PZ1SSY+Ee+3J8aIdoOwk/2eep7fBwjfPjCNkW3KXCtnt9seV/HNOncmPWDkaN hon4Y0q0g8g7QodUvueWVdhjskrj3gXkEMLTxWaIuwr9cOg3T6O0Ag4yk2Jt7ngEK2qC Wvyu36JKNlVGp3YdTfotvVV6dJaHn0hMqcs4LX2rmsK0S9NIZo9dg/xdgZ6cqWegaXPj HYjcoJEnzr2jyszb3zIdc8dG+FIT90e45nDcD4Q1jGXIzz/iDqa8uIP/6gGnOG8XFMK1 u9ug== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vw+arTQIh94R/1Rhi/R3AjpUyEdnGQADcjj5LoFpCeI=; b=E8JyIrBA2Idodw0hu1afojuZYrCty26GNIqvEjfKE0V3Hq8M8dM/nCM6HcigpHI3Y/ CuqTluzZXivqBuCLpSK54l9azA5zP6uMrL/8H7ShsZRV++NH9Rf7gN8PxFXYHSib20tX wbiFU4Y9S0OU+Ltde5o+mi35r7hMsCDtbOobBOZWBzZIO2g+y1FX8FmChmZfXFEPgQU6 F1fZiCSbQdXwynLPn04J+JfztjmEzRGm5a9YjuIMUw5oPWACSNxLxRohSXNFZo6oc6fd +Zp3tfPkrT5LPcEHxrEEJXRsAlYPmIxQ1TquHUOqZlZXTRXRk0NO2Z9W5kGVJoL21b0Y Luuw== X-Gm-Message-State: AOAM532BnbBZHsdGmkIK8KkhXNhMQUA+jDXfhBqMQ8pvEhbkJFBhD0Qa q4en/DjnhidrK8Ya4pzTlaVoRl9v4No= X-Google-Smtp-Source: ABdhPJxsAbbaDe1zWx1FLg2cfyP9764s0LX9lX/GEcxCMacRUfasflBPkpKQuiT/H/x0BQExw5J9hA== X-Received: by 2002:a54:410d:: with SMTP id l13mr4191328oic.112.1630014134817; Thu, 26 Aug 2021 14:42:14 -0700 (PDT) Received: from nuclearis3.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id 14sm858852otl.78.2021.08.26.14.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:14 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 02/10] stm32mp1: Add support for falcon mode boot from SD card Date: Thu, 26 Aug 2021 16:42:01 -0500 Message-Id: <20210826214209.254461-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826214209.254461-1-mr.nuke.me@gmail.com> References: <20210826214209.254461-1-mr.nuke.me@gmail.com> 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 Falcon mode requires a board-specific mechanism to select between fast and normal boot. This is done via spl_start_uboot() Use the B2 button as the selection mechanism. This is connected to GPIO PA13. Incidentally, this GPIO is already accessible via the "st,fastboot-gpios" devicetree node. Offsets for raw MMC loading are defined. These point to the partition after "ssbl". Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c | 39 ++++++++++++++++++++++++++++++++++++++ include/configs/stm32mp1.h | 13 +++++++++++++ 2 files changed, 52 insertions(+) diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c index 8e4549a1b3..bb210d7727 100644 --- a/board/st/stm32mp1/spl.c +++ b/board/st/stm32mp1/spl.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include "../common/stpmic1.h" @@ -29,6 +30,44 @@ int board_early_init_f(void) return 0; } +#if IS_ENABLED(CONFIG_SPL_OS_BOOT) +int spl_start_uboot(void) +{ + ofnode node; + struct gpio_desc gpio; + int boot_uboot = 1; + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) { + pr_warn("%s: no /config node?\n", __func__); + return 0; + } + + if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0, &gpio, + GPIOD_IS_IN)) { + pr_warn("%s: could not find a /config/st,fastboot-gpios\n", + __func__); + return 1; + } + + boot_uboot = dm_gpio_get_value(&gpio); + dm_gpio_free(NULL, &gpio); + + return boot_uboot; +} + +#if IS_ENABLED(CONFIG_ARMV7_NONSEC) +/* + * A bit of a hack, but armv7_boot_nonsec() is provided by bootm.c. This is not + * available in SPL, so we have to provide an implementation. + */ +bool armv7_boot_nonsec(void) +{ + return 0; +} +#endif /* CONFIG_ARMV7_NONSEC */ +#endif /* CONFIG_SPL_OS_BOOT */ + #ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init(void) { diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 9fcd60285a..0849a1bddb 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -10,6 +10,19 @@ #include #include +/* + * Arguments if falcon mode is used + * CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR is the partition after "ssbl" + * CONFIG_SYS_SPL_ARGS_ADDR is not used, but needs to point to valid RAM. + */ +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 5154 +#define CONFIG_SYS_SPL_ARGS_ADDR 0xc4000000 + +/* Falcon mode from SPI is not supported, but the defines are needed */ +#define CONFIG_SYS_SPI_KERNEL_OFFS (~0) +#define CONFIG_SYS_SPI_ARGS_OFFS (~0) +#define CONFIG_SYS_SPI_ARGS_SIZE 0 + #ifndef CONFIG_TFABOOT /* PSCI support */ #define CONFIG_ARMV7_SECURE_BASE STM32_SYSRAM_BASE -- 2.31.1