summaryrefslogtreecommitdiffstats
path: root/src/soc/qualcomm/common/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/qualcomm/common/clock.c')
-rw-r--r--src/soc/qualcomm/common/clock.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/soc/qualcomm/common/clock.c b/src/soc/qualcomm/common/clock.c
index e06a954f3ca0..09484b76f41e 100644
--- a/src/soc/qualcomm/common/clock.c
+++ b/src/soc/qualcomm/common/clock.c
@@ -90,15 +90,20 @@ static void clock_configure_mnd(struct clock_rcg *clk, uint32_t m, uint32_t n,
/* Clock Root clock Generator Operations */
enum cb_err clock_configure(struct clock_rcg *clk,
- struct clock_freq_config *clk_cfg, uint32_t hz,
- uint32_t num_perfs)
+ struct clock_freq_config *clk_cfg, uint32_t hz,
+ uint32_t num_perfs)
{
uint32_t reg_val, idx;
for (idx = 0; idx < num_perfs; idx++)
- if (hz <= clk_cfg[idx].hz)
+ if (hz == clk_cfg[idx].hz)
break;
+ /* Verify we matched an entry. If not, throw error. */
+ if (idx >= num_perfs)
+ die("Failed to find a matching clock frequency (%d hz) for %p!\n",
+ hz, clk);
+
reg_val = (clk_cfg[idx].src << CLK_CTL_CFG_SRC_SEL_SHFT) |
(clk_cfg[idx].div << CLK_CTL_CFG_SRC_DIV_SHFT);