[PATCH net-next v3 4/5] net: stmmac: add support for RZ/N1 GMAC

Serge Semin fancer.lancer at gmail.com
Tue Apr 16 07:47:38 PDT 2024


On Mon, Apr 15, 2024 at 11:18:44AM +0200, Romain Gantois wrote:
> [...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
> new file mode 100644
> index 0000000000000..e85524c2017cf
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 Schneider-Electric
> + *
> + * Clément Léger <clement.leger at bootlin.com>
> + */
> +
> +#include <linux/of.h>
> +#include <linux/pcs-rzn1-miic.h>
> +#include <linux/phylink.h>
> +#include <linux/platform_device.h>
> +
> +#include "stmmac_platform.h"
> +#include "stmmac.h"
> +
> +static int rzn1_dwmac_pcs_init(struct stmmac_priv *priv,

> +			       struct mac_device_info *hw)

AFAICS hw is unused, and the mac_device_info instance is reached via
the priv pointer. What about dropping the unused argument then?

> +{
> +	struct device_node *np = priv->device->of_node;
> +	struct device_node *pcs_node;
> +	struct phylink_pcs *pcs;
> +
> +	pcs_node = of_parse_phandle(np, "pcs-handle", 0);
> +
> +	if (pcs_node) {
> +		pcs = miic_create(priv->device, pcs_node);
> +		of_node_put(pcs_node);
> +		if (IS_ERR(pcs))
> +			return PTR_ERR(pcs);
> +
> +		priv->hw->phylink_pcs = pcs;
> +	}
> +
> +	return 0;
> +}
> +
> +static void rzn1_dwmac_pcs_exit(struct stmmac_priv *priv,

> +				struct mac_device_info *hw)

ditto.

-Serge(y)

> +{
> +	if (priv->hw->phylink_pcs)
> +		miic_destroy(priv->hw->phylink_pcs);
> +}
> +
> [...]



More information about the linux-arm-kernel mailing list