Skip to content

Commit

Permalink
arch/arm64/src/imx9: Add config option to select TX clk direction
Browse files Browse the repository at this point in the history
TX clock or ref clock can be driven either from outside (PHY / oscilator) or by the ENET block.

Typical connection with RMII PHY is that the PHY drives the refclk.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Aug 29, 2024
1 parent ec07426 commit b0bf61b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions arch/arm64/src/imx9/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,11 @@ config IMX9_ENET1_RGMII

endchoice

config IMX9_ENET1_TX_CLOCK_IS_INPUT
bool "ENET1 TX clock is input"
default y if IMX9_ENET1_RMII
default n if IMX9_ENET1_RGMII

config IMX9_ENET1_PHY_AUTONEG
bool "ENET1 PHY autonegotiation enable"
default y
Expand Down
11 changes: 10 additions & 1 deletion arch/arm64/src/imx9/imx9_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "imx9_iomuxc.h"
#include "hardware/imx9_ccm.h"
#include "hardware/imx9_pinmux.h"
#include "hardware/imx9_blk_ctrl.h"

#ifdef CONFIG_IMX9_ENET

Expand Down Expand Up @@ -423,7 +424,7 @@ static inline uint32_t imx9_enet_getreg32(struct imx9_driver_s *priv,
}

/****************************************************************************
* Name: imx9_enet_putreg32
* Name: imx9_enet_modifyreg32
*
* Description:
* Atomically modify the specified bits in a memory mapped register
Expand Down Expand Up @@ -3092,6 +3093,14 @@ int imx9_netinitialize(int intf)

imx9_ccm_configure_root_clock(CCM_CR_ENETREFPHY, SYS_PLL1PFD0DIV2, 20);

/* Enet TX / ref clock direction */

#ifdef CONFIG_IMX9_ENET1_TX_CLOCK_IS_INPUT
modifyreg32(IMX9_WAKUPMIX_ENET_CLK_SEL, WAKEUPMIX_ENET1_TX_CLK_SEL, 0);
#else
modifyreg32(IMX9_WAKUPMIX_ENET_CLK_SEL, 0, WAKEUPMIX_ENET1_TX_CLK_SEL);
#endif

/* Enable the ENET clock */

imx9_ccm_gate_on(priv->clk_gate, true);
Expand Down

0 comments on commit b0bf61b

Please sign in to comment.