code: plan9front

Download patch

ref: 302e5bc94465df9b36e326faea94dcd018b1b491
parent: 42a2c7167b4da87df9bfd0a350d9ffdaa2a26490
author: "Ori Bernstein" <ori@eigenstate.org>
date: Fri Aug 12 05:06:29 EDT 2022

ether8169: support for RTL8168EP chips

There are a few flags we need to set, and the order
of initialization changed. Synced from the FreeBSD
driver, with the mac version coming from Linux.

--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -126,6 +126,7 @@
 	Macv42		= 0x50800000,	/* RTL8168GU */
 	Macv44		= 0x5c800000,	/* RTL8411B */
 	Macv45		= 0x54000000,	/* RTL8111HN */
+	Macv51		= 0x50000000,	/* RTL8168EP */
 
 	Ifg0		= 0x01000000,	/* Interframe Gap 0 */
 	Ifg1		= 0x02000000,	/* Interframe Gap 1 */
@@ -714,6 +715,7 @@
 	switch(ctlr->macv){
 	case Macv40:
 	case Macv44:
+	case Macv51:
 		cplusc |= Macstatdis;
 		break;
 	default:
@@ -737,6 +739,7 @@
 	switch(ctlr->macv){
 	case Macv42:
 	case Macv45:
+	case Macv51:
 		ctlr->rcr = Rxfth256|Mrxdmaunlimited|Ab|Am|Apm;
 		break;
 	default:
@@ -758,6 +761,9 @@
 	r = csr16r(ctlr, Mulint) & 0xF000;
 	csr16w(ctlr, Mulint, r);
 
+	if(ctlr->macv == Macv51)
+		csr8w(ctlr, Cr, Te|Re);
+
 	ctlr->imr = Serr|Fovw|Punlc|Rdu|Ter|Rer|Rok|Tdu;
 	csr16w(ctlr, Imr, ctlr->imr);
 
@@ -1096,6 +1102,7 @@
 	case Macv42:
 	case Macv44:
 	case Macv45:
+	case Macv51:
 		break;
 	}
 	return 0;