Skip to content

Commit 94c16fd

Browse files
Mathieu Othacehekuba-moo
authored andcommitted
net: dwmac-imx: add imx93 clock input support in RMII mode
If the rmii_refclk_ext boolean is set, configure the ENET QOS TX_CLK pin direction to input. Otherwise, it defaults to output. That mirrors what is already happening for the imx8mp in the imx8mp_set_intf_mode function. Signed-off-by: Mathieu Othacehe <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5df7ca0 commit 94c16fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define MX93_GPR_ENET_QOS_INTF_SEL_RMII (0x4 << 1)
3737
#define MX93_GPR_ENET_QOS_INTF_SEL_RGMII (0x1 << 1)
3838
#define MX93_GPR_ENET_QOS_CLK_GEN_EN (0x1 << 0)
39+
#define MX93_GPR_ENET_QOS_CLK_SEL_MASK BIT_MASK(0)
40+
#define MX93_GPR_CLK_SEL_OFFSET (4)
3941

4042
#define DMA_BUS_MODE 0x00001000
4143
#define DMA_BUS_MODE_SFT_RESET (0x1 << 0)
@@ -108,13 +110,21 @@ imx8dxl_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
108110
static int imx93_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
109111
{
110112
struct imx_priv_data *dwmac = plat_dat->bsp_priv;
111-
int val;
113+
int val, ret;
112114

113115
switch (plat_dat->mac_interface) {
114116
case PHY_INTERFACE_MODE_MII:
115117
val = MX93_GPR_ENET_QOS_INTF_SEL_MII;
116118
break;
117119
case PHY_INTERFACE_MODE_RMII:
120+
if (dwmac->rmii_refclk_ext) {
121+
ret = regmap_clear_bits(dwmac->intf_regmap,
122+
dwmac->intf_reg_off +
123+
MX93_GPR_CLK_SEL_OFFSET,
124+
MX93_GPR_ENET_QOS_CLK_SEL_MASK);
125+
if (ret)
126+
return ret;
127+
}
118128
val = MX93_GPR_ENET_QOS_INTF_SEL_RMII;
119129
break;
120130
case PHY_INTERFACE_MODE_RGMII:

0 commit comments

Comments
 (0)