From: Sean Anderson <sean.anderson@seco.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Cc: Camelia Groza <camelia.groza@nxp.com>,
linux-kernel@vger.kernel.org (open list),
Madalin Bucur <madalin.bucur@nxp.com>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
Sean Anderson <sean.anderson@seco.com>
Subject: [RESEND PATCH net-next v4 06/25] net: fman: Get PCS node in per-mac init
Date: Thu, 18 Aug 2022 12:16:30 -0400 [thread overview]
Message-ID: <20220818161649.2058728-7-sean.anderson@seco.com> (raw)
In-Reply-To: <20220818161649.2058728-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>
Acked-by: Camelia Groza <camelia.groza@nxp.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
next prev parent reply other threads:[~2022-08-18 16:17 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 16:16 [RESEND PATCH net-next v4 00/25] net: dpaa: Cleanups in preparation for phylink conversion Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 01/25] dt-bindings: net: Convert FMan MAC bindings to yaml Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 02/25] net: fman: Convert to SPDX identifiers Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 03/25] net: fman: Don't pass comm_mode to enable/disable Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 04/25] net: fman: Store en/disable in mac_device instead of mac_priv_s Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 05/25] net: fman: dtsec: Always gracefully stop/start Sean Anderson
2022-08-18 16:16 ` Sean Anderson [this message]
2022-08-18 16:16 ` [RESEND PATCH net-next v4 07/25] net: fman: Store initialization function in match data Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 08/25] net: fman: Move struct dev to mac_device Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 09/25] net: fman: Configure fixed link in memac_initialization Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 10/25] net: fman: Export/rename some common functions Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 11/25] net: fman: memac: Use params instead of priv for max_speed Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 12/25] net: fman: Move initialization to mac-specific files Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 13/25] net: fman: Mark mac methods static Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 14/25] net: fman: Inline several functions into initialization Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 15/25] net: fman: Remove internal_phy_node from params Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 16/25] net: fman: Map the base address once Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 17/25] net: fman: Pass params directly to mac init Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 18/25] net: fman: Use mac_dev for some params Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 19/25] net: fman: Specify type of mac_dev for exception_cb Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 20/25] net: fman: Clean up error handling Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 21/25] net: fman: Change return type of disable to void Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 22/25] net: dpaa: Use mac_dev variable in dpaa_netdev_init Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 23/25] soc: fsl: qbman: Add helper for sanity checking cgr ops Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 24/25] soc: fsl: qbman: Add CGR update function Sean Anderson
2022-08-18 16:16 ` [RESEND PATCH net-next v4 25/25] net: dpaa: Adjust queue depth on rate change Sean Anderson
2022-08-18 18:20 ` [RESEND PATCH net-next v4 00/25] net: dpaa: Cleanups in preparation for phylink conversion Jakub Kicinski
2022-08-18 18:37 ` Sean Anderson
2022-08-18 18:58 ` Jakub Kicinski
2022-08-18 19:14 ` Sean Anderson
2022-08-18 19:28 ` Jakub Kicinski
2022-09-02 21:32 ` Sean Anderson
2022-09-02 21:51 ` Sean Anderson
2022-08-19 23:50 ` patchwork-bot+netdevbpf
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=20220818161649.2058728-7-sean.anderson@seco.com \
--to=sean.anderson@seco.com \
--cc=camelia.groza@nxp.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=linuxppc-dev@lists.ozlabs.org \
--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
all inboxes | Powered by JetHome®