From: Fabian Pflug <f.pflug@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Marco Felsch <m.felsch@pengutronix.de>,
Fabian Pflug <f.pflug@pengutronix.de>
Subject: [PATCH v4 1/2] ARM: i.MX: scratch: add generic init for imx
Date: Mon, 16 Feb 2026 11:36:23 +0100 [thread overview]
Message-ID: <20260216-v2025-11-0-topic-optee-imx6-start-v4-1-b73279a8a971@pengutronix.de> (raw)
In-Reply-To: <20260216-v2025-11-0-topic-optee-imx6-start-v4-0-b73279a8a971@pengutronix.de>
The zero_init, memset and scratch assignment were the same, and will be
the same for i.MX6. Why not make it generic?
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
arch/arm/mach-imx/Kconfig | 2 +-
arch/arm/mach-imx/scratch.c | 18 +++++++++---------
include/mach/imx/scratch.h | 1 +
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ef181d3868..ce121e3434 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -60,7 +60,7 @@ config ARCH_IMX_ROMAPI
config ARCH_IMX_SCRATCHMEM
def_bool y
- depends on ARCH_IMX8M || ARCH_IMX9
+ depends on ARCH_IMX6 || ARCH_IMX8M || ARCH_IMX9
config ARCH_IMX_TZASC
bool
diff --git a/arch/arm/mach-imx/scratch.c b/arch/arm/mach-imx/scratch.c
index fba4b41040..ccfc81a14d 100644
--- a/arch/arm/mach-imx/scratch.c
+++ b/arch/arm/mach-imx/scratch.c
@@ -32,25 +32,25 @@ static_assert(sizeof(struct imx_scratch_space) -
static struct imx_scratch_space *scratch;
-void imx8m_init_scratch_space(int ddr_buswidth, bool zero_init)
+void imx_init_scratch_space(ulong endmem, bool zero_init)
{
- ulong endmem = MX8M_DDR_CSD1_BASE_ADDR +
- imx8m_barebox_earlymem_size(ddr_buswidth);
-
scratch = (void *)arm_mem_scratch(endmem);
if (zero_init)
memset(scratch, 0, sizeof(*scratch));
}
+void imx8m_init_scratch_space(int ddr_buswidth, bool zero_init)
+{
+ ulong endmem = MX8M_DDR_CSD1_BASE_ADDR +
+ imx8m_barebox_earlymem_size(ddr_buswidth);
+ imx_init_scratch_space(endmem, zero_init);
+}
+
void imx93_init_scratch_space(bool zero_init)
{
ulong endmem = MX9_DDR_CSD1_BASE_ADDR + imx9_ddrc_sdram_size();
-
- scratch = (void *)arm_mem_scratch(endmem);
-
- if (zero_init)
- memset(scratch, 0, sizeof(*scratch));
+ imx_init_scratch_space(endmem, zero_init);
}
void imx8m_scratch_save_bootrom_log(const u32 *rom_log)
diff --git a/include/mach/imx/scratch.h b/include/mach/imx/scratch.h
index b74d19a560..3c302b3a34 100644
--- a/include/mach/imx/scratch.h
+++ b/include/mach/imx/scratch.h
@@ -3,6 +3,7 @@
#ifndef __MACH_IMX_SCRATCH_H
#define __MACH_IMX_SCRATCH_H
+void imx_init_scratch_space(ulong endmem, bool zero_init);
void imx8m_init_scratch_space(int ddr_buswidth, bool zero_init);
void imx93_init_scratch_space(bool zero_init);
--
2.47.3
next prev parent reply other threads:[~2026-02-16 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 10:36 [PATCH v4 0/2] Add generic OP-TEE loading for i.MX6 Fabian Pflug
2026-02-16 10:36 ` Fabian Pflug [this message]
2026-02-16 10:36 ` [PATCH v4 2/2] ARM: i.MX6: load optee in PBL before barebox proper Fabian Pflug
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260216-v2025-11-0-topic-optee-imx6-start-v4-1-b73279a8a971@pengutronix.de \
--to=f.pflug@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox