From: Wolfgang Ocker <weo@reccoware.de>
To: benh@kernel.crashing.org
Cc: Linuxppc-dev@ozlabs.org
Subject: [PATCH] PPC4xx compatible ioctl for PHY control
Date: Tue, 26 Aug 2008 20:22:58 +0200 [thread overview]
Message-ID: <1219774978.3294.61.camel@galileo.recco.de> (raw)
From: Wolfgang Ocker <weo@reccoware.de>
Made PHY access in ioctl() for newemac driver compatible to other devices.
- Allow specification of PHY address in mii_ioctl_data->phy_id
- Use mii_ioctl_data structure
Signed-off-by: Wolfgang Ocker <weo@reccoware.de>
---
--- linux-2.6.26.3/drivers/net/ibm_newemac/core.c.mdio 2008-08-20 20:11:37.000000000 +0200
+++ linux-2.6.26.3/drivers/net/ibm_newemac/core.c 2008-08-24 18:25:49.000000000 +0200
@@ -2172,28 +2172,31 @@
static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
{
struct emac_instance *dev = netdev_priv(ndev);
- uint16_t *data = (uint16_t *) & rq->ifr_ifru;
+ struct mii_ioctl_data *data = if_mii(rq);
+ int r;
DBG(dev, "ioctl %08x" NL, cmd);
- if (dev->phy.address < 0)
+ if (data->phy_id & ~0x1f)
return -EOPNOTSUPP;
switch (cmd) {
case SIOCGMIIPHY:
case SIOCDEVPRIVATE:
- data[0] = dev->phy.address;
+ data->phy_id = dev->phy.address;
/* Fall through */
case SIOCGMIIREG:
case SIOCDEVPRIVATE + 1:
- data[3] = emac_mdio_read(ndev, dev->phy.address, data[1]);
+ r = emac_mdio_read(ndev, data->phy_id, data->reg_num);
+ if (r < 0)
+ r = 0xffff;
+ data->val_out = r;
return 0;
-
case SIOCSMIIREG:
case SIOCDEVPRIVATE + 2:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- emac_mdio_write(ndev, dev->phy.address, data[1], data[2]);
+ emac_mdio_write(ndev, data->phy_id, data->reg_num, data->val_in);
return 0;
default:
return -EOPNOTSUPP;
reply other threads:[~2008-08-26 18:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1219774978.3294.61.camel@galileo.recco.de \
--to=weo@reccoware.de \
--cc=Linuxppc-dev@ozlabs.org \
--cc=benh@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox