[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221103210650.2325784-11-sean.anderson@seco.com>
Date: Thu, 3 Nov 2022 17:06:49 -0400
From: Sean Anderson <sean.anderson@...o.com>
To: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org
Cc: Vladimir Oltean <olteanv@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
Andrew Lunn <andrew@...n.ch>,
Ioana Ciornei <ioana.ciornei@....com>,
Madalin Bucur <madalin.bucur@....com>,
"David S . Miller" <davem@...emloft.net>,
Sean Anderson <sean.anderson@...o.com>
Subject: [PATCH net-next v2 10/11] [DO NOT MERGE] net: dpaa2: Convert to use PCS subsystem
This converts the DPAA2 driver to use the PCS subsystem, instead of
attaching the Lynx library to an MDIO device.
Signed-off-by: Sean Anderson <sean.anderson@...o.com>
---
Changes in v2:
- Split off from the lynx PCS patch
drivers/net/ethernet/freescale/dpaa2/Kconfig | 1 +
.../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 43 +++----------------
2 files changed, 8 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/Kconfig b/drivers/net/ethernet/freescale/dpaa2/Kconfig
index d029b69c3f18..2648e9fb6e13 100644
--- a/drivers/net/ethernet/freescale/dpaa2/Kconfig
+++ b/drivers/net/ethernet/freescale/dpaa2/Kconfig
@@ -3,6 +3,7 @@ config FSL_DPAA2_ETH
tristate "Freescale DPAA2 Ethernet"
depends on FSL_MC_BUS && FSL_MC_DPIO
select PHYLINK
+ select PCS
select PCS_LYNX
select FSL_XGMAC_MDIO
select NET_DEVLINK
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index 49ff85633783..18f8f9f8d161 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -2,6 +2,7 @@
/* Copyright 2019 NXP */
#include <linux/acpi.h>
+#include <linux/pcs.h>
#include <linux/pcs-lynx.h>
#include <linux/phy/phy.h>
#include <linux/property.h>
@@ -246,32 +247,10 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
struct fwnode_handle *dpmac_node,
int id)
{
- struct mdio_device *mdiodev;
- struct fwnode_handle *node;
-
- node = fwnode_find_reference(dpmac_node, "pcs-handle", 0);
- if (IS_ERR(node)) {
- /* do not error out on old DTS files */
- netdev_warn(mac->net_dev, "pcs-handle node not found\n");
- return 0;
- }
-
- if (!fwnode_device_is_available(node)) {
- netdev_err(mac->net_dev, "pcs-handle node not available\n");
- fwnode_handle_put(node);
- return -ENODEV;
- }
-
- mdiodev = fwnode_mdio_find_device(node);
- fwnode_handle_put(node);
- if (!mdiodev)
- return -EPROBE_DEFER;
-
- mac->pcs = lynx_pcs_create(mdiodev);
- if (!mac->pcs) {
- netdev_err(mac->net_dev, "lynx_pcs_create() failed\n");
- put_device(&mdiodev->dev);
- return -ENOMEM;
+ mac->pcs = pcs_get_by_fwnode(&mac->mc_dev->dev, dpmac_node, NULL);
+ if (IS_ERR(mac->pcs)) {
+ netdev_err(mac->net_dev, "pcs_get_by_fwnode() failed\n");
+ return PTR_ERR(mac->pcs);
}
return 0;
@@ -279,16 +258,8 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
{
- struct phylink_pcs *phylink_pcs = mac->pcs;
-
- if (phylink_pcs) {
- struct mdio_device *mdio = lynx_get_mdio_device(phylink_pcs);
- struct device *dev = &mdio->dev;
-
- lynx_pcs_destroy(phylink_pcs);
- put_device(dev);
- mac->pcs = NULL;
- }
+ pcs_put(&mac->mc_dev->dev, mac->pcs);
+ mac->pcs = NULL;
}
static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac)
--
2.35.1.1320.gc452695387.dirty
Powered by blists - more mailing lists