shithub: riscv

Download patch

ref: 52174db958342cb4d4178cfcdc06bbb1aca894ab
parent: 906cc83c35d001d44d2aef26d3ca511cce85183a
author: ftrvxmtrx <devnull@localhost>
date: Mon Jun 9 17:06:22 EDT 2014

ether8169: support for RTL8168G

--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -120,6 +120,7 @@
 	Macv28		= 0x2c000000,	/* RTL8111/8168B */
 	Macv29		= 0x40800000,	/* RTL8101/8102E */
 	Macv30		= 0x24000000,	/* RTL8101E? (untested) */
+	Macv40		= 0x4c000000,	/* RTL8168G */
 	Ifg0		= 0x01000000,	/* Interframe Gap 0 */
 	Ifg1		= 0x02000000,	/* Interframe Gap 1 */
 };
@@ -178,6 +179,7 @@
 	Dac		= 0x0010,	/* PCI Dual Address Cycle Enable */
 	Rxchksum	= 0x0020,	/* Receive Checksum Offload Enable */
 	Rxvlan		= 0x0040,	/* Receive VLAN De-tagging Enable */
+	Macstatdis	= 0x0080,	/* Disable Mac Statistics */
 	Endian		= 0x0200,	/* Endian Mode */
 };
 
@@ -697,7 +699,15 @@
 
 	cplusc = csr16r(ctlr, Cplusc);
 	cplusc &= ~(Endian|Rxchksum);
-	cplusc |= Txenb|Rxenb|Mulrw;
+	cplusc |= Txenb|Mulrw;
+	switch(ctlr->macv){
+	case Macv40:
+		cplusc |= Macstatdis;
+		break;
+	default:
+		cplusc |= Rxenb;
+		break;
+	}
 	csr16w(ctlr, Cplusc, cplusc);
 
 	csr32w(ctlr, Tnpds+4, 0);
@@ -1040,6 +1050,7 @@
 	case Macv28:
 	case Macv29:
 	case Macv30:
+	case Macv40:
 		break;
 	}
 	return 0;