netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <dvrabel@cantab.net>
To: David Vrabel <dvrabel@cantab.net>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	romieu@fr.zoreil.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, david@pleyades.net
Subject: Re: IP1000 gigabit nic driver
Date: Mon, 01 May 2006 12:32:40 +0100	[thread overview]
Message-ID: <4455F1D8.5030102@cantab.net> (raw)
In-Reply-To: <44554ADE.8030200@cantab.net>

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

David Vrabel wrote:
> 
>     - something (PHY reset/auto negotiation?) takes 2-3 seconds and
>       appears to be done with interrupts disabled.

It was clocking the MII management interface (MDC) at 500 Hz so each PHY
register access took some 130 ms, and many registers accesses were being
done on initialization. According to the datasheet, the maximum
frequency for MDC is 2.5 MHz.  Delays have been adjusted accordingly.

David Vrabel

[-- Attachment #2: drivers-net-ipg-speed-up-phy-access --]
[-- Type: text/plain, Size: 3542 bytes --]

Reduce delays when reading/writing the PHY registers so we clock the
MII management interface at 2.5 MHz (the maximum according to the
datasheet) instead of 500 Hz.

Signed-off-by: David Vrabel <dvrabel@cantab.net>

Index: linux-source-2.6.16/drivers/net/ipg.c
===================================================================
--- linux-source-2.6.16.orig/drivers/net/ipg.c	2006-05-01 11:52:32.555800238 +0100
+++ linux-source-2.6.16/drivers/net/ipg.c	2006-05-01 12:08:45.316188064 +0100
@@ -176,13 +176,13 @@
 		 (IPG_PC_MGMTCLK_LO | (IPG_PC_MGMTDATA & 0) | IPG_PC_MGMTDIR |
 		  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-	mdelay(IPG_PC_PHYCTRLWAIT);
+	ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 	iowrite8(IPG_PC_RSVD_MASK &
 		 (IPG_PC_MGMTCLK_HI | (IPG_PC_MGMTDATA & 0) | IPG_PC_MGMTDIR |
 		  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-	mdelay(IPG_PC_PHYCTRLWAIT);
+	ndelay(IPG_PC_PHYCTRLWAIT_NS);
 }
 
 static void send_end(void __iomem * ioaddr, u8 phyctrlpolarity)
@@ -198,7 +198,7 @@
 	iowrite8(IPG_PC_RSVD_MASK & (IPG_PC_MGMTCLK_LO | phyctrlpolarity),
 		 ioaddr + IPG_PHYCTRL);
 
-	mdelay(IPG_PC_PHYCTRLWAIT);
+	ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 	bit_data =
 	    ((ioread8(ioaddr + IPG_PHYCTRL) & IPG_PC_MGMTDATA) >> 1) & 1;
@@ -206,7 +206,7 @@
 	iowrite8(IPG_PC_RSVD_MASK & (IPG_PC_MGMTCLK_HI | phyctrlpolarity),
 		 ioaddr + IPG_PHYCTRL);
 
-	mdelay(IPG_PC_PHYCTRLWAIT);
+	ndelay(IPG_PC_PHYCTRLWAIT_NS);
 	return bit_data;
 }
 
@@ -290,14 +290,14 @@
 				  (IPG_PC_MGMTDATA & databit) | IPG_PC_MGMTDIR |
 				  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 			iowrite8(IPG_PC_RSVD_MASK &
 				 (IPG_PC_MGMTCLK_HI |
 				  (IPG_PC_MGMTDATA & databit) | IPG_PC_MGMTDIR |
 				  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 		}
 
 	send_three_state(ioaddr, phyctrlpolarity);
@@ -403,14 +403,14 @@
 				  (IPG_PC_MGMTDATA & databit) | IPG_PC_MGMTDIR |
 				  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 			iowrite8(IPG_PC_RSVD_MASK &
 				 (IPG_PC_MGMTCLK_HI |
 				  (IPG_PC_MGMTDATA & databit) | IPG_PC_MGMTDIR |
 				  phyctrlpolarity), ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 		}
 
 	/* The last cycle is a tri-state, so read from the PHY.
@@ -421,7 +421,7 @@
 				 (IPG_PC_MGMTCLK_LO | phyctrlpolarity),
 				 ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 			field[j] |= ((ioread8(ioaddr + IPG_PHYCTRL) &
 				      IPG_PC_MGMTDATA) >> 1)
@@ -431,7 +431,7 @@
 				 (IPG_PC_MGMTCLK_HI | phyctrlpolarity),
 				 ioaddr + IPG_PHYCTRL);
 
-			mdelay(IPG_PC_PHYCTRLWAIT);
+			ndelay(IPG_PC_PHYCTRLWAIT_NS);
 
 		}
 }
Index: linux-source-2.6.16/drivers/net/ipg.h
===================================================================
--- linux-source-2.6.16.orig/drivers/net/ipg.h	2006-05-01 12:08:58.343035854 +0100
+++ linux-source-2.6.16/drivers/net/ipg.h	2006-05-01 12:09:37.282602113 +0100
@@ -672,10 +672,10 @@
 /* Number of IPG_AC_RESETWAIT timeperiods before declaring timeout. */
 #define         IPG_AC_RESET_TIMEOUT         0x0A
 
-/* Minimum number of miliseconds used to toggle MDC clock during
+/* Minimum number of nanoseconds used to toggle MDC clock during
  * MII/GMII register access.
  */
-#define         IPG_PC_PHYCTRLWAIT           0x01
+#define		IPG_PC_PHYCTRLWAIT_NS		200
 
 #define		IPG_TFDLIST_LENGTH		0x100
 

  parent reply	other threads:[~2006-05-01 11:32 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060427142939.GA31473@fargo>
2006-04-27 18:56 ` IP1000 gigabit nic driver Francois Romieu
2006-04-27 22:26   ` David Vrabel
2006-04-28  7:57     ` David Gómez
2006-04-28 10:58       ` Pekka Enberg
2006-04-28 11:37         ` David Gómez
2006-04-28 11:51           ` Pekka J Enberg
2006-04-28 11:59           ` Pekka J Enberg
2006-04-28 21:58             ` David Gómez
2006-04-29 10:29             ` Pekka Enberg
2006-04-29 10:35               ` Arjan van de Ven
2006-04-29 12:21               ` David Gómez
2006-04-29 20:35                 ` Pekka Enberg
2006-04-30  9:26                   ` Pekka Enberg
2006-04-30 23:40                     ` David Vrabel
2006-05-01  9:31                       ` Pekka Enberg
2006-05-03 12:43                         ` Andrew Morton
2006-05-03 13:06                           ` Pekka J Enberg
2006-05-03 14:15                             ` David Vrabel
2006-05-01  9:43                       ` Pekka Enberg
2006-05-01 11:32                       ` David Vrabel [this message]
2006-05-01 18:08                         ` Pekka Enberg
2006-05-01 23:10                           ` [PATCH 1/3] ipg: removal of unreachable code Francois Romieu
2006-05-02  6:36                             ` Pekka J Enberg
2006-05-01 23:10                           ` [PATCH 2/3] ipg: leaks in ipg_probe Francois Romieu
2006-05-02  6:41                             ` Pekka J Enberg
2006-05-02 18:33                               ` Francois Romieu
2006-05-02 19:04                                 ` Pekka Enberg
2006-05-02 22:30                                   ` [PATCH] ipg: removing more dead code David Gómez
2006-05-03 13:12                                     ` Pekka J Enberg
2006-05-03 21:00                                   ` [PATCH 2/3] ipg: leaks in ipg_probe David Gómez
2006-05-01 23:12                           ` [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open Francois Romieu
2006-05-02  6:45                             ` Pekka J Enberg
2006-05-02 21:44                               ` [PATCH 1/2] ipg: sanitize the pci device table Francois Romieu
2006-05-02 21:45                               ` [PATCH 2/2] ipg: redundancy with mii.h Francois Romieu
2006-05-02 21:55                                 ` Francois Romieu
2006-05-03  6:16                                   ` Pekka J Enberg
2006-05-03 23:35                                     ` Francois Romieu
2006-05-04  6:52                                       ` David Vrabel
2006-05-05  0:24                                         ` Francois Romieu
2006-05-04 13:44                                       ` Pekka Enberg
2006-05-04 23:55                                         ` Francois Romieu
2006-05-20 21:03                                           ` David Vrabel
2006-05-21  7:23                                             ` Pekka Enberg
2006-05-21 10:16                                             ` Francois Romieu
2006-05-22  3:22                                               ` jesse\(建興\)
2006-05-23  6:50                                               ` jesse\(建興\)
2006-05-01 20:38                         ` IP1000 gigabit nic driver Francois Romieu
2006-05-01 20:41                           ` Lennert Buytenhek
2006-05-02  0:36                             ` David Vrabel
2006-05-01 19:39                   ` David Gómez
2006-04-29 12:58               ` David Vrabel
2006-04-28 11:59           ` Ingo Oeser
2006-04-28  7:54   ` David Gómez

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=4455F1D8.5030102@cantab.net \
    --to=dvrabel@cantab.net \
    --cc=david@pleyades.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=romieu@fr.zoreil.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).