summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/microchip/ksz9477_spi.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2019-06-26 01:43:46 +0200
committerDavid S. Miller <davem@davemloft.net>2019-06-27 11:00:31 -0700
commitee394fea6f0671fc2bb7e63161129a5d73d8d6e1 (patch)
tree36deaa2e9089f3b2aa7d8879ec9e94c0b389c8a7 /drivers/net/dsa/microchip/ksz9477_spi.c
parent46558d601cb6e245d9427d5044106a30811959fb (diff)
downloadlwn-ee394fea6f0671fc2bb7e63161129a5d73d8d6e1.tar.gz
lwn-ee394fea6f0671fc2bb7e63161129a5d73d8d6e1.zip
net: dsa: microchip: Dispose of ksz_io_ops
Since the driver now uses regmap , get rid of ad-hoc ksz_io_ops abstraction, which no longer has any meaning. Moreover, since regmap has it's own locking, get rid of the register access mutex. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Tristram Ha <Tristram.Ha@microchip.com> Cc: Woojung Huh <Woojung.Huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz9477_spi.c')
-rw-r--r--drivers/net/dsa/microchip/ksz9477_spi.c57
1 files changed, 1 insertions, 56 deletions
diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c
index c72645354dc2..d1ffdf51d58c 100644
--- a/drivers/net/dsa/microchip/ksz9477_spi.c
+++ b/drivers/net/dsa/microchip/ksz9477_spi.c
@@ -46,67 +46,12 @@ static const struct regmap_config ksz9477_regmap_config[] = {
KSZ_REGMAP_COMMON(32),
};
-static int ksz_spi_read8(struct ksz_device *dev, u32 reg, u8 *val)
-{
- unsigned int value;
- int ret = regmap_read(dev->regmap, reg, &value);
-
- *val = value;
- return ret;
-}
-
-static int ksz_spi_read16(struct ksz_device *dev, u32 reg, u16 *val)
-{
- int ret = regmap_bulk_read(dev->regmap, reg, val, 2);
-
- if (!ret)
- *val = be16_to_cpu(*val);
-
- return ret;
-}
-
-static int ksz_spi_read32(struct ksz_device *dev, u32 reg, u32 *val)
-{
- int ret = regmap_bulk_read(dev->regmap, reg, val, 4);
-
- if (!ret)
- *val = be32_to_cpu(*val);
-
- return ret;
-}
-
-static int ksz_spi_write8(struct ksz_device *dev, u32 reg, u8 value)
-{
- return regmap_write(dev->regmap, reg, value);
-}
-
-static int ksz_spi_write16(struct ksz_device *dev, u32 reg, u16 value)
-{
- value = cpu_to_be16(value);
- return regmap_bulk_write(dev->regmap, reg, &value, 2);
-}
-
-static int ksz_spi_write32(struct ksz_device *dev, u32 reg, u32 value)
-{
- value = cpu_to_be32(value);
- return regmap_bulk_write(dev->regmap, reg, &value, 4);
-}
-
-static const struct ksz_io_ops ksz9477_spi_ops = {
- .read8 = ksz_spi_read8,
- .read16 = ksz_spi_read16,
- .read32 = ksz_spi_read32,
- .write8 = ksz_spi_write8,
- .write16 = ksz_spi_write16,
- .write32 = ksz_spi_write32,
-};
-
static int ksz9477_spi_probe(struct spi_device *spi)
{
struct ksz_device *dev;
int i, ret;
- dev = ksz_switch_alloc(&spi->dev, &ksz9477_spi_ops, spi);
+ dev = ksz_switch_alloc(&spi->dev, spi);
if (!dev)
return -ENOMEM;