All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	Sean Anderson <sean.anderson@seco.com>
Subject: [PATCH v2 2/2] net: macb: Allow SGMII only if we are a GEM in mac_validate
Date: Mon, 11 Oct 2021 12:55:17 -0400	[thread overview]
Message-ID: <20211011165517.2857893-2-sean.anderson@seco.com> (raw)
In-Reply-To: <20211011165517.2857893-1-sean.anderson@seco.com>

This aligns mac_validate with mac_config. In mac_config, SGMII is only
enabled if macb_is_gem. Validate should care if the mac is a gem as
well. This also simplifies the logic now that all gigabit modes depend
on the mac being a GEM.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

Changes in v2:
- New

 drivers/net/ethernet/cadence/macb_main.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a9105ec1b885..ae8c969a609c 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -534,22 +534,18 @@ static void macb_validate(struct phylink_config *config,
 	case PHY_INTERFACE_MODE_RGMII_ID:
 	case PHY_INTERFACE_MODE_RGMII_RXID:
 	case PHY_INTERFACE_MODE_RGMII_TXID:
-		if (!macb_is_gem(bp)) {
-			if (one)
-				goto none;
-			else
-				goto mii;
-		}
-		fallthrough;
 	case PHY_INTERFACE_MODE_SGMII:
-		if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
-			phylink_set(mask, 1000baseT_Full);
-			phylink_set(mask, 1000baseX_Full);
-			if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
-				phylink_set(mask, 1000baseT_Half);
+		if (macb_is_gem(bp)) {
+			if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
+				phylink_set(mask, 1000baseT_Full);
+				phylink_set(mask, 1000baseX_Full);
+				if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
+					phylink_set(mask, 1000baseT_Half);
+			}
+		} else if (one) {
+			goto none;
 		}
 		fallthrough;
-	mii:
 	case PHY_INTERFACE_MODE_MII:
 	case PHY_INTERFACE_MODE_RMII:
 		phylink_set(mask, 10baseT_Half);
-- 
2.25.1


  reply	other threads:[~2021-10-11 16:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 16:55 [PATCH v2 1/2] net: macb: Clean up macb_validate Sean Anderson
2021-10-11 16:55 ` Sean Anderson [this message]
2021-10-12  0:17   ` [PATCH v2 2/2] net: macb: Allow SGMII only if we are a GEM in mac_validate Jakub Kicinski
2021-10-12  8:27     ` Antoine Tenart
2021-10-12 16:20       ` Sean Anderson
2021-10-12  8:33 ` [PATCH v2 1/2] net: macb: Clean up macb_validate Antoine Tenart
2021-10-12  8:34   ` Antoine Tenart
2021-10-12  9:24   ` Nicolas Ferre
2021-10-12 16:34   ` Sean Anderson
2021-10-12 16:53     ` Antoine Tenart
2021-10-14 16:34   ` Russell King (Oracle)
2021-10-14 17:50     ` Sean Anderson
2021-10-14 23:08       ` Russell King (Oracle)
2021-10-15 22:28         ` Sean Anderson
2021-10-15 22:47           ` Russell King (Oracle)
2021-10-19 15:02             ` Russell King (Oracle)
2021-10-22 17:37               ` Sean Anderson
2021-10-25 10:35                 ` Russell King (Oracle)
2021-10-25 15:26                   ` Sean Anderson

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=20211011165517.2857893-2-sean.anderson@seco.com \
    --to=sean.anderson@seco.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.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.