All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ong Boon Leong <boon.leong.ong@intel.com>
To: Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Paolo Abeni <pabeni@redhat.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Ong Boon Leong <boon.leong.ong@intel.com>
Subject: [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support
Date: Fri, 22 Apr 2022 15:35:03 +0800	[thread overview]
Message-ID: <20220422073505.810084-3-boon.leong.ong@intel.com> (raw)
In-Reply-To: <20220422073505.810084-1-boon.leong.ong@intel.com>

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 <emilio.riva@ericsson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Ong Boon Leong <boon.leong.ong@intel.com>
To: Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Paolo Abeni <pabeni@redhat.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Ong Boon Leong <boon.leong.ong@intel.com>
Subject: [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support
Date: Fri, 22 Apr 2022 15:35:03 +0800	[thread overview]
Message-ID: <20220422073505.810084-3-boon.leong.ong@intel.com> (raw)
In-Reply-To: <20220422073505.810084-1-boon.leong.ong@intel.com>

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 <emilio.riva@ericsson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-04-22  7:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  7:35 [PATCH net-next 0/4] pcs-xpcs, stmmac: add 1000BASE-X AN for network switch Ong Boon Leong
2022-04-22  7:35 ` Ong Boon Leong
2022-04-22  7:35 ` [PATCH net-next 1/4] net: pcs: xpcs: add CL37 1000BASE-X AN support Ong Boon Leong
2022-04-22  7:35   ` Ong Boon Leong
2022-04-22  8:00   ` Russell King (Oracle)
2022-04-22  8:00     ` Russell King (Oracle)
2022-04-25  3:30     ` Ong, Boon Leong
2022-04-25  3:30       ` Ong, Boon Leong
2022-04-22 17:35   ` kernel test robot
2022-04-22 17:35     ` kernel test robot
2022-04-23  3:00   ` kernel test robot
2022-04-23  3:00     ` kernel test robot
2022-04-22  7:35 ` Ong Boon Leong [this message]
2022-04-22  7:35   ` [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support Ong Boon Leong
2022-04-22 12:58   ` Andrew Lunn
2022-04-22 12:58     ` Andrew Lunn
2022-04-23  1:13     ` Ong, Boon Leong
2022-04-23  1:13       ` Ong, Boon Leong
2022-04-22  7:35 ` [PATCH net-next 3/4] stmmac: intel: prepare to support 1000BASE-X phy interface setting Ong Boon Leong
2022-04-22  7:35   ` Ong Boon Leong
2022-04-22  7:35 ` [PATCH net-next 4/4] stmmac: intel: introduce platform data phyless setting for Ericsson system Ong Boon Leong
2022-04-22  7:35   ` Ong Boon Leong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220422073505.810084-3-boon.leong.ong@intel.com \
    --to=boon.leong.ong@intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexandre.torgue@st.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.