Skip to contentSkip to conversation

net: stmmac: socfgpa: Ensure emac bit set in sys manager for MII/GMII/SGMII.

PATCH Superseded Stephan Gatzka 2 participants 2 messages Aug 18, 2017

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: socfgpa: Ensure emac bit set in sys manager for MII/GMII/SGMII.

When using MII/GMII/SGMII in the Altera SoC, the phy needs to be wired through the FPGA. To ensure correct behavior, the appropriate bit in the System Manager FPGA Interface Group register needs to be set.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +4 -1
index 17d4bba..d7c231b 100644
@@ -269,7 +269,10 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
 	ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
 	ctrl |= val << reg_shift;
 
-	if (dwmac->f2h_ptp_ref_clk) {
+	if ((dwmac->f2h_ptp_ref_clk) ||
+	    (phymode == PHY_INTERFACE_MODE_MII) ||
+	    (phymode == PHY_INTERFACE_MODE_GMII) ||
+	    (phymode == PHY_INTERFACE_MODE_SGMII)) {
 		ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
 		regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
 			    &module);
Signature · 1 line
2.7.4
#1 lore raw

Hello!

Quoted 15 lines · Stephan Gatzka

When using MII/GMII/SGMII in the Altera SoC, the phy needs to be wired through the FPGA. To ensure correct behavior, the appropriate bit in the System Manager FPGA Interface Group register needs to be set.

---
  drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +0 -0
index 17d4bba..d7c231b 100644

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac) · line 275

Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +4 -1
@@ -269,7 +269,10 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
  	ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
  	ctrl |= val << reg_shift;
 
-	if (dwmac->f2h_ptp_ref_clk) {
+	if ((dwmac->f2h_ptp_ref_clk) ||
+	    (phymode == PHY_INTERFACE_MODE_MII) ||
+	    (phymode == PHY_INTERFACE_MODE_GMII) ||
+	    (phymode == PHY_INTERFACE_MODE_SGMII)) {

Inner parens not needed at all (especially the first pair).

[...]

MBR, Sergei