hw/misc/bcm2835_cprman: correct register index in test for mux update
Subsystems (2)
PATCH 1/1 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.
--- hw/misc/bcm2835_cprman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/bcm2835_cprman.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
Cc'ing Luc
Quoted 25 lines · Jonathan Gilbert
After each register write handled by
cprman_write, functionupdate_muxchecks each of the clocks to see whether the supplied register index applies to it, callingclock_mux_updateif so. Each clock has two registers, so it needs to check the basecm_offsetforCM_CTLand then the next slot forCM_DIV. But, it was checking forcm_offsetplus 4, as though it were a byte offset when it's a logical index.Signed-off-by Jonathan Gilbert <[email protected]>--- hw/misc/bcm2835_cprman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/misc/bcm2835_cprman.c +1
-1@@ -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 ;
Philippe Mathieu-Daudé
Reviewed-byQuoted 10 lines · Philippe Mathieu-Daudé
Cc'ing Luc
Quoted 7 lines · Jonathan Gilbert
After each register write handled by
cprman_write, functionupdate_muxchecks each of the clocks to see whether the supplied register index applies to it, callingclock_mux_updateif so. Each clock has two registers, so it needs to check the basecm_offsetforCM_CTLand then the next slot forCM_DIV. But, it was checking forcm_offsetplus 4, as though it were a byte offset when it's a logical index.
Quoted 20 lines
Quoted 18 lines
Signed-off-by Jonathan Gilbert <[email protected]>---
hw/misc/bcm2835_cprman.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)hw/misc/bcm2835_cprman.c +0
-0@@ -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_CTLorCM_DIVmux register */clock_mux_update(&s->clock_muxes[i]); return;
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Cc'ing Luc
Quoted 7 lines · Jonathan Gilbert
After each register write handled by
cprman_write, functionupdate_muxchecks each of the clocks to see whether the supplied register index applies to it, callingclock_mux_updateif so. Each clock has two registers, so it needs to check the basecm_offsetforCM_CTLand then the next slot forCM_DIV. But, it was checking forcm_offsetplus 4, as though it were a byte offset when it's a logical index.
Quoted 7 lines
Fixes 7281362484a ("hw/misc/bcm2835_cprman: clock mux skeleton implementation")Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 4 lines
Quoted 4 lines
Signed-off-by Jonathan Gilbert <[email protected]>---
hw/misc/bcm2835_cprman.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Trivial fix so patch queued, thanks.
Luc Michel
Reviewed-byQuoted 17 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Cc'ing Luc
Quoted 7 lines · Jonathan Gilbert
After each register write handled by
cprman_write, functionupdate_muxchecks each of the clocks to see whether the supplied register index applies to it, callingclock_mux_updateif so. Each clock has two registers, so it needs to check the basecm_offsetforCM_CTLand then the next slot forCM_DIV. But, it was checking forcm_offsetplus 4, as though it were a byte offset when it's a logical index.Fixes 7281362484a ("hw/misc/bcm2835_cprman: clock mux skeletonimplementation")
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Signed-off-by Jonathan Gilbert <[email protected]>---
hw/misc/bcm2835_cprman.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Trivial fix so patch queued, thanks.
Thanks for the fix.
A bit late: