From: Sean Anderson <sean.anderson@seco.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Madalin Bucur <madalin.bucur@nxp.com>,
netdev@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>,
linux-arm-kernel@lists.infradead.org,
Eric Dumazet <edumazet@google.com>,
linux-kernel@vger.kernel.org,
Sean Anderson <sean.anderson@seco.com>
Subject: [PATCH net-next v2 09/35] net: fman: Get PCS node in per-mac init
Date: Tue, 28 Jun 2022 18:13:38 -0400 [thread overview]
Message-ID: <20220628221404.1444200-10-sean.anderson@seco.com> (raw)
In-Reply-To: <20220628221404.1444200-1-sean.anderson@seco.com>
This moves the reading of the PCS property out of the generic probe and
into the mac-specific initialization function. This reduces the
mac-specific jobs done in the top-level probe function.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---
(no changes since v1)
drivers/net/ethernet/freescale/fman/mac.c | 19 +++++++++----------
drivers/net/ethernet/freescale/fman/mac.h | 2 +-
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 6a4eaca83700..0af6f6c49284 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -32,7 +32,6 @@ struct mac_priv_s {
void __iomem *vaddr;
u8 cell_index;
struct fman *fman;
- struct device_node *internal_phy_node;
/* List of multicast addresses */
struct list_head mc_addr_list;
struct platform_device *eth_dev;
@@ -85,12 +84,12 @@ static int set_fman_mac_params(struct mac_device *mac_dev,
params->exception_cb = mac_exception;
params->event_cb = mac_exception;
params->dev_id = mac_dev;
- params->internal_phy_node = priv->internal_phy_node;
return 0;
}
-static int tgec_initialization(struct mac_device *mac_dev)
+static int tgec_initialization(struct mac_device *mac_dev,
+ struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
@@ -138,7 +137,8 @@ static int tgec_initialization(struct mac_device *mac_dev)
return err;
}
-static int dtsec_initialization(struct mac_device *mac_dev)
+static int dtsec_initialization(struct mac_device *mac_dev,
+ struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
@@ -150,6 +150,7 @@ static int dtsec_initialization(struct mac_device *mac_dev)
err = set_fman_mac_params(mac_dev, ¶ms);
if (err)
goto _return;
+ params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
mac_dev->fman_mac = dtsec_config(¶ms);
if (!mac_dev->fman_mac) {
@@ -190,7 +191,8 @@ static int dtsec_initialization(struct mac_device *mac_dev)
return err;
}
-static int memac_initialization(struct mac_device *mac_dev)
+static int memac_initialization(struct mac_device *mac_dev,
+ struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
@@ -201,6 +203,7 @@ static int memac_initialization(struct mac_device *mac_dev)
err = set_fman_mac_params(mac_dev, ¶ms);
if (err)
goto _return;
+ params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
if (priv->max_speed == SPEED_10000)
params.phy_if = PHY_INTERFACE_MODE_XGMII;
@@ -583,14 +586,10 @@ static int mac_probe(struct platform_device *_of_dev)
if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) {
setup_dtsec(mac_dev);
- priv->internal_phy_node = of_parse_phandle(mac_node,
- "tbi-handle", 0);
} else if (of_device_is_compatible(mac_node, "fsl,fman-xgec")) {
setup_tgec(mac_dev);
} else if (of_device_is_compatible(mac_node, "fsl,fman-memac")) {
setup_memac(mac_dev);
- priv->internal_phy_node = of_parse_phandle(mac_node,
- "pcsphy-handle", 0);
} else {
dev_err(dev, "MAC node (%pOF) contains unsupported MAC\n",
mac_node);
@@ -783,7 +782,7 @@ static int mac_probe(struct platform_device *_of_dev)
put_device(&phy->mdio.dev);
}
- err = mac_dev->init(mac_dev);
+ err = mac_dev->init(mac_dev, mac_node);
if (err < 0) {
dev_err(dev, "mac_dev->init() = %d\n", err);
of_node_put(mac_dev->phy_node);
diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h
index 95f67b4efb61..e4329c7d5001 100644
--- a/drivers/net/ethernet/freescale/fman/mac.h
+++ b/drivers/net/ethernet/freescale/fman/mac.h
@@ -35,7 +35,7 @@ struct mac_device {
bool promisc;
bool allmulti;
- int (*init)(struct mac_device *mac_dev);
+ int (*init)(struct mac_device *mac_dev, struct device_node *mac_node);
int (*enable)(struct fman_mac *mac_dev);
int (*disable)(struct fman_mac *mac_dev);
void (*adjust_link)(struct mac_device *mac_dev);
--
2.35.1.1320.gc452695387.dirty
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-28 22:22 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 22:13 [PATCH net-next v2 00/35] [RFT] net: dpaa: Convert to phylink Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 01/35] dt-bindings: phy: Add QorIQ SerDes binding Sean Anderson
2022-06-29 2:09 ` Rob Herring
2022-06-30 15:53 ` Sean Anderson
2022-06-30 17:27 ` Rob Herring
2022-06-30 18:01 ` Sean Anderson
2022-06-30 18:08 ` Krzysztof Kozlowski
2022-06-30 18:16 ` Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 02/35] dt-bindings: net: Convert FMan MAC bindings to yaml Sean Anderson
2022-06-29 2:09 ` Rob Herring
2022-06-29 14:50 ` Russell King (Oracle)
2022-06-30 14:59 ` Sean Anderson
2022-07-01 0:01 ` Rob Herring
2022-06-28 22:13 ` [PATCH net-next v2 03/35] dt-bindings: net: fman: Add additional interface properties Sean Anderson
2022-06-30 16:01 ` Rob Herring
2022-06-30 16:11 ` Sean Anderson
2022-07-12 19:36 ` Rob Herring
2022-07-12 19:56 ` Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 04/35] [RFC] phy: fsl: Add Lynx 10G SerDes driver Sean Anderson
2022-06-30 15:56 ` Ioana Ciornei
2022-06-30 18:11 ` Sean Anderson
2022-07-01 10:03 ` Ioana Ciornei
2022-07-01 15:51 ` Sean Anderson
[not found] ` <343faa45-4e4a-7a7f-b0c3-fcc9db89e976@seco.com>
2022-07-01 21:04 ` Sean Anderson
2022-07-05 6:12 ` Vinod Koul
2022-07-05 15:29 ` Sean Anderson
2022-07-06 16:57 ` Vinod Koul
2022-07-07 15:00 ` Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 05/35] net: fman: Convert to SPDX identifiers Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 06/35] net: fman: Don't pass comm_mode to enable/disable Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 07/35] net: fman: Store en/disable in mac_device instead of mac_priv_s Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 08/35] net: fman: dtsec: Always gracefully stop/start Sean Anderson
2022-06-28 22:13 ` Sean Anderson [this message]
2022-06-28 22:13 ` [PATCH net-next v2 10/35] net: fman: Store initialization function in match data Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 11/35] net: fman: Move struct dev to mac_device Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 12/35] net: fman: Configure fixed link in memac_initialization Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 13/35] net: fman: Export/rename some common functions Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 14/35] net: fman: memac: Use params instead of priv for max_speed Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 15/35] net: fman: Move initialization to mac-specific files Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 16/35] net: fman: Mark mac methods static Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 17/35] net: fman: Inline several functions into initialization Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 18/35] net: fman: Remove internal_phy_node from params Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 19/35] net: fman: Map the base address once Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 20/35] net: fman: Pass params directly to mac init Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 21/35] net: fman: Use mac_dev for some params Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 22/35] net: fman: Specify type of mac_dev for exception_cb Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 23/35] net: fman: Clean up error handling Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 24/35] net: fman: Change return type of disable to void Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 25/35] net: dpaa: Use mac_dev variable in dpaa_netdev_init Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 26/35] soc: fsl: qbman: Add helper for sanity checking cgr ops Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 27/35] soc: fsl: qbman: Add CGR update function Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 28/35] net: dpaa: Adjust queue depth on rate change Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 29/35] net: fman: memac: Add serdes support Sean Anderson
2022-06-28 22:13 ` [PATCH net-next v2 30/35] net: fman: memac: Use lynx pcs driver Sean Anderson
2022-06-28 22:14 ` [PATCH net-next v2 31/35] [RFT] net: dpaa: Convert to phylink Sean Anderson
2022-06-29 14:44 ` Russell King (Oracle)
2022-06-30 15:56 ` Sean Anderson
2022-06-28 22:14 ` [PATCH net-next v2 32/35] qoriq: Specify which MACs support RGMII Sean Anderson
2022-06-28 22:14 ` [PATCH net-next v2 33/35] qoriq: Add nodes for QSGMII PCSs Sean Anderson
2022-06-28 22:14 ` [PATCH net-next v2 34/35] arm64: dts: ls1046a: Add serdes bindings Sean Anderson
2022-06-28 22:14 ` [PATCH net-next v2 35/35] arm64: dts: ls1046ardb: " 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=20220628221404.1444200-10-sean.anderson@seco.com \
--to=sean.anderson@seco.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=madalin.bucur@nxp.com \
--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).