Skip to content

Commit

Permalink
[nrf fromlist] drivers: clock_control: nrf fll16 remove closed loop impl
Browse files Browse the repository at this point in the history
Remove the closed loop mode implementation for the fll16m clock.
Closed loop causes a hardware bug resulting in increased current
consumption if SoC experiences high, but within spec, temperatures.

Upstream PR #: 86339

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
  • Loading branch information
bjarki-andreasen committed Feb 26, 2025
1 parent 1bf500b commit 7e1ff38
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
27 changes: 1 addition & 26 deletions drivers/clock_control/clock_control_nrf2_fll16m.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
#define FLAG_HFXO_STARTED BIT(FLAGS_COMMON_BITS)

#define FLL16M_MODE_OPEN_LOOP 0
#define FLL16M_MODE_CLOSED_LOOP 1
#define FLL16M_MODE_CLOSED_LOOP 1 /* <-- DO NOT IMPLEMENT, CAN CAUSE HARDWARE BUG */
#define FLL16M_MODE_BYPASS 2
#define FLL16M_MODE_DEFAULT FLL16M_MODE_OPEN_LOOP

#define FLL16M_HFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, hfxo)

#define FLL16M_HFXO_ACCURACY DT_PROP(FLL16M_HFXO_NODE, accuracy_ppm)
#define FLL16M_OPEN_LOOP_ACCURACY DT_INST_PROP(0, open_loop_accuracy_ppm)
#define FLL16M_CLOSED_LOOP_BASE_ACCURACY DT_INST_PROP(0, closed_loop_base_accuracy_ppm)
#define FLL16M_MAX_ACCURACY FLL16M_HFXO_ACCURACY

#define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr))
Expand All @@ -43,9 +42,6 @@ static struct clock_options {
.accuracy = FLL16M_OPEN_LOOP_ACCURACY,
.mode = FLL16M_MODE_OPEN_LOOP,
},
{
.mode = FLL16M_MODE_CLOSED_LOOP,
},
{
/* Bypass mode uses HFXO */
.accuracy = FLL16M_HFXO_ACCURACY,
Expand Down Expand Up @@ -225,27 +221,6 @@ static int api_get_rate_fll16m(const struct device *dev,
static int fll16m_init(const struct device *dev)
{
struct fll16m_dev_data *dev_data = dev->data;
nrf_bicr_lfosc_mode_t lfosc_mode;

clock_options[1].accuracy = FLL16M_CLOSED_LOOP_BASE_ACCURACY;

/* Closed-loop mode uses LFXO as source if present, HFXO otherwise */
lfosc_mode = nrf_bicr_lfosc_mode_get(BICR);

if (lfosc_mode != NRF_BICR_LFOSC_MODE_UNCONFIGURED &&
lfosc_mode != NRF_BICR_LFOSC_MODE_DISABLED) {
int ret;
uint16_t accuracy;

ret = lfosc_get_accuracy(&accuracy);
if (ret < 0) {
return ret;
}

clock_options[1].accuracy += accuracy;
} else {
clock_options[1].accuracy += FLL16M_HFXO_ACCURACY;
}

return clock_config_init(&dev_data->clk_cfg,
ARRAY_SIZE(dev_data->clk_cfg.onoff),
Expand Down
7 changes: 0 additions & 7 deletions dts/bindings/clock/nordic,nrf-fll16m.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ description: |
fll16m {
open-loop-accuracy-ppm = <20000>;
closed-loop-base-accuracy-ppm = <5000>;
clocks = <&hfxo>, <&lfxo>;
clock-names = "hfxo", "lfxo";
};
Expand All @@ -34,9 +33,3 @@ properties:
open-loop-accuracy-ppm:
type: int
description: Clock accuracy in parts per million if open-loop clock source is used.

closed-loop-base-accuracy-ppm:
type: int
description: |
Base clock accuracy in parts per million if closed-loop clock source is used.
The actual accuracy is this property plus the accuracy of the HFXO or LFXO.
1 change: 0 additions & 1 deletion dts/common/nordic/nrf54h20.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
#clock-cells = <0>;
clock-frequency = <DT_FREQ_M(16)>;
open-loop-accuracy-ppm = <20000>;
closed-loop-base-accuracy-ppm = <5000>;
clocks = <&hfxo>, <&lfxo>;
clock-names = "hfxo", "lfxo";
};
Expand Down

0 comments on commit 7e1ff38

Please sign in to comment.