ar8216: introduce ar8xxx_reg_clear complementing ar8xxx_reg_set
authorJohn Crispin <john@openwrt.org>
Sat, 17 Jan 2015 14:24:56 +0000 (14:24 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 17 Jan 2015 14:24:56 +0000 (14:24 +0000)
Introduce ar8xxx_reg_clear complementing ar8xxx_reg_set.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
SVN-Revision: 44004

target/linux/generic/files/drivers/net/phy/ar8216.c
target/linux/generic/files/drivers/net/phy/ar8216.h
target/linux/generic/files/drivers/net/phy/ar8327.c

index 76dfcf4c015e7bf34c73b1ebf38f4b6edd143dbe..2fd44253c802411042e2b12bf2439651532e4cb0 100644 (file)
@@ -957,13 +957,11 @@ ar8216_set_mirror_regs(struct ar8xxx_priv *priv)
                   AR8216_GLOBAL_CPUPORT_MIRROR_PORT,
                   (0xF << AR8216_GLOBAL_CPUPORT_MIRROR_PORT_S));
        for (port = 0; port < AR8216_NUM_PORTS; port++) {
-               ar8xxx_rmw(priv, AR8216_REG_PORT_CTRL(port),
-                          AR8216_PORT_CTRL_MIRROR_RX,
-                          0);
+               ar8xxx_reg_clear(priv, AR8216_REG_PORT_CTRL(port),
+                          AR8216_PORT_CTRL_MIRROR_RX);
 
-               ar8xxx_rmw(priv, AR8216_REG_PORT_CTRL(port),
-                          AR8216_PORT_CTRL_MIRROR_TX,
-                          0);
+               ar8xxx_reg_clear(priv, AR8216_REG_PORT_CTRL(port),
+                          AR8216_PORT_CTRL_MIRROR_TX);
        }
 
        /* now enable mirroring if necessary */
index 50f225258f5bfe1adb9d43152dda91f62e1f25d3..d3d044324eb4198a8d67d43ef914ddaad392dab1 100644 (file)
@@ -536,4 +536,10 @@ ar8xxx_reg_set(struct ar8xxx_priv *priv, int reg, u32 val)
        ar8xxx_rmw(priv, reg, 0, val);
 }
 
+static inline void
+ar8xxx_reg_clear(struct ar8xxx_priv *priv, int reg, u32 val)
+{
+       ar8xxx_rmw(priv, reg, val, 0);
+}
+
 #endif
index b69c33b1233787da294aed817bc1b6a22a79faa7..f6d07c19829b1355860b8faa1378d7e390b998f4 100644 (file)
@@ -865,13 +865,11 @@ ar8327_set_mirror_regs(struct ar8xxx_priv *priv)
                   AR8327_FWD_CTRL0_MIRROR_PORT,
                   (0xF << AR8327_FWD_CTRL0_MIRROR_PORT_S));
        for (port = 0; port < AR8327_NUM_PORTS; port++) {
-               ar8xxx_rmw(priv, AR8327_REG_PORT_LOOKUP(port),
-                          AR8327_PORT_LOOKUP_ING_MIRROR_EN,
-                          0);
+               ar8xxx_reg_clear(priv, AR8327_REG_PORT_LOOKUP(port),
+                          AR8327_PORT_LOOKUP_ING_MIRROR_EN);
 
-               ar8xxx_rmw(priv, AR8327_REG_PORT_HOL_CTRL1(port),
-                          AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN,
-                          0);
+               ar8xxx_reg_clear(priv, AR8327_REG_PORT_HOL_CTRL1(port),
+                          AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN);
        }
 
        /* now enable mirroring if necessary */