netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: linux@armlinux.org.uk, andrew@lunn.ch, hkallweit1@gmail.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH net-next v2 4/4] net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling
Date: Tue, 10 Jan 2023 14:02:06 +0900	[thread overview]
Message-ID: <20230110050206.116110-5-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <20230110050206.116110-1-yoshihiro.shimoda.uh@renesas.com>

Some Ethernet PHYs (like marvell10g) will decide the host interface
mode by the media-side speed. So, the rswitch driver needs to
initialize one of the Ethernet SERDES (r8a779f0-eth-serdes) ports
after linked the Ethernet PHY up. The r8a779f0-eth-serdes driver has
.init() for initializing all ports and .power_on() for initializing
each port. So, add phy_power_{on,off} calling for it.

Notes that in-band mode will not work because the initialization
is not completed. So, output error message if in-band mode.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/net/ethernet/renesas/rswitch.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 5a8a0c48dfd3..c027c2be9151 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1174,12 +1174,20 @@ static void rswitch_mac_config(struct phylink_config *config,
 			       unsigned int mode,
 			       const struct phylink_link_state *state)
 {
+	struct net_device *ndev = to_net_dev(config->dev);
+
+	if (mode == MLO_AN_INBAND)
+		netdev_err(ndev, "Link up/down will not work because in-band mode\n");
 }
 
 static void rswitch_mac_link_down(struct phylink_config *config,
 				  unsigned int mode,
 				  phy_interface_t interface)
 {
+	struct net_device *ndev = to_net_dev(config->dev);
+	struct rswitch_device *rdev = netdev_priv(ndev);
+
+	phy_power_off(rdev->serdes);
 }
 
 static void rswitch_mac_link_up(struct phylink_config *config,
@@ -1187,7 +1195,11 @@ static void rswitch_mac_link_up(struct phylink_config *config,
 				phy_interface_t interface, int speed,
 				int duplex, bool tx_pause, bool rx_pause)
 {
+	struct net_device *ndev = to_net_dev(config->dev);
+	struct rswitch_device *rdev = netdev_priv(ndev);
+
 	/* Current hardware cannot change speed at runtime */
+	phy_power_on(rdev->serdes);
 }
 
 static const struct phylink_mac_ops rswitch_phylink_ops = {
-- 
2.25.1


  parent reply	other threads:[~2023-01-10  5:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10  5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
2023-01-10  5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
2023-01-10 14:21   ` Arun.Ramadoss
2023-01-12  7:33     ` Yoshihiro Shimoda
2023-01-10  5:02 ` [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling Yoshihiro Shimoda
2023-01-10 14:15   ` Arun.Ramadoss
2023-01-12  7:32     ` Yoshihiro Shimoda
2023-01-10  5:02 ` [PATCH net-next v2 3/4] net: ethernet: renesas: rswitch: Enable ovr_host_interfaces Yoshihiro Shimoda
2023-01-10  5:02 ` Yoshihiro Shimoda [this message]
2023-01-10 14:35 ` [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Russell King (Oracle)
2023-01-12  1:09   ` Yoshihiro Shimoda

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=20230110050206.116110-5-yoshihiro.shimoda.uh@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).