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: Madalin Bucur <madalin.bucur@nxp.com>,
Sean Anderson <sean.anderson@seco.com>,
open list <linux-kernel@vger.kernel.org>,
Camelia Groza <camelia.groza@nxp.com>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next v5 04/14] net: fman: Remove internal_phy_node from params
Date: Fri, 2 Sep 2022 17:57:26 -0400 [thread overview]
Message-ID: <20220902215737.981341-5-sean.anderson@seco.com> (raw)
In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com>
This member was used to pass the phy node between mac_probe and the
mac-specific initialization function. But now that the phy node is
gotten in the initialization function, this parameter does not serve a
purpose. Remove it, and do the grabbing of the node/grabbing of the phy
in the same place.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
---
(no changes since v1)
.../net/ethernet/freescale/fman/fman_dtsec.c | 33 +++++++++---------
.../net/ethernet/freescale/fman/fman_mac.h | 2 --
.../net/ethernet/freescale/fman/fman_memac.c | 34 +++++++++----------
3 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
index 84205be3a817..c2c4677451a9 100644
--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
+++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
@@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
dtsec->fm = params->fm;
dtsec->basex_if = params->basex_if;
- if (!params->internal_phy_node) {
- pr_err("TBI PHY node is not available\n");
- goto err_dtsec_drv_param;
- }
-
- dtsec->tbiphy = of_phy_find_device(params->internal_phy_node);
- if (!dtsec->tbiphy) {
- pr_err("of_phy_find_device (TBI PHY) failed\n");
- goto err_dtsec_drv_param;
- }
-
- put_device(&dtsec->tbiphy->mdio.dev);
-
/* Save FMan revision */
fman_get_revision(dtsec->fm, &dtsec->fm_rev_info);
return dtsec;
-err_dtsec_drv_param:
- kfree(dtsec_drv_param);
err_dtsec:
kfree(dtsec);
return NULL;
@@ -1494,6 +1479,7 @@ int dtsec_initialization(struct mac_device *mac_dev,
int err;
struct fman_mac_params params;
struct fman_mac *dtsec;
+ struct device_node *phy_node;
mac_dev->set_promisc = dtsec_set_promiscuous;
mac_dev->change_addr = dtsec_modify_mac_address;
@@ -1512,7 +1498,6 @@ 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) {
@@ -1523,6 +1508,22 @@ int dtsec_initialization(struct mac_device *mac_dev,
dtsec = mac_dev->fman_mac;
dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm();
dtsec->dtsec_drv_param->tx_pad_crc = true;
+
+ phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
+ if (!phy_node) {
+ pr_err("TBI PHY node is not available\n");
+ err = -EINVAL;
+ goto _return_fm_mac_free;
+ }
+
+ dtsec->tbiphy = of_phy_find_device(phy_node);
+ if (!dtsec->tbiphy) {
+ pr_err("of_phy_find_device (TBI PHY) failed\n");
+ err = -EINVAL;
+ goto _return_fm_mac_free;
+ }
+ put_device(&dtsec->tbiphy->mdio.dev);
+
err = dtsec_init(dtsec);
if (err < 0)
goto _return_fm_mac_free;
diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h
index 418d1de85702..7774af6463e5 100644
--- a/drivers/net/ethernet/freescale/fman/fman_mac.h
+++ b/drivers/net/ethernet/freescale/fman/fman_mac.h
@@ -190,8 +190,6 @@ struct fman_mac_params {
* synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps
*/
bool basex_if;
- /* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */
- struct device_node *internal_phy_node;
};
struct eth_hash_t {
diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
index e5d75597463a..19c2d657c41a 100644
--- a/drivers/net/ethernet/freescale/fman/fman_memac.c
+++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
@@ -1150,22 +1150,6 @@ static struct fman_mac *memac_config(struct fman_mac_params *params)
/* Save FMan revision */
fman_get_revision(memac->fm, &memac->fm_rev_info);
- if (memac->phy_if == PHY_INTERFACE_MODE_SGMII ||
- memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
- if (!params->internal_phy_node) {
- pr_err("PCS PHY node is not available\n");
- memac_free(memac);
- return NULL;
- }
-
- memac->pcsphy = of_phy_find_device(params->internal_phy_node);
- if (!memac->pcsphy) {
- pr_err("of_phy_find_device (PCS PHY) failed\n");
- memac_free(memac);
- return NULL;
- }
- }
-
return memac;
}
@@ -1173,6 +1157,7 @@ int memac_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
{
int err;
+ struct device_node *phy_node;
struct fman_mac_params params;
struct fixed_phy_status *fixed_link;
struct fman_mac *memac;
@@ -1194,7 +1179,6 @@ 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 (params.max_speed == SPEED_10000)
params.phy_if = PHY_INTERFACE_MODE_XGMII;
@@ -1208,6 +1192,22 @@ int memac_initialization(struct mac_device *mac_dev,
memac = mac_dev->fman_mac;
memac->memac_drv_param->max_frame_length = fman_get_max_frm();
memac->memac_drv_param->reset_on_init = true;
+ if (memac->phy_if == PHY_INTERFACE_MODE_SGMII ||
+ memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
+ phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
+ if (!phy_node) {
+ pr_err("PCS PHY node is not available\n");
+ err = -EINVAL;
+ goto _return_fm_mac_free;
+ }
+
+ memac->pcsphy = of_phy_find_device(phy_node);
+ if (!memac->pcsphy) {
+ pr_err("of_phy_find_device (PCS PHY) failed\n");
+ err = -EINVAL;
+ goto _return_fm_mac_free;
+ }
+ }
if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
struct phy_device *phy;
--
2.35.1.1320.gc452695387.dirty
next prev parent reply other threads:[~2022-09-02 22:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 21:57 [PATCH net-next v5 00/14] net: dpaa: Cleanups in preparation for phylink conversion (part 2) Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 01/14] net: fman: Move initialization to mac-specific files Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 02/14] net: fman: Mark mac methods static Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 03/14] net: fman: Inline several functions into initialization Sean Anderson
2022-09-02 21:57 ` Sean Anderson [this message]
2022-09-02 21:57 ` [PATCH net-next v5 05/14] net: fman: Map the base address once Sean Anderson
2022-10-17 15:15 ` Geert Uytterhoeven
2022-10-17 15:34 ` Sean Anderson
2022-10-17 15:49 ` Geert Uytterhoeven
2022-09-02 21:57 ` [PATCH net-next v5 06/14] net: fman: Pass params directly to mac init Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 07/14] net: fman: Use mac_dev for some params Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 08/14] net: fman: Specify type of mac_dev for exception_cb Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 09/14] net: fman: Clean up error handling Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 10/14] net: fman: Change return type of disable to void Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 11/14] net: dpaa: Use mac_dev variable in dpaa_netdev_init Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 12/14] soc: fsl: qbman: Add helper for sanity checking cgr ops Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 13/14] soc: fsl: qbman: Add CGR update function Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 14/14] net: dpaa: Adjust queue depth on rate change Sean Anderson
2022-09-05 13:40 ` [PATCH net-next v5 00/14] net: dpaa: Cleanups in preparation for phylink conversion (part 2) 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=20220902215737.981341-5-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;
as well as URLs for NNTP newsgroup(s).