Skip to content

Commit

Permalink
sedi: hpet: keep waiting if main counter value is invalid
Browse files Browse the repository at this point in the history
This commit is to keep waiting if HPET main counter value is invalid,
which may happen after ISH just goes out of lowper power state.
Avoid reading out an invalid HPET main counter value.

Signed-off-by: Roger Wang <[email protected]>
Signed-off-by: Dong Wang <[email protected]>
  • Loading branch information
roger1wang-intel authored and kwd-doodling committed Jun 11, 2024
1 parent 59ca937 commit c1b41b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bsp_sedi/drivers/hpet/sedi_hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SEDI_REG_DEFINE(HPET, MCV, 0x0f0, RW, (uint64_t)-1, (uint64_t)0x0);
SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS8))
#define CTRL_STS_TIMER1_COMPARATOR SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS9)
#define CTRL_STS_TIMER2_COMPARATOR SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS10)
#define CTRL_STS_MAIN_COUNTER_VALUE_INVALID SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS13)

/*Macro for interrupt routing*/
#define TIMER2_INT_ROUTE (0x0b)
Expand Down Expand Up @@ -157,6 +158,7 @@ uint64_t sedi_hpet_get_main_counter(void)
uint32_t highBits;
uint32_t lowBits;

wait_for_idle(CTRL_STS_MAIN_COUNTER_VALUE_INVALID);
do {
highBits = SEDI_REG_GET(HPET, MCV_HIGH);
lowBits = SEDI_REG_GET(HPET, MCV_LOW);
Expand Down

0 comments on commit c1b41b0

Please sign in to comment.