clock_control: Add support for getting LPO frequency in mcux sim driver
The mcux sim clock control driver was originally designed to pass through the clock subsystem value from dts to the mcux CLOCK_GetFreq() function. This assumed that the values in include/dt-bindings/clock/kinetis_sim.h matched the enumeration in fsl_clock.h, which is true for the coresys, platform, and bus clocks. However, the low-power oscillator (LPO) clock has a different values in k64 vs. kw2xd, therefore we must update the clock_control driver to parse the value from dts and convert it to the fsl_clock.h enumeration. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
parent
eeeffcaf58
commit
39d63d316b
2 changed files with 12 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <clock_control.h>
|
#include <clock_control.h>
|
||||||
|
#include <dt-bindings/clock/kinetis_sim.h>
|
||||||
#include <fsl_clock.h>
|
#include <fsl_clock.h>
|
||||||
|
|
||||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_CLOCK_CONTROL_LEVEL
|
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_CLOCK_CONTROL_LEVEL
|
||||||
|
@ -25,7 +26,16 @@ static int mcux_sim_get_subsys_rate(struct device *dev,
|
||||||
clock_control_subsys_t sub_system,
|
clock_control_subsys_t sub_system,
|
||||||
u32_t *rate)
|
u32_t *rate)
|
||||||
{
|
{
|
||||||
clock_name_t clock_name = (clock_name_t) sub_system;
|
clock_name_t clock_name;
|
||||||
|
|
||||||
|
switch ((u32_t) sub_system) {
|
||||||
|
case KINETIS_SIM_LPO_CLK:
|
||||||
|
clock_name = kCLOCK_LpoClk;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
clock_name = (clock_name_t) sub_system;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
*rate = CLOCK_GetFreq(clock_name);
|
*rate = CLOCK_GetFreq(clock_name);
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
#define KINETIS_SIM_CORESYS_CLK 0
|
#define KINETIS_SIM_CORESYS_CLK 0
|
||||||
#define KINETIS_SIM_PLATFORM_CLK 1
|
#define KINETIS_SIM_PLATFORM_CLK 1
|
||||||
#define KINETIS_SIM_BUS_CLK 2
|
#define KINETIS_SIM_BUS_CLK 2
|
||||||
|
#define KINETIS_SIM_LPO_CLK 19
|
||||||
|
|
||||||
#endif /* __KINETIS_SIM_H */
|
#endif /* __KINETIS_SIM_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue