All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>
Cc: u-boot@lists.denx.de, "Marek Behún" <marek.behun@nic.cz>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Priyanka Jain" <priyanka.jain@nxp.com>,
	"Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Wolfgang Denk" <wd@denx.de>
Subject: [PATCH u-boot-net 12/14] net: phy: use ->is_c45 instead of is_10g_interface()
Date: Thu, 17 Mar 2022 13:49:56 +0100	[thread overview]
Message-ID: <20220317124958.27921-13-kabel@kernel.org> (raw)
In-Reply-To: <20220317124958.27921-1-kabel@kernel.org>

From: Marek Behún <marek.behun@nic.cz>

Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to
determine whether clause 45 protocol should be used.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 drivers/net/phy/phy.c |  8 ++++----
 include/phy.h         | 12 ------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 4109676a51..10c724388f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -632,10 +632,10 @@ static int phy_probe(struct phy_device *phydev)
 	return err;
 }
 
-static struct phy_driver *generic_for_interface(phy_interface_t interface)
+static struct phy_driver *generic_for_phy(struct phy_device *phydev)
 {
 #ifdef CONFIG_PHYLIB_10G
-	if (is_10g_interface(interface))
+	if (phydev->is_c45)
 		return &gen10g_driver;
 #endif
 
@@ -656,7 +656,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev,
 	}
 
 	/* If we made it here, there's no driver for this PHY */
-	return generic_for_interface(interface);
+	return generic_for_phy(phydev);
 }
 
 static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
@@ -859,7 +859,7 @@ int phy_reset(struct phy_device *phydev)
 
 #ifdef CONFIG_PHYLIB_10G
 	/* If it's 10G, we need to issue reset through one of the MMDs */
-	if (is_10g_interface(phydev->interface)) {
+	if (phydev->is_c45) {
 		if (!phydev->mmds)
 			gen10g_discover_mmds(phydev);
 
diff --git a/include/phy.h b/include/phy.h
index dee8fb5f2e..9742ce6fe1 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -359,18 +359,6 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
 
 #ifdef CONFIG_PHYLIB_10G
 extern struct phy_driver gen10g_driver;
-
-/*
- * List all 10G interfaces here, the assumption being that PHYs on these
- * interfaces are C45
- */
-static inline int is_10g_interface(phy_interface_t interface)
-{
-	return interface == PHY_INTERFACE_MODE_XGMII ||
-	       interface == PHY_INTERFACE_MODE_USXGMII ||
-	       interface == PHY_INTERFACE_MODE_10GBASER;
-}
-
 #endif
 
 /**
-- 
2.34.1


  parent reply	other threads:[~2022-03-17 12:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 12:49 [PATCH u-boot-net 00/14] u-boot-net refactors, fixes, cleanups Marek Behún
2022-03-17 12:49 ` [PATCH u-boot-net 01/14] net: mdio-uclass: fix type for phy_mode_str and phy_handle_str Marek Behún
2022-03-18  7:54   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 02/14] net: mdio-uclass: use ARRAY_SIZE() Marek Behún
2022-03-18  7:55   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 03/14] net: introduce helpers to get PHY ofnode from MAC Marek Behún
2022-03-18  8:02   ` Ramon Fried
2022-03-28  6:35   ` Simon Glass
2022-03-28 21:51     ` Marek Behún
2022-03-17 12:49 ` [PATCH u-boot-net 04/14] net: mdio-uclass: add wrappers for read/write/reset operations Marek Behún
2022-03-18  8:00   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 05/14] treewide: use dm_mdio_read/write/reset() wrappers Marek Behún
2022-03-18  8:04   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 06/14] net: phy: fix parsing wrong property Marek Behún
2022-03-18  8:05   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 07/14] net: introduce helpers to get PHY interface mode from a device/ofnode Marek Behún
2022-03-18  8:07   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 08/14] treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX Marek Behún
2022-03-18  7:34   ` Stefan Roese
2022-03-17 12:49 ` [PATCH u-boot-net 09/14] treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA Marek Behún
2022-03-18  7:34   ` Stefan Roese
2022-03-18  8:07   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 10/14] phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition Marek Behún
2022-03-18  7:34   ` Stefan Roese
2022-03-18  8:08   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 11/14] net: phy: xilinx: Check interface type in ->config(), not ->probe() Marek Behún
2022-03-18  8:09   ` Ramon Fried
2022-03-17 12:49 ` Marek Behún [this message]
2022-03-18  8:10   ` [PATCH u-boot-net 12/14] net: phy: use ->is_c45 instead of is_10g_interface() Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 13/14] bcmgenet, sun8i_emac: Don't connect PHY two times Marek Behún
2022-03-18  8:10   ` Ramon Fried
2022-03-17 12:49 ` [PATCH u-boot-net 14/14] net: phy: don't require PHY interface mode during PHY creation Marek Behún
2022-03-18  8:12   ` Ramon Fried
2022-03-18  8:13 ` [PATCH u-boot-net 00/14] u-boot-net refactors, fixes, cleanups Ramon Fried

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=20220317124958.27921-13-kabel@kernel.org \
    --to=kabel@kernel.org \
    --cc=bmeng.cn@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=marek.behun@nic.cz \
    --cc=michal.simek@xilinx.com \
    --cc=priyanka.jain@nxp.com \
    --cc=radu-nicolae.pirea@oss.nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=vladimir.oltean@nxp.com \
    --cc=wd@denx.de \
    /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.