From: Yangbo Lu <yangbo.lu@nxp.com>
To: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Richard Cochran <richardcochran@gmail.com>,
claudiu.manoil@nxp.com, Rob Herring <robh+dt@kernel.org>
Cc: Yangbo Lu <yangbo.lu@nxp.com>
Subject: [PATCH 3/5] net: ethernet: gianfar_ethtool: get phc index through drvdata
Date: Fri, 25 May 2018 12:40:36 +0800 [thread overview]
Message-ID: <20180525044038.37756-3-yangbo.lu@nxp.com> (raw)
In-Reply-To: <20180525044038.37756-1-yangbo.lu@nxp.com>
Global variable gfar_phc_index was used to get and store
phc index through gianfar_ptp driver. However gianfar_ptp
had been renamed as ptp_qoriq for QorIQ common PTP driver.
This gfar_phc_index doesn't work any more, and the phc index
is stored in drvdata now. This patch is to support getting
phc index through ptp_qoriq drvdata.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
drivers/net/ethernet/freescale/gianfar.h | 3 --
drivers/net/ethernet/freescale/gianfar_ethtool.c | 23 +++++++++++++++++----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h
index 5aa8147..8e42c02 100644
--- a/drivers/net/ethernet/freescale/gianfar.h
+++ b/drivers/net/ethernet/freescale/gianfar.h
@@ -1372,7 +1372,4 @@ struct filer_table {
struct gfar_filer_entry fe[MAX_FILER_CACHE_IDX + 20];
};
-/* The gianfar_ptp module will set this variable */
-extern int gfar_phc_index;
-
#endif /* __GIANFAR_H */
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index a93e019..8cb98ca 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -41,6 +41,8 @@
#include <linux/phy.h>
#include <linux/sort.h>
#include <linux/if_vlan.h>
+#include <linux/of_platform.h>
+#include <linux/fsl/ptp_qoriq.h>
#include "gianfar.h"
@@ -1509,24 +1511,35 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
return ret;
}
-int gfar_phc_index = -1;
-EXPORT_SYMBOL(gfar_phc_index);
-
static int gfar_get_ts_info(struct net_device *dev,
struct ethtool_ts_info *info)
{
struct gfar_private *priv = netdev_priv(dev);
+ struct platform_device *ptp_dev;
+ struct device_node *ptp_node;
+ struct qoriq_ptp *ptp = NULL;
+
+ info->phc_index = -1;
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) {
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE;
- info->phc_index = -1;
return 0;
}
+
+ ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp");
+ if (ptp_node) {
+ ptp_dev = of_find_device_by_node(ptp_node);
+ if (ptp_dev)
+ ptp = platform_get_drvdata(ptp_dev);
+ }
+
+ if (ptp)
+ info->phc_index = ptp->phc_index;
+
info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE;
- info->phc_index = gfar_phc_index;
info->tx_types = (1 << HWTSTAMP_TX_OFF) |
(1 << HWTSTAMP_TX_ON);
info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
--
1.7.1
next prev parent reply other threads:[~2018-05-25 4:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 4:40 [PATCH 1/5] ptp: rework gianfar_ptp as QorIQ common PTP driver Yangbo Lu
2018-05-25 4:40 ` [PATCH 2/5] ptp_qoriq: move some definitions to header file Yangbo Lu
2018-05-29 3:05 ` David Miller
2018-05-25 4:40 ` Yangbo Lu [this message]
2018-05-29 3:06 ` [PATCH 3/5] net: ethernet: gianfar_ethtool: get phc index through drvdata David Miller
2018-05-25 4:40 ` [PATCH 4/5] dt-bindings: ptp: add ptp-qoriq.txt Yangbo Lu
2018-05-29 3:06 ` David Miller
2018-05-25 4:40 ` [PATCH 5/5] MAINTAINERS: add myself as maintainer for QorIQ PTP clock driver Yangbo Lu
2018-05-25 4:47 ` Y.b. Lu
2018-05-29 3:06 ` David Miller
2018-05-29 3:57 ` Y.b. Lu
2018-05-28 14:29 ` [PATCH 1/5] ptp: rework gianfar_ptp as QorIQ common PTP driver Richard Cochran
2018-05-29 3:05 ` David Miller
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=20180525044038.37756-3-yangbo.lu@nxp.com \
--to=yangbo.lu@nxp.com \
--cc=claudiu.manoil@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.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).