how to set mii speed in fec driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to set mii speed in fec driver

Jump to solution
1,066 Views
ankitpanchal167
Contributor III

Hi 

i want to set mii speed of fec as 1 Mhz on imx8mp.

how to i set mii speed 1 Mhz? 

Right now it's 2.5 Mhz.

we are try to set using fec_main.c file but not able to set some time its very high frequncy. 

here added fec mii speed snap 

mii_speed = DIV_ROUND_UP(clk_get_rate(fep->clk_ipg), 5000000);
if (fep->quirks & FEC_QUIRK_ENET_MAC)
mii_speed--;
if (mii_speed > 63) {
dev_err(&pdev->dev,
"fec clock (%lu) too fast to get right mii speed\n",
clk_get_rate(fep->clk_ipg));
err = -EINVAL;
goto err_out;
}

holdtime = DIV_ROUND_UP(clk_get_rate(fep->clk_ipg), 100000000) - 1;

fep->phy_speed = mii_speed << 1 | holdtime << 8;

writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);

As per code we are below value are geting for 2.5 Mhz  

mii_speed = 54

clk_get_rate(fep->clk_ipg) = 266666666

holdtime = 2 

 How to set  1 Mhz  instead of 2.5 Mhz ? 

which value i want  to change ?

we are using imx8mp 5.4 kernel 

 

 

0 Kudos
Reply
1 Solution
1,054 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ankit

 

in general one can try to decrease value of parent clock using const imx8mp_enet_ref_sels[] 

in clock driver

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/clk/imx/clk-imx8mp.c?h=lf-5.10.y

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8mp.dtsi?...

However setting such low frequency seems out of ENET specification as i.MX8M Plus supports

only RMII and RGMII as described in sect.3.8.3 Ethernet controller (ENET) AC electrical specifications

i.MX 8M Plus Applications Processor Datasheet for Consumer Products

 

Best regards
igor

View solution in original post

0 Kudos
Reply
1 Reply
1,055 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ankit

 

in general one can try to decrease value of parent clock using const imx8mp_enet_ref_sels[] 

in clock driver

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/clk/imx/clk-imx8mp.c?h=lf-5.10.y

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8mp.dtsi?...

However setting such low frequency seems out of ENET specification as i.MX8M Plus supports

only RMII and RGMII as described in sect.3.8.3 Ethernet controller (ENET) AC electrical specifications

i.MX 8M Plus Applications Processor Datasheet for Consumer Products

 

Best regards
igor

0 Kudos
Reply