From: Harini Katakam <harini.katakam@xilinx.com>
To: <nicolas.ferre@microchip.com>, <davem@davemloft.net>,
<claudiu.beznea@microchip.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<michal.simek@xilinx.com>, <harinikatakamlinux@gmail.com>,
<harini.katakam@xilinx.com>, Harini Katakam <harinik@xilinx.com>
Subject: [PATCH v2 2/4] net: macb: Support clock management for tsu_clk
Date: Mon, 26 Nov 2018 12:37:50 +0530 [thread overview]
Message-ID: <1543216072-9623-3-git-send-email-harini.katakam@xilinx.com> (raw)
In-Reply-To: <1543216072-9623-1-git-send-email-harini.katakam@xilinx.com>
From: Harini Katakam <harinik@xilinx.com>
TSU clock needs to be enabled/disabled as per support in devicetree
and it should also be controlled during suspend/resume (WOL has no
dependency on this clock).
Signed-off-by: Harini Katakam <harinik@xilinx.com>
---
v2:
No changes
drivers/net/ethernet/cadence/macb.h | 3 ++-
drivers/net/ethernet/cadence/macb_main.c | 30 +++++++++++++++++++++++++-----
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index df7bee1..e0fddff 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1085,7 +1085,7 @@ struct macb_config {
unsigned int dma_burst_length;
int (*clk_init)(struct platform_device *pdev, struct clk **pclk,
struct clk **hclk, struct clk **tx_clk,
- struct clk **rx_clk);
+ struct clk **rx_clk, struct clk **tsu_clk);
int (*init)(struct platform_device *pdev);
int jumbo_max_len;
};
@@ -1165,6 +1165,7 @@ struct macb {
struct clk *hclk;
struct clk *tx_clk;
struct clk *rx_clk;
+ struct clk *tsu_clk;
struct net_device *dev;
union {
struct macb_stats macb;
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index fd86ece..32453d4 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3293,7 +3293,7 @@ static void macb_probe_queues(void __iomem *mem,
static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
struct clk **hclk, struct clk **tx_clk,
- struct clk **rx_clk)
+ struct clk **rx_clk, struct clk **tsu_clk)
{
struct macb_platform_data *pdata;
int err;
@@ -3327,6 +3327,10 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
if (IS_ERR(*rx_clk))
*rx_clk = NULL;
+ *tsu_clk = devm_clk_get(&pdev->dev, "tsu_clk");
+ if (IS_ERR(*tsu_clk))
+ *tsu_clk = NULL;
+
err = clk_prepare_enable(*pclk);
if (err) {
dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
@@ -3351,8 +3355,17 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
goto err_disable_txclk;
}
+ err = clk_prepare_enable(*tsu_clk);
+ if (err) {
+ dev_err(&pdev->dev, "failed to enable tsu_clk (%u)\n", err);
+ goto err_disable_rxclk;
+ }
+
return 0;
+err_disable_rxclk:
+ clk_disable_unprepare(*rx_clk);
+
err_disable_txclk:
clk_disable_unprepare(*tx_clk);
@@ -3803,13 +3816,14 @@ static const struct net_device_ops at91ether_netdev_ops = {
static int at91ether_clk_init(struct platform_device *pdev, struct clk **pclk,
struct clk **hclk, struct clk **tx_clk,
- struct clk **rx_clk)
+ struct clk **rx_clk, struct clk **tsu_clk)
{
int err;
*hclk = NULL;
*tx_clk = NULL;
*rx_clk = NULL;
+ *tsu_clk = NULL;
*pclk = devm_clk_get(&pdev->dev, "ether_clk");
if (IS_ERR(*pclk))
@@ -3957,11 +3971,12 @@ static int macb_probe(struct platform_device *pdev)
{
const struct macb_config *macb_config = &default_gem_config;
int (*clk_init)(struct platform_device *, struct clk **,
- struct clk **, struct clk **, struct clk **)
- = macb_config->clk_init;
+ struct clk **, struct clk **, struct clk **,
+ struct clk **) = macb_config->clk_init;
int (*init)(struct platform_device *) = macb_config->init;
struct device_node *np = pdev->dev.of_node;
struct clk *pclk, *hclk = NULL, *tx_clk = NULL, *rx_clk = NULL;
+ struct clk *tsu_clk = NULL;
unsigned int queue_mask, num_queues;
struct macb_platform_data *pdata;
bool native_io;
@@ -3989,7 +4004,7 @@ static int macb_probe(struct platform_device *pdev)
}
}
- err = clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk);
+ err = clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk);
if (err)
return err;
@@ -4026,6 +4041,7 @@ static int macb_probe(struct platform_device *pdev)
bp->hclk = hclk;
bp->tx_clk = tx_clk;
bp->rx_clk = rx_clk;
+ bp->tsu_clk = tsu_clk;
if (macb_config)
bp->jumbo_max_len = macb_config->jumbo_max_len;
@@ -4141,6 +4157,7 @@ static int macb_probe(struct platform_device *pdev)
clk_disable_unprepare(hclk);
clk_disable_unprepare(pclk);
clk_disable_unprepare(rx_clk);
+ clk_disable_unprepare(tsu_clk);
return err;
}
@@ -4168,6 +4185,7 @@ static int macb_remove(struct platform_device *pdev)
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
clk_disable_unprepare(bp->rx_clk);
+ clk_disable_unprepare(bp->tsu_clk);
of_node_put(bp->phy_node);
free_netdev(dev);
}
@@ -4193,6 +4211,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
clk_disable_unprepare(bp->pclk);
clk_disable_unprepare(bp->rx_clk);
}
+ clk_disable_unprepare(bp->tsu_clk);
return 0;
}
@@ -4212,6 +4231,7 @@ static int __maybe_unused macb_resume(struct device *dev)
clk_prepare_enable(bp->tx_clk);
clk_prepare_enable(bp->rx_clk);
}
+ clk_prepare_enable(bp->tsu_clk);
netif_device_attach(netdev);
--
2.7.4
next prev parent reply other threads:[~2018-11-26 7:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 7:07 [PATCH v2 0/4] Macb power management support for ZynqMP Harini Katakam
2018-11-26 7:07 ` [PATCH v2 1/4] net: macb: Check MDIO state before read/write and use timeouts Harini Katakam
2018-11-26 14:39 ` Andrew Lunn
2018-11-27 5:38 ` Harini Katakam
2018-11-26 14:46 ` Claudiu.Beznea
2018-11-26 14:52 ` Andrew Lunn
2018-11-27 5:36 ` Harini Katakam
2018-11-27 10:25 ` Claudiu.Beznea
2018-11-27 10:49 ` Harini Katakam
2018-11-28 0:35 ` Andrew Lunn
2018-11-29 10:21 ` Claudiu.Beznea
2018-11-26 7:07 ` Harini Katakam [this message]
2018-11-26 7:07 ` [PATCH v2 3/4] net: macb: Add pm runtime support Harini Katakam
2018-11-26 14:47 ` Andrew Lunn
2018-11-26 14:47 ` Claudiu.Beznea
2018-11-26 7:07 ` [PATCH v2 4/4] net: macb: Add support for suspend/resume with full power down Harini Katakam
2018-11-26 14:46 ` Claudiu.Beznea
2018-11-27 6:25 ` Harini Katakam
2018-11-27 10:31 ` Claudiu.Beznea
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=1543216072-9623-3-git-send-email-harini.katakam@xilinx.com \
--to=harini.katakam@xilinx.com \
--cc=claudiu.beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=harinik@xilinx.com \
--cc=harinikatakamlinux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.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).