9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] driver for intel wireless 7260?
@ 2021-07-26 16:30 Skylar Bleed
  2021-07-26 19:29 ` cinap_lenrek
  0 siblings, 1 reply; 11+ messages in thread
From: Skylar Bleed @ 2021-07-26 16:30 UTC (permalink / raw)
  To: 9front

does this exist yet? is there any plan to make it exist? I wanted to check in again because I really want to try 9front again, but having no internet always forces me to turn back to some BSD system or something. I did try to roll my own a while back but I am not skilled enough to do that yet lol. if people aren't working on it, I could try to put out a bounty for it, but honestly I am pretty low on cash at the moment.

cheers
skye

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-07-26 16:30 [9front] driver for intel wireless 7260? Skylar Bleed
@ 2021-07-26 19:29 ` cinap_lenrek
  2021-07-27  7:21   ` Aw: " Eckard Brauer
  2021-07-27  8:17   ` Aw: " Eckard Brauer
  0 siblings, 2 replies; 11+ messages in thread
From: cinap_lenrek @ 2021-07-26 19:29 UTC (permalink / raw)
  To: 9front

it falls into the family of /sys/src/9/pc/etheriwl.c
supported cards.

it is just that i havnt had the hardware, so the
driver will ignore it.

add pci id and initialize ctlr->family to 7000.

you'll need iwm-8260-17 and then troubleshoot from there.

the etheriwl driver is based on iwn/iwm obsd drivers 
(becasue there is no other "documentation"),
so check there for differences and switches around the
device family for unhandled cases.

money is not a problem. time and availability of hw is.
you will do yourself and us more good by just doing the
work.

--
cinap

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Aw: Re: [9front] driver for intel wireless 7260?
  2021-07-26 19:29 ` cinap_lenrek
@ 2021-07-27  7:21   ` Eckard Brauer
  2021-08-04 20:50     ` kemal
  2021-07-27  8:17   ` Aw: " Eckard Brauer
  1 sibling, 1 reply; 11+ messages in thread
From: Eckard Brauer @ 2021-07-27  7:21 UTC (permalink / raw)
  To: 9front

Just a few weeks ago, I had some mailing with Kemal for that topic, as
he tried to help me on that. My little understanding reached it's end
early, and unfortunately we had no luck getting the card to work
finally, but Kemal already did some patches I tried out.

Maybe it's of some help to have that patches, so notify me, I should
have them all here.

Eckard

> Gesendet: Montag, 26. Juli 2021 um 21:29 Uhr
> Von: cinap_lenrek@felloff.net
> An: 9front@9front.org
> Betreff: Re: [9front] driver for intel wireless 7260?
>
> it falls into the family of /sys/src/9/pc/etheriwl.c
> supported cards.
>
> it is just that i havnt had the hardware, so the
> driver will ignore it.
>
> add pci id and initialize ctlr->family to 7000.
>
> you'll need iwm-8260-17 and then troubleshoot from there.
>
> the etheriwl driver is based on iwn/iwm obsd drivers
> (becasue there is no other "documentation"),
> so check there for differences and switches around the
> device family for unhandled cases.
>
> money is not a problem. time and availability of hw is.
> you will do yourself and us more good by just doing the
> work.
>
> --
> cinap
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Aw: Re: [9front] driver for intel wireless 7260?
  2021-07-26 19:29 ` cinap_lenrek
  2021-07-27  7:21   ` Aw: " Eckard Brauer
@ 2021-07-27  8:17   ` Eckard Brauer
  2021-07-30 21:19     ` unobe
  1 sibling, 1 reply; 11+ messages in thread
From: Eckard Brauer @ 2021-07-27  8:17 UTC (permalink / raw)
  To: 9front

Just a few weeks ago, I had some mailing with Kemal for that topic, as
he tried to help me on that. My little understanding reached it's end
early, and unfortunately we had no luck getting the card to work
finally, but Kemal already did some patches I tried out.

Maybe it's of some help to have that patches, so notify me, I should
have them all here.

Eckard

> Gesendet: Montag, 26. Juli 2021 um 21:29 Uhr
> Von: cinap_lenrek@felloff.net
> An: 9front@9front.org
> Betreff: Re: [9front] driver for intel wireless 7260?
>
> it falls into the family of /sys/src/9/pc/etheriwl.c
> supported cards.
>
> it is just that i havnt had the hardware, so the
> driver will ignore it.
>
> add pci id and initialize ctlr->family to 7000.
>
> you'll need iwm-8260-17 and then troubleshoot from there.
>
> the etheriwl driver is based on iwn/iwm obsd drivers
> (becasue there is no other "documentation"),
> so check there for differences and switches around the
> device family for unhandled cases.
>
> money is not a problem. time and availability of hw is.
> you will do yourself and us more good by just doing the
> work.
>
> --
> cinap
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Aw: Re: [9front] driver for intel wireless 7260?
  2021-07-27  8:17   ` Aw: " Eckard Brauer
@ 2021-07-30 21:19     ` unobe
  0 siblings, 0 replies; 11+ messages in thread
From: unobe @ 2021-07-30 21:19 UTC (permalink / raw)
  To: 9front

> > Gesendet: Montag, 26. Juli 2021 um 21:29 Uhr
> > Von: cinap_lenrek@felloff.net
> > An: 9front@9front.org
> > Betreff: Re: [9front] driver for intel wireless 7260?
> >
> > it falls into the family of /sys/src/9/pc/etheriwl.c
> > supported cards.
> >
> > it is just that i havnt had the hardware, so the
> > driver will ignore it.
> >
> > add pci id and initialize ctlr->family to 7000.
> >
> > you'll need iwm-8260-17 and then troubleshoot from there.
> >
> > the etheriwl driver is based on iwn/iwm obsd drivers
> > (becasue there is no other "documentation"),
> > so check there for differences and switches around the
> > device family for unhandled cases.
> >
> > money is not a problem. time and availability of hw is.
> > you will do yourself and us more good by just doing the
> > work.

Quoth Eckard Brauer <eckard.brauer@gmx.de>:
> Just a few weeks ago, I had some mailing with Kemal for that topic, as
> he tried to help me on that. My little understanding reached it's end
> early, and unfortunately we had no luck getting the card to work
> finally, but Kemal already did some patches I tried out.
> 
> Maybe it's of some help to have that patches, so notify me, I should
> have them all here.

You might also want to have the openbsd source pulled up to
compare--altho' the code was *initially* derived from the openbsd
source code, it's different, and there's been continuous development
of the driver in OpenBSD.  Perhaps looking at that might make it
easier to get it working.

https://github.com/openbsd/src (look at /sys/dev/pci/if_iwn.c )


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-07-27  7:21   ` Aw: " Eckard Brauer
@ 2021-08-04 20:50     ` kemal
  2021-08-05  0:32       ` kemal
  0 siblings, 1 reply; 11+ messages in thread
From: kemal @ 2021-08-04 20:50 UTC (permalink / raw)
  To: 9front

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

2021-07-27 7:21 GMT, Eckard Brauer <eckard.brauer@gmx.de>:
> Just a few weeks ago, I had some mailing with Kemal for that topic, as
> he tried to help me on that. My little understanding reached it's end
> early, and unfortunately we had no luck getting the card to work
> finally, but Kemal already did some patches I tried out.

correct. (except for the few weeks part, it has been months :))

just now i cleaned up those patches and now i have a diff that
should work. it can be applied with `ape/patch -p0 < diff.txt`

this diff might work with 3160, but requires normal additions like
pci ids etc. PLUS this line:

"	if(ctlr->type == Type7260){"

being changed to

"	if(ctlr->type == Type7260 || ctlr->type == Type3160){

hope it works.

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 2419 bytes --]

--- /sys/src/9/pc/etheriwl.c
+++ /sys/src/9/pc/etheriwl.c
@@ -1,9 +1,10 @@
 /*
  * Intel WiFi Link driver.
  *
- * Written without any documentation but Damien Bergaminis
- * OpenBSD iwn(4) and iwm(4) driver sources. Requires intel
- * firmware to be present in /lib/firmware/iwn-* on attach.
+ * Written without any documentation but Damien Bergamini's
+ * iwn(4) and Stefan Sperling's iwm(4) OpenBSD driver sources.
+ * Requires Intel firmware to be present in /lib/firmware/iw[nm]-*
+ * on attach.
  */
 
 #include "u.h"
@@ -242,6 +243,8 @@
 
 	SbCpu1Status	= 0xa01e30,
 	SbCpu2Status	= 0xa01e34,
+	OscClk		= 0xa04068,
+		OscClkCtrl	= 1<<3,
 	UregChick	= 0xa05c00,
 		UregChickMsiEnable	= 1<<24,
 
@@ -631,6 +634,7 @@
 	Type6005	= 11,	/* also Centrino Advanced-N 6030, 6235 */
 	Type2030	= 12,
 	Type2000	= 16,
+	Type7260	= 30,
 
 	Type8265	= 35,
 };
@@ -686,6 +690,7 @@
 	[Type6005] "iwn-6005", /* see in iwlattach() below */
 	[Type2030] "iwn-2030",
 	[Type2000] "iwn-2000",
+	[Type7260] "iwm-7260-17",
 };
 
 static char *qcmd(Ctlr *ctlr, uint qid, uint code, uchar *data, int size, Block *block);
@@ -1088,6 +1093,22 @@
 		nicunlock(ctlr);
 	}
 
+	/* Enable the oscillator to count wake up time for L1 exit. (weird W/A) */
+	if(ctlr->type == Type7260){
+		if((err = niclock(ctlr)) != nil)
+			return err;
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+		delay(20);
+
+		prphwrite(ctlr, OscClk, prphread(ctlr, OscClk) | OscClkCtrl);
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+
+		nicunlock(ctlr);
+	}
 	if(ctlr->family < 8000){
 		if((err = niclock(ctlr)) != nil)
 			return err;
@@ -3416,6 +3437,12 @@
 		iunlock(ctlr);
 		return "qcmd: broken";
 	}
+	/* wake up the nic (just needed for 7k) */
+	if(ctlr->family == 7000 && q->n == 0)
+		if(niclock(ctlr) != nil){
+			iunlock(ctlr);
+			return "qcmd: busy";
+		}
 	q->n++;
 	q->lastcmd = code;
 
@@ -4242,6 +4269,9 @@
 		if(tx != nil && tx->n > 0){
 			tx->n--;
 			wakeup(tx);
+			/* unlock 7k family nics as all commands are done */
+			if(ctlr->family == 7000 && tx->n == 0)
+				nicunlock(ctlr);
 		}
 	}
 
@@ -4349,6 +4379,11 @@
 		case 0x088e:	/* Centrino Advanced-N 6235 */
 		case 0x088f:	/* Centrino Advanced-N 6235 */
 			family = 0;
+			fwname = nil;
+			break;
+		case 0x08b1:	/* Wireless AC 7260 */
+		case 0x08b2:	/* Wireless AC 7260 */
+			family = 7000;
 			fwname = nil;
 			break;
 		case 0x24f3:	/* Wireless AC 8260 */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-08-04 20:50     ` kemal
@ 2021-08-05  0:32       ` kemal
  2021-08-05  7:52         ` cinap_lenrek
  0 siblings, 1 reply; 11+ messages in thread
From: kemal @ 2021-08-05  0:32 UTC (permalink / raw)
  To: 9front

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

> just now i cleaned up those patches and now i have a diff that
> should work. it can be applied with `ape/patch -p0 < diff.txt`

fuck forgot one thing... openbsd sends a command for 7k family
after boot, it initializes tx backoffs to minimum. in addition,
obsd does not check for errors for this command, gonna do the
same.

the new diff is attached.

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 2945 bytes --]

--- /sys/src/9/pc/etheriwl.c
+++ /sys/src/9/pc/etheriwl.c
@@ -1,9 +1,10 @@
 /*
  * Intel WiFi Link driver.
  *
- * Written without any documentation but Damien Bergaminis
- * OpenBSD iwn(4) and iwm(4) driver sources. Requires intel
- * firmware to be present in /lib/firmware/iwn-* on attach.
+ * Written without any documentation but Damien Bergamini's
+ * iwn(4) and Stefan Sperling's iwm(4) OpenBSD driver sources.
+ * Requires Intel firmware to be present in /lib/firmware/iw[nm]-*
+ * on attach.
  */
 
 #include "u.h"
@@ -242,6 +243,8 @@
 
 	SbCpu1Status	= 0xa01e30,
 	SbCpu2Status	= 0xa01e34,
+	OscClk		= 0xa04068,
+		OscClkCtrl	= 1<<3,
 	UregChick	= 0xa05c00,
 		UregChickMsiEnable	= 1<<24,
 
@@ -631,6 +634,7 @@
 	Type6005	= 11,	/* also Centrino Advanced-N 6030, 6235 */
 	Type2030	= 12,
 	Type2000	= 16,
+	Type7260	= 30,
 
 	Type8265	= 35,
 };
@@ -686,6 +690,7 @@
 	[Type6005] "iwn-6005", /* see in iwlattach() below */
 	[Type2030] "iwn-2030",
 	[Type2000] "iwn-2000",
+	[Type7260] "iwm-7260-17",
 };
 
 static char *qcmd(Ctlr *ctlr, uint qid, uint code, uchar *data, int size, Block *block);
@@ -1088,6 +1093,22 @@
 		nicunlock(ctlr);
 	}
 
+	/* Enable the oscillator to count wake up time for L1 exit. (weird W/A) */
+	if(ctlr->type == Type7260){
+		if((err = niclock(ctlr)) != nil)
+			return err;
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+		delay(20);
+
+		prphwrite(ctlr, OscClk, prphread(ctlr, OscClk) | OscClkCtrl);
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+
+		nicunlock(ctlr);
+	}
 	if(ctlr->family < 8000){
 		if((err = niclock(ctlr)) != nil)
 			return err;
@@ -2800,6 +2821,12 @@
 	return cmd(ctlr, 210, c, 11*4);
 }
 
+static void
+tttxbackoff(Ctlr *ctlr, u32int backoff)
+{
+	cmd(ctlr, 126, (uchar*)&backoff, sizeof(backoff));
+}
+
 static char*
 updatedevicepower(Ctlr *ctlr)
 {
@@ -2864,6 +2891,10 @@
 		if((err = sendbtcoexadv(ctlr)) != nil)
 			return err;
 
+		/* Initialize tx backoffs to the minimum. */
+		if(ctlr->family == 7000)
+			tttxbackoff(ctlr, 0);
+
 		if((err = updatedevicepower(ctlr)) != nil){
 			print("can't update device power: %s\n", err);
 			return err;
@@ -3416,6 +3447,12 @@
 		iunlock(ctlr);
 		return "qcmd: broken";
 	}
+	/* wake up the nic (just needed for 7k) */
+	if(ctlr->family == 7000 && q->n == 0)
+		if(niclock(ctlr) != nil){
+			iunlock(ctlr);
+			return "qcmd: busy";
+		}
 	q->n++;
 	q->lastcmd = code;
 
@@ -4242,6 +4279,9 @@
 		if(tx != nil && tx->n > 0){
 			tx->n--;
 			wakeup(tx);
+			/* unlock 7k family nics as all commands are done */
+			if(ctlr->family == 7000 && tx->n == 0)
+				nicunlock(ctlr);
 		}
 	}
 
@@ -4349,6 +4389,11 @@
 		case 0x088e:	/* Centrino Advanced-N 6235 */
 		case 0x088f:	/* Centrino Advanced-N 6235 */
 			family = 0;
+			fwname = nil;
+			break;
+		case 0x08b1:	/* Wireless AC 7260 */
+		case 0x08b2:	/* Wireless AC 7260 */
+			family = 7000;
 			fwname = nil;
 			break;
 		case 0x24f3:	/* Wireless AC 8260 */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-08-05  0:32       ` kemal
@ 2021-08-05  7:52         ` cinap_lenrek
  2021-08-05 12:41           ` kemal
  0 siblings, 1 reply; 11+ messages in thread
From: cinap_lenrek @ 2021-08-05  7:52 UTC (permalink / raw)
  To: 9front

static void
+tttxbackoff(Ctlr *ctlr, u32int backoff)
+{
+	cmd(ctlr, 126, (uchar*)&backoff, sizeof(backoff));
+}

avoid this stuff. this code depends on the endianess of
the arch... everyone else is preparing bytes,
even if we just need to provide a single long.

--
cinap

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-08-05  7:52         ` cinap_lenrek
@ 2021-08-05 12:41           ` kemal
  2021-08-05 21:19             ` Eckard Brauer
  2021-08-05 22:33             ` cinap_lenrek
  0 siblings, 2 replies; 11+ messages in thread
From: kemal @ 2021-08-05 12:41 UTC (permalink / raw)
  To: 9front

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

> avoid this stuff. this code depends on the endianess of
> the arch... everyone else is preparing bytes,
> even if we just need to provide a single long.

ok, i cleaned it up.

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 2882 bytes --]

--- /sys/src/9/pc/etheriwl.c
+++ /sys/src/9/pc/etheriwl.c
@@ -1,9 +1,10 @@
 /*
  * Intel WiFi Link driver.
  *
- * Written without any documentation but Damien Bergaminis
- * OpenBSD iwn(4) and iwm(4) driver sources. Requires intel
- * firmware to be present in /lib/firmware/iwn-* on attach.
+ * Written without any documentation but Damien Bergamini's
+ * iwn(4) and Stefan Sperling's iwm(4) OpenBSD driver sources.
+ * Requires Intel firmware to be present in /lib/firmware/iw[nm]-*
+ * on attach.
  */
 
 #include "u.h"
@@ -242,6 +243,8 @@
 
 	SbCpu1Status	= 0xa01e30,
 	SbCpu2Status	= 0xa01e34,
+	OscClk		= 0xa04068,
+		OscClkCtrl	= 1<<3,
 	UregChick	= 0xa05c00,
 		UregChickMsiEnable	= 1<<24,
 
@@ -632,6 +635,7 @@
 	Type2030	= 12,
 	Type2000	= 16,
 
+	Type7260	= 30,
 	Type8265	= 35,
 };
 
@@ -686,6 +690,7 @@
 	[Type6005] "iwn-6005", /* see in iwlattach() below */
 	[Type2030] "iwn-2030",
 	[Type2000] "iwn-2000",
+	[Type7260] "iwm-7260-17",
 };
 
 static char *qcmd(Ctlr *ctlr, uint qid, uint code, uchar *data, int size, Block *block);
@@ -1088,6 +1093,23 @@
 		nicunlock(ctlr);
 	}
 
+	/* Enable the oscillator to count wake up time for L1 exit. (weird W/A) */
+	if(ctlr->type == Type7260){
+		if((err = niclock(ctlr)) != nil)
+			return err;
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+		delay(20);
+
+		prphwrite(ctlr, OscClk, prphread(ctlr, OscClk) | OscClkCtrl);
+
+		prphread(ctlr, OscClk);
+		prphread(ctlr, OscClk);
+
+		nicunlock(ctlr);
+	}
+
 	if(ctlr->family < 8000){
 		if((err = niclock(ctlr)) != nil)
 			return err;
@@ -2800,6 +2822,15 @@
 	return cmd(ctlr, 210, c, 11*4);
 }
 
+static void
+tttxbackoff(Ctlr *ctlr)
+{
+	uchar c[4];
+	
+	put32(c, 0);
+	cmd(ctlr, 126, c, sizeof(c));
+}
+
 static char*
 updatedevicepower(Ctlr *ctlr)
 {
@@ -2864,6 +2895,10 @@
 		if((err = sendbtcoexadv(ctlr)) != nil)
 			return err;
 
+		/* Initialize tx backoffs to the minimum. */
+		if(ctlr->family == 7000)
+			tttxbackoff(ctlr);
+
 		if((err = updatedevicepower(ctlr)) != nil){
 			print("can't update device power: %s\n", err);
 			return err;
@@ -3416,6 +3451,12 @@
 		iunlock(ctlr);
 		return "qcmd: broken";
 	}
+	/* wake up the nic (just needed for 7k) */
+	if(ctlr->family == 7000 && q->n == 0)
+		if(niclock(ctlr) != nil){
+			iunlock(ctlr);
+			return "qcmd: busy";
+		}
 	q->n++;
 	q->lastcmd = code;
 
@@ -4242,6 +4283,9 @@
 		if(tx != nil && tx->n > 0){
 			tx->n--;
 			wakeup(tx);
+			/* unlock 7k family nics as all commands are done */
+			if(ctlr->family == 7000 && tx->n == 0)
+				nicunlock(ctlr);
 		}
 	}
 
@@ -4349,6 +4393,11 @@
 		case 0x088e:	/* Centrino Advanced-N 6235 */
 		case 0x088f:	/* Centrino Advanced-N 6235 */
 			family = 0;
+			fwname = nil;
+			break;
+		case 0x08b1:	/* Wireless AC 7260 */
+		case 0x08b2:	/* Wireless AC 7260 */
+			family = 7000;
 			fwname = nil;
 			break;
 		case 0x24f3:	/* Wireless AC 8260 */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-08-05 12:41           ` kemal
@ 2021-08-05 21:19             ` Eckard Brauer
  2021-08-05 22:33             ` cinap_lenrek
  1 sibling, 0 replies; 11+ messages in thread
From: Eckard Brauer @ 2021-08-05 21:19 UTC (permalink / raw)
  To: 9front

Will try it out these days - am a bit unde rstress currently as my
mother in law is just dying, so i'd have to be a bit more bound to the
family...

Am Thu, 5 Aug 2021 12:41:30 +0000
schrieb kemal <kemalinanc8@gmail.com>:

>  [...]
>
> ok, i cleaned it up.



--

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] driver for intel wireless 7260?
  2021-08-05 12:41           ` kemal
  2021-08-05 21:19             ` Eckard Brauer
@ 2021-08-05 22:33             ` cinap_lenrek
  1 sibling, 0 replies; 11+ messages in thread
From: cinap_lenrek @ 2021-08-05 22:33 UTC (permalink / raw)
  To: 9front

excellent! applied.

--
cinap

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-08-06  2:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 16:30 [9front] driver for intel wireless 7260? Skylar Bleed
2021-07-26 19:29 ` cinap_lenrek
2021-07-27  7:21   ` Aw: " Eckard Brauer
2021-08-04 20:50     ` kemal
2021-08-05  0:32       ` kemal
2021-08-05  7:52         ` cinap_lenrek
2021-08-05 12:41           ` kemal
2021-08-05 21:19             ` Eckard Brauer
2021-08-05 22:33             ` cinap_lenrek
2021-07-27  8:17   ` Aw: " Eckard Brauer
2021-07-30 21:19     ` unobe

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).