Ticket #12006: Add-support-for-Intel-Centrino-Wireless-N-2230.patch
File Add-support-for-Intel-Centrino-Wireless-N-2230.patch, 12.9 KB (added by , 9 years ago) |
---|
-
src/add-ons/kernel/drivers/network/wlan/iprowifi4965/Jamfile
From 65a33ec2a06ef050f0835073962fae65256d0249 Mon Sep 17 00:00:00 2001 From: Dan MacDonald <allcoms@gmail.com> Date: Tue, 28 Apr 2015 11:12:56 +0000 Subject: [PATCH] Add support for Intel Centrino Wireless-N 2230. Haiku Trac ticket #12006 --- .../drivers/network/wlan/iprowifi4965/Jamfile | 6 +- .../network/wlan/iprowifi4965/dev/iwn/if_iwn.c | 123 +++++++++++++++++---- .../network/wlan/iprowifi4965/dev/iwn/if_iwnreg.h | 52 ++++++++- .../network/wlan/iprowifi4965/dev/iwn/if_iwnvar.h | 1 + .../drivers/network/wlan/iprowifi4965/glue.c | 3 +- 5 files changed, 155 insertions(+), 30 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/Jamfile b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/Jamfile index 6c26afb..bee6f06 100644
a b KernelAddon iprowifi4965 : 25 25 ; 26 26 27 27 HAIKU_WIFI_FIRMWARE_PACKAGES on iprowifi4965 = 28 iwlwifi-1000-ucode-39.31.5.1 iwlwifi-4965-ucode-228.61.2.24 28 iwlwifi-1000-ucode-39.31.5.1 29 iwlwifi-2030-ucode-18.168.6.1 iwlwifi-4965-ucode-228.61.2.24 29 30 iwlwifi-5000-ucode-8.83.5.1 iwlwifi-5150-ucode-8.24.2.2 30 31 iwlwifi-6000-ucode-9.221.4.1 iwlwifi-6000g2a-ucode-18.168.6.1 31 32 iwlwifi-6000g2b-ucode-18.168.6.1 iwlwifi-6050-ucode-41.28.5.1 ; 32 33 HAIKU_WIFI_FIRMWARE_ARCHIVES on iprowifi4965 = 33 iwlwifi-1000-ucode-39.31.5.1.tgz iwlwifi-4965-ucode-228.61.2.24.tgz 34 iwlwifi-1000-ucode-39.31.5.1.tgz 35 iwlwifi-2030-ucode-18.168.6.1.tgz iwlwifi-4965-ucode-228.61.2.24.tgz 34 36 iwlwifi-5000-ucode-8.83.5.1.tgz iwlwifi-5150-ucode-8.24.2.2.tgz 35 37 iwlwifi-6000-ucode-9.221.4.1.tgz iwlwifi-6000g2a-ucode-18.168.6.1.tgz 36 38 iwlwifi-6000g2b-ucode-18.168.6.1.tgz iwlwifi-6050-ucode-41.28.5.1.tgz ; -
src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c
diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c index 8cd5a48..255cc6e 100644
a b static int iwn5000_query_calibration(struct iwn_softc *); 284 284 static int iwn5000_send_calibration(struct iwn_softc *); 285 285 static int iwn5000_send_wimax_coex(struct iwn_softc *); 286 286 static int iwn5000_crystal_calib(struct iwn_softc *); 287 static int iwn5000_temp_offset_calib(struct iwn_softc *); 287 static int iwn6000_temp_offset_calib(struct iwn_softc *); 288 static int iwn2000_temp_offset_calib(struct iwn_softc *); 288 289 static int iwn4965_post_alive(struct iwn_softc *); 289 290 static int iwn5000_post_alive(struct iwn_softc *); 290 291 static int iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, … … iwn5000_attach(struct iwn_softc *sc, uint16_t pid) 806 807 } else 807 808 sc->fwname = "iwn6000g2afw"; 808 809 break; 810 case IWN_HW_REV_TYPE_2030: 811 sc->limits = &iwn2000_sensitivity_limits; 812 sc->fwname = "iwn2030fw"; 813 sc->sc_flags |= IWN_FLAG_ADV_BTCOEX; 814 break; 809 815 default: 810 816 device_printf(sc->sc_dev, "adapter type %d not supported\n", 811 817 sc->hw_type); … … iwn5000_read_eeprom(struct iwn_softc *sc) 1774 1780 hdr.version, hdr.pa_type, le16toh(hdr.volt)); 1775 1781 sc->calib_ver = hdr.version; 1776 1782 1783 if (sc->hw_type == IWN_HW_REV_TYPE_2030) { 1784 sc->eeprom_voltage = htole16(hdr.volt); 1785 iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, &val, 2); 1786 sc->eeprom_temp = htole16(val); 1787 iwn_read_prom_data(sc, base + IWN2000_EEPROM_RAWTEMP, &val, 2); 1788 sc->eeprom_rawtemp = htole16(val); 1789 } 1790 1777 1791 if (sc->hw_type == IWN_HW_REV_TYPE_5150) { 1778 1792 /* Compute temperature offset. */ 1779 1793 iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, &val, 2); … … iwn_send_advanced_btcoex(struct iwn_softc *sc) 5002 5016 0xcc00ff28, 0x0000aaaa, 0xcc00aaaa, 0x0000aaaa, 5003 5017 0xc0004000, 0x00004000, 0xf0005000, 0xf0005000, 5004 5018 }; 5005 struct iwn6000_btcoex_config btconfig;5006 5019 struct iwn_btcoex_priotable btprio; 5007 5020 struct iwn_btcoex_prot btprot; 5008 5021 int error, i; 5009 5022 5010 memset(&btconfig, 0, sizeof btconfig); 5011 btconfig.flags = 145; 5012 btconfig.max_kill = 5; 5013 btconfig.bt3_t7_timer = 1; 5014 btconfig.kill_ack = htole32(0xffff0000); 5015 btconfig.kill_cts = htole32(0xffff0000); 5016 btconfig.sample_time = 2; 5017 btconfig.bt3_t2_timer = 0xc; 5018 for (i = 0; i < 12; i++) 5019 btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); 5020 btconfig.valid = htole16(0xff); 5021 btconfig.prio_boost = 0xf0; 5022 DPRINTF(sc, IWN_DEBUG_RESET, 5023 "%s: configuring advanced bluetooth coexistence\n", __func__); 5024 error = iwn_cmd(sc, IWN_CMD_BT_COEX, &btconfig, sizeof(btconfig), 1); 5025 if (error != 0) 5026 return error; 5023 if (sc->hw_type == IWN_HW_REV_TYPE_2030) { 5024 struct iwn2000_btcoex_config btconfig; 5025 5026 memset(&btconfig, 0, sizeof btconfig); 5027 btconfig.flags = 145; 5028 btconfig.max_kill = 5; 5029 btconfig.bt3_t7_timer = 1; 5030 btconfig.kill_ack = htole32(0xffff0000); 5031 btconfig.kill_cts = htole32(0xffff0000); 5032 btconfig.sample_time = 2; 5033 btconfig.bt3_t2_timer = 0xc; 5034 for (i = 0; i < 12; i++) 5035 btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); 5036 btconfig.valid = htole16(0xff); 5037 btconfig.prio_boost = htole32(0xf0); 5038 DPRINTF(sc, IWN_DEBUG_RESET, 5039 "%s: configuring advanced bluetooth coexistence\n", 5040 __func__); 5041 error = iwn_cmd(sc, IWN_CMD_BT_COEX, &btconfig, 5042 sizeof(btconfig), 1); 5043 if (error != 0) 5044 return (error); 5045 } else { 5046 struct iwn6000_btcoex_config btconfig; 5047 5048 memset(&btconfig, 0, sizeof btconfig); 5049 btconfig.flags = 145; 5050 btconfig.max_kill = 5; 5051 btconfig.bt3_t7_timer = 1; 5052 btconfig.kill_ack = htole32(0xffff0000); 5053 btconfig.kill_cts = htole32(0xffff0000); 5054 btconfig.sample_time = 2; 5055 btconfig.bt3_t2_timer = 0xc; 5056 for (i = 0; i < 12; i++) 5057 btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); 5058 btconfig.valid = htole16(0xff); 5059 btconfig.prio_boost = 0xf0; 5060 DPRINTF(sc, IWN_DEBUG_RESET, 5061 "%s: configuring advanced bluetooth coexistence\n", 5062 __func__); 5063 error = iwn_cmd(sc, IWN_CMD_BT_COEX, &btconfig, 5064 sizeof(btconfig), 1); 5065 if (error != 0) 5066 return (error); 5067 } 5027 5068 5028 5069 memset(&btprio, 0, sizeof btprio); 5029 5070 btprio.calib_init1 = 0x6; … … iwn_config(struct iwn_softc *sc) 5074 5115 uint16_t rxchain; 5075 5116 int error; 5076 5117 5118 /* Set radio temperature sensor offset. */ 5077 5119 if (sc->hw_type == IWN_HW_REV_TYPE_6005) { 5078 /* Set radio temperature sensor offset. */ 5079 error = iwn5000_temp_offset_calib(sc); 5120 error = iwn6000_temp_offset_calib(sc); 5121 if (error != 0) { 5122 device_printf(sc->sc_dev, 5123 "%s: could not set temperature offset\n", __func__); 5124 return error; 5125 } 5126 } else if (sc->hw_type == IWN_HW_REV_TYPE_2030) { 5127 error = iwn2000_temp_offset_calib(sc); 5080 5128 if (error != 0) { 5081 5129 device_printf(sc->sc_dev, 5082 5130 "%s: could not set temperature offset\n", __func__); … … iwn5000_crystal_calib(struct iwn_softc *sc) 5943 5991 } 5944 5992 5945 5993 static int 5946 iwn 5000_temp_offset_calib(struct iwn_softc *sc)5994 iwn6000_temp_offset_calib(struct iwn_softc *sc) 5947 5995 { 5948 struct iwn 5000_phy_calib_temp_offset cmd;5996 struct iwn6000_phy_calib_temp_offset cmd; 5949 5997 5950 5998 memset(&cmd, 0, sizeof cmd); 5951 cmd.code = IWN 5000_PHY_CALIB_TEMP_OFFSET;5999 cmd.code = IWN6000_PHY_CALIB_TEMP_OFFSET; 5952 6000 cmd.ngroups = 1; 5953 6001 cmd.isvalid = 1; 5954 6002 if (sc->eeprom_temp != 0) … … iwn5000_temp_offset_calib(struct iwn_softc *sc) 5960 6008 return iwn_cmd(sc, IWN_CMD_PHY_CALIB, &cmd, sizeof cmd, 0); 5961 6009 } 5962 6010 6011 static int 6012 iwn2000_temp_offset_calib(struct iwn_softc *sc) 6013 { 6014 struct iwn2000_phy_calib_temp_offset cmd; 6015 6016 memset(&cmd, 0, sizeof cmd); 6017 cmd.code = IWN2000_PHY_CALIB_TEMP_OFFSET; 6018 cmd.ngroups = 1; 6019 cmd.isvalid = 1; 6020 if (sc->eeprom_rawtemp != 0) { 6021 cmd.offset_low = htole16(sc->eeprom_rawtemp); 6022 cmd.offset_high = htole16(sc->eeprom_temp); 6023 } else { 6024 cmd.offset_low = htole16(IWN_DEFAULT_TEMP_OFFSET); 6025 cmd.offset_high = htole16(IWN_DEFAULT_TEMP_OFFSET); 6026 } 6027 cmd.burnt_voltage_ref = htole16(sc->eeprom_voltage); 6028 6029 DPRINTF(sc, IWN_DEBUG_CALIBRATE, 6030 "setting radio sensor offset to %d:%d, voltage to %d\n", 6031 htole16(cmd.offset_low), htole16(cmd.offset_high), 6032 htole16(cmd.burnt_voltage_ref)); 6033 return iwn_cmd(sc, IWN_CMD_PHY_CALIB, &cmd, sizeof cmd, 0); 6034 } 6035 5963 6036 /* 5964 6037 * This function is called after the runtime firmware notifies us of its 5965 6038 * readiness (called in a process context). … … iwn5000_nic_config(struct iwn_softc *sc) 6663 6736 } 6664 6737 if (sc->hw_type == IWN_HW_REV_TYPE_6005) 6665 6738 IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_6050_1X2); 6739 if (sc->hw_type == IWN_HW_REV_TYPE_2030) 6740 IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_RADIO_IQ_INVERT); 6666 6741 return 0; 6667 6742 } 6668 6743 -
src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnreg.h
diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnreg.h b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnreg.h index 9aa0d66..6791def 100644
a b 206 206 #define IWN_HW_REV_TYPE_6000 7 207 207 #define IWN_HW_REV_TYPE_6050 8 208 208 #define IWN_HW_REV_TYPE_6005 11 209 #define IWN_HW_REV_TYPE_2030 12 209 210 210 211 /* Possible flags for register IWN_GIO_CHICKEN. */ 211 212 #define IWN_GIO_CHICKEN_L1A_NO_L0S_RX (1 << 23) … … 220 221 #define IWN_GP_DRIVER_RADIO_2X2_IPA (2 << 0) 221 222 #define IWN_GP_DRIVER_CALIB_VER6 (1 << 2) 222 223 #define IWN_GP_DRIVER_6050_1X2 (1 << 3) 224 #define IWN_GP_DRIVER_RADIO_IQ_INVERT (1 << 7) 223 225 224 226 /* Possible flags for register IWN_UCODE_GP1_CLR. */ 225 227 #define IWN_UCODE_GP1_RFKILL (1 << 1) … … struct iwn6000_btcoex_config { 878 880 uint16_t rx_prio_boost; 879 881 } __packed; 880 882 883 struct iwn2000_btcoex_config { 884 uint8_t flags; /* same as in iwn6000_btcoex_config */ 885 uint8_t lead_time; 886 uint8_t max_kill; 887 uint8_t bt3_t7_timer; 888 uint32_t kill_ack; 889 uint32_t kill_cts; 890 uint8_t sample_time; 891 uint8_t bt3_t2_timer; 892 uint16_t bt4_reaction; 893 uint32_t lookup_table[12]; 894 uint16_t bt4_decision; 895 uint16_t valid; 896 uint32_t prio_boost; 897 uint8_t reserved; 898 uint8_t tx_prio_boost; 899 uint16_t rx_prio_boost; 900 } __packed; 901 881 902 struct iwn_btcoex_priotable { 882 903 uint8_t calib_init1; 883 904 uint8_t calib_init2; … … struct iwn_phy_calib { 965 986 #define IWN5000_PHY_CALIB_CRYSTAL 15 966 987 #define IWN5000_PHY_CALIB_BASE_BAND 16 967 988 #define IWN5000_PHY_CALIB_TX_IQ_PERIODIC 17 968 #define IWN5000_PHY_CALIB_TEMP_OFFSET 18969 970 989 #define IWN5000_PHY_CALIB_RESET_NOISE_GAIN 18 971 990 #define IWN5000_PHY_CALIB_NOISE_GAIN 19 972 991 992 #define IWN6000_PHY_CALIB_TEMP_OFFSET 18 993 #define IWN2000_PHY_CALIB_TEMP_OFFSET 18 994 973 995 uint8_t group; 974 996 uint8_t ngroups; 975 997 uint8_t isvalid; … … struct iwn5000_phy_calib_crystal { 985 1007 uint8_t reserved[2]; 986 1008 } __packed; 987 1009 988 struct iwn 5000_phy_calib_temp_offset {1010 struct iwn6000_phy_calib_temp_offset { 989 1011 uint8_t code; 990 1012 uint8_t group; 991 1013 uint8_t ngroups; … … struct iwn5000_phy_calib_temp_offset { 996 1018 uint16_t reserved; 997 1019 } __packed; 998 1020 1021 struct iwn2000_phy_calib_temp_offset { 1022 uint8_t code; 1023 uint8_t group; 1024 uint8_t ngroups; 1025 uint8_t isvalid; 1026 int16_t offset_high; 1027 int16_t offset_low; 1028 int16_t burnt_voltage_ref; 1029 int16_t reserved; 1030 } __packed; 1031 999 1032 struct iwn_phy_calib_gain { 1000 1033 uint8_t code; 1001 1034 uint8_t group; … … struct iwn_fw_tlv { 1414 1447 #define IWN5000_EEPROM_CRYSTAL 0x128 1415 1448 #define IWN5000_EEPROM_TEMP 0x12a 1416 1449 #define IWN5000_EEPROM_VOLT 0x12b 1450 #define IWN2000_EEPROM_RAWTEMP 0x12b 1417 1451 1418 1452 /* Possible flags for IWN_EEPROM_SKU_CAP. */ 1419 1453 #define IWN_EEPROM_SKU_CAP_11N (1 << 6) … … static const struct iwn_sensitivity_limits iwn6000_sensitivity_limits = { 1722 1756 100 1723 1757 }; 1724 1758 1759 static const struct iwn_sensitivity_limits iwn2000_sensitivity_limits = { 1760 105, 110, 1761 192, 232, 1762 80, 145, 1763 128, 232, 1764 125, 175, 1765 160, 310, 1766 97, 1767 97, 1768 100 1769 }; 1770 1725 1771 /* Map TID to TX scheduler's FIFO. */ 1726 1772 static const uint8_t iwn_tid2fifo[] = { 1727 1773 1, 0, 0, 1, 2, 2, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 3 -
src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnvar.h
diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnvar.h b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwnvar.h index 7647b09..932aaaf 100644
a b struct iwn_softc { 295 295 uint32_t eeprom_crystal; 296 296 int16_t eeprom_temp; 297 297 int16_t eeprom_voltage; 298 int16_t eeprom_rawtemp; 298 299 int8_t maxpwr2GHz; 299 300 int8_t maxpwr5GHz; 300 301 int8_t maxpwr[IEEE80211_CHAN_MAX]; -
src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c
diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c index 198bece..cf23a6d 100644
a b NO_HAIKU_FBSD_MII_DRIVER(); 24 24 NO_HAIKU_REENABLE_INTERRUPTS(); 25 25 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN); 26 26 HAIKU_FIRMWARE_VERSION(44417); 27 HAIKU_FIRMWARE_NAME_MAP( 8) = {27 HAIKU_FIRMWARE_NAME_MAP(9) = { 28 28 {"iwn1000fw", "iwlwifi-1000-5.ucode"}, 29 {"iwn2030fw", "iwlwifi-2030-6.ucode"}, 29 30 {"iwn4965fw", "iwlwifi-4965-2.ucode"}, 30 31 {"iwn5000fw", "iwlwifi-5000-5.ucode"}, 31 32 {"iwn5150fw", "iwlwifi-5150-2.ucode"},