bluetooth: controller: Align nrf link layer to new clock control API

Align to use clock_control_get_status for blocking clock start.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-07-03 09:19:51 +02:00 committed by Carles Cufí
commit ec6b7e780b
4 changed files with 17 additions and 7 deletions

View file

@ -132,7 +132,7 @@ int ll_init(struct k_sem *sem_rx)
return -ENODEV;
}
clock_control_on(clk_k32, (void *)CLOCK_CONTROL_NRF_K32SRC);
clock_control_on(clk_k32, NULL);
entropy = device_get_binding(CONFIG_ENTROPY_NAME);
if (!entropy) {

View file

@ -171,7 +171,11 @@ static u32_t init(u8_t chan, u8_t phy, void (*isr)(void *param))
/* Setup resources required by Radio */
hf_clock = radio_hf_clock_get();
clock_control_on(hf_clock, (void *)1); /* start clock, blocking. */
clock_control_on(hf_clock, NULL); /* start clock, blocking. */
while (clock_control_get_status(hf_clock, NULL) !=
CLOCK_CONTROL_STATUS_ON) {
}
/* Reset Radio h/w */
radio_reset();

View file

@ -139,7 +139,7 @@ int lll_init(void)
return -ENODEV;
}
clock_control_on(clk_k32, (void *)CLOCK_CONTROL_NRF_K32SRC);
clock_control_on(clk_k32, NULL);
/* Initialize HF CLK */
lll.clk_hf =
@ -328,11 +328,15 @@ int lll_clk_on_wait(void)
int err;
/* turn on radio clock in blocking mode. */
err = clock_control_on(lll.clk_hf, (void *)1);
if (!err || err == -EINPROGRESS) {
DEBUG_RADIO_XTAL(1);
err = clock_control_on(lll.clk_hf, NULL);
while (clock_control_get_status(lll.clk_hf, NULL) !=
CLOCK_CONTROL_STATUS_ON) {
k_cpu_idle();
}
DEBUG_RADIO_XTAL(1);
return err;
}

View file

@ -28,7 +28,9 @@ void lll_clock_wait(void)
LL_ASSERT(lf_clock);
while (clock_control_on(lf_clock, (void *)CLOCK_CONTROL_NRF_K32SRC)) {
clock_control_on(lf_clock, NULL);
while (clock_control_get_status(lf_clock, NULL) !=
CLOCK_CONTROL_STATUS_ON) {
DEBUG_CPU_SLEEP(1);
k_cpu_idle();
DEBUG_CPU_SLEEP(0);