From: <Tristram.Ha@microchip.com>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>,
Marek Vasut <marex@denx.de>, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Pavel Machek <pavel@ucw.cz>,
Dan Carpenter <dan.carpenter@oracle.com>
Cc: Tristram Ha <Tristram.Ha@microchip.com>,
<vivien.didelot@savoirfairelinux.com>,
<UNGLinuxDriver@microchip.com>, <netdev@vger.kernel.org>
Subject: [PATCH RFC 2/4] net: dsa: microchip: Use regmap_update_bits
Date: Wed, 16 Jan 2019 19:22:04 -0800 [thread overview]
Message-ID: <1547695326-31553-3-git-send-email-Tristram.Ha@microchip.com> (raw)
In-Reply-To: <1547695326-31553-1-git-send-email-Tristram.Ha@microchip.com>
From: Tristram Ha <Tristram.Ha@microchip.com>
Use regmap_update_bits function for bit manipulation in 32-bit access.
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.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
next prev parent reply other threads:[~2019-01-17 3:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 3:22 [PATCH RFC 0/4] Convert KSZ9477 SPI driver to use regmap Tristram.Ha
2019-01-17 3:22 ` [PATCH RFC 1/4] net: dsa: microchip: convert " Tristram.Ha
2019-01-18 6:29 ` Marek Vasut
2019-01-18 10:50 ` Pavel Machek
2019-01-18 20:32 ` Tristram.Ha
2019-01-19 6:23 ` Marek Vasut
2019-01-19 13:22 ` Pavel Machek
2019-01-17 3:22 ` Tristram.Ha [this message]
2019-01-17 3:22 ` [PATCH RFC 3/4] net: dsa: microchip: remove ksz9477_get_port_addr Tristram.Ha
2019-01-17 3:22 ` [PATCH RFC 4/4] net: dsa: microchip: remove ksz_spi.h Tristram.Ha
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=1547695326-31553-3-git-send-email-Tristram.Ha@microchip.com \
--to=tristram.ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=dan.carpenter@oracle.com \
--cc=f.fainelli@gmail.com \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=sergio.paracuellos@gmail.com \
--cc=vivien.didelot@savoirfairelinux.com \
/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;
as well as URLs for NNTP newsgroup(s).