[PATCH v2 3/6] drivers: net: fec_imx: add promiscuous mode configuration support

Sascha Hauer sha at pengutronix.de
Fri Nov 4 01:29:04 PDT 2022


On Thu, Nov 03, 2022 at 02:13:48PM +0100, Oleksij Rempel wrote:
> Add promiscuous mode configuration support to allow using multiple MAC address
> on same FEC interfaces.
> 
> Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
> ---
>  drivers/net/fec_imx.c | 24 +++++++++++++++++++++++-
>  drivers/net/fec_imx.h |  1 +
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 673555a48a..a5ff764e28 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -25,6 +25,22 @@
>  
>  #include "fec_imx.h"
>  
> +static int fec_set_promiscuous_mode(struct eth_device *edev, bool enable)
> +{
> +	struct fec_priv *fec = (struct fec_priv *)edev->priv;
> +	u32 rcntl;
> +
> +	rcntl = readl(fec->regs + FEC_R_CNTRL);
> +
> +	if (enable)
> +		rcntl |= FEC_R_CNTRL_PROMISC;
> +	else
> +		rcntl &= ~FEC_R_CNTRL_PROMISC;
> +
> +	writel(rcntl, fec->regs + FEC_R_CNTRL);
> +
> +	return 0;
> +}
>  
>  /*
>   * MII-interface related functions
> @@ -257,10 +273,13 @@ static int fec_init(struct eth_device *dev)
>  	 */
>  	writel(0x00000000, fec->regs + FEC_IMASK);
>  
> +	rcntl = readl(fec->regs + FEC_R_CNTRL);
> +	rcntl &= FEC_R_CNTRL_PROMISC;
> +
>  	/*
>  	 * Set FEC-Lite receive control register(R_CNTRL):
>  	 */
> -	rcntl = FEC_R_CNTRL_MAX_FL(1518);
> +	rcntl |= FEC_R_CNTRL_MAX_FL(1518);

Mask out the set bits before setting them again.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list