Patch for PCNet32/Home 79C978

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm new to this, so please don't flame me if I've done something wrong :)

Earlier this year, I purchased a Diamond PCI card and set it up to work with 
Linux.  To get the card to work in HomePNA mode, I had to copy over some code 
from the Linux 2.2.18 pcnet32.c to the Linux 2.6 pcnet32.c.  I noticed in the 
comment regarding this card that "there probably should be some sort of 
module option to select the mode by which the card should operate," so I 
wrote one, attached as a patch.  The option is called pcnet32_homepna.  I 
read SubmittingPatches and CodingStyle, so I think it's formatted correctly 
and all.  It works on my computer, and unfortunately I'm the only one in my 
family with this specific card, so I can't test it anywhere else.

Here's the command to invoke it after it's patched:

modprobe pcnet32 pcnet32_homepna=1
	for HomePNA, or
modprobe pcnet32
	for standard Ethernet.

I made it go into standard ethernet by default because, despite comments to 
the contrary, this is the default behavior I observed in Linux 2.4 and 2.6.  
The patch is against Linux 2.6.6.

Please Cc me as I am not on this list if you make a decision about this patch.

Developer's Certificate of Origin 1.0 

By making a contribution to this project, I certify that: 


(a) The contribution was created in whole or in part by me and I have the 
right to submit it under the open source license indicated in the file; or 


(b) The contribution is based upon previous work that, to the best of my 
knowledge, is covered under an appropriate open source license and I have the 
right under that license to submit that work with modifications, whether 
created in whole or in part by me, under the same open source license (unless 
I am permitted to submit under a different license), as indicated in the 
file; or 


(c) The contribution was provided directly to me by some other person who 
certified (a), (b) or (c) and I have not modified it.
--- linux-2.6.6/drivers/net/pcnet32.c.bak	2004-05-10 18:33:18.000000000 -0500
+++ linux-2.6.6/drivers/net/pcnet32.c	2004-06-02 18:13:23.000000000 -0500
@@ -53,6 +53,11 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELD
 #include <asm/uaccess.h>
 #include <asm/irq.h>
 
+/*Module Parameter for HomePNA cards
+  added by Patrick Simmons, 2004*/
+int pcnet32_homepna = 0;
+MODULE_PARM(pcnet32_homepna,"i");
+
 /*
  * PCI device identifiers for "new style" Linux PCI Device Drivers
  */
@@ -234,7 +239,9 @@ static int full_duplex[MAX_UNITS];
  *	   Jim Lewis <jklewis@us.ibm.com> added ethernet loopback test.
  *	   Thomas Munck Steenholdt <tmus@tmus.dk> non-mii ioctl corrections.
  * v1.29   6 Apr 2004 Jim Lewis <jklewis@us.ibm.com> added physical
- *	   identification code (blink led's).
+ *	   identification code (blink led's)i.
+ * v1.30   4 Jun 2004 Patrick Simmons <psimmons@flash.net> added option
+ *         pcnet32_homepna for selecting HomePNA mode for the PCNet/Home 79C978.
  */
 
 
@@ -991,13 +998,18 @@ pcnet32_probe1(unsigned long ioaddr, uns
 	fdx = 1;
 	/*
 	 * This is based on specs published at www.amd.com.  This section
-	 * assumes that a card with a 79C978 wants to go into 1Mb HomePNA
-	 * mode.  The 79C978 can also go into standard ethernet, and there
-	 * probably should be some sort of module option to select the
-	 * mode by which the card should operate
+	 * assumes that a card with a 79C978 wants to go into standard ethernet 
+	 * mode.  The 79C978 can also go into 1MB HomePNA mode, and the module
+	 * option pcnet32_homepna=1 can select this instead.
 	 */
 	/* switch to home wiring mode */
 	media = a->read_bcr(ioaddr, 49);
+	if(pcnet32_homepna) {
+	   if (pcnet32_debug > 2)
+	      printk(KERN_DEBUG PFX "media value %#x.\n",  media);
+	   media &= ~3;
+	   media |= 1;
+	}
 	if (pcnet32_debug & NETIF_MSG_PROBE)
 	    printk(KERN_DEBUG PFX "media reset to %#x.\n",  media);
 	a->write_bcr(ioaddr, 49, media);

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux