Re: [PATCH 5.10 041/290] net: enetc: force the RGMII speed and duplex instead of operating in inband mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> It has been reported that RGMII is broken in fixed-link, and that is not
> surprising considering the fact that no PHY is attached to the MAC in
> that case, but a switch.

Okay, but there's something wrong in the code.

> This brings us to the topic of the patch: the enetc driver should have
> not enabled the optional in-band status signaling for RGMII unconditionally,
> but should have forced the speed and duplex to what was resolved by
> phylink.

> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> @@ -494,13 +494,20 @@ static void enetc_configure_port_mac(str
>  
>  static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode)
>  {
...
> +	u32 val;
> +
> +	if (phy_interface_mode_is_rgmii(phy_mode)) {
> +		val = enetc_port_rd(hw, ENETC_PM0_IF_MODE);
> +		val &= ~ENETC_PM0_IFM_EN_AUTO;
> +		val &= ENETC_PM0_IFM_IFMODE_MASK;
> +		val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG;
> +		enetc_port_wr(hw, ENETC_PM0_IF_MODE, val);
> +	}

val clears ENETC_PM0_IFM_EN_AUTO bit, then the bit is cleared again,
preserving just IFMODE bits, then ors the IFMODE bits with new values.

I believe this is needed:

Signed-off-by: Pavel Machek (CIP) <pavel@xxxxxxx>
									Pavel

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 83187cd59fdd..446ad4c43fab 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -499,7 +499,7 @@ static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode)
 	if (phy_interface_mode_is_rgmii(phy_mode)) {
 		val = enetc_port_rd(hw, ENETC_PM0_IF_MODE);
 		val &= ~ENETC_PM0_IFM_EN_AUTO;
-		val &= ENETC_PM0_IFM_IFMODE_MASK;
+		val &= ~ENETC_PM0_IFM_IFMODE_MASK;
 		val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG;
 		enetc_port_wr(hw, ENETC_PM0_IF_MODE, val);
 	}


-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux