[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181115203544.GG32274@lunn.ch>
Date: Thu, 15 Nov 2018 21:35:44 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Claudiu Manoil <claudiu.manoil@....com>
Cc: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, alexandru.marginean@....com,
catalin.horghidan@....com
Subject: Re: [PATCH net-next 1/4] enetc: Introduce basic PF and VF ENETC
ethernet drivers
On Thu, Nov 15, 2018 at 06:13:53PM +0200, Claudiu Manoil wrote:
> ENETC is a multi-port virtualized Ethernet controller supporting GbE
> designs
Hi Claudiu
Do you mean 1GbE, or multigigabit? Do you have a SERDES between the
MAC and the PHY? Could an SFP be connected?
> +static int enetc_of_get_phy(struct enetc_ndev_priv *priv)
> +{
> + struct device_node *np = priv->dev->of_node;
> + int err;
> +
> + if (!np) {
> + dev_err(priv->dev, "missing ENETC port node\n");
> + return -ENODEV;
> + }
> +
> + priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
> + if (!priv->phy_node) {
> + if (!of_phy_is_fixed_link(np)) {
> + dev_err(priv->dev, "PHY not specified\n");
> + return -ENODEV;
> + }
> +
> + err = of_phy_register_fixed_link(np);
> + if (err < 0) {
> + dev_err(priv->dev, "fixed link registration failed\n");
> + return err;
> + }
> +
> + priv->phy_node = of_node_get(np);
> + }
> +
> + priv->if_mode = of_get_phy_mode(np);
> + if (priv->if_mode < 0) {
> + dev_err(priv->dev, "missing phy type\n");
> + of_node_put(priv->phy_node);
> + if (of_phy_is_fixed_link(np))
> + of_phy_deregister_fixed_link(np);
> +
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
I asked the above questions because of this. Using phylink will
simplify a lot of this. And it makes you future proof for faster
speeds and handling the SERDES between the MAC and the PHY, and having
an SFP, etc.
Andrew
Powered by blists - more mailing lists