mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 3/6] drivers: net: fec_imx: add promiscuous mode configuration support
Date: Fri, 4 Nov 2022 09:29:04 +0100	[thread overview]
Message-ID: <20221104082904.GS3143@pengutronix.de> (raw)
In-Reply-To: <20221103131351.2059683-3-o.rempel@pengutronix.de>

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@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 |



  reply	other threads:[~2022-11-04  8:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 13:13 [PATCH v2 1/6] net: " Oleksij Rempel
2022-11-03 13:13 ` [PATCH v2 2/6] net: dsa: enable promiscuous mode for switch master edev Oleksij Rempel
2022-11-04  8:26   ` Sascha Hauer
2022-11-04  8:34     ` Ahmad Fatoum
2022-11-03 13:13 ` [PATCH v2 3/6] drivers: net: fec_imx: add promiscuous mode configuration support Oleksij Rempel
2022-11-04  8:29   ` Sascha Hauer [this message]
2022-11-04  8:52     ` Sascha Hauer
2022-11-03 13:13 ` [PATCH v2 4/6] net: dsa: fix of_device_ensure_probed*() for switch ports Oleksij Rempel
2022-11-03 13:13 ` [PATCH v2 5/6] ARM: boards: skov-imx6: convert all pr_ to dev_ prints Oleksij Rempel
2022-11-03 13:13 ` [PATCH v2 6/6] ARM: boards: skov-imx6: assigned separate MAC address to LAN2 Oleksij Rempel
2022-11-04  8:25 ` [PATCH v2 1/6] net: add promiscuous mode configuration support Sascha Hauer
2022-11-04  8:37 ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221104082904.GS3143@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox