From patchwork Thu Aug 26 21:42:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521385 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=F6vkPdv0; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4GwbtD39b6z9sSs for ; Fri, 27 Aug 2021 07:42:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75BCF8321D; Thu, 26 Aug 2021 23:42:35 +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="F6vkPdv0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C4D9983216; Thu, 26 Aug 2021 23:42:24 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 9384583210 for ; Thu, 26 Aug 2021 23:42:15 +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-x234.google.com with SMTP id 6so6617084oiy.8 for ; Thu, 26 Aug 2021 14:42:15 -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=Ema+Nx1gQzYsyMRkUkrb8dKeiu34AdyPL5lBP5zMJYA=; b=F6vkPdv0AfKsFTydoI9qq6rTdx7Hp+Br+2IgeyQWblEtCPCsLhlqm0pfXXj2nK+J4C tARsg9yOtjeGH9+05jYjyZFLIzXOIkpED5A8H36B5tkVMnlEmrRUZ3nWad/TGhhjhP7a MCk5ni6uVLUXQ5rulCZTfHJqFOG65tf+DHkDQAVWElOhEipACkowBDOo/jJDP7AGOLem w5RSgxP2E32gJkglL1i/OhRcGxOgSW+pO0mbIhQBFpqNCaIFIl8s9M6j2XTu6xd9z1mU NgfPtIFWYE0Vj4wDuMXzU1bA+OEhdiKTnC5CHwMXQTDmoQOvVi2E3j0Dytugulrlu0hz eFaw== 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=Ema+Nx1gQzYsyMRkUkrb8dKeiu34AdyPL5lBP5zMJYA=; b=gGIYsFxY70knna7L5fHjhqqMMwnQB72Hfa1YMjwiwSUDAL7hLL8fdcpr2DrRSuoRij ur5sBSTtAqn1j9bXojtu1fcXX05Wkc5C0VS5R0Ndxvvq3QxxBACdxQGjIsNX5XPB5n3/ CTUjZ/IbndqgiKWHJuDNa22Yu0fbiL1IO8H5QLlPzoQ2hvuYPuNTWVXvw0b2E2bHZHhW f+nDAl/FX+QJSh2Ionlm0ERREut3uIG80j5TIjV3qvBN0TK4Jv0mbLaSM8qGaKnK1TJo uom7H9+qK6jvs7VAW9JZYx/haZiuGF8SMBTD5l7tGWYwbaTNJ+96Mpzm2Txv5yB4deFh kr7w== X-Gm-Message-State: AOAM530GPgXweCFULKAGAYDrCkJaAHh331JVf8uje2K/G8nJV7TpIYmu JtaQVosDFeB+PNHhrQL56fhc3pzcxDE= X-Google-Smtp-Source: ABdhPJxFU8b51CkaeXHmtVIf01NCGGNQrEC/zlKLnY3+if/ZkpaD64GdUohTm78UUuRTR5UrkQsqiw== X-Received: by 2002:a05:6808:20aa:: with SMTP id s42mr12645450oiw.37.1630014133707; Thu, 26 Aug 2021 14:42:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:13 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 01/10] stm32mp1: Add support for baudrates higher than 115200 Date: Thu, 26 Aug 2021 16:42:00 -0500 Message-Id: <20210826214209.254461-2-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 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 The UART can reliably go up to 2000000 baud when connected to the on-board st-link. Unfortunately u-boot will fall back to 115200 unless higher rates are declared via CONFIG_SYS_BAUDRATE_TABLE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Patrick Delaunay --- include/configs/stm32mp1.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index b372838be8..9fcd60285a 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -16,6 +16,10 @@ #define CONFIG_ARMV7_SECURE_MAX_SIZE STM32_SYSRAM_SIZE #endif +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ + 230400, 460800, 921600, \ + 1000000, 2000000 } + /* * Configuration of the external SRAM memory used by U-Boot */ From patchwork Thu Aug 26 21:42:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521387 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=krBwuFRy; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4GwbtP2FJPz9s1l for ; Fri, 27 Aug 2021 07:42:53 +1000 (AEST) 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) 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-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 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 From patchwork Thu Aug 26 21:42:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521388 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GVYchbDJ; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Gwbtb1PrJz9sVw for ; Fri, 27 Aug 2021 07:43:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F32083211; Thu, 26 Aug 2021 23:42:48 +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="GVYchbDJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3002483216; Thu, 26 Aug 2021 23:42:28 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 AB17183218 for ; Thu, 26 Aug 2021 23:42:17 +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-x234.google.com with SMTP id s20so6707781oiw.3 for ; Thu, 26 Aug 2021 14:42:17 -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=NQ1FcGsMJO2x70RHgnSKydCnHM0mFjYPDny6+5kvnAg=; b=GVYchbDJ1uFs1Mk0wrn6chF1/xdlRMLTvhONneF3LTAQD+diBikj5Fz2lJzcYn+t0g fah+qoQrM2hX8oFNKGreavdedEZozOOLalBM7nEmSPhZo8eCxbPBlEzIJvD2c6ix4nGZ muoj/jfFY/pOH+E/R5ZE5nFGi2HWmOyO7E83pSQb4e98pYvoZzsLcqiGa8wi6CJOZ11G FffwoEiSDPRsHDw7sdh771gPGJGgFPWZiFhTwUzEFoFD1HJS8dzqaepg7jSjGNdygHEb wtGVAhI+5HljV005InA7S288pMdcMMJR3dwYCJozjkd1HDMJlBdT0D3AGLGDNLWGW0HF nhBw== 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=NQ1FcGsMJO2x70RHgnSKydCnHM0mFjYPDny6+5kvnAg=; b=LQ4hLS21Gqsbd0iBALDS4/8loNzuHswbAveGEy1PXCmNJWr3mUOdJlh+xT4FUgmXrF 7nu6nhPOekxuoPFmL6BtItq8oARfpByh45H2VvH4CtHlLUBzbWrO51S/Tq4odmA0uei2 BrrMl5+3B6oMM7U3wFJszmy44FmWKzESuvAIpwExpWg193XQf33ZSVwtzRV4gQTZ6i5p 5AC3gMGW9/9wph6jMDj/ipercY2V/yg4frEe15ZlU9udnHcDZUNAIiIhYpMtpRBqLfGO HRD3khDHm2iSry/def3vO8vmzghp7JTAi7ciMs9ZKN7djeRmmVwrJq1Yq4bsbxSc4jJi 6A0w== X-Gm-Message-State: AOAM530MIHHMSqZtS/P9T5GHLYTvAYMNaRhFBl6o6E5mIumc0hzHmeSi a7aLZtjL5y5jXubwG1ZofMLqIwwyhwE= X-Google-Smtp-Source: ABdhPJw0VCMtWwu5ESGryIp+H6pJsRQH98HANRYacOJOdlMehlCI8m5CewJDp5yx9KDVY03pT+mUtw== X-Received: by 2002:aca:accd:: with SMTP id v196mr11555214oie.152.1630014135843; Thu, 26 Aug 2021 14:42:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:15 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 03/10] board: stm32mp1: Implement board_fit_config_name_match() for SPL Date: Thu, 26 Aug 2021 16:42:02 -0500 Message-Id: <20210826214209.254461-4-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 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 This function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it. Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c index bb210d7727..543c037ad8 100644 --- a/board/st/stm32mp1/spl.c +++ b/board/st/stm32mp1/spl.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -92,3 +93,12 @@ void board_debug_uart_init(void) #endif } #endif + +int board_fit_config_name_match(const char *name) +{ + if (of_machine_is_compatible("st,stm32mp157c-dk2")) + return !strstr(name, "stm32mp157c-dk2"); + + /* Okay, it's most likely an EV board */ + return !strstr(name, "stm32mp157") + !strstr(name, "-ev"); +} From patchwork Thu Aug 26 21:42:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521390 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ZESMV7qj; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Gwbv12jNwz9s1l for ; Fri, 27 Aug 2021 07:43:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D868B8321D; Thu, 26 Aug 2021 23:43:13 +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="ZESMV7qj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76D418311A; Thu, 26 Aug 2021 23:42:33 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) (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 A04D38311A for ; Thu, 26 Aug 2021 23:42:18 +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-oo1-xc29.google.com with SMTP id t1-20020a4a54010000b02902638ef0f883so1389251ooa.11 for ; Thu, 26 Aug 2021 14:42:18 -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=RZT+HAZfrLyj8cHlQsqGduu6RYUYdMMQhft86KZ6OMA=; b=ZESMV7qj8GU5N9FTEfj18rMX+V5cd9WsxbOOLrLpRtaEJYYlJijE46VPzReSTJF1Mf EmDBtIKhRq+6VFkC24XWWfBa5YlKP7dq7T6fLCV/yjhApvZ57XWIo4egkyC6hIFcX29B DaiYSRaUlJJu3U56ziYDA0rjot0Bl1cR+Ai9xFrUqC4vXlwcnwumyQNj+T32cbPGF8wH 9vnnHDoAQXuBXgup4nciolmkfbkST1px5xfgI0b6sJKu9i5zkGKsNmZ9vyBMYFEIfHnh xHXCjSetxnj9G08tickJCcz8zsNtGiybJxaNRNNioau7n2NeHFlEYTGfS5ddULkKAijK qSpg== 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=RZT+HAZfrLyj8cHlQsqGduu6RYUYdMMQhft86KZ6OMA=; b=Ipp3Owby7je1qdBD9Tp1sPcDju+Ro0QOtB/x0BfH2jww3JiDLahHJHfzrL1BxjiVlO VuqqrOrD21QFKk7sjXgXG6+2pkOiOULliGG7ikilk8NXDC7iGOF6mR0yy+Uobl2ANfsZ Zz3guo/of5zNqedRLqAYLJx8hgSVFoLgb67c8peCPVmarKiSLwZJHp3GSg5f4kZ2EnXg 7cBW8EYtl/KxmNg/VWMPHMczrx9twa9NCeBuS/4ACPfn5K6eUKgCTd7dB7xHUslOuzm+ 92JGXou0jtt3ZxY8h9bvem+QsY7tI+IEOkYKhX5E3L/6OXn8bVM7NUZ11okilbBJBwh5 pcSw== X-Gm-Message-State: AOAM531L6vCQkrr1LqnOOnodoSgLFlHkgbNafoOFxBUrSGzBHJHhc13x S2rQUGJyVr7wDsSCFlhaMUj6xeBrkAo= X-Google-Smtp-Source: ABdhPJzIKuiG2b6pZ4/EG5eo5AeMKjMpYDh+Ch7gkq6GNbpc3GF0OCKpfpIUkcEjoulWnnzQBQ2cRg== X-Received: by 2002:a4a:a509:: with SMTP id v9mr5003466ook.73.1630014136878; Thu, 26 Aug 2021 14:42:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:16 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 04/10] fdt_support: Implement fdt_ethernet_set_macaddr() Date: Thu, 26 Aug 2021 16:42:03 -0500 Message-Id: <20210826214209.254461-5-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 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 Oftentimes we have MAC address information stored in a ROM or OTP. The way to add that to the FDT would be through the u-boot environment, and then fdt_fixup_ethernet(). This is not very useful in SPL. It would be more helpful to be able to "set interface x to MAC y". This is where fdt_ethernet_set_macaddr() comes in. It is similar in function to fdt_fixup_ethernet(), but only updates one interface, without using the u-boot env, and without string processing. Signed-off-by: Alexandru Gagniuc --- common/fdt_support.c | 30 ++++++++++++++++++++++++++++++ include/fdt_support.h | 17 +++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index 4341d84bd5..c4cbd4060e 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -592,6 +592,36 @@ void fdt_fixup_ethernet(void *fdt) } } +int fdt_ethernet_set_macaddr(void *fdt, int ethnum, const uint8_t *mac_addr) +{ + const char *path, *name; + int prop, aliases_node; + char eth_name[16] = "ethernet"; + + aliases_node = fdt_path_offset(fdt, "/aliases"); + if (aliases_node < 0) + return aliases_node; + + if (ethnum >= 0) + sprintf(eth_name, "ethernet%d", ethnum); + + fdt_for_each_property_offset(prop, fdt, aliases_node) { + path = fdt_getprop_by_offset(fdt, prop, &name, NULL); + if (!strcmp(name, eth_name)) + break; + + path = NULL; + } + + if (!path) + return -FDT_ERR_NOTFOUND; + + do_fixup_by_path(fdt, path, "mac-address", mac_addr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", mac_addr, 6, 1); + + return 0; +} + int fdt_record_loadable(void *blob, u32 index, const char *name, uintptr_t load_addr, u32 size, uintptr_t entry_point, const char *type, const char *os, const char *arch) diff --git a/include/fdt_support.h b/include/fdt_support.h index f6f46bb8e9..3f0bcb5a00 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -119,6 +119,23 @@ static inline int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], #endif void fdt_fixup_ethernet(void *fdt); + +/** + * Set the "mac-address" and "local-mac-address" of ethernet node + * The ethernet node is located from the "/aliases" section of the fdt. When + * 'ethnum' is positive, then the name is matched exactly, e.g "ethernet0". + * When ethnum is negative, the first ethernet alias is updated. + * Unlike fdt_fixup_ethernet(), this function only updates one ethernet node, + * and soes not use the "ethaddr" from the u-boot environment. This is useful, + * for example, in SPL, when the environment is not initialized or available. + * + * @param fdt FDT blob to update + * @param ethnum Ethernet device index, or negative for any ethernet + * @param mac_addr Pointer to 6-byte array containing the MAC address + * + * @return 0 if ok, or -FDT_ERR_... on error + */ +int fdt_ethernet_set_macaddr(void *fdt, int ethnum, const uint8_t *mac_addr); int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create); void fdt_fixup_qe_firmware(void *fdt); From patchwork Thu Aug 26 21:42:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521389 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=t4uAl38x; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Gwbtn5qWjz9s1l for ; Fri, 27 Aug 2021 07:43:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F1C728322D; Thu, 26 Aug 2021 23:43:08 +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="t4uAl38x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6CA483205; Thu, 26 Aug 2021 23:42:32 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (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 B351C83219 for ; Thu, 26 Aug 2021 23:42:19 +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-ot1-x32d.google.com with SMTP id k12-20020a056830150c00b0051abe7f680bso5397177otp.1 for ; Thu, 26 Aug 2021 14:42:19 -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=2hItgfHS0riRrilYwEgvnl7otxHSHrAkNeg/sXlz2dU=; b=t4uAl38xpBoayjHXWO+cnTn00OevjYvnLqafmgCywlkAQ7D0YFAYKIminkTpGafmfh MgOlDuXfvHKdyuSAmBYHBGxhTdjr49n6JGRzg7Amn1tGwMQXXcd1Pbt8Q0kKSZIwjiLa efiGmEsBPv7SxVSoKvanPXbxg7w07mGxhdgtsJr3FWciisXOk+LsdmY3HWEuWvqHlf0h 4meMZMBjzWj+lMWTPPtRN6kz6WDR4ZjiLQj6OsOJlFipaThJ6BJQ7fGoUKkJElF+lV76 E+78l2W0cBUxJNl7KwjOGgMXJhyC6Xdb7R4I4HXt3bus5xsPA754caCabwjFnK1X24Yv o7yw== 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=2hItgfHS0riRrilYwEgvnl7otxHSHrAkNeg/sXlz2dU=; b=ev189Jrettn4TScdHXi8DTTcKBRjI61ojU8gJOUOCqA1HtNJ4iRTE1B6d04/Do65N5 4ecGVUdlyHTgdy3FPTzMtwpxP/ArhuYBUxQjNcnMLzCiJJc8tlQIU0umI2Hm2jYa9B/M nPr0sdSqYjD+1IV27vT7jBHMi/oKDFeXgoKSnpKOf0gHA0FRHYHmQh1hNlckY7++FWVC cXLMMOPB9JHtRV7v1yB3bqBTpDgbfP01hSnNLv/fqpGyp52YrUaZ8UGsLZZSYeaEd2AS 8z2EelgZlWyb4/QNDbo6uLWngwTz7Var4fMDDmHqylV+ZeL+YcVAwSKX6y+mgTKGHrry 5+LQ== X-Gm-Message-State: AOAM531Hf00f25QAMWfycQfSr34e1Qav69iywhzFfTgGqwyPnv2eOQnW WyMJ1ZN4Mw30GLIT1juTxXVIyWOuCmQ= X-Google-Smtp-Source: ABdhPJy2sB49i/RkyoGSYsNNM02KLTbS5QneaNNUVa6nzuSTc9x2fnZIF1M5KHVEqdlWVl2/NpCvTA== X-Received: by 2002:a05:6830:88:: with SMTP id a8mr5187042oto.233.1630014138008; Thu, 26 Aug 2021 14:42:18 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:17 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 05/10] arm: stm32mp: bsec: Do not skip .probe() for SPL Date: Thu, 26 Aug 2021 16:42:04 -0500 Message-Id: <20210826214209.254461-6-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 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 stm32mp_bsec_probe() was skipped for TFABOOT and SPL_BUILD. The idea of skipping probe() is that we can't access BSEC from the normal world. This is true with TFABOOT. However, in SPL, we are in the secure world, so skipping probe is incorrect. In fact, SPL is not even built when TFABOOT is selected. Thus, only skip probe with TFABOOT, but not SPL_BUILD. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/bsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index fe39bd80cf..a02d19c1b9 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -506,7 +506,7 @@ static int stm32mp_bsec_probe(struct udevice *dev) * only executed in U-Boot proper when TF-A is not used */ - if (!IS_ENABLED(CONFIG_TFABOOT) && !IS_ENABLED(CONFIG_SPL_BUILD)) { + if (!IS_ENABLED(CONFIG_TFABOOT)) { plat = dev_get_plat(dev); for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++) From patchwork Thu Aug 26 21:42:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521393 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=TZFQdKvK; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 ozlabs.org (Postfix) with ESMTPS id 4GwbvQ1c2jz9s1l for ; Fri, 27 Aug 2021 07:43:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22BAC83239; Thu, 26 Aug 2021 23:43:21 +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="TZFQdKvK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 094CE83189; Thu, 26 Aug 2021 23:42:36 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (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 0F1EA83227 for ; Thu, 26 Aug 2021 23:42:21 +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-ot1-x333.google.com with SMTP id 61-20020a9d0d430000b02903eabfc221a9so5444991oti.0 for ; Thu, 26 Aug 2021 14:42:20 -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=/A42Glvy8cNQ5MTm16d7kUpOtUkMPsOCwK1Js6GhOdk=; b=TZFQdKvKLAWcVTr7m4pTZ6NVlatFCHcFic4U0WJMn3A4XZL4a9ywJ2ZKrLMrGhzwym WHqdwMQfXfokgRE+FI5JuazWqWHufuGKwhBVsI40hisqiJ8w0jERIM3FiPGzDHghlXOV 6I/Mg7cIWK6T5WANoTMPhvrtjpPkvt1yKU5EKmimf0/9pm6aSFV253sQNJMmq6bcBR9I S3w9cWDJmtVcrnG7f5TXjWeIN73b44OXnpJsDAi06sWMQqh8s2dr8jUHTrze9nw0cx+c r4BnP2bOb1Has7Nrh1eOpvSy5MLlEECrUK9IS4bj9oldW3kJ19d/upUnNaf/YQAIYHbP LcvQ== 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=/A42Glvy8cNQ5MTm16d7kUpOtUkMPsOCwK1Js6GhOdk=; b=dG5FcQJREAwEN0ZRpFxSfN2S302m7yJhsJ0jQ+aCVEi7TSbrVpDHmL8iKuFfoj03iM OhaPGPt0yTfVDjMcoj7Gwq7eisqQodclkwSSkeCwx63b0gdkX/nYw8GnGrTQ7tREgMn7 ToMASaF6PTZyY/PhyeY5ycBNW4RHFxe8cmUS2ww9KwpHG91Z5b28hq79kYdPaCicVwoj NQDAH0rq9cp7ouCyFWRwfFSKn2xUQbQ4QfwKcwJEsLcPUsD4PIkTT/2a3kASdWbPQWrr rrAQO4bzoQFJ/3uQii9uipei8LawgvUc/jcb3yryPvNk9Gui0WEpyfYZmL+eY14jiPWL mxQA== X-Gm-Message-State: AOAM533Skuh/rKkCQ/SwNyJWEV1n/a+kc2xrAYrQkAGqRvOINhHnUxgt mbIm5/vroWCF5ZQhTcU2j/hXrStnsBc= X-Google-Smtp-Source: ABdhPJz/AX4g9/SAlFBZhkRcRF3hIHAEf+NIF7nJlX5FkkVrXREcAb+PZFGc781rV4HQ831GcQryHw== X-Received: by 2002:a9d:1b48:: with SMTP id l66mr5133493otl.261.1630014139291; Thu, 26 Aug 2021 14:42:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:18 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 06/10] arm: stm32mp: Factor out reading MAC address from OTP Date: Thu, 26 Aug 2021 16:42:05 -0500 Message-Id: <20210826214209.254461-7-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 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 Move the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index eb79f3ffd2..8727de513c 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -593,6 +593,28 @@ static void setup_boot_mode(void) clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL); } +static int stm32_read_otp_mac(uint8_t enetaddr[ARP_HLEN]) +{ + struct udevice *dev; + int ret, i; + u32 otp[2]; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, sizeof(otp)); + if (ret < 0) + return ret; + + for (i = 0; i < ARP_HLEN; i++) + enetaddr[i] = ((uint8_t *)&otp)[i]; + + return 0; +} + /* * If there is no MAC address in the environment, then it will be initialized * (silently) from the value in the OTP. @@ -601,29 +623,16 @@ __weak int setup_mac_address(void) { #if defined(CONFIG_NET) int ret; - int i; - u32 otp[2]; uchar enetaddr[6]; - struct udevice *dev; /* MAC already in environment */ if (eth_env_get_enetaddr("ethaddr", enetaddr)) return 0; - ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), - otp, sizeof(otp)); + ret = stm32_read_otp_mac(enetaddr); if (ret < 0) return ret; - for (i = 0; i < 6; i++) - enetaddr[i] = ((uint8_t *)&otp)[i]; - if (!is_valid_ethaddr(enetaddr)) { log_err("invalid MAC address in OTP %pM\n", enetaddr); return -EINVAL; From patchwork Thu Aug 26 21:42:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521394 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=W3f2bRBH; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Gwbvc6FFHz9s1l for ; Fri, 27 Aug 2021 07:43:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 820DC83242; Thu, 26 Aug 2021 23:43:24 +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="W3f2bRBH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 25AD68311A; Thu, 26 Aug 2021 23:42:41 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) (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 6E7B683242 for ; Thu, 26 Aug 2021 23:42:23 +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-ot1-x32e.google.com with SMTP id o16-20020a9d2210000000b0051b1e56c98fso5365849ota.8 for ; Thu, 26 Aug 2021 14:42:23 -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=0eDVbpOjyIqQoFnpGUbEZg3TclG9Btt0IMhYr/jGmhc=; b=W3f2bRBHOZUL9/dSvv5ajU/gV/0QT07DeLNAEGIs6z3MByyFjQZlu1TzflUIUns4Ez V5JDHbDIKA4L0y7ehEYSAhcuLFlcYo3HwR/r5fds7vHlgnaGNigF3IrpM2ng3Mc9Yyiq tj0O/fKqTEh5/00SZcBkOWe7Yi5hYNKigFrhM7kUIg5ZDdDadtJH0nJ9Bt3/fsOrj+de uEX97rJDDEVRC1T60HmMo0JzQxW47ivOP3fBHfaRUooDO/kGgoAkcRxgRNOdnbbdW1aj u3kr9fxow/C9x84XcM40Y9nNpZjd9V2W4tQCaTpOqObZejV7nUK0Qdcrmg+4HCSLqckL CbYg== 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=0eDVbpOjyIqQoFnpGUbEZg3TclG9Btt0IMhYr/jGmhc=; b=Ywz07x0KEmDP4IsjEwDpMiH1sPPylRwLdxtIWhlH+6gN1J/KzUj4ScwWgIXFuvbtFW tZ7iL6oC2JYCGqfw0vkyxdYtMU0LrftENX0IAyXwYvw6dXu2hRYIlAwTkas6oGNICDye f7POWLO3ZfYh+YOGLiqzLmxo3p18oA3IhAcshokZ7b+VILDZR8ABPFTOpgpvr+ftsltU fZcAe6dxVC4CMtXrVIzlryRyn3onnN53AtzDTeP2GyLbWXmD7fcXYoMXsBjkyhE2opWq bSZ2kqG7xLKKrrnOmxXWvZv8giFkC4fZQZI8toSSKQzu56QgJrvKhZRcg/ZAZ30H1LF1 bQHA== X-Gm-Message-State: AOAM532eLcVkYxaGBV6STF1az1JimumrltPO+zWCijJRW1YKtvNtRpSR 2mp+ap16v8gQCmwVUkLVbdjEp6SQpVc= X-Google-Smtp-Source: ABdhPJxbfZvD3EdI7FCBGfRlIWNAawTOR2ppCnZlsvgxDGHorGC0EOn7LQk85sI9T/iZFL185TaYvg== X-Received: by 2002:a9d:730a:: with SMTP id e10mr5184059otk.120.1630014140537; Thu, 26 Aug 2021 14:42:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:19 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 07/10] stm32mp1: spl: Configure MAC address when booting OP-TEE Date: Thu, 26 Aug 2021 16:42:06 -0500 Message-Id: <20210826214209.254461-8-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 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 When OP-TEE is booted as the SPL payload, the stage after OP-TEE is not guaranteed to be u-boot. Thus the FDT patching in u-boot is not guaranteed to occur. Add this step to SPL. The patching by stm32_fdt_setup_mac_addr() is done in SPL, and patches the target FDT directly. This differs is different from setup_mac_address(), which sets the "ethaddr" env variable, and does not work in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 22 +++++++++++++++++++ .../arm/mach-stm32mp/include/mach/sys_proto.h | 3 +++ arch/arm/mach-stm32mp/spl.c | 1 + 3 files changed, 26 insertions(+) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 8727de513c..2b8b67bb40 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -646,6 +647,27 @@ __weak int setup_mac_address(void) return 0; } +int stm32_fdt_setup_mac_addr(void *fdt) +{ + int ret; + uchar enetaddr[ARP_HLEN]; + + ret = stm32_read_otp_mac(enetaddr); + if (ret < 0) + return ret; + + if (!is_valid_ethaddr(enetaddr)) { + printf("invalid MAC address in OTP\n"); + return -EINVAL; + } + + ret = fdt_ethernet_set_macaddr(fdt, 0, enetaddr); + if (ret) + debug("Failed to set mac address from OTP: %d\n", ret); + + return ret; +} + static int setup_serial_number(void) { char serial_string[25]; diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 4149d3a133..2d24cfee3f 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -47,7 +47,10 @@ void get_soc_name(char name[SOC_NAME_SIZE]); /* return boot mode */ u32 get_bootmode(void); +/* Set 'ethaddr' env variable with MAC from OTP (useful for u-boot proper) */ int setup_mac_address(void); +/* Patch the first 'ethernet' node of FDT with MAC from OTP (useful for SPL) */ +int stm32_fdt_setup_mac_addr(void *fdt); /* board power management : configure vddcore according OPP */ void board_vddcore_init(u32 voltage_mv); diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index 405eff68a3..d9fdc5926c 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -181,6 +181,7 @@ void stm32_init_tzc_for_optee(void) void spl_board_prepare_for_optee(void *fdt) { + stm32_fdt_setup_mac_addr(fdt); stm32_init_tzc_for_optee(); } From patchwork Thu Aug 26 21:42:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521396 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=h1WRJT4h; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Gwbw12QS2z9sSs for ; Fri, 27 Aug 2021 07:44:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0C8E83255; Thu, 26 Aug 2021 23:43:50 +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="h1WRJT4h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C2AE8321C; Thu, 26 Aug 2021 23:42:43 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (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 7EAEF8323E for ; Thu, 26 Aug 2021 23:42:23 +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-ot1-x32c.google.com with SMTP id x9-20020a056830278900b0051b8be1192fso5375589otu.7 for ; Thu, 26 Aug 2021 14:42:23 -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=/HYgYfONsM1dFHKNHx2gHtuNxkXTvSPnRlEWRWJNRh8=; b=h1WRJT4htFpNXdxjeFstjaHTn8AAAg6jdP2RbOEMVTM0ckHRhh1SgJHgo3Dc8rnjg1 euxaHHEx7dpoBDnnQC+62wiiYd1SngASqBCq1lzagePo3mGDtvpcUmy40Xl5M5PgzuxN kXN5yxi/KS9nHdW9yJzasOmf5EZ19wHKqI03tezZAt5wNffJSPiQnyBbfbMlTn7ZNvFm raccARYIGZr9k8bQKiXOVHXJjiQZMMcseForxka0zErYdlq7uwVLOj8kd7dbRkd2GVP7 a1E0Yr+Bx/3almW3+byL/70WmIWabN7iqcP5A9H57oyEk4r2JKFqP4wgdpjPwnHT4j1i /cQg== 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=/HYgYfONsM1dFHKNHx2gHtuNxkXTvSPnRlEWRWJNRh8=; b=DaPgzkrUTYLoEDskvv8tgSgU8DSIrzaJ+6P/PYqhhTjBRYsMTjFh2mSKP72CjpaupN l92vIIU7oT4jsiR6uUgbWVHU9Dn0OXKnn6BpAA+13Pr87qtUIC6yaRS/XqdXUlzMoxMW dFK7sfd6T4LZSWrPs41CkPgH28xslwfC+AJbSzuD8hsr5L74vJCU+GEVe9DL6ytmBD74 BduvFV2+ehi8uimLrxKgTls9yaScV/fZZ3thZe6dRg6cB8A/e39bfUGRcGMEackUOyrL aOqnoxcOBideH0yzERryPTyE/sL+qhUHAFSfXMasObNXEdVBIjkt3wZ8ZiGTKGclAZs/ 5GDQ== X-Gm-Message-State: AOAM530Ih/h+LObwUhbP/8wBHe2CBzJvOyIBgDJ8ri0+QZF8ReNKU+IT T2oD25wh71KkQQ/9G+XrhJWe2Jk59DA= X-Google-Smtp-Source: ABdhPJwwV1bOb2A66YAHsW5Fugm1ac3dF8l9bFOBRg37h3+uMwzI9h0/++uNXlD7NtfgJPxervHscA== X-Received: by 2002:a05:6830:3144:: with SMTP id c4mr5033993ots.153.1630014141740; Thu, 26 Aug 2021 14:42:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:21 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 08/10] lib: Makefile: Make optee library available in SPL Date: Thu, 26 Aug 2021 16:42:07 -0500 Message-Id: <20210826214209.254461-9-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 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 We want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly. Signed-off-by: Alexandru Gagniuc --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 8ba745faa0..73dacbb01b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_FIT) += libfdt/ obj-$(CONFIG_OF_LIVE) += of_live.o obj-$(CONFIG_CMD_DHRYSTONE) += dhry/ obj-$(CONFIG_ARCH_AT91) += at91/ -obj-$(CONFIG_OPTEE) += optee/ obj-$(CONFIG_ASN1_DECODER) += asn1_decoder.o obj-y += crypto/ @@ -74,6 +73,7 @@ obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o obj-$(CONFIG_$(SPL_)LZO) += lzo/ obj-$(CONFIG_$(SPL_)LZMA) += lzma/ obj-$(CONFIG_$(SPL_)LZ4) += lz4_wrapper.o +obj-$(CONFIG_OPTEE) += optee/ obj-$(CONFIG_$(SPL_)LIB_RATIONAL) += rational.o From patchwork Thu Aug 26 21:42:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521392 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=TU7pNQgX; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4GwbvC5pNWz9s1l for ; Fri, 27 Aug 2021 07:43:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF9BE83244; Thu, 26 Aug 2021 23:43: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=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="TU7pNQgX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A16F68311A; Thu, 26 Aug 2021 23:42:37 +0200 (CEST) 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-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) (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 9533D8320F for ; Thu, 26 Aug 2021 23:42:24 +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-x22b.google.com with SMTP id p2so6963731oif.1 for ; Thu, 26 Aug 2021 14:42:24 -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=wlKcpj5jHmlvZUiSoIE3x9wiQKdS0Go6iWYSSOKtYiE=; b=TU7pNQgXDESfr3Jro3a8f3f3A65bBk7+oenrm4aE02ygWGBjcZ976DXt0PMzM2jwpq PjSHZj6oLJHjbx/9oPdpPwmp90mfkKePaSzZytqaOvvPJaHuYYDQyG0FeHC+1eL+a3Te 6TJTt6v7gEQ7+7WwbPNvACcEsiyEZT0r9toof6EYnMJ6ybiNF0j3EZB6twJGPB1/m3U3 mLNASqC22Hp5E+aPTnUV78gQg6DppsuayvFcZqTbnwtOkCkpfs3TcHyNzoneNcv8nRL3 A/d434pGvsW7ZVayEF03ZdE+9psFKN8hunLNIr5Y/JUgpHGlMbYe2dlYxAEgJX6zmajs tKGA== 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=wlKcpj5jHmlvZUiSoIE3x9wiQKdS0Go6iWYSSOKtYiE=; b=a3y4HKnvYE1YTSFiRjVQ0A0pFSzcA19ylkuj6ZamAkUgv09oD1JoWD8Fn4TtDTzljH A7a66CH5fP6yOPcs7Lch7yweFoFLD3TPMP0A0hnUaTNMpBKjOb6FdQhPSG+AlsIsL1Gp Lz6qDYNKDeYf+oYlzjYL1dbLSjyXDfLFkndT4S0v86ebdJlL01Klsf4nBvE0+6AVAr/K Iy0GcARXpn44De1DSY4GrrqgUZDo1drjOTF20TS2vQsHsemaUuR30VcrBZvTXT2XHVMi rdOwFhHT0vWD6Z3tB9JdDZaob+otyTP4J7lbfGciku7o5JXYDNCNkZbLphFPmK8ZJ0ey Exrg== X-Gm-Message-State: AOAM532b6lHrIs6DTa6LATY0CWRkOltI5ycKdppLgN7DY+geXqPQP6ZT d66VUt/RzlGjOVYAWB4+oc2Znsd3xOg= X-Google-Smtp-Source: ABdhPJzdlW7CR4j+0R9dod5KNcU0Ir5VAGq3RsbewjKr9AopBfBAuyfO3EUJ3aSf1/dLnsOT1gjgew== X-Received: by 2002:aca:c614:: with SMTP id w20mr4277363oif.18.1630014142953; Thu, 26 Aug 2021 14:42:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:22 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 09/10] ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb Date: Thu, 26 Aug 2021 16:42:08 -0500 Message-Id: <20210826214209.254461-10-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 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 This node is required in SPL when booting an OP-TEE payload. Add it to the SPL devicetree. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 0101962ea5..2e65b9b4d5 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -31,6 +31,7 @@ optee { compatible = "linaro,optee-tz"; method = "smc"; + u-boot,dm-spl; }; }; From patchwork Thu Aug 26 21:42:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1521395 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vXDFCqke; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 ozlabs.org (Postfix) with ESMTPS id 4Gwbvq0WQ2z9s1l for ; Fri, 27 Aug 2021 07:44:06 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E6518322D; Thu, 26 Aug 2021 23:43:44 +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="vXDFCqke"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6E69683213; Thu, 26 Aug 2021 23:42:45 +0200 (CEST) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (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 927118323A for ; Thu, 26 Aug 2021 23:42:25 +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-ot1-x32d.google.com with SMTP id i3-20020a056830210300b0051af5666070so5391709otc.4 for ; Thu, 26 Aug 2021 14:42:25 -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=D9d00reuPnJt4IO8tXXk7K6+yF2oG/OxD6cAC0AOIs4=; b=vXDFCqkexZN7txz0aWZor4QmZL0a7Z2z0BmZwhqnHZ72iM1RvjFhVLN3FKxG5CZoMn 6JJH1+Lk8EfgjM8ju08TDK1Af/eVlkL3vAF3aV/YhboCRhq+FmfJgUDM+rSGasYemKnx aP2KiO9oS3h9WoJom3pk3mcIowelScIfUjIzBgKd7zH8BjO1/wgtSnyKvsGnWayBjuAS RzPRdusRqLMUkX+vDogW/96boZ5GxpWOkF7Y7xOUnr3E7esPmmTkAknCbrpJRhd84WjX LTBcHCOg94d8NqCiytrfzS3Fvs0Mtig3x5nhGx+gHDzU6OjqBiSnZdrT/OLD2P44M+Kb SS8Q== 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=D9d00reuPnJt4IO8tXXk7K6+yF2oG/OxD6cAC0AOIs4=; b=iB5SXoUC2Ltkmp14rzYmQutgq6fpTI/diCrjcVq8JPXLYZHomYFRqbKitRug7fxpJm szjm0Ri6b8bZGDVT+nt+SYXTG3wWnIzoSlxVPHo4jEMO3be6zhEavOx1Y0wfPMZ3ng/i DXlYJKBGvMZFBEmiRx/0NpRLoFFahGFfL5ATPYaUq4oeD5qzpRpJFHR5IUVaVfo11irs bGwl+NHAJydt3iMoKSUoXIhnlTo9wA+Job0s1esgDC8yeNMKV1hd17UooPeepwlhZoPs O0S33ivD0mxneBxDqRwkAt97jP36AuqKAyR1BTBERno+QpovXP7W3VOvKJH7y6UbikP1 Ou8A== X-Gm-Message-State: AOAM530qNkodejNoYJfrVdL81tOx0f5FNnXAXkyXyz6aEL6ddgiBKV6D CMkuYb14RFvRysQoLevewrYQRQKH7jo= X-Google-Smtp-Source: ABdhPJzrsvi5sGDq0MIm2W43mAkZ/q6p+FR3WmmralWQa5y+oXR3kjz/zPe52JbDaRWRhQmzr8IxQg== X-Received: by 2002:a05:6830:4097:: with SMTP id x23mr4949855ott.289.1630014143913; Thu, 26 Aug 2021 14:42:23 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:42:23 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: patrick.delaunay@foss.st.com, marex@denx.de, Alexandru Gagniuc Subject: [PATCH 10/10] stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads Date: Thu, 26 Aug 2021 16:42:09 -0500 Message-Id: <20210826214209.254461-11-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 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 OP-TEE does not take a devicetree for its own use. However, it does pass the devicetree to the normal world OS. In most cases that will be some other devicetree-bearing platform, such as linux. As in other cases where there's an OPTEE payload (e.g. BOOTM_OPTEE), it is required to copy the optee nodes to he target's FDT. Do this as part of spl_board_prepare_for_optee(). Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index d9fdc5926c..94fbb45cf9 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -19,6 +19,7 @@ #include #include #include +#include u32 spl_boot_device(void) { @@ -182,6 +183,7 @@ void stm32_init_tzc_for_optee(void) void spl_board_prepare_for_optee(void *fdt) { stm32_fdt_setup_mac_addr(fdt); + optee_copy_fdt_nodes(fdt); stm32_init_tzc_for_optee(); }