netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Donald Becker <becker@scyld.com>
Cc: netdev@oss.sgi.com, Jason Lunz <lunz@falooley.org>,
	Richard Gooch <rgooch@ras.ucalgary.ca>,
	"Patrick R. McManus" <mcmanus@ducksong.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	edward_peng@dlink.com.tw
Subject: PATCH: sundance #3
Date: Thu, 19 Sep 2002 14:18:14 -0400	[thread overview]
Message-ID: <3D8A14E6.6000105@mandrakesoft.com> (raw)
In-Reply-To: Pine.LNX.4.44.0209191316300.29420-100000@beohost.scyld.com

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

The obvious sundance #3 patch follows...  cumulative to the 
sundance-1.04 base patch, and sundance #2 patch.

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5293 bytes --]

diff -Nru a/drivers/net/sundance.c b/drivers/net/sundance.c
--- a/drivers/net/sundance.c	Thu Sep 19 14:16:21 2002
+++ b/drivers/net/sundance.c	Thu Sep 19 14:16:21 2002
@@ -41,10 +41,17 @@
 	- Autodetect where mii_preable_required is needed,
 	default to not needed.  (Donald Becker)
 
+	Version LK1.04b:
+	- Remove mii_preamble_required module parameter (Donald Becker)
+	- Add per-interface mii_preamble_required (setting is autodetected)
+	  (Donald Becker)
+	- Remove unnecessary cast from void pointer
+	- Re-align comments in private struct
+
 */
 
 #define DRV_NAME	"sundance"
-#define DRV_VERSION	"1.01+LK1.04a"
+#define DRV_VERSION	"1.01+LK1.04b"
 #define DRV_RELDATE	"19-Sep-2002"
 
 
@@ -81,10 +88,6 @@
 #define MAX_UNITS 8	
 static char *media[MAX_UNITS];
 
-/* Set iff a MII transceiver on any interface requires mdio preamble.
-   This only set with older tranceivers, so the extra
-   code size of a per-interface flag is not worthwhile. */
-static int mii_preamble_required = 0;
 
 /* Operational parameters that are set at compile time. */
 
@@ -159,13 +162,11 @@
 MODULE_PARM(rx_copybreak, "i");
 MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "s");
 MODULE_PARM(flowctrl, "i");
-MODULE_PARM(mii_preamble_required, "i");
 MODULE_PARM_DESC(max_interrupt_work, "Sundance Alta maximum events handled per interrupt");
 MODULE_PARM_DESC(mtu, "Sundance Alta MTU (all boards)");
 MODULE_PARM_DESC(debug, "Sundance Alta debug level (0-5)");
 MODULE_PARM_DESC(rx_copybreak, "Sundance Alta copy breakpoint for copy-only-tiny-frames");
 MODULE_PARM_DESC(flowctrl, "Sundance Alta flow control [0|1]");
-MODULE_PARM_DESC(mii_preamble_required, "Set to send a preamble before MII management transactions");
 
 /*
 				Theory of Operation
@@ -418,17 +419,17 @@
         dma_addr_t tx_ring_dma;
         dma_addr_t rx_ring_dma;
 	struct net_device_stats stats;
-	struct timer_list timer;	/* Media monitoring timer. */
+	struct timer_list timer;		/* Media monitoring timer. */
 	/* Frequently used values: keep some adjacent for cache effect. */
 	spinlock_t lock;
-	spinlock_t rx_lock;					/* Group with Tx control cache line. */
+	spinlock_t rx_lock;			/* Group with Tx control cache line. */
 	int chip_id;
 	unsigned int cur_rx, dirty_rx;		/* Producer/consumer ring indices */
-	unsigned int rx_buf_sz;				/* Based on MTU+slack. */
+	unsigned int rx_buf_sz;			/* Based on MTU+slack. */
 	struct netdev_desc *last_tx;		/* Last Tx descriptor used. */
 	unsigned int cur_tx, dirty_tx;
 	/* These values are keep track of the transceiver/media in use. */
-	unsigned int full_duplex:1;			/* Full-duplex operation requested. */
+	unsigned int full_duplex:1;		/* Full-duplex operation requested. */
 	unsigned int flowctrl:1;
 	unsigned int default_port:4;		/* Last dev->if_port value. */
 	unsigned int an_enable:1;
@@ -436,10 +437,11 @@
 	struct tasklet_struct rx_tasklet;
 	int budget;
 	/* Multicast and receive mode. */
-	spinlock_t mcastlock;				/* SMP lock multicast updates. */
+	spinlock_t mcastlock;			/* SMP lock multicast updates. */
 	u16 mcast_filter[4];
 	/* MII transceiver section. */
-	u16 advertising;					/* NWay media advertisement */
+	int mii_preamble_required;
+	u16 advertising;			/* NWay media advertisement */
 	unsigned char phys[MII_CNT];		/* MII device addresses, only first one used. */
 	struct pci_dev *pci_dev;
 };
@@ -569,20 +571,20 @@
 	if (1) {
 		int phy, phy_idx = 0;
 		np->phys[0] = 1;		/* Default setting */
-		mii_preamble_required++;
+		np->mii_preamble_required++;
 		for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) {
 			int mii_status = mdio_read(dev, phy, MII_BMSR);
 			if (mii_status != 0xffff  &&  mii_status != 0x0000) {
 				np->phys[phy_idx++] = phy;
 				np->advertising = mdio_read(dev, phy, MII_ADVERTISE);
 				if ((mii_status & 0x0040) == 0)
-					mii_preamble_required++;
+					np->mii_preamble_required++;
 				printk(KERN_INFO "%s: MII PHY found at address %d, status "
 					   "0x%4.4x advertising %4.4x.\n",
 					   dev->name, phy, mii_status, np->advertising);
 			}
 		}
-		mii_preamble_required--;
+		np->mii_preamble_required--;
 
 		if (phy_idx == 0) {
 			printk(KERN_INFO "%s: No MII transceiver found, aborting.  ASIC status %x\n",
@@ -722,11 +724,12 @@
 
 static int mdio_read(struct net_device *dev, int phy_id, int location)
 {
+	struct netdev_private *np = dev->priv;
 	long mdio_addr = dev->base_addr + MIICtrl;
 	int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
 	int i, retval = 0;
 
-	if (mii_preamble_required)
+	if (np->mii_preamble_required)
 		mdio_sync(mdio_addr);
 
 	/* Shift the read command bits out. */
@@ -751,11 +754,12 @@
 
 static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
 {
+	struct netdev_private *np = dev->priv;
 	long mdio_addr = dev->base_addr + MIICtrl;
 	int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value;
 	int i;
 
-	if (mii_preamble_required)
+	if (np->mii_preamble_required)
 		mdio_sync(mdio_addr);
 
 	/* Shift the command bits out. */
@@ -969,7 +973,7 @@
 static int
 start_tx (struct sk_buff *skb, struct net_device *dev)
 {
-	struct netdev_private *np = (struct netdev_private *) dev->priv;
+	struct netdev_private *np = dev->priv;
 	struct netdev_desc *txdesc;
 	unsigned entry;
 	long ioaddr = dev->base_addr;

  parent reply	other threads:[~2002-09-19 18:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-28 18:56 [PATCH] 2.4.20-pre sundance.c cleanups Jason Lunz
2002-08-28 23:13 ` Jason Lunz
2002-09-19  3:53   ` Richard Gooch
2002-09-19  4:14     ` Jason Lunz
2002-09-19  4:25       ` [PATCH] 2.4.20-pre sundance.c update Jeff Garzik
2002-09-19  4:56         ` Jason Lunz
2002-09-19  5:11           ` Jeff Garzik
2002-09-19 13:23         ` Donald Becker
2002-09-19 17:12           ` PATCH: sundance #2 Jeff Garzik
2002-09-19 17:29             ` Donald Becker
2002-09-19 18:13               ` Jeff Garzik
2002-09-19 18:18               ` Jeff Garzik [this message]
2002-09-19 19:30           ` PATCH: sundance #4 Jeff Garzik
2002-09-19 20:51             ` PATCH: sundance #4a Jason Lunz
2002-09-19 21:09               ` Jeff Garzik
2002-09-19 20:52             ` PATCH: sundance #4b Jason Lunz
2002-09-19 21:14               ` Jeff Garzik
2002-09-19 21:03             ` PATCH: sundance #5 (variable per-interface MTU support) Jason Lunz
2002-09-19 21:19               ` Jeff Garzik
2002-09-19 22:28               ` Donald Becker
2002-09-19 21:35             ` PATCH: [my] sundance #5 Jeff Garzik
2002-09-20  0:18               ` PATCH: sundance #6 Jeff Garzik
2002-09-19  6:42       ` [PATCH] 2.4.20-pre sundance.c cleanups Richard Gooch
2002-09-19  7:11         ` Keith Owens
2002-09-19 12:58     ` Donald Becker

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=3D8A14E6.6000105@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=becker@scyld.com \
    --cc=edward_peng@dlink.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lunz@falooley.org \
    --cc=mcmanus@ducksong.com \
    --cc=netdev@oss.sgi.com \
    --cc=rgooch@ras.ucalgary.ca \
    /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).