Skip to content

Commit

Permalink
clock_control: mcux_ccm: add SAI and SDMA clocks
Browse files Browse the repository at this point in the history
Add SAI1-3 and SDMA1-3 bus clocks for imx8mp.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
  • Loading branch information
LaurentiuM1234 committed Feb 5, 2025
1 parent f8af332 commit e69a7d4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions drivers/clock_control/clock_control_mcux_ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ static const clock_ip_name_t sai_clocks[] = {
kCLOCK_AUDIO_Sai3,
};
#endif

#if defined(CONFIG_SOC_MIMX8ML8_ADSP)
static const clock_ip_name_t sai_clocks[] = {
kCLOCK_Sai1,
kCLOCK_Sai2,
kCLOCK_Sai3,
};
#endif /* CONFIG_SOC_MIMX8ML8_ADSP */
#endif /* CONFIG_DAI_NXP_SAI */

#if defined(CONFIG_I2C_NXP_II2C)
Expand All @@ -94,6 +102,14 @@ static const clock_ip_name_t i2c_clk_root[] = {
};
#endif

#if defined(CONFIG_DMA_NXP_SDMA)
static const clock_ip_name_t sdma_clocks[] = {
kCLOCK_Sdma1,
kCLOCK_Sdma2,
kCLOCK_Sdma3,
};
#endif /* CONFIG_DMA_NXP_SDMA */

static int mcux_ccm_on(const struct device *dev,
clock_control_subsys_t sub_system)
{
Expand All @@ -110,6 +126,14 @@ static int mcux_ccm_on(const struct device *dev,
return 0;
#endif

#ifdef CONFIG_DMA_NXP_SDMA
case IMX_CCM_SDMA1_CLK:
case IMX_CCM_SDMA2_CLK:
case IMX_CCM_SDMA3_CLK:
CLOCK_EnableClock(sdma_clocks[instance]);
return 0;
#endif /* CONFIG_DMA_NXP_SDMA */

#if defined(CONFIG_UART_MCUX_LPUART) && defined(CONFIG_SOC_MIMX8QM6_ADSP)
case IMX_CCM_LPUART1_CLK:
case IMX_CCM_LPUART2_CLK:
Expand Down Expand Up @@ -137,6 +161,13 @@ static int mcux_ccm_on(const struct device *dev,
CLOCK_EnableClock(sai_clocks[instance]);
return 0;
#endif
#if defined(CONFIG_SOC_MIMX8ML8_ADSP)
case IMX_CCM_SAI1_CLK:
case IMX_CCM_SAI2_CLK:
case IMX_CCM_SAI3_CLK:
CLOCK_EnableClock(sai_clocks[instance]);
return 0;
#endif /* CONFIG_SOC_MIMX8ML8_ADSP */
#endif /* CONFIG_DAI_NXP_SAI */

#if defined(CONFIG_ETH_NXP_ENET)
Expand Down Expand Up @@ -171,6 +202,14 @@ static int mcux_ccm_off(const struct device *dev,
return 0;
#endif

#ifdef CONFIG_DMA_NXP_SDMA
case IMX_CCM_SDMA1_CLK:
case IMX_CCM_SDMA2_CLK:
case IMX_CCM_SDMA3_CLK:
CLOCK_DisableClock(sdma_clocks[instance]);
return 0;
#endif /* CONFIG_DMA_NXP_SDMA */

#ifdef CONFIG_DAI_NXP_SAI
#if defined(CONFIG_SOC_MIMX8QM6_ADSP) || defined(CONFIG_SOC_MIMX8QX6_ADSP)
case IMX_CCM_SAI1_CLK:
Expand All @@ -179,6 +218,13 @@ static int mcux_ccm_off(const struct device *dev,
CLOCK_DisableClock(sai_clocks[instance]);
return 0;
#endif
#if defined(CONFIG_SOC_MIMX8ML8_ADSP)
case IMX_CCM_SAI1_CLK:
case IMX_CCM_SAI2_CLK:
case IMX_CCM_SAI3_CLK:
CLOCK_DisableClock(sai_clocks[instance]);
return 0;
#endif /* CONFIG_SOC_MIMX8ML8_ADSP */
#endif /* CONFIG_DAI_NXP_SAI */
default:
(void)instance;
Expand Down
4 changes: 4 additions & 0 deletions include/zephyr/dt-bindings/clock/imx_ccm.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,8 @@
#define IMX_CCM_I2C5_CLK 0x1404UL
#define IMX_CCM_I2C6_CLK 0x1405UL

#define IMX_CCM_SDMA1_CLK 0x1500UL
#define IMX_CCM_SDMA2_CLK 0x1501UL
#define IMX_CCM_SDMA3_CLK 0x1502UL

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_IMX_CCM_H_ */

0 comments on commit e69a7d4

Please sign in to comment.