summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2020-03-25 17:02:51 +0100
committerMarek Vasut <marex@denx.de>2020-05-22 19:46:45 +0200
commit6a457313642525feacdfea973dbabd639f5b3261 (patch)
treefb24522a3b853468355654c181c6d6d63974b4c5
parent8b41a167114ee847fb384f0d3ae61e86e89d133c (diff)
net: ks8851: Use 16bit RXQCR access
Per KS8851-16MLL, the RXQCR is a 16bit register. Use 16bit accessors to it consistently and drop the ks_wrreg8() function altogether, as it is not used anymore. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Eugen Hristev <eugen.hristev@microchip.com> Cc: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r--drivers/net/ks8851_mll.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 03b8d7c9fd..c1c143dbaa 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -119,15 +119,6 @@ static u16 ks_rdreg16(struct eth_device *dev, u16 offset)
return readw(dev->iobase);
}
-static void ks_wrreg8(struct eth_device *dev, u16 offset, u8 val)
-{
- u8 shift_bit = (offset & 0x03);
- u16 value_write = (u16)(val << ((offset & 1) << 3));
-
- writew(offset | (BE0 << shift_bit), dev->iobase + 2);
- writew(value_write, dev->iobase);
-}
-
static void ks_wrreg16(struct eth_device *dev, u16 offset, u16 val)
{
writew(offset | ((BE1 | BE0) << (offset & 0x02)), dev->iobase + 2);
@@ -275,7 +266,7 @@ static inline void ks_read_qmu(struct eth_device *dev, u16 *buf, u32 len)
/* 1. set sudo DMA mode */
ks_wrreg16(dev, KS_RXFDPR, RXFDPR_RXFPAI);
- ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_SDA);
+ ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_SDA);
/*
* 2. read prepend data
@@ -293,7 +284,7 @@ static inline void ks_read_qmu(struct eth_device *dev, u16 *buf, u32 len)
ks_inblk(dev, buf, ALIGN(len, 4));
/* 4. reset sudo DMA Mode */
- ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL);
+ ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL);
}
static void ks_rcv(struct eth_device *dev, uchar **pv_data)
@@ -518,13 +509,13 @@ static void ks_write_qmu(struct eth_device *dev, u8 *pdata, u16 len)
/* 1. set sudo-DMA mode */
ks_wrreg16(dev, KS_TXFDPR, TXFDPR_TXFPAI);
- ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_SDA);
+ ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_SDA);
/* 2. write status/lenth info */
ks_outblk(dev, ks->txh.txw, 4);
/* 3. write pkt data */
ks_outblk(dev, (u16 *)pdata, ALIGN(len, 4));
/* 4. reset sudo-DMA mode */
- ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL);
+ ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL);
/* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */
ks_wrreg16(dev, KS_TXQCR, TXQCR_METFE);
/* 6. wait until TXQCR_METFE is auto-cleared */