drivers: clock_control: nrf: Switch to single clock device
Low frequency and high frequency clocks had separate devices while they are actually handled by single peripheral with single interrupt. The split was done probably because opaque subsys argument in the API was used for other purposes and there was no way to pass the information which clock should be controlled. Implementation changes some time ago and subsys parameter was no longer used. It now can be used to indicate which clock should be controlled. Change become necessary when nrf5340 is taken into account where there are more clocks and current approach would lead to create multiple devices - mess. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
9128200e6c
commit
00156ad80a
17 changed files with 335 additions and 242 deletions
|
@ -10,7 +10,23 @@
|
|||
#include <device.h>
|
||||
#include <hal/nrf_clock.h>
|
||||
|
||||
/* TODO: move all these to clock_control.h ? */
|
||||
/** @brief Clocks handled by the CLOCK peripheral.
|
||||
*
|
||||
* Enum shall be used as a sys argument in clock_control API.
|
||||
*/
|
||||
enum clock_control_nrf_type {
|
||||
CLOCK_CONTROL_NRF_TYPE_HFCLK,
|
||||
CLOCK_CONTROL_NRF_TYPE_LFCLK,
|
||||
CLOCK_CONTROL_NRF_TYPE_COUNT
|
||||
};
|
||||
|
||||
/* Define can be used with clock control API instead of enum directly to
|
||||
* increase code readability.
|
||||
*/
|
||||
#define CLOCK_CONTROL_NRF_SUBSYS_HF \
|
||||
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK)
|
||||
#define CLOCK_CONTROL_NRF_SUBSYS_LF \
|
||||
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_LFCLK)
|
||||
|
||||
/* Define 32KHz clock source */
|
||||
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue