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 Benoit Lecocq
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


 
 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 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 },
  };
  
  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

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: [NEW] ugold(4) driver for Microdia's USB TEMPer variant (take 2)

2013-05-27 Thread Benoit Lecocq
On 05/12/13 20:41, SASANO Takayoshi wrote:
 Hello,
 
 Here is the driver for Microdia's USB TEMPer with some fixes.
 
 http://www.uaa.org.uk/gomitext/2013/20130513/20130513.diff
 
 - removed intermediate buffer (sc_ibuf), all USB interrupt responses
   will be processed in ugold_intr().
 - use uhidev_set_report() to issue HID command.
 - add ugold* at uhidev? into GENERIC for alpha, amd64, armish, hppa, i386,
   landisk, loongson, macppc, sgi (IP27, IP30, IP32), socppc and sparc64.
 
 Regards,
 
 SASANO Takayoshi u...@mx5.nisiq.net
 

Hi,

I have tried it on amd64 and it works fine :

uhidev4 at uhub3 port 1 configuration 1 interface 0 RDing TEMPerV1.4
rev 2.00/0.01 addr 3
uhidev4: iclass 3/1, 1 report id
ugold0 at uhidev4 reportid 1
uhidev5 at uhub3 port 1 configuration 1 interface 1 RDing TEMPerV1.4
rev 2.00/0.01 addr 3
uhidev5: iclass 3/1
ugold1 at uhidev5
ugold1: type ds75/12bit (temperature)


# sysctl hw.sensors.ugold1
hw.sensors.ugold1.temp0=23.37 degC (inner)

Cheers,
benoit