netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Florian Fainelli <florian@openwrt.org>
Subject: [PATCH 3/8] r6040: add a MAC operation timeout define
Date: Wed, 11 Apr 2012 19:18:38 +0200	[thread overview]
Message-ID: <1334164723-9627-4-git-send-email-florian@openwrt.org> (raw)
In-Reply-To: <1334164723-9627-1-git-send-email-florian@openwrt.org>

2048 is the usual value for busy-waiting on a register r/w, define it
as MAC_DEF_TIMEOUT and use it where it is appropriate.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 drivers/net/ethernet/rdc/r6040.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index fa29596..9ffbf6e 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -137,6 +137,8 @@
 #define MBCR_DEFAULT	0x012A	/* MAC Bus Control Register */
 #define MCAST_MAX	3	/* Max number multicast addresses to filter */
 
+#define MAC_DEF_TIMEOUT	2048	/* Default MAC read/write operation timeout */
+
 /* Descriptor status */
 #define DSC_OWNER_MAC	0x8000	/* MAC is the owner of this descriptor */
 #define DSC_RX_OK	0x4000	/* RX was successful */
@@ -204,7 +206,7 @@ static char version[] __devinitdata = DRV_NAME
 /* Read a word data from PHY Chip */
 static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
 {
-	int limit = 2048;
+	int limit = MAC_DEF_TIMEOUT;
 	u16 cmd;
 
 	iowrite16(MDIO_READ + reg + (phy_addr << 8), ioaddr + MMDIO);
@@ -222,7 +224,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
 static void r6040_phy_write(void __iomem *ioaddr,
 					int phy_addr, int reg, u16 val)
 {
-	int limit = 2048;
+	int limit = MAC_DEF_TIMEOUT;
 	u16 cmd;
 
 	iowrite16(val, ioaddr + MMWD);
@@ -361,7 +363,7 @@ err_exit:
 static void r6040_reset_mac(struct r6040_private *lp)
 {
 	void __iomem *ioaddr = lp->base;
-	int limit = 2048;
+	int limit = MAC_DEF_TIMEOUT;
 	u16 cmd;
 
 	iowrite16(MAC_RST, ioaddr + MCR1);
-- 
1.7.5.4

  parent reply	other threads:[~2012-04-11 17:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 17:18 [PATCH 0/8] r6040: misc cleanups Florian Fainelli
2012-04-11 17:18 ` [PATCH 1/8] r6040: consolidate MAC reset to its own function Florian Fainelli
2012-04-11 17:18 ` [PATCH 2/8] r6040: remove unused variable mcr1 from private structure Florian Fainelli
2012-04-11 17:18 ` Florian Fainelli [this message]
2012-04-11 17:18 ` [PATCH 4/8] r6040: fix typo on stats update in tx path Florian Fainelli
2012-04-11 17:18 ` [PATCH 5/8] r6040: define and use MLSR register bits Florian Fainelli
2012-04-11 17:18 ` [PATCH 6/8] r6040: define and use MTPR transmit enable bit Florian Fainelli
2012-04-11 17:18 ` [PATCH 7/8] r6040: define and use bits of register PHY_CC Florian Fainelli
2012-04-11 17:18 ` [PATCH 8/8] r6040: update copyright from 2007 to now Florian Fainelli
2012-04-12 20:07 ` [PATCH 0/8] r6040: misc cleanups David Miller

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=1334164723-9627-4-git-send-email-florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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).