* [PATCH RFC v2 1/4] net: mvmdio: make orion_mdio_wait_ready consistent
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
@ 2013-10-24 18:09 ` Leigh Brown
2013-10-26 5:44 ` David Miller
2013-10-24 18:09 ` [PATCH RFC v2 2/4] net: mvmdio: orion_mdio_ready: remove manual poll Leigh Brown
` (4 subsequent siblings)
5 siblings, 1 reply; 20+ messages in thread
From: Leigh Brown @ 2013-10-24 18:09 UTC (permalink / raw)
To: linux-arm-kernel
Amend orion_mdio_wait_ready so that the same timeout is used when
polling or using wait_event_timeout. Set the timeout to 1ms.
Replace udelay with usleep_range to avoid a busy loop, and set the
polling interval range as 45us to 55us, so that the first sleep
will be enough in almost all cases.
Generate the same log message at timeout when polling or using
wait_event_timeout.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 51 +++++++++++++++++++--------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index e2f6626..6ed6f00 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -44,6 +44,15 @@
#define MVMDIO_ERR_INT_SMI_DONE 0x00000010
#define MVMDIO_ERR_INT_MASK 0x0080
+/*
+ * SMI Timeout measurements:
+ * - Kirkwood 88F6281 (Globalscale Dreamplug): 45us to 95us (Interrupt)
+ * - Armada 370 (Globalscale Mirabox): 41us to 43us (Polled)
+ */
+#define MVMDIO_SMI_TIMEOUT 1000 /* 1000us = 1ms */
+#define MVMDIO_SMI_POLL_INTERVAL_MIN 45
+#define MVMDIO_SMI_POLL_INTERVAL_MAX 55
+
struct orion_mdio_dev {
struct mutex lock;
void __iomem *regs;
@@ -68,34 +77,34 @@ static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev)
static int orion_mdio_wait_ready(struct mii_bus *bus)
{
struct orion_mdio_dev *dev = bus->priv;
- int count;
+ unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT);
+ unsigned long end = jiffies + timeout;
+ int timedout = 0;
- if (dev->err_interrupt <= 0) {
- count = 0;
- while (1) {
- if (orion_mdio_smi_is_done(dev))
+ while (1) {
+ if (orion_mdio_smi_is_done(dev))
+ return 0;
+ else
+ if (timedout)
break;
- if (count > 100) {
- dev_err(bus->parent,
- "Timeout: SMI busy for too long\n");
- return -ETIMEDOUT;
- }
+ if (dev->err_interrupt <= 0) {
+ usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN,
+ MVMDIO_SMI_POLL_INTERVAL_MAX);
- udelay(10);
- count++;
- }
- } else {
- if (!orion_mdio_smi_is_done(dev)) {
+ if (time_is_before_jiffies(end))
+ ++timedout;
+ } else {
wait_event_timeout(dev->smi_busy_wait,
- orion_mdio_smi_is_done(dev),
- msecs_to_jiffies(100));
- if (!orion_mdio_smi_is_done(dev))
- return -ETIMEDOUT;
- }
+ orion_mdio_smi_is_done(dev),
+ timeout);
+
+ ++timedout;
+ }
}
- return 0;
+ dev_err(bus->parent, "Timeout: SMI busy for too long\n");
+ return -ETIMEDOUT;
}
static int orion_mdio_read(struct mii_bus *bus, int mii_id,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH RFC v2 2/4] net: mvmdio: orion_mdio_ready: remove manual poll
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
2013-10-24 18:09 ` [PATCH RFC v2 1/4] net: mvmdio: make orion_mdio_wait_ready consistent Leigh Brown
@ 2013-10-24 18:09 ` Leigh Brown
2013-10-24 18:09 ` [PATCH RFC v2 3/4] net: mvmdio: slight optimisation of orion_mdio_write Leigh Brown
` (3 subsequent siblings)
5 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-24 18:09 UTC (permalink / raw)
To: linux-arm-kernel
Replace manual poll of MVMDIO_SMI_READ_VALID with a call to
orion_mdio_wait_ready. This ensures a consistent timeout,
eliminates a busy loop, and allows for use of interrupts on
systems that support them.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 36 +++++++++++++--------------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6ed6f00..f053475 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -111,43 +111,35 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
int regnum)
{
struct orion_mdio_dev *dev = bus->priv;
- int count;
u32 val;
int ret;
mutex_lock(&dev->lock);
ret = orion_mdio_wait_ready(bus);
- if (ret < 0) {
- mutex_unlock(&dev->lock);
- return ret;
- }
+ if (ret < 0)
+ goto out;
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
MVMDIO_SMI_READ_OPERATION),
dev->regs);
- /* Wait for the value to become available */
- count = 0;
- while (1) {
- val = readl(dev->regs);
- if (val & MVMDIO_SMI_READ_VALID)
- break;
-
- if (count > 100) {
- dev_err(bus->parent, "Timeout when reading PHY\n");
- mutex_unlock(&dev->lock);
- return -ETIMEDOUT;
- }
-
- udelay(10);
- count++;
+ ret = orion_mdio_wait_ready(bus);
+ if (ret < 0)
+ goto out;
+
+ val = readl(dev->regs);
+ if (!(val & MVMDIO_SMI_READ_VALID)) {
+ dev_err(bus->parent, "SMI bus read not valid\n");
+ ret = -ENODEV;
+ goto out;
}
+ ret = val & 0xFFFF;
+out:
mutex_unlock(&dev->lock);
-
- return val & 0xFFFF;
+ return ret;
}
static int orion_mdio_write(struct mii_bus *bus, int mii_id,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH RFC v2 3/4] net: mvmdio: slight optimisation of orion_mdio_write
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
2013-10-24 18:09 ` [PATCH RFC v2 1/4] net: mvmdio: make orion_mdio_wait_ready consistent Leigh Brown
2013-10-24 18:09 ` [PATCH RFC v2 2/4] net: mvmdio: orion_mdio_ready: remove manual poll Leigh Brown
@ 2013-10-24 18:09 ` Leigh Brown
2013-10-26 5:45 ` David Miller
2013-10-24 18:09 ` [PATCH RFC v2 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth Leigh Brown
` (2 subsequent siblings)
5 siblings, 1 reply; 20+ messages in thread
From: Leigh Brown @ 2013-10-24 18:09 UTC (permalink / raw)
To: linux-arm-kernel
Make only a single call to mutex_unlock in orion_mdio_write.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index f053475..13f4614 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -151,10 +151,8 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
mutex_lock(&dev->lock);
ret = orion_mdio_wait_ready(bus);
- if (ret < 0) {
- mutex_unlock(&dev->lock);
- return ret;
- }
+ if (ret != 0)
+ goto out;
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
@@ -162,9 +160,9 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
(value << MVMDIO_SMI_DATA_SHIFT)),
dev->regs);
+out:
mutex_unlock(&dev->lock);
-
- return 0;
+ return ret;
}
static int orion_mdio_reset(struct mii_bus *bus)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH RFC v2 3/4] net: mvmdio: slight optimisation of orion_mdio_write
2013-10-24 18:09 ` [PATCH RFC v2 3/4] net: mvmdio: slight optimisation of orion_mdio_write Leigh Brown
@ 2013-10-26 5:45 ` David Miller
0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2013-10-26 5:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Leigh Brown <leigh@solinno.co.uk>
Date: Thu, 24 Oct 2013 19:09:33 +0100
> Make only a single call to mutex_unlock in orion_mdio_write.
>
> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
You patch does more than what you're talking about here in your
commit message. In particular you're also changing the interpretation
of the orion_mdio_wait_ready() return value by changing the test
from < 0 to != 0.
Even if that is a legitimate change:
1) You're not describing it in the commit message@all.
2) It's a logically separate change, so should go into a completely
separate patch.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH RFC v2 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
` (2 preceding siblings ...)
2013-10-24 18:09 ` [PATCH RFC v2 3/4] net: mvmdio: slight optimisation of orion_mdio_write Leigh Brown
@ 2013-10-24 18:09 ` Leigh Brown
2013-10-24 21:25 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Jason Cooper
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
5 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-24 18:09 UTC (permalink / raw)
To: linux-arm-kernel
Amend the documentation in the mvmdio driver to note the fact
that it is now used by both the mvneta and mv643xx_eth drivers.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 13f4614..79b6d32 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -4,11 +4,9 @@
* Since the MDIO interface of Marvell network interfaces is shared
* between all network interfaces, having a single driver allows to
* handle concurrent accesses properly (you may have four Ethernet
- * ports, but they in fact share the same SMI interface to access the
- * MDIO bus). Moreover, this MDIO interface code is similar between
- * the mv643xx_eth driver and the mvneta driver. For now, it is only
- * used by the mvneta driver, but it could later be used by the
- * mv643xx_eth driver as well.
+ * ports, but they in fact share the same SMI interface to access
+ * the MDIO bus). This driver is currently used by the mvneta and
+ * mv643xx_eth drivers.
*
* Copyright (C) 2012 Marvell
*
--
1.7.10.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
` (3 preceding siblings ...)
2013-10-24 18:09 ` [PATCH RFC v2 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth Leigh Brown
@ 2013-10-24 21:25 ` Jason Cooper
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
5 siblings, 0 replies; 20+ messages in thread
From: Jason Cooper @ 2013-10-24 21:25 UTC (permalink / raw)
To: linux-arm-kernel
Leigh,
Thanks for getting the bottom of this!
On Thu, Oct 24, 2013 at 07:09:30PM +0100, Leigh Brown wrote:
> Thanks to the comment from Sebastian I did some more investigation and
> discovered that almost everything about my analysis was wrong (woops).
> The patch itself wasn't too bad though.
>
> In terms of timings, I don't believe the timeout was due to the SMI bus
> taking too long to respond because when I have repeated my testing
> (this time disabling interrupts whilst waiting), I have found that the
> maximum time that my Dreamplug takes to respond was about 95us (and
> 43us on the Mirabox, which polls). So I think the root cause of the
> problem was that interrupt handler was interfering with the polling in
> some way.
>
> I have therefore amended the first patch to use usleep_range to sleep
> instead of busy wait as suggested by Sebastian, and set the timeout to
> 1ms. I've tested this on both the Dreamplug and Mirabox and have seen
> no timeouts at all.
>
> The second, third and fourth patches are pretty much the same as before.
>
> If I receive no comments who do I submit this to for inclusion?
You can can use scripts/get_maintainer.pl for this. In this case, it
spits out:
"David S. Miller" <davem@davemloft.net> (commit_signer:63/70=90%)
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> (commit_signer:15/70=21%)
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> (commit_signer:10/70=14%)
Florian Fainelli <florian@openwrt.org> (commit_signer:8/70=11%)
Stephen Hemminger <stephen@networkplumber.org> (commit_signer:6/70=9%)
netdev at vger.kernel.org (open list:NETWORKING DRIVERS)
linux-kernel at vger.kernel.org (open list)
thx,
Jason.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 0/4] Fix MDIO bus timeout issues on Dreamplug
2013-10-24 18:09 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Leigh Brown
` (4 preceding siblings ...)
2013-10-24 21:25 ` [PATCH RFC v2 0/4] MDIO bus timeout issues on Dreamplug Jason Cooper
@ 2013-10-29 9:33 ` Leigh Brown
2013-10-29 9:33 ` [PATCH v3 1/4] net: mvmdio: make orion_mdio_wait_ready consistent Leigh Brown
` (4 more replies)
5 siblings, 5 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-29 9:33 UTC (permalink / raw)
To: linux-arm-kernel
I think I have addressed all comments.
Changes since v2:
- Fix coding style in ordio_mdio_wait_ready, as identified by David
- Remove un-needed operator change in orion_mdio_write, as identified by David
This patchset fixes an issue with the Dreamplug MDIO bus timeout since the
mv643xx_eth driver was converted to use the mvmdio driver to access the bus.
Leigh Brown (4):
net: mvmdio: make orion_mdio_wait_ready consistent
net: mvmdio: orion_mdio_ready: remove manual poll
net: mvmdio: slight optimisation of orion_mdio_write
net: mvmdio: doc: mvmdio now used by mv643xx_eth
drivers/net/ethernet/marvell/mvmdio.c | 110 ++++++++++++++++------------------
1 file changed, 53 insertions(+), 57 deletions(-)
--
1.8.4.rc3
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net: mvmdio: make orion_mdio_wait_ready consistent
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
@ 2013-10-29 9:33 ` Leigh Brown
2013-10-29 9:33 ` [PATCH v3 2/4] net: mvmdio: orion_mdio_ready: remove manual poll Leigh Brown
` (3 subsequent siblings)
4 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-29 9:33 UTC (permalink / raw)
To: linux-arm-kernel
Amend orion_mdio_wait_ready so that the same timeout is used when
polling or using wait_event_timeout. Set the timeout to 1ms.
Replace udelay with usleep_range to avoid a busy loop, and set the
polling interval range as 45us to 55us, so that the first sleep
will be enough in almost all cases.
Generate the same log message at timeout when polling or using
wait_event_timeout.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 52 ++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index e2f6626..971a4c1 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -44,6 +44,15 @@
#define MVMDIO_ERR_INT_SMI_DONE 0x00000010
#define MVMDIO_ERR_INT_MASK 0x0080
+/*
+ * SMI Timeout measurements:
+ * - Kirkwood 88F6281 (Globalscale Dreamplug): 45us to 95us (Interrupt)
+ * - Armada 370 (Globalscale Mirabox): 41us to 43us (Polled)
+ */
+#define MVMDIO_SMI_TIMEOUT 1000 /* 1000us = 1ms */
+#define MVMDIO_SMI_POLL_INTERVAL_MIN 45
+#define MVMDIO_SMI_POLL_INTERVAL_MAX 55
+
struct orion_mdio_dev {
struct mutex lock;
void __iomem *regs;
@@ -68,34 +77,33 @@ static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev)
static int orion_mdio_wait_ready(struct mii_bus *bus)
{
struct orion_mdio_dev *dev = bus->priv;
- int count;
+ unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT);
+ unsigned long end = jiffies + timeout;
+ int timedout = 0;
- if (dev->err_interrupt <= 0) {
- count = 0;
- while (1) {
- if (orion_mdio_smi_is_done(dev))
- break;
+ while (1) {
+ if (orion_mdio_smi_is_done(dev))
+ return 0;
+ else if (timedout)
+ break;
- if (count > 100) {
- dev_err(bus->parent,
- "Timeout: SMI busy for too long\n");
- return -ETIMEDOUT;
- }
+ if (dev->err_interrupt <= 0) {
+ usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN,
+ MVMDIO_SMI_POLL_INTERVAL_MAX);
- udelay(10);
- count++;
- }
- } else {
- if (!orion_mdio_smi_is_done(dev)) {
+ if (time_is_before_jiffies(end))
+ ++timedout;
+ } else {
wait_event_timeout(dev->smi_busy_wait,
- orion_mdio_smi_is_done(dev),
- msecs_to_jiffies(100));
- if (!orion_mdio_smi_is_done(dev))
- return -ETIMEDOUT;
- }
+ orion_mdio_smi_is_done(dev),
+ timeout);
+
+ ++timedout;
+ }
}
- return 0;
+ dev_err(bus->parent, "Timeout: SMI busy for too long\n");
+ return -ETIMEDOUT;
}
static int orion_mdio_read(struct mii_bus *bus, int mii_id,
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 2/4] net: mvmdio: orion_mdio_ready: remove manual poll
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
2013-10-29 9:33 ` [PATCH v3 1/4] net: mvmdio: make orion_mdio_wait_ready consistent Leigh Brown
@ 2013-10-29 9:33 ` Leigh Brown
2013-10-29 9:33 ` [PATCH v3 3/4] net: mvmdio: slight optimisation of orion_mdio_write Leigh Brown
` (2 subsequent siblings)
4 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-29 9:33 UTC (permalink / raw)
To: linux-arm-kernel
Replace manual poll of MVMDIO_SMI_READ_VALID with a call to
orion_mdio_wait_ready. This ensures a consistent timeout,
eliminates a busy loop, and allows for use of interrupts on
systems that support them.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 34 +++++++++++++---------------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 971a4c1..e3898b3 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -110,43 +110,35 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
int regnum)
{
struct orion_mdio_dev *dev = bus->priv;
- int count;
u32 val;
int ret;
mutex_lock(&dev->lock);
ret = orion_mdio_wait_ready(bus);
- if (ret < 0) {
- mutex_unlock(&dev->lock);
- return ret;
- }
+ if (ret < 0)
+ goto out;
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
MVMDIO_SMI_READ_OPERATION),
dev->regs);
- /* Wait for the value to become available */
- count = 0;
- while (1) {
- val = readl(dev->regs);
- if (val & MVMDIO_SMI_READ_VALID)
- break;
-
- if (count > 100) {
- dev_err(bus->parent, "Timeout when reading PHY\n");
- mutex_unlock(&dev->lock);
- return -ETIMEDOUT;
- }
+ ret = orion_mdio_wait_ready(bus);
+ if (ret < 0)
+ goto out;
- udelay(10);
- count++;
+ val = readl(dev->regs);
+ if (!(val & MVMDIO_SMI_READ_VALID)) {
+ dev_err(bus->parent, "SMI bus read not valid\n");
+ ret = -ENODEV;
+ goto out;
}
+ ret = val & 0xFFFF;
+out:
mutex_unlock(&dev->lock);
-
- return val & 0xFFFF;
+ return ret;
}
static int orion_mdio_write(struct mii_bus *bus, int mii_id,
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 3/4] net: mvmdio: slight optimisation of orion_mdio_write
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
2013-10-29 9:33 ` [PATCH v3 1/4] net: mvmdio: make orion_mdio_wait_ready consistent Leigh Brown
2013-10-29 9:33 ` [PATCH v3 2/4] net: mvmdio: orion_mdio_ready: remove manual poll Leigh Brown
@ 2013-10-29 9:33 ` Leigh Brown
2013-10-29 9:33 ` [PATCH v3 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth Leigh Brown
2013-10-29 22:54 ` [PATCH v3 0/4] Fix MDIO bus timeout issues on Dreamplug David Miller
4 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-29 9:33 UTC (permalink / raw)
To: linux-arm-kernel
Make only a single call to mutex_unlock in orion_mdio_write.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index e3898b3..0cfa0c8 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -150,10 +150,8 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
mutex_lock(&dev->lock);
ret = orion_mdio_wait_ready(bus);
- if (ret < 0) {
- mutex_unlock(&dev->lock);
- return ret;
- }
+ if (ret < 0)
+ goto out;
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
@@ -161,9 +159,9 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
(value << MVMDIO_SMI_DATA_SHIFT)),
dev->regs);
+out:
mutex_unlock(&dev->lock);
-
- return 0;
+ return ret;
}
static int orion_mdio_reset(struct mii_bus *bus)
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
` (2 preceding siblings ...)
2013-10-29 9:33 ` [PATCH v3 3/4] net: mvmdio: slight optimisation of orion_mdio_write Leigh Brown
@ 2013-10-29 9:33 ` Leigh Brown
2013-10-29 22:54 ` [PATCH v3 0/4] Fix MDIO bus timeout issues on Dreamplug David Miller
4 siblings, 0 replies; 20+ messages in thread
From: Leigh Brown @ 2013-10-29 9:33 UTC (permalink / raw)
To: linux-arm-kernel
Amend the documentation in the mvmdio driver to note the fact
that it is now used by both the mvneta and mv643xx_eth drivers.
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
drivers/net/ethernet/marvell/mvmdio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 0cfa0c8..0d0311c 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -4,11 +4,9 @@
* Since the MDIO interface of Marvell network interfaces is shared
* between all network interfaces, having a single driver allows to
* handle concurrent accesses properly (you may have four Ethernet
- * ports, but they in fact share the same SMI interface to access the
- * MDIO bus). Moreover, this MDIO interface code is similar between
- * the mv643xx_eth driver and the mvneta driver. For now, it is only
- * used by the mvneta driver, but it could later be used by the
- * mv643xx_eth driver as well.
+ * ports, but they in fact share the same SMI interface to access
+ * the MDIO bus). This driver is currently used by the mvneta and
+ * mv643xx_eth drivers.
*
* Copyright (C) 2012 Marvell
*
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 0/4] Fix MDIO bus timeout issues on Dreamplug
2013-10-29 9:33 ` [PATCH v3 0/4] Fix " Leigh Brown
` (3 preceding siblings ...)
2013-10-29 9:33 ` [PATCH v3 4/4] net: mvmdio: doc: mvmdio now used by mv643xx_eth Leigh Brown
@ 2013-10-29 22:54 ` David Miller
4 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2013-10-29 22:54 UTC (permalink / raw)
To: linux-arm-kernel
From: Leigh Brown <leigh@solinno.co.uk>
Date: Tue, 29 Oct 2013 09:33:30 +0000
> I think I have addressed all comments.
>
> Changes since v2:
> - Fix coding style in ordio_mdio_wait_ready, as identified by David
> - Remove un-needed operator change in orion_mdio_write, as identified by David
>
> This patchset fixes an issue with the Dreamplug MDIO bus timeout since the
> mv643xx_eth driver was converted to use the mvmdio driver to access the bus.
Series applied to net-next, thanks.
^ permalink raw reply [flat|nested] 20+ messages in thread