Skip to content

Commit

Permalink
drivers: clock_control: mcux_ccm_rev2: add ENET clk for imx93
Browse files Browse the repository at this point in the history
Add ENET clock support in the ccm driver for imx93.

Signed-off-by: Jiafei Pan <[email protected]>
  • Loading branch information
JiafeiPan authored and nashif committed Jul 28, 2024
1 parent 5663a32 commit fa9a131
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions drivers/clock_control/clock_control_mcux_ccm_rev2.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,33 @@ LOG_MODULE_REGISTER(clock_control);
static int mcux_ccm_on(const struct device *dev,
clock_control_subsys_t sub_system)
{
uint32_t clock_name = (uintptr_t)sub_system;
uint32_t peripheral, instance;

peripheral = (clock_name & IMX_CCM_PERIPHERAL_MASK);
instance = (clock_name & IMX_CCM_INSTANCE_MASK);
switch (peripheral) {
#ifdef CONFIG_ETH_NXP_ENET
if ((uint32_t)sub_system == IMX_CCM_ENET_CLK) {
CLOCK_EnableClock(kCLOCK_Enet);
#ifdef CONFIG_ETH_NXP_ENET_1G
} else if ((uint32_t)sub_system == IMX_CCM_ENET1G_CLK) {
CLOCK_EnableClock(kCLOCK_Enet_1g);

#ifdef CONFIG_SOC_MIMX9352_A55
#define ENET1G_CLOCK kCLOCK_Enet1
#else
#define ENET_CLOCK kCLOCK_Enet
#define ENET1G_CLOCK kCLOCK_Enet_1g
#endif
}
#ifdef ENET_CLOCK
case IMX_CCM_ENET_CLK:
CLOCK_EnableClock(ENET_CLOCK);
return 0;
#endif
return 0;
case IMX_CCM_ENET1G_CLK:
CLOCK_EnableClock(ENET1G_CLOCK);
return 0;
#endif
default:
(void)instance;
return 0;
}
}

static int mcux_ccm_off(const struct device *dev,
Expand Down Expand Up @@ -116,7 +133,11 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
#ifdef CONFIG_ETH_NXP_ENET
case IMX_CCM_ENET_CLK:
case IMX_CCM_ENET1G_CLK:
#ifdef CONFIG_SOC_MIMX9352_A55
clock_root = kCLOCK_Root_WakeupAxi;
#else
clock_root = kCLOCK_Root_Bus;
#endif
break;
#endif

Expand Down

0 comments on commit fa9a131

Please sign in to comment.