aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ibm_newemac/core.c10
-rw-r--r--drivers/net/pcmcia/3c574_cs.c13
-rw-r--r--drivers/net/pcmcia/axnet_cs.c9
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c9
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c13
5 files changed, 32 insertions, 22 deletions
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 8a95234d419c..1d7d7fef414f 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2209,7 +2209,7 @@ static const struct ethtool_ops emac_ethtool_ops = {
2209static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) 2209static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
2210{ 2210{
2211 struct emac_instance *dev = netdev_priv(ndev); 2211 struct emac_instance *dev = netdev_priv(ndev);
2212 uint16_t *data = (uint16_t *) & rq->ifr_ifru; 2212 struct mii_ioctl_data *data = if_mii(rq);
2213 2213
2214 DBG(dev, "ioctl %08x" NL, cmd); 2214 DBG(dev, "ioctl %08x" NL, cmd);
2215 2215
@@ -2218,14 +2218,16 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
2218 2218
2219 switch (cmd) { 2219 switch (cmd) {
2220 case SIOCGMIIPHY: 2220 case SIOCGMIIPHY:
2221 data[0] = dev->phy.address; 2221 data->phy_id = dev->phy.address;
2222 /* Fall through */ 2222 /* Fall through */
2223 case SIOCGMIIREG: 2223 case SIOCGMIIREG:
2224 data[3] = emac_mdio_read(ndev, dev->phy.address, data[1]); 2224 data->val_out = emac_mdio_read(ndev, dev->phy.address,
2225 data->reg_num);
2225 return 0; 2226 return 0;
2226 2227
2227 case SIOCSMIIREG: 2228 case SIOCSMIIREG:
2228 emac_mdio_write(ndev, dev->phy.address, data[1], data[2]); 2229 emac_mdio_write(ndev, dev->phy.address, data->reg_num,
2230 data->val_in);
2229 return 0; 2231 return 0;
2230 default: 2232 default:
2231 return -EOPNOTSUPP; 2233 return -EOPNOTSUPP;
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index d836af1b9034..ee8ad3e180dd 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -85,6 +85,7 @@ earlier 3Com products.
85#include <linux/ioport.h> 85#include <linux/ioport.h>
86#include <linux/ethtool.h> 86#include <linux/ethtool.h>
87#include <linux/bitops.h> 87#include <linux/bitops.h>
88#include <linux/mii.h>
88 89
89#include <pcmcia/cs_types.h> 90#include <pcmcia/cs_types.h>
90#include <pcmcia/cs.h> 91#include <pcmcia/cs.h>
@@ -1096,16 +1097,16 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1096{ 1097{
1097 struct el3_private *lp = netdev_priv(dev); 1098 struct el3_private *lp = netdev_priv(dev);
1098 unsigned int ioaddr = dev->base_addr; 1099 unsigned int ioaddr = dev->base_addr;
1099 u16 *data = (u16 *)&rq->ifr_ifru; 1100 struct mii_ioctl_data *data = if_mii(rq);
1100 int phy = lp->phys & 0x1f; 1101 int phy = lp->phys & 0x1f;
1101 1102
1102 DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", 1103 DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
1103 dev->name, rq->ifr_ifrn.ifrn_name, cmd, 1104 dev->name, rq->ifr_ifrn.ifrn_name, cmd,
1104 data[0], data[1], data[2], data[3]); 1105 data->phy_id, data->reg_num, data->val_in, data->val_out);
1105 1106
1106 switch(cmd) { 1107 switch(cmd) {
1107 case SIOCGMIIPHY: /* Get the address of the PHY in use. */ 1108 case SIOCGMIIPHY: /* Get the address of the PHY in use. */
1108 data[0] = phy; 1109 data->phy_id = phy;
1109 case SIOCGMIIREG: /* Read the specified MII register. */ 1110 case SIOCGMIIREG: /* Read the specified MII register. */
1110 { 1111 {
1111 int saved_window; 1112 int saved_window;
@@ -1114,7 +1115,8 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1114 spin_lock_irqsave(&lp->window_lock, flags); 1115 spin_lock_irqsave(&lp->window_lock, flags);
1115 saved_window = inw(ioaddr + EL3_CMD) >> 13; 1116 saved_window = inw(ioaddr + EL3_CMD) >> 13;
1116 EL3WINDOW(4); 1117 EL3WINDOW(4);
1117 data[3] = mdio_read(ioaddr, data[0] & 0x1f, data[1] & 0x1f); 1118 data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f,
1119 data->reg_num & 0x1f);
1118 EL3WINDOW(saved_window); 1120 EL3WINDOW(saved_window);
1119 spin_unlock_irqrestore(&lp->window_lock, flags); 1121 spin_unlock_irqrestore(&lp->window_lock, flags);
1120 return 0; 1122 return 0;
@@ -1127,7 +1129,8 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1127 spin_lock_irqsave(&lp->window_lock, flags); 1129 spin_lock_irqsave(&lp->window_lock, flags);
1128 saved_window = inw(ioaddr + EL3_CMD) >> 13; 1130 saved_window = inw(ioaddr + EL3_CMD) >> 13;
1129 EL3WINDOW(4); 1131 EL3WINDOW(4);
1130 mdio_write(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2]); 1132 mdio_write(ioaddr, data->phy_id & 0x1f,
1133 data->reg_num & 0x1f, data->val_in);
1131 EL3WINDOW(saved_window); 1134 EL3WINDOW(saved_window);
1132 spin_unlock_irqrestore(&lp->window_lock, flags); 1135 spin_unlock_irqrestore(&lp->window_lock, flags);
1133 return 0; 1136 return 0;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 4f2fef6cf6dc..3131a59a8d32 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -37,6 +37,7 @@
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/crc32.h> 39#include <linux/crc32.h>
40#include <linux/mii.h>
40#include "../8390.h" 41#include "../8390.h"
41 42
42#include <pcmcia/cs_types.h> 43#include <pcmcia/cs_types.h>
@@ -697,16 +698,16 @@ static const struct ethtool_ops netdev_ethtool_ops = {
697static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 698static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
698{ 699{
699 axnet_dev_t *info = PRIV(dev); 700 axnet_dev_t *info = PRIV(dev);
700 u16 *data = (u16 *)&rq->ifr_ifru; 701 struct mii_ioctl_data *data = if_mii(rq);
701 unsigned int mii_addr = dev->base_addr + AXNET_MII_EEP; 702 unsigned int mii_addr = dev->base_addr + AXNET_MII_EEP;
702 switch (cmd) { 703 switch (cmd) {
703 case SIOCGMIIPHY: 704 case SIOCGMIIPHY:
704 data[0] = info->phy_id; 705 data->phy_id = info->phy_id;
705 case SIOCGMIIREG: /* Read MII PHY register. */ 706 case SIOCGMIIREG: /* Read MII PHY register. */
706 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f); 707 data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
707 return 0; 708 return 0;
708 case SIOCSMIIREG: /* Write MII PHY register. */ 709 case SIOCSMIIREG: /* Write MII PHY register. */
709 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]); 710 mdio_write(mii_addr, data->phy_id, data->reg_num & 0x1f, data->val_in);
710 return 0; 711 return 0;
711 } 712 }
712 return -EOPNOTSUPP; 713 return -EOPNOTSUPP;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 8996b45ffffb..90a94d215831 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -40,6 +40,7 @@
40#include <linux/netdevice.h> 40#include <linux/netdevice.h>
41#include <linux/log2.h> 41#include <linux/log2.h>
42#include <linux/etherdevice.h> 42#include <linux/etherdevice.h>
43#include <linux/mii.h>
43#include "../8390.h" 44#include "../8390.h"
44 45
45#include <pcmcia/cs_types.h> 46#include <pcmcia/cs_types.h>
@@ -1191,7 +1192,7 @@ static const struct ethtool_ops netdev_ethtool_ops = {
1191static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1192static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1192{ 1193{
1193 pcnet_dev_t *info = PRIV(dev); 1194 pcnet_dev_t *info = PRIV(dev);
1194 u16 *data = (u16 *)&rq->ifr_ifru; 1195 struct mii_ioctl_data *data = if_mii(rq);
1195 unsigned int mii_addr = dev->base_addr + DLINK_GPIO; 1196 unsigned int mii_addr = dev->base_addr + DLINK_GPIO;
1196 1197
1197 if (!(info->flags & (IS_DL10019|IS_DL10022))) 1198 if (!(info->flags & (IS_DL10019|IS_DL10022)))
@@ -1199,12 +1200,12 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1199 1200
1200 switch (cmd) { 1201 switch (cmd) {
1201 case SIOCGMIIPHY: 1202 case SIOCGMIIPHY:
1202 data[0] = info->phy_id; 1203 data->phy_id = info->phy_id;
1203 case SIOCGMIIREG: /* Read MII PHY register. */ 1204 case SIOCGMIIREG: /* Read MII PHY register. */
1204 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f); 1205 data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
1205 return 0; 1206 return 0;
1206 case SIOCSMIIREG: /* Write MII PHY register. */ 1207 case SIOCSMIIREG: /* Write MII PHY register. */
1207 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]); 1208 mdio_write(mii_addr, data->phy_id, data->reg_num & 0x1f, data->val_in);
1208 return 0; 1209 return 0;
1209 } 1210 }
1210 return -EOPNOTSUPP; 1211 return -EOPNOTSUPP;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 9709dd173ddc..cf8423102538 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -80,6 +80,7 @@
80#include <linux/if_arp.h> 80#include <linux/if_arp.h>
81#include <linux/ioport.h> 81#include <linux/ioport.h>
82#include <linux/bitops.h> 82#include <linux/bitops.h>
83#include <linux/mii.h>
83 84
84#include <pcmcia/cs_types.h> 85#include <pcmcia/cs_types.h>
85#include <pcmcia/cs.h> 86#include <pcmcia/cs.h>
@@ -1558,24 +1559,26 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1558{ 1559{
1559 local_info_t *local = netdev_priv(dev); 1560 local_info_t *local = netdev_priv(dev);
1560 unsigned int ioaddr = dev->base_addr; 1561 unsigned int ioaddr = dev->base_addr;
1561 u16 *data = (u16 *)&rq->ifr_ifru; 1562 struct mii_ioctl_data *data = if_mii(rq);
1562 1563
1563 DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", 1564 DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n",
1564 dev->name, rq->ifr_ifrn.ifrn_name, cmd, 1565 dev->name, rq->ifr_ifrn.ifrn_name, cmd,
1565 data[0], data[1], data[2], data[3]); 1566 data->phy_id, data->reg_num, data->val_in, data->val_out);
1566 1567
1567 if (!local->mohawk) 1568 if (!local->mohawk)
1568 return -EOPNOTSUPP; 1569 return -EOPNOTSUPP;
1569 1570
1570 switch(cmd) { 1571 switch(cmd) {
1571 case SIOCGMIIPHY: /* Get the address of the PHY in use. */ 1572 case SIOCGMIIPHY: /* Get the address of the PHY in use. */
1572 data[0] = 0; /* we have only this address */ 1573 data->phy_id = 0; /* we have only this address */
1573 /* fall through */ 1574 /* fall through */
1574 case SIOCGMIIREG: /* Read the specified MII register. */ 1575 case SIOCGMIIREG: /* Read the specified MII register. */
1575 data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f); 1576 data->val_out = mii_rd(ioaddr, data->phy_id & 0x1f,
1577 data->reg_num & 0x1f);
1576 break; 1578 break;
1577 case SIOCSMIIREG: /* Write the specified MII register */ 1579 case SIOCSMIIREG: /* Write the specified MII register */
1578 mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16); 1580 mii_wr(ioaddr, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in,
1581 16);
1579 break; 1582 break;
1580 default: 1583 default:
1581 return -EOPNOTSUPP; 1584 return -EOPNOTSUPP;