* [PATCH 0/2] net/cadence/macb: add support for dt phy definition @ 2013-08-22 15:56 Boris BREZILLON 2013-08-22 15:57 ` [PATCH 1/2] " Boris BREZILLON ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Boris BREZILLON @ 2013-08-22 15:56 UTC (permalink / raw) To: Nicolas Ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, Florian Fainelli Cc: netdev, linux-kernel, linux-arm-kernel, devicetree, Boris BREZILLON Hello, This patch series adds support for ethernet phy definition using device tree. This may help in moving some at91 boards to dt (some of them define an interrupt pin). Tested on samad31ek. Best Regards, Boris Boris BREZILLON (2): net/cadence/macb: add support for dt phy definition ARM: at91/dt: define phy available on sama5d3 mother board arch/arm/boot/dts/sama5d3xmb.dtsi | 8 +++++++ drivers/net/ethernet/cadence/macb.c | 41 +++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 7 deletions(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] net/cadence/macb: add support for dt phy definition 2013-08-22 15:56 [PATCH 0/2] net/cadence/macb: add support for dt phy definition Boris BREZILLON @ 2013-08-22 15:57 ` Boris BREZILLON 2013-08-22 16:00 ` boris brezillon 2013-08-22 15:58 ` [PATCH 2/2] ARM: at91/dt: define phy available on sama5d3 mother board Boris BREZILLON 2013-08-26 20:04 ` [PATCH 0/2] net/cadence/macb: add support for dt phy definition David Miller 2 siblings, 1 reply; 12+ messages in thread From: Boris BREZILLON @ 2013-08-22 15:57 UTC (permalink / raw) To: Nicolas Ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, Florian Fainelli Cc: netdev, linux-kernel, linux-arm-kernel, devicetree, Boris BREZILLON The macb driver only handle PHY description through platform_data (macb_platform_data). Thus, when using dt you cannot define phy properties like phy address or phy irq pin. This patch makes use of the of_mdiobus_register to add support for phy device definition using dt. A fallback to the autoscan procedure is added in case there is no phy devices defined in dt. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> --- drivers/net/ethernet/cadence/macb.c | 41 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index e866608..fe06ab0 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -27,6 +27,7 @@ #include <linux/phy.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/of_mdio.h> #include <linux/of_net.h> #include <linux/pinctrl/consumer.h> @@ -314,6 +315,7 @@ static int macb_mii_probe(struct net_device *dev) int macb_mii_init(struct macb *bp) { struct macb_platform_data *pdata; + struct device_node *np; int err = -ENXIO, i; /* Enable management port */ @@ -335,21 +337,46 @@ int macb_mii_init(struct macb *bp) bp->mii_bus->parent = &bp->dev->dev; pdata = bp->pdev->dev.platform_data; - if (pdata) - bp->mii_bus->phy_mask = pdata->phy_mask; - bp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); if (!bp->mii_bus->irq) { err = -ENOMEM; goto err_out_free_mdiobus; } - for (i = 0; i < PHY_MAX_ADDR; i++) - bp->mii_bus->irq[i] = PHY_POLL; - dev_set_drvdata(&bp->dev->dev, bp->mii_bus); - if (mdiobus_register(bp->mii_bus)) + np = bp->pdev->dev.of_node; + if (np) { + /* try dt phy registration */ + err = of_mdiobus_register(bp->mii_bus, np); + + /* fallback to standard phy registration if no phy were + found during dt phy registration */ + if (!err && !phy_find_first(bp->mii_bus)) { + for (i = 0; i < PHY_MAX_ADDR; i++) { + struct phy_device *phydev; + + phydev = mdiobus_scan(bp->mii_bus, i); + if (IS_ERR(phydev)) { + err = PTR_ERR(phydev); + break; + } + } + + if (err) + goto err_out_unregister_bus; + } + } else { + for (i = 0; i < PHY_MAX_ADDR; i++) + bp->mii_bus->irq[i] = PHY_POLL; + + if (pdata) + bp->mii_bus->phy_mask = pdata->phy_mask; + + err = mdiobus_register(bp->mii_bus); + } + + if (err) goto err_out_free_mdio_irq; if (macb_mii_probe(bp->dev) != 0) { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] net/cadence/macb: add support for dt phy definition 2013-08-22 15:57 ` [PATCH 1/2] " Boris BREZILLON @ 2013-08-22 16:00 ` boris brezillon 0 siblings, 0 replies; 12+ messages in thread From: boris brezillon @ 2013-08-22 16:00 UTC (permalink / raw) To: Florian Fainelli Cc: Boris BREZILLON, Nicolas Ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, netdev, linux-kernel, linux-arm-kernel, devicetree Hello Florian, On 22/08/2013 17:57, Boris BREZILLON wrote: > The macb driver only handle PHY description through platform_data > (macb_platform_data). > Thus, when using dt you cannot define phy properties like phy address or > phy irq pin. > > This patch makes use of the of_mdiobus_register to add support for > phy device definition using dt. > A fallback to the autoscan procedure is added in case there is no phy > devices defined in dt. > > Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> > --- > drivers/net/ethernet/cadence/macb.c | 41 +++++++++++++++++++++++++++++------ > 1 file changed, 34 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c > index e866608..fe06ab0 100644 > --- a/drivers/net/ethernet/cadence/macb.c > +++ b/drivers/net/ethernet/cadence/macb.c > @@ -27,6 +27,7 @@ > #include <linux/phy.h> > #include <linux/of.h> > #include <linux/of_device.h> > +#include <linux/of_mdio.h> > #include <linux/of_net.h> > #include <linux/pinctrl/consumer.h> > > @@ -314,6 +315,7 @@ static int macb_mii_probe(struct net_device *dev) > int macb_mii_init(struct macb *bp) > { > struct macb_platform_data *pdata; > + struct device_node *np; > int err = -ENXIO, i; > > /* Enable management port */ > @@ -335,21 +337,46 @@ int macb_mii_init(struct macb *bp) > bp->mii_bus->parent = &bp->dev->dev; > pdata = bp->pdev->dev.platform_data; > > - if (pdata) > - bp->mii_bus->phy_mask = pdata->phy_mask; > - > bp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); > if (!bp->mii_bus->irq) { > err = -ENOMEM; > goto err_out_free_mdiobus; > } > > - for (i = 0; i < PHY_MAX_ADDR; i++) > - bp->mii_bus->irq[i] = PHY_POLL; > - > dev_set_drvdata(&bp->dev->dev, bp->mii_bus); > > - if (mdiobus_register(bp->mii_bus)) > + np = bp->pdev->dev.of_node; > + if (np) { > + /* try dt phy registration */ > + err = of_mdiobus_register(bp->mii_bus, np); > + > + /* fallback to standard phy registration if no phy were > + found during dt phy registration */ > + if (!err && !phy_find_first(bp->mii_bus)) { > + for (i = 0; i < PHY_MAX_ADDR; i++) { > + struct phy_device *phydev; > + > + phydev = mdiobus_scan(bp->mii_bus, i); > + if (IS_ERR(phydev)) { > + err = PTR_ERR(phydev); > + break; > + } > + } > + This is were I need the mdiobus_full_scan function. > + if (err) > + goto err_out_unregister_bus; > + } > + } else { > + for (i = 0; i < PHY_MAX_ADDR; i++) > + bp->mii_bus->irq[i] = PHY_POLL; > + > + if (pdata) > + bp->mii_bus->phy_mask = pdata->phy_mask; > + > + err = mdiobus_register(bp->mii_bus); > + } > + > + if (err) > goto err_out_free_mdio_irq; > > if (macb_mii_probe(bp->dev) != 0) { ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] ARM: at91/dt: define phy available on sama5d3 mother board 2013-08-22 15:56 [PATCH 0/2] net/cadence/macb: add support for dt phy definition Boris BREZILLON 2013-08-22 15:57 ` [PATCH 1/2] " Boris BREZILLON @ 2013-08-22 15:58 ` Boris BREZILLON 2013-08-26 20:04 ` [PATCH 0/2] net/cadence/macb: add support for dt phy definition David Miller 2 siblings, 0 replies; 12+ messages in thread From: Boris BREZILLON @ 2013-08-22 15:58 UTC (permalink / raw) To: Nicolas Ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, Florian Fainelli Cc: netdev, linux-kernel, linux-arm-kernel, devicetree, Boris BREZILLON This patch describe the phy used on atmel sama5d3 mother board: - phy address - phy interrupt pin Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> --- arch/arm/boot/dts/sama5d3xmb.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 8a9e05d..e9521d5 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -81,6 +81,14 @@ macb1: ethernet@f802c000 { phy-mode = "rmii"; + + #address-cells = <1>; + #size-cells = <0>; + phy0: ethernet-phy@0 { + interrupt-parent = <&pioE>; + interrupts = <30 IRQ_TYPE_EDGE_FALLING>; + reg = <1>; + }; }; pinctrl@fffff200 { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-22 15:56 [PATCH 0/2] net/cadence/macb: add support for dt phy definition Boris BREZILLON 2013-08-22 15:57 ` [PATCH 1/2] " Boris BREZILLON 2013-08-22 15:58 ` [PATCH 2/2] ARM: at91/dt: define phy available on sama5d3 mother board Boris BREZILLON @ 2013-08-26 20:04 ` David Miller 2013-08-27 7:42 ` boris brezillon 2 siblings, 1 reply; 12+ messages in thread From: David Miller @ 2013-08-26 20:04 UTC (permalink / raw) To: b.brezillon Cc: nicolas.ferre, rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, linux, f.fainelli, netdev, linux-kernel, linux-arm-kernel, devicetree From: Boris BREZILLON <b.brezillon@overkiz.com> Date: Thu, 22 Aug 2013 17:56:20 +0200 > This patch series adds support for ethernet phy definition using device > tree. > > This may help in moving some at91 boards to dt (some of them define an > interrupt pin). > > Tested on samad31ek. Series applied to net-next, thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-26 20:04 ` [PATCH 0/2] net/cadence/macb: add support for dt phy definition David Miller @ 2013-08-27 7:42 ` boris brezillon 2013-08-27 9:07 ` Florian Fainelli 2013-08-27 16:20 ` David Miller 0 siblings, 2 replies; 12+ messages in thread From: boris brezillon @ 2013-08-27 7:42 UTC (permalink / raw) To: David Miller Cc: nicolas.ferre, rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, linux, f.fainelli, netdev, linux-kernel, linux-arm-kernel, devicetree Hello Dave, On 26/08/2013 22:04, David Miller wrote: > From: Boris BREZILLON <b.brezillon@overkiz.com> > Date: Thu, 22 Aug 2013 17:56:20 +0200 > >> This patch series adds support for ethernet phy definition using device >> tree. >> >> This may help in moving some at91 boards to dt (some of them define an >> interrupt pin). >> >> Tested on samad31ek. > Series applied to net-next, thanks. Could you apply, the 3rd version of this series instead ? It fixes one bug when no phy is discovered and use the appropriate address for the phy dt node. Sorry for the inconvenience. Best Regards, Boris ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 7:42 ` boris brezillon @ 2013-08-27 9:07 ` Florian Fainelli 2013-08-27 9:13 ` boris brezillon 2013-08-27 16:20 ` David Miller 1 sibling, 1 reply; 12+ messages in thread From: Florian Fainelli @ 2013-08-27 9:07 UTC (permalink / raw) To: boris brezillon Cc: David Miller, nicolas.ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, netdev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Hello Boris, 2013/8/27 boris brezillon <b.brezillon@overkiz.com>: > Hello Dave, > > > On 26/08/2013 22:04, David Miller wrote: >> >> From: Boris BREZILLON <b.brezillon@overkiz.com> >> Date: Thu, 22 Aug 2013 17:56:20 +0200 >> >>> This patch series adds support for ethernet phy definition using device >>> tree. >>> >>> This may help in moving some at91 boards to dt (some of them define an >>> interrupt pin). >>> >>> Tested on samad31ek. >> >> Series applied to net-next, thanks. > > Could you apply, the 3rd version of this series instead ? > > It fixes one bug when no phy is discovered and use the appropriate address > for the phy dt node. > > Sorry for the inconvenience. You will probably have to resubmit an incremental patch, I have never seen David pick up another version of a patch once it has been pushed out: http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=8c038e7e14b1c5f156745e3c4df0a3aa46173dd9 http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=148cbb53ace32f584d208764c7f7e6aa8edb970c -- Florian ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 9:07 ` Florian Fainelli @ 2013-08-27 9:13 ` boris brezillon 2013-08-27 9:16 ` Nicolas Ferre 0 siblings, 1 reply; 12+ messages in thread From: boris brezillon @ 2013-08-27 9:13 UTC (permalink / raw) To: Florian Fainelli Cc: David Miller, nicolas.ferre, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, netdev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org On 27/08/2013 11:07, Florian Fainelli wrote: > Hello Boris, > > 2013/8/27 boris brezillon <b.brezillon@overkiz.com>: >> Hello Dave, >> >> >> On 26/08/2013 22:04, David Miller wrote: >>> From: Boris BREZILLON <b.brezillon@overkiz.com> >>> Date: Thu, 22 Aug 2013 17:56:20 +0200 >>> >>>> This patch series adds support for ethernet phy definition using device >>>> tree. >>>> >>>> This may help in moving some at91 boards to dt (some of them define an >>>> interrupt pin). >>>> >>>> Tested on samad31ek. >>> Series applied to net-next, thanks. >> Could you apply, the 3rd version of this series instead ? >> >> It fixes one bug when no phy is discovered and use the appropriate address >> for the phy dt node. >> >> Sorry for the inconvenience. > You will probably have to resubmit an incremental patch, I have never > seen David pick up another version of a patch once it has been pushed > out: > > http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=8c038e7e14b1c5f156745e3c4df0a3aa46173dd9 > http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=148cbb53ace32f584d208764c7f7e6aa8edb970c Okay, I will submit patches (based on net-next branch) to fix those bugs. Thanks. Best Regards, Boris ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 9:13 ` boris brezillon @ 2013-08-27 9:16 ` Nicolas Ferre 0 siblings, 0 replies; 12+ messages in thread From: Nicolas Ferre @ 2013-08-27 9:16 UTC (permalink / raw) To: boris brezillon Cc: Florian Fainelli, David Miller, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Russell King, netdev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org On 27/08/2013 11:13, boris brezillon : > On 27/08/2013 11:07, Florian Fainelli wrote: >> Hello Boris, >> >> 2013/8/27 boris brezillon <b.brezillon@overkiz.com>: >>> Hello Dave, >>> >>> >>> On 26/08/2013 22:04, David Miller wrote: >>>> From: Boris BREZILLON <b.brezillon@overkiz.com> >>>> Date: Thu, 22 Aug 2013 17:56:20 +0200 >>>> >>>>> This patch series adds support for ethernet phy definition using device >>>>> tree. >>>>> >>>>> This may help in moving some at91 boards to dt (some of them define an >>>>> interrupt pin). >>>>> >>>>> Tested on samad31ek. >>>> Series applied to net-next, thanks. >>> Could you apply, the 3rd version of this series instead ? >>> >>> It fixes one bug when no phy is discovered and use the appropriate address >>> for the phy dt node. >>> >>> Sorry for the inconvenience. >> You will probably have to resubmit an incremental patch, I have never >> seen David pick up another version of a patch once it has been pushed >> out: >> >> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=8c038e7e14b1c5f156745e3c4df0a3aa46173dd9 >> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=148cbb53ace32f584d208764c7f7e6aa8edb970c > Okay, I will submit patches (based on net-next branch) to fix those bugs. You can add my Acked-by to your fixes... Bye, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 7:42 ` boris brezillon 2013-08-27 9:07 ` Florian Fainelli @ 2013-08-27 16:20 ` David Miller 2013-08-27 16:38 ` boris brezillon 1 sibling, 1 reply; 12+ messages in thread From: David Miller @ 2013-08-27 16:20 UTC (permalink / raw) To: b.brezillon Cc: nicolas.ferre, rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, linux, f.fainelli, netdev, linux-kernel, linux-arm-kernel, devicetree From: boris brezillon <b.brezillon@overkiz.com> Date: Tue, 27 Aug 2013 09:42:34 +0200 > Could you apply, the 3rd version of this series instead ? There can never be an "instead" or reverting patches I've said I've applied already. If you want changes, you have to submit follow-on fixes. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 16:20 ` David Miller @ 2013-08-27 16:38 ` boris brezillon 2013-08-27 16:41 ` David Miller 0 siblings, 1 reply; 12+ messages in thread From: boris brezillon @ 2013-08-27 16:38 UTC (permalink / raw) To: David Miller Cc: nicolas.ferre, rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, linux, f.fainelli, netdev, linux-kernel, linux-arm-kernel, devicetree On 27/08/2013 18:20, David Miller wrote: > From: boris brezillon <b.brezillon@overkiz.com> > Date: Tue, 27 Aug 2013 09:42:34 +0200 > >> Could you apply, the 3rd version of this series instead ? > There can never be an "instead" or reverting patches I've said I've > applied already. > > If you want changes, you have to submit follow-on fixes. Hello David, I sent the incremental patches based on your net-next branch: https://lkml.org/lkml/2013/8/27/257 https://lkml.org/lkml/2013/8/27/259 Thanks. Best Regards, Boris ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] net/cadence/macb: add support for dt phy definition 2013-08-27 16:38 ` boris brezillon @ 2013-08-27 16:41 ` David Miller 0 siblings, 0 replies; 12+ messages in thread From: David Miller @ 2013-08-27 16:41 UTC (permalink / raw) To: b.brezillon Cc: nicolas.ferre, rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, linux, f.fainelli, netdev, linux-kernel, linux-arm-kernel, devicetree From: boris brezillon <b.brezillon@overkiz.com> Date: Tue, 27 Aug 2013 18:38:52 +0200 > On 27/08/2013 18:20, David Miller wrote: >> From: boris brezillon <b.brezillon@overkiz.com> >> Date: Tue, 27 Aug 2013 09:42:34 +0200 >> >>> Could you apply, the 3rd version of this series instead ? >> There can never be an "instead" or reverting patches I've said I've >> applied already. >> >> If you want changes, you have to submit follow-on fixes. > > Hello David, > > I sent the incremental patches based on your net-next branch: > https://lkml.org/lkml/2013/8/27/257 > https://lkml.org/lkml/2013/8/27/259 The place to check to see if your patch is queued up is here: http://patchwork.ozlabs.org/project/netdev/list/ If it's there, it's not necessary to notify me of anything. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-08-27 16:41 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-22 15:56 [PATCH 0/2] net/cadence/macb: add support for dt phy definition Boris BREZILLON 2013-08-22 15:57 ` [PATCH 1/2] " Boris BREZILLON 2013-08-22 16:00 ` boris brezillon 2013-08-22 15:58 ` [PATCH 2/2] ARM: at91/dt: define phy available on sama5d3 mother board Boris BREZILLON 2013-08-26 20:04 ` [PATCH 0/2] net/cadence/macb: add support for dt phy definition David Miller 2013-08-27 7:42 ` boris brezillon 2013-08-27 9:07 ` Florian Fainelli 2013-08-27 9:13 ` boris brezillon 2013-08-27 9:16 ` Nicolas Ferre 2013-08-27 16:20 ` David Miller 2013-08-27 16:38 ` boris brezillon 2013-08-27 16:41 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).