netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage
@ 2014-07-27 21:21 Thomas Petazzoni
  2014-07-27 21:21 ` [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls Thomas Petazzoni
  2014-07-29 23:48 ` [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2014-07-27 21:21 UTC (permalink / raw)
  To: David S. Miller, netdev
  Cc: Tawfik Bayouk, Nadav Haklai, Lior Amsalem, Jason Cooper,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Ezequiel Garcia, linux-arm-kernel, Thomas Petazzoni

This commit is similar to commit 4d12bc63ab5e ("net: mvneta: fix
operation in 10 Mbit/s mode"), but this time for the mvpp2 driver. The
driver was properly taking into account the 1 Gbit/s and 100 Mbit/s
speeds, but not the 10 Mbit/s, which was handled as 100
Mbit/s. However, the MVPP2_GMAC_CONFIG_MII_SPEED bit in the
MVPP2_GMAC_AUTONEG_CONFIG register must remain cleared to allow 10
Mbit/s operation. This commit therefore fixes 10 Mbit/s operation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
This commit applies on top of net-next, since the mvpp2 driver was
merged there.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 3193a7d..3cae3d2 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -4842,7 +4842,7 @@ static void mvpp2_link_event(struct net_device *dev)
 
 			if (phydev->speed == SPEED_1000)
 				val |= MVPP2_GMAC_CONFIG_GMII_SPEED;
-			else
+			else if (phydev->speed == SPEED_100)
 				val |= MVPP2_GMAC_CONFIG_MII_SPEED;
 
 			writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls
  2014-07-27 21:21 [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage Thomas Petazzoni
@ 2014-07-27 21:21 ` Thomas Petazzoni
  2014-07-29 23:48   ` David Miller
  2014-07-29 23:48 ` [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2014-07-27 21:21 UTC (permalink / raw)
  To: David S. Miller, netdev
  Cc: Tawfik Bayouk, Nadav Haklai, Lior Amsalem, Jason Cooper,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Ezequiel Garcia, linux-arm-kernel, Thomas Petazzoni

This commit implements the ->ndo_do_ioctl() operation so that the
PHY-related ioctl() calls can work from userspace, which allows
applications like mii-tool or mii-diag to do their job.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
This commit applies on top of net-next, since the mvpp2 driver was
merged there.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 3cae3d2..ece83f1 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5714,6 +5714,21 @@ mvpp2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 	return stats;
 }
 
+static int mvpp2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+	struct mvpp2_port *port = netdev_priv(dev);
+	int ret;
+
+	if (!port->phy_dev)
+		return -ENOTSUPP;
+
+	ret = phy_mii_ioctl(port->phy_dev, ifr, cmd);
+	if (!ret)
+		mvpp2_link_event(dev);
+
+	return ret;
+}
+
 /* Ethtool methods */
 
 /* Get settings (phy address, speed) for ethtools */
@@ -5868,6 +5883,7 @@ static const struct net_device_ops mvpp2_netdev_ops = {
 	.ndo_set_mac_address	= mvpp2_set_mac_address,
 	.ndo_change_mtu		= mvpp2_change_mtu,
 	.ndo_get_stats64	= mvpp2_get_stats64,
+	.ndo_do_ioctl		= mvpp2_ioctl,
 };
 
 static const struct ethtool_ops mvpp2_eth_tool_ops = {
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage
  2014-07-27 21:21 [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage Thomas Petazzoni
  2014-07-27 21:21 ` [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls Thomas Petazzoni
@ 2014-07-29 23:48 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-29 23:48 UTC (permalink / raw)
  To: thomas.petazzoni
  Cc: netdev, tawfik, nadavh, alior, jason, andrew,
	sebastian.hesselbarth, gregory.clement, ezequiel.garcia,
	linux-arm-kernel

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 27 Jul 2014 23:21:35 +0200

> This commit is similar to commit 4d12bc63ab5e ("net: mvneta: fix
> operation in 10 Mbit/s mode"), but this time for the mvpp2 driver. The
> driver was properly taking into account the 1 Gbit/s and 100 Mbit/s
> speeds, but not the 10 Mbit/s, which was handled as 100
> Mbit/s. However, the MVPP2_GMAC_CONFIG_MII_SPEED bit in the
> MVPP2_GMAC_AUTONEG_CONFIG register must remain cleared to allow 10
> Mbit/s operation. This commit therefore fixes 10 Mbit/s operation.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls
  2014-07-27 21:21 ` [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls Thomas Petazzoni
@ 2014-07-29 23:48   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-29 23:48 UTC (permalink / raw)
  To: thomas.petazzoni
  Cc: netdev, tawfik, nadavh, alior, jason, andrew,
	sebastian.hesselbarth, gregory.clement, ezequiel.garcia,
	linux-arm-kernel

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 27 Jul 2014 23:21:36 +0200

> This commit implements the ->ndo_do_ioctl() operation so that the
> PHY-related ioctl() calls can work from userspace, which allows
> applications like mii-tool or mii-diag to do their job.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-29 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-27 21:21 [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage Thomas Petazzoni
2014-07-27 21:21 ` [PATCH 2/2] net: mvpp2: implement ioctl() operation for PHY ioctls Thomas Petazzoni
2014-07-29 23:48   ` David Miller
2014-07-29 23:48 ` [PATCH 1/2] net: mvpp2: fix 10 Mbit/s usage David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).