Skip to content

Commit

Permalink
cleanup clock init in soc
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswalmsley-cpi committed Jul 6, 2023
1 parent 7ac54cf commit da6c8ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 0 additions & 10 deletions drivers/ethernet/eth_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,16 +1073,6 @@ static void eth_mcux_init(const struct device *dev)
kENET_RxAccelProtoCheckEnabled;
}

#ifdef CONFIG_ETH_MCUX_RMII_EXT_CLK
if(context->base == ENET) {
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1RefClkMode, true);
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, false);
} else {
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2RefClkMode, true);
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2TxClkOutputDir, false);
}
#endif

ENET_Init(context->base,
&context->enet_handle,
&enet_config,
Expand Down
16 changes: 14 additions & 2 deletions soc/arm/nxp_imx/rt/soc_rt10xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,26 @@ static ALWAYS_INLINE void clock_init(void)

#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && CONFIG_NET_L2_ETHERNET
/* Enable clock output for ENET1 */
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, true);
#ifdef CONFIG_ETH_MCUX_RMII_EXT_CLK
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1RefClkMode, true);
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, false);
#else
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir |
kIOMUXC_GPR_ENET1RefClkMode, false);
#endif
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) && CONFIG_NET_L2_ETHERNET
#ifdef CONFIG_ETH_MCUX_RMII_EXT_CLK
/* Set ENET2 ref clock to be generated by External OSC,*/
/* direction as output and frequency to 50MHz */
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2RefClkMode, true);
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2TxClkOutputDir, false);

#else
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2TxClkOutputDir |
kIOMUXC_GPR_ENET2RefClkMode, true);
kIOMUXC_GPR_ENET2RefClkMode, false);
#endif
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI
Expand Down

0 comments on commit da6c8ab

Please sign in to comment.