public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH 02/12] net: ks8851: Remove RXQCR cache
Date: Wed, 25 Mar 2020 19:44:51 +0100	[thread overview]
Message-ID: <20200325184501.200580-2-marex@denx.de> (raw)
In-Reply-To: <20200325184501.200580-1-marex@denx.de>

The cached RXQCR value is never updated, remove the cache and just use
the bits in the cache directly in the code.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/ks8851_mll.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 4386763bac..367ad2a397 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -49,7 +49,6 @@ union ks_tx_hdr {
  * @frame_cnt	: number of frames received.
  * @bus_width	: i/o bus width.
  * @irq		: irq number assigned to this device.
- * @rc_rxqcr	: Cached copy of KS_RXQCR.
  * @rc_txcr	: Cached copy of KS_TXCR.
  * @rc_ier	: Cached copy of KS_IER.
  * @sharedbus	: Multipex(addr and data bus) mode indicator.
@@ -80,7 +79,6 @@ struct ks_net {
 	u32			frame_cnt;
 	int			bus_width;
 	int			irq;
-	u16			rc_rxqcr;
 	u16			rc_txcr;
 	u16			rc_ier;
 	u16			sharedbus;
@@ -275,7 +273,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, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
+	ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_SDA);
 
 	/*
 	 * 2. read prepend data
@@ -293,7 +291,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, (ks->rc_rxqcr & ~RXQCR_SDA) & 0xff);
+	ks_wrreg8(dev, KS_RXQCR, RXQCR_CMD_CNTL);
 }
 
 static void ks_rcv(struct eth_device *dev, uchar **pv_data)
@@ -324,7 +322,7 @@ static void ks_rcv(struct eth_device *dev, uchar **pv_data)
 			net_process_received_packet(*pv_data, frame_hdr->len);
 			pv_data++;
 		} else {
-			ks_wrreg16(dev, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
+			ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL | RXQCR_RRXEF);
 			printf(DRIVERNAME ": bad packet\n");
 		}
 		frame_hdr++;
@@ -379,8 +377,7 @@ static void ks_setup(struct eth_device *dev)
 	ks_wrreg16(dev, KS_RXFCTR, 1 & RXFCTR_THRESHOLD_MASK);
 
 	/* Setup RxQ Command Control (RXQCR) */
-	ks->rc_rxqcr = RXQCR_CMD_CNTL;
-	ks_wrreg16(dev, KS_RXQCR, ks->rc_rxqcr);
+	ks_wrreg16(dev, KS_RXQCR, RXQCR_CMD_CNTL);
 
 	/*
 	 * set the force mode to half duplex, default is full duplex
@@ -519,13 +516,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, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
+	ks_wrreg8(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, (ks->rc_rxqcr & ~RXQCR_SDA) & 0xff);
+	ks_wrreg8(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 */
-- 
2.25.1

  reply	other threads:[~2020-03-25 18:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 18:44 [PATCH 01/12] net: ks8851: Replace malloc()+memset() with calloc() Marek Vasut
2020-03-25 18:44 ` Marek Vasut [this message]
2020-03-25 18:44 ` [PATCH 03/12] net: ks8851: Use 16bit RXQCR access Marek Vasut
2020-03-25 18:44 ` [PATCH 04/12] net: ks8851: Trim down struct ks_net Marek Vasut
2020-03-25 18:44 ` [PATCH 05/12] net: ks8851: Remove type_frame_head Marek Vasut
2020-03-25 18:44 ` [PATCH 06/12] net: ks8851: Clean up chip ID readout Marek Vasut
2020-03-25 18:44 ` [PATCH 07/12] net: ks8851: Checkpatch cleanup Marek Vasut
2020-03-25 18:44 ` [PATCH 08/12] net: ks8851: Pass around driver private data Marek Vasut
2020-03-25 18:44 ` [PATCH 09/12] net: ks8851: Split non-DM specific bits from common code Marek Vasut
2020-03-25 18:44 ` [PATCH 10/12] net: ks8851: Receive one packet per recv call Marek Vasut
2020-03-25 18:45 ` [PATCH 11/12] net: ks8851: Add DM support Marek Vasut
2020-03-25 18:45 ` [PATCH 12/12] net: ks8851: Add Kconfig entries Marek Vasut
2020-04-16 13:06 ` [PATCH 01/12] net: ks8851: Replace malloc()+memset() with calloc() Marek Vasut
2020-04-16 13:57 ` Joe Hershberger

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=20200325184501.200580-2-marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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