diff options
author | Reece R. Pollack | 2014-01-17 13:22:35 -0600 |
---|---|---|
committer | Murali Karicheri | 2014-12-03 10:30:04 -0600 |
commit | ab733b9b8fc85818c5cf180a390b37172197d31f (patch) | |
tree | 0d8997aeac6aca3337ed1269a843727531897fe6 /drivers/net/ethernet/ti/keystone_ethss.c | |
parent | c9e8a54563d9995c198b9018db5087ee09a0a24f (diff) | |
download | linux-ab733b9b8fc85818c5cf180a390b37172197d31f.tar.gz linux-ab733b9b8fc85818c5cf180a390b37172197d31f.tar.xz linux-ab733b9b8fc85818c5cf180a390b37172197d31f.zip |
net: keystone: Don't register RX hooks when force_no_hwtstamp specified
The PA RX hook checked for the presence of the "force_no_hwtstamp" option
in the device tree, and immediately exited if present. This patch goes
one step further by not registering the RX hook at all.
This patch also adds the same functionality to the CPSW.
Signed-off-by: Reece R. Pollack <x0183204@ti.com>
Diffstat (limited to 'drivers/net/ethernet/ti/keystone_ethss.c')
-rw-r--r-- | drivers/net/ethernet/ti/keystone_ethss.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/keystone_ethss.c b/drivers/net/ethernet/ti/keystone_ethss.c index 2edbeb277a5..3f61d321364 100644 --- a/drivers/net/ethernet/ti/keystone_ethss.c +++ b/drivers/net/ethernet/ti/keystone_ethss.c | |||
@@ -344,6 +344,7 @@ struct cpsw_priv { | |||
344 | spinlock_t hw_stats_lock; | 344 | spinlock_t hw_stats_lock; |
345 | struct cpts cpts; | 345 | struct cpts cpts; |
346 | int cpts_registered; | 346 | int cpts_registered; |
347 | int force_no_hwtstamp; | ||
347 | }; | 348 | }; |
348 | 349 | ||
349 | struct cpsw_intf { | 350 | struct cpsw_intf { |
@@ -2375,6 +2376,9 @@ int cpsw_ioctl(void *intf_priv, struct ifreq *req, int cmd) | |||
2375 | struct phy_device *phy = slave->phy; | 2376 | struct phy_device *phy = slave->phy; |
2376 | int ret = -EOPNOTSUPP; | 2377 | int ret = -EOPNOTSUPP; |
2377 | 2378 | ||
2379 | if (cpsw_intf->cpsw_priv->force_no_hwtstamp) | ||
2380 | return -EOPNOTSUPP; | ||
2381 | |||
2378 | if (phy) | 2382 | if (phy) |
2379 | ret = phy_mii_ioctl(phy, req, cmd); | 2383 | ret = phy_mii_ioctl(phy, req, cmd); |
2380 | 2384 | ||
@@ -2614,6 +2618,7 @@ static int cpsw_rx_hook(int order, void *data, struct netcp_packet *p_info) | |||
2614 | } | 2618 | } |
2615 | 2619 | ||
2616 | #define CPSW_TXHOOK_ORDER 0 | 2620 | #define CPSW_TXHOOK_ORDER 0 |
2621 | #define CPSW_RXHOOK_ORDER 0 | ||
2617 | 2622 | ||
2618 | static int cpsw_open(void *intf_priv, struct net_device *ndev) | 2623 | static int cpsw_open(void *intf_priv, struct net_device *ndev) |
2619 | { | 2624 | { |
@@ -2706,8 +2711,9 @@ static int cpsw_open(void *intf_priv, struct net_device *ndev) | |||
2706 | netcp_register_txhook(netcp, CPSW_TXHOOK_ORDER, | 2711 | netcp_register_txhook(netcp, CPSW_TXHOOK_ORDER, |
2707 | cpsw_tx_hook, cpsw_intf); | 2712 | cpsw_tx_hook, cpsw_intf); |
2708 | 2713 | ||
2709 | netcp_register_rxhook(netcp, CPSW_TXHOOK_ORDER, | 2714 | if(!cpsw_dev->force_no_hwtstamp) |
2710 | cpsw_rx_hook, cpsw_intf); | 2715 | netcp_register_rxhook(netcp, CPSW_RXHOOK_ORDER, |
2716 | cpsw_rx_hook, cpsw_intf); | ||
2711 | 2717 | ||
2712 | /* Configure the streaming switch */ | 2718 | /* Configure the streaming switch */ |
2713 | #define PSTREAM_ROUTE_DMA 6 | 2719 | #define PSTREAM_ROUTE_DMA 6 |
@@ -2741,6 +2747,10 @@ static int cpsw_close(void *intf_priv, struct net_device *ndev) | |||
2741 | 2747 | ||
2742 | for_each_slave(cpsw_intf, cpsw_slave_stop, cpsw_dev); | 2748 | for_each_slave(cpsw_intf, cpsw_slave_stop, cpsw_dev); |
2743 | 2749 | ||
2750 | if(!cpsw_dev->force_no_hwtstamp) | ||
2751 | netcp_unregister_rxhook(netcp, CPSW_RXHOOK_ORDER, | ||
2752 | cpsw_rx_hook, cpsw_intf); | ||
2753 | |||
2744 | netcp_unregister_txhook(netcp, CPSW_TXHOOK_ORDER, cpsw_tx_hook, | 2754 | netcp_unregister_txhook(netcp, CPSW_TXHOOK_ORDER, cpsw_tx_hook, |
2745 | cpsw_intf); | 2755 | cpsw_intf); |
2746 | netcp_txpipe_close(&cpsw_intf->tx_pipe); | 2756 | netcp_txpipe_close(&cpsw_intf->tx_pipe); |
@@ -3040,6 +3050,11 @@ static int cpsw_probe(struct netcp_device *netcp_device, | |||
3040 | cpsw_dev->intf_tx_queues = 1; | 3050 | cpsw_dev->intf_tx_queues = 1; |
3041 | } | 3051 | } |
3042 | 3052 | ||
3053 | if (of_find_property(node, "force_no_hwtstamp", NULL)) { | ||
3054 | cpsw_dev->force_no_hwtstamp = 1; | ||
3055 | dev_warn(dev, "***** No CPSW or PHY timestamping *****\n"); | ||
3056 | } | ||
3057 | |||
3043 | if (of_find_property(node, "multi-interface", NULL)) | 3058 | if (of_find_property(node, "multi-interface", NULL)) |
3044 | cpsw_dev->multi_if = 1; | 3059 | cpsw_dev->multi_if = 1; |
3045 | 3060 | ||