drivers: Align nrf counter, timer and usb driver to new clock_control

Align drivers to use new clock control API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-07-03 09:22:06 +02:00 committed by Carles Cufí
parent ec6b7e780b
commit 43af941131
3 changed files with 8 additions and 11 deletions

View file

@ -295,7 +295,7 @@ static int init_rtc(struct device *dev,
return -ENODEV;
}
clock_control_on(clock, (void *)CLOCK_CONTROL_NRF_K32SRC);
clock_control_on(clock, NULL);
nrfx_err_t result = nrfx_rtc_init(rtc, config, handler);

View file

@ -85,7 +85,7 @@ int z_clock_driver_init(struct device *device)
return -1;
}
clock_control_on(clock, (void *)CLOCK_CONTROL_NRF_K32SRC);
clock_control_on(clock, NULL);
/* TODO: replace with counter driver to access RTC */
nrf_rtc_prescaler_set(RTC, 0);

View file

@ -550,7 +550,11 @@ static int hf_clock_enable(bool on, bool blocking)
/* Do not request HFCLK multiple times. */
return 0;
}
ret = clock_control_on(clock, (void *)blocking);
ret = clock_control_on(clock, NULL);
while (blocking &&
clock_control_get_status(clock, NULL) !=
CLOCK_CONTROL_STATUS_ON) {
}
} else {
if (!clock_requested) {
/* Cancel the operation if clock has not
@ -558,14 +562,7 @@ static int hf_clock_enable(bool on, bool blocking)
*/
return 0;
}
ret = clock_control_off(clock, (void *)blocking);
if (ret == -EBUSY) {
/* This is an expected behaviour.
* -EBUSY means that some other module has also
* requested the clock to run.
*/
ret = 0;
}
ret = clock_control_off(clock, NULL);
}
if (ret && (blocking || (ret != -EINPROGRESS))) {