linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
       [not found] <1430299742-29428-1-git-send-email-igal.liberman@freescale.com>
@ 2015-07-20 12:16 ` Joakim Tjernlund
  2015-07-20 12:28   ` Madalin-Cristian Bucur
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2015-07-20 12:16 UTC (permalink / raw)
  To: netdev, igal.liberman; +Cc: linuxppc-dev, linux-kernel, madalin.bucur

On Wed, 2015-04-29 at 12:29 +0300, Igal.Liberman wrote:
> From: Igal Liberman <Igal.Liberman@freescale.com>
> 
> This patch adds the Ethernet MAC driver support.
> 
> Signed-off-by: Igal Liberman <Igal.Liberman@freescale.com>
> ---
>  drivers/net/ethernet/freescale/fman/inc/mac.h     |  125 +++++
>  drivers/net/ethernet/freescale/fman/mac/Makefile  |    3 +-
>  drivers/net/ethernet/freescale/fman/mac/mac-api.c |  605 +++++++++++++++++++++
>  drivers/net/ethernet/freescale/fman/mac/mac.c     |  527 ++++++++++++++++++
>  4 files changed, 1259 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h
>  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c
>  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c
> 
> diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h
> new file mode 100644
> index 0000000..2d27331
> --- /dev/null
> +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h
.....
> +	/* Get the rest of the PHY information */
> +	mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
> +	if (!mac_dev->phy_node) {
> +		int sz;
> +		const u32 *phy_id = of_get_property(mac_node, "fixed-link",
> +							&sz);
> +		if (!phy_id || sz < sizeof(*phy_id)) {
> +			dev_err(dev, "No PHY (or fixed link) found\n");
> +			_errno = -EINVAL;
> +			goto _return_dev_set_drvdata;
> +		}
> +
> +		sprintf(mac_dev->fixed_bus_id, PHY_ID_FMT, "fixed-0",
> +			phy_id[0]);
> +	}

The above for fixed PHY does not work for me, changing it to does:

diff --git a/drivers/net/ethernet/freescale/fman/mac/mac.c b/drivers/net/ethernet/freescale/fman/mac/mac.c
index 4eb8f7c..a8be96a 100644
--- a/drivers/net/ethernet/freescale/fman/mac/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac/mac.c
@@ -42,6 +42,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/device.h>
 #include <linux/phy.h>
@@ -399,7 +400,7 @@ static int __cold mac_probe(struct platform_device *_of_dev)
 
        /* Get the rest of the PHY information */
        mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
-       if (!mac_dev->phy_node) {
+       if (0 && !mac_dev->phy_node) {
                int sz;
                const u32 *phy_id = of_get_property(mac_node, "fixed-link",
                                                        &sz);
@@ -412,6 +413,16 @@ static int __cold mac_probe(struct platform_device *_of_dev)
                sprintf(mac_dev->fixed_bus_id, PHY_ID_FMT, "fixed-0",
                        phy_id[0]);
        }
+       if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
+               /*
+                * In the case of a fixed PHY, the DT node associated
+                * to the PHY is the Ethernet MAC DT node.
+                */
+               _errno = of_phy_register_fixed_link(mac_node);
+               if (_errno)
+                       return _errno;
+               mac_dev->phy_node = of_node_get(mac_node);
+       }

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

* RE: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
  2015-07-20 12:16 ` [RFC,v3,12/12] fsl/fman: Add FMan MAC driver Joakim Tjernlund
@ 2015-07-20 12:28   ` Madalin-Cristian Bucur
  2015-07-20 12:57     ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Madalin-Cristian Bucur @ 2015-07-20 12:28 UTC (permalink / raw)
  To: Joakim Tjernlund, netdev, Liberman Igal; +Cc: linuxppc-dev, linux-kernel

Hi Joakim,

It seems we just need to align to the API introduced by Thomas Petazzoni
in 3be2a49e.

Madalin

> -----Original Message-----
> From: Joakim Tjernlund [mailto:joakim.tjernlund@transmode.se]
> Sent: Monday, July 20, 2015 3:16 PM
> To: netdev@vger.kernel.org; Liberman Igal-B31950
> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Bucur
> Madalin-Cristian-B32716
> Subject: Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
> 
> On Wed, 2015-04-29 at 12:29 +0300, Igal.Liberman wrote:
> > From: Igal Liberman <Igal.Liberman@freescale.com>
> >
> > This patch adds the Ethernet MAC driver support.
> >
> > Signed-off-by: Igal Liberman <Igal.Liberman@freescale.com>
> > ---
> >  drivers/net/ethernet/freescale/fman/inc/mac.h     |  125 +++++
> >  drivers/net/ethernet/freescale/fman/mac/Makefile  |    3 +-
> >  drivers/net/ethernet/freescale/fman/mac/mac-api.c |  605
> +++++++++++++++++++++
> >  drivers/net/ethernet/freescale/fman/mac/mac.c     |  527
> ++++++++++++++++++
> >  4 files changed, 1259 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h
> >  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c
> >  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c
> >
> > diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h
> b/drivers/net/ethernet/freescale/fman/inc/mac.h
> > new file mode 100644
> > index 0000000..2d27331
> > --- /dev/null
> > +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h
> .....
> > +	/* Get the rest of the PHY information */
> > +	mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle",
> 0);
> > +	if (!mac_dev->phy_node) {
> > +		int sz;
> > +		const u32 *phy_id = of_get_property(mac_node, "fixed-
> link",
> > +							&sz);
> > +		if (!phy_id || sz < sizeof(*phy_id)) {
> > +			dev_err(dev, "No PHY (or fixed link) found\n");
> > +			_errno = -EINVAL;
> > +			goto _return_dev_set_drvdata;
> > +		}
> > +
> > +		sprintf(mac_dev->fixed_bus_id, PHY_ID_FMT, "fixed-0",
> > +			phy_id[0]);
> > +	}
> 
> The above for fixed PHY does not work for me, changing it to does:
> 
> diff --git a/drivers/net/ethernet/freescale/fman/mac/mac.c
> b/drivers/net/ethernet/freescale/fman/mac/mac.c
> index 4eb8f7c..a8be96a 100644
> --- a/drivers/net/ethernet/freescale/fman/mac/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac/mac.c
> @@ -42,6 +42,7 @@
>  #include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/of_platform.h>
> +#include <linux/of_mdio.h>
>  #include <linux/of_net.h>
>  #include <linux/device.h>
>  #include <linux/phy.h>
> @@ -399,7 +400,7 @@ static int __cold mac_probe(struct platform_device
> *_of_dev)
> 
>         /* Get the rest of the PHY information */
>         mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
> -       if (!mac_dev->phy_node) {
> +       if (0 && !mac_dev->phy_node) {
>                 int sz;
>                 const u32 *phy_id = of_get_property(mac_node, "fixed-link",
>                                                         &sz);
> @@ -412,6 +413,16 @@ static int __cold mac_probe(struct platform_device
> *_of_dev)
>                 sprintf(mac_dev->fixed_bus_id, PHY_ID_FMT, "fixed-0",
>                         phy_id[0]);
>         }
> +       if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
> +               /*
> +                * In the case of a fixed PHY, the DT node associated
> +                * to the PHY is the Ethernet MAC DT node.
> +                */
> +               _errno = of_phy_register_fixed_link(mac_node);
> +               if (_errno)
> +                       return _errno;
> +               mac_dev->phy_node = of_node_get(mac_node);
> +       }

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

* Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
  2015-07-20 12:28   ` Madalin-Cristian Bucur
@ 2015-07-20 12:57     ` Joakim Tjernlund
  2015-07-20 13:33       ` Madalin-Cristian Bucur
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2015-07-20 12:57 UTC (permalink / raw)
  To: netdev, Igal.Liberman, madalin.bucur; +Cc: linuxppc-dev, linux-kernel

On Mon, 2015-07-20 at 12:28 +0000, Madalin-Cristian Bucur wrote:
> Hi Joakim,
> 
> It seems we just need to align to the API introduced by Thomas Petazzoni
> in 3be2a49e.
> 
> Madalin

So it seems, any idea when the next spin will be ready?
Could you also push it onto 
  http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
?

 Jocke

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

* RE: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
  2015-07-20 12:57     ` Joakim Tjernlund
@ 2015-07-20 13:33       ` Madalin-Cristian Bucur
  2015-07-21 13:44         ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Madalin-Cristian Bucur @ 2015-07-20 13:33 UTC (permalink / raw)
  To: Joakim Tjernlund, netdev, Liberman Igal; +Cc: linuxppc-dev, linux-kernel

> -----Original Message-----
> From: Joakim Tjernlund [mailto:joakim.tjernlund@transmode.se]
> Sent: Monday, July 20, 2015 3:57 PM
> To: netdev@vger.kernel.org; Liberman Igal-B31950; Bucur Madalin-Cristian-
> B32716
> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
> 
> On Mon, 2015-07-20 at 12:28 +0000, Madalin-Cristian Bucur wrote:
> > Hi Joakim,
> >
> > It seems we just need to align to the API introduced by Thomas Petazzoni
> > in 3be2a49e.
> >
> > Madalin
> 
> So it seems, any idea when the next spin will be ready?
> Could you also push it onto
>   http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
> ?
> 
>  Jocke

We're working on addressing all the feedback received to date (you've just added
a bit more) then we'll re-submit the FMan driver together with the DPAA Ethernet
driver. A push in the public git is also going to take place after the patches are sent
for review.

Madalin

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

* Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
  2015-07-20 13:33       ` Madalin-Cristian Bucur
@ 2015-07-21 13:44         ` Joakim Tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2015-07-21 13:44 UTC (permalink / raw)
  To: netdev, Igal.Liberman, madalin.bucur; +Cc: linuxppc-dev, linux-kernel

On Mon, 2015-07-20 at 13:33 +0000, Madalin-Cristian Bucur wrote:
> > -----Original Message-----
> > From: Joakim Tjernlund [mailto:joakim.tjernlund@transmode.se]
> > Sent: Monday, July 20, 2015 3:57 PM
> > To: netdev@vger.kernel.org; Liberman Igal-B31950; Bucur Madalin-Cristian-
> > B32716
> > Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> > Subject: Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
> > 
> > On Mon, 2015-07-20 at 12:28 +0000, Madalin-Cristian Bucur wrote:
> > > Hi Joakim,
> > > 
> > > It seems we just need to align to the API introduced by Thomas Petazzoni
> > > in 3be2a49e.
> > > 
> > > Madalin
> > 
> > So it seems, any idea when the next spin will be ready?
> > Could you also push it onto
> >   http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
> > ?
> > 
> >  Jocke
> 
> We're working on addressing all the feedback received to date (you've just added
> a bit more) then we'll re-submit the FMan driver together with the DPAA Ethernet
> driver. A push in the public git is also going to take place after the patches are sent
> for review.

Hi again

Now I got to actually use PHY less(aka. Fixed PHY) too. I had to hack AN off for all such links
to get a 1000 SGMII link working:
--- a/drivers/net/ethernet/freescale/fman/mac/memac.c
+++ b/drivers/net/ethernet/freescale/fman/mac/memac.c
@@ -80,7 +80,10 @@ static void setup_sgmii_internal_phy(struct memac_t *p_memac, uint8_t phy_addr)
                           ENET_SPEED_1000);
 
        /* SGMII mode + AN enable */
-       tmp_reg16 = PHY_SGMII_IF_MODE_AN | PHY_SGMII_IF_MODE_SGMII;
+       //tmp_reg16 = PHY_SGMII_IF_MODE_AN | PHY_SGMII_IF_MODE_SGMII;
+       tmp_reg16 = PHY_SGMII_IF_MODE_AN | PHY_SGMII_IF_MODE_SGMII | 0x8;
+       if (p_memac->mac_id != 0)
+               tmp_reg16 &= ~PHY_SGMII_IF_MODE_AN;
        memac_mii_write_phy_reg(p_memac, phy_addr, 0x14, tmp_reg16);
 
        /* Device ability according to SGMII specification */
@@ -104,6 +107,8 @@ static void setup_sgmii_internal_phy(struct memac_t *p_memac, uint8_t phy_addr)
 
        /* Restart AN */
        tmp_reg16 = PHY_SGMII_CR_DEF_VAL | PHY_SGMII_CR_RESET_AN;
+       if (p_memac->mac_id != 0)
+               tmp_reg16 &= ~0x1000;
        memac_mii_write_phy_reg(p_memac, phy_addr, 0x0, tmp_reg16);
 
        /* Restore original enet mode */


Could you please fix this too?

 Jocke

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

end of thread, other threads:[~2015-07-21 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1430299742-29428-1-git-send-email-igal.liberman@freescale.com>
2015-07-20 12:16 ` [RFC,v3,12/12] fsl/fman: Add FMan MAC driver Joakim Tjernlund
2015-07-20 12:28   ` Madalin-Cristian Bucur
2015-07-20 12:57     ` Joakim Tjernlund
2015-07-20 13:33       ` Madalin-Cristian Bucur
2015-07-21 13:44         ` Joakim Tjernlund

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