* [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4
@ 2016-10-12 13:42 Giuseppe Cavallaro
2016-10-12 13:42 ` [PATCH (net.git) 2/2] stmmac: fix error check when init ptp Giuseppe Cavallaro
2016-10-13 15:01 ` [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Giuseppe Cavallaro @ 2016-10-12 13:42 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, Giuseppe Cavallaro, Alexandre TORGUE,
Rayagond Kokatanur
The gmac 4.x version has not extended descriptors
(that are available on 3.x instead of).
While initializing the PTP module, the advanced PTP was
enabled in case of extended descriptors. This cannot be
applied for 4.x version where only the hardware capability
register has to show if the feature is present.
Patch also adds some extra netdev_(debug/inof) to better
dump the configuration.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Cc: Rayagond Kokatanur <rayagond@vayavyalabs.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4c8c60a..e838850 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -650,20 +650,27 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
if (IS_ERR(priv->clk_ptp_ref)) {
priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk);
priv->clk_ptp_ref = NULL;
+ netdev_dbg(priv->dev, "PTP uses main clock\n");
} else {
clk_prepare_enable(priv->clk_ptp_ref);
priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref);
+ netdev_dbg(priv->dev, "PTP rate %d\n", priv->clk_ptp_rate);
}
priv->adv_ts = 0;
- if (priv->dma_cap.atime_stamp && priv->extend_desc)
+ /* Check if adv_ts can be enabled for dwmac 4.x core */
+ if (priv->plat->has_gmac4 && priv->dma_cap.atime_stamp)
+ priv->adv_ts = 1;
+ /* Dwmac 3.x core with extend_desc can support adv_ts */
+ else if (priv->extend_desc && priv->dma_cap.atime_stamp)
priv->adv_ts = 1;
- if (netif_msg_hw(priv) && priv->dma_cap.time_stamp)
- pr_debug("IEEE 1588-2002 Time Stamp supported\n");
+ if (priv->dma_cap.time_stamp)
+ netdev_info(priv->dev, "IEEE 1588-2002 Timestamp supported\n");
- if (netif_msg_hw(priv) && priv->adv_ts)
- pr_debug("IEEE 1588-2008 Advanced Time Stamp supported\n");
+ if (priv->adv_ts)
+ netdev_info(priv->dev,
+ "IEEE 1588-2008 Advanced Timestamp supported\n");
priv->hw->ptp = &stmmac_ptp;
priv->hwts_tx_en = 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH (net.git) 2/2] stmmac: fix error check when init ptp
2016-10-12 13:42 [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 Giuseppe Cavallaro
@ 2016-10-12 13:42 ` Giuseppe Cavallaro
2016-10-13 15:01 ` David Miller
2016-10-13 15:01 ` [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Giuseppe Cavallaro @ 2016-10-12 13:42 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, Giuseppe Cavallaro, Alexandre TORGUE,
Rayagond Kokatanur
This patch fixes a problem when propagated the
failure of ptp_clock_register to open function.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Cc: Rayagond Kokatanur <rayagond@vayavyalabs.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 10 ++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e838850..6c85b61 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1709,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
if (init_ptp) {
ret = stmmac_init_ptp(priv);
- if (ret && ret != -EOPNOTSUPP)
- pr_warn("%s: failed PTP initialisation\n", __func__);
+ if (ret)
+ netdev_warn(priv->dev, "PTP support cannot init.\n");
}
#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 6e3b829..289d527 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
priv->device);
if (IS_ERR(priv->ptp_clock)) {
priv->ptp_clock = NULL;
- pr_err("ptp_clock_register() failed on %s\n", priv->dev->name);
- } else if (priv->ptp_clock)
- pr_debug("Added PTP HW clock successfully on %s\n",
- priv->dev->name);
+ return PTR_ERR(priv->ptp_clock);
+ }
+
+ spin_lock_init(&priv->ptp_lock);
+
+ netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4
2016-10-12 13:42 [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 Giuseppe Cavallaro
2016-10-12 13:42 ` [PATCH (net.git) 2/2] stmmac: fix error check when init ptp Giuseppe Cavallaro
@ 2016-10-13 15:01 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-10-13 15:01 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-kernel, alexandre.torgue, rayagond
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Wed, 12 Oct 2016 15:42:03 +0200
> The gmac 4.x version has not extended descriptors
> (that are available on 3.x instead of).
> While initializing the PTP module, the advanced PTP was
> enabled in case of extended descriptors. This cannot be
> applied for 4.x version where only the hardware capability
> register has to show if the feature is present.
> Patch also adds some extra netdev_(debug/inof) to better
> dump the configuration.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH (net.git) 2/2] stmmac: fix error check when init ptp
2016-10-12 13:42 ` [PATCH (net.git) 2/2] stmmac: fix error check when init ptp Giuseppe Cavallaro
@ 2016-10-13 15:01 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-10-13 15:01 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-kernel, alexandre.torgue, rayagond
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Wed, 12 Oct 2016 15:42:04 +0200
> This patch fixes a problem when propagated the
> failure of ptp_clock_register to open function.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-13 15:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 13:42 [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 Giuseppe Cavallaro
2016-10-12 13:42 ` [PATCH (net.git) 2/2] stmmac: fix error check when init ptp Giuseppe Cavallaro
2016-10-13 15:01 ` David Miller
2016-10-13 15:01 ` [PATCH (net.git) 1/2] stmmac: fix ptp init for gmac4 David Miller
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).