Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
You can probably safely merge patches 1 to 4 if Thomas agrees, and we will
see what kind of feeback I get on patch 5.
Florian Fainelli (5):
net: mvmdio: unmap base register address at driver removal
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
net: mvmdio: allow Device Tree and platform device to coexist
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 84 +++++++--
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 +-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 187 +-------------------
drivers/net/ethernet/marvell/mvmdio.c | 136 +++++++++++---
7 files changed, 226 insertions(+), 219 deletions(-)
--
1.7.10.4
Fix the driver remove callback to unmap the base register address and
not leak this mapping after the driver has been removed.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
drivers/net/ethernet/marvell/mvmdio.c | 3 +++
1 file changed, 3 insertions(+)
This patch changes the Marvell MDIO driver to be registered by using
both Device Tree and platform device methods. The driver voluntarily
does not use devm_ioremap() to share the same error path for Device Tree
and non-Device Tree cases.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
drivers/net/ethernet/marvell/mvmdio.c | 46 +++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 13 deletions(-)
@@ -219,18 +220,31 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->regs=of_iomap(pdev->dev.of_node,0);-if(!dev->regs){-dev_err(&pdev->dev,"No SMI register address given in DT\n");-kfree(bus->irq);-mdiobus_free(bus);-return-ENODEV;-}-dev->err_interrupt=NO_IRQ;init_waitqueue_head(&dev->smi_busy_wait);-dev->err_interrupt=irq_of_parse_and_map(pdev->dev.of_node,0);+if(pdev->dev.of_node){+dev->regs=of_iomap(pdev->dev.of_node,0);+if(!dev->regs){+dev_err(&pdev->dev,"No SMI register address given in DT\n");+ret=-ENODEV;+gotoout_free;+}++dev->err_interrupt=irq_of_parse_and_map(pdev->dev.of_node,0);+}else{+r=platform_get_resource(pdev,IORESOURCE_MEM,0);++dev->regs=ioremap(r->start,resource_size(r));+if(!dev->regs){+dev_err(&pdev->dev,"No SMI register address given\n");+ret=-ENODEV;+gotoout_free;+}++dev->err_interrupt=platform_get_irq(pdev,0);+}+if(dev->err_interrupt!=NO_IRQ){ret=devm_request_irq(&pdev->dev,dev->err_interrupt,orion_mdio_err_irq,
@@ -242,18 +256,24 @@ static int orion_mdio_probe(struct platform_device *pdev)mutex_init(&dev->lock);-ret=of_mdiobus_register(bus,np);+if(np)+ret=of_mdiobus_register(bus,np);+else+ret=mdiobus_register(bus);if(ret<0){dev_err(&pdev->dev,"Cannot register MDIO bus (%d)\n",ret);iounmap(dev->regs);-kfree(bus->irq);-mdiobus_free(bus);-returnret;+gotoout_free;}platform_set_drvdata(pdev,bus);return0;++out_free:+kfree(bus->irq);+mdiobus_free(bus);+returnret;}staticintorion_mdio_remove(structplatform_device*pdev)
This patch enhances the "mvmdio" to support a SMI error/done interrupt
line which can be used along with a wait queue instead of doing
busy-waiting on the registers. This is a feature which is available in
the mv643xx_eth SMI code and thus reduces again the gap between the two.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
drivers/net/ethernet/marvell/mvmdio.c | 83 +++++++++++++++++---
2 files changed, 75 insertions(+), 11 deletions(-)
@@ -9,6 +9,9 @@ Required properties: - compatible: "marvell,orion-mdio" - reg: address and length of the SMI register+Optional properties:+- interrupts: interrupt line number for the SMI error/done interrupt+ The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
@@ -36,12 +40,28 @@#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 0x0080structorion_mdio_dev{structmutexlock;void__iomem*regs;+/*+*Ifwehaveaccesstotheerrorinterruptpin(whichis+*somewhatmisnamedasitnotonlyreflectsinternalerrors+*butalsoreflectsSMIcompletion),usethattowaitfor+*SMIaccesscompletioninsteadofpollingtheSMIbusybit.+*/+interr_interrupt;+wait_queue_head_tsmi_busy_wait;};+staticintorion_mdio_smi_is_done(structorion_mdio_dev*dev)+{+return!(readl(dev->regs)&MVMDIO_SMI_BUSY);+}+/* Wait for the SMI unit to be ready for another operation*/staticintorion_mdio_wait_ready(structmii_bus*bus)
@@ -50,19 +70,30 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)intcount;u32val;-count=0;-while(1){-val=readl(dev->regs);-if(!(val&MVMDIO_SMI_BUSY))-break;--if(count>100){-dev_err(bus->parent,"Timeout: SMI busy for too long\n");-return-ETIMEDOUT;+if(dev->err_interrupt==NO_IRQ){+count=0;+while(1){+val=readl(dev->regs);+if(!(val&MVMDIO_SMI_BUSY))+break;++if(count>100){+dev_err(bus->parent,+"Timeout: SMI busy for too long\n");+return-ETIMEDOUT;+}++udelay(10);+count++;}+}-udelay(10);-count++;+if(!orion_mdio_smi_is_done(dev)){+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;}return0;
@@ -141,6 +172,21 @@ static int orion_mdio_reset(struct mii_bus *bus)return0;}+staticirqreturn_torion_mdio_err_irq(intirq,void*dev_id)+{+structorion_mdio_dev*dev=dev_id;++if(readl(dev->regs+MVMDIO_ERR_INT_CAUSE)&+MVMDIO_ERR_INT_SMI_DONE){+writel(~MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_CAUSE);+wake_up(&dev->smi_busy_wait);+returnIRQ_HANDLED;+}++returnIRQ_NONE;+}+staticintorion_mdio_probe(structplatform_device*pdev){structdevice_node*np=pdev->dev.of_node;
@@ -181,6 +227,19 @@ static int orion_mdio_probe(struct platform_device *pdev)return-ENODEV;}+dev->err_interrupt=NO_IRQ;+init_waitqueue_head(&dev->smi_busy_wait);++dev->err_interrupt=irq_of_parse_and_map(pdev->dev.of_node,0);+if(dev->err_interrupt!=NO_IRQ){+ret=devm_request_irq(&pdev->dev,dev->err_interrupt,+orion_mdio_err_irq,+IRQF_SHARED,pdev->name,dev);+if(!ret)+writel(MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_MASK);+}+mutex_init(&dev->lock);ret=of_mdiobus_register(bus,np);
@@ -202,6 +261,8 @@ static int orion_mdio_remove(struct platform_device *pdev)structmii_bus*bus=platform_get_drvdata(pdev);structorion_mdio_dev*dev=bus->priv;+writel(0,dev->regs+MVMDIO_ERR_INT_MASK);+free_irq(dev->err_interrupt,dev);mdiobus_unregister(bus);kfree(bus->irq);mdiobus_free(bus);
This patch renames the base register cookie in the mvmdio drive from
"smireg" to "regs" since a subsequent patch is going to use an ioremap()
cookie whose size is larger than a single register of 4 bytes. No
functionnal code change introduced.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
drivers/net/ethernet/marvell/mvmdio.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
@@ -39,7 +39,7 @@structorion_mdio_dev{structmutexlock;-void__iomem*smireg;+void__iomem*regs;};/* Wait for the SMI unit to be ready for another operation
@@ -52,7 +52,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(!(val&MVMDIO_SMI_BUSY))break;
@@ -87,12 +87,12 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,writel(((mii_id<<MVMDIO_SMI_PHY_ADDR_SHIFT)|(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_READ_OPERATION),-dev->smireg);+dev->regs);/* Wait for the value to become available */count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(val&MVMDIO_SMI_READ_VALID)break;
@@ -129,7 +129,7 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_WRITE_OPERATION|(value<<MVMDIO_SMI_DATA_SHIFT)),-dev->smireg);+dev->regs);mutex_unlock(&dev->lock);
@@ -173,8 +173,8 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->smireg=of_iomap(pdev->dev.of_node,0);-if(!dev->smireg){+dev->regs=of_iomap(pdev->dev.of_node,0);+if(!dev->regs){dev_err(&pdev->dev,"No SMI register address given in DT\n");kfree(bus->irq);mdiobus_free(bus);
@@ -186,7 +186,7 @@ static int orion_mdio_probe(struct platform_device *pdev)ret=of_mdiobus_register(bus,np);if(ret<0){dev_err(&pdev->dev,"Cannot register MDIO bus (%d)\n",ret);-iounmap(dev->smireg);+iounmap(dev->regs);kfree(bus->irq);mdiobus_free(bus);returnret;
@@ -205,7 +205,7 @@ static int orion_mdio_remove(struct platform_device *pdev)mdiobus_unregister(bus);kfree(bus->irq);mdiobus_free(bus);-iounmap(dev->smireg);+iounmap(dev->regs);return0;}
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 84 +++++++++++--
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 187 ++--------------------------
5 files changed, 113 insertions(+), 193 deletions(-)
@@ -1080,98 +1053,6 @@ static void txq_set_fixed_prio_mode(struct tx_queue *txq)}-/* mii management interface *************************************************/-staticirqreturn_tmv643xx_eth_err_irq(intirq,void*dev_id)-{-structmv643xx_eth_shared_private*msp=dev_id;--if(readl(msp->base+ERR_INT_CAUSE)&ERR_INT_SMI_DONE){-writel(~ERR_INT_SMI_DONE,msp->base+ERR_INT_CAUSE);-wake_up(&msp->smi_busy_wait);-returnIRQ_HANDLED;-}--returnIRQ_NONE;-}--staticintsmi_is_done(structmv643xx_eth_shared_private*msp)-{-return!(readl(msp->base+SMI_REG)&SMI_BUSY);-}--staticintsmi_wait_ready(structmv643xx_eth_shared_private*msp)-{-if(msp->err_interrupt==NO_IRQ){-inti;--for(i=0;!smi_is_done(msp);i++){-if(i==10)-return-ETIMEDOUT;-msleep(10);-}--return0;-}--if(!smi_is_done(msp)){-wait_event_timeout(msp->smi_busy_wait,smi_is_done(msp),-msecs_to_jiffies(100));-if(!smi_is_done(msp))-return-ETIMEDOUT;-}--return0;-}--staticintsmi_bus_read(structmii_bus*bus,intaddr,intreg)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;-intret;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_READ|(reg<<21)|(addr<<16),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--ret=readl(smi_reg);-if(!(ret&SMI_READ_VALID)){-pr_warn("SMI bus read not valid\n");-return-ENODEV;-}--returnret&0xffff;-}--staticintsmi_bus_write(structmii_bus*bus,intaddr,intreg,u16val)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_WRITE|(reg<<21)|-(addr<<16)|(val&0xffff),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--return0;-}--/* statistics ***************************************************************/staticstructnet_device_stats*mv643xx_eth_get_stats(structnet_device*dev){
@@ -2611,47 +2492,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)gotoout_free;/*-*SetupandregisterSMIbus.-*/-if(pd==NULL||pd->shared_smi==NULL){-msp->smi_bus=mdiobus_alloc();-if(msp->smi_bus==NULL)-gotoout_unmap;--msp->smi_bus->priv=msp;-msp->smi_bus->name="mv643xx_eth smi";-msp->smi_bus->read=smi_bus_read;-msp->smi_bus->write=smi_bus_write,-snprintf(msp->smi_bus->id,MII_BUS_ID_SIZE,"%s-%d",-pdev->name,pdev->id);-msp->smi_bus->parent=&pdev->dev;-msp->smi_bus->phy_mask=0xffffffff;-if(mdiobus_register(msp->smi_bus)<0)-gotoout_free_mii_bus;-msp->smi=msp;-}else{-msp->smi=platform_get_drvdata(pd->shared_smi);-}--msp->err_interrupt=NO_IRQ;-init_waitqueue_head(&msp->smi_busy_wait);--/*-*Checkwhethertheerrorinterruptishookedup.-*/-res=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(res!=NULL){-interr;--err=request_irq(res->start,mv643xx_eth_err_irq,-IRQF_SHARED,"mv643xx_eth",msp);-if(!err){-writel(ERR_INT_SMI_DONE,msp->base+ERR_INT_MASK);-msp->err_interrupt=res->start;-}-}--/**(Re-)programMBUSremappingwindowsifweareaskedto.*/dram=mv_mbus_dram_info();
@@ -2666,10 +2506,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)return0;-out_free_mii_bus:-mdiobus_free(msp->smi_bus);-out_unmap:-iounmap(msp->base);out_free:kfree(msp);out:
@@ -2766,17 +2595,19 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,num=1;}+/* Attempt to connect to the PHY using orion-mdio */phydev=NULL;for(i=0;i<num;i++){intaddr=(start+i)&0x1f;-if(bus->phy_map[addr]==NULL)-mdiobus_scan(bus,addr);+snprintf(phy_id,sizeof(phy_id),PHY_ID_FMT,+"orion-mdio-mii",addr);-if(phydev==NULL){-phydev=bus->phy_map[addr];-if(phydev!=NULL)-phy_addr_set(mp,addr);+phydev=phy_connect(mp->dev,phy_id,NULL,+PHY_INTERFACE_MODE_GMII);+if(!IS_ERR(phydev)){+phy_addr_set(mp,addr);+break;}}
From: Thomas Petazzoni <hidden> Date: 2013-01-29 15:32:52
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:04 +0100, Florian Fainelli wrote:
Fix the driver remove callback to unmap the base register address and
not leak this mapping after the driver has been removed.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
What about using devm_request_and_ioremap() instead, in order to get
automatic unmap on error and in the ->remove() path?
But maybe it won't work because this memory range is claimed both by
the MDIO driver and the Ethernet driver itself. In that case, you could
use devm_ioremap().
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
From: Thomas Petazzoni <hidden> Date: 2013-01-29 15:34:16
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:05 +0100, Florian Fainelli wrote:
This patch renames the base register cookie in the mvmdio drive from
"smireg" to "regs" since a subsequent patch is going to use an ioremap()
cookie whose size is larger than a single register of 4 bytes. No
functionnal code change introduced.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Thomas Petazzoni <redacted>
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:04 +0100, Florian Fainelli wrote:
quoted
Fix the driver remove callback to unmap the base register address and
not leak this mapping after the driver has been removed.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
What about using devm_request_and_ioremap() instead, in order to get
automatic unmap on error and in the ->remove() path?
Right now, you are using of_iomap() which eases the task of fetching the
resource and getting an ioremap cookie, which I why I kept that.
But maybe it won't work because this memory range is claimed both by
the MDIO driver and the Ethernet driver itself. In that case, you could
use devm_ioremap().
Then we would loose the facility of of_iomap(), but fair enough, it can
be inserted as a patch in this serie.
Thanks
--
Florian
@@ -36,12 +40,28 @@ #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 struct orion_mdio_dev { struct mutex lock; void __iomem *regs;+ /*+ * If we have access to the error interrupt pin (which is+ * somewhat misnamed as it not only reflects internal errors+ * but also reflects SMI completion), use that to wait for+ * SMI access completion instead of polling the SMI busy bit.+ */+ int err_interrupt;+ 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);+}+ /* Wait for the SMI unit to be ready for another operation */ static int orion_mdio_wait_ready(struct mii_bus *bus)
@@ -50,19 +70,30 @@ static int orion_mdio_wait_ready(struct mii_bus *bus) int count; u32 val;- count = 0;- while (1) {- val = readl(dev->regs);- if (!(val & MVMDIO_SMI_BUSY))- break;-- if (count > 100) {- dev_err(bus->parent, "Timeout: SMI busy for too long\n");- return -ETIMEDOUT;+ if (dev->err_interrupt == NO_IRQ) {+ count = 0;+ while (1) {+ val = readl(dev->regs);+ if (!(val & MVMDIO_SMI_BUSY))+ break;
What about using your new orion_mdio_smi_is_done() function here?
+
+ if (count > 100) {
+ dev_err(bus->parent,
+ "Timeout: SMI busy for too long\n");
+ return -ETIMEDOUT;
+ }
+
+ udelay(10);
+ count++;
}
+ }
- udelay(10);
- count++;
+ if (!orion_mdio_smi_is_done(dev)) {
Maybe it should be in an else if block so that the waitqueue case is
only considered if there is an IRQ registered? Of course practically
speaking, it's OK because if there is no IRQ, we'll wait in the polling
loop above, and either exit from the function on timeout, or continue
on success. But it still would make the code a little bit clearer, I'd
say.
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
From: Thomas Petazzoni <hidden> Date: 2013-01-29 15:49:10
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:07 +0100, Florian Fainelli wrote:
This patch changes the Marvell MDIO driver to be registered by using
both Device Tree and platform device methods. The driver voluntarily
does not use devm_ioremap() to share the same error path for Device Tree
and non-Device Tree cases.
Not sure why you think devm_ioremap() can't be used here. Maybe I'm
missing something, but could you explain? If you use devm_ioremap(),
then basically you don't need to do anything in the error path
regarding to the I/O mapping... since it's the whole purpose of the
devm_*() stuff to automagically undo things in the error case, and in
the ->remove() code.
- dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ if (pdev->dev.of_node) {
+ dev->regs = of_iomap(pdev->dev.of_node, 0);
+ if (!dev->regs) {
+ dev_err(&pdev->dev, "No SMI register address given in DT\n");
+ ret = -ENODEV;
+ goto out_free;
+ }
+
+ dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ } else {
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+ dev->regs = ioremap(r->start, resource_size(r));
+ if (!dev->regs) {
+ dev_err(&pdev->dev, "No SMI register address given\n");
+ ret = -ENODEV;
+ goto out_free;
+ }
+
+ dev->err_interrupt = platform_get_irq(pdev, 0);
+ }
I think you can do a devm_ioremap() and a platform_get_irq() in both
cases here, and therefore keep the code common between the DT case and
the !DT case.
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
From: Thomas Petazzoni <hidden> Date: 2013-01-29 16:01:40
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:08 +0100, Florian Fainelli wrote:
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 84 +++++++++++--
In this file, there was one "MV643XX_ETH_SHARED_NAME" platform_device
registered for each network interface. Why? If the driver is shared,
isn't the whole idea to register it only once?
In any case, one of the idea of separating the mvmdio driver from the
mvneta driver in the first place is that there should be only one
instance of the mvmdio device, even if there are multiple network
interfaces. The reason is that from a HW point of the view, the MDIO
unit is shared between the network interfaces. If you look at
armada-370-xp.dtsi, there is only one mvmdio device registered, and two
network interfaces (using the mvneta driver) that are registered (and
actually up to four network interfaces can exist, they are added by
some other .dtsi files depending on the specific SoC).
So I don't think there should be one instance of the mvmdio per network
interface.
Also, I am wondering what's left in this MV643XX_ETH_SHARED_NAME driver
once the MDIO stuff has been pulled out in a separate driver? I think
the whole point of this work should be to get rid of this
MV643XX_ETH_SHARED_NAME driver, no?
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Dear Florian Fainelli,
On Tue, 29 Jan 2013 16:24:08 +0100, Florian Fainelli wrote:
quoted
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 84 +++++++++++--
In this file, there was one "MV643XX_ETH_SHARED_NAME" platform_device
registered for each network interface. Why? If the driver is shared,
isn't the whole idea to register it only once?
It looks like I introduced two redundant mvmdio instances as ge01 refers
to the ge00 smi bus (the same applies to ge11 and ge10). Thanks for
spotting this.
In any case, one of the idea of separating the mvmdio driver from the
mvneta driver in the first place is that there should be only one
instance of the mvmdio device, even if there are multiple network
interfaces. The reason is that from a HW point of the view, the MDIO
unit is shared between the network interfaces. If you look at
armada-370-xp.dtsi, there is only one mvmdio device registered, and two
network interfaces (using the mvneta driver) that are registered (and
actually up to four network interfaces can exist, they are added by
some other .dtsi files depending on the specific SoC).
So I don't think there should be one instance of the mvmdio per network
interface.
Also, I am wondering what's left in this MV643XX_ETH_SHARED_NAME driver
once the MDIO stuff has been pulled out in a separate driver? I think
the whole point of this work should be to get rid of this
MV643XX_ETH_SHARED_NAME driver, no?
If you take a closer look at mv643xx_eth you will see that the "shared"
driver still handles the mconf bus window configuration, which is not
abstracted yet. Besides that, I would rather do it step by step.
--
Florian
From: Thomas Petazzoni <hidden> Date: 2013-01-29 16:46:22
Dear Florian Fainelli,
On Tue, 29 Jan 2013 17:27:56 +0100, Florian Fainelli wrote:
It looks like I introduced two redundant mvmdio instances as ge01
refers to the ge00 smi bus (the same applies to ge11 and ge10).
Thanks for spotting this.
Ok, good.
If you take a closer look at mv643xx_eth you will see that the
"shared" driver still handles the mconf bus window configuration,
which is not abstracted yet.
Indeed, I've seen that. But I don't understand why it's done in the
mv643xx_eth_shared_probe(). The mbus window configuration registers are
per-network interface, so this call to mv643xx_eth_conf_mbus_windows()
could presumably be done in mv643xx_eth_probe().
At least in mvneta, we have the same registers, and we do their
initialization in the driver normal (and only) ->probe() routine.
Besides that, I would rather do it step by step.
Yes, agreed. But I think it would be good to have followed patches that
progressively get rid of the shared driver thing, as it will help in
bringing a proper DT binding in the mv643xx_eth driver. But it
certainly doesn't need to be part of this specific patch.
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
From: Jason Gunthorpe <hidden> Date: 2013-01-29 17:59:27
On Tue, Jan 29, 2013 at 04:24:07PM +0100, Florian Fainelli wrote:
- dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ if (pdev->dev.of_node) {
+ dev->regs = of_iomap(pdev->dev.of_node, 0);
+ if (!dev->regs) {
+ dev_err(&pdev->dev, "No SMI register address given in DT\n");
+ ret = -ENODEV;
+ goto out_free;
+ }
+
+ dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ } else {
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+ dev->regs = ioremap(r->start, resource_size(r));
+ if (!dev->regs) {
+ dev_err(&pdev->dev, "No SMI register address given\n");
+ ret = -ENODEV;
+ goto out_free;
+ }
+
+ dev->err_interrupt = platform_get_irq(pdev, 0);
+ }
Why do you have these different paths for OF and platform? AFAIK these
days when a OF device is automatically converted into a platform
device all the struct resources are created too, so you can't you just
use platform_get_resource and devm_request_and_ioremap for both flows?
Ditto for the interrupt - platform_get_irq should work in both cases?
Jason
From: Jason Gunthorpe <hidden> Date: 2013-01-29 18:13:16
On Tue, Jan 29, 2013 at 04:24:08PM +0100, Florian Fainelli wrote:
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Can you finish off this job by making the mv643xx_eth driver accept
the standard phy-handle OF property instead of using a phy address?
Ie the end result should be something like:
smi0: mdio@72000 {
device_type = "mdio";
compatible = "marvell,orion-mdio";
reg = <0x72004 0x4>;
#address-cells = <1>;
#size-cells = <0>;
PHY1: ethernet-phy@1 {
reg = <1>;
device_type = "ethernet-phy";
phy-id = <0x01410e90>;
};
};
egiga0 {
device_type = "network";
compatible = "marvell,mv643xx-eth";
reg = <0x72000 0x4000>;
port_number = <0>;
phy-handle = <&PHY1>;
interrupts = <11>;
local-mac-address = [000000000002]; /* Filled by boot loader */
};
Regards,
Jason
Le mardi 29 janvier 2013 19:13:06, Jason Gunthorpe a =E9crit :
On Tue, Jan 29, 2013 at 04:24:08PM +0100, Florian Fainelli wrote:
quoted
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
=20
Can you finish off this job by making the mv643xx_eth driver accept
the standard phy-handle OF property instead of using a phy address?
I can certainly do that, at the same time we need to continue supporting th=
e=20
"old" platform device style registration without breaking them (PowerPC in=
=20
particular, and the hopefully yet to be converted orion5x). So the phy_scan=
()=20
as I modified it will probably still be there.
=20
Why do you have these different paths for OF and platform? AFAIK these
days when a OF device is automatically converted into a platform
device all the struct resources are created too, so you can't you just
use platform_get_resource and devm_request_and_ioremap for both flows?
=20
Ditto for the interrupt - platform_get_irq should work in both cases?
There was no particular reason and I updated the patchset to do that precis=
ely=20
in version 2.
=2D-=20
=46lorian
From: Jason Cooper <hidden> Date: 2013-03-14 17:26:30
Florian,
Any word on version 2 of this series? I'd like to base the conversion
of kirkwood to DT based ethernet init on it.
thx,
Jason.
On Tue, Jan 29, 2013 at 04:24:03PM +0100, Florian Fainelli wrote:
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
You can probably safely merge patches 1 to 4 if Thomas agrees, and we will
see what kind of feeback I get on patch 5.
Florian Fainelli (5):
net: mvmdio: unmap base register address at driver removal
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
net: mvmdio: allow Device Tree and platform device to coexist
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 84 +++++++--
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 +-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 187 +-------------------
drivers/net/ethernet/marvell/mvmdio.c | 136 +++++++++++---
7 files changed, 226 insertions(+), 219 deletions(-)
--
1.7.10.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This patch renames the base register cookie in the mvmdio drive from
"smireg" to "regs" since a subsequent patch is going to use an ioremap()
cookie whose size is larger than a single register of 4 bytes. No
functionnal code change introduced.
Acked-by: Thomas Petazzoni <redacted>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v1:
- added Thomas Acked-by tag
drivers/net/ethernet/marvell/mvmdio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -38,7 +38,7 @@structorion_mdio_dev{structmutexlock;-void__iomem*smireg;+void__iomem*regs;};/* Wait for the SMI unit to be ready for another operation
@@ -51,7 +51,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(!(val&MVMDIO_SMI_BUSY))break;
@@ -86,12 +86,12 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,writel(((mii_id<<MVMDIO_SMI_PHY_ADDR_SHIFT)|(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_READ_OPERATION),-dev->smireg);+dev->regs);/* Wait for the value to become available */count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(val&MVMDIO_SMI_READ_VALID)break;
@@ -128,7 +128,7 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_WRITE_OPERATION|(value<<MVMDIO_SMI_DATA_SHIFT)),-dev->smireg);+dev->regs);mutex_unlock(&dev->lock);
@@ -177,8 +177,8 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->smireg=devm_ioremap(&pdev->dev,r->start,resource_size(r));-if(!dev->smireg){+dev->regs=devm_ioremap(&pdev->dev,r->start,resource_size(r));+if(!dev->regs){dev_err(&pdev->dev,"Unable to remap SMI register\n");kfree(bus->irq);mdiobus_free(bus);
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Florian Fainelli (4):
net: mvmdio: allow platform device style registration
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 97 +++++++---
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 +-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 +-------------------
drivers/net/ethernet/marvell/mvmdio.c | 111 +++++++++---
include/linux/mv643xx_eth.h | 1 -
8 files changed, 207 insertions(+), 226 deletions(-)
--
1.7.10.4
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 97 +++++++++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 ++--------------------------
include/linux/mv643xx_eth.h | 1 -
6 files changed, 117 insertions(+), 202 deletions(-)
@@ -1122,97 +1095,6 @@ out_write:wrlp(mp,PORT_SERIAL_CONTROL,pscr);}-staticirqreturn_tmv643xx_eth_err_irq(intirq,void*dev_id)-{-structmv643xx_eth_shared_private*msp=dev_id;--if(readl(msp->base+ERR_INT_CAUSE)&ERR_INT_SMI_DONE){-writel(~ERR_INT_SMI_DONE,msp->base+ERR_INT_CAUSE);-wake_up(&msp->smi_busy_wait);-returnIRQ_HANDLED;-}--returnIRQ_NONE;-}--staticintsmi_is_done(structmv643xx_eth_shared_private*msp)-{-return!(readl(msp->base+SMI_REG)&SMI_BUSY);-}--staticintsmi_wait_ready(structmv643xx_eth_shared_private*msp)-{-if(msp->err_interrupt==NO_IRQ){-inti;--for(i=0;!smi_is_done(msp);i++){-if(i==10)-return-ETIMEDOUT;-msleep(10);-}--return0;-}--if(!smi_is_done(msp)){-wait_event_timeout(msp->smi_busy_wait,smi_is_done(msp),-msecs_to_jiffies(100));-if(!smi_is_done(msp))-return-ETIMEDOUT;-}--return0;-}--staticintsmi_bus_read(structmii_bus*bus,intaddr,intreg)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;-intret;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_READ|(reg<<21)|(addr<<16),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--ret=readl(smi_reg);-if(!(ret&SMI_READ_VALID)){-pr_warn("SMI bus read not valid\n");-return-ENODEV;-}--returnret&0xffff;-}--staticintsmi_bus_write(structmii_bus*bus,intaddr,intreg,u16val)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_WRITE|(reg<<21)|-(addr<<16)|(val&0xffff),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--return0;-}--/* statistics ***************************************************************/staticstructnet_device_stats*mv643xx_eth_get_stats(structnet_device*dev){
@@ -2688,47 +2570,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)gotoout_free;/*-*SetupandregisterSMIbus.-*/-if(pd==NULL||pd->shared_smi==NULL){-msp->smi_bus=mdiobus_alloc();-if(msp->smi_bus==NULL)-gotoout_unmap;--msp->smi_bus->priv=msp;-msp->smi_bus->name="mv643xx_eth smi";-msp->smi_bus->read=smi_bus_read;-msp->smi_bus->write=smi_bus_write,-snprintf(msp->smi_bus->id,MII_BUS_ID_SIZE,"%s-%d",-pdev->name,pdev->id);-msp->smi_bus->parent=&pdev->dev;-msp->smi_bus->phy_mask=0xffffffff;-if(mdiobus_register(msp->smi_bus)<0)-gotoout_free_mii_bus;-msp->smi=msp;-}else{-msp->smi=platform_get_drvdata(pd->shared_smi);-}--msp->err_interrupt=NO_IRQ;-init_waitqueue_head(&msp->smi_busy_wait);--/*-*Checkwhethertheerrorinterruptishookedup.-*/-res=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(res!=NULL){-interr;--err=request_irq(res->start,mv643xx_eth_err_irq,-IRQF_SHARED,"mv643xx_eth",msp);-if(!err){-writel(ERR_INT_SMI_DONE,msp->base+ERR_INT_MASK);-msp->err_interrupt=res->start;-}-}--/**(Re-)programMBUSremappingwindowsifweareaskedto.*/dram=mv_mbus_dram_info();
@@ -2743,10 +2584,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)return0;-out_free_mii_bus:-mdiobus_free(msp->smi_bus);-out_unmap:-iounmap(msp->base);out_free:kfree(msp);out:
@@ -2843,17 +2673,19 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,num=1;}+/* Attempt to connect to the PHY using orion-mdio */phydev=NULL;for(i=0;i<num;i++){intaddr=(start+i)&0x1f;-if(bus->phy_map[addr]==NULL)-mdiobus_scan(bus,addr);+snprintf(phy_id,sizeof(phy_id),PHY_ID_FMT,+"orion-mdio-mii",addr);-if(phydev==NULL){-phydev=bus->phy_map[addr];-if(phydev!=NULL)-phy_addr_set(mp,addr);+phydev=phy_connect(mp->dev,phy_id,NULL,+PHY_INTERFACE_MODE_GMII);+if(!IS_ERR(phydev)){+phy_addr_set(mp,addr);+break;}}
This patch enhances the "mvmdio" to support a SMI error/done interrupt
line which can be used along with a wait queue instead of doing
busy-waiting on the registers. This is a feature which is available in
the mv643xx_eth SMI code and thus reduces again the gap between the two.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Chances since v1:
- always use orion_smi_is_done() helper
- make interrupt/non-interrupt code path entirely independant
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
drivers/net/ethernet/marvell/mvmdio.c | 83 +++++++++++++++++---
2 files changed, 74 insertions(+), 12 deletions(-)
@@ -9,6 +9,9 @@ Required properties: - compatible: "marvell,orion-mdio" - reg: address and length of the SMI register+Optional properties:+- interrupts: interrupt line number for the SMI error/done interrupt+ The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
@@ -35,33 +38,58 @@#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 0x0080structorion_mdio_dev{structmutexlock;void__iomem*regs;+/*+*Ifwehaveaccesstotheerrorinterruptpin(whichis+*somewhatmisnamedasitnotonlyreflectsinternalerrors+*butalsoreflectsSMIcompletion),usethattowaitfor+*SMIaccesscompletioninsteadofpollingtheSMIbusybit.+*/+interr_interrupt;+wait_queue_head_tsmi_busy_wait;};+staticintorion_mdio_smi_is_done(structorion_mdio_dev*dev)+{+return!(readl(dev->regs)&MVMDIO_SMI_BUSY);+}+/* Wait for the SMI unit to be ready for another operation*/staticintorion_mdio_wait_ready(structmii_bus*bus){structorion_mdio_dev*dev=bus->priv;intcount;-u32val;-count=0;-while(1){-val=readl(dev->regs);-if(!(val&MVMDIO_SMI_BUSY))-break;+if(dev->err_interrupt==NO_IRQ){+count=0;+while(1){+if(orion_mdio_smi_is_done(dev))+break;-if(count>100){-dev_err(bus->parent,"Timeout: SMI busy for too long\n");-return-ETIMEDOUT;-}+if(count>100){+dev_err(bus->parent,+"Timeout: SMI busy for too long\n");+return-ETIMEDOUT;+}-udelay(10);-count++;+udelay(10);+count++;+}+}else{+if(!orion_mdio_smi_is_done(dev)){+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;+}}return0;
@@ -140,6 +168,21 @@ static int orion_mdio_reset(struct mii_bus *bus)return0;}+staticirqreturn_torion_mdio_err_irq(intirq,void*dev_id)+{+structorion_mdio_dev*dev=dev_id;++if(readl(dev->regs+MVMDIO_ERR_INT_CAUSE)&+MVMDIO_ERR_INT_SMI_DONE){+writel(~MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_CAUSE);+wake_up(&dev->smi_busy_wait);+returnIRQ_HANDLED;+}++returnIRQ_NONE;+}+staticintorion_mdio_probe(structplatform_device*pdev){structresource*r;
@@ -185,6 +228,19 @@ static int orion_mdio_probe(struct platform_device *pdev)return-ENODEV;}+init_waitqueue_head(&dev->smi_busy_wait);++dev->err_interrupt=platform_get_irq(pdev,0);+if(dev->err_interrupt!=-ENXIO){+ret=devm_request_irq(&pdev->dev,dev->err_interrupt,+orion_mdio_err_irq,+IRQF_SHARED,pdev->name,dev);+if(!ret)+writel(MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_MASK);+}else+dev->err_interrupt=NO_IRQ;+mutex_init(&dev->lock);ret=mdiobus_register(bus);
@@ -203,6 +259,9 @@ static int orion_mdio_probe(struct platform_device *pdev)staticintorion_mdio_remove(structplatform_device*pdev){structmii_bus*bus=platform_get_drvdata(pdev);+structorion_mdio_dev*dev=bus->priv;++writel(0,dev->regs+MVMDIO_ERR_INT_MASK);mdiobus_unregister(bus);kfree(bus->irq);mdiobus_free(bus);
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v1:
- removed one too many mdio bus registration for Orion5x/Kirkwood
arch/arm/plat-orion/common.c | 97 +++++++++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 ++--------------------------
include/linux/mv643xx_eth.h | 1 -
6 files changed, 117 insertions(+), 202 deletions(-)
@@ -1122,97 +1095,6 @@ out_write:wrlp(mp,PORT_SERIAL_CONTROL,pscr);}-staticirqreturn_tmv643xx_eth_err_irq(intirq,void*dev_id)-{-structmv643xx_eth_shared_private*msp=dev_id;--if(readl(msp->base+ERR_INT_CAUSE)&ERR_INT_SMI_DONE){-writel(~ERR_INT_SMI_DONE,msp->base+ERR_INT_CAUSE);-wake_up(&msp->smi_busy_wait);-returnIRQ_HANDLED;-}--returnIRQ_NONE;-}--staticintsmi_is_done(structmv643xx_eth_shared_private*msp)-{-return!(readl(msp->base+SMI_REG)&SMI_BUSY);-}--staticintsmi_wait_ready(structmv643xx_eth_shared_private*msp)-{-if(msp->err_interrupt==NO_IRQ){-inti;--for(i=0;!smi_is_done(msp);i++){-if(i==10)-return-ETIMEDOUT;-msleep(10);-}--return0;-}--if(!smi_is_done(msp)){-wait_event_timeout(msp->smi_busy_wait,smi_is_done(msp),-msecs_to_jiffies(100));-if(!smi_is_done(msp))-return-ETIMEDOUT;-}--return0;-}--staticintsmi_bus_read(structmii_bus*bus,intaddr,intreg)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;-intret;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_READ|(reg<<21)|(addr<<16),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--ret=readl(smi_reg);-if(!(ret&SMI_READ_VALID)){-pr_warn("SMI bus read not valid\n");-return-ENODEV;-}--returnret&0xffff;-}--staticintsmi_bus_write(structmii_bus*bus,intaddr,intreg,u16val)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_WRITE|(reg<<21)|-(addr<<16)|(val&0xffff),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--return0;-}--/* statistics ***************************************************************/staticstructnet_device_stats*mv643xx_eth_get_stats(structnet_device*dev){
@@ -2688,47 +2570,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)gotoout_free;/*-*SetupandregisterSMIbus.-*/-if(pd==NULL||pd->shared_smi==NULL){-msp->smi_bus=mdiobus_alloc();-if(msp->smi_bus==NULL)-gotoout_unmap;--msp->smi_bus->priv=msp;-msp->smi_bus->name="mv643xx_eth smi";-msp->smi_bus->read=smi_bus_read;-msp->smi_bus->write=smi_bus_write,-snprintf(msp->smi_bus->id,MII_BUS_ID_SIZE,"%s-%d",-pdev->name,pdev->id);-msp->smi_bus->parent=&pdev->dev;-msp->smi_bus->phy_mask=0xffffffff;-if(mdiobus_register(msp->smi_bus)<0)-gotoout_free_mii_bus;-msp->smi=msp;-}else{-msp->smi=platform_get_drvdata(pd->shared_smi);-}--msp->err_interrupt=NO_IRQ;-init_waitqueue_head(&msp->smi_busy_wait);--/*-*Checkwhethertheerrorinterruptishookedup.-*/-res=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(res!=NULL){-interr;--err=request_irq(res->start,mv643xx_eth_err_irq,-IRQF_SHARED,"mv643xx_eth",msp);-if(!err){-writel(ERR_INT_SMI_DONE,msp->base+ERR_INT_MASK);-msp->err_interrupt=res->start;-}-}--/**(Re-)programMBUSremappingwindowsifweareaskedto.*/dram=mv_mbus_dram_info();
@@ -2743,10 +2584,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)return0;-out_free_mii_bus:-mdiobus_free(msp->smi_bus);-out_unmap:-iounmap(msp->base);out_free:kfree(msp);out:
@@ -2843,17 +2673,19 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,num=1;}+/* Attempt to connect to the PHY using orion-mdio */phydev=NULL;for(i=0;i<num;i++){intaddr=(start+i)&0x1f;-if(bus->phy_map[addr]==NULL)-mdiobus_scan(bus,addr);+snprintf(phy_id,sizeof(phy_id),PHY_ID_FMT,+"orion-mdio-mii",addr);-if(phydev==NULL){-phydev=bus->phy_map[addr];-if(phydev!=NULL)-phy_addr_set(mp,addr);+phydev=phy_connect(mp->dev,phy_id,NULL,+PHY_INTERFACE_MODE_GMII);+if(!IS_ERR(phydev)){+phy_addr_set(mp,addr);+break;}}
This patch changes the mvmdio driver not to use device tree
helper functions such as of_mdiobus_register() and of_iomap() so we can
instantiate this driver using a classic platform_device approach. Use
the device manager helper to ioremap() the base register cookie so we
get automatic freeing upon error and removal. This change is harmless
for Device Tree platforms because they will get the driver be registered
the same way as it was before.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v1:
- use device managed helpers to fix an ioremap leak in remove function
- remove the use of Device Tree specific helpers to allow platform-style
registration
drivers/net/ethernet/marvell/mvmdio.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
@@ -172,9 +177,9 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->smireg=of_iomap(pdev->dev.of_node,0);+dev->smireg=devm_ioremap(&pdev->dev,r->start,resource_size(r));if(!dev->smireg){-dev_err(&pdev->dev,"No SMI register address given in DT\n");+dev_err(&pdev->dev,"Unable to remap SMI register\n");kfree(bus->irq);mdiobus_free(bus);return-ENODEV;
@@ -182,10 +187,9 @@ static int orion_mdio_probe(struct platform_device *pdev)mutex_init(&dev->lock);-ret=of_mdiobus_register(bus,np);+ret=mdiobus_register(bus);if(ret<0){dev_err(&pdev->dev,"Cannot register MDIO bus (%d)\n",ret);-iounmap(dev->smireg);kfree(bus->irq);mdiobus_free(bus);returnret;
From: Jason Cooper <hidden> Date: 2013-03-14 19:02:56
Florian,
On Thu, Mar 14, 2013 at 07:08:32PM +0100, Florian Fainelli wrote:
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 97 +++++++++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 ++--------------------------
include/linux/mv643xx_eth.h | 1 -
6 files changed, 117 insertions(+), 202 deletions(-)
@@ -1122,97 +1095,6 @@ out_write:wrlp(mp,PORT_SERIAL_CONTROL,pscr);}-staticirqreturn_tmv643xx_eth_err_irq(intirq,void*dev_id)-{-structmv643xx_eth_shared_private*msp=dev_id;--if(readl(msp->base+ERR_INT_CAUSE)&ERR_INT_SMI_DONE){-writel(~ERR_INT_SMI_DONE,msp->base+ERR_INT_CAUSE);-wake_up(&msp->smi_busy_wait);-returnIRQ_HANDLED;-}--returnIRQ_NONE;-}--staticintsmi_is_done(structmv643xx_eth_shared_private*msp)-{-return!(readl(msp->base+SMI_REG)&SMI_BUSY);-}--staticintsmi_wait_ready(structmv643xx_eth_shared_private*msp)-{-if(msp->err_interrupt==NO_IRQ){-inti;--for(i=0;!smi_is_done(msp);i++){-if(i==10)-return-ETIMEDOUT;-msleep(10);-}--return0;-}--if(!smi_is_done(msp)){-wait_event_timeout(msp->smi_busy_wait,smi_is_done(msp),-msecs_to_jiffies(100));-if(!smi_is_done(msp))-return-ETIMEDOUT;-}--return0;-}--staticintsmi_bus_read(structmii_bus*bus,intaddr,intreg)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;-intret;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_READ|(reg<<21)|(addr<<16),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--ret=readl(smi_reg);-if(!(ret&SMI_READ_VALID)){-pr_warn("SMI bus read not valid\n");-return-ENODEV;-}--returnret&0xffff;-}--staticintsmi_bus_write(structmii_bus*bus,intaddr,intreg,u16val)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_WRITE|(reg<<21)|-(addr<<16)|(val&0xffff),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--return0;-}--/* statistics ***************************************************************/staticstructnet_device_stats*mv643xx_eth_get_stats(structnet_device*dev){
@@ -2688,47 +2570,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)gotoout_free;/*-*SetupandregisterSMIbus.-*/-if(pd==NULL||pd->shared_smi==NULL){-msp->smi_bus=mdiobus_alloc();-if(msp->smi_bus==NULL)-gotoout_unmap;--msp->smi_bus->priv=msp;-msp->smi_bus->name="mv643xx_eth smi";-msp->smi_bus->read=smi_bus_read;-msp->smi_bus->write=smi_bus_write,-snprintf(msp->smi_bus->id,MII_BUS_ID_SIZE,"%s-%d",-pdev->name,pdev->id);-msp->smi_bus->parent=&pdev->dev;-msp->smi_bus->phy_mask=0xffffffff;-if(mdiobus_register(msp->smi_bus)<0)-gotoout_free_mii_bus;-msp->smi=msp;-}else{-msp->smi=platform_get_drvdata(pd->shared_smi);-}--msp->err_interrupt=NO_IRQ;-init_waitqueue_head(&msp->smi_busy_wait);--/*-*Checkwhethertheerrorinterruptishookedup.-*/-res=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(res!=NULL){-interr;--err=request_irq(res->start,mv643xx_eth_err_irq,-IRQF_SHARED,"mv643xx_eth",msp);-if(!err){-writel(ERR_INT_SMI_DONE,msp->base+ERR_INT_MASK);-msp->err_interrupt=res->start;-}-}--/**(Re-)programMBUSremappingwindowsifweareaskedto.*/dram=mv_mbus_dram_info();
@@ -2743,10 +2584,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)return0;-out_free_mii_bus:-mdiobus_free(msp->smi_bus);-out_unmap:-iounmap(msp->base);out_free:kfree(msp);out:
@@ -2843,17 +2673,19 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,num=1;}+/* Attempt to connect to the PHY using orion-mdio */phydev=NULL;for(i=0;i<num;i++){intaddr=(start+i)&0x1f;-if(bus->phy_map[addr]==NULL)-mdiobus_scan(bus,addr);+snprintf(phy_id,sizeof(phy_id),PHY_ID_FMT,+"orion-mdio-mii",addr);-if(phydev==NULL){-phydev=bus->phy_map[addr];-if(phydev!=NULL)-phy_addr_set(mp,addr);+phydev=phy_connect(mp->dev,phy_id,NULL,+PHY_INTERFACE_MODE_GMII);+if(!IS_ERR(phydev)){+phy_addr_set(mp,addr);+break;}}
Hello Jason,
Le 14/03/2013 20:02, Jason Cooper a écrit :
Florian,
On Thu, Mar 14, 2013 at 07:08:32PM +0100, Florian Fainelli wrote:
quoted
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 97 +++++++++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 ++--------------------------
include/linux/mv643xx_eth.h | 1 -
6 files changed, 117 insertions(+), 202 deletions(-)
Isn't this the old version of 4/4 ?
No this really is v2, but I reformatted just that one and sent it
without the v2 changelog, you should have received the proper version a
couple minutes later once I realized my mistake.
--
Florian
From: Jason Cooper <hidden> Date: 2013-03-14 20:36:55
On Thu, Mar 14, 2013 at 08:32:57PM +0100, Florian Fainelli wrote:
Hello Jason,
=20
Le 14/03/2013 20:02, Jason Cooper a =E9crit :
quoted
Florian,
On Thu, Mar 14, 2013 at 07:08:32PM +0100, Florian Fainelli wrote:
quoted
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlap=
s
quoted
quoted
with the Marvell Ethernet shared registers because it will use a subs=
et
quoted
quoted
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/arm/plat-orion/common.c | 97 +++++++++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 14 ++-
drivers/net/ethernet/marvell/Kconfig | 1 +
drivers/net/ethernet/marvell/mv643xx_eth.c | 186 ++---------------=
=20
No this really is v2, but I reformatted just that one and sent it
without the v2 changelog, you should have received the proper
version a couple minutes later once I realized my mistake.
Yes, I received both, just making sure.
thx,
Jason.
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 - shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
Thanks to the help of Andrew Lunn, there is at least two known issues
with this patch version:
- we need to move up the mvmdio line in
drivers/net/ethernet/marvell/Makefile to make sure that configs having
both mvmdio and mv643xx_eth built-in get the probing order right
- the bus name used by mv643xx_eth is not the right now (orion-mdio.0 vs
expected orion-mdio) so the PHY device will not be found during
phy_connect()
I will fix these two issues in the next version of the patchset.
--
Florian
From: Thomas Petazzoni <hidden> Date: 2013-03-15 11:42:17
Dear Florian Fainelli,
On Fri, 15 Mar 2013 12:07:12 +0100, Florian Fainelli wrote:
Thanks to the help of Andrew Lunn, there is at least two known issues
with this patch version:
- we need to move up the mvmdio line in
drivers/net/ethernet/marvell/Makefile to make sure that configs having
both mvmdio and mv643xx_eth built-in get the probing order right
I don't think it's the right way of fixing the problem. If there is no
dependency on the two devices through the device model (i.e they don't
have a parent->child relationship), then the mv643xx_eth driver should
probably return -EPROBE_DEFER when it can't find its PHY so that its
->probe() operation gets called once again by the kernel when other
drivers (including mvmdio) have been probed.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
All applied to net-next, thanks.
Oh woah that was fast, maybe too fast, I will submit a follow-up patch
for patch 4 to address the issues I mentionned earlier.
--
Florian
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
All applied to net-next, thanks.
Actually, reverted. Please send me code which actually compiles:
drivers/net/ethernet/marvell/mvmdio.c: In function ‘orion_mdio_wait_ready’:
drivers/net/ethernet/marvell/mvmdio.c:70:28: error: ‘NO_IRQ’ undeclared (first use in this function)
drivers/net/ethernet/marvell/mvmdio.c:70:28: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/marvell/mvmdio.c: In function ‘orion_mdio_probe’:
drivers/net/ethernet/marvell/mvmdio.c:242:24: error: ‘NO_IRQ’ undeclared (first use in this function)
make[4]: *** [drivers/net/ethernet/marvell/mvmdio.o] Error 1
And don't use Kconfig dependencies to work around this, fix it properly.
Is there any platform out there for which we do not have a NO_IRQ
definition by now? If so, what is it?
--
Florian
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus
driver
instead of rolling its own implementation. As a result, all users of
this
mv643xx_eth driver are converted to register an "orion-mdio"
platform_device.
The mvmdio driver is also updated to support an interrupt line which
reports
SMI error/completion, and to allow traditionnal platform device
registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we
do
not want the architecture files to be desynchronized from the
mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be
very small.
All applied to net-next, thanks.
Actually, reverted. Please send me code which actually compiles:
drivers/net/ethernet/marvell/mvmdio.c: In function
‘orion_mdio_wait_ready’:
drivers/net/ethernet/marvell/mvmdio.c:70:28: error: ‘NO_IRQ’
undeclared (first use in this function)
drivers/net/ethernet/marvell/mvmdio.c:70:28: note: each undeclared
identifier is reported only once for each function it appears in
drivers/net/ethernet/marvell/mvmdio.c: In function ‘orion_mdio_probe’:
drivers/net/ethernet/marvell/mvmdio.c:242:24: error: ‘NO_IRQ’
undeclared (first use in this function)
make[4]: *** [drivers/net/ethernet/marvell/mvmdio.o] Error 1
And don't use Kconfig dependencies to work around this, fix it
properly.
Is there any platform out there for which we do not have a NO_IRQ
definition by now? If so, what is it?
Obviously if x86_64 doesn't even build your changes, that is one such
platform. Also, is grep not working on your computer?
I built tested on PowerPC and ARM which are the platforms actually
*using* these drivers and forgot that you build for x86_64.
Platforms are absolutely no required to have this define, zero is the
only valid "no IRQ" which is portable in any way.
This is an old and tired topic, portable code does not use NO_IRQ, and
that's simply the end of it.
I changed not to rely on NO_IRQ anymore. Thanks!
--
Florian
FYI, NO_IRQ is not supposed to be used anymore (we're supposed to be
removing it). platform_get_irq() returns negative numbers for failure,
so why not test for < 0 in both the above tests, or maybe <= 0 (as
IRQ0 is also not supposed to be valid.)?
This patch changes the mvmdio driver not to use device tree
helper functions such as of_mdiobus_register() and of_iomap() so we can
instantiate this driver using a classic platform_device approach. Use
the device manager helper to ioremap() the base register cookie so we
get automatic freeing upon error and removal. This change is harmless
for Device Tree platforms because they will get the driver be registered
the same way as it was before.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v2:
- use of_mdiobus_register if device tree node is available to ensure that
all child PHY nodes get also registered (fixes PHY probing on DT-only)
Changes since v1:
- use device managed helpers to fix an ioremap leak in remove function
- remove the use of Device Tree specific helpers to allow platform-style
registration
drivers/net/ethernet/marvell/mvmdio.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
@@ -172,9 +178,9 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->smireg=of_iomap(pdev->dev.of_node,0);+dev->smireg=devm_ioremap(&pdev->dev,r->start,resource_size(r));if(!dev->smireg){-dev_err(&pdev->dev,"No SMI register address given in DT\n");+dev_err(&pdev->dev,"Unable to remap SMI register\n");kfree(bus->irq);mdiobus_free(bus);return-ENODEV;
@@ -182,10 +188,12 @@ static int orion_mdio_probe(struct platform_device *pdev)mutex_init(&dev->lock);-ret=of_mdiobus_register(bus,np);+if(pdev->dev.of_node)+ret=of_mdiobus_register(bus,pdev->dev.of_node);+else+ret=mdiobus_register(bus);if(ret<0){dev_err(&pdev->dev,"Cannot register MDIO bus (%d)\n",ret);-iounmap(dev->smireg);kfree(bus->irq);mdiobus_free(bus);returnret;
This patch converts the Marvell MV643XX ethernet driver to use the
Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms
registering the Marvell MV643XX ethernet driver are also updated to
register a Marvell Orion MDIO driver. This driver voluntarily overlaps
with the Marvell Ethernet shared registers because it will use a subset
of this shared register (shared_base + 0x4 to shared_base + 0x84). The
Ethernet driver is also updated to look up for a PHY device using the
Orion MDIO bus driver.
For ARM and PowerPC we register a single instance of the "mvmdio" driver
in the system like it used to be done with the use of the "shared_smi"
platform_data cookie on ARM.
Note that it is safe to register the mvmdio driver only for the "ge00"
instance of the driver because this "ge00" interface is guaranteed to
always be explicitely registered by consumers of
arch/arm/plat-orion/common.c and other instances (ge01, ge10 and ge11)
were all pointing their shared_smi to ge00. For PowerPC the in-tree
Device Tree Source files mention only one MV643XX ethernet MAC instance
so the MDIO bus driver is registered only when id == 0.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v2:
- added missing adjust_link callback to phy_connect
- removed superfluous phy_attach() call
- modified PowerPC code to register a single orion-mdio instance
- modified arm code to register a single orion-mdio instance for
all GE* interfaces
Changes since v1:
- removed one too many mdio bus registration for Orion5x/Kirkwood
arch/arm/plat-orion/common.c | 54 ++++----
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 +++
arch/powerpc/sysdev/mv64x60_dev.c | 16 ++-
drivers/net/ethernet/marvell/Kconfig | 5 +-
drivers/net/ethernet/marvell/Makefile | 2 +-
drivers/net/ethernet/marvell/mv643xx_eth.c | 195 +++-------------------------
include/linux/mv643xx_eth.h | 1 -
7 files changed, 84 insertions(+), 209 deletions(-)
@@ -2,8 +2,8 @@# Makefile for the Marvell device drivers.#-obj-$(CONFIG_MV643XX_ETH)+=mv643xx_eth.oobj-$(CONFIG_MVMDIO)+=mvmdio.o+obj-$(CONFIG_MV643XX_ETH)+=mv643xx_eth.oobj-$(CONFIG_MVNETA)+=mvneta.oobj-$(CONFIG_PXA168_ETH)+=pxa168_eth.oobj-$(CONFIG_SKGE)+=skge.o
@@ -1122,97 +1095,6 @@ out_write:wrlp(mp,PORT_SERIAL_CONTROL,pscr);}-staticirqreturn_tmv643xx_eth_err_irq(intirq,void*dev_id)-{-structmv643xx_eth_shared_private*msp=dev_id;--if(readl(msp->base+ERR_INT_CAUSE)&ERR_INT_SMI_DONE){-writel(~ERR_INT_SMI_DONE,msp->base+ERR_INT_CAUSE);-wake_up(&msp->smi_busy_wait);-returnIRQ_HANDLED;-}--returnIRQ_NONE;-}--staticintsmi_is_done(structmv643xx_eth_shared_private*msp)-{-return!(readl(msp->base+SMI_REG)&SMI_BUSY);-}--staticintsmi_wait_ready(structmv643xx_eth_shared_private*msp)-{-if(msp->err_interrupt==NO_IRQ){-inti;--for(i=0;!smi_is_done(msp);i++){-if(i==10)-return-ETIMEDOUT;-msleep(10);-}--return0;-}--if(!smi_is_done(msp)){-wait_event_timeout(msp->smi_busy_wait,smi_is_done(msp),-msecs_to_jiffies(100));-if(!smi_is_done(msp))-return-ETIMEDOUT;-}--return0;-}--staticintsmi_bus_read(structmii_bus*bus,intaddr,intreg)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;-intret;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_READ|(reg<<21)|(addr<<16),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--ret=readl(smi_reg);-if(!(ret&SMI_READ_VALID)){-pr_warn("SMI bus read not valid\n");-return-ENODEV;-}--returnret&0xffff;-}--staticintsmi_bus_write(structmii_bus*bus,intaddr,intreg,u16val)-{-structmv643xx_eth_shared_private*msp=bus->priv;-void__iomem*smi_reg=msp->base+SMI_REG;--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--writel(SMI_OPCODE_WRITE|(reg<<21)|-(addr<<16)|(val&0xffff),smi_reg);--if(smi_wait_ready(msp)){-pr_warn("SMI bus busy timeout\n");-return-ETIMEDOUT;-}--return0;-}--/* statistics ***************************************************************/staticstructnet_device_stats*mv643xx_eth_get_stats(structnet_device*dev){
@@ -2688,47 +2570,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)gotoout_free;/*-*SetupandregisterSMIbus.-*/-if(pd==NULL||pd->shared_smi==NULL){-msp->smi_bus=mdiobus_alloc();-if(msp->smi_bus==NULL)-gotoout_unmap;--msp->smi_bus->priv=msp;-msp->smi_bus->name="mv643xx_eth smi";-msp->smi_bus->read=smi_bus_read;-msp->smi_bus->write=smi_bus_write,-snprintf(msp->smi_bus->id,MII_BUS_ID_SIZE,"%s-%d",-pdev->name,pdev->id);-msp->smi_bus->parent=&pdev->dev;-msp->smi_bus->phy_mask=0xffffffff;-if(mdiobus_register(msp->smi_bus)<0)-gotoout_free_mii_bus;-msp->smi=msp;-}else{-msp->smi=platform_get_drvdata(pd->shared_smi);-}--msp->err_interrupt=NO_IRQ;-init_waitqueue_head(&msp->smi_busy_wait);--/*-*Checkwhethertheerrorinterruptishookedup.-*/-res=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(res!=NULL){-interr;--err=request_irq(res->start,mv643xx_eth_err_irq,-IRQF_SHARED,"mv643xx_eth",msp);-if(!err){-writel(ERR_INT_SMI_DONE,msp->base+ERR_INT_MASK);-msp->err_interrupt=res->start;-}-}--/**(Re-)programMBUSremappingwindowsifweareaskedto.*/dram=mv_mbus_dram_info();
@@ -2743,10 +2584,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)return0;-out_free_mii_bus:-mdiobus_free(msp->smi_bus);-out_unmap:-iounmap(msp->base);out_free:kfree(msp);out:
@@ -2843,17 +2680,19 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,num=1;}+/* Attempt to connect to the PHY using orion-mdio */phydev=NULL;for(i=0;i<num;i++){intaddr=(start+i)&0x1f;-if(bus->phy_map[addr]==NULL)-mdiobus_scan(bus,addr);+snprintf(phy_id,sizeof(phy_id),PHY_ID_FMT,+"orion-mdio-mii",addr);-if(phydev==NULL){-phydev=bus->phy_map[addr];-if(phydev!=NULL)-phy_addr_set(mp,addr);+phydev=phy_connect(mp->dev,phy_id,mv643xx_eth_adjust_link,+PHY_INTERFACE_MODE_GMII);+if(!IS_ERR(phydev)){+phy_addr_set(mp,addr);+break;}}
@@ -2866,8 +2705,6 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)phy_reset(mp);-phy_attach(mp->dev,dev_name(&phy->dev),PHY_INTERFACE_MODE_GMII);-if(speed==0){phy->autoneg=AUTONEG_ENABLE;phy->speed=0;
This patch enhances the "mvmdio" to support a SMI error/done interrupt
line which can be used along with a wait queue instead of doing
busy-waiting on the registers. This is a feature which is available in
the mv643xx_eth SMI code and thus reduces again the gap between the two.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v2:
- remove NO_IRQ usage which is not portable, check for irq >= 0
instead
- factor out mdiobus cleaning under the out_mdio label in probe()
Chances since v1:
- always use orion_smi_is_done() helper
- make interrupt/non-interrupt code path entirely independant
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
drivers/net/ethernet/marvell/mvmdio.c | 98 ++++++++++++++++----
2 files changed, 83 insertions(+), 18 deletions(-)
@@ -9,6 +9,9 @@ Required properties: - compatible: "marvell,orion-mdio" - reg: address and length of the SMI register+Optional properties:+- interrupts: interrupt line number for the SMI error/done interrupt+ The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
@@ -36,33 +39,58 @@#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 0x0080structorion_mdio_dev{structmutexlock;void__iomem*regs;+/*+*Ifwehaveaccesstotheerrorinterruptpin(whichis+*somewhatmisnamedasitnotonlyreflectsinternalerrors+*butalsoreflectsSMIcompletion),usethattowaitfor+*SMIaccesscompletioninsteadofpollingtheSMIbusybit.+*/+interr_interrupt;+wait_queue_head_tsmi_busy_wait;};+staticintorion_mdio_smi_is_done(structorion_mdio_dev*dev)+{+return!(readl(dev->regs)&MVMDIO_SMI_BUSY);+}+/* Wait for the SMI unit to be ready for another operation*/staticintorion_mdio_wait_ready(structmii_bus*bus){structorion_mdio_dev*dev=bus->priv;intcount;-u32val;-count=0;-while(1){-val=readl(dev->regs);-if(!(val&MVMDIO_SMI_BUSY))-break;+if(dev->err_interrupt<=0){+count=0;+while(1){+if(orion_mdio_smi_is_done(dev))+break;-if(count>100){-dev_err(bus->parent,"Timeout: SMI busy for too long\n");-return-ETIMEDOUT;-}+if(count>100){+dev_err(bus->parent,+"Timeout: SMI busy for too long\n");+return-ETIMEDOUT;+}-udelay(10);-count++;+udelay(10);+count++;+}+}else{+if(!orion_mdio_smi_is_done(dev)){+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;+}}return0;
@@ -141,6 +169,21 @@ static int orion_mdio_reset(struct mii_bus *bus)return0;}+staticirqreturn_torion_mdio_err_irq(intirq,void*dev_id)+{+structorion_mdio_dev*dev=dev_id;++if(readl(dev->regs+MVMDIO_ERR_INT_CAUSE)&+MVMDIO_ERR_INT_SMI_DONE){+writel(~MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_CAUSE);+wake_up(&dev->smi_busy_wait);+returnIRQ_HANDLED;+}++returnIRQ_NONE;+}+staticintorion_mdio_probe(structplatform_device*pdev){structresource*r;
@@ -181,9 +224,22 @@ static int orion_mdio_probe(struct platform_device *pdev)dev->regs=devm_ioremap(&pdev->dev,r->start,resource_size(r));if(!dev->regs){dev_err(&pdev->dev,"Unable to remap SMI register\n");-kfree(bus->irq);-mdiobus_free(bus);-return-ENODEV;+ret=-ENODEV;+gotoout_mdio;+}++init_waitqueue_head(&dev->smi_busy_wait);++dev->err_interrupt=platform_get_irq(pdev,0);+if(dev->err_interrupt!=-ENXIO){+ret=devm_request_irq(&pdev->dev,dev->err_interrupt,+orion_mdio_err_irq,+IRQF_SHARED,pdev->name,dev);+if(ret)+gotoout_mdio;++writel(MVMDIO_ERR_INT_SMI_DONE,+dev->regs+MVMDIO_ERR_INT_MASK);}mutex_init(&dev->lock);
@@ -194,19 +250,25 @@ static int orion_mdio_probe(struct platform_device *pdev)ret=mdiobus_register(bus);if(ret<0){dev_err(&pdev->dev,"Cannot register MDIO bus (%d)\n",ret);-kfree(bus->irq);-mdiobus_free(bus);-returnret;+gotoout_mdio;}platform_set_drvdata(pdev,bus);return0;++out_mdio:+kfree(bus->irq);+mdiobus_free(bus);+returnret;}staticintorion_mdio_remove(structplatform_device*pdev){structmii_bus*bus=platform_get_drvdata(pdev);+structorion_mdio_dev*dev=bus->priv;++writel(0,dev->regs+MVMDIO_ERR_INT_MASK);mdiobus_unregister(bus);kfree(bus->irq);mdiobus_free(bus);
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Florian Fainelli (4):
net: mvmdio: allow platform device style registration
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 54 +++---
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 ++
arch/powerpc/sysdev/mv64x60_dev.c | 16 +-
drivers/net/ethernet/marvell/Kconfig | 5 +-
drivers/net/ethernet/marvell/Makefile | 2 +-
drivers/net/ethernet/marvell/mv643xx_eth.c | 195 ++------------------
drivers/net/ethernet/marvell/mvmdio.c | 130 ++++++++++---
include/linux/mv643xx_eth.h | 1 -
9 files changed, 187 insertions(+), 239 deletions(-)
--
1.7.10.4
This patch renames the base register cookie in the mvmdio drive from
"smireg" to "regs" since a subsequent patch is going to use an ioremap()
cookie whose size is larger than a single register of 4 bytes. No
functionnal code change introduced.
Acked-by: Thomas Petazzoni <redacted>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Changes since v2:
- rebased against latest version
Changes since v1:
- added Thomas Acked-by tag
drivers/net/ethernet/marvell/mvmdio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -39,7 +39,7 @@structorion_mdio_dev{structmutexlock;-void__iomem*smireg;+void__iomem*regs;};/* Wait for the SMI unit to be ready for another operation
@@ -52,7 +52,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(!(val&MVMDIO_SMI_BUSY))break;
@@ -87,12 +87,12 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id,writel(((mii_id<<MVMDIO_SMI_PHY_ADDR_SHIFT)|(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_READ_OPERATION),-dev->smireg);+dev->regs);/* Wait for the value to become available */count=0;while(1){-val=readl(dev->smireg);+val=readl(dev->regs);if(val&MVMDIO_SMI_READ_VALID)break;
@@ -129,7 +129,7 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id,(regnum<<MVMDIO_SMI_PHY_REG_SHIFT)|MVMDIO_SMI_WRITE_OPERATION|(value<<MVMDIO_SMI_DATA_SHIFT)),-dev->smireg);+dev->regs);mutex_unlock(&dev->lock);
@@ -178,8 +178,8 @@ static int orion_mdio_probe(struct platform_device *pdev)bus->irq[i]=PHY_POLL;dev=bus->priv;-dev->smireg=devm_ioremap(&pdev->dev,r->start,resource_size(r));-if(!dev->smireg){+dev->regs=devm_ioremap(&pdev->dev,r->start,resource_size(r));+if(!dev->regs){dev_err(&pdev->dev,"Unable to remap SMI register\n");kfree(bus->irq);mdiobus_free(bus);
From: Thomas Petazzoni <hidden> Date: 2013-03-22 13:53:43
Hello,
On Fri, 22 Mar 2013 14:39:24 +0100, Florian Fainelli wrote:
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Florian Fainelli (4):
net: mvmdio: allow platform device style registration
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
mv643xx_eth: convert to use the Marvell Orion MDIO driver
For the entire series:
Tested-by: Thomas Petazzoni <redacted>
tested on:
* Armada XP DB, DT-based, which uses the mvneta driver. It is affected
by the 3 first commits since Armada XP also uses the mvmdio driver.
* Kirkwood development board, non-DT, which uses the mv643xx_eth
driver.
Thanks Florian for this work,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
From: Jason Cooper <hidden> Date: 2013-03-22 14:15:15
On Fri, Mar 22, 2013 at 02:39:24PM +0100, Florian Fainelli wrote:
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Florian Fainelli (4):
net: mvmdio: allow platform device style registration
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 54 +++---
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 ++
arch/powerpc/sysdev/mv64x60_dev.c | 16 +-
drivers/net/ethernet/marvell/Kconfig | 5 +-
drivers/net/ethernet/marvell/Makefile | 2 +-
drivers/net/ethernet/marvell/mv643xx_eth.c | 195 ++------------------
drivers/net/ethernet/marvell/mvmdio.c | 130 ++++++++++---
include/linux/mv643xx_eth.h | 1 -
9 files changed, 187 insertions(+), 239 deletions(-)
Whole series applied on top of v3.9-rc3 and tested on dreamplug
(kirkwood DT boot with legacy mv643xx_eth init)
Tested-by: Jason Cooper <redacted>
also, for the bits changing plat-orion:
Acked-by: Jason Cooper <redacted>
thx,
Jason.
On Fri, Mar 22, 2013 at 02:39:24PM +0100, Florian Fainelli wrote:
quoted
Hi all,
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Florian Fainelli (4):
net: mvmdio: allow platform device style registration
net: mvmdio: rename base register cookie from smireg to regs
net: mvmdio: enhance driver to support SMI error/done interrupts
mv643xx_eth: convert to use the Marvell Orion MDIO driver
.../devicetree/bindings/net/marvell-orion-mdio.txt | 3 +
arch/arm/plat-orion/common.c | 54 +++---
arch/powerpc/platforms/chrp/pegasos_eth.c | 20 ++
arch/powerpc/sysdev/mv64x60_dev.c | 16 +-
drivers/net/ethernet/marvell/Kconfig | 5 +-
drivers/net/ethernet/marvell/Makefile | 2 +-
drivers/net/ethernet/marvell/mv643xx_eth.c | 195 ++------------------
drivers/net/ethernet/marvell/mvmdio.c | 130 ++++++++++---
include/linux/mv643xx_eth.h | 1 -
9 files changed, 187 insertions(+), 239 deletions(-)
Whole series applied on top of v3.9-rc3 and tested on dreamplug
(kirkwood DT boot with legacy mv643xx_eth init)
Ok, thanks! Does that mean that you want these changes to go via your
tree? David initially applied my v2 of this patchset, and since it
thouches mostly ethernet driver stuff, I would rather make it go via his
tree if both of you agree.
--
Florian
This patch converts the mv643xx_eth driver to use the mvmdio MDIO bus driver
instead of rolling its own implementation. As a result, all users of this
mv643xx_eth driver are converted to register an "orion-mdio" platform_device.
The mvmdio driver is also updated to support an interrupt line which reports
SMI error/completion, and to allow traditionnal platform device registration
instead of just device tree.
David, I think it makes sense for you to merge all of this, since we do
not want the architecture files to be desynchronized from the mv643xx_eth to
avoid runtime breakage. The potential for merge conflicts should be very small.
Whole series applied on top of v3.9-rc3 and tested on dreamplug
(kirkwood DT boot with legacy mv643xx_eth init)
=20
Ok, thanks! Does that mean that you want these changes to go via
your tree? David initially applied my v2 of this patchset, and since
it thouches mostly ethernet driver stuff, I would rather make it go
via his tree if both of you agree.
Yeah, I thought I should have reworded that after I hit send :) I
simply meant it applied cleanly against v3.9-rc3, booted, and worked. I
Acked it so David could take the whole series through his tree. Sorry
for the confusion.
Now that I can build mv643xx_eth DT on top of this, I'll structure it so
those changes go on top of yours (in David's tree) and try to avoid the
external dependency for the DT bits going though arm-soc.
thx,
Jason.
Ok, thanks! Does that mean that you want these changes to go via
your tree? David initially applied my v2 of this patchset, and since
it thouches mostly ethernet driver stuff, I would rather make it go
via his tree if both of you agree.
Yeah, I thought I should have reworded that after I hit send :) I
simply meant it applied cleanly against v3.9-rc3, booted, and worked. I
Acked it so David could take the whole series through his tree. Sorry
for the confusion.
Now that I can build mv643xx_eth DT on top of this, I'll structure it so
those changes go on top of yours (in David's tree) and try to avoid the
external dependency for the DT bits going though arm-soc.
Sounds good! FYI, I am finishing up DSA Device Tree bindings so that we
can finally get rid of board-specific Kirkwood files.
--
Florian