diff mbox

PATCH: DaVinci EMAC MII ioctl support

Message ID 4D9C77A8.3040209@dave-tech.it (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

r&d4@dave-tech.it April 6, 2011, 2:24 p.m. UTC
Dear DaVince developer,

I'm currently working with a TI AM35xx on our embedded SOM.

Due the fact that I need to use mii-tool on our platform I've done a
little patch to your driver to add mii ioctl support.

It has been tested on our Lizard board (SMSC LAN8700 as Ethernet phy)
with the following version of mii-tool:

root@lizard:/mnt/ubifs# mii-tool -V
mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)
eth0: 100 Mbit, full duplex, link ok

Feel free to add this to patch to the next release of your driver, I
think it will be useful to many developers.

Best Regards,

--

Andrea SCIAN
DAVE
www.dave.eu

Comments

hong zhang April 6, 2011, 4:30 p.m. UTC | #1
ethtool is not supported by davinci-emac?

--- On Wed, 4/6/11, r&d4@dave-tech.it <r&d4@dave-tech.it> wrote:

> From: r&d4@dave-tech.it <r&d4@dave-tech.it>
> Subject: PATCH: DaVinci EMAC  MII ioctl support
> To: davinci-linux-open-source@linux.davincidsp.com
> Date: Wednesday, April 6, 2011, 9:24 AM
> 
> Dear DaVince developer,
> 
> I'm currently working with a TI AM35xx on our embedded
> SOM.
> 
> Due the fact that I need to use mii-tool on our platform
> I've done a
> little patch to your driver to add mii ioctl support.
> 
> It has been tested on our Lizard board (SMSC LAN8700 as
> Ethernet phy)
> with the following version of mii-tool:
> 
> root@lizard:/mnt/ubifs# mii-tool -V
> mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)
> eth0: 100 Mbit, full duplex, link ok
> 
> Feel free to add this to patch to the next release of your
> driver, I
> think it will be useful to many developers.
> 
> Best Regards,
> 
> --
> 
> Andrea SCIAN
> DAVE
> www.dave.eu
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
>
r&d4@dave-tech.it April 6, 2011, 4:45 p.m. UTC | #2
On 06/04/2011 18.30, hong zhang wrote:
> ethtool is not supported by davinci-emac?
>

I try ethtool on my platform and it's working.
Anyway I need a tool to write mii register directly and I already have a 
modified source of mii-tool that allow me to do that, so it was easier 
to add a line to DaVinci driver instead than learing ethtool sources.

Regards,

Andrea
diff mbox

Patch

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 45e6188..f63827e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2355,14 +2355,15 @@  static void emac_adjust_link(struct net_device *ndev)
  */
 static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
 {
-	dev_warn(&ndev->dev, "DaVinci EMAC: ioctl not supported\n");
-
+	struct emac_priv *priv = netdev_priv(ndev);
+	
 	if (!(netif_running(ndev)))
 		return -EINVAL;
 
-	/* TODO: Add phy read and write and private statistics get feature */
+	if (!priv->phydev)
+		return -ENOTSUPP;
 
-	return -EOPNOTSUPP;
+	return phy_mii_ioctl(priv->phydev, if_mii(ifrq), cmd);
 }
 
 /**