mbox series

[net-next,v2,0/3] dpaa2-mac: add PCS support through the Lynx module

Message ID 20200923154123.636-1-ioana.ciornei@nxp.com
Headers show
Series dpaa2-mac: add PCS support through the Lynx module | expand

Message

Ioana Ciornei Sept. 23, 2020, 3:41 p.m. UTC
This patch set aims to add PCS support in the dpaa2-eth driver by
leveraging the Lynx PCS module.

The first two patches are some missing pieces: the first one adding
support for 10GBASER in Lynx PCS while the second one adds a new
function - of_mdio_find_device - which is helpful in retrieving the PCS
represented as a mdio_device.  The final patch adds the glue logic
between phylink and the Lynx PCS module: it retrieves the PCS
represented as an mdio_device and registers it to Lynx and phylink.

Comments

Andrew Lunn Sept. 24, 2020, 1:07 a.m. UTC | #1
On Wed, Sep 23, 2020 at 06:41:21PM +0300, Ioana Ciornei wrote:
> Add support in the Lynx PCS module for the 10GBASE-R mode which is only
> used to get the link state, since it offers a single fixed speed.
> 
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Andrew Lunn Sept. 24, 2020, 1:10 a.m. UTC | #2
> +static int dpaa2_pcs_create(struct dpaa2_mac *mac,
> +			    struct device_node *dpmac_node, int id)
> +{
> +	struct mdio_device *mdiodev;
> +	struct device_node *node;
> +
> +	node = of_parse_phandle(dpmac_node, "pcs-handle", 0);
> +	if (!node) {
> +		/* do not error out on old DTS files */
> +		netdev_warn(mac->net_dev, "pcs-handle node not found\n");
> +		return 0;
> +	}
> +
> +	if (!of_device_is_available(node) ||
> +	    !of_device_is_available(node->parent)) {
> +		netdev_err(mac->net_dev, "pcs-handle node not available\n");
> +		return -ENODEV;
> +	}

Can a child be available when its parent is not? I've no idea!

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Ioana Ciornei Sept. 24, 2020, 5:25 a.m. UTC | #3
On Thu, Sep 24, 2020 at 03:10:51AM +0200, Andrew Lunn wrote:
> > +static int dpaa2_pcs_create(struct dpaa2_mac *mac,

> > +			    struct device_node *dpmac_node, int id)

> > +{

> > +	struct mdio_device *mdiodev;

> > +	struct device_node *node;

> > +

> > +	node = of_parse_phandle(dpmac_node, "pcs-handle", 0);

> > +	if (!node) {

> > +		/* do not error out on old DTS files */

> > +		netdev_warn(mac->net_dev, "pcs-handle node not found\n");

> > +		return 0;

> > +	}

> > +

> > +	if (!of_device_is_available(node) ||

> > +	    !of_device_is_available(node->parent)) {

> > +		netdev_err(mac->net_dev, "pcs-handle node not available\n");

> > +		return -ENODEV;

> > +	}

> 

> Can a child be available when its parent is not? I've no idea!

> 


One can definitely try and enable the child node from DTS while keeping
the parent disabled but what seems to be the outcome is that the
disabled state will trickle down from the parent node to all child
nodes.
This check is just a little more cautious than absolutely necessary.

Ioana
David Miller Sept. 25, 2020, 2:49 a.m. UTC | #4
From: Ioana Ciornei <ioana.ciornei@nxp.com>

Date: Wed, 23 Sep 2020 18:41:20 +0300

> This patch set aims to add PCS support in the dpaa2-eth driver by

> leveraging the Lynx PCS module.

> 

> The first two patches are some missing pieces: the first one adding

> support for 10GBASER in Lynx PCS while the second one adds a new

> function - of_mdio_find_device - which is helpful in retrieving the PCS

> represented as a mdio_device.  The final patch adds the glue logic

> between phylink and the Lynx PCS module: it retrieves the PCS

> represented as an mdio_device and registers it to Lynx and phylink.

> From that point on, any PCS callbacks are treated by Lynx, without

> dpaa2-eth interaction.

> 

> Changes in v2:

>  - move put_device() after destroy - 3/3


Series applied, thank you.