From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Rob Herring <robh+dt@kernel.org>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Johan Hovold <johan@kernel.org>,
Maxime Ripard <mripard@kernel.org>,
Joao Pinto <jpinto@synopsys.com>, Lars Persson <larper@axis.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
Serge Semin <fancer.lancer@gmail.com>,
Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
Vyacheslav Mitrofanov
<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
<netdev@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 20/24] net: stmmac: dwc-qos: Discard Tx/Rx clocks request
Date: Mon, 8 Feb 2021 16:56:04 +0300 [thread overview]
Message-ID: <20210208135609.7685-21-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru>
Since the Tx/Rx clocks with the same names are now requested and
enabled/disabled in the STMMAC DT-based platform config method, there is
no need in duplicating the same procedures in the DWC QoS Eth sub-driver.
Discard it then, but make sure the denoted clocks have been specified
for the platform.
Note also the deprecated clock "phy_ref_clk" have been defined as the Tx
clock in the DWC QoS Eth bindings. Let's use a pointer to the Tx clock
defined in the platform data then instead of the unrelated pclk pointer.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
---
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 44 +++++--------------
1 file changed, 11 insertions(+), 33 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index b71f0c3faebe..f315ca395e12 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -31,8 +31,6 @@ struct tegra_eqos {
struct reset_control *rst;
struct clk *clk_master;
struct clk *clk_slave;
- struct clk *clk_tx;
- struct clk *clk_rx;
struct gpio_desc *reset;
};
@@ -155,7 +153,7 @@ static int dwc_qos_probe(struct platform_device *pdev,
goto disable;
}
- plat_dat->pclk = clk;
+ plat_dat->tx_clk = clk;
return 0;
@@ -175,8 +173,8 @@ static int dwc_qos_remove(struct platform_device *pdev)
* data so the stmmac_remove_config_dt() method wouldn't have disabled
* the clocks too.
*/
- clk_disable_unprepare(priv->plat->pclk);
- priv->plat->pclk = NULL;
+ clk_disable_unprepare(priv->plat->tx_clk);
+ priv->plat->tx_clk = NULL;
clk_disable_unprepare(priv->plat->stmmac_clk);
priv->plat->stmmac_clk = NULL;
@@ -197,6 +195,7 @@ static int dwc_qos_remove(struct platform_device *pdev)
static void tegra_eqos_fix_speed(void *priv, unsigned int speed)
{
struct tegra_eqos *eqos = priv;
+ struct stmmac_priv *sp = netdev_priv(dev_get_drvdata(eqos->dev));
unsigned long rate = 125000000;
bool needs_calibration = false;
u32 value;
@@ -262,7 +261,7 @@ static void tegra_eqos_fix_speed(void *priv, unsigned int speed)
writel(value, eqos->regs + AUTO_CAL_CONFIG);
}
- err = clk_set_rate(eqos->clk_tx, rate);
+ err = clk_set_rate(sp->plat->tx_clk, rate);
if (err < 0)
dev_err(eqos->dev, "failed to set TX rate: %d\n", err);
}
@@ -299,6 +298,11 @@ static int tegra_eqos_probe(struct platform_device *pdev,
if (!is_of_node(dev->fwnode))
goto bypass_clk_reset_gpio;
+ if (!data->tx_clk || !data->rx_clk) {
+ err = -EINVAL;
+ goto error;
+ }
+
eqos->clk_master = devm_clk_get(&pdev->dev, "master_bus");
if (IS_ERR(eqos->clk_master)) {
err = PTR_ERR(eqos->clk_master);
@@ -321,30 +325,10 @@ static int tegra_eqos_probe(struct platform_device *pdev,
data->stmmac_clk = eqos->clk_slave;
- eqos->clk_rx = devm_clk_get(&pdev->dev, "rx");
- if (IS_ERR(eqos->clk_rx)) {
- err = PTR_ERR(eqos->clk_rx);
- goto disable_slave;
- }
-
- err = clk_prepare_enable(eqos->clk_rx);
- if (err < 0)
- goto disable_slave;
-
- eqos->clk_tx = devm_clk_get(&pdev->dev, "tx");
- if (IS_ERR(eqos->clk_tx)) {
- err = PTR_ERR(eqos->clk_tx);
- goto disable_rx;
- }
-
- err = clk_prepare_enable(eqos->clk_tx);
- if (err < 0)
- goto disable_rx;
-
eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH);
if (IS_ERR(eqos->reset)) {
err = PTR_ERR(eqos->reset);
- goto disable_tx;
+ goto disable_slave;
}
usleep_range(2000, 4000);
@@ -385,10 +369,6 @@ static int tegra_eqos_probe(struct platform_device *pdev,
reset_control_assert(eqos->rst);
reset_phy:
gpiod_set_value(eqos->reset, 1);
-disable_tx:
- clk_disable_unprepare(eqos->clk_tx);
-disable_rx:
- clk_disable_unprepare(eqos->clk_rx);
disable_slave:
clk_disable_unprepare(eqos->clk_slave);
data->stmmac_clk = NULL;
@@ -405,8 +385,6 @@ static int tegra_eqos_remove(struct platform_device *pdev)
reset_control_assert(eqos->rst);
gpiod_set_value(eqos->reset, 1);
- clk_disable_unprepare(eqos->clk_tx);
- clk_disable_unprepare(eqos->clk_rx);
clk_disable_unprepare(eqos->clk_slave);
clk_disable_unprepare(eqos->clk_master);
--
2.29.2
next prev parent reply other threads:[~2021-02-08 14:17 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 13:55 [PATCH v2 00/24] net: stmmac: Fix clocks/reset-related procedures Serge Semin
2021-02-08 13:55 ` [PATCH v2 01/24] dt-bindings: net: dwmac: Validate PBL for all IP-cores Serge Semin
2021-02-08 13:55 ` [PATCH v2 02/24] dt-bindings: net: dwmac: Extend number of PBL values Serge Semin
2021-02-08 13:55 ` [PATCH v2 03/24] dt-bindings: net: dwmac: Fix the TSO property declaration Serge Semin
2021-02-09 21:54 ` Rob Herring
2021-02-08 13:55 ` [PATCH v2 04/24] dt-bindings: net: dwmac: Refactor snps,*-config properties Serge Semin
2021-02-09 22:26 ` Rob Herring
2021-02-10 21:57 ` Serge Semin
2021-02-18 15:55 ` Serge Semin
2021-02-08 13:55 ` [PATCH v2 05/24] dt-bindings: net: dwmac: Elaborate stmmaceth/pclk description Serge Semin
2021-02-08 13:55 ` [PATCH v2 06/24] dt-bindings: net: dwmac: Add Tx/Rx clock sources Serge Semin
2021-02-08 13:55 ` [PATCH v2 07/24] dt-bindings: net: dwmac: Detach Generic DW MAC bindings Serge Semin
2021-02-09 22:32 ` Rob Herring
2021-02-10 22:05 ` Serge Semin
2021-02-08 13:55 ` [PATCH v2 08/24] net: stmmac: Add {axi,mtl-rx,mtl-tx}-config sub-nodes support Serge Semin
2021-02-08 13:55 ` [PATCH v2 09/24] net: stmmac: dwmac-rk: Cleanup STMMAC DT-config in remove cb Serge Semin
2021-02-08 13:55 ` [PATCH v2 10/24] net: stmmac: dwmac-sti: " Serge Semin
2021-02-08 13:55 ` [PATCH v2 11/24] net: stmmac: dwmac-stm32: " Serge Semin
2021-02-08 13:55 ` [PATCH v2 12/24] net: stmmac: Directly call reverse methods in stmmac_probe_config_dt() Serge Semin
2021-02-08 13:55 ` [PATCH v2 13/24] net: stmmac: Fix clocks left enabled on glue-probes failure Serge Semin
2021-02-08 13:55 ` [PATCH v2 14/24] net: stmmac: Use optional clock request method to get stmmaceth Serge Semin
2021-02-08 13:55 ` [PATCH v2 15/24] net: stmmac: Use optional clock request method to get ptp_clk Serge Semin
2021-02-08 13:56 ` [PATCH v2 16/24] net: stmmac: Use optional reset control API to work with stmmaceth Serge Semin
2021-02-10 6:49 ` Jisheng Zhang
2021-02-10 22:14 ` Serge Semin
2021-02-08 13:56 ` [PATCH v2 17/24] net: stmmac: dwc-qos: Cleanup STMMAC platform data clock pointers Serge Semin
2021-02-08 13:56 ` [PATCH v2 18/24] net: stmmac: dwc-qos: Use dev_err_probe() for probe errors handling Serge Semin
2021-02-08 13:56 ` [PATCH v2 19/24] net: stmmac: Add Tx/Rx platform clocks support Serge Semin
2021-02-08 13:56 ` Serge Semin [this message]
2021-02-08 13:56 ` [PATCH v2 21/24] net: stmmac: dwmac-imx: Discard Tx clock request Serge Semin
2021-02-08 13:56 ` [PATCH v2 22/24] net: stmmac: Call stmmaceth clock as system clock in warn-message Serge Semin
2021-02-08 13:56 ` [PATCH v2 23/24] net: stmmac: Use pclk to set MDC clock frequency Serge Semin
2021-02-08 13:56 ` [PATCH v2 24/24] net: stmmac: dwc-qos: Save master/slave clocks in the plat-data Serge Semin
2021-02-08 19:05 ` [PATCH v2 00/24] net: stmmac: Fix clocks/reset-related procedures Jakub Kicinski
2021-02-09 10:59 ` Serge Semin
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=20210208135609.7685-21-Sergey.Semin@baikalelectronics.ru \
--to=sergey.semin@baikalelectronics.ru \
--cc=Alexey.Malahov@baikalelectronics.ru \
--cc=Pavel.Parkhomenko@baikalelectronics.ru \
--cc=Vyacheslav.Mitrofanov@baikalelectronics.ru \
--cc=alexandre.torgue@st.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=joabreu@synopsys.com \
--cc=johan@kernel.org \
--cc=jpinto@synopsys.com \
--cc=kuba@kernel.org \
--cc=larper@axis.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mripard@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=robh+dt@kernel.org \
/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).