Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-26 Thread Andre de Oliveira
On Fri, Jan 03, 2014 at 06:40:22PM +0100, Dawe wrote:
 On Jan 03, 2014 14:24, Fabian Raetz wrote:
  Hi tech@,
  
  here is an updated patch.
  
  it seems like Intel Centrino Wireless-N 2030 and
  Intel Centrino Wireless-N 2230 have the same pciids...
  
  this makes patch apply again with newest pcidevs changes.
  
 
 No regressions with my Intel WiFi Link 1000 running amd64.
 
 iwn0 at pci2 dev 0 function 0 Intel WiFi Link 1000 rev 0x00: msi, MIMO 
 1T2R, BGS
 
same to me: no regressions with Advanced-N 6030, since 2014.02.12.

iwn0 at pci1 dev 0 function 0 Intel Centrino Advanced-N 6030 rev 0x34:
msi, MIMO 2T2R, MoW, address 00:db:df:08:22:8f

-a



Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-19 Thread Byron Klippert
On Sun, Feb 9, 2014, at 13:56, Fabian Raetz wrote:
 On Sun, Feb 09, 2014 at 09:32:15PM +0100, Mark Kettenis wrote:
   Date: Sun, 9 Feb 2014 14:23:18 +0100
   From: Fabian Raetz fabian.ra...@gmail.com

Hmm, my cleanup was based on the version you send out on December
31st.  Can you send me the latest version of your diff?

   
   On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
 Hi tech@,
 
 here is an updated patch.
 
 it seems like Intel Centrino Wireless-N 2030 and
 Intel Centrino Wireless-N 2230 have the same pciids...
 
 this makes patch apply again with newest pcidevs changes.

Please also make sure to use tab and not space when appropriate ;)  You
can check style(9) if in doubt !

   ups :)
   attached is a diff
   - which follows style(9) (hopefully) and
   - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
 IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().
   
   @mike, only style changes since the last patch i send you.
  
  Thanks.  I incorporated the changes in my cleaned up version.
  
  The change does affect other hardware types now, but I've tested this
  on a couple of systems:
  
  iwn0 at pci3 dev 0 function 0 Intel WiFi Link 5300 rev 0x00: msi, MIMO 
  3T3R, MoW
  
  iwn0 at pci3 dev 0 function 0 Intel Centrino Ultimate-N 6300 rev 0x35: 
  msi, MIMO 3T3R, MoW
  
  iwn0 at pci2 dev 0 function 0 Intel Centrino Advanced-N 6205 rev 0x34: 
  msi, MIMO 2T2R, MoW
  
  So if this one works for you and Benoit, I'll go ahead and commit this.
  
 works for me too. Thanks!
 
 iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4:
 msi, MIMO 2T2R, BGN
 

Feb. 17th amd64 snapshot works for me!

iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2200 rev 0xc4:
msi, MIMO 2T2R, BGN


Thanks


-- 
Byron Klippert  
  byronklipp...@ml1.net
  c. 867-336-1306



Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Benoit Lecocq
On 02/08/14 23:34, Mark Kettenis wrote:

 Hi tech@,

 the diff below adds support for the Intel Centrino Wireless-N 2230 
 card found in my Lenovo E330 to iwn(4). 

 iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: 
 msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39

 This is the 0x0888 version.

 I've got most changes from
 https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445
  
 which (i think) mostly landed in freebsd as part of
 http://svnweb.freebsd.org/base?view=revisionrevision=258035

 This is the only iwn(4) device i have, so hopefully i did not broke 
 another supported device.
 Any feedback and tests are welcome.

 Regards,
 Fabian Raetz
 
 Hi Fabian,
 
 Finally had some time to look at this.  I cleaned your diff up a bit.
 Also noticed that the sensitivy limits didn't match the Linux driver I
 was looking at.  Does the diff below still result in working hardware
 for you?
 
 Thanks,
 
 Mark
 
 

Hi,

With your patch the network card is detected :

iwn0 at pci3 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4:
msi, MIMO 2T2R, BGN, address 68:5d:43:20:8b:68

But I have the following message :

iwn0: fatal firmware error
firmware error log:
  error type  = UNKNOWN (0x1038)
  program counter = 0x0002A698
  source line = 0x1014
  error data  = 0x1014
  branch link = 0x0002A5B40002A5B4
  interrupt link  = 0xEC7A
  time= 969333536
driver status:
  tx ring  0: qid=0  cur=6   queued=0
  tx ring  1: qid=1  cur=0   queued=0
  tx ring  2: qid=2  cur=0   queued=0
  tx ring  3: qid=3  cur=0   queued=0
  tx ring  4: qid=4  cur=36  queued=0
  tx ring  5: qid=5  cur=0   queued=0
  tx ring  6: qid=6  cur=0   queued=0
  tx ring  7: qid=7  cur=0   queued=0
  tx ring  8: qid=8  cur=0   queued=0
  tx ring  9: qid=9  cur=0   queued=0
  tx ring 10: qid=10 cur=0   queued=0
  tx ring 11: qid=11 cur=0   queued=0
  tx ring 12: qid=12 cur=0   queued=0
  tx ring 13: qid=13 cur=0   queued=0
  tx ring 14: qid=14 cur=0   queued=0
  tx ring 15: qid=15 cur=0   queued=0
  tx ring 16: qid=16 cur=0   queued=0
  tx ring 17: qid=17 cur=0   queued=0
  tx ring 18: qid=18 cur=0   queued=0
  tx ring 19: qid=19 cur=0   queued=0
  rx ring: cur=22
  802.11 state 4

I have not the same issue with the patch from Fabian.

Cheers,
benoit


 Index: if_iwn.c
 ===
 RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
 retrieving revision 1.127
 diff -u -p -r1.127 if_iwn.c
 --- if_iwn.c  6 Dec 2013 21:03:04 -   1.127
 +++ if_iwn.c  8 Feb 2014 22:31:37 -
 @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
 + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 },
 + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 },
  };
  
  int  iwn_match(struct device *, void *, void *);
 @@ -244,6 +246,7 @@ int   iwn5000_send_calibration(struct iwn
  int  iwn5000_send_wimax_coex(struct iwn_softc *);
  int  iwn5000_crystal_calib(struct iwn_softc *);
  int  iwn5000_temp_offset_calib(struct iwn_softc *);
 +int  iwn2000_temp_offset_calib(struct iwn_softc *);
  int  iwn4965_post_alive(struct iwn_softc *);
  int  iwn5000_post_alive(struct iwn_softc *);
  int  iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
 @@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
   } else
   sc-fwname = iwn-6005;
   break;
 + case IWN_HW_REV_TYPE_2030:
 + sc-limits = iwn2000_sensitivity_limits;
 + sc-fwname = iwn-2030;
 + sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
 + break;
   default:
   printf(: adapter type %d not supported\n, sc-hw_type);
   return ENOTSUP;
 @@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
   hdr.version, hdr.pa_type, letoh16(hdr.volt)));
   sc-calib_ver = hdr.version;
  
 + if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
 + sc-eeprom_voltage = letoh16(hdr.volt);
 + iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
 + sc-eeprom_temp = letoh16(val);
 + iwn_read_prom_data(sc, base + IWN2000_EEPROM_RAWTEMP, val, 2);
 + sc-eeprom_rawtemp = letoh16(val);
 + }
 +
   if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
   /* Compute temperature offset. */
   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
 @@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft
  
   switch (calib-code) {
   case IWN5000_PHY_CALIB_DC:
 - if (sc-hw_type == IWN_HW_REV_TYPE_5150)
 + if (sc-hw_type == 

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Mark Kettenis
 Date: Sun, 09 Feb 2014 10:34:04 +0100
 From: Benoit Lecocq b...@arcane-labs.net
 
 On 02/08/14 23:34, Mark Kettenis wrote:
 
  Hi tech@,
 
  the diff below adds support for the Intel Centrino Wireless-N 2230 
  card found in my Lenovo E330 to iwn(4). 
 
  iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: 
  msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39
 
  This is the 0x0888 version.
 
  I've got most changes from
  https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445
   
  which (i think) mostly landed in freebsd as part of
  http://svnweb.freebsd.org/base?view=revisionrevision=258035
 
  This is the only iwn(4) device i have, so hopefully i did not broke 
  another supported device.
  Any feedback and tests are welcome.
 
  Regards,
  Fabian Raetz
  
  Hi Fabian,
  
  Finally had some time to look at this.  I cleaned your diff up a bit.
  Also noticed that the sensitivy limits didn't match the Linux driver I
  was looking at.  Does the diff below still result in working hardware
  for you?
  
  Thanks,
  
  Mark
  
  
 
 Hi,
 
 With your patch the network card is detected :
 
 iwn0 at pci3 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4:
 msi, MIMO 2T2R, BGN, address 68:5d:43:20:8b:68
 
 But I have the following message :
 
 iwn0: fatal firmware error
 firmware error log:
   error type  = UNKNOWN (0x1038)
   program counter = 0x0002A698
   source line = 0x1014
   error data  = 0x1014
   branch link = 0x0002A5B40002A5B4
   interrupt link  = 0xEC7A
   time= 969333536
 driver status:
   tx ring  0: qid=0  cur=6   queued=0
   tx ring  1: qid=1  cur=0   queued=0
   tx ring  2: qid=2  cur=0   queued=0
   tx ring  3: qid=3  cur=0   queued=0
   tx ring  4: qid=4  cur=36  queued=0
   tx ring  5: qid=5  cur=0   queued=0
   tx ring  6: qid=6  cur=0   queued=0
   tx ring  7: qid=7  cur=0   queued=0
   tx ring  8: qid=8  cur=0   queued=0
   tx ring  9: qid=9  cur=0   queued=0
   tx ring 10: qid=10 cur=0   queued=0
   tx ring 11: qid=11 cur=0   queued=0
   tx ring 12: qid=12 cur=0   queued=0
   tx ring 13: qid=13 cur=0   queued=0
   tx ring 14: qid=14 cur=0   queued=0
   tx ring 15: qid=15 cur=0   queued=0
   tx ring 16: qid=16 cur=0   queued=0
   tx ring 17: qid=17 cur=0   queued=0
   tx ring 18: qid=18 cur=0   queued=0
   tx ring 19: qid=19 cur=0   queued=0
   rx ring: cur=22
   802.11 state 4
 
 I have not the same issue with the patch from Fabian.

Does the interface work despite this message?

Does the following diff work better?


Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c9 Feb 2014 11:18:29 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn2000_temp_offset_calib(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2000_sensitivity_limits;
+   sc-fwname = iwn-2030;
+   sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+   break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+   sc-eeprom_voltage = letoh16(hdr.volt);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+   sc-eeprom_temp = letoh16(val);
+   iwn_read_prom_data(sc, base + IWN2000_EEPROM_RAWTEMP, val, 2);
+   sc-eeprom_rawtemp = letoh16(val);
+   }
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + 

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Fabian Raetz
On Sun, Feb 09, 2014 at 01:51:19PM +0100, Benoit Lecocq wrote:
 On 02/09/14 12:30, Mark Kettenis wrote:
  Date: Sun, 09 Feb 2014 10:34:04 +0100
  From: Benoit Lecocq b...@arcane-labs.net
 
  On 02/08/14 23:34, Mark Kettenis wrote:
 
  Hi tech@,
 
  the diff below adds support for the Intel Centrino Wireless-N 2230 
  card found in my Lenovo E330 to iwn(4). 
 
  iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: 
  msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39
 
  This is the 0x0888 version.
 
  I've got most changes from
  https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445
   
  which (i think) mostly landed in freebsd as part of
  http://svnweb.freebsd.org/base?view=revisionrevision=258035
 
  This is the only iwn(4) device i have, so hopefully i did not broke 
  another supported device.
  Any feedback and tests are welcome.
 
  Regards,
  Fabian Raetz
 
  Hi Fabian,
 
  Finally had some time to look at this.  I cleaned your diff up a bit.
  Also noticed that the sensitivy limits didn't match the Linux driver I
  was looking at.  Does the diff below still result in working hardware
  for you?
 
  Thanks,
 
  Mark
 
 
 
  Hi,
 
  With your patch the network card is detected :
 
  iwn0 at pci3 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4:
  msi, MIMO 2T2R, BGN, address 68:5d:43:20:8b:68
 
  But I have the following message :
 
  iwn0: fatal firmware error
  firmware error log:
error type  = UNKNOWN (0x1038)
program counter = 0x0002A698
source line = 0x1014
error data  = 0x1014
branch link = 0x0002A5B40002A5B4
interrupt link  = 0xEC7A
time= 969333536
  driver status:
tx ring  0: qid=0  cur=6   queued=0
tx ring  1: qid=1  cur=0   queued=0
tx ring  2: qid=2  cur=0   queued=0
tx ring  3: qid=3  cur=0   queued=0
tx ring  4: qid=4  cur=36  queued=0
tx ring  5: qid=5  cur=0   queued=0
tx ring  6: qid=6  cur=0   queued=0
tx ring  7: qid=7  cur=0   queued=0
tx ring  8: qid=8  cur=0   queued=0
tx ring  9: qid=9  cur=0   queued=0
tx ring 10: qid=10 cur=0   queued=0
tx ring 11: qid=11 cur=0   queued=0
tx ring 12: qid=12 cur=0   queued=0
tx ring 13: qid=13 cur=0   queued=0
tx ring 14: qid=14 cur=0   queued=0
tx ring 15: qid=15 cur=0   queued=0
tx ring 16: qid=16 cur=0   queued=0
tx ring 17: qid=17 cur=0   queued=0
tx ring 18: qid=18 cur=0   queued=0
tx ring 19: qid=19 cur=0   queued=0
rx ring: cur=22
802.11 state 4
 
  I have not the same issue with the patch from Fabian.
  
  Does the interface work despite this message?
  
  Does the following diff work better?
  
 
 Yes the interface work despite the message.
 
 Same messages with the new diff :
 
 iwn0: fatal firmware error
 firmware error log:
   error type  = UNKNOWN (0x1967)
   program counter = 0x99C4
   source line = 0x009F
   error data  = 0x00FF0013
   branch link = 0x99BA99BA
   interrupt link  = 0xEC7A
   time= 254992438
 driver status:
   tx ring  0: qid=0  cur=70  queued=0
   tx ring  1: qid=1  cur=0   queued=0
   tx ring  2: qid=2  cur=0   queued=0
   tx ring  3: qid=3  cur=0   queued=0
   tx ring  4: qid=4  cur=36  queued=0
   tx ring  5: qid=5  cur=0   queued=0
   tx ring  6: qid=6  cur=0   queued=0
   tx ring  7: qid=7  cur=0   queued=0
   tx ring  8: qid=8  cur=0   queued=0
   tx ring  9: qid=9  cur=0   queued=0
   tx ring 10: qid=10 cur=0   queued=0
   tx ring 11: qid=11 cur=0   queued=0
   tx ring 12: qid=12 cur=0   queued=0
   tx ring 13: qid=13 cur=0   queued=0
   tx ring 14: qid=14 cur=0   queued=0
   tx ring 15: qid=15 cur=0   queued=0
   tx ring 16: qid=16 cur=0   queued=0
   tx ring 17: qid=17 cur=0   queued=0
   tx ring 18: qid=18 cur=0   queued=0
   tx ring 19: qid=19 cur=0   queued=0
   rx ring: cur=22
   802.11 state 4
 
 
Hi,

i'm seeing the firmware error too with both of your diffs
and i'm pretty sure i fixed this firmware error in my
last diff send to this thread by handling IWN_FW_TLV_SENS and
IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv()

Except the firmware error, the card is working fine.

Regards,
Fabian



Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Mark Kettenis
 Date: Sun, 9 Feb 2014 14:07:53 +0100
 From: Fabian Raetz fabian.ra...@gmail.com
 
 On Sun, Feb 09, 2014 at 01:51:19PM +0100, Benoit Lecocq wrote:
  On 02/09/14 12:30, Mark Kettenis wrote:
   Date: Sun, 09 Feb 2014 10:34:04 +0100
   From: Benoit Lecocq b...@arcane-labs.net
  
   On 02/08/14 23:34, Mark Kettenis wrote:
  
   Hi tech@,
  
   the diff below adds support for the Intel Centrino Wireless-N 2230 
   card found in my Lenovo E330 to iwn(4). 
  
   iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 
   0xc4: msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39
  
   This is the 0x0888 version.
  
   I've got most changes from
   https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445

   which (i think) mostly landed in freebsd as part of
   http://svnweb.freebsd.org/base?view=revisionrevision=258035
  
   This is the only iwn(4) device i have, so hopefully i did not broke 
   another supported device.
   Any feedback and tests are welcome.
  
   Regards,
   Fabian Raetz
  
   Hi Fabian,
  
   Finally had some time to look at this.  I cleaned your diff up a bit.
   Also noticed that the sensitivy limits didn't match the Linux driver I
   was looking at.  Does the diff below still result in working hardware
   for you?
  
   Thanks,
  
   Mark
  
  
  
   Hi,
  
   With your patch the network card is detected :
  
   iwn0 at pci3 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4:
   msi, MIMO 2T2R, BGN, address 68:5d:43:20:8b:68
  
   But I have the following message :
  
   iwn0: fatal firmware error
   firmware error log:
 error type  = UNKNOWN (0x1038)
 program counter = 0x0002A698
 source line = 0x1014
 error data  = 0x1014
 branch link = 0x0002A5B40002A5B4
 interrupt link  = 0xEC7A
 time= 969333536
   driver status:
 tx ring  0: qid=0  cur=6   queued=0
 tx ring  1: qid=1  cur=0   queued=0
 tx ring  2: qid=2  cur=0   queued=0
 tx ring  3: qid=3  cur=0   queued=0
 tx ring  4: qid=4  cur=36  queued=0
 tx ring  5: qid=5  cur=0   queued=0
 tx ring  6: qid=6  cur=0   queued=0
 tx ring  7: qid=7  cur=0   queued=0
 tx ring  8: qid=8  cur=0   queued=0
 tx ring  9: qid=9  cur=0   queued=0
 tx ring 10: qid=10 cur=0   queued=0
 tx ring 11: qid=11 cur=0   queued=0
 tx ring 12: qid=12 cur=0   queued=0
 tx ring 13: qid=13 cur=0   queued=0
 tx ring 14: qid=14 cur=0   queued=0
 tx ring 15: qid=15 cur=0   queued=0
 tx ring 16: qid=16 cur=0   queued=0
 tx ring 17: qid=17 cur=0   queued=0
 tx ring 18: qid=18 cur=0   queued=0
 tx ring 19: qid=19 cur=0   queued=0
 rx ring: cur=22
 802.11 state 4
  
   I have not the same issue with the patch from Fabian.
   
   Does the interface work despite this message?
   
   Does the following diff work better?
   
  
  Yes the interface work despite the message.
  
  Same messages with the new diff :
  
  iwn0: fatal firmware error
  firmware error log:
error type  = UNKNOWN (0x1967)
program counter = 0x99C4
source line = 0x009F
error data  = 0x00FF0013
branch link = 0x99BA99BA
interrupt link  = 0xEC7A
time= 254992438
  driver status:
tx ring  0: qid=0  cur=70  queued=0
tx ring  1: qid=1  cur=0   queued=0
tx ring  2: qid=2  cur=0   queued=0
tx ring  3: qid=3  cur=0   queued=0
tx ring  4: qid=4  cur=36  queued=0
tx ring  5: qid=5  cur=0   queued=0
tx ring  6: qid=6  cur=0   queued=0
tx ring  7: qid=7  cur=0   queued=0
tx ring  8: qid=8  cur=0   queued=0
tx ring  9: qid=9  cur=0   queued=0
tx ring 10: qid=10 cur=0   queued=0
tx ring 11: qid=11 cur=0   queued=0
tx ring 12: qid=12 cur=0   queued=0
tx ring 13: qid=13 cur=0   queued=0
tx ring 14: qid=14 cur=0   queued=0
tx ring 15: qid=15 cur=0   queued=0
tx ring 16: qid=16 cur=0   queued=0
tx ring 17: qid=17 cur=0   queued=0
tx ring 18: qid=18 cur=0   queued=0
tx ring 19: qid=19 cur=0   queued=0
rx ring: cur=22
802.11 state 4
  
  
 Hi,
 
 i'm seeing the firmware error too with both of your diffs
 and i'm pretty sure i fixed this firmware error in my
 last diff send to this thread by handling IWN_FW_TLV_SENS and
 IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv()

Hmm, my cleanup was based on the version you send out on December
31st.  Can you send me the latest version of your diff?



Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Fabian Raetz
 
 Hmm, my cleanup was based on the version you send out on December
 31st.  Can you send me the latest version of your diff?
 

On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
 On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
  Hi tech@,
  
  here is an updated patch.
  
  it seems like Intel Centrino Wireless-N 2030 and
  Intel Centrino Wireless-N 2230 have the same pciids...
  
  this makes patch apply again with newest pcidevs changes.
 
 Please also make sure to use tab and not space when appropriate ;)  You
 can check style(9) if in doubt !
 
ups :)
attached is a diff
- which follows style(9) (hopefully) and
- fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
  IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().

@mike, only style changes since the last patch i send you.

Regards,
Fabian


Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c7 Jan 2014 20:51:38 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn5000_temp_offset_calibv2(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ;
sc-fwsz = IWN5000_FWSZ;
sc-sched_txfact_addr = IWN5000_SCHED_TXFACT;
+   sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN;
 
switch (sc-hw_type) {
case IWN_HW_REV_TYPE_5100:
@@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2030_sensitivity_limits;
+   sc-fwname = iwn-2030;
+   sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+   break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+   sc-eeprom_voltage = letoh16(hdr.volt);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+   sc-eeprom_temp_high = letoh16(val);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2);
+   sc-eeprom_temp = letoh16(val);
+   }
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
@@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft
 
switch (calib-code) {
case IWN5000_PHY_CALIB_DC:
-   if (sc-hw_type == IWN_HW_REV_TYPE_5150)
+   if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
+   sc-hw_type == IWN_HW_REV_TYPE_2030)
idx = 0;
break;
case IWN5000_PHY_CALIB_LO:
@@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc)
struct iwn_phy_calib cmd;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   cmd.code = sc-reset_noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
DPRINTF((setting initial differential gains\n));
@@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc)
div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN;
+   cmd.code = sc-noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
/* Get first available RX antenna as referential. */
@@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft
0xc0004000, 0x4000, 0xf0005000, 0xf0005000,
};
struct iwn6000_btcoex_config btconfig;
+   struct iwn2000_btcoex_config btconfig2k;
struct iwn_btcoex_priotable btprio;
struct iwn_btcoex_prot btprot;
  

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Fabian Raetz
On Sun, Feb 09, 2014 at 10:40:57AM -0500, Brad Smith wrote:
 On Sun, Feb 09, 2014 at 02:23:18PM +0100, Fabian Raetz wrote:
   
   Hmm, my cleanup was based on the version you send out on December
   31st.  Can you send me the latest version of your diff?
   
  
  On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
   On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
Hi tech@,

here is an updated patch.

it seems like Intel Centrino Wireless-N 2030 and
Intel Centrino Wireless-N 2230 have the same pciids...

this makes patch apply again with newest pcidevs changes.
   
   Please also make sure to use tab and not space when appropriate ;)  You
   can check style(9) if in doubt !
   
  ups :)
  attached is a diff
  - which follows style(9) (hopefully) and
  - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().
  
  @mike, only style changes since the last patch i send you.
  
  Regards,
  Fabian
  
 Post the diff again but remove the pcidevs change.
  

Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c9 Feb 2014 16:41:10 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn5000_temp_offset_calibv2(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ;
sc-fwsz = IWN5000_FWSZ;
sc-sched_txfact_addr = IWN5000_SCHED_TXFACT;
+   sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN;
 
switch (sc-hw_type) {
case IWN_HW_REV_TYPE_5100:
@@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2030_sensitivity_limits;
+   sc-fwname = iwn-2030;
+   sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+   break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+   sc-eeprom_voltage = letoh16(hdr.volt);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+   sc-eeprom_temp_high = letoh16(val);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2);
+   sc-eeprom_temp = letoh16(val);
+   }
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
@@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft
 
switch (calib-code) {
case IWN5000_PHY_CALIB_DC:
-   if (sc-hw_type == IWN_HW_REV_TYPE_5150)
+   if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
+   sc-hw_type == IWN_HW_REV_TYPE_2030)
idx = 0;
break;
case IWN5000_PHY_CALIB_LO:
@@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc)
struct iwn_phy_calib cmd;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   cmd.code = sc-reset_noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
DPRINTF((setting initial differential gains\n));
@@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc)
div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN;
+   cmd.code = sc-noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
/* Get first available RX antenna as referential. */
@@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Benoit Lecocq
On 02/09/14 21:32, Mark Kettenis wrote:
 Date: Sun, 9 Feb 2014 14:23:18 +0100
 From: Fabian Raetz fabian.ra...@gmail.com

 Hmm, my cleanup was based on the version you send out on December
 31st.  Can you send me the latest version of your diff?


 On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
 On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
 Hi tech@,

 here is an updated patch.

 it seems like Intel Centrino Wireless-N 2030 and
 Intel Centrino Wireless-N 2230 have the same pciids...

 this makes patch apply again with newest pcidevs changes.

 Please also make sure to use tab and not space when appropriate ;)  You
 can check style(9) if in doubt !

 ups :)
 attached is a diff
 - which follows style(9) (hopefully) and
 - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
   IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().

 @mike, only style changes since the last patch i send you.
 
 Thanks.  I incorporated the changes in my cleaned up version.
 
 The change does affect other hardware types now, but I've tested this
 on a couple of systems:
 
 iwn0 at pci3 dev 0 function 0 Intel WiFi Link 5300 rev 0x00: msi, MIMO 
 3T3R, MoW
 
 iwn0 at pci3 dev 0 function 0 Intel Centrino Ultimate-N 6300 rev 0x35: msi, 
 MIMO 3T3R, MoW
 
 iwn0 at pci2 dev 0 function 0 Intel Centrino Advanced-N 6205 rev 0x34: msi, 
 MIMO 2T2R, MoW
 
 So if this one works for you and Benoit, I'll go ahead and commit this.
 

ok for me, works fine !

 
 Index: if_iwn.c
 ===
 RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
 retrieving revision 1.127
 diff -u -p -r1.127 if_iwn.c
 --- if_iwn.c  6 Dec 2013 21:03:04 -   1.127
 +++ if_iwn.c  9 Feb 2014 20:25:41 -
 @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
 + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 },
 + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 },
  };
  
  int  iwn_match(struct device *, void *, void *);
 @@ -243,7 +245,8 @@ int   iwn5000_query_calibration(struct iw
  int  iwn5000_send_calibration(struct iwn_softc *);
  int  iwn5000_send_wimax_coex(struct iwn_softc *);
  int  iwn5000_crystal_calib(struct iwn_softc *);
 -int  iwn5000_temp_offset_calib(struct iwn_softc *);
 +int  iwn6000_temp_offset_calib(struct iwn_softc *);
 +int  iwn2000_temp_offset_calib(struct iwn_softc *);
  int  iwn4965_post_alive(struct iwn_softc *);
  int  iwn5000_post_alive(struct iwn_softc *);
  int  iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
 @@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
   } else
   sc-fwname = iwn-6005;
   break;
 + case IWN_HW_REV_TYPE_2030:
 + sc-limits = iwn2000_sensitivity_limits;
 + sc-fwname = iwn-2030;
 + sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
 + break;
   default:
   printf(: adapter type %d not supported\n, sc-hw_type);
   return ENOTSUP;
 @@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
   hdr.version, hdr.pa_type, letoh16(hdr.volt)));
   sc-calib_ver = hdr.version;
  
 + if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
 + sc-eeprom_voltage = letoh16(hdr.volt);
 + iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
 + sc-eeprom_temp = letoh16(val);
 + iwn_read_prom_data(sc, base + IWN2000_EEPROM_RAWTEMP, val, 2);
 + sc-eeprom_rawtemp = letoh16(val);
 + }
 +
   if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
   /* Compute temperature offset. */
   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
 @@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft
  
   switch (calib-code) {
   case IWN5000_PHY_CALIB_DC:
 - if (sc-hw_type == IWN_HW_REV_TYPE_5150)
 + if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
 + sc-hw_type == IWN_HW_REV_TYPE_2030)
   idx = 0;
   break;
   case IWN5000_PHY_CALIB_LO:
 @@ -3822,7 +3839,7 @@ iwn5000_init_gains(struct iwn_softc *sc)
   struct iwn_phy_calib cmd;
  
   memset(cmd, 0, sizeof cmd);
 - cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
 + cmd.code = sc-reset_noise_gain;
   cmd.ngroups = 1;
   cmd.isvalid = 1;
   DPRINTF((setting initial differential gains\n));
 @@ -3872,7 +3889,7 @@ iwn5000_set_gains(struct iwn_softc *sc)
   div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30;
  
   memset(cmd, 0, sizeof cmd);
 - cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN;
 + cmd.code = sc-noise_gain;
   cmd.ngroups = 1;
   cmd.isvalid = 1;
   /* Get first available RX antenna 

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-09 Thread Fabian Raetz
On Sun, Feb 09, 2014 at 09:32:15PM +0100, Mark Kettenis wrote:
  Date: Sun, 9 Feb 2014 14:23:18 +0100
  From: Fabian Raetz fabian.ra...@gmail.com
   
   Hmm, my cleanup was based on the version you send out on December
   31st.  Can you send me the latest version of your diff?
   
  
  On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
   On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
Hi tech@,

here is an updated patch.

it seems like Intel Centrino Wireless-N 2030 and
Intel Centrino Wireless-N 2230 have the same pciids...

this makes patch apply again with newest pcidevs changes.
   
   Please also make sure to use tab and not space when appropriate ;)  You
   can check style(9) if in doubt !
   
  ups :)
  attached is a diff
  - which follows style(9) (hopefully) and
  - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().
  
  @mike, only style changes since the last patch i send you.
 
 Thanks.  I incorporated the changes in my cleaned up version.
 
 The change does affect other hardware types now, but I've tested this
 on a couple of systems:
 
 iwn0 at pci3 dev 0 function 0 Intel WiFi Link 5300 rev 0x00: msi, MIMO 
 3T3R, MoW
 
 iwn0 at pci3 dev 0 function 0 Intel Centrino Ultimate-N 6300 rev 0x35: msi, 
 MIMO 3T3R, MoW
 
 iwn0 at pci2 dev 0 function 0 Intel Centrino Advanced-N 6205 rev 0x34: msi, 
 MIMO 2T2R, MoW
 
 So if this one works for you and Benoit, I'll go ahead and commit this.
 
works for me too. Thanks!

iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4: msi, 
MIMO 2T2R, BGN



Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-02-08 Thread Mark Kettenis
 
 Hi tech@,
 
 the diff below adds support for the Intel Centrino Wireless-N 2230 
 card found in my Lenovo E330 to iwn(4). 
 
 iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: msi, 
 MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39
 
 This is the 0x0888 version.
 
 I've got most changes from
 https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445
  
 which (i think) mostly landed in freebsd as part of
 http://svnweb.freebsd.org/base?view=revisionrevision=258035
 
 This is the only iwn(4) device i have, so hopefully i did not broke 
 another supported device.
 Any feedback and tests are welcome.
 
 Regards,
 Fabian Raetz

Hi Fabian,

Finally had some time to look at this.  I cleaned your diff up a bit.
Also noticed that the sensitivy limits didn't match the Linux driver I
was looking at.  Does the diff below still result in working hardware
for you?

Thanks,

Mark


Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c8 Feb 2014 22:31:37 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn2000_temp_offset_calib(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2000_sensitivity_limits;
+   sc-fwname = iwn-2030;
+   sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+   break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+   sc-eeprom_voltage = letoh16(hdr.volt);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+   sc-eeprom_temp = letoh16(val);
+   iwn_read_prom_data(sc, base + IWN2000_EEPROM_RAWTEMP, val, 2);
+   sc-eeprom_rawtemp = letoh16(val);
+   }
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
@@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft
 
switch (calib-code) {
case IWN5000_PHY_CALIB_DC:
-   if (sc-hw_type == IWN_HW_REV_TYPE_5150)
+   if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
+   sc-hw_type == IWN_HW_REV_TYPE_2030)
idx = 0;
break;
case IWN5000_PHY_CALIB_LO:
@@ -4160,29 +4177,55 @@ iwn_send_advanced_btcoex(struct iwn_soft
0xcc00ff28, 0x, 0xcc00, 0x,
0xc0004000, 0x4000, 0xf0005000, 0xf0005000,
};
-   struct iwn6000_btcoex_config btconfig;
struct iwn_btcoex_priotable btprio;
struct iwn_btcoex_prot btprot;
int error, i;
 
-   memset(btconfig, 0, sizeof btconfig);
-   btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION |
-   (IWN_BT_FLAG_COEX6000_MODE_3W  IWN_BT_FLAG_COEX6000_MODE_SHIFT) |
-   IWN_BT_FLAG_SYNC_2_BT_DISABLE;
-   btconfig.max_kill = 5;
-   btconfig.bt3_t7_timer = 1;
-   btconfig.kill_ack = htole32(0x);
-   btconfig.kill_cts = htole32(0x);
-   btconfig.sample_time = 2;
-   btconfig.bt3_t2_timer = 0xc;
-   for (i = 0; i  12; i++)
-   btconfig.lookup_table[i] = htole32(btcoex_3wire[i]);
-   btconfig.valid = htole16(0xff);
-   btconfig.prio_boost = 0xf0;
-   DPRINTF((configuring advanced bluetooth coexistence\n));
-   error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig, sizeof(btconfig), 1);
-   if (error != 0)
-   return (error);
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+ 

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-01-07 Thread Fabian Raetz
On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote:
 On 03/01/14(Fri) 14:24, Fabian Raetz wrote:
  Hi tech@,
  
  here is an updated patch.
  
  it seems like Intel Centrino Wireless-N 2030 and
  Intel Centrino Wireless-N 2230 have the same pciids...
  
  this makes patch apply again with newest pcidevs changes.
 
 Please also make sure to use tab and not space when appropriate ;)  You
 can check style(9) if in doubt !
 
ups :)
attached is a diff
- which follows style(9) (hopefully) and
- fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and
  IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv().

@mike, only style changes since the last patch i send you.

Regards,
Fabian


Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c7 Jan 2014 20:51:38 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn5000_temp_offset_calibv2(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ;
sc-fwsz = IWN5000_FWSZ;
sc-sched_txfact_addr = IWN5000_SCHED_TXFACT;
+   sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN;
 
switch (sc-hw_type) {
case IWN_HW_REV_TYPE_5100:
@@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2030_sensitivity_limits;
+   sc-fwname = iwn-2030;
+   sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+   break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+   sc-eeprom_voltage = letoh16(hdr.volt);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+   sc-eeprom_temp_high = letoh16(val);
+   iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2);
+   sc-eeprom_temp = letoh16(val);
+   }
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
@@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft
 
switch (calib-code) {
case IWN5000_PHY_CALIB_DC:
-   if (sc-hw_type == IWN_HW_REV_TYPE_5150)
+   if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
+   sc-hw_type == IWN_HW_REV_TYPE_2030)
idx = 0;
break;
case IWN5000_PHY_CALIB_LO:
@@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc)
struct iwn_phy_calib cmd;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN;
+   cmd.code = sc-reset_noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
DPRINTF((setting initial differential gains\n));
@@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc)
div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30;
 
memset(cmd, 0, sizeof cmd);
-   cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN;
+   cmd.code = sc-noise_gain;
cmd.ngroups = 1;
cmd.isvalid = 1;
/* Get first available RX antenna as referential. */
@@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft
0xc0004000, 0x4000, 0xf0005000, 0xf0005000,
};
struct iwn6000_btcoex_config btconfig;
+   struct iwn2000_btcoex_config btconfig2k;
struct iwn_btcoex_priotable btprio;
struct iwn_btcoex_prot btprot;
int error, i;
 
memset(btconfig, 0, sizeof btconfig);
-   btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION |

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-01-03 Thread Fabian Raetz
Hi tech@,

here is an updated patch.

it seems like Intel Centrino Wireless-N 2030 and
Intel Centrino Wireless-N 2230 have the same pciids...

this makes patch apply again with newest pcidevs changes.


Index: if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.127
diff -u -p -r1.127 if_iwn.c
--- if_iwn.c6 Dec 2013 21:03:04 -   1.127
+++ if_iwn.c3 Jan 2014 13:18:54 -
@@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 },
+   { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 },
 };
 
 intiwn_match(struct device *, void *, void *);
@@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn
 intiwn5000_send_wimax_coex(struct iwn_softc *);
 intiwn5000_crystal_calib(struct iwn_softc *);
 intiwn5000_temp_offset_calib(struct iwn_softc *);
+intiwn5000_temp_offset_calibv2(struct iwn_softc *);
 intiwn4965_post_alive(struct iwn_softc *);
 intiwn5000_post_alive(struct iwn_softc *);
 intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci
} else
sc-fwname = iwn-6005;
break;
+   case IWN_HW_REV_TYPE_2030:
+   sc-limits = iwn2030_sensitivity_limits;
+   sc-fwname = iwn-2030;
+sc-sc_flags |= IWN_FLAG_ADV_BT_COEX;
+break;
default:
printf(: adapter type %d not supported\n, sc-hw_type);
return ENOTSUP;
@@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc
hdr.version, hdr.pa_type, letoh16(hdr.volt)));
sc-calib_ver = hdr.version;
 
+   if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+sc-eeprom_voltage = letoh16(hdr.volt);
+iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
+sc-eeprom_temp_high = letoh16(val);
+iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2);
+sc-eeprom_temp = letoh16(val);
+}
+
if (sc-hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2);
@@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft
 
switch (calib-code) {
case IWN5000_PHY_CALIB_DC:
-   if (sc-hw_type == IWN_HW_REV_TYPE_5150)
+   if (sc-hw_type == IWN_HW_REV_TYPE_5150 ||
+sc-hw_type == IWN_HW_REV_TYPE_2030)
idx = 0;
break;
case IWN5000_PHY_CALIB_LO:
@@ -4161,28 +4178,51 @@ iwn_send_advanced_btcoex(struct iwn_soft
0xc0004000, 0x4000, 0xf0005000, 0xf0005000,
};
struct iwn6000_btcoex_config btconfig;
+struct iwn2000_btcoex_config btconfig2k;
struct iwn_btcoex_priotable btprio;
struct iwn_btcoex_prot btprot;
int error, i;
 
memset(btconfig, 0, sizeof btconfig);
-   btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION |
-   (IWN_BT_FLAG_COEX6000_MODE_3W  IWN_BT_FLAG_COEX6000_MODE_SHIFT) |
-   IWN_BT_FLAG_SYNC_2_BT_DISABLE;
-   btconfig.max_kill = 5;
-   btconfig.bt3_t7_timer = 1;
-   btconfig.kill_ack = htole32(0x);
-   btconfig.kill_cts = htole32(0x);
-   btconfig.sample_time = 2;
-   btconfig.bt3_t2_timer = 0xc;
-   for (i = 0; i  12; i++)
-   btconfig.lookup_table[i] = htole32(btcoex_3wire[i]);
-   btconfig.valid = htole16(0xff);
-   btconfig.prio_boost = 0xf0;
-   DPRINTF((configuring advanced bluetooth coexistence\n));
-   error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig, sizeof(btconfig), 1);
-   if (error != 0)
-   return (error);
+memset(btconfig2k, 0, sizeof btconfig2k);
+
+if (sc-hw_type == IWN_HW_REV_TYPE_2030) {
+btconfig2k.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION |
+(IWN_BT_FLAG_COEX6000_MODE_3W  IWN_BT_FLAG_COEX6000_MODE_SHIFT) |
+IWN_BT_FLAG_SYNC_2_BT_DISABLE;
+btconfig2k.max_kill = 5;
+btconfig2k.bt3_t7_timer = 1;
+btconfig2k.kill_ack = htole32(0x);
+btconfig2k.kill_cts = htole32(0x);
+btconfig2k.sample_time = 2;
+btconfig2k.bt3_t2_timer = 0xc;
+for (i = 0; i  12; i++)
+btconfig2k.lookup_table[i] = htole32(btcoex_3wire[i]);
+btconfig2k.valid = htole16(0xff);
+btconfig2k.prio_boost = htole32(0xf0);
+DPRINTF((configuring advanced bluetooth coexistence\n));
+error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig2k, sizeof(btconfig2k), 
1);
+if (error 

Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)

2014-01-03 Thread Dawe
On Jan 03, 2014 14:24, Fabian Raetz wrote:
 Hi tech@,
 
 here is an updated patch.
 
 it seems like Intel Centrino Wireless-N 2030 and
 Intel Centrino Wireless-N 2230 have the same pciids...
 
 this makes patch apply again with newest pcidevs changes.
 

No regressions with my Intel WiFi Link 1000 running amd64.

iwn0 at pci2 dev 0 function 0 Intel WiFi Link 1000 rev 0x00: msi, MIMO 1T2R, 
BGS