2022-04-22 21:31:39

by Ong Boon Leong

[permalink] [raw]
Subject: [PATCH net-next 0/4] pcs-xpcs, stmmac: add 1000BASE-X AN for network switch

Hi,

1/4: Add the support for 1000BASE-X AN to pcs-xpcs which previously supports
C37 SGMII AN mode.
2/4: Add the capability to bypass PHY device detection in stmmac driver as
hinted based on platform data.
3/4 & 4/4: Make dwmac-intel to detect DMI info to switch specific ethernet
interface to use phyless mode according to Ericsson platform
need.

This patch series has been tested by Ericsson engineer Emilio Riva
<[email protected]> separately on its lab.

Thanks

Ong Boon Leong (4):
net: pcs: xpcs: add CL37 1000BASE-X AN support
net: stmmac: introduce PHY-less setup support
stmmac: intel: prepare to support 1000BASE-X phy interface setting
stmmac: intel: introduce platform data phyless setting for Ericsson
system

.../net/ethernet/stmicro/stmmac/dwmac-intel.c | 68 ++++++-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +-
.../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
drivers/net/pcs/pcs-xpcs.c | 174 +++++++++++++++++-
include/linux/pcs/pcs-xpcs.h | 3 +-
include/linux/stmmac.h | 1 +
6 files changed, 250 insertions(+), 8 deletions(-)

--
2.25.1


2022-04-22 22:56:03

by Ong Boon Leong

[permalink] [raw]
Subject: [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support

Certain platform uses PHY-less configuration whereby the MAC controller
is connected to network switch chip directly over SGMII or 1000BASE-X.

This patch prepares the stmmac driver to support PHY-less configuration
described above.

Tested-by: Emilio Riva <[email protected]>
Signed-off-by: Ong Boon Leong <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++++++-
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
include/linux/stmmac.h | 1 +
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 57cb11abec8..4d39387bc48 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1142,11 +1142,18 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
static int stmmac_init_phy(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);
+ struct stmmac_mdio_bus_data *mdio_bus_data;
struct device_node *node;
- int ret;
+ int ret = 0;

+ mdio_bus_data = priv->plat->mdio_bus_data;
node = priv->plat->phylink_node;

+ if (mdio_bus_data->phyless) {
+ netdev_info(priv->dev, "using PHY-less setup\n");
+ goto phyless_setup;
+ }
+
if (node)
ret = phylink_of_phy_connect(priv->phylink, node, 0);

@@ -1166,6 +1173,7 @@ static int stmmac_init_phy(struct net_device *dev)
ret = phylink_connect_phy(priv->phylink, phydev);
}

+phyless_setup:
if (!priv->plat->pmt) {
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 9bc625fccca..16ce188697e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -490,7 +490,7 @@ int stmmac_mdio_register(struct net_device *ndev)
if (priv->plat->has_xgmac)
stmmac_xgmac2_mdio_read(new_bus, 0, MII_ADDR_C45);

- if (priv->plat->phy_node || mdio_node)
+ if (priv->plat->phy_node || mdio_node || mdio_bus_data->phyless)
goto bus_register_done;

found = 0;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index f8e8df25098..238d452ef43 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -82,6 +82,7 @@ struct stmmac_mdio_bus_data {
unsigned int phy_mask;
unsigned int has_xpcs;
unsigned int xpcs_an_inband;
+ unsigned int phyless;
int *irqs;
int probed_phy_irq;
bool needs_reset;
--
2.25.1