Commit 790fd433eb for qemu.org
commit 790fd433eb04beb410a16f8c6b2ffa4ae1fe8c54
Author: Jonathan Gilbert <logic@deltaq.org>
Date: Fri Sep 25 05:07:26 2026 -0500
hw/misc/bcm2835_cprman: correct register index in test for mux update
After each register write handled by cprman_write, function update_mux
checks each of the clocks to see whether the supplied register index
applies to it, calling clock_mux_update if so. Each clock has two
registers, so it needs to check the base cm_offset for CM_CTL and then
the next slot for CM_DIV. But, it was checking for cm_offset plus 4, as
though it were a byte offset when it's a logical index.
Signed-off-by: Jonathan Gilbert <logic@deltaq.org>
Fixes: 7281362484a ("hw/misc/bcm2835_cprman: clock mux skeleton implementation")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260925100726.1546566-1-logic@deltaq.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/hw/misc/bcm2835_cprman.c b/hw/misc/bcm2835_cprman.c
index 8220f7a6b4..f9a77ff9bb 100644
--- a/hw/misc/bcm2835_cprman.c
+++ b/hw/misc/bcm2835_cprman.c
@@ -508,7 +508,7 @@ static inline void update_mux_from_cm(BCM2835CprmanState *s, size_t idx)
for (i = 0; i < CPRMAN_NUM_CLOCK_MUX; i++) {
if ((CLOCK_MUX_INIT_INFO[i].cm_offset == idx) ||
- (CLOCK_MUX_INIT_INFO[i].cm_offset + 4 == idx)) {
+ (CLOCK_MUX_INIT_INFO[i].cm_offset + 1 == idx)) {
/* matches CM_CTL or CM_DIV mux register */
clock_mux_update(&s->clock_muxes[i]);
return;