clock_control: Add support for lpspi clock in mcux ccm driver
Adds support for getting the lpspi clock frequency in the mcux ccm driver. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
parent
8c8de70f6e
commit
83a6781507
2 changed files with 18 additions and 0 deletions
|
@ -12,6 +12,13 @@
|
|||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_CLOCK_CONTROL_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
|
||||
static const clock_name_t lpspi_clocks[] = {
|
||||
kCLOCK_Usb1PllPfd1Clk,
|
||||
kCLOCK_Usb1PllPfd0Clk,
|
||||
kCLOCK_SysPllClk,
|
||||
kCLOCK_SysPllPfd2Clk,
|
||||
};
|
||||
|
||||
static int mcux_ccm_on(struct device *dev,
|
||||
clock_control_subsys_t sub_system)
|
||||
{
|
||||
|
@ -31,6 +38,16 @@ static int mcux_ccm_get_subsys_rate(struct device *dev,
|
|||
u32_t clock_name = (u32_t) sub_system;
|
||||
|
||||
switch (clock_name) {
|
||||
case IMX_CCM_LPSPI_CLK:
|
||||
{
|
||||
u32_t lpspi_mux = CLOCK_GetMux(kCLOCK_LpspiMux);
|
||||
clock_name_t lpspi_clock = lpspi_clocks[lpspi_mux];
|
||||
|
||||
*rate = CLOCK_GetFreq(lpspi_clock)
|
||||
/ (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case IMX_CCM_LPUART_CLK:
|
||||
if (CLOCK_GetMux(kCLOCK_UartMux) == 0) {
|
||||
*rate = CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6
|
||||
|
|
|
@ -12,5 +12,6 @@
|
|||
#define IMX_CCM_BUS_CLK 2
|
||||
#define IMX_CCM_LPUART_CLK 3
|
||||
#define IMX_CCM_LPI2C_CLK 4
|
||||
#define IMX_CCM_LPSPI_CLK 5
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_IMX_CCM_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue