Commit 7349a74e authored by Yangbo Lu's avatar Yangbo Lu Committed by David S. Miller

net: ethernet: gianfar_ethtool: get phc index through drvdata

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: default avatarYangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c50c1ed
...@@ -1372,7 +1372,4 @@ struct filer_table { ...@@ -1372,7 +1372,4 @@ struct filer_table {
struct gfar_filer_entry fe[MAX_FILER_CACHE_IDX + 20]; 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 */ #endif /* __GIANFAR_H */
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/sort.h> #include <linux/sort.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/of_platform.h>
#include <linux/fsl/ptp_qoriq.h>
#include "gianfar.h" #include "gianfar.h"
...@@ -1509,24 +1511,35 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, ...@@ -1509,24 +1511,35 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
return ret; return ret;
} }
int gfar_phc_index = -1;
EXPORT_SYMBOL(gfar_phc_index);
static int gfar_get_ts_info(struct net_device *dev, static int gfar_get_ts_info(struct net_device *dev,
struct ethtool_ts_info *info) struct ethtool_ts_info *info)
{ {
struct gfar_private *priv = netdev_priv(dev); 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)) { if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) {
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE; SOF_TIMESTAMPING_SOFTWARE;
info->phc_index = -1;
return 0; 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 | info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE; SOF_TIMESTAMPING_RAW_HARDWARE;
info->phc_index = gfar_phc_index;
info->tx_types = (1 << HWTSTAMP_TX_OFF) | info->tx_types = (1 << HWTSTAMP_TX_OFF) |
(1 << HWTSTAMP_TX_ON); (1 << HWTSTAMP_TX_ON);
info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment