[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1547695326-31553-3-git-send-email-Tristram.Ha@microchip.com>
Date: Wed, 16 Jan 2019 19:22:04 -0800
From: <Tristram.Ha@...rochip.com>
To: Sergio Paracuellos <sergio.paracuellos@...il.com>,
Marek Vasut <marex@...x.de>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Pavel Machek <pavel@....cz>,
Dan Carpenter <dan.carpenter@...cle.com>
CC: Tristram Ha <Tristram.Ha@...rochip.com>,
<vivien.didelot@...oirfairelinux.com>,
<UNGLinuxDriver@...rochip.com>, <netdev@...r.kernel.org>
Subject: [PATCH RFC 2/4] net: dsa: microchip: Use regmap_update_bits
From: Tristram Ha <Tristram.Ha@...rochip.com>
Use regmap_update_bits function for bit manipulation in 32-bit access.
Signed-off-by: Tristram Ha <Tristram.Ha@...rochip.com>
---
drivers/net/dsa/microchip/ksz9477.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 89ed059..14b6371 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -65,31 +65,14 @@
static void ksz9477_cfg32(struct ksz_device *dev, u32 addr, u32 bits, bool set)
{
- u32 data;
-
- ksz_read32(dev, addr, &data);
- if (set)
- data |= bits;
- else
- data &= ~bits;
- ksz_write32(dev, addr, data);
+ regmap_update_bits(dev->regmap[2], addr, bits, set ? bits : 0);
}
static void ksz9477_port_cfg32(struct ksz_device *dev, int port, int offset,
u32 bits, bool set)
{
- u32 addr;
- u32 data;
-
- addr = PORT_CTRL_ADDR(port, offset);
- ksz_read32(dev, addr, &data);
-
- if (set)
- data |= bits;
- else
- data &= ~bits;
-
- ksz_write32(dev, addr, data);
+ regmap_update_bits(dev->regmap[2], PORT_CTRL_ADDR(port, offset), bits,
+ set ? bits : 0);
}
static int ksz9477_wait_vlan_ctrl_ready(struct ksz_device *dev, u32 waiton,
--
1.9.1
Powered by blists - more mailing lists