From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 02/11] hw/misc/aspeed_scu: Support the Frequency Counter Control register for AST2700
Date: Fri, 4 Jul 2025 10:37:14 +0200 [thread overview]
Message-ID: <20250704083723.1410455-3-clg@redhat.com> (raw)
In-Reply-To: <20250704083723.1410455-1-clg@redhat.com>
From: Jamin Lin <jamin_lin@aspeedtech.com>
According to the datasheet:
BIT[1] (SCU_FREQ_OSC_EN) enables the oscillator frequency measurement counter.
BIT[6] (SCU_FREQ_DONE) indicates the measurement is finished.
Firmware polls BIT[6] to determine when measurement is complete.
The flag can be cleared by writing BIT[1] to 0.
To simulate this hardware behavior in QEMU:
If BIT[1] is set to 1, BIT[6] is immediately set to 1 to avoid
firmware hanging during polling.
If BIT[1] is cleared to 0, BIT[6] is also cleared to 0 to match
hardware semantics.
The initial value of this register is initialized to 0x80, reflecting the
default value confirmed from an EVB register dump.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250618080006.846355-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/misc/aspeed_scu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index 4930e00fed14..11d073910882 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -176,6 +176,7 @@
#define AST2700_SCUIO_UARTCLK_GEN TO_REG(0x330)
#define AST2700_SCUIO_HUARTCLK_GEN TO_REG(0x334)
#define AST2700_SCUIO_CLK_DUTY_MEAS_RST TO_REG(0x388)
+#define AST2700_SCUIO_FREQ_CNT_CTL TO_REG(0x3A0)
#define SCU_IO_REGION_SIZE 0x1000
@@ -1022,6 +1023,10 @@ static void aspeed_ast2700_scuio_write(void *opaque, hwaddr offset,
s->regs[reg - 1] ^= data;
updated = true;
break;
+ case AST2700_SCUIO_FREQ_CNT_CTL:
+ s->regs[reg] = deposit32(s->regs[reg], 6, 1, !!(data & BIT(1)));
+ updated = true;
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Unhandled write at offset 0x%" HWADDR_PRIx "\n",
@@ -1066,6 +1071,7 @@ static const uint32_t ast2700_a0_resets_io[ASPEED_AST2700_SCU_NR_REGS] = {
[AST2700_SCUIO_UARTCLK_GEN] = 0x00014506,
[AST2700_SCUIO_HUARTCLK_GEN] = 0x000145c0,
[AST2700_SCUIO_CLK_DUTY_MEAS_RST] = 0x0c9100d2,
+ [AST2700_SCUIO_FREQ_CNT_CTL] = 0x00000080,
};
static void aspeed_2700_scuio_class_init(ObjectClass *klass, const void *data)
--
2.50.0
next prev parent reply other threads:[~2025-07-04 8:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 8:37 [PULL 00/11] aspeed queue Cédric Le Goater
2025-07-04 8:37 ` [PULL 01/11] hw/misc/aspeed_sdmc: Skipping dram_init in u-boot for AST2700 Cédric Le Goater
2025-07-04 8:37 ` Cédric Le Goater [this message]
2025-07-04 8:37 ` [PULL 03/11] hw/arm/aspeed: bletchley: update hw strap values Cédric Le Goater
2025-07-04 8:37 ` [PULL 04/11] hw/arm/aspeed: add Catalina machine type Cédric Le Goater
2025-07-04 8:37 ` [PULL 05/11] hw/misc/aspeed_scu: Handle AST2600 protection key registers correctly Cédric Le Goater
2025-07-04 8:37 ` [PULL 06/11] tests/qtest: Add test for ASPEED SCU Cédric Le Goater
2025-07-04 8:37 ` [PULL 07/11] aspeed: Deprecate the ast2700a0-evb machine Cédric Le Goater
2025-07-04 8:37 ` [PULL 08/11] hw/arm/aspeed: Add second SPI chip to Aspeed model Cédric Le Goater
2025-07-04 8:37 ` [PULL 09/11] docs: add support for gb200-bmc Cédric Le Goater
2025-07-11 12:01 ` Peter Maydell
2025-07-15 6:13 ` Cédric Le Goater
2025-07-15 8:49 ` Peter Maydell
2025-07-04 8:37 ` [PULL 10/11] hw/arm/aspeed: Add GB200 BMC target Cédric Le Goater
2025-07-04 8:37 ` [PULL 11/11] tests/functional: Add gb200 tests Cédric Le Goater
2025-07-04 17:49 ` [PULL 00/11] aspeed queue Stefan Hajnoczi
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=20250704083723.1410455-3-clg@redhat.com \
--to=clg@redhat.com \
--cc=jamin_lin@aspeedtech.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).