{"id":2230929,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2230929/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260430084414.1354490-3-richard.genoud@bootlin.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430084414.1354490-3-richard.genoud@bootlin.com>","list_archive_url":null,"date":"2026-04-30T08:43:55","name":"[02/20] global: k3: use gd to store the resume state","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c91fd97105d00334b192709aafdf5b5564e9cb99","submitter":{"id":88519,"url":"http://patchwork.ozlabs.org/api/1.2/people/88519/?format=json","name":"Richard Genoud (TI)","email":"richard.genoud@bootlin.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260430084414.1354490-3-richard.genoud@bootlin.com/mbox/","series":[{"id":502237,"url":"http://patchwork.ozlabs.org/api/1.2/series/502237/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=502237","date":"2026-04-30T08:43:53","name":"Introduce resume for J7xx SoCs","version":1,"mbox":"http://patchwork.ozlabs.org/series/502237/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230929/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230929/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=HUbHDmYq;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.b=\"HUbHDmYq\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com","phobos.denx.de;\n spf=pass smtp.mailfrom=richard.genoud@bootlin.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5nmK6DlQz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 18:44:49 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id C618284687;\n\tThu, 30 Apr 2026 10:44:36 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id D65CE84686; Thu, 30 Apr 2026 10:44:34 +0200 (CEST)","from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id E9C678466B\n for <u-boot@lists.denx.de>; Thu, 30 Apr 2026 10:44:32 +0200 (CEST)","from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n by smtpout-03.galae.net (Postfix) with ESMTPS id 7E6D64E42B79;\n Thu, 30 Apr 2026 08:44:32 +0000 (UTC)","from mail.galae.net (mail.galae.net [212.83.136.155])\n by smtpout-01.galae.net (Postfix) with ESMTPS id 5405360495;\n Thu, 30 Apr 2026 08:44:32 +0000 (UTC)","from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id BEC311072B7AB;\n Thu, 30 Apr 2026 10:44: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,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n t=1777538670; h=from:subject:date:message-id:to:cc:mime-version:\n content-transfer-encoding:in-reply-to:references;\n bh=Y6EoOzHO3mIxV1nXF8K4bKSQFNev75nz0tkJ6XsRmfw=;\n b=HUbHDmYqpGWDpQNTn71TpPWZnYDIdLwtyNY++LW3ElyzcMT5fHzmTcpcUhQ922Htv3/Mld\n R4PoXdmovyQ4dQOZVPFyZ3RcI/WuoMPjeU6QvYnDVvwuYhvW8PpcXJsc76wAs1I0Ks5vMw\n ncKU/SK8iS+4b8FJijr4aEppkhBfSVVrblkhdMMl/HdQnP2Pavce22uHWk/okpxkI4yEpi\n JBBVn0RhWdEk1aG4xpfaA6j26ZsTy2XYzlnsbidDnsBbdQKCeuACtVoOOTi/2gMb3C08jw\n INxHDbOIf2lKjCueMSZAicqKKm56S4qUdw26cL/w7O9PWtBZgXn0ZJbW1O6rJA==","From":"\"Richard Genoud (TI)\" <richard.genoud@bootlin.com>","To":"Tom Rini <trini@konsulko.com>, Manorit Chawdhry <m-chawdhry@ti.com>,\n Apurva Nandan <a-nandan@ti.com>, \"Andrew F . Davis\" <afd@ti.com>,\n Vignesh Raghavendra <vigneshr@ti.com>, Bryan Brattlof <bb@ti.com>,\n Vaishnav Achath <vaishnav.a@ti.com>, Jayesh Choudhary <j-choudhary@ti.com>,\n Simon Glass <sjg@chromium.org>, Alper Nebi Yasak <alpernebiyasak@gmail.com>","Cc":"Markus Schneider-Pargmann <msp@baylibre.com>,\n Udit Kumar <u-kumar1@ti.com>,\n Abhash Kumar <a-kumar2@ti.com>,\n Thomas Richard <thomas.richard@bootlin.com>,\n Gregory CLEMENT <gregory.clement@bootlin.com>,\n Thomas Petazzoni <thomas.petazzoni@bootlin.com>,\n Richard Genoud <richard.genoud@bootlin.com>, u-boot@lists.denx.de","Subject":"[PATCH 02/20] global: k3: use gd to store the resume state","Date":"Thu, 30 Apr 2026 10:43:55 +0200","Message-ID":"<20260430084414.1354490-3-richard.genoud@bootlin.com>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260430084414.1354490-1-richard.genoud@bootlin.com>","References":"<20260430084414.1354490-1-richard.genoud@bootlin.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Last-TLS-Session-Version":"TLSv1.3","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"For J7200, J784s4, J721e, j722s, j721s2 SoCs, the everything is shutdown\nat suspend but the PMIC and the DDR.\nIn order for U-Boot SPL to know that it is resuming from suspend and not\nbooting, a flag is set in a PMIC register.\nSo, at startup, U-Boot will read the PMIC register and deduce if the\nboard is resuming from suspend or not.\n\nThis state (resuming or not) is consulted at several places (in\nboard_init_f() and in k3_ddrss_probe().\nAs it takes some time to read a i2c register, it's best to cache the\ninformation.\nBut, as stated by the README, in board_init_f(), the BSS is not\navailable, so we cannot use global/static variables, only stack\nvariables and global_data.\n\nThus, we use gd to store the resume state of the board.\n\nSigned-off-by: Richard Genoud (TI) <richard.genoud@bootlin.com>\n---\n arch/arm/include/asm/global_data.h | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)","diff":"diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h\nindex b2ec450f9002..f343d3396c1c 100644\n--- a/arch/arm/include/asm/global_data.h\n+++ b/arch/arm/include/asm/global_data.h\n@@ -14,6 +14,14 @@\n #include <linux/types.h>\n #include <asm/u-boot.h>\n \n+#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_ARCH_K3))\n+enum k3_resume_state {\n+\tK3_RESUME_STATE_UNKNOWN = 0,\n+\tK3_RESUME_STATE_BOOTING,\n+\tK3_RESUME_STATE_RESUMING\n+};\n+#endif\n+\n /* Architecture-specific global data */\n struct arch_global_data {\n #if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)\n@@ -108,8 +116,19 @@ struct arch_global_data {\n #ifdef CONFIG_SMBIOS\n \tulong smbios_start;\t\t/* Start address of SMBIOS table */\n #endif\n+#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_ARCH_K3))\n+\tenum k3_resume_state k3_resuming;\n+#endif\n };\n \n+#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_ARCH_K3))\n+#define gd_k3_resuming() gd->arch.k3_resuming\n+#define gd_set_k3_resuming(state) gd->arch.k3_resuming = (state)\n+#else\n+#define gd_k3_resuming() 0\n+#define gd_set_k3_resuming(state)\n+#endif\n+\n #include <asm-generic/global_data.h>\n \n #if defined(__clang__) || defined(LTO_ENABLE)\n","prefixes":["02/20"]}