Skip to content

Commit 91de5ac

Browse files
committed
Merge branch 'net-pcs-stmmac=add-C37-AN-SGMII-support'
Ong Boon Leong says: ==================== net: pcs, stmmac: add C37 AN SGMII support This patch series adds MAC-side SGMII support to stmmac driver and it is changed as follow:- 1/6: Refactor the current C73 implementation in pcs-xpcs to prepare for adding C37 AN later. 2/6: Add MAC-side SGMII C37 AN support to pcs-xpcs 3,4/6: make phylink_parse_mode() to work for non-DT platform so that we can use stmmac platform_data to set it. 5/6: Make stmmac_open() to only skip PHY init if C73 is used, otherwise C37 AN will need phydev to be connected to phylink. 6/6: Finally, add pcs-xpcs SGMII interface support to Intel mGbE controller. The patch series have been tested on EHL CRB PCH TSN (eth2) controller that has Marvell 88E1512 PHY attached over SGMII interface and the iterative tests of speed change (AN) + ping test have been successful. [63446.009295] intel-eth-pci 0000:00:1e.4 eth2: Link is Down [63449.986365] intel-eth-pci 0000:00:1e.4 eth2: Link is Up - 1Gbps/Full - flow control off [63449.987625] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready [63451.248064] intel-eth-pci 0000:00:1e.4 eth2: Link is Down [63454.082366] intel-eth-pci 0000:00:1e.4 eth2: Link is Up - 100Mbps/Full - flow control off [63454.083650] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready [63456.465179] intel-eth-pci 0000:00:1e.4 eth2: Link is Down [63459.202367] intel-eth-pci 0000:00:1e.4 eth2: Link is Up - 10Mbps/Full - flow control off [63459.203639] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready [63460.882832] intel-eth-pci 0000:00:1e.4 eth2: Link is Down [63464.322366] intel-eth-pci 0000:00:1e.4 eth2: Link is Up - 1Gbps/Full - flow control off ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 29c35da + 7310fe5 commit 91de5ac

File tree

7 files changed

+258
-31
lines changed

7 files changed

+258
-31
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#include "dwmac4.h"
1010
#include "stmmac.h"
1111

12+
#define INTEL_MGBE_ADHOC_ADDR 0x15
13+
#define INTEL_MGBE_XPCS_ADDR 0x16
14+
1215
struct intel_priv_data {
1316
int mdio_adhoc_addr; /* mdio address for serdes & etc */
1417
};
@@ -333,6 +336,16 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
333336
/* Use the last Rx queue */
334337
plat->vlan_fail_q = plat->rx_queues_to_use - 1;
335338

339+
/* Intel mgbe SGMII interface uses pcs-xcps */
340+
if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII) {
341+
plat->mdio_bus_data->has_xpcs = true;
342+
plat->mdio_bus_data->xpcs_an_inband = true;
343+
}
344+
345+
/* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
346+
plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR;
347+
plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR;
348+
336349
return 0;
337350
}
338351

@@ -664,7 +677,7 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
664677
pci_set_master(pdev);
665678

666679
plat->bsp_priv = intel_priv;
667-
intel_priv->mdio_adhoc_addr = 0x15;
680+
intel_priv->mdio_adhoc_addr = INTEL_MGBE_ADHOC_ADDR;
668681

669682
ret = info->setup(pdev, plat);
670683
if (ret)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
11171117
priv->phylink_config.dev = &priv->dev->dev;
11181118
priv->phylink_config.type = PHYLINK_NETDEV;
11191119
priv->phylink_config.pcs_poll = true;
1120+
priv->phylink_config.ovr_an_inband =
1121+
priv->plat->mdio_bus_data->xpcs_an_inband;
11201122

11211123
if (!fwnode)
11221124
fwnode = dev_fwnode(priv->device);
@@ -2896,7 +2898,7 @@ static int stmmac_open(struct net_device *dev)
28962898

28972899
if (priv->hw->pcs != STMMAC_PCS_TBI &&
28982900
priv->hw->pcs != STMMAC_PCS_RTBI &&
2899-
priv->hw->xpcs == NULL) {
2901+
priv->hw->xpcs_args.an_mode != DW_AN_C73) {
29002902
ret = stmmac_init_phy(dev);
29012903
if (ret) {
29022904
netdev_err(priv->dev,

0 commit comments

Comments
 (0)