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 29/35] net: fman: memac: Add serdes support Date: Tue, 28 Jun 2022 18:13:58 -0400 [thread overview] Message-ID: <20220628221404.1444200-30-sean.anderson@seco.com> (raw) In-Reply-To: <20220628221404.1444200-1-sean.anderson@seco.com> This adds support for using a serdes which has to be configured. This is primarly in preparation for the next commit, which will then change the serdes mode dynamically. Signed-off-by: Sean Anderson <sean.anderson@seco.com> --- (no changes since v1) .../net/ethernet/freescale/fman/fman_memac.c | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 02b3a0a2d5d1..a62fe860b1d0 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -13,6 +13,7 @@ #include <linux/io.h> #include <linux/phy.h> #include <linux/phy_fixed.h> +#include <linux/phy/phy.h> #include <linux/of_mdio.h> /* PCS registers */ @@ -324,6 +325,7 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; + struct phy *serdes; struct phy_device *pcsphy; bool allmulti_enabled; }; @@ -1203,17 +1205,55 @@ int memac_initialization(struct mac_device *mac_dev, } } + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); + if (PTR_ERR(memac->serdes) == -ENODEV) { + memac->serdes = NULL; + } else if (IS_ERR(memac->serdes)) { + err = PTR_ERR(memac->serdes); + dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); + goto _return_fm_mac_free; + } else { + err = phy_init(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not initialize serdes\n"); + goto _return_fm_mac_free; + } + + err = phy_power_on(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not power on serdes\n"); + goto _return_phy_exit; + } + + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || + memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII || + memac->phy_if == PHY_INTERFACE_MODE_XGMII) { + err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + memac->phy_if); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not set serdes mode to %s\n", + phy_modes(memac->phy_if)); + goto _return_phy_power_off; + } + } + } + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; err = of_phy_register_fixed_link(mac_node); if (err) - goto _return_fm_mac_free; + goto _return_phy_power_off; fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); if (!fixed_link) { err = -ENOMEM; - goto _return_fm_mac_free; + goto _return_phy_power_off; } mac_dev->phy_node = of_node_get(mac_node); @@ -1242,6 +1282,10 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; +_return_phy_power_off: + phy_power_off(memac->serdes); +_return_phy_exit: + phy_exit(memac->serdes); _return_fixed_link_free: kfree(fixed_link); _return_fm_mac_free: -- 2.35.1.1320.gc452695387.dirty
WARNING: multiple messages have this Message-ID (diff)
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 29/35] net: fman: memac: Add serdes support Date: Tue, 28 Jun 2022 18:13:58 -0400 [thread overview] Message-ID: <20220628221404.1444200-30-sean.anderson@seco.com> (raw) In-Reply-To: <20220628221404.1444200-1-sean.anderson@seco.com> This adds support for using a serdes which has to be configured. This is primarly in preparation for the next commit, which will then change the serdes mode dynamically. Signed-off-by: Sean Anderson <sean.anderson@seco.com> --- (no changes since v1) .../net/ethernet/freescale/fman/fman_memac.c | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 02b3a0a2d5d1..a62fe860b1d0 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -13,6 +13,7 @@ #include <linux/io.h> #include <linux/phy.h> #include <linux/phy_fixed.h> +#include <linux/phy/phy.h> #include <linux/of_mdio.h> /* PCS registers */ @@ -324,6 +325,7 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; + struct phy *serdes; struct phy_device *pcsphy; bool allmulti_enabled; }; @@ -1203,17 +1205,55 @@ int memac_initialization(struct mac_device *mac_dev, } } + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); + if (PTR_ERR(memac->serdes) == -ENODEV) { + memac->serdes = NULL; + } else if (IS_ERR(memac->serdes)) { + err = PTR_ERR(memac->serdes); + dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); + goto _return_fm_mac_free; + } else { + err = phy_init(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not initialize serdes\n"); + goto _return_fm_mac_free; + } + + err = phy_power_on(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not power on serdes\n"); + goto _return_phy_exit; + } + + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || + memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII || + memac->phy_if == PHY_INTERFACE_MODE_XGMII) { + err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + memac->phy_if); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not set serdes mode to %s\n", + phy_modes(memac->phy_if)); + goto _return_phy_power_off; + } + } + } + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; err = of_phy_register_fixed_link(mac_node); if (err) - goto _return_fm_mac_free; + goto _return_phy_power_off; fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); if (!fixed_link) { err = -ENOMEM; - goto _return_fm_mac_free; + goto _return_phy_power_off; } mac_dev->phy_node = of_node_get(mac_node); @@ -1242,6 +1282,10 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; +_return_phy_power_off: + phy_power_off(memac->serdes); +_return_phy_exit: + phy_exit(memac->serdes); _return_fixed_link_free: kfree(fixed_link); _return_fm_mac_free: -- 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:18 UTC|newest] Thread overview: 147+ 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 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-28 22:13 ` [PATCH net-next v2 01/35] dt-bindings: phy: Add QorIQ SerDes binding Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-29 2:09 ` Rob Herring 2022-06-29 2:09 ` Rob Herring 2022-06-29 2:09 ` Rob Herring 2022-06-30 15:53 ` Sean Anderson 2022-06-30 15:53 ` Sean Anderson 2022-06-30 15:53 ` Sean Anderson 2022-06-30 17:27 ` Rob Herring 2022-06-30 17:27 ` Rob Herring 2022-06-30 17:27 ` Rob Herring 2022-06-30 18:01 ` Sean Anderson 2022-06-30 18:01 ` Sean Anderson 2022-06-30 18:01 ` Sean Anderson 2022-06-30 18:08 ` Krzysztof Kozlowski 2022-06-30 18:08 ` Krzysztof Kozlowski 2022-06-30 18:08 ` Krzysztof Kozlowski 2022-06-30 18:16 ` Sean Anderson 2022-06-30 18:16 ` Sean Anderson 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-28 22:13 ` Sean Anderson 2022-06-29 2:09 ` Rob Herring 2022-06-29 2:09 ` Rob Herring 2022-06-29 14:50 ` Russell King (Oracle) 2022-06-29 14:50 ` Russell King (Oracle) 2022-06-30 14:59 ` Sean Anderson 2022-06-30 14:59 ` Sean Anderson 2022-07-01 0:01 ` Rob Herring 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-28 22:13 ` Sean Anderson 2022-06-30 16:01 ` Rob Herring 2022-06-30 16:01 ` Rob Herring 2022-06-30 16:11 ` Sean Anderson 2022-06-30 16:11 ` Sean Anderson 2022-07-12 19:36 ` Rob Herring 2022-07-12 19:36 ` Rob Herring 2022-07-12 19:56 ` Sean Anderson 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-28 22:13 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-30 15:56 ` Ioana Ciornei 2022-06-30 15:56 ` Ioana Ciornei 2022-06-30 15:56 ` Ioana Ciornei 2022-06-30 18:11 ` Sean Anderson 2022-06-30 18:11 ` Sean Anderson 2022-06-30 18:11 ` Sean Anderson 2022-07-01 10:03 ` Ioana Ciornei 2022-07-01 10:03 ` Ioana Ciornei 2022-07-01 10:03 ` Ioana Ciornei 2022-07-01 15:51 ` Sean Anderson 2022-07-01 15:51 ` Sean Anderson 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-01 21:04 ` Sean Anderson 2022-07-01 21:04 ` Sean Anderson 2022-07-05 6:12 ` Vinod Koul 2022-07-05 6:12 ` Vinod Koul 2022-07-05 6:12 ` Vinod Koul 2022-07-05 15:29 ` Sean Anderson 2022-07-05 15:29 ` Sean Anderson 2022-07-05 15:29 ` Sean Anderson 2022-07-06 16:57 ` Vinod Koul 2022-07-06 16:57 ` Vinod Koul 2022-07-06 16:57 ` Vinod Koul 2022-07-07 15:00 ` Sean Anderson 2022-07-07 15:00 ` Sean Anderson 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 ` 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 ` 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 ` 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 2022-06-28 22:13 ` [PATCH net-next v2 09/35] net: fman: Get PCS node in per-mac init Sean Anderson 2022-06-28 22:13 ` Sean Anderson 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` 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 ` Sean Anderson 2022-06-28 22:13 ` 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 ` Sean Anderson 2022-06-28 22:13 ` 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 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson 2022-06-28 22:13 ` Sean Anderson [this message] 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:13 ` Sean Anderson 2022-06-28 22:14 ` [PATCH net-next v2 31/35] [RFT] net: dpaa: Convert to phylink Sean Anderson 2022-06-28 22:14 ` Sean Anderson 2022-06-29 14:44 ` Russell King (Oracle) 2022-06-29 14:44 ` Russell King (Oracle) 2022-06-30 15:56 ` Sean Anderson 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 ` Sean Anderson 2022-06-28 22:14 ` 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 ` Sean Anderson 2022-06-28 22:14 ` 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 ` Sean Anderson 2022-06-28 22:14 ` [PATCH net-next v2 35/35] arm64: dts: ls1046ardb: " Sean Anderson 2022-06-28 22:14 ` Sean Anderson 2022-06-28 22:14 ` 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-30-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: linkBe 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.