Skip to content

Commit 5a4d714

Browse files
TonyHan11kartben
authored andcommitted
soc: microchip: sam-clk: optimize get_rate() for generic clocks
Obtain generic clock division ratio from the register instead of from the variable to avoid wrong result caused by un-synced division ratios. Signed-off-by: Tony Han <tony.han@microchip.com>
1 parent a8cf696 commit 5a4d714

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

soc/microchip/sam/common/clk-generated.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ static int clk_generated_get_rate(const struct device *dev,
135135
LOG_ERR("get parent clock rate failed.");
136136
return ret;
137137
}
138+
139+
gck->gckdiv = FIELD_GET(PMC_PCR_GCLKDIV_Msk, status);
138140
*rate /= (gck->gckdiv + 1);
139141

140142
return 0;

0 commit comments

Comments
 (0)