Skip to content
Permalink
Browse files

clock/usdhc: Enable clock of USDHC of i.MXRT

Enable clock of USDHC of i.MXRT.

Add clock interface for USDHC in ccm.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
  • Loading branch information...
JunYangNXP authored and MaureenHelm committed Jul 4, 2019
1 parent 6ff5ac0 commit 27d8329fc9aad19fad09ed0dd0f96e63a9cc2b4c
Showing with 32 additions and 0 deletions.
  1. +14 −0 drivers/clock_control/clock_control_mcux_ccm.c
  2. +2 −0 include/dt-bindings/clock/imx_ccm.h
  3. +16 −0 soc/arm/nxp_imx/rt/soc.c
@@ -73,6 +73,20 @@ static int mcux_ccm_get_subsys_rate(struct device *dev,
}

break;

#ifdef CONFIG_DISK_ACCESS_USDHC1
case IMX_CCM_USDHC1_CLK:
*rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) /
(CLOCK_GetDiv(kCLOCK_Usdhc1Div) + 1U);
break;
#endif

#ifdef CONFIG_DISK_ACCESS_USDHC2
case IMX_CCM_USDHC2_CLK:
*rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) /
(CLOCK_GetDiv(kCLOCK_Usdhc2Div) + 1U);
break;
#endif
}

return 0;
@@ -13,5 +13,7 @@
#define IMX_CCM_LPUART_CLK 3
#define IMX_CCM_LPI2C_CLK 4
#define IMX_CCM_LPSPI_CLK 5
#define IMX_CCM_USDHC1_CLK 6
#define IMX_CCM_USDHC2_CLK 7

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_IMX_CCM_H_ */
@@ -185,6 +185,22 @@ static ALWAYS_INLINE void clkInit(void)
USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig);
#endif

#if defined(CONFIG_DISK_ACCESS_USDHC1) || \
defined(CONFIG_DISK_ACCESS_USDHC2)
CLOCK_InitSysPfd(kCLOCK_Pfd0, 0x12U);
/* Configure USDHC clock source and divider */
#ifdef CONFIG_DISK_ACCESS_USDHC1
CLOCK_SetDiv(kCLOCK_Usdhc1Div, 0U);
CLOCK_SetMux(kCLOCK_Usdhc1Mux, 1U);
CLOCK_EnableClock(kCLOCK_Usdhc1);
#endif
#ifdef CONFIG_DISK_ACCESS_USDHC2
CLOCK_SetDiv(kCLOCK_Usdhc2Div, 0U);
CLOCK_SetMux(kCLOCK_Usdhc2Mux, 1U);
CLOCK_EnableClock(kCLOCK_Usdhc2);
#endif
#endif

/* Keep the system clock running so SYSTICK can wake up the system from
* wfi.
*/

0 comments on commit 27d8329

Please sign in to comment.
You can’t perform that action at this time.