[PATCH v2 2/4] net: mvneta: add SFP TX disable handling
Marek Behún
marek.behun at nic.cz
Wed Mar 23 23:25:35 CET 2022
On Wed, 23 Mar 2022 18:19:08 +0100
Robert Marko <robert.marko at sartura.hr> wrote:
> Add support for handling SFP TX disable for MVNETA in the same fashion as
> to what MVPP2 is doing in order to enable using SFP-s.
>
> This allows using ethernet on SFP only boards.
>
> Signed-off-by: Robert Marko <robert.marko at sartura.hr>
> ---
> Changes in v2:
> * Parse the standard SFP node for TX disable GPIO instead of using a
> custom property
>
> drivers/net/mvneta.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 4a4268c2b2..018f2da393 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -286,6 +286,7 @@ struct mvneta_port {
> struct phy_device *phydev;
> #if CONFIG_IS_ENABLED(DM_GPIO)
> struct gpio_desc phy_reset_gpio;
> + struct gpio_desc sfp_tx_disable_gpio;
> #endif
> struct mii_dev *bus;
> };
> @@ -1693,6 +1694,9 @@ static int mvneta_probe(struct udevice *dev)
> {
> struct eth_pdata *pdata = dev_get_plat(dev);
> struct mvneta_port *pp = dev_get_priv(dev);
> +#if CONFIG_IS_ENABLED(DM_GPIO)
> + struct ofnode_phandle_args sfp_args;
> +#endif
> void *blob = (void *)gd->fdt_blob;
> int node = dev_of_offset(dev);
> struct mii_dev *bus;
> @@ -1767,6 +1771,11 @@ static int mvneta_probe(struct udevice *dev)
> return ret;
>
> #if CONFIG_IS_ENABLED(DM_GPIO)
> + ret = dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args);
> + if (!ret)
> + gpio_request_by_name_nodev(sfp_args.node, "tx-disable-gpio", 0,
> + &pp->sfp_tx_disable_gpio, GPIOD_IS_OUT);
This should also check whether the sfp_args.node is not disabled:
if (!ret && ofnode_is_enabled(sf_args.node))
because for example current dts for Turris Omnia in Linux' upstream
has sfp node but it is disabled by default.
The dev_read_phandle_with_args() function does not check whether the
sfp node is disabled or not (if I am looking at the code correctly.
Marek
More information about the U-Boot
mailing list