Skip to content

Commit ddd5be1

Browse files
ldebieveYann-lms
authored andcommitted
clk: calibration: increase CSI margin and debug info
Increase margin for CSI clock frequency to 1% around reference frequency. Add more debug information for trim values around the defined one. Change-Id: If68eec22a911d1abaffec829e35d222bbc8a624a Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/tf-a/+/133488 Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com> Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com> Reviewed-by: Yann GAUTIER <yann.gautier@st.com>
1 parent b2efbf3 commit ddd5be1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

drivers/st/clk/stm32mp1_clk.c

+20-2
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static struct stm32mp1_clk_cal stm32mp1_clk_cal_csi = {
654654
.trim_max = 15,
655655
.trim_min = -16,
656656
.ref_freq = 0,
657-
.freq_margin = 4,
657+
.freq_margin = 5,
658658
.set_trim = csi_set_trim,
659659
.get_trim = csi_get_trimed_cal,
660660
};
@@ -2300,9 +2300,27 @@ static void stm32mp1_rcc_calibration(struct stm32mp1_clk_cal *clk_cal)
23002300
clk_cal->set_trim(trim);
23012301
freq = clk_cal->get_freq();
23022302
if ((freq < min) || (freq > max)) {
2303-
ERROR("%s Calibration : Freq %lu , trim %i\n",
2303+
ERROR("%s Calibration : Freq %lu, trim %i\n",
23042304
(clk_cal->set_trim == hsi_set_trim) ? "HSI" : "CSI",
23052305
freq, trim);
2306+
#if DEBUG
2307+
/*
2308+
* Show the steps around the selected trim value
2309+
* to correct the margin if needed
2310+
*/
2311+
new_trim = trim_decrease(clk_cal, trim);
2312+
clk_cal->set_trim(new_trim);
2313+
ERROR("%s Calibration : Freq %lu, trim %i\n",
2314+
(clk_cal->set_trim == hsi_set_trim) ?
2315+
"HSI" : "CSI", clk_cal->get_freq(),
2316+
new_trim);
2317+
new_trim = trim_increase(clk_cal, trim);
2318+
clk_cal->set_trim(new_trim);
2319+
ERROR("%s Calibration : Freq %lu, trim %i\n",
2320+
(clk_cal->set_trim == hsi_set_trim) ?
2321+
"HSI" : "CSI", clk_cal->get_freq(),
2322+
new_trim);
2323+
#endif
23062324
panic();
23072325
}
23082326
}

0 commit comments

Comments
 (0)