linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support
@ 2017-06-14 15:49 Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 01/11] net: mvmdio: reorder headers alphabetically Antoine Tenart
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This series aims to add the xSMI support on the xMDIO bus to the
mvmdio driver. The xSMI interface complies with the IEEE 802.3 clause 45
and is used by 10GbE devices. On 7k and 8k (as of now), such an
interface is found and is used by Ethernet controllers.

Patches 1-4 and 9 are cosmetic cleanups.

Patches 5-7 are prerequisites to the xSMI support.

Patches 8 and 10-11 add the xSMI support to the mvmdio driver, and a
node is added both in the cp110 slave and master device trees.

This was tested on an Armada 8040 mcbin, as well as on both the
Armada 7040 DB and the Armada 8040 DB to ensure the SMI interface
was still working.

@Dave: patch 11 should go through the mvebu tree as asked by Gregory,
thanks!

Thanks,
Antoine

Since v3:
  - Added a patch from Russell King removing locks, as there is already
    per bus locking in the MDIO layer.
  - Russell suggested another approach to add the xSMI support, by having
    two different read/write functions. Reworked the series to take this
    into account. (This also lead to the removal of some patches, and the
    introduction of some others).

Since v2:
  - Brought back the marvell,xmdio compatible and updated the driver
    accordingly. The ops (smi, xsmi) are chosen based on the compatible.
  - Now return -EOPNOTSUPP when the MII_ADDR_C45 bit is wrongly set.
  - Mask dev_addr with GENMASK(4, 0).
  - Moved bit definitions under their register definition.
  - Fixed the write operation shift.
  - Added one space before the second parameter of GENMASK.

Since v1:
  - Instead of using the smi/xsmi helpers based on the compatible, now
    check if the MII_ADDR_C45 bit is set.
  - Removed the marvell,xmdio compatible addition.
  - Fixed the is_read_valid logic.
  - Updated to use static const variables for ops.
  - Added 3 Reviewed-by tags from Florian (I dropped another one as the
    patch changed in v2).

Antoine Tenart (10):
  net: mvmdio: reorder headers alphabetically
  net: mvmdio: use tabs for defines
  net: mvmdio: use GENMASK for masks
  net: mvmdio: introduce an ops structure
  net: mvmdio: put the poll intervals in the ops structure
  net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations
  net: mvmdio: add xmdio xsmi support
  net: mvmdio: simplify the smi read and write error paths
  dt-bindings: orion-mdio: document the new xmdio compatible
  arm64: marvell: dts: add xmdio nodes for 7k/8k

Russell King (1):
  net: mvmdio: remove duplicate locking

 .../devicetree/bindings/net/marvell-orion-mdio.txt |   8 +-
 .../boot/dts/marvell/armada-cp110-master.dtsi      |   8 +
 .../arm64/boot/dts/marvell/armada-cp110-slave.dtsi |   8 +
 drivers/net/ethernet/marvell/mvmdio.c              | 214 +++++++++++++++------
 4 files changed, 178 insertions(+), 60 deletions(-)

-- 
2.9.4

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

* [PATCH v4 01/11] net: mvmdio: reorder headers alphabetically
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 02/11] net: mvmdio: use tabs for defines Antoine Tenart
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Cosmetic fix reordering headers alphabetically.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 90a60b98c28e..109a2bff334d 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -17,16 +17,16 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/of_mdio.h>
 #include <linux/phy.h>
-#include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <linux/of_mdio.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-- 
2.9.4

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

* [PATCH v4 02/11] net: mvmdio: use tabs for defines
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 01/11] net: mvmdio: reorder headers alphabetically Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 03/11] net: mvmdio: use GENMASK for masks Antoine Tenart
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Cosmetic patch replacing spaces by tabs for defined values.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 109a2bff334d..17b518b13ae3 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -30,25 +30,25 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-#define MVMDIO_SMI_DATA_SHIFT              0
-#define MVMDIO_SMI_PHY_ADDR_SHIFT          16
-#define MVMDIO_SMI_PHY_REG_SHIFT           21
-#define MVMDIO_SMI_READ_OPERATION          BIT(26)
-#define MVMDIO_SMI_WRITE_OPERATION         0
-#define MVMDIO_SMI_READ_VALID              BIT(27)
-#define MVMDIO_SMI_BUSY                    BIT(28)
-#define MVMDIO_ERR_INT_CAUSE		   0x007C
-#define  MVMDIO_ERR_INT_SMI_DONE	   0x00000010
-#define MVMDIO_ERR_INT_MASK		   0x0080
+#define MVMDIO_SMI_DATA_SHIFT		0
+#define MVMDIO_SMI_PHY_ADDR_SHIFT	16
+#define MVMDIO_SMI_PHY_REG_SHIFT	21
+#define MVMDIO_SMI_READ_OPERATION	BIT(26)
+#define MVMDIO_SMI_WRITE_OPERATION	0
+#define MVMDIO_SMI_READ_VALID		BIT(27)
+#define MVMDIO_SMI_BUSY			BIT(28)
+#define MVMDIO_ERR_INT_CAUSE		0x007C
+#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
+#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;
-- 
2.9.4

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

* [PATCH v4 03/11] net: mvmdio: use GENMASK for masks
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 01/11] net: mvmdio: reorder headers alphabetically Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 02/11] net: mvmdio: use tabs for defines Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-19 11:57   ` David Laight
  2017-06-14 15:49 ` [PATCH v4 04/11] net: mvmdio: remove duplicate locking Antoine Tenart
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Cosmetic patch to use the GENMASK helper for masks.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 17b518b13ae3..583f1c5753c2 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -138,7 +138,7 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 		goto out;
 	}
 
-	ret = val & 0xFFFF;
+	ret = val & GENMASK(15, 0);
 out:
 	mutex_unlock(&dev->lock);
 	return ret;
-- 
2.9.4

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

* [PATCH v4 04/11] net: mvmdio: remove duplicate locking
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (2 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 03/11] net: mvmdio: use GENMASK for masks Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:01   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 05/11] net: mvmdio: introduce an ops structure Antoine Tenart
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

From: Russell King <rmk+kernel@armlinux.org.uk>

The MDIO layer already provides per-bus locking, so there's no need for
MDIO bus drivers to do their own internal locking.  Remove this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/marvell/mvmdio.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 583f1c5753c2..eab625752b12 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -23,7 +23,6 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/of_mdio.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
@@ -51,7 +50,6 @@
 #define MVMDIO_SMI_POLL_INTERVAL_MAX	55
 
 struct orion_mdio_dev {
-	struct mutex lock;
 	void __iomem *regs;
 	struct clk *clk[3];
 	/*
@@ -116,8 +114,6 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 	u32 val;
 	int ret;
 
-	mutex_lock(&dev->lock);
-
 	ret = orion_mdio_wait_ready(bus);
 	if (ret < 0)
 		goto out;
@@ -140,7 +136,6 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 
 	ret = val & GENMASK(15, 0);
 out:
-	mutex_unlock(&dev->lock);
 	return ret;
 }
 
@@ -150,8 +145,6 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	struct orion_mdio_dev *dev = bus->priv;
 	int ret;
 
-	mutex_lock(&dev->lock);
-
 	ret = orion_mdio_wait_ready(bus);
 	if (ret < 0)
 		goto out;
@@ -163,7 +156,6 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	       dev->regs);
 
 out:
-	mutex_unlock(&dev->lock);
 	return ret;
 }
 
@@ -244,8 +236,6 @@ static int orion_mdio_probe(struct platform_device *pdev)
 		return -EPROBE_DEFER;
 	}
 
-	mutex_init(&dev->lock);
-
 	if (pdev->dev.of_node)
 		ret = of_mdiobus_register(bus, pdev->dev.of_node);
 	else
-- 
2.9.4

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

* [PATCH v4 05/11] net: mvmdio: introduce an ops structure
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (3 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 04/11] net: mvmdio: remove duplicate locking Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:02   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 06/11] net: mvmdio: put the poll intervals in the " Antoine Tenart
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce an ops structure to add an indirection on the is_done
function, as this is needed to add the xMDIO support later.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index eab625752b12..2a8efc77f5fe 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -62,14 +62,14 @@ struct orion_mdio_dev {
 	wait_queue_head_t smi_busy_wait;
 };
 
-static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev)
-{
-	return !(readl(dev->regs) & MVMDIO_SMI_BUSY);
-}
+struct orion_mdio_ops {
+	int (*is_done)(struct orion_mdio_dev *);
+};
 
 /* Wait for the SMI unit to be ready for another operation
  */
-static int orion_mdio_wait_ready(struct mii_bus *bus)
+static int orion_mdio_wait_ready(const struct orion_mdio_ops *ops,
+				 struct mii_bus *bus)
 {
 	struct orion_mdio_dev *dev = bus->priv;
 	unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT);
@@ -77,7 +77,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)
 	int timedout = 0;
 
 	while (1) {
-	        if (orion_mdio_smi_is_done(dev))
+	        if (ops->is_done(dev))
 			return 0;
 	        else if (timedout)
 			break;
@@ -96,8 +96,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)
 			if (timeout < 2)
 				timeout = 2;
 			wait_event_timeout(dev->smi_busy_wait,
-				           orion_mdio_smi_is_done(dev),
-				           timeout);
+				           ops->is_done(dev), timeout);
 
 			++timedout;
 	        }
@@ -107,6 +106,15 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)
 	return  -ETIMEDOUT;
 }
 
+static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev)
+{
+	return !(readl(dev->regs) & MVMDIO_SMI_BUSY);
+}
+
+static const struct orion_mdio_ops orion_mdio_smi_ops = {
+	.is_done = orion_mdio_smi_is_done,
+};
+
 static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 			   int regnum)
 {
@@ -114,7 +122,7 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 	u32 val;
 	int ret;
 
-	ret = orion_mdio_wait_ready(bus);
+	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
 		goto out;
 
@@ -123,7 +131,7 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 		MVMDIO_SMI_READ_OPERATION),
 	       dev->regs);
 
-	ret = orion_mdio_wait_ready(bus);
+	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
 		goto out;
 
@@ -145,7 +153,7 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	struct orion_mdio_dev *dev = bus->priv;
 	int ret;
 
-	ret = orion_mdio_wait_ready(bus);
+	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
 		goto out;
 
-- 
2.9.4

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

* [PATCH v4 06/11] net: mvmdio: put the poll intervals in the ops structure
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (4 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 05/11] net: mvmdio: introduce an ops structure Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:02   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations Antoine Tenart
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Put the two poll intervals (min and max) in the driver's ops
structure. This is needed to add the xmdio support later.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 2a8efc77f5fe..e4aa8e2d2e8a 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -64,6 +64,8 @@ struct orion_mdio_dev {
 
 struct orion_mdio_ops {
 	int (*is_done)(struct orion_mdio_dev *);
+	unsigned int poll_interval_min;
+	unsigned int poll_interval_max;
 };
 
 /* Wait for the SMI unit to be ready for another operation
@@ -83,8 +85,8 @@ static int orion_mdio_wait_ready(const struct orion_mdio_ops *ops,
 			break;
 
 	        if (dev->err_interrupt <= 0) {
-			usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN,
-				     MVMDIO_SMI_POLL_INTERVAL_MAX);
+			usleep_range(ops->poll_interval_min,
+				     ops->poll_interval_max);
 
 			if (time_is_before_jiffies(end))
 				++timedout;
@@ -113,6 +115,8 @@ static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev)
 
 static const struct orion_mdio_ops orion_mdio_smi_ops = {
 	.is_done = orion_mdio_smi_is_done,
+	.poll_interval_min = MVMDIO_SMI_POLL_INTERVAL_MIN,
+	.poll_interval_max = MVMDIO_SMI_POLL_INTERVAL_MAX,
 };
 
 static int orion_mdio_read(struct mii_bus *bus, int mii_id,
-- 
2.9.4

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

* [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (5 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 06/11] net: mvmdio: put the poll intervals in the " Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:02   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support Antoine Tenart
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Add a check for the read and write smi operations, to ensure the
MII_ADDR_C45 bit isn't set. This will be needed as soon as the xSMI
support is added to the mvmdio driver.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index e4aa8e2d2e8a..fe6072aae0a6 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -126,6 +126,9 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 	u32 val;
 	int ret;
 
+	if (regnum & MII_ADDR_C45)
+		return -EOPNOTSUPP;
+
 	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
 		goto out;
@@ -157,6 +160,9 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	struct orion_mdio_dev *dev = bus->priv;
 	int ret;
 
+	if (regnum & MII_ADDR_C45)
+		return -EOPNOTSUPP;
+
 	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
 		goto out;
-- 
2.9.4

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

* [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (6 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:03   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths Antoine Tenart
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the xmdio xsmi interface support in the mvmdio driver.
This interface is used in Ethernet controllers on Marvell 370, 7k and 8k
(as of now). The xsmi interface supported by this driver complies with
the IEEE 802.3 clause 45. The xSMI interface is used by 10GbE devices.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 112 +++++++++++++++++++++++++++++++---
 1 file changed, 105 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index fe6072aae0a6..0888e50f6b17 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -23,6 +23,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/of_mdio.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
@@ -40,6 +41,15 @@
 #define  MVMDIO_ERR_INT_SMI_DONE	0x00000010
 #define MVMDIO_ERR_INT_MASK		0x0080
 
+#define MVMDIO_XSMI_MGNT_REG		0x0
+#define  MVMDIO_XSMI_PHYADDR_SHIFT	16
+#define  MVMDIO_XSMI_DEVADDR_SHIFT	21
+#define  MVMDIO_XSMI_WRITE_OPERATION	(0x5 << 26)
+#define  MVMDIO_XSMI_READ_OPERATION	(0x7 << 26)
+#define  MVMDIO_XSMI_READ_VALID		BIT(29)
+#define  MVMDIO_XSMI_BUSY		BIT(30)
+#define MVMDIO_XSMI_ADDR_REG		0x8
+
 /*
  * SMI Timeout measurements:
  * - Kirkwood 88F6281 (Globalscale Dreamplug): 45us to 95us (Interrupt)
@@ -49,6 +59,9 @@
 #define MVMDIO_SMI_POLL_INTERVAL_MIN	45
 #define MVMDIO_SMI_POLL_INTERVAL_MAX	55
 
+#define MVMDIO_XSMI_POLL_INTERVAL_MIN	150
+#define MVMDIO_XSMI_POLL_INTERVAL_MAX	160
+
 struct orion_mdio_dev {
 	void __iomem *regs;
 	struct clk *clk[3];
@@ -62,6 +75,11 @@ struct orion_mdio_dev {
 	wait_queue_head_t smi_busy_wait;
 };
 
+enum orion_mdio_bus_type {
+	BUS_TYPE_SMI,
+	BUS_TYPE_XSMI
+};
+
 struct orion_mdio_ops {
 	int (*is_done)(struct orion_mdio_dev *);
 	unsigned int poll_interval_min;
@@ -119,8 +137,8 @@ static const struct orion_mdio_ops orion_mdio_smi_ops = {
 	.poll_interval_max = MVMDIO_SMI_POLL_INTERVAL_MAX,
 };
 
-static int orion_mdio_read(struct mii_bus *bus, int mii_id,
-			   int regnum)
+static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id,
+			       int regnum)
 {
 	struct orion_mdio_dev *dev = bus->priv;
 	u32 val;
@@ -154,8 +172,8 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,
 	return ret;
 }
 
-static int orion_mdio_write(struct mii_bus *bus, int mii_id,
-			    int regnum, u16 value)
+static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
+				int regnum, u16 value)
 {
 	struct orion_mdio_dev *dev = bus->priv;
 	int ret;
@@ -177,6 +195,73 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	return ret;
 }
 
+static int orion_mdio_xsmi_is_done(struct orion_mdio_dev *dev)
+{
+	return !(readl(dev->regs + MVMDIO_XSMI_MGNT_REG) & MVMDIO_XSMI_BUSY);
+}
+
+static const struct orion_mdio_ops orion_mdio_xsmi_ops = {
+	.is_done = orion_mdio_xsmi_is_done,
+	.poll_interval_min = MVMDIO_XSMI_POLL_INTERVAL_MIN,
+	.poll_interval_max = MVMDIO_XSMI_POLL_INTERVAL_MAX,
+};
+
+static int orion_mdio_xsmi_read(struct mii_bus *bus, int mii_id,
+				int regnum)
+{
+	struct orion_mdio_dev *dev = bus->priv;
+	u16 dev_addr = (regnum >> 16) & GENMASK(4, 0);
+	int ret;
+
+	if (!(regnum & MII_ADDR_C45))
+		return -EOPNOTSUPP;
+
+	ret = orion_mdio_wait_ready(&orion_mdio_xsmi_ops, bus);
+	if (ret < 0)
+		return ret;
+
+	writel(regnum & GENMASK(15, 0), dev->regs + MVMDIO_XSMI_ADDR_REG);
+	writel((mii_id << MVMDIO_XSMI_PHYADDR_SHIFT) |
+	       (dev_addr << MVMDIO_XSMI_DEVADDR_SHIFT) |
+	       MVMDIO_XSMI_READ_OPERATION,
+	       dev->regs + MVMDIO_XSMI_MGNT_REG);
+
+	ret = orion_mdio_wait_ready(&orion_mdio_xsmi_ops, bus);
+	if (ret < 0)
+		return ret;
+
+	if (!(readl(dev->regs + MVMDIO_XSMI_MGNT_REG) &
+	      MVMDIO_XSMI_READ_VALID)) {
+		dev_err(bus->parent, "XSMI bus read not valid\n");
+		return -ENODEV;
+	}
+
+	return readl(dev->regs + MVMDIO_XSMI_MGNT_REG) & GENMASK(15, 0);
+}
+
+static int orion_mdio_xsmi_write(struct mii_bus *bus, int mii_id,
+				int regnum, u16 value)
+{
+	struct orion_mdio_dev *dev = bus->priv;
+	u16 dev_addr = (regnum >> 16) & GENMASK(4, 0);
+	int ret;
+
+	if (!(regnum & MII_ADDR_C45))
+		return -EOPNOTSUPP;
+
+	ret = orion_mdio_wait_ready(&orion_mdio_xsmi_ops, bus);
+	if (ret < 0)
+		return ret;
+
+	writel(regnum & GENMASK(15, 0), dev->regs + MVMDIO_XSMI_ADDR_REG);
+	writel((mii_id << MVMDIO_XSMI_PHYADDR_SHIFT) |
+	       (dev_addr << MVMDIO_XSMI_DEVADDR_SHIFT) |
+	       MVMDIO_XSMI_WRITE_OPERATION | value,
+	       dev->regs + MVMDIO_XSMI_MGNT_REG);
+
+	return 0;
+}
+
 static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)
 {
 	struct orion_mdio_dev *dev = dev_id;
@@ -194,11 +279,14 @@ static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)
 
 static int orion_mdio_probe(struct platform_device *pdev)
 {
+	enum orion_mdio_bus_type type;
 	struct resource *r;
 	struct mii_bus *bus;
 	struct orion_mdio_dev *dev;
 	int i, ret;
 
+	type = (enum orion_mdio_bus_type)of_device_get_match_data(&pdev->dev);
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!r) {
 		dev_err(&pdev->dev, "No SMI register address given\n");
@@ -210,9 +298,18 @@ static int orion_mdio_probe(struct platform_device *pdev)
 	if (!bus)
 		return -ENOMEM;
 
+	switch (type) {
+	case BUS_TYPE_SMI:
+		bus->read = orion_mdio_smi_read;
+		bus->write = orion_mdio_smi_write;
+		break;
+	case BUS_TYPE_XSMI:
+		bus->read = orion_mdio_xsmi_read;
+		bus->write = orion_mdio_xsmi_write;
+		break;
+	}
+
 	bus->name = "orion_mdio_bus";
-	bus->read = orion_mdio_read;
-	bus->write = orion_mdio_write;
 	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii",
 		 dev_name(&pdev->dev));
 	bus->parent = &pdev->dev;
@@ -302,7 +399,8 @@ static int orion_mdio_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id orion_mdio_match[] = {
-	{ .compatible = "marvell,orion-mdio" },
+	{ .compatible = "marvell,orion-mdio", .data = (void *)BUS_TYPE_SMI },
+	{ .compatible = "marvell,xmdio", .data = (void *)BUS_TYPE_XSMI },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, orion_mdio_match);
-- 
2.9.4

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

* [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (7 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 17:04   ` Florian Fainelli
  2017-06-14 15:49 ` [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible Antoine Tenart
  2017-06-14 15:49 ` [PATCH v4 11/11] arm64: marvell: dts: add xmdio nodes for 7k/8k Antoine Tenart
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Cosmetic patch simplifying the smi read and write error paths. It also
align their error paths with the ones of the xsmi functions.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 0888e50f6b17..c9798210fa0f 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -149,7 +149,7 @@ static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id,
 
 	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
 		(regnum << MVMDIO_SMI_PHY_REG_SHIFT)  |
@@ -158,18 +158,15 @@ static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id,
 
 	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	val = readl(dev->regs);
 	if (!(val & MVMDIO_SMI_READ_VALID)) {
 		dev_err(bus->parent, "SMI bus read not valid\n");
-		ret = -ENODEV;
-		goto out;
+		return -ENODEV;
 	}
 
-	ret = val & GENMASK(15, 0);
-out:
-	return ret;
+	return val & GENMASK(15, 0);
 }
 
 static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
@@ -183,7 +180,7 @@ static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
 
 	ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
 		(regnum << MVMDIO_SMI_PHY_REG_SHIFT)  |
@@ -191,8 +188,7 @@ static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
 		(value << MVMDIO_SMI_DATA_SHIFT)),
 	       dev->regs);
 
-out:
-	return ret;
+	return 0;
 }
 
 static int orion_mdio_xsmi_is_done(struct orion_mdio_dev *dev)
-- 
2.9.4

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

* [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (8 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  2017-06-14 16:35   ` Andrew Lunn
  2017-06-14 15:49 ` [PATCH v4 11/11] arm64: marvell: dts: add xmdio nodes for 7k/8k Antoine Tenart
  10 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

A new compatible for Marvell xMDIO interfaces was added into the Marvell
MDIO driver. Document this new compatible.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
index ccdabdcc8618..b93a5b5a0472 100644
--- a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
+++ b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
@@ -1,12 +1,12 @@
 * Marvell MDIO Ethernet Controller interface
 
 The Ethernet controllers of the Marvel Kirkwood, Dove, Orion5x,
-MV78xx0, Armada 370 and Armada XP have an identical unit that provides
-an interface with the MDIO bus. This driver handles this MDIO
-interface.
+MV78xx0, Armada 370, Armada XP, Armada 7k and Armada 8k have an
+identical unit that provides an interface with the MDIO bus or
+with the xMDIO bus. This driver handles these interfaces.
 
 Required properties:
-- compatible: "marvell,orion-mdio"
+- compatible: "marvell,orion-mdio" or "marvell,xmdio"
 - reg: address and length of the MDIO registers.  When an interrupt is
   not present, the length is the size of the SMI register (4 bytes)
   otherwise it must be 0x84 bytes to cover the interrupt control
-- 
2.9.4

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

* [PATCH v4 11/11] arm64: marvell: dts: add xmdio nodes for 7k/8k
  2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
                   ` (9 preceding siblings ...)
  2017-06-14 15:49 ` [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible Antoine Tenart
@ 2017-06-14 15:49 ` Antoine Tenart
  10 siblings, 0 replies; 24+ messages in thread
From: Antoine Tenart @ 2017-06-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

Add the description of the xMDIO bus for the Marvell Armada 7k and
Marvell Armada 8k; for both CP110 slave and master. This bus is found
on Marvell Ethernet controllers and provides an interface with the
xMDIO bus.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi | 8 ++++++++
 arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi b/arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
index 576e825585c9..8b512b75aea9 100644
--- a/arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
+++ b/arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
@@ -97,6 +97,14 @@
 				clocks = <&cpm_syscon0 1 9>, <&cpm_syscon0 1 5>;
 			};
 
+			cpm_xmdio: mdio at 12a600 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "marvell,xmdio";
+				reg = <0x12a600 0x10>;
+				status = "disabled";
+			};
+
 			cpm_syscon0: system-controller at 440000 {
 				compatible = "marvell,cp110-system-controller0",
 					     "syscon";
diff --git a/arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi b/arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
index 797208a11f9d..bd0c0e03edd2 100644
--- a/arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
+++ b/arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
@@ -104,6 +104,14 @@
 				clocks = <&cps_syscon0 1 9>, <&cps_syscon0 1 5>;
 			};
 
+			cps_xmdio: mdio at 12a600 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "marvell,xmdio";
+				reg = <0x12a600 0x10>;
+				status = "disabled";
+			};
+
 			cps_syscon0: system-controller at 440000 {
 				compatible = "marvell,cp110-system-controller0",
 					     "syscon";
-- 
2.9.4

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

* [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible
  2017-06-14 15:49 ` [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible Antoine Tenart
@ 2017-06-14 16:35   ` Andrew Lunn
  2017-06-15  6:55     ` Antoine Tenart
  0 siblings, 1 reply; 24+ messages in thread
From: Andrew Lunn @ 2017-06-14 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 14, 2017 at 05:49:10PM +0200, Antoine Tenart wrote:
> A new compatible for Marvell xMDIO interfaces was added into the Marvell
> MDIO driver. Document this new compatible.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---
>  Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
> index ccdabdcc8618..b93a5b5a0472 100644
> --- a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
> +++ b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
> @@ -1,12 +1,12 @@
>  * Marvell MDIO Ethernet Controller interface
>  
>  The Ethernet controllers of the Marvel Kirkwood, Dove, Orion5x,
> -MV78xx0, Armada 370 and Armada XP have an identical unit that provides
> -an interface with the MDIO bus. This driver handles this MDIO
> -interface.
> +MV78xx0, Armada 370, Armada XP, Armada 7k and Armada 8k have an
> +identical unit that provides an interface with the MDIO bus or
> +with the xMDIO bus. This driver handles these interfaces.

Hi Antoine

This patches is looking good now. One nit. The description above
suggests Kirkwood, Dove, Orion5x, MV78xx0, Armada 370 and Armada XP
all have xmdio. Maybe better wording would be:

The Ethernet controllers of the Marvel Kirkwood, Dove, Orion5x,
MV78xx0, Armada 370, Armada XP, Armada 7k and Armada 8k have an
identical unit that provides an interface with the MDIO bus.
Additionally, Armada 7k and Armada 8k has a second unit which
provides an interface with the xMDIO bus. This driver handles
these interfaces.

      Andrew

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

* [PATCH v4 04/11] net: mvmdio: remove duplicate locking
  2017-06-14 15:49 ` [PATCH v4 04/11] net: mvmdio: remove duplicate locking Antoine Tenart
@ 2017-06-14 17:01   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> From: Russell King <rmk+kernel@armlinux.org.uk>
> 
> The MDIO layer already provides per-bus locking, so there's no need for
> MDIO bus drivers to do their own internal locking.  Remove this.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 05/11] net: mvmdio: introduce an ops structure
  2017-06-14 15:49 ` [PATCH v4 05/11] net: mvmdio: introduce an ops structure Antoine Tenart
@ 2017-06-14 17:02   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> Introduce an ops structure to add an indirection on the is_done
> function, as this is needed to add the xMDIO support later.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 06/11] net: mvmdio: put the poll intervals in the ops structure
  2017-06-14 15:49 ` [PATCH v4 06/11] net: mvmdio: put the poll intervals in the " Antoine Tenart
@ 2017-06-14 17:02   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> Put the two poll intervals (min and max) in the driver's ops
> structure. This is needed to add the xmdio support later.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations
  2017-06-14 15:49 ` [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations Antoine Tenart
@ 2017-06-14 17:02   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> Add a check for the read and write smi operations, to ensure the
> MII_ADDR_C45 bit isn't set. This will be needed as soon as the xSMI
> support is added to the mvmdio driver.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support
  2017-06-14 15:49 ` [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support Antoine Tenart
@ 2017-06-14 17:03   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> This patch adds the xmdio xsmi interface support in the mvmdio driver.
> This interface is used in Ethernet controllers on Marvell 370, 7k and 8k
> (as of now). The xsmi interface supported by this driver complies with
> the IEEE 802.3 clause 45. The xSMI interface is used by 10GbE devices.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Nice!

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths
  2017-06-14 15:49 ` [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths Antoine Tenart
@ 2017-06-14 17:04   ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2017-06-14 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/14/2017 08:49 AM, Antoine Tenart wrote:
> Cosmetic patch simplifying the smi read and write error paths. It also
> align their error paths with the ones of the xsmi functions.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible
  2017-06-14 16:35   ` Andrew Lunn
@ 2017-06-15  6:55     ` Antoine Tenart
  2017-06-15 13:12       ` Andrew Lunn
  0 siblings, 1 reply; 24+ messages in thread
From: Antoine Tenart @ 2017-06-15  6:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andrew,

On Wed, Jun 14, 2017 at 06:35:37PM +0200, Andrew Lunn wrote:
> On Wed, Jun 14, 2017 at 05:49:10PM +0200, Antoine Tenart wrote:
> >  
> >  The Ethernet controllers of the Marvel Kirkwood, Dove, Orion5x,
> > -MV78xx0, Armada 370 and Armada XP have an identical unit that provides
> > -an interface with the MDIO bus. This driver handles this MDIO
> > -interface.
> > +MV78xx0, Armada 370, Armada XP, Armada 7k and Armada 8k have an
> > +identical unit that provides an interface with the MDIO bus or
> > +with the xMDIO bus. This driver handles these interfaces.
> 
> This patches is looking good now. One nit. The description above
> suggests Kirkwood, Dove, Orion5x, MV78xx0, Armada 370 and Armada XP
> all have xmdio. Maybe better wording would be:
> 
> The Ethernet controllers of the Marvel Kirkwood, Dove, Orion5x,
> MV78xx0, Armada 370, Armada XP, Armada 7k and Armada 8k have an
> identical unit that provides an interface with the MDIO bus.
> Additionally, Armada 7k and Armada 8k has a second unit which
> provides an interface with the xMDIO bus. This driver handles
> these interfaces.

Agreed, your description is better :)
I'll respin this patch only, if there is no other comment.

Thanks!
Antoine

-- 
Antoine T?nart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170615/b4fb6e80/attachment.sig>

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

* [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible
  2017-06-15  6:55     ` Antoine Tenart
@ 2017-06-15 13:12       ` Andrew Lunn
  2017-06-15 13:22         ` Antoine Tenart
  0 siblings, 1 reply; 24+ messages in thread
From: Andrew Lunn @ 2017-06-15 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

> Agreed, your description is better :)
> I'll respin this patch only, if there is no other comment.

I assume these patches are going via net-next? Dave will not like a
respin of a single patch. You need to post them all again.

       Andrew

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

* [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible
  2017-06-15 13:12       ` Andrew Lunn
@ 2017-06-15 13:22         ` Antoine Tenart
  0 siblings, 0 replies; 24+ messages in thread
From: Antoine Tenart @ 2017-06-15 13:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andrew,

On Thu, Jun 15, 2017 at 03:12:32PM +0200, Andrew Lunn wrote:
> > Agreed, your description is better :)
> > I'll respin this patch only, if there is no other comment.
> 
> I assume these patches are going via net-next? Dave will not like a
> respin of a single patch. You need to post them all again.

OK, I'll respin the whole series with the net-next tag.

Antoine

-- 
Antoine T?nart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170615/d9bfe5d0/attachment.sig>

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

* [PATCH v4 03/11] net: mvmdio: use GENMASK for masks
  2017-06-14 15:49 ` [PATCH v4 03/11] net: mvmdio: use GENMASK for masks Antoine Tenart
@ 2017-06-19 11:57   ` David Laight
  2017-06-19 14:49     ` David Miller
  0 siblings, 1 reply; 24+ messages in thread
From: David Laight @ 2017-06-19 11:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Antoine Tenart
> Sent: 14 June 2017 16:49
> Cosmetic patch to use the GENMASK helper for masks.
...
> -	ret = val & 0xFFFF;
> +	ret = val & GENMASK(15, 0);

My 2c: It isn't at all clear to me that changes like this in anyway
improve the code readability.
In some sense the '15' should be a named constant - but that just makes
it even less obvious what is going on.

	David

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

* [PATCH v4 03/11] net: mvmdio: use GENMASK for masks
  2017-06-19 11:57   ` David Laight
@ 2017-06-19 14:49     ` David Miller
  0 siblings, 0 replies; 24+ messages in thread
From: David Miller @ 2017-06-19 14:49 UTC (permalink / raw)
  To: linux-arm-kernel

From: David Laight <David.Laight@ACULAB.COM>
Date: Mon, 19 Jun 2017 11:57:51 +0000

> From: Antoine Tenart
>> Sent: 14 June 2017 16:49
>> Cosmetic patch to use the GENMASK helper for masks.
> ...
>> -	ret = val & 0xFFFF;
>> +	ret = val & GENMASK(15, 0);
> 
> My 2c: It isn't at all clear to me that changes like this in anyway
> improve the code readability.
> In some sense the '15' should be a named constant - but that just makes
> it even less obvious what is going on.

I agree, a hexidecimal mask of 0xffff is 100 times more readable and
understandable to me than "SOME_MACRO(x, y)".

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

end of thread, other threads:[~2017-06-19 14:49 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14 15:49 [PATCH v4 00/11] net: mvmdio: add xMDIO xSMI support Antoine Tenart
2017-06-14 15:49 ` [PATCH v4 01/11] net: mvmdio: reorder headers alphabetically Antoine Tenart
2017-06-14 15:49 ` [PATCH v4 02/11] net: mvmdio: use tabs for defines Antoine Tenart
2017-06-14 15:49 ` [PATCH v4 03/11] net: mvmdio: use GENMASK for masks Antoine Tenart
2017-06-19 11:57   ` David Laight
2017-06-19 14:49     ` David Miller
2017-06-14 15:49 ` [PATCH v4 04/11] net: mvmdio: remove duplicate locking Antoine Tenart
2017-06-14 17:01   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 05/11] net: mvmdio: introduce an ops structure Antoine Tenart
2017-06-14 17:02   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 06/11] net: mvmdio: put the poll intervals in the " Antoine Tenart
2017-06-14 17:02   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 07/11] net: mvmdio: check the MII_ADDR_C45 bit is not set for smi operations Antoine Tenart
2017-06-14 17:02   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 08/11] net: mvmdio: add xmdio xsmi support Antoine Tenart
2017-06-14 17:03   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 09/11] net: mvmdio: simplify the smi read and write error paths Antoine Tenart
2017-06-14 17:04   ` Florian Fainelli
2017-06-14 15:49 ` [PATCH v4 10/11] dt-bindings: orion-mdio: document the new xmdio compatible Antoine Tenart
2017-06-14 16:35   ` Andrew Lunn
2017-06-15  6:55     ` Antoine Tenart
2017-06-15 13:12       ` Andrew Lunn
2017-06-15 13:22         ` Antoine Tenart
2017-06-14 15:49 ` [PATCH v4 11/11] arm64: marvell: dts: add xmdio nodes for 7k/8k Antoine Tenart

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).