Commit e583cd6f authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Alessandro Rubini

wr_nic: remove DMTD calibration procedures (not used)

The calibration procedures are defined but never called. They
were used in wrs-V2 hardware, but callers disappeared in January 2012.
Better remove them than let them rust forever.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 31013ca8
......@@ -5,7 +5,7 @@ ccflags-y += -DWR_SWITCH
obj-m := wr-nic.o
wr-nic-objs := module.o device.o nic-core.o endpoint.o ethtool.o \
pps.o timestamp.o dmtd.o
pps.o timestamp.o
# accept WRN_DEBUG from the environment. It turns pr_debug() into printk.
ifdef WRN_DEBUG
......
/*
* DMTD calibration procedures
*
* Copyright (C) 2010 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
* Partly from previous work by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Partly from previous work by Emilio G. Cota <cota@braap.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include "wr-nic.h"
int wrn_phase_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct wrn_phase_req phase_req;
struct wrn_ep *ep = netdev_priv(dev);
u32 dmsr;
s32 ph;
phase_req.phase = 0;
phase_req.ready = 0;
dmsr = readl(&ep->ep_regs->DMSR);
if(dmsr & EP_DMSR_PS_RDY) {
ph = EP_DMSR_PS_VAL_R(dmsr);
/* Sign-extend the 24-bit value */
if(ph & 0x800000)
ph |= 0xff << 24;
/* Divide by nsamples (average) */
ph /= WRN_DMTD_AVG_SAMPLES;
/* Put it back in the proper range */
ph = (ph + WRN_DMTD_MAX_PHASE) % WRN_DMTD_MAX_PHASE;
phase_req.phase = ph;
phase_req.ready = 1;
}
if (copy_to_user(rq->ifr_data, &phase_req, sizeof(phase_req)))
return -EFAULT;
return 0;
}
int wrn_calib_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct wrn_calibration_req cal_req;
struct wrn_ep *ep = netdev_priv(dev);
u32 tmp;
if (copy_from_user(&cal_req, rq->ifr_data, sizeof(cal_req)))
return -EFAULT;
if (0) { /* FIXME: what' coming out of this thing? */
if (!(ep->ep_flags & BIT(WRN_EP_UP)))
return -EIO; /* was -EFAULT in minic */
}
switch(cal_req.cmd) {
case WRN_CAL_TX_ON:
tmp = wrn_phy_read(dev, 0, WRN_MDIO_WR_SPEC);
wrn_phy_write(dev, 0, WRN_MDIO_WR_SPEC,
tmp | WRN_MDIO_WR_SPEC_TX_CAL);
break;
case WRN_CAL_TX_OFF:
tmp = wrn_phy_read(dev, 0, WRN_MDIO_WR_SPEC);
wrn_phy_write(dev, 0, WRN_MDIO_WR_SPEC,
tmp & (~WRN_MDIO_WR_SPEC_TX_CAL));
break;
case WRN_CAL_RX_ON:
tmp = wrn_phy_read(dev, 0, WRN_MDIO_WR_SPEC);
wrn_phy_write(dev, 0, WRN_MDIO_WR_SPEC,
tmp | WRN_MDIO_WR_SPEC_CAL_CRST);
break;
case WRN_CAL_RX_OFF:
// do nothing.....
break;
case WRN_CAL_RX_CHECK:
tmp = wrn_phy_read(dev, 0, WRN_MDIO_WR_SPEC);
cal_req.cal_present = tmp & WRN_MDIO_WR_SPEC_RX_CAL_STAT
? 1 : 0;
if (copy_to_user(rq->ifr_data,&cal_req,
sizeof(cal_req)))
return -EFAULT;
break;
}
return 0;
}
......@@ -295,9 +295,8 @@ static int wrn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case SIOCSHWTSTAMP:
return wrn_tstamp_ioctl(dev, rq, cmd);
case PRIV_IOCGCALIBRATE:
return wrn_calib_ioctl(dev, rq, cmd);
case PRIV_IOCGGETPHASE:
return wrn_phase_ioctl(dev, rq, cmd);
return -EOPNOTSUPP;
case PRIV_IOCREADREG:
if (get_user(reg, (u32 *)rq->ifr_data) < 0)
return -EFAULT;
......
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