diff options
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 18 | ||||
-rw-r--r-- | drivers/net/ethernet/xscale/ixp4xx_eth.c | 12 |
6 files changed, 30 insertions, 54 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 00c5be8c55b8..a9e068423ba0 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -13618,16 +13618,9 @@ static int tg3_hwtstamp_ioctl(struct net_device *dev, | |||
13618 | if (stmpconf.flags) | 13618 | if (stmpconf.flags) |
13619 | return -EINVAL; | 13619 | return -EINVAL; |
13620 | 13620 | ||
13621 | switch (stmpconf.tx_type) { | 13621 | if (stmpconf.tx_type != HWTSTAMP_TX_ON && |
13622 | case HWTSTAMP_TX_ON: | 13622 | stmpconf.tx_type != HWTSTAMP_TX_OFF) |
13623 | tg3_flag_set(tp, TX_TSTAMP_EN); | ||
13624 | break; | ||
13625 | case HWTSTAMP_TX_OFF: | ||
13626 | tg3_flag_clear(tp, TX_TSTAMP_EN); | ||
13627 | break; | ||
13628 | default: | ||
13629 | return -ERANGE; | 13623 | return -ERANGE; |
13630 | } | ||
13631 | 13624 | ||
13632 | switch (stmpconf.rx_filter) { | 13625 | switch (stmpconf.rx_filter) { |
13633 | case HWTSTAMP_FILTER_NONE: | 13626 | case HWTSTAMP_FILTER_NONE: |
@@ -13689,6 +13682,11 @@ static int tg3_hwtstamp_ioctl(struct net_device *dev, | |||
13689 | tw32(TG3_RX_PTP_CTL, | 13682 | tw32(TG3_RX_PTP_CTL, |
13690 | tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK); | 13683 | tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK); |
13691 | 13684 | ||
13685 | if (stmpconf.tx_type == HWTSTAMP_TX_ON) | ||
13686 | tg3_flag_set(tp, TX_TSTAMP_EN); | ||
13687 | else | ||
13688 | tg3_flag_clear(tp, TX_TSTAMP_EN); | ||
13689 | |||
13692 | return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ? | 13690 | return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ? |
13693 | -EFAULT : 0; | 13691 | -EFAULT : 0; |
13694 | } | 13692 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 4ef786775acb..f02816575369 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -3482,10 +3482,10 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca) | |||
3482 | * specified. Matching the kind of event packet is not supported, with the | 3482 | * specified. Matching the kind of event packet is not supported, with the |
3483 | * exception of "all V2 events regardless of level 2 or 4". | 3483 | * exception of "all V2 events regardless of level 2 or 4". |
3484 | **/ | 3484 | **/ |
3485 | static int e1000e_config_hwtstamp(struct e1000_adapter *adapter) | 3485 | static int e1000e_config_hwtstamp(struct e1000_adapter *adapter, |
3486 | struct hwtstamp_config *config) | ||
3486 | { | 3487 | { |
3487 | struct e1000_hw *hw = &adapter->hw; | 3488 | struct e1000_hw *hw = &adapter->hw; |
3488 | struct hwtstamp_config *config = &adapter->hwtstamp_config; | ||
3489 | u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; | 3489 | u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; |
3490 | u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; | 3490 | u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; |
3491 | u32 rxmtrl = 0; | 3491 | u32 rxmtrl = 0; |
@@ -3586,6 +3586,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter) | |||
3586 | return -ERANGE; | 3586 | return -ERANGE; |
3587 | } | 3587 | } |
3588 | 3588 | ||
3589 | adapter->hwtstamp_config = *config; | ||
3590 | |||
3589 | /* enable/disable Tx h/w time stamping */ | 3591 | /* enable/disable Tx h/w time stamping */ |
3590 | regval = er32(TSYNCTXCTL); | 3592 | regval = er32(TSYNCTXCTL); |
3591 | regval &= ~E1000_TSYNCTXCTL_ENABLED; | 3593 | regval &= ~E1000_TSYNCTXCTL_ENABLED; |
@@ -3874,7 +3876,7 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
3874 | e1000e_reset_adaptive(hw); | 3876 | e1000e_reset_adaptive(hw); |
3875 | 3877 | ||
3876 | /* initialize systim and reset the ns time counter */ | 3878 | /* initialize systim and reset the ns time counter */ |
3877 | e1000e_config_hwtstamp(adapter); | 3879 | e1000e_config_hwtstamp(adapter, &adapter->hwtstamp_config); |
3878 | 3880 | ||
3879 | /* Set EEE advertisement as appropriate */ | 3881 | /* Set EEE advertisement as appropriate */ |
3880 | if (adapter->flags2 & FLAG2_HAS_EEE) { | 3882 | if (adapter->flags2 & FLAG2_HAS_EEE) { |
@@ -5797,14 +5799,10 @@ static int e1000e_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr) | |||
5797 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) | 5799 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) |
5798 | return -EFAULT; | 5800 | return -EFAULT; |
5799 | 5801 | ||
5800 | adapter->hwtstamp_config = config; | 5802 | ret_val = e1000e_config_hwtstamp(adapter, &config); |
5801 | |||
5802 | ret_val = e1000e_config_hwtstamp(adapter); | ||
5803 | if (ret_val) | 5803 | if (ret_val) |
5804 | return ret_val; | 5804 | return ret_val; |
5805 | 5805 | ||
5806 | config = adapter->hwtstamp_config; | ||
5807 | |||
5808 | switch (config.rx_filter) { | 5806 | switch (config.rx_filter) { |
5809 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: | 5807 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: |
5810 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: | 5808 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 5a0f04c2c813..27ffe0ebf0a6 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -245,16 +245,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
245 | /* Get ieee1588's dev information */ | 245 | /* Get ieee1588's dev information */ |
246 | pdev = adapter->ptp_pdev; | 246 | pdev = adapter->ptp_pdev; |
247 | 247 | ||
248 | switch (cfg.tx_type) { | 248 | if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON) |
249 | case HWTSTAMP_TX_OFF: | ||
250 | adapter->hwts_tx_en = 0; | ||
251 | break; | ||
252 | case HWTSTAMP_TX_ON: | ||
253 | adapter->hwts_tx_en = 1; | ||
254 | break; | ||
255 | default: | ||
256 | return -ERANGE; | 249 | return -ERANGE; |
257 | } | ||
258 | 250 | ||
259 | switch (cfg.rx_filter) { | 251 | switch (cfg.rx_filter) { |
260 | case HWTSTAMP_FILTER_NONE: | 252 | case HWTSTAMP_FILTER_NONE: |
@@ -284,6 +276,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
284 | return -ERANGE; | 276 | return -ERANGE; |
285 | } | 277 | } |
286 | 278 | ||
279 | adapter->hwts_tx_en = cfg.tx_type == HWTSTAMP_TX_ON; | ||
280 | |||
287 | /* Clear out any old time stamps. */ | 281 | /* Clear out any old time stamps. */ |
288 | pch_ch_event_write(pdev, TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED); | 282 | pch_ch_event_write(pdev, TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED); |
289 | 283 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8d4ccd35a016..8a7a23a84ac5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -435,16 +435,9 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
435 | if (config.flags) | 435 | if (config.flags) |
436 | return -EINVAL; | 436 | return -EINVAL; |
437 | 437 | ||
438 | switch (config.tx_type) { | 438 | if (config.tx_type != HWTSTAMP_TX_OFF && |
439 | case HWTSTAMP_TX_OFF: | 439 | config.tx_type != HWTSTAMP_TX_ON) |
440 | priv->hwts_tx_en = 0; | ||
441 | break; | ||
442 | case HWTSTAMP_TX_ON: | ||
443 | priv->hwts_tx_en = 1; | ||
444 | break; | ||
445 | default: | ||
446 | return -ERANGE; | 440 | return -ERANGE; |
447 | } | ||
448 | 441 | ||
449 | if (priv->adv_ts) { | 442 | if (priv->adv_ts) { |
450 | switch (config.rx_filter) { | 443 | switch (config.rx_filter) { |
@@ -576,6 +569,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
576 | } | 569 | } |
577 | } | 570 | } |
578 | priv->hwts_rx_en = ((config.rx_filter == HWTSTAMP_FILTER_NONE) ? 0 : 1); | 571 | priv->hwts_rx_en = ((config.rx_filter == HWTSTAMP_FILTER_NONE) ? 0 : 1); |
572 | priv->hwts_tx_en = config.tx_type == HWTSTAMP_TX_ON; | ||
579 | 573 | ||
580 | if (!priv->hwts_tx_en && !priv->hwts_rx_en) | 574 | if (!priv->hwts_tx_en && !priv->hwts_rx_en) |
581 | priv->hw->ptp->config_hw_tstamping(priv->ioaddr, 0); | 575 | priv->hw->ptp->config_hw_tstamping(priv->ioaddr, 0); |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 90d41d26ec6d..30b0c032e5fc 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1323,6 +1323,10 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1323 | struct cpts *cpts = priv->cpts; | 1323 | struct cpts *cpts = priv->cpts; |
1324 | struct hwtstamp_config cfg; | 1324 | struct hwtstamp_config cfg; |
1325 | 1325 | ||
1326 | if (priv->version != CPSW_VERSION_1 && | ||
1327 | priv->version != CPSW_VERSION_2) | ||
1328 | return -EOPNOTSUPP; | ||
1329 | |||
1326 | if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) | 1330 | if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) |
1327 | return -EFAULT; | 1331 | return -EFAULT; |
1328 | 1332 | ||
@@ -1330,16 +1334,8 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1330 | if (cfg.flags) | 1334 | if (cfg.flags) |
1331 | return -EINVAL; | 1335 | return -EINVAL; |
1332 | 1336 | ||
1333 | switch (cfg.tx_type) { | 1337 | if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON) |
1334 | case HWTSTAMP_TX_OFF: | ||
1335 | cpts->tx_enable = 0; | ||
1336 | break; | ||
1337 | case HWTSTAMP_TX_ON: | ||
1338 | cpts->tx_enable = 1; | ||
1339 | break; | ||
1340 | default: | ||
1341 | return -ERANGE; | 1338 | return -ERANGE; |
1342 | } | ||
1343 | 1339 | ||
1344 | switch (cfg.rx_filter) { | 1340 | switch (cfg.rx_filter) { |
1345 | case HWTSTAMP_FILTER_NONE: | 1341 | case HWTSTAMP_FILTER_NONE: |
@@ -1366,6 +1362,8 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1366 | return -ERANGE; | 1362 | return -ERANGE; |
1367 | } | 1363 | } |
1368 | 1364 | ||
1365 | cpts->tx_enable = cfg.tx_type == HWTSTAMP_TX_ON; | ||
1366 | |||
1369 | switch (priv->version) { | 1367 | switch (priv->version) { |
1370 | case CPSW_VERSION_1: | 1368 | case CPSW_VERSION_1: |
1371 | cpsw_hwtstamp_v1(priv); | 1369 | cpsw_hwtstamp_v1(priv); |
@@ -1374,7 +1372,7 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1374 | cpsw_hwtstamp_v2(priv); | 1372 | cpsw_hwtstamp_v2(priv); |
1375 | break; | 1373 | break; |
1376 | default: | 1374 | default: |
1377 | return -ENOTSUPP; | 1375 | WARN_ON(1); |
1378 | } | 1376 | } |
1379 | 1377 | ||
1380 | return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; | 1378 | return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; |
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index e78802e75ea6..bcc224a83734 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c | |||
@@ -389,16 +389,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
389 | ch = PORT2CHANNEL(port); | 389 | ch = PORT2CHANNEL(port); |
390 | regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; | 390 | regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; |
391 | 391 | ||
392 | switch (cfg.tx_type) { | 392 | if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON) |
393 | case HWTSTAMP_TX_OFF: | ||
394 | port->hwts_tx_en = 0; | ||
395 | break; | ||
396 | case HWTSTAMP_TX_ON: | ||
397 | port->hwts_tx_en = 1; | ||
398 | break; | ||
399 | default: | ||
400 | return -ERANGE; | 393 | return -ERANGE; |
401 | } | ||
402 | 394 | ||
403 | switch (cfg.rx_filter) { | 395 | switch (cfg.rx_filter) { |
404 | case HWTSTAMP_FILTER_NONE: | 396 | case HWTSTAMP_FILTER_NONE: |
@@ -416,6 +408,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
416 | return -ERANGE; | 408 | return -ERANGE; |
417 | } | 409 | } |
418 | 410 | ||
411 | port->hwts_tx_en = cfg.tx_type == HWTSTAMP_TX_ON; | ||
412 | |||
419 | /* Clear out any old time stamps. */ | 413 | /* Clear out any old time stamps. */ |
420 | __raw_writel(TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED, | 414 | __raw_writel(TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED, |
421 | ®s->channel[ch].ch_event); | 415 | ®s->channel[ch].ch_event); |