From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Troy Lee" <troy_lee@aspeedtech.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH v7 09/11] hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap
Date: Tue, 24 Nov 2026 05:52:01 +0000 [thread overview]
Message-ID: <20261124055150.1328856-10-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20261124055150.1328856-1-jamin_lin@aspeedtech.com>
This commit adds SCU register support for TSP SDRAM remap control and runtime
activation. Unlike SSP, the TSP does not support configurable target address remapping
through SCU registers. It only supports setting the PSP DRAM base and size, which
are then aliased into the TSP-visible SDRAM window.
coprocessor_sdram_remap[2]: maps PSP DRAM offset 0x42E000000 (size: 32MB) to TSP SDRAM
offset 0x0
The SCU registers AST2700_SCU_TSP_CTRL_1 and
AST2700_SCU_TSP_REMAP_SIZE_2 allow runtime reconfiguration of the DRAM base (alias offset)
and mapping size.
|------------------------------------------| |----------------------------|
| PSP DRAM | | TSP SDRAM |
|------------------------------------------| |----------------------------|
| 0x42E0_0000_0 (SCU_168 << 4) | | 0x0000_0000 |
| remap base |------> | - fixed target addr |
| size: 32MB (SCU_194) | | |
|------------------------------------------| |----------------------------|
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
hw/misc/aspeed_scu.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index a9c5c9bacd..9becf308d0 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -20,6 +20,7 @@
#include "qemu/guest-random.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qemu/units.h"
#include "target/arm/arm-powerctl.h"
#define TO_REG(offset) ((offset) >> 2)
@@ -164,6 +165,8 @@
#define AST2700_SSP_TSP_RST_RB BIT(8)
#define AST2700_SSP_TSP_RST_HOLD_RB BIT(9)
#define AST2700_SSP_TSP_RST_SRC_RB BIT(10)
+#define AST2700_SCU_TSP_CTRL_1 TO_REG(0x168)
+#define AST2700_SCU_TSP_REMAP_SIZE_2 TO_REG(0x194)
#define AST2700_SCU_SYS_RST_CTRL_1 TO_REG(0x200)
#define AST2700_SCU_SYS_RST_CLR_1 TO_REG(0x204)
#define AST2700_SCU_SYS_RST_SSP BIT(30)
@@ -1028,6 +1031,27 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
memory_region_set_size(mr, data);
memory_region_transaction_commit();
break;
+ case AST2700_SCU_TSP_CTRL_1:
+ mr = a->tsp_remap;
+ if (a->tsp_cpuid < 0 || mr == NULL) {
+ return;
+ }
+ data &= 0x7fffffff;
+ memory_region_transaction_begin();
+ memory_region_set_alias_offset(mr,
+ ((uint64_t) data << 4) & 0x3ffffffff);
+ memory_region_transaction_commit();
+ break;
+ case AST2700_SCU_TSP_REMAP_SIZE_2:
+ mr = a->tsp_remap;
+ if (a->tsp_cpuid < 0 || mr == NULL) {
+ return;
+ }
+ data &= 0x3fffffff;
+ memory_region_transaction_begin();
+ memory_region_set_size(mr, data);
+ memory_region_transaction_commit();
+ break;
case AST2700_SCU_SYS_RST_CTRL_1:
if (a->ssp_cpuid < 0) {
return;
@@ -1107,6 +1131,8 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
[AST2700_SCU_SSP_REMAP_ADDR_2] = 0x00000000,
[AST2700_SCU_SSP_REMAP_SIZE_2] = 0x05880000,
[AST2700_SCU_TSP_CTRL_0] = 0x000007FE,
+ [AST2700_SCU_TSP_CTRL_1] = 0x42E00000,
+ [AST2700_SCU_TSP_REMAP_SIZE_2] = 0x02000000,
[AST2700_SCU_SYS_RST_CTRL_1] = 0xFFC37FDC,
[AST2700_SCU_SYS_RST_CTRL_2] = 0x00001FFF,
[AST2700_SCU_HPLL_PARAM] = 0x0000009f,
@@ -1152,6 +1178,12 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
if (a->tsp_cpuid >= 0) {
arm_set_cpu_off(a->tsp_cpuid);
+ if (a->tsp_remap) {
+ memory_region_transaction_begin();
+ memory_region_set_alias_offset(a->tsp_remap, 0x2e000000);
+ memory_region_set_size(a->tsp_remap, 32 * MiB);
+ memory_region_transaction_commit();
+ }
}
}
--
2.53.0
next prev parent reply other threads:[~2026-11-24 5:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 5:51 [PATCH v7 00/11] Add SSP/TSP power control and DRAM remap support for AST2700 Jamin Lin
2026-11-24 5:51 ` [PATCH v7 01/11] hw/arm/aspeed_ast1700: Correct AST2700 SCU to SCUIO Jamin Lin
2026-11-24 5:51 ` [PATCH v7 02/11] hw/arm/ast27x0: Start SSP in powered-off state to match hardware behavior Jamin Lin
2026-11-24 5:51 ` [PATCH v7 03/11] hw/arm/ast27x0: Start TSP " Jamin Lin
2026-11-24 5:51 ` [PATCH v7 04/11] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap Jamin Lin
2026-11-24 5:51 ` [PATCH v7 05/11] hw/arm/ast27x0: Add DRAM alias for TSP " Jamin Lin
2026-11-24 5:51 ` [PATCH v7 06/11] hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU registers Jamin Lin
2026-11-24 5:51 ` [PATCH v7 07/11] hw/misc/aspeed_scu: Implement TSP " Jamin Lin
2026-11-24 5:52 ` [PATCH v7 08/11] hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap Jamin Lin
2026-11-24 5:52 ` Jamin Lin [this message]
2026-11-24 5:52 ` [PATCH v7 10/11] tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP and load binaries from DRAM Jamin Lin
2026-11-24 5:52 ` [PATCH v7 11/11] docs: Add support vbootrom and update Manual boot for ast2700fc Jamin Lin
2026-11-24 10:35 ` [PATCH v7 00/11] Add SSP/TSP power control and DRAM remap support for AST2700 Cédric Le Goater
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=20261124055150.1328856-10-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=clg@kaod.org \
--cc=kane_chen@aspeedtech.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=troy_lee@aspeedtech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.