diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-18 17:54:03 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-21 12:17:15 -0500 |
commit | 7575c917cf29824b71c4dff8274fe39fc32bc173 (patch) | |
tree | 11c4cd2b73bb791012c28fde4c4c0c4ddf4581a5 /drivers/net/ethernet/adi | |
parent | 433dc9b3d123e72a0f5988c1f0d1c9319a735276 (diff) |
bfin_mac: Implement the SIOCGHWTSTAMP ioctl
Compile-tested only (thanks to the kbuild test robot).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/adi')
-rw-r--r-- | drivers/net/ethernet/adi/bfin_mac.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c index 75fb1d20d6fd..0d4f29579879 100644 --- a/drivers/net/ethernet/adi/bfin_mac.c +++ b/drivers/net/ethernet/adi/bfin_mac.c | |||
@@ -667,8 +667,8 @@ static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result) | |||
667 | return 1000000000UL / ppn; | 667 | return 1000000000UL / ppn; |
668 | } | 668 | } |
669 | 669 | ||
670 | static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, | 670 | static int bfin_mac_hwtstamp_set(struct net_device *netdev, |
671 | struct ifreq *ifr, int cmd) | 671 | struct ifreq *ifr) |
672 | { | 672 | { |
673 | struct hwtstamp_config config; | 673 | struct hwtstamp_config config; |
674 | struct bfin_mac_local *lp = netdev_priv(netdev); | 674 | struct bfin_mac_local *lp = netdev_priv(netdev); |
@@ -824,6 +824,16 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, | |||
824 | -EFAULT : 0; | 824 | -EFAULT : 0; |
825 | } | 825 | } |
826 | 826 | ||
827 | static int bfin_mac_hwtstamp_get(struct net_device *netdev, | ||
828 | struct ifreq *ifr) | ||
829 | { | ||
830 | struct bfin_mac_local *lp = netdev_priv(netdev); | ||
831 | |||
832 | return copy_to_user(ifr->ifr_data, &lp->stamp_cfg, | ||
833 | sizeof(lp->stamp_cfg)) ? | ||
834 | -EFAULT : 0; | ||
835 | } | ||
836 | |||
827 | static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) | 837 | static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) |
828 | { | 838 | { |
829 | struct bfin_mac_local *lp = netdev_priv(netdev); | 839 | struct bfin_mac_local *lp = netdev_priv(netdev); |
@@ -1062,7 +1072,8 @@ static void bfin_phc_release(struct bfin_mac_local *lp) | |||
1062 | #else | 1072 | #else |
1063 | # define bfin_mac_hwtstamp_is_none(cfg) 0 | 1073 | # define bfin_mac_hwtstamp_is_none(cfg) 0 |
1064 | # define bfin_mac_hwtstamp_init(dev) | 1074 | # define bfin_mac_hwtstamp_init(dev) |
1065 | # define bfin_mac_hwtstamp_ioctl(dev, ifr, cmd) (-EOPNOTSUPP) | 1075 | # define bfin_mac_hwtstamp_set(dev, ifr) (-EOPNOTSUPP) |
1076 | # define bfin_mac_hwtstamp_get(dev, ifr) (-EOPNOTSUPP) | ||
1066 | # define bfin_rx_hwtstamp(dev, skb) | 1077 | # define bfin_rx_hwtstamp(dev, skb) |
1067 | # define bfin_tx_hwtstamp(dev, skb) | 1078 | # define bfin_tx_hwtstamp(dev, skb) |
1068 | # define bfin_phc_init(netdev, dev) 0 | 1079 | # define bfin_phc_init(netdev, dev) 0 |
@@ -1496,7 +1507,9 @@ static int bfin_mac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
1496 | 1507 | ||
1497 | switch (cmd) { | 1508 | switch (cmd) { |
1498 | case SIOCSHWTSTAMP: | 1509 | case SIOCSHWTSTAMP: |
1499 | return bfin_mac_hwtstamp_ioctl(netdev, ifr, cmd); | 1510 | return bfin_mac_hwtstamp_set(netdev, ifr); |
1511 | case SIOCGHWTSTAMP: | ||
1512 | return bfin_mac_hwtstamp_get(netdev, ifr); | ||
1500 | default: | 1513 | default: |
1501 | if (lp->phydev) | 1514 | if (lp->phydev) |
1502 | return phy_mii_ioctl(lp->phydev, ifr, cmd); | 1515 | return phy_mii_ioctl(lp->phydev, ifr, cmd); |