]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: fec: add set_promisc function
authorTim Harvey <tharvey@gateworks.com>
Wed, 30 Jun 2021 23:50:06 +0000 (16:50 -0700)
committerStefano Babic <sbabic@denx.de>
Sat, 10 Jul 2021 16:12:41 +0000 (18:12 +0200)
Enabling promiscuous mode is necessary if FEC is the master of a DSA
switch driver where each port has their own MAC address.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/fec_mxc.c
drivers/net/fec_mxc.h

index 77680491d0d62cab18e2b373786eea601ca31066..db2cdaf684bf00163478cbd2479a7147f05eaa6e 100644 (file)
@@ -458,6 +458,9 @@ static void fec_reg_setup(struct fec_priv *fec)
        else if (fec->xcv_type == RMII)
                rcntrl |= FEC_RCNTRL_RMII;
 
+       if (fec->promisc)
+               rcntrl |= 0x8;
+
        writel(rcntrl, &fec->eth->r_cntrl);
 }
 
@@ -1278,6 +1281,15 @@ static int fecmxc_read_rom_hwaddr(struct udevice *dev)
        return fec_get_hwaddr(priv->dev_id, pdata->enetaddr);
 }
 
+static int fecmxc_set_promisc(struct udevice *dev, bool enable)
+{
+       struct fec_priv *priv = dev_get_priv(dev);
+
+       priv->promisc = enable;
+
+       return 0;
+}
+
 static int fecmxc_free_pkt(struct udevice *dev, uchar *packet, int length)
 {
        if (packet)
@@ -1294,6 +1306,7 @@ static const struct eth_ops fecmxc_ops = {
        .stop                   = fecmxc_halt,
        .write_hwaddr           = fecmxc_set_hwaddr,
        .read_rom_hwaddr        = fecmxc_read_rom_hwaddr,
+       .set_promisc            = fecmxc_set_promisc,
 };
 
 static int device_get_phy_addr(struct fec_priv *priv, struct udevice *dev)
index 5ccde9193b2fd3960a451bfc22a165de9c55dfed..62b55ef3959a99862ed347a99c97b867883b5842 100644 (file)
@@ -272,6 +272,7 @@ struct fec_priv {
        struct clk clk_ref;
        struct clk clk_ptp;
        u32 clk_rate;
+       char promisc;
 };
 
 /**