diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2022-11-08 07:10:06 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-11-08 11:12:49 +0100 |
commit | 55d6d85d7c1c05175470f717ab8074095aabc530 (patch) | |
tree | b8f3023784559a642c1123a47bc608615e18cd67 | |
parent | 062717c8ce04ec2fe0678b29e4b73ec97029d024 (diff) | |
download | barebox-55d6d85d7c1c05175470f717ab8074095aabc530.tar.gz barebox-55d6d85d7c1c05175470f717ab8074095aabc530.tar.xz |
drivers: net: fec_imx: add promiscuous mode configuration support
Add promiscuous mode configuration support to allow using multiple MAC address
on same FEC interface.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20221108061009.4168735-5-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/net/fec_imx.c | 24 | ||||
-rw-r--r-- | drivers/net/fec_imx.h | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 673555a48a..da42a479d9 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_promisc(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); rcntl |= FEC_R_CNTRL_MII_MODE; /* @@ -768,6 +787,7 @@ static int fec_probe(struct device_d *dev) edev->halt = fec_halt; edev->get_ethaddr = fec_get_hwaddr; edev->set_ethaddr = fec_set_hwaddr; + edev->set_promisc = fec_set_promisc; edev->parent = dev; dma_set_mask(dev, DMA_BIT_MASK(32)); @@ -834,6 +854,8 @@ static int fec_probe(struct device_d *dev) if (ret) goto free_gpio; + fec_set_promisc(edev, false); + /* * reserve memory for both buffer descriptor chains at once * Datasheet forces the startaddress of each chain is 16 byte aligned diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h index 316eefe48f..9bb1c64b55 100644 --- a/drivers/net/fec_imx.h +++ b/drivers/net/fec_imx.h @@ -58,6 +58,7 @@ #define FEC_R_CNTRL_RMII_10T (1 << 9) /* i.MX28 specific */ #define FEC_R_CNTRL_RMII_MODE (1 << 8) /* i.MX28 specific */ #define FEC_R_CNTRL_FCE (1 << 5) +#define FEC_R_CNTRL_PROMISC (1 << 3) #define FEC_R_CNTRL_MII_MODE (1 << 2) #define FEC_IEVENT_HBERR 0x80000000 /* Note: Not on i.MX28 */ |