[patch] applied: vt6102pwr

0 views
Skip to first unread message

9cha...@cat-v.org

unread,
Jun 1, 2008, 7:24:36 PM6/1/08
to plan9c...@googlegroups.com
Created Jun 1 17:24 by none
Processed Jun 1 23:24 by geoff

Reset Wake-on-LAN/power management registers on chip reset. This gets my VIA Rhine II (PCI rev id 0x71) working. Without this patch the card is not initialized properly and the MII init fails.

The source for this extra init behavior is gPXE's via-rhine.c and Linux 2.6.24's via-rhine.c. Both do basically the same thing with the power management registers when setting up the card.

--
/sys/src/9/pc/ethervt6102.c
ethervt6102.c.orig:40,45 - /n/sources/patch/applied/vt6102pwr/ethervt6102.c:40,49
Miiadr = 0x71, /* MII Address */
Miidata = 0x72, /* MII Data */
Eecsr = 0x74, /* EEPROM Control and Status */
+ Sticky = 0x83,
+ Wolcrclr = 0xA4,
+ Wolcgclr = 0xA7,
+ Pwrcsrclr = 0xAC,
};

enum { /* Rcr */
ethervt6102.c.orig:837,843 - /n/sources/patch/applied/vt6102pwr/ethervt6102.c:841,863
static int
vt6102detach(Ctlr* ctlr)
{
- int timeo;
+ int revid, timeo;
+
+ /*
+ * Reset power management registers.
+ */
+ revid = pcicfgr8(ctlr->pcidev, PciRID);
+ if(revid >= 0x40){
+ /* Set power state D0. */
+ csr8w(ctlr, Sticky, csr8r(ctlr, Sticky) & 0xFC);
+
+ /* Disable force PME-enable. */
+ csr8w(ctlr, Wolcgclr, 0x80);
+
+ /* Clear WOL config and status bits. */
+ csr8w(ctlr, Wolcrclr, 0xFF);
+ csr8w(ctlr, Pwrcsrclr, 0xFF);
+ }

/*
* Soft reset the controller.

Reply all
Reply to author
Forward
0 new messages