diff options
167 files changed, 6478 insertions, 6908 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 5095340716cf..d350dae2ce1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1595,6 +1595,7 @@ M: Arend van Spriel <arend@broadcom.com> | |||
1595 | M: Franky (Zhenhui) Lin <frankyl@broadcom.com> | 1595 | M: Franky (Zhenhui) Lin <frankyl@broadcom.com> |
1596 | M: Kan Yan <kanyan@broadcom.com> | 1596 | M: Kan Yan <kanyan@broadcom.com> |
1597 | L: linux-wireless@vger.kernel.org | 1597 | L: linux-wireless@vger.kernel.org |
1598 | L: brcm80211-dev-list@broadcom.com | ||
1598 | S: Supported | 1599 | S: Supported |
1599 | F: drivers/net/wireless/brcm80211/ | 1600 | F: drivers/net/wireless/brcm80211/ |
1600 | 1601 | ||
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index 5ed0718fc660..a3420585d942 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -28,6 +28,12 @@ static const struct bcma_device_id_name bcma_arm_device_names[] = { | |||
28 | 28 | ||
29 | static const struct bcma_device_id_name bcma_bcm_device_names[] = { | 29 | static const struct bcma_device_id_name bcma_bcm_device_names[] = { |
30 | { BCMA_CORE_OOB_ROUTER, "OOB Router" }, | 30 | { BCMA_CORE_OOB_ROUTER, "OOB Router" }, |
31 | { BCMA_CORE_4706_CHIPCOMMON, "BCM4706 ChipCommon" }, | ||
32 | { BCMA_CORE_4706_SOC_RAM, "BCM4706 SOC RAM" }, | ||
33 | { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" }, | ||
34 | { BCMA_CORE_AMEMC, "AMEMC (DDR)" }, | ||
35 | { BCMA_CORE_ALTA, "ALTA (I2S)" }, | ||
36 | { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" }, | ||
31 | { BCMA_CORE_INVALID, "Invalid" }, | 37 | { BCMA_CORE_INVALID, "Invalid" }, |
32 | { BCMA_CORE_CHIPCOMMON, "ChipCommon" }, | 38 | { BCMA_CORE_CHIPCOMMON, "ChipCommon" }, |
33 | { BCMA_CORE_ILINE20, "ILine 20" }, | 39 | { BCMA_CORE_ILINE20, "ILine 20" }, |
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index f27e9732951d..fd7dbd4609df 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -53,6 +53,11 @@ | |||
53 | 53 | ||
54 | #define DEFAULT_BG_SCAN_PERIOD 60 | 54 | #define DEFAULT_BG_SCAN_PERIOD 60 |
55 | 55 | ||
56 | struct ath6kl_cfg80211_match_probe_ssid { | ||
57 | struct cfg80211_ssid ssid; | ||
58 | u8 flag; | ||
59 | }; | ||
60 | |||
56 | static struct ieee80211_rate ath6kl_rates[] = { | 61 | static struct ieee80211_rate ath6kl_rates[] = { |
57 | RATETAB_ENT(10, 0x1, 0), | 62 | RATETAB_ENT(10, 0x1, 0), |
58 | RATETAB_ENT(20, 0x2, 0), | 63 | RATETAB_ENT(20, 0x2, 0), |
@@ -576,6 +581,9 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
576 | 581 | ||
577 | vif->nw_type = vif->next_mode; | 582 | vif->nw_type = vif->next_mode; |
578 | 583 | ||
584 | /* enable enhanced bmiss detection if applicable */ | ||
585 | ath6kl_cfg80211_sta_bmiss_enhance(vif, true); | ||
586 | |||
579 | if (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) | 587 | if (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) |
580 | nw_subtype = SUBTYPE_P2PCLIENT; | 588 | nw_subtype = SUBTYPE_P2PCLIENT; |
581 | 589 | ||
@@ -852,20 +860,6 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, | |||
852 | } | 860 | } |
853 | } | 861 | } |
854 | 862 | ||
855 | /* | ||
856 | * Send a disconnect command to target when a disconnect event is | ||
857 | * received with reason code other than 3 (DISCONNECT_CMD - disconnect | ||
858 | * request from host) to make the firmware stop trying to connect even | ||
859 | * after giving disconnect event. There will be one more disconnect | ||
860 | * event for this disconnect command with reason code DISCONNECT_CMD | ||
861 | * which will be notified to cfg80211. | ||
862 | */ | ||
863 | |||
864 | if (reason != DISCONNECT_CMD) { | ||
865 | ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); | ||
866 | return; | ||
867 | } | ||
868 | |||
869 | clear_bit(CONNECT_PEND, &vif->flags); | 863 | clear_bit(CONNECT_PEND, &vif->flags); |
870 | 864 | ||
871 | if (vif->sme_state == SME_CONNECTING) { | 865 | if (vif->sme_state == SME_CONNECTING) { |
@@ -875,32 +869,96 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, | |||
875 | WLAN_STATUS_UNSPECIFIED_FAILURE, | 869 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
876 | GFP_KERNEL); | 870 | GFP_KERNEL); |
877 | } else if (vif->sme_state == SME_CONNECTED) { | 871 | } else if (vif->sme_state == SME_CONNECTED) { |
878 | cfg80211_disconnected(vif->ndev, reason, | 872 | cfg80211_disconnected(vif->ndev, proto_reason, |
879 | NULL, 0, GFP_KERNEL); | 873 | NULL, 0, GFP_KERNEL); |
880 | } | 874 | } |
881 | 875 | ||
882 | vif->sme_state = SME_DISCONNECTED; | 876 | vif->sme_state = SME_DISCONNECTED; |
877 | |||
878 | /* | ||
879 | * Send a disconnect command to target when a disconnect event is | ||
880 | * received with reason code other than 3 (DISCONNECT_CMD - disconnect | ||
881 | * request from host) to make the firmware stop trying to connect even | ||
882 | * after giving disconnect event. There will be one more disconnect | ||
883 | * event for this disconnect command with reason code DISCONNECT_CMD | ||
884 | * which won't be notified to cfg80211. | ||
885 | */ | ||
886 | if (reason != DISCONNECT_CMD) | ||
887 | ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); | ||
883 | } | 888 | } |
884 | 889 | ||
885 | static int ath6kl_set_probed_ssids(struct ath6kl *ar, | 890 | static int ath6kl_set_probed_ssids(struct ath6kl *ar, |
886 | struct ath6kl_vif *vif, | 891 | struct ath6kl_vif *vif, |
887 | struct cfg80211_ssid *ssids, int n_ssids) | 892 | struct cfg80211_ssid *ssids, int n_ssids, |
893 | struct cfg80211_match_set *match_set, | ||
894 | int n_match_ssid) | ||
888 | { | 895 | { |
889 | u8 i; | 896 | u8 i, j, index_to_add, ssid_found = false; |
897 | struct ath6kl_cfg80211_match_probe_ssid ssid_list[MAX_PROBED_SSIDS]; | ||
898 | |||
899 | memset(ssid_list, 0, sizeof(ssid_list)); | ||
890 | 900 | ||
891 | if (n_ssids > MAX_PROBED_SSID_INDEX) | 901 | if (n_ssids > MAX_PROBED_SSIDS || |
902 | n_match_ssid > MAX_PROBED_SSIDS) | ||
892 | return -EINVAL; | 903 | return -EINVAL; |
893 | 904 | ||
894 | for (i = 0; i < n_ssids; i++) { | 905 | for (i = 0; i < n_ssids; i++) { |
906 | memcpy(ssid_list[i].ssid.ssid, | ||
907 | ssids[i].ssid, | ||
908 | ssids[i].ssid_len); | ||
909 | ssid_list[i].ssid.ssid_len = ssids[i].ssid_len; | ||
910 | |||
911 | if (ssids[i].ssid_len) | ||
912 | ssid_list[i].flag = SPECIFIC_SSID_FLAG; | ||
913 | else | ||
914 | ssid_list[i].flag = ANY_SSID_FLAG; | ||
915 | |||
916 | if (n_match_ssid == 0) | ||
917 | ssid_list[i].flag |= MATCH_SSID_FLAG; | ||
918 | } | ||
919 | |||
920 | index_to_add = i; | ||
921 | |||
922 | for (i = 0; i < n_match_ssid; i++) { | ||
923 | ssid_found = false; | ||
924 | |||
925 | for (j = 0; j < n_ssids; j++) { | ||
926 | if ((match_set[i].ssid.ssid_len == | ||
927 | ssid_list[j].ssid.ssid_len) && | ||
928 | (!memcmp(ssid_list[j].ssid.ssid, | ||
929 | match_set[i].ssid.ssid, | ||
930 | match_set[i].ssid.ssid_len))) { | ||
931 | ssid_list[j].flag |= MATCH_SSID_FLAG; | ||
932 | ssid_found = true; | ||
933 | break; | ||
934 | } | ||
935 | } | ||
936 | |||
937 | if (ssid_found) | ||
938 | continue; | ||
939 | |||
940 | if (index_to_add >= MAX_PROBED_SSIDS) | ||
941 | continue; | ||
942 | |||
943 | ssid_list[index_to_add].ssid.ssid_len = | ||
944 | match_set[i].ssid.ssid_len; | ||
945 | memcpy(ssid_list[index_to_add].ssid.ssid, | ||
946 | match_set[i].ssid.ssid, | ||
947 | match_set[i].ssid.ssid_len); | ||
948 | ssid_list[index_to_add].flag |= MATCH_SSID_FLAG; | ||
949 | index_to_add++; | ||
950 | } | ||
951 | |||
952 | for (i = 0; i < index_to_add; i++) { | ||
895 | ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, | 953 | ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, |
896 | ssids[i].ssid_len ? | 954 | ssid_list[i].flag, |
897 | SPECIFIC_SSID_FLAG : ANY_SSID_FLAG, | 955 | ssid_list[i].ssid.ssid_len, |
898 | ssids[i].ssid_len, | 956 | ssid_list[i].ssid.ssid); |
899 | ssids[i].ssid); | 957 | |
900 | } | 958 | } |
901 | 959 | ||
902 | /* Make sure no old entries are left behind */ | 960 | /* Make sure no old entries are left behind */ |
903 | for (i = n_ssids; i < MAX_PROBED_SSID_INDEX; i++) { | 961 | for (i = index_to_add; i < MAX_PROBED_SSIDS; i++) { |
904 | ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, | 962 | ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, |
905 | DISABLE_SSID_FLAG, 0, NULL); | 963 | DISABLE_SSID_FLAG, 0, NULL); |
906 | } | 964 | } |
@@ -934,7 +992,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |||
934 | } | 992 | } |
935 | 993 | ||
936 | ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, | 994 | ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, |
937 | request->n_ssids); | 995 | request->n_ssids, NULL, 0); |
938 | if (ret < 0) | 996 | if (ret < 0) |
939 | return ret; | 997 | return ret; |
940 | 998 | ||
@@ -943,7 +1001,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |||
943 | WMI_FRAME_PROBE_REQ, | 1001 | WMI_FRAME_PROBE_REQ, |
944 | request->ie, request->ie_len); | 1002 | request->ie, request->ie_len); |
945 | if (ret) { | 1003 | if (ret) { |
946 | ath6kl_err("failed to set Probe Request appie for scan"); | 1004 | ath6kl_err("failed to set Probe Request appie for scan\n"); |
947 | return ret; | 1005 | return ret; |
948 | } | 1006 | } |
949 | 1007 | ||
@@ -1512,6 +1570,9 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy, | |||
1512 | } | 1570 | } |
1513 | } | 1571 | } |
1514 | 1572 | ||
1573 | /* need to clean up enhanced bmiss detection fw state */ | ||
1574 | ath6kl_cfg80211_sta_bmiss_enhance(vif, false); | ||
1575 | |||
1515 | set_iface_type: | 1576 | set_iface_type: |
1516 | switch (type) { | 1577 | switch (type) { |
1517 | case NL80211_IFTYPE_STATION: | 1578 | case NL80211_IFTYPE_STATION: |
@@ -2074,7 +2135,9 @@ static int ath6kl_wow_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) | |||
2074 | if (wow && (wow->n_patterns > WOW_MAX_FILTERS_PER_LIST)) | 2135 | if (wow && (wow->n_patterns > WOW_MAX_FILTERS_PER_LIST)) |
2075 | return -EINVAL; | 2136 | return -EINVAL; |
2076 | 2137 | ||
2077 | if (!test_bit(NETDEV_MCAST_ALL_ON, &vif->flags)) { | 2138 | if (!test_bit(NETDEV_MCAST_ALL_ON, &vif->flags) && |
2139 | test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, | ||
2140 | ar->fw_capabilities)) { | ||
2078 | ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, | 2141 | ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, |
2079 | vif->fw_vif_idx, false); | 2142 | vif->fw_vif_idx, false); |
2080 | if (ret) | 2143 | if (ret) |
@@ -2209,7 +2272,9 @@ static int ath6kl_wow_resume(struct ath6kl *ar) | |||
2209 | 2272 | ||
2210 | ar->state = ATH6KL_STATE_ON; | 2273 | ar->state = ATH6KL_STATE_ON; |
2211 | 2274 | ||
2212 | if (!test_bit(NETDEV_MCAST_ALL_OFF, &vif->flags)) { | 2275 | if (!test_bit(NETDEV_MCAST_ALL_OFF, &vif->flags) && |
2276 | test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, | ||
2277 | ar->fw_capabilities)) { | ||
2213 | ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, | 2278 | ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, |
2214 | vif->fw_vif_idx, true); | 2279 | vif->fw_vif_idx, true); |
2215 | if (ret) | 2280 | if (ret) |
@@ -2475,7 +2540,7 @@ void ath6kl_check_wow_status(struct ath6kl *ar) | |||
2475 | static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum ieee80211_band band, | 2540 | static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum ieee80211_band band, |
2476 | bool ht_enable) | 2541 | bool ht_enable) |
2477 | { | 2542 | { |
2478 | struct ath6kl_htcap *htcap = &vif->htcap; | 2543 | struct ath6kl_htcap *htcap = &vif->htcap[band]; |
2479 | 2544 | ||
2480 | if (htcap->ht_enable == ht_enable) | 2545 | if (htcap->ht_enable == ht_enable) |
2481 | return 0; | 2546 | return 0; |
@@ -2585,6 +2650,30 @@ static int ath6kl_set_ies(struct ath6kl_vif *vif, | |||
2585 | return 0; | 2650 | return 0; |
2586 | } | 2651 | } |
2587 | 2652 | ||
2653 | void ath6kl_cfg80211_sta_bmiss_enhance(struct ath6kl_vif *vif, bool enable) | ||
2654 | { | ||
2655 | int err; | ||
2656 | |||
2657 | if (WARN_ON(!test_bit(WMI_READY, &vif->ar->flag))) | ||
2658 | return; | ||
2659 | |||
2660 | if (vif->nw_type != INFRA_NETWORK) | ||
2661 | return; | ||
2662 | |||
2663 | if (!test_bit(ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, | ||
2664 | vif->ar->fw_capabilities)) | ||
2665 | return; | ||
2666 | |||
2667 | ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s fw bmiss enhance\n", | ||
2668 | enable ? "enable" : "disable"); | ||
2669 | |||
2670 | err = ath6kl_wmi_sta_bmiss_enhance_cmd(vif->ar->wmi, | ||
2671 | vif->fw_vif_idx, enable); | ||
2672 | if (err) | ||
2673 | ath6kl_err("failed to %s enhanced bmiss detection: %d\n", | ||
2674 | enable ? "enable" : "disable", err); | ||
2675 | } | ||
2676 | |||
2588 | static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon, | 2677 | static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon, |
2589 | u8 *rsn_capab) | 2678 | u8 *rsn_capab) |
2590 | { | 2679 | { |
@@ -2665,9 +2754,15 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
2665 | 2754 | ||
2666 | /* TODO: | 2755 | /* TODO: |
2667 | * info->interval | 2756 | * info->interval |
2668 | * info->dtim_period | ||
2669 | */ | 2757 | */ |
2670 | 2758 | ||
2759 | ret = ath6kl_wmi_ap_set_dtim_cmd(ar->wmi, vif->fw_vif_idx, | ||
2760 | info->dtim_period); | ||
2761 | |||
2762 | /* ignore error, just print a warning and continue normally */ | ||
2763 | if (ret) | ||
2764 | ath6kl_warn("Failed to set dtim_period in beacon: %d\n", ret); | ||
2765 | |||
2671 | if (info->beacon.head == NULL) | 2766 | if (info->beacon.head == NULL) |
2672 | return -EINVAL; | 2767 | return -EINVAL; |
2673 | mgmt = (struct ieee80211_mgmt *) info->beacon.head; | 2768 | mgmt = (struct ieee80211_mgmt *) info->beacon.head; |
@@ -3131,10 +3226,24 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy, | |||
3131 | ath6kl_cfg80211_scan_complete_event(vif, true); | 3226 | ath6kl_cfg80211_scan_complete_event(vif, true); |
3132 | 3227 | ||
3133 | ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, | 3228 | ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, |
3134 | request->n_ssids); | 3229 | request->n_ssids, |
3230 | request->match_sets, | ||
3231 | request->n_match_sets); | ||
3135 | if (ret < 0) | 3232 | if (ret < 0) |
3136 | return ret; | 3233 | return ret; |
3137 | 3234 | ||
3235 | if (!request->n_match_sets) { | ||
3236 | ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, | ||
3237 | ALL_BSS_FILTER, 0); | ||
3238 | if (ret < 0) | ||
3239 | return ret; | ||
3240 | } else { | ||
3241 | ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, | ||
3242 | MATCHED_SSID_FILTER, 0); | ||
3243 | if (ret < 0) | ||
3244 | return ret; | ||
3245 | } | ||
3246 | |||
3138 | /* fw uses seconds, also make sure that it's >0 */ | 3247 | /* fw uses seconds, also make sure that it's >0 */ |
3139 | interval = max_t(u16, 1, request->interval / 1000); | 3248 | interval = max_t(u16, 1, request->interval / 1000); |
3140 | 3249 | ||
@@ -3156,7 +3265,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy, | |||
3156 | WMI_FRAME_PROBE_REQ, | 3265 | WMI_FRAME_PROBE_REQ, |
3157 | request->ie, request->ie_len); | 3266 | request->ie, request->ie_len); |
3158 | if (ret) { | 3267 | if (ret) { |
3159 | ath6kl_warn("Failed to set probe request IE for scheduled scan: %d", | 3268 | ath6kl_warn("Failed to set probe request IE for scheduled scan: %d\n", |
3160 | ret); | 3269 | ret); |
3161 | return ret; | 3270 | return ret; |
3162 | } | 3271 | } |
@@ -3188,6 +3297,18 @@ static int ath6kl_cfg80211_sscan_stop(struct wiphy *wiphy, | |||
3188 | return 0; | 3297 | return 0; |
3189 | } | 3298 | } |
3190 | 3299 | ||
3300 | static int ath6kl_cfg80211_set_bitrate(struct wiphy *wiphy, | ||
3301 | struct net_device *dev, | ||
3302 | const u8 *addr, | ||
3303 | const struct cfg80211_bitrate_mask *mask) | ||
3304 | { | ||
3305 | struct ath6kl *ar = ath6kl_priv(dev); | ||
3306 | struct ath6kl_vif *vif = netdev_priv(dev); | ||
3307 | |||
3308 | return ath6kl_wmi_set_bitrate_mask(ar->wmi, vif->fw_vif_idx, | ||
3309 | mask); | ||
3310 | } | ||
3311 | |||
3191 | static const struct ieee80211_txrx_stypes | 3312 | static const struct ieee80211_txrx_stypes |
3192 | ath6kl_mgmt_stypes[NUM_NL80211_IFTYPES] = { | 3313 | ath6kl_mgmt_stypes[NUM_NL80211_IFTYPES] = { |
3193 | [NL80211_IFTYPE_STATION] = { | 3314 | [NL80211_IFTYPE_STATION] = { |
@@ -3253,6 +3374,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = { | |||
3253 | .mgmt_frame_register = ath6kl_mgmt_frame_register, | 3374 | .mgmt_frame_register = ath6kl_mgmt_frame_register, |
3254 | .sched_scan_start = ath6kl_cfg80211_sscan_start, | 3375 | .sched_scan_start = ath6kl_cfg80211_sscan_start, |
3255 | .sched_scan_stop = ath6kl_cfg80211_sscan_stop, | 3376 | .sched_scan_stop = ath6kl_cfg80211_sscan_stop, |
3377 | .set_bitrate_mask = ath6kl_cfg80211_set_bitrate, | ||
3256 | }; | 3378 | }; |
3257 | 3379 | ||
3258 | void ath6kl_cfg80211_stop(struct ath6kl_vif *vif) | 3380 | void ath6kl_cfg80211_stop(struct ath6kl_vif *vif) |
@@ -3380,7 +3502,8 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, | |||
3380 | vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL; | 3502 | vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL; |
3381 | vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME; | 3503 | vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME; |
3382 | vif->bg_scan_period = 0; | 3504 | vif->bg_scan_period = 0; |
3383 | vif->htcap.ht_enable = true; | 3505 | vif->htcap[IEEE80211_BAND_2GHZ].ht_enable = true; |
3506 | vif->htcap[IEEE80211_BAND_5GHZ].ht_enable = true; | ||
3384 | 3507 | ||
3385 | memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN); | 3508 | memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN); |
3386 | if (fw_vif_idx != 0) | 3509 | if (fw_vif_idx != 0) |
@@ -3440,7 +3563,13 @@ int ath6kl_cfg80211_init(struct ath6kl *ar) | |||
3440 | } | 3563 | } |
3441 | 3564 | ||
3442 | /* max num of ssids that can be probed during scanning */ | 3565 | /* max num of ssids that can be probed during scanning */ |
3443 | wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX; | 3566 | wiphy->max_scan_ssids = MAX_PROBED_SSIDS; |
3567 | |||
3568 | /* max num of ssids that can be matched after scan */ | ||
3569 | if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, | ||
3570 | ar->fw_capabilities)) | ||
3571 | wiphy->max_match_sets = MAX_PROBED_SSIDS; | ||
3572 | |||
3444 | wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ | 3573 | wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ |
3445 | switch (ar->hw.cap) { | 3574 | switch (ar->hw.cap) { |
3446 | case WMI_11AN_CAP: | 3575 | case WMI_11AN_CAP: |
@@ -3477,6 +3606,17 @@ int ath6kl_cfg80211_init(struct ath6kl *ar) | |||
3477 | ath6kl_band_5ghz.ht_cap.cap = 0; | 3606 | ath6kl_band_5ghz.ht_cap.cap = 0; |
3478 | ath6kl_band_5ghz.ht_cap.ht_supported = false; | 3607 | ath6kl_band_5ghz.ht_cap.ht_supported = false; |
3479 | } | 3608 | } |
3609 | |||
3610 | if (ar->hw.flags & ATH6KL_HW_FLAG_64BIT_RATES) { | ||
3611 | ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; | ||
3612 | ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff; | ||
3613 | ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff; | ||
3614 | ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff; | ||
3615 | } else { | ||
3616 | ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; | ||
3617 | ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff; | ||
3618 | } | ||
3619 | |||
3480 | if (band_2gig) | 3620 | if (band_2gig) |
3481 | wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; | 3621 | wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; |
3482 | if (band_5gig) | 3622 | if (band_5gig) |
@@ -3497,7 +3637,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar) | |||
3497 | wiphy->wowlan.pattern_min_len = 1; | 3637 | wiphy->wowlan.pattern_min_len = 1; |
3498 | wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE; | 3638 | wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE; |
3499 | 3639 | ||
3500 | wiphy->max_sched_scan_ssids = MAX_PROBED_SSID_INDEX; | 3640 | wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS; |
3501 | 3641 | ||
3502 | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | | 3642 | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | |
3503 | WIPHY_FLAG_HAVE_AP_SME | | 3643 | WIPHY_FLAG_HAVE_AP_SME | |
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h index 5ea8cbb79f43..b992046a1b0e 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.h +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h | |||
@@ -62,5 +62,7 @@ void ath6kl_cfg80211_cleanup(struct ath6kl *ar); | |||
62 | 62 | ||
63 | struct ath6kl *ath6kl_cfg80211_create(void); | 63 | struct ath6kl *ath6kl_cfg80211_create(void); |
64 | void ath6kl_cfg80211_destroy(struct ath6kl *ar); | 64 | void ath6kl_cfg80211_destroy(struct ath6kl *ar); |
65 | /* TODO: remove this once ath6kl_vif_cleanup() is moved to cfg80211.c */ | ||
66 | void ath6kl_cfg80211_sta_bmiss_enhance(struct ath6kl_vif *vif, bool enable); | ||
65 | 67 | ||
66 | #endif /* ATH6KL_CFG80211_H */ | 68 | #endif /* ATH6KL_CFG80211_H */ |
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index 8443b2a4133e..d38a31de344c 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -100,6 +100,21 @@ enum ath6kl_fw_capability { | |||
100 | /* Firmware has support to override rsn cap of rsn ie */ | 100 | /* Firmware has support to override rsn cap of rsn ie */ |
101 | ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, | 101 | ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, |
102 | 102 | ||
103 | /* | ||
104 | * Multicast support in WOW and host awake mode. | ||
105 | * Allow all multicast in host awake mode. | ||
106 | * Apply multicast filter in WOW mode. | ||
107 | */ | ||
108 | ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, | ||
109 | |||
110 | /* Firmware supports enhanced bmiss detection */ | ||
111 | ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, | ||
112 | |||
113 | /* | ||
114 | * FW supports matching of ssid in schedule scan | ||
115 | */ | ||
116 | ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, | ||
117 | |||
103 | /* this needs to be last */ | 118 | /* this needs to be last */ |
104 | ATH6KL_FW_CAPABILITY_MAX, | 119 | ATH6KL_FW_CAPABILITY_MAX, |
105 | }; | 120 | }; |
@@ -112,6 +127,10 @@ struct ath6kl_fw_ie { | |||
112 | u8 data[0]; | 127 | u8 data[0]; |
113 | }; | 128 | }; |
114 | 129 | ||
130 | enum ath6kl_hw_flags { | ||
131 | ATH6KL_HW_FLAG_64BIT_RATES = BIT(0), | ||
132 | }; | ||
133 | |||
115 | #define ATH6KL_FW_API2_FILE "fw-2.bin" | 134 | #define ATH6KL_FW_API2_FILE "fw-2.bin" |
116 | #define ATH6KL_FW_API3_FILE "fw-3.bin" | 135 | #define ATH6KL_FW_API3_FILE "fw-3.bin" |
117 | 136 | ||
@@ -196,7 +215,7 @@ struct ath6kl_fw_ie { | |||
196 | 215 | ||
197 | #define AGGR_NUM_OF_FREE_NETBUFS 16 | 216 | #define AGGR_NUM_OF_FREE_NETBUFS 16 |
198 | 217 | ||
199 | #define AGGR_RX_TIMEOUT 400 /* in ms */ | 218 | #define AGGR_RX_TIMEOUT 100 /* in ms */ |
200 | 219 | ||
201 | #define WMI_TIMEOUT (2 * HZ) | 220 | #define WMI_TIMEOUT (2 * HZ) |
202 | 221 | ||
@@ -245,7 +264,6 @@ struct skb_hold_q { | |||
245 | 264 | ||
246 | struct rxtid { | 265 | struct rxtid { |
247 | bool aggr; | 266 | bool aggr; |
248 | bool progress; | ||
249 | bool timer_mon; | 267 | bool timer_mon; |
250 | u16 win_sz; | 268 | u16 win_sz; |
251 | u16 seq_next; | 269 | u16 seq_next; |
@@ -254,9 +272,15 @@ struct rxtid { | |||
254 | struct sk_buff_head q; | 272 | struct sk_buff_head q; |
255 | 273 | ||
256 | /* | 274 | /* |
257 | * FIXME: No clue what this should protect. Apparently it should | 275 | * lock mainly protects seq_next and hold_q. Movement of seq_next |
258 | * protect some of the fields above but they are also accessed | 276 | * needs to be protected between aggr_timeout() and |
259 | * without taking the lock. | 277 | * aggr_process_recv_frm(). hold_q will be holding the pending |
278 | * reorder frames and it's access should also be protected. | ||
279 | * Some of the other fields like hold_q_sz, win_sz and aggr are | ||
280 | * initialized/reset when receiving addba/delba req, also while | ||
281 | * deleting aggr state all the pending buffers are flushed before | ||
282 | * resetting these fields, so there should not be any race in accessing | ||
283 | * these fields. | ||
260 | */ | 284 | */ |
261 | spinlock_t lock; | 285 | spinlock_t lock; |
262 | }; | 286 | }; |
@@ -541,7 +565,7 @@ struct ath6kl_vif { | |||
541 | struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1]; | 565 | struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1]; |
542 | struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1]; | 566 | struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1]; |
543 | struct aggr_info *aggr_cntxt; | 567 | struct aggr_info *aggr_cntxt; |
544 | struct ath6kl_htcap htcap; | 568 | struct ath6kl_htcap htcap[IEEE80211_NUM_BANDS]; |
545 | 569 | ||
546 | struct timer_list disconnect_timer; | 570 | struct timer_list disconnect_timer; |
547 | struct timer_list sched_scan_timer; | 571 | struct timer_list sched_scan_timer; |
@@ -684,6 +708,8 @@ struct ath6kl { | |||
684 | u32 testscript_addr; | 708 | u32 testscript_addr; |
685 | enum wmi_phy_cap cap; | 709 | enum wmi_phy_cap cap; |
686 | 710 | ||
711 | u32 flags; | ||
712 | |||
687 | struct ath6kl_hw_fw { | 713 | struct ath6kl_hw_fw { |
688 | const char *dir; | 714 | const char *dir; |
689 | const char *otp; | 715 | const char *otp; |
diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c index 2798624d3a9d..cd0e1ba410d6 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c | |||
@@ -1309,7 +1309,7 @@ static int ath6kl_htc_rx_packet(struct htc_target *target, | |||
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | ath6kl_dbg(ATH6KL_DBG_HTC, | 1311 | ath6kl_dbg(ATH6KL_DBG_HTC, |
1312 | "htc rx 0x%p hdr x%x len %d mbox 0x%x\n", | 1312 | "htc rx 0x%p hdr 0x%x len %d mbox 0x%x\n", |
1313 | packet, packet->info.rx.exp_hdr, | 1313 | packet, packet->info.rx.exp_hdr, |
1314 | padded_len, dev->ar->mbox_info.htc_addr); | 1314 | padded_len, dev->ar->mbox_info.htc_addr); |
1315 | 1315 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 7eb0515f458a..f90b5db741cf 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -42,6 +42,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
42 | .reserved_ram_size = 6912, | 42 | .reserved_ram_size = 6912, |
43 | .refclk_hz = 26000000, | 43 | .refclk_hz = 26000000, |
44 | .uarttx_pin = 8, | 44 | .uarttx_pin = 8, |
45 | .flags = 0, | ||
45 | 46 | ||
46 | /* hw2.0 needs override address hardcoded */ | 47 | /* hw2.0 needs override address hardcoded */ |
47 | .app_start_override_addr = 0x944C00, | 48 | .app_start_override_addr = 0x944C00, |
@@ -67,6 +68,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
67 | .refclk_hz = 26000000, | 68 | .refclk_hz = 26000000, |
68 | .uarttx_pin = 8, | 69 | .uarttx_pin = 8, |
69 | .testscript_addr = 0x57ef74, | 70 | .testscript_addr = 0x57ef74, |
71 | .flags = 0, | ||
70 | 72 | ||
71 | .fw = { | 73 | .fw = { |
72 | .dir = AR6003_HW_2_1_1_FW_DIR, | 74 | .dir = AR6003_HW_2_1_1_FW_DIR, |
@@ -91,6 +93,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
91 | .board_addr = 0x433900, | 93 | .board_addr = 0x433900, |
92 | .refclk_hz = 26000000, | 94 | .refclk_hz = 26000000, |
93 | .uarttx_pin = 11, | 95 | .uarttx_pin = 11, |
96 | .flags = ATH6KL_HW_FLAG_64BIT_RATES, | ||
94 | 97 | ||
95 | .fw = { | 98 | .fw = { |
96 | .dir = AR6004_HW_1_0_FW_DIR, | 99 | .dir = AR6004_HW_1_0_FW_DIR, |
@@ -110,6 +113,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
110 | .board_addr = 0x43d400, | 113 | .board_addr = 0x43d400, |
111 | .refclk_hz = 40000000, | 114 | .refclk_hz = 40000000, |
112 | .uarttx_pin = 11, | 115 | .uarttx_pin = 11, |
116 | .flags = ATH6KL_HW_FLAG_64BIT_RATES, | ||
113 | 117 | ||
114 | .fw = { | 118 | .fw = { |
115 | .dir = AR6004_HW_1_1_FW_DIR, | 119 | .dir = AR6004_HW_1_1_FW_DIR, |
@@ -129,6 +133,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
129 | .board_addr = 0x435c00, | 133 | .board_addr = 0x435c00, |
130 | .refclk_hz = 40000000, | 134 | .refclk_hz = 40000000, |
131 | .uarttx_pin = 11, | 135 | .uarttx_pin = 11, |
136 | .flags = ATH6KL_HW_FLAG_64BIT_RATES, | ||
132 | 137 | ||
133 | .fw = { | 138 | .fw = { |
134 | .dir = AR6004_HW_1_2_FW_DIR, | 139 | .dir = AR6004_HW_1_2_FW_DIR, |
@@ -938,6 +943,14 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) | |||
938 | } | 943 | } |
939 | 944 | ||
940 | switch (ie_id) { | 945 | switch (ie_id) { |
946 | case ATH6KL_FW_IE_FW_VERSION: | ||
947 | strlcpy(ar->wiphy->fw_version, data, | ||
948 | sizeof(ar->wiphy->fw_version)); | ||
949 | |||
950 | ath6kl_dbg(ATH6KL_DBG_BOOT, | ||
951 | "found fw version %s\n", | ||
952 | ar->wiphy->fw_version); | ||
953 | break; | ||
941 | case ATH6KL_FW_IE_OTP_IMAGE: | 954 | case ATH6KL_FW_IE_OTP_IMAGE: |
942 | ath6kl_dbg(ATH6KL_DBG_BOOT, "found otp image ie (%zd B)\n", | 955 | ath6kl_dbg(ATH6KL_DBG_BOOT, "found otp image ie (%zd B)\n", |
943 | ie_len); | 956 | ie_len); |
@@ -991,9 +1004,6 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) | |||
991 | ar->hw.reserved_ram_size); | 1004 | ar->hw.reserved_ram_size); |
992 | break; | 1005 | break; |
993 | case ATH6KL_FW_IE_CAPABILITIES: | 1006 | case ATH6KL_FW_IE_CAPABILITIES: |
994 | if (ie_len < DIV_ROUND_UP(ATH6KL_FW_CAPABILITY_MAX, 8)) | ||
995 | break; | ||
996 | |||
997 | ath6kl_dbg(ATH6KL_DBG_BOOT, | 1007 | ath6kl_dbg(ATH6KL_DBG_BOOT, |
998 | "found firmware capabilities ie (%zd B)\n", | 1008 | "found firmware capabilities ie (%zd B)\n", |
999 | ie_len); | 1009 | ie_len); |
@@ -1002,6 +1012,9 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) | |||
1002 | index = i / 8; | 1012 | index = i / 8; |
1003 | bit = i % 8; | 1013 | bit = i % 8; |
1004 | 1014 | ||
1015 | if (index == ie_len) | ||
1016 | break; | ||
1017 | |||
1005 | if (data[index] & (1 << bit)) | 1018 | if (data[index] & (1 << bit)) |
1006 | __set_bit(i, ar->fw_capabilities); | 1019 | __set_bit(i, ar->fw_capabilities); |
1007 | } | 1020 | } |
@@ -1392,6 +1405,12 @@ static int ath6kl_init_upload(struct ath6kl *ar) | |||
1392 | ar->version.target_ver == AR6003_HW_2_1_1_VERSION) { | 1405 | ar->version.target_ver == AR6003_HW_2_1_1_VERSION) { |
1393 | ath6kl_err("temporary war to avoid sdio crc error\n"); | 1406 | ath6kl_err("temporary war to avoid sdio crc error\n"); |
1394 | 1407 | ||
1408 | param = 0x28; | ||
1409 | address = GPIO_BASE_ADDRESS + GPIO_PIN9_ADDRESS; | ||
1410 | status = ath6kl_bmi_reg_write(ar, address, param); | ||
1411 | if (status) | ||
1412 | return status; | ||
1413 | |||
1395 | param = 0x20; | 1414 | param = 0x20; |
1396 | 1415 | ||
1397 | address = GPIO_BASE_ADDRESS + GPIO_PIN10_ADDRESS; | 1416 | address = GPIO_BASE_ADDRESS + GPIO_PIN10_ADDRESS; |
@@ -1659,6 +1678,9 @@ void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready) | |||
1659 | cfg80211_scan_done(vif->scan_req, true); | 1678 | cfg80211_scan_done(vif->scan_req, true); |
1660 | vif->scan_req = NULL; | 1679 | vif->scan_req = NULL; |
1661 | } | 1680 | } |
1681 | |||
1682 | /* need to clean up enhanced bmiss detection fw state */ | ||
1683 | ath6kl_cfg80211_sta_bmiss_enhance(vif, false); | ||
1662 | } | 1684 | } |
1663 | 1685 | ||
1664 | void ath6kl_stop_txrx(struct ath6kl *ar) | 1686 | void ath6kl_stop_txrx(struct ath6kl *ar) |
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index b836f2795114..c189e28e86a9 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c | |||
@@ -554,20 +554,24 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver, | |||
554 | struct ath6kl *ar = devt; | 554 | struct ath6kl *ar = devt; |
555 | 555 | ||
556 | memcpy(ar->mac_addr, datap, ETH_ALEN); | 556 | memcpy(ar->mac_addr, datap, ETH_ALEN); |
557 | ath6kl_dbg(ATH6KL_DBG_TRC, "%s: mac addr = %pM\n", | 557 | |
558 | __func__, ar->mac_addr); | 558 | ath6kl_dbg(ATH6KL_DBG_BOOT, |
559 | "ready event mac addr %pM sw_ver 0x%x abi_ver 0x%x cap 0x%x\n", | ||
560 | ar->mac_addr, sw_ver, abi_ver, cap); | ||
559 | 561 | ||
560 | ar->version.wlan_ver = sw_ver; | 562 | ar->version.wlan_ver = sw_ver; |
561 | ar->version.abi_ver = abi_ver; | 563 | ar->version.abi_ver = abi_ver; |
562 | ar->hw.cap = cap; | 564 | ar->hw.cap = cap; |
563 | 565 | ||
564 | snprintf(ar->wiphy->fw_version, | 566 | if (strlen(ar->wiphy->fw_version) == 0) { |
565 | sizeof(ar->wiphy->fw_version), | 567 | snprintf(ar->wiphy->fw_version, |
566 | "%u.%u.%u.%u", | 568 | sizeof(ar->wiphy->fw_version), |
567 | (ar->version.wlan_ver & 0xf0000000) >> 28, | 569 | "%u.%u.%u.%u", |
568 | (ar->version.wlan_ver & 0x0f000000) >> 24, | 570 | (ar->version.wlan_ver & 0xf0000000) >> 28, |
569 | (ar->version.wlan_ver & 0x00ff0000) >> 16, | 571 | (ar->version.wlan_ver & 0x0f000000) >> 24, |
570 | (ar->version.wlan_ver & 0x0000ffff)); | 572 | (ar->version.wlan_ver & 0x00ff0000) >> 16, |
573 | (ar->version.wlan_ver & 0x0000ffff)); | ||
574 | } | ||
571 | 575 | ||
572 | /* indicate to the waiting thread that the ready event was received */ | 576 | /* indicate to the waiting thread that the ready event was received */ |
573 | set_bit(WMI_READY, &ar->flag); | 577 | set_bit(WMI_READY, &ar->flag); |
@@ -1166,7 +1170,10 @@ static void ath6kl_set_multicast_list(struct net_device *ndev) | |||
1166 | else | 1170 | else |
1167 | clear_bit(NETDEV_MCAST_ALL_ON, &vif->flags); | 1171 | clear_bit(NETDEV_MCAST_ALL_ON, &vif->flags); |
1168 | 1172 | ||
1169 | mc_all_on = mc_all_on || (vif->ar->state == ATH6KL_STATE_ON); | 1173 | if (test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, |
1174 | vif->ar->fw_capabilities)) { | ||
1175 | mc_all_on = mc_all_on || (vif->ar->state == ATH6KL_STATE_ON); | ||
1176 | } | ||
1170 | 1177 | ||
1171 | if (!(ndev->flags & IFF_MULTICAST)) { | 1178 | if (!(ndev->flags & IFF_MULTICAST)) { |
1172 | mc_all_on = false; | 1179 | mc_all_on = false; |
diff --git a/drivers/net/wireless/ath/ath6kl/target.h b/drivers/net/wireless/ath/ath6kl/target.h index 78e0ef4567a5..a98c12ba70c1 100644 --- a/drivers/net/wireless/ath/ath6kl/target.h +++ b/drivers/net/wireless/ath/ath6kl/target.h | |||
@@ -45,6 +45,7 @@ | |||
45 | #define LPO_CAL_ENABLE_S 20 | 45 | #define LPO_CAL_ENABLE_S 20 |
46 | #define LPO_CAL_ENABLE 0x00100000 | 46 | #define LPO_CAL_ENABLE 0x00100000 |
47 | 47 | ||
48 | #define GPIO_PIN9_ADDRESS 0x0000004c | ||
48 | #define GPIO_PIN10_ADDRESS 0x00000050 | 49 | #define GPIO_PIN10_ADDRESS 0x00000050 |
49 | #define GPIO_PIN11_ADDRESS 0x00000054 | 50 | #define GPIO_PIN11_ADDRESS 0x00000054 |
50 | #define GPIO_PIN12_ADDRESS 0x00000058 | 51 | #define GPIO_PIN12_ADDRESS 0x00000058 |
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index 67206aedea6c..7dfa0fd86d7b 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c | |||
@@ -1036,6 +1036,7 @@ static void aggr_deque_frms(struct aggr_info_conn *agg_conn, u8 tid, | |||
1036 | rxtid = &agg_conn->rx_tid[tid]; | 1036 | rxtid = &agg_conn->rx_tid[tid]; |
1037 | stats = &agg_conn->stat[tid]; | 1037 | stats = &agg_conn->stat[tid]; |
1038 | 1038 | ||
1039 | spin_lock_bh(&rxtid->lock); | ||
1039 | idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); | 1040 | idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); |
1040 | 1041 | ||
1041 | /* | 1042 | /* |
@@ -1054,8 +1055,6 @@ static void aggr_deque_frms(struct aggr_info_conn *agg_conn, u8 tid, | |||
1054 | seq_end = seq_no ? seq_no : rxtid->seq_next; | 1055 | seq_end = seq_no ? seq_no : rxtid->seq_next; |
1055 | idx_end = AGGR_WIN_IDX(seq_end, rxtid->hold_q_sz); | 1056 | idx_end = AGGR_WIN_IDX(seq_end, rxtid->hold_q_sz); |
1056 | 1057 | ||
1057 | spin_lock_bh(&rxtid->lock); | ||
1058 | |||
1059 | do { | 1058 | do { |
1060 | node = &rxtid->hold_q[idx]; | 1059 | node = &rxtid->hold_q[idx]; |
1061 | if ((order == 1) && (!node->skb)) | 1060 | if ((order == 1) && (!node->skb)) |
@@ -1127,11 +1126,13 @@ static bool aggr_process_recv_frm(struct aggr_info_conn *agg_conn, u8 tid, | |||
1127 | ((end > extended_end) && (cur > extended_end) && | 1126 | ((end > extended_end) && (cur > extended_end) && |
1128 | (cur < end))) { | 1127 | (cur < end))) { |
1129 | aggr_deque_frms(agg_conn, tid, 0, 0); | 1128 | aggr_deque_frms(agg_conn, tid, 0, 0); |
1129 | spin_lock_bh(&rxtid->lock); | ||
1130 | if (cur >= rxtid->hold_q_sz - 1) | 1130 | if (cur >= rxtid->hold_q_sz - 1) |
1131 | rxtid->seq_next = cur - (rxtid->hold_q_sz - 1); | 1131 | rxtid->seq_next = cur - (rxtid->hold_q_sz - 1); |
1132 | else | 1132 | else |
1133 | rxtid->seq_next = ATH6KL_MAX_SEQ_NO - | 1133 | rxtid->seq_next = ATH6KL_MAX_SEQ_NO - |
1134 | (rxtid->hold_q_sz - 2 - cur); | 1134 | (rxtid->hold_q_sz - 2 - cur); |
1135 | spin_unlock_bh(&rxtid->lock); | ||
1135 | } else { | 1136 | } else { |
1136 | /* | 1137 | /* |
1137 | * Dequeue only those frames that are outside the | 1138 | * Dequeue only those frames that are outside the |
@@ -1185,25 +1186,25 @@ static bool aggr_process_recv_frm(struct aggr_info_conn *agg_conn, u8 tid, | |||
1185 | aggr_deque_frms(agg_conn, tid, 0, 1); | 1186 | aggr_deque_frms(agg_conn, tid, 0, 1); |
1186 | 1187 | ||
1187 | if (agg_conn->timer_scheduled) | 1188 | if (agg_conn->timer_scheduled) |
1188 | rxtid->progress = true; | 1189 | return is_queued; |
1189 | else | 1190 | |
1190 | for (idx = 0 ; idx < rxtid->hold_q_sz; idx++) { | 1191 | spin_lock_bh(&rxtid->lock); |
1191 | if (rxtid->hold_q[idx].skb) { | 1192 | for (idx = 0 ; idx < rxtid->hold_q_sz; idx++) { |
1192 | /* | 1193 | if (rxtid->hold_q[idx].skb) { |
1193 | * There is a frame in the queue and no | 1194 | /* |
1194 | * timer so start a timer to ensure that | 1195 | * There is a frame in the queue and no |
1195 | * the frame doesn't remain stuck | 1196 | * timer so start a timer to ensure that |
1196 | * forever. | 1197 | * the frame doesn't remain stuck |
1197 | */ | 1198 | * forever. |
1198 | agg_conn->timer_scheduled = true; | 1199 | */ |
1199 | mod_timer(&agg_conn->timer, | 1200 | agg_conn->timer_scheduled = true; |
1200 | (jiffies + | 1201 | mod_timer(&agg_conn->timer, |
1201 | HZ * (AGGR_RX_TIMEOUT) / 1000)); | 1202 | (jiffies + (HZ * AGGR_RX_TIMEOUT) / 1000)); |
1202 | rxtid->progress = false; | 1203 | rxtid->timer_mon = true; |
1203 | rxtid->timer_mon = true; | 1204 | break; |
1204 | break; | ||
1205 | } | ||
1206 | } | 1205 | } |
1206 | } | ||
1207 | spin_unlock_bh(&rxtid->lock); | ||
1207 | 1208 | ||
1208 | return is_queued; | 1209 | return is_queued; |
1209 | } | 1210 | } |
@@ -1608,7 +1609,7 @@ static void aggr_timeout(unsigned long arg) | |||
1608 | rxtid = &aggr_conn->rx_tid[i]; | 1609 | rxtid = &aggr_conn->rx_tid[i]; |
1609 | stats = &aggr_conn->stat[i]; | 1610 | stats = &aggr_conn->stat[i]; |
1610 | 1611 | ||
1611 | if (!rxtid->aggr || !rxtid->timer_mon || rxtid->progress) | 1612 | if (!rxtid->aggr || !rxtid->timer_mon) |
1612 | continue; | 1613 | continue; |
1613 | 1614 | ||
1614 | stats->num_timeouts++; | 1615 | stats->num_timeouts++; |
@@ -1626,14 +1627,15 @@ static void aggr_timeout(unsigned long arg) | |||
1626 | rxtid = &aggr_conn->rx_tid[i]; | 1627 | rxtid = &aggr_conn->rx_tid[i]; |
1627 | 1628 | ||
1628 | if (rxtid->aggr && rxtid->hold_q) { | 1629 | if (rxtid->aggr && rxtid->hold_q) { |
1630 | spin_lock_bh(&rxtid->lock); | ||
1629 | for (j = 0; j < rxtid->hold_q_sz; j++) { | 1631 | for (j = 0; j < rxtid->hold_q_sz; j++) { |
1630 | if (rxtid->hold_q[j].skb) { | 1632 | if (rxtid->hold_q[j].skb) { |
1631 | aggr_conn->timer_scheduled = true; | 1633 | aggr_conn->timer_scheduled = true; |
1632 | rxtid->timer_mon = true; | 1634 | rxtid->timer_mon = true; |
1633 | rxtid->progress = false; | ||
1634 | break; | 1635 | break; |
1635 | } | 1636 | } |
1636 | } | 1637 | } |
1638 | spin_unlock_bh(&rxtid->lock); | ||
1637 | 1639 | ||
1638 | if (j >= rxtid->hold_q_sz) | 1640 | if (j >= rxtid->hold_q_sz) |
1639 | rxtid->timer_mon = false; | 1641 | rxtid->timer_mon = false; |
@@ -1660,7 +1662,6 @@ static void aggr_delete_tid_state(struct aggr_info_conn *aggr_conn, u8 tid) | |||
1660 | aggr_deque_frms(aggr_conn, tid, 0, 0); | 1662 | aggr_deque_frms(aggr_conn, tid, 0, 0); |
1661 | 1663 | ||
1662 | rxtid->aggr = false; | 1664 | rxtid->aggr = false; |
1663 | rxtid->progress = false; | ||
1664 | rxtid->timer_mon = false; | 1665 | rxtid->timer_mon = false; |
1665 | rxtid->win_sz = 0; | 1666 | rxtid->win_sz = 0; |
1666 | rxtid->seq_next = 0; | 1667 | rxtid->seq_next = 0; |
@@ -1739,7 +1740,6 @@ void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info, | |||
1739 | for (i = 0; i < NUM_OF_TIDS; i++) { | 1740 | for (i = 0; i < NUM_OF_TIDS; i++) { |
1740 | rxtid = &aggr_conn->rx_tid[i]; | 1741 | rxtid = &aggr_conn->rx_tid[i]; |
1741 | rxtid->aggr = false; | 1742 | rxtid->aggr = false; |
1742 | rxtid->progress = false; | ||
1743 | rxtid->timer_mon = false; | 1743 | rxtid->timer_mon = false; |
1744 | skb_queue_head_init(&rxtid->q); | 1744 | skb_queue_head_init(&rxtid->q); |
1745 | spin_lock_init(&rxtid->lock); | 1745 | spin_lock_init(&rxtid->lock); |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index ee8ec2394c2c..a6caa673e8ad 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -743,7 +743,6 @@ int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid) | |||
743 | return -ENOMEM; | 743 | return -ENOMEM; |
744 | 744 | ||
745 | cmd = (struct roam_ctrl_cmd *) skb->data; | 745 | cmd = (struct roam_ctrl_cmd *) skb->data; |
746 | memset(cmd, 0, sizeof(*cmd)); | ||
747 | 746 | ||
748 | memcpy(cmd->info.bssid, bssid, ETH_ALEN); | 747 | memcpy(cmd->info.bssid, bssid, ETH_ALEN); |
749 | cmd->roam_ctrl = WMI_FORCE_ROAM; | 748 | cmd->roam_ctrl = WMI_FORCE_ROAM; |
@@ -753,6 +752,22 @@ int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid) | |||
753 | NO_SYNC_WMIFLAG); | 752 | NO_SYNC_WMIFLAG); |
754 | } | 753 | } |
755 | 754 | ||
755 | int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period) | ||
756 | { | ||
757 | struct sk_buff *skb; | ||
758 | struct set_dtim_cmd *cmd; | ||
759 | |||
760 | skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); | ||
761 | if (!skb) | ||
762 | return -ENOMEM; | ||
763 | |||
764 | cmd = (struct set_dtim_cmd *) skb->data; | ||
765 | |||
766 | cmd->dtim_period = cpu_to_le32(dtim_period); | ||
767 | return ath6kl_wmi_cmd_send(wmi, if_idx, skb, | ||
768 | WMI_AP_SET_DTIM_CMDID, NO_SYNC_WMIFLAG); | ||
769 | } | ||
770 | |||
756 | int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode) | 771 | int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode) |
757 | { | 772 | { |
758 | struct sk_buff *skb; | 773 | struct sk_buff *skb; |
@@ -763,7 +778,6 @@ int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode) | |||
763 | return -ENOMEM; | 778 | return -ENOMEM; |
764 | 779 | ||
765 | cmd = (struct roam_ctrl_cmd *) skb->data; | 780 | cmd = (struct roam_ctrl_cmd *) skb->data; |
766 | memset(cmd, 0, sizeof(*cmd)); | ||
767 | 781 | ||
768 | cmd->info.roam_mode = mode; | 782 | cmd->info.roam_mode = mode; |
769 | cmd->roam_ctrl = WMI_SET_ROAM_MODE; | 783 | cmd->roam_ctrl = WMI_SET_ROAM_MODE; |
@@ -1995,7 +2009,7 @@ int ath6kl_wmi_probedssid_cmd(struct wmi *wmi, u8 if_idx, u8 index, u8 flag, | |||
1995 | struct wmi_probed_ssid_cmd *cmd; | 2009 | struct wmi_probed_ssid_cmd *cmd; |
1996 | int ret; | 2010 | int ret; |
1997 | 2011 | ||
1998 | if (index > MAX_PROBED_SSID_INDEX) | 2012 | if (index >= MAX_PROBED_SSIDS) |
1999 | return -EINVAL; | 2013 | return -EINVAL; |
2000 | 2014 | ||
2001 | if (ssid_len > sizeof(cmd->ssid)) | 2015 | if (ssid_len > sizeof(cmd->ssid)) |
@@ -2599,6 +2613,115 @@ static void ath6kl_wmi_relinquish_implicit_pstream_credits(struct wmi *wmi) | |||
2599 | spin_unlock_bh(&wmi->lock); | 2613 | spin_unlock_bh(&wmi->lock); |
2600 | } | 2614 | } |
2601 | 2615 | ||
2616 | static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx, | ||
2617 | const struct cfg80211_bitrate_mask *mask) | ||
2618 | { | ||
2619 | struct sk_buff *skb; | ||
2620 | int ret, mode, band; | ||
2621 | u64 mcsrate, ratemask[IEEE80211_NUM_BANDS]; | ||
2622 | struct wmi_set_tx_select_rates64_cmd *cmd; | ||
2623 | |||
2624 | memset(&ratemask, 0, sizeof(ratemask)); | ||
2625 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
2626 | /* copy legacy rate mask */ | ||
2627 | ratemask[band] = mask->control[band].legacy; | ||
2628 | if (band == IEEE80211_BAND_5GHZ) | ||
2629 | ratemask[band] = | ||
2630 | mask->control[band].legacy << 4; | ||
2631 | |||
2632 | /* copy mcs rate mask */ | ||
2633 | mcsrate = mask->control[band].mcs[1]; | ||
2634 | mcsrate <<= 8; | ||
2635 | mcsrate |= mask->control[band].mcs[0]; | ||
2636 | ratemask[band] |= mcsrate << 12; | ||
2637 | ratemask[band] |= mcsrate << 28; | ||
2638 | } | ||
2639 | |||
2640 | ath6kl_dbg(ATH6KL_DBG_WMI, | ||
2641 | "Ratemask 64 bit: 2.4:%llx 5:%llx\n", | ||
2642 | ratemask[0], ratemask[1]); | ||
2643 | |||
2644 | skb = ath6kl_wmi_get_new_buf(sizeof(*cmd) * WMI_RATES_MODE_MAX); | ||
2645 | if (!skb) | ||
2646 | return -ENOMEM; | ||
2647 | |||
2648 | cmd = (struct wmi_set_tx_select_rates64_cmd *) skb->data; | ||
2649 | for (mode = 0; mode < WMI_RATES_MODE_MAX; mode++) { | ||
2650 | /* A mode operate in 5GHZ band */ | ||
2651 | if (mode == WMI_RATES_MODE_11A || | ||
2652 | mode == WMI_RATES_MODE_11A_HT20 || | ||
2653 | mode == WMI_RATES_MODE_11A_HT40) | ||
2654 | band = IEEE80211_BAND_5GHZ; | ||
2655 | else | ||
2656 | band = IEEE80211_BAND_2GHZ; | ||
2657 | cmd->ratemask[mode] = cpu_to_le64(ratemask[band]); | ||
2658 | } | ||
2659 | |||
2660 | ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, | ||
2661 | WMI_SET_TX_SELECT_RATES_CMDID, | ||
2662 | NO_SYNC_WMIFLAG); | ||
2663 | return ret; | ||
2664 | } | ||
2665 | |||
2666 | static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx, | ||
2667 | const struct cfg80211_bitrate_mask *mask) | ||
2668 | { | ||
2669 | struct sk_buff *skb; | ||
2670 | int ret, mode, band; | ||
2671 | u32 mcsrate, ratemask[IEEE80211_NUM_BANDS]; | ||
2672 | struct wmi_set_tx_select_rates32_cmd *cmd; | ||
2673 | |||
2674 | memset(&ratemask, 0, sizeof(ratemask)); | ||
2675 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
2676 | /* copy legacy rate mask */ | ||
2677 | ratemask[band] = mask->control[band].legacy; | ||
2678 | if (band == IEEE80211_BAND_5GHZ) | ||
2679 | ratemask[band] = | ||
2680 | mask->control[band].legacy << 4; | ||
2681 | |||
2682 | /* copy mcs rate mask */ | ||
2683 | mcsrate = mask->control[band].mcs[0]; | ||
2684 | ratemask[band] |= mcsrate << 12; | ||
2685 | ratemask[band] |= mcsrate << 20; | ||
2686 | } | ||
2687 | |||
2688 | ath6kl_dbg(ATH6KL_DBG_WMI, | ||
2689 | "Ratemask 32 bit: 2.4:%x 5:%x\n", | ||
2690 | ratemask[0], ratemask[1]); | ||
2691 | |||
2692 | skb = ath6kl_wmi_get_new_buf(sizeof(*cmd) * WMI_RATES_MODE_MAX); | ||
2693 | if (!skb) | ||
2694 | return -ENOMEM; | ||
2695 | |||
2696 | cmd = (struct wmi_set_tx_select_rates32_cmd *) skb->data; | ||
2697 | for (mode = 0; mode < WMI_RATES_MODE_MAX; mode++) { | ||
2698 | /* A mode operate in 5GHZ band */ | ||
2699 | if (mode == WMI_RATES_MODE_11A || | ||
2700 | mode == WMI_RATES_MODE_11A_HT20 || | ||
2701 | mode == WMI_RATES_MODE_11A_HT40) | ||
2702 | band = IEEE80211_BAND_5GHZ; | ||
2703 | else | ||
2704 | band = IEEE80211_BAND_2GHZ; | ||
2705 | cmd->ratemask[mode] = cpu_to_le32(ratemask[band]); | ||
2706 | } | ||
2707 | |||
2708 | ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, | ||
2709 | WMI_SET_TX_SELECT_RATES_CMDID, | ||
2710 | NO_SYNC_WMIFLAG); | ||
2711 | return ret; | ||
2712 | } | ||
2713 | |||
2714 | int ath6kl_wmi_set_bitrate_mask(struct wmi *wmi, u8 if_idx, | ||
2715 | const struct cfg80211_bitrate_mask *mask) | ||
2716 | { | ||
2717 | struct ath6kl *ar = wmi->parent_dev; | ||
2718 | |||
2719 | if (ar->hw.flags & ATH6KL_HW_FLAG_64BIT_RATES) | ||
2720 | return ath6kl_set_bitrate_mask64(wmi, if_idx, mask); | ||
2721 | else | ||
2722 | return ath6kl_set_bitrate_mask32(wmi, if_idx, mask); | ||
2723 | } | ||
2724 | |||
2602 | int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, | 2725 | int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, |
2603 | enum ath6kl_host_mode host_mode) | 2726 | enum ath6kl_host_mode host_mode) |
2604 | { | 2727 | { |
@@ -2997,6 +3120,25 @@ int ath6kl_wmi_add_del_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, | |||
2997 | return ret; | 3120 | return ret; |
2998 | } | 3121 | } |
2999 | 3122 | ||
3123 | int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enhance) | ||
3124 | { | ||
3125 | struct sk_buff *skb; | ||
3126 | struct wmi_sta_bmiss_enhance_cmd *cmd; | ||
3127 | int ret; | ||
3128 | |||
3129 | skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); | ||
3130 | if (!skb) | ||
3131 | return -ENOMEM; | ||
3132 | |||
3133 | cmd = (struct wmi_sta_bmiss_enhance_cmd *) skb->data; | ||
3134 | cmd->enable = enhance ? 1 : 0; | ||
3135 | |||
3136 | ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, | ||
3137 | WMI_STA_BMISS_ENHANCE_CMDID, | ||
3138 | NO_SYNC_WMIFLAG); | ||
3139 | return ret; | ||
3140 | } | ||
3141 | |||
3000 | s32 ath6kl_wmi_get_rate(s8 rate_index) | 3142 | s32 ath6kl_wmi_get_rate(s8 rate_index) |
3001 | { | 3143 | { |
3002 | if (rate_index == RATE_AUTO) | 3144 | if (rate_index == RATE_AUTO) |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h index 9076bec3a2ba..43339aca585d 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ b/drivers/net/wireless/ath/ath6kl/wmi.h | |||
@@ -624,6 +624,10 @@ enum wmi_cmd_id { | |||
624 | WMI_SEND_MGMT_CMDID, | 624 | WMI_SEND_MGMT_CMDID, |
625 | WMI_BEGIN_SCAN_CMDID, | 625 | WMI_BEGIN_SCAN_CMDID, |
626 | 626 | ||
627 | WMI_SET_BLACK_LIST, | ||
628 | WMI_SET_MCASTRATE, | ||
629 | |||
630 | WMI_STA_BMISS_ENHANCE_CMDID, | ||
627 | }; | 631 | }; |
628 | 632 | ||
629 | enum wmi_mgmt_frame_type { | 633 | enum wmi_mgmt_frame_type { |
@@ -960,6 +964,9 @@ enum wmi_bss_filter { | |||
960 | /* beacons matching probed ssid */ | 964 | /* beacons matching probed ssid */ |
961 | PROBED_SSID_FILTER, | 965 | PROBED_SSID_FILTER, |
962 | 966 | ||
967 | /* beacons matching matched ssid */ | ||
968 | MATCHED_SSID_FILTER, | ||
969 | |||
963 | /* marker only */ | 970 | /* marker only */ |
964 | LAST_BSS_FILTER, | 971 | LAST_BSS_FILTER, |
965 | }; | 972 | }; |
@@ -978,7 +985,7 @@ struct wmi_bss_filter_cmd { | |||
978 | } __packed; | 985 | } __packed; |
979 | 986 | ||
980 | /* WMI_SET_PROBED_SSID_CMDID */ | 987 | /* WMI_SET_PROBED_SSID_CMDID */ |
981 | #define MAX_PROBED_SSID_INDEX 9 | 988 | #define MAX_PROBED_SSIDS 16 |
982 | 989 | ||
983 | enum wmi_ssid_flag { | 990 | enum wmi_ssid_flag { |
984 | /* disables entry */ | 991 | /* disables entry */ |
@@ -989,10 +996,13 @@ enum wmi_ssid_flag { | |||
989 | 996 | ||
990 | /* probes for any ssid */ | 997 | /* probes for any ssid */ |
991 | ANY_SSID_FLAG = 0x02, | 998 | ANY_SSID_FLAG = 0x02, |
999 | |||
1000 | /* match for ssid */ | ||
1001 | MATCH_SSID_FLAG = 0x08, | ||
992 | }; | 1002 | }; |
993 | 1003 | ||
994 | struct wmi_probed_ssid_cmd { | 1004 | struct wmi_probed_ssid_cmd { |
995 | /* 0 to MAX_PROBED_SSID_INDEX */ | 1005 | /* 0 to MAX_PROBED_SSIDS - 1 */ |
996 | u8 entry_index; | 1006 | u8 entry_index; |
997 | 1007 | ||
998 | /* see, enum wmi_ssid_flg */ | 1008 | /* see, enum wmi_ssid_flg */ |
@@ -1017,6 +1027,11 @@ struct wmi_bmiss_time_cmd { | |||
1017 | __le16 num_beacons; | 1027 | __le16 num_beacons; |
1018 | }; | 1028 | }; |
1019 | 1029 | ||
1030 | /* WMI_STA_ENHANCE_BMISS_CMDID */ | ||
1031 | struct wmi_sta_bmiss_enhance_cmd { | ||
1032 | u8 enable; | ||
1033 | } __packed; | ||
1034 | |||
1020 | /* WMI_SET_POWER_MODE_CMDID */ | 1035 | /* WMI_SET_POWER_MODE_CMDID */ |
1021 | enum wmi_power_mode { | 1036 | enum wmi_power_mode { |
1022 | REC_POWER = 0x01, | 1037 | REC_POWER = 0x01, |
@@ -1048,6 +1063,36 @@ struct wmi_power_params_cmd { | |||
1048 | __le16 ps_fail_event_policy; | 1063 | __le16 ps_fail_event_policy; |
1049 | } __packed; | 1064 | } __packed; |
1050 | 1065 | ||
1066 | /* | ||
1067 | * Ratemask for below modes should be passed | ||
1068 | * to WMI_SET_TX_SELECT_RATES_CMDID. | ||
1069 | * AR6003 has 32 bit mask for each modes. | ||
1070 | * First 12 bits for legacy rates, 13 to 20 | ||
1071 | * bits for HT 20 rates and 21 to 28 bits for | ||
1072 | * HT 40 rates | ||
1073 | */ | ||
1074 | enum wmi_mode_phy { | ||
1075 | WMI_RATES_MODE_11A = 0, | ||
1076 | WMI_RATES_MODE_11G, | ||
1077 | WMI_RATES_MODE_11B, | ||
1078 | WMI_RATES_MODE_11GONLY, | ||
1079 | WMI_RATES_MODE_11A_HT20, | ||
1080 | WMI_RATES_MODE_11G_HT20, | ||
1081 | WMI_RATES_MODE_11A_HT40, | ||
1082 | WMI_RATES_MODE_11G_HT40, | ||
1083 | WMI_RATES_MODE_MAX | ||
1084 | }; | ||
1085 | |||
1086 | /* WMI_SET_TX_SELECT_RATES_CMDID */ | ||
1087 | struct wmi_set_tx_select_rates32_cmd { | ||
1088 | __le32 ratemask[WMI_RATES_MODE_MAX]; | ||
1089 | } __packed; | ||
1090 | |||
1091 | /* WMI_SET_TX_SELECT_RATES_CMDID */ | ||
1092 | struct wmi_set_tx_select_rates64_cmd { | ||
1093 | __le64 ratemask[WMI_RATES_MODE_MAX]; | ||
1094 | } __packed; | ||
1095 | |||
1051 | /* WMI_SET_DISC_TIMEOUT_CMDID */ | 1096 | /* WMI_SET_DISC_TIMEOUT_CMDID */ |
1052 | struct wmi_disc_timeout_cmd { | 1097 | struct wmi_disc_timeout_cmd { |
1053 | /* seconds */ | 1098 | /* seconds */ |
@@ -1572,6 +1617,10 @@ struct roam_ctrl_cmd { | |||
1572 | u8 roam_ctrl; | 1617 | u8 roam_ctrl; |
1573 | } __packed; | 1618 | } __packed; |
1574 | 1619 | ||
1620 | struct set_dtim_cmd { | ||
1621 | __le32 dtim_period; | ||
1622 | } __packed; | ||
1623 | |||
1575 | /* BSS INFO HDR version 2.0 */ | 1624 | /* BSS INFO HDR version 2.0 */ |
1576 | struct wmi_bss_info_hdr2 { | 1625 | struct wmi_bss_info_hdr2 { |
1577 | __le16 ch; /* frequency in MHz */ | 1626 | __le16 ch; /* frequency in MHz */ |
@@ -2532,6 +2581,8 @@ int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx, | |||
2532 | __be32 ips0, __be32 ips1); | 2581 | __be32 ips0, __be32 ips1); |
2533 | int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, | 2582 | int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, |
2534 | enum ath6kl_host_mode host_mode); | 2583 | enum ath6kl_host_mode host_mode); |
2584 | int ath6kl_wmi_set_bitrate_mask(struct wmi *wmi, u8 if_idx, | ||
2585 | const struct cfg80211_bitrate_mask *mask); | ||
2535 | int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx, | 2586 | int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx, |
2536 | enum ath6kl_wow_mode wow_mode, | 2587 | enum ath6kl_wow_mode wow_mode, |
2537 | u32 filter, u16 host_req_delay); | 2588 | u32 filter, u16 host_req_delay); |
@@ -2542,11 +2593,14 @@ int ath6kl_wmi_add_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, | |||
2542 | int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, | 2593 | int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, |
2543 | u16 list_id, u16 filter_id); | 2594 | u16 list_id, u16 filter_id); |
2544 | int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi); | 2595 | int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi); |
2596 | int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period); | ||
2545 | int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid); | 2597 | int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid); |
2546 | int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode); | 2598 | int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode); |
2547 | int ath6kl_wmi_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, bool mc_all_on); | 2599 | int ath6kl_wmi_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, bool mc_all_on); |
2548 | int ath6kl_wmi_add_del_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, | 2600 | int ath6kl_wmi_add_del_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, |
2549 | u8 *filter, bool add_filter); | 2601 | u8 *filter, bool add_filter); |
2602 | int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enable); | ||
2603 | |||
2550 | /* AP mode uAPSD */ | 2604 | /* AP mode uAPSD */ |
2551 | int ath6kl_wmi_ap_set_apsd(struct wmi *wmi, u8 if_idx, u8 enable); | 2605 | int ath6kl_wmi_ap_set_apsd(struct wmi *wmi, u8 if_idx, u8 enable); |
2552 | 2606 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index b4c77f9d7470..ff007f500feb 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -104,11 +104,6 @@ static const struct ani_cck_level_entry cck_level_table[] = { | |||
104 | #define ATH9K_ANI_CCK_DEF_LEVEL \ | 104 | #define ATH9K_ANI_CCK_DEF_LEVEL \ |
105 | 2 /* default level - matches the INI settings */ | 105 | 2 /* default level - matches the INI settings */ |
106 | 106 | ||
107 | static bool use_new_ani(struct ath_hw *ah) | ||
108 | { | ||
109 | return AR_SREV_9300_20_OR_LATER(ah) || modparam_force_new_ani; | ||
110 | } | ||
111 | |||
112 | static void ath9k_hw_update_mibstats(struct ath_hw *ah, | 107 | static void ath9k_hw_update_mibstats(struct ath_hw *ah, |
113 | struct ath9k_mib_stats *stats) | 108 | struct ath9k_mib_stats *stats) |
114 | { | 109 | { |
@@ -122,8 +117,6 @@ static void ath9k_hw_update_mibstats(struct ath_hw *ah, | |||
122 | static void ath9k_ani_restart(struct ath_hw *ah) | 117 | static void ath9k_ani_restart(struct ath_hw *ah) |
123 | { | 118 | { |
124 | struct ar5416AniState *aniState; | 119 | struct ar5416AniState *aniState; |
125 | struct ath_common *common = ath9k_hw_common(ah); | ||
126 | u32 ofdm_base = 0, cck_base = 0; | ||
127 | 120 | ||
128 | if (!DO_ANI(ah)) | 121 | if (!DO_ANI(ah)) |
129 | return; | 122 | return; |
@@ -131,18 +124,10 @@ static void ath9k_ani_restart(struct ath_hw *ah) | |||
131 | aniState = &ah->curchan->ani; | 124 | aniState = &ah->curchan->ani; |
132 | aniState->listenTime = 0; | 125 | aniState->listenTime = 0; |
133 | 126 | ||
134 | if (!use_new_ani(ah)) { | ||
135 | ofdm_base = AR_PHY_COUNTMAX - ah->config.ofdm_trig_high; | ||
136 | cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high; | ||
137 | } | ||
138 | |||
139 | ath_dbg(common, ANI, "Writing ofdmbase=%u cckbase=%u\n", | ||
140 | ofdm_base, cck_base); | ||
141 | |||
142 | ENABLE_REGWRITE_BUFFER(ah); | 127 | ENABLE_REGWRITE_BUFFER(ah); |
143 | 128 | ||
144 | REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base); | 129 | REG_WRITE(ah, AR_PHY_ERR_1, 0); |
145 | REG_WRITE(ah, AR_PHY_ERR_2, cck_base); | 130 | REG_WRITE(ah, AR_PHY_ERR_2, 0); |
146 | REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); | 131 | REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); |
147 | REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); | 132 | REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); |
148 | 133 | ||
@@ -154,129 +139,23 @@ static void ath9k_ani_restart(struct ath_hw *ah) | |||
154 | aniState->cckPhyErrCount = 0; | 139 | aniState->cckPhyErrCount = 0; |
155 | } | 140 | } |
156 | 141 | ||
157 | static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah) | ||
158 | { | ||
159 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | ||
160 | struct ar5416AniState *aniState; | ||
161 | int32_t rssi; | ||
162 | |||
163 | aniState = &ah->curchan->ani; | ||
164 | |||
165 | if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { | ||
166 | if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, | ||
167 | aniState->noiseImmunityLevel + 1)) { | ||
168 | return; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | if (aniState->spurImmunityLevel < HAL_SPUR_IMMUNE_MAX) { | ||
173 | if (ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, | ||
174 | aniState->spurImmunityLevel + 1)) { | ||
175 | return; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | if (ah->opmode == NL80211_IFTYPE_AP) { | ||
180 | if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) { | ||
181 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
182 | aniState->firstepLevel + 1); | ||
183 | } | ||
184 | return; | ||
185 | } | ||
186 | rssi = BEACON_RSSI(ah); | ||
187 | if (rssi > aniState->rssiThrHigh) { | ||
188 | if (!aniState->ofdmWeakSigDetectOff) { | ||
189 | if (ath9k_hw_ani_control(ah, | ||
190 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
191 | false)) { | ||
192 | ath9k_hw_ani_control(ah, | ||
193 | ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); | ||
194 | return; | ||
195 | } | ||
196 | } | ||
197 | if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) { | ||
198 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
199 | aniState->firstepLevel + 1); | ||
200 | return; | ||
201 | } | ||
202 | } else if (rssi > aniState->rssiThrLow) { | ||
203 | if (aniState->ofdmWeakSigDetectOff) | ||
204 | ath9k_hw_ani_control(ah, | ||
205 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
206 | true); | ||
207 | if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) | ||
208 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
209 | aniState->firstepLevel + 1); | ||
210 | return; | ||
211 | } else { | ||
212 | if ((conf->channel->band == IEEE80211_BAND_2GHZ) && | ||
213 | !conf_is_ht(conf)) { | ||
214 | if (!aniState->ofdmWeakSigDetectOff) | ||
215 | ath9k_hw_ani_control(ah, | ||
216 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
217 | false); | ||
218 | if (aniState->firstepLevel > 0) | ||
219 | ath9k_hw_ani_control(ah, | ||
220 | ATH9K_ANI_FIRSTEP_LEVEL, 0); | ||
221 | return; | ||
222 | } | ||
223 | } | ||
224 | } | ||
225 | |||
226 | static void ath9k_hw_ani_cck_err_trigger_old(struct ath_hw *ah) | ||
227 | { | ||
228 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | ||
229 | struct ar5416AniState *aniState; | ||
230 | int32_t rssi; | ||
231 | |||
232 | aniState = &ah->curchan->ani; | ||
233 | if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { | ||
234 | if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, | ||
235 | aniState->noiseImmunityLevel + 1)) { | ||
236 | return; | ||
237 | } | ||
238 | } | ||
239 | if (ah->opmode == NL80211_IFTYPE_AP) { | ||
240 | if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) { | ||
241 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
242 | aniState->firstepLevel + 1); | ||
243 | } | ||
244 | return; | ||
245 | } | ||
246 | rssi = BEACON_RSSI(ah); | ||
247 | if (rssi > aniState->rssiThrLow) { | ||
248 | if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) | ||
249 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
250 | aniState->firstepLevel + 1); | ||
251 | } else { | ||
252 | if ((conf->channel->band == IEEE80211_BAND_2GHZ) && | ||
253 | !conf_is_ht(conf)) { | ||
254 | if (aniState->firstepLevel > 0) | ||
255 | ath9k_hw_ani_control(ah, | ||
256 | ATH9K_ANI_FIRSTEP_LEVEL, 0); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | /* Adjust the OFDM Noise Immunity Level */ | 142 | /* Adjust the OFDM Noise Immunity Level */ |
262 | static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel) | 143 | static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, |
144 | bool scan) | ||
263 | { | 145 | { |
264 | struct ar5416AniState *aniState = &ah->curchan->ani; | 146 | struct ar5416AniState *aniState = &ah->curchan->ani; |
265 | struct ath_common *common = ath9k_hw_common(ah); | 147 | struct ath_common *common = ath9k_hw_common(ah); |
266 | const struct ani_ofdm_level_entry *entry_ofdm; | 148 | const struct ani_ofdm_level_entry *entry_ofdm; |
267 | const struct ani_cck_level_entry *entry_cck; | 149 | const struct ani_cck_level_entry *entry_cck; |
268 | 150 | bool weak_sig; | |
269 | aniState->noiseFloor = BEACON_RSSI(ah); | ||
270 | 151 | ||
271 | ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", | 152 | ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", |
272 | aniState->ofdmNoiseImmunityLevel, | 153 | aniState->ofdmNoiseImmunityLevel, |
273 | immunityLevel, aniState->noiseFloor, | 154 | immunityLevel, BEACON_RSSI(ah), |
274 | aniState->rssiThrLow, aniState->rssiThrHigh); | 155 | aniState->rssiThrLow, aniState->rssiThrHigh); |
275 | 156 | ||
276 | if (aniState->update_ani) | 157 | if (!scan) |
277 | aniState->ofdmNoiseImmunityLevel = | 158 | aniState->ofdmNoiseImmunityLevel = immunityLevel; |
278 | (immunityLevel > ATH9K_ANI_OFDM_DEF_LEVEL) ? | ||
279 | immunityLevel : ATH9K_ANI_OFDM_DEF_LEVEL; | ||
280 | 159 | ||
281 | entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; | 160 | entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; |
282 | entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; | 161 | entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; |
@@ -292,12 +171,22 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel) | |||
292 | ATH9K_ANI_FIRSTEP_LEVEL, | 171 | ATH9K_ANI_FIRSTEP_LEVEL, |
293 | entry_ofdm->fir_step_level); | 172 | entry_ofdm->fir_step_level); |
294 | 173 | ||
295 | if ((aniState->noiseFloor >= aniState->rssiThrHigh) && | 174 | weak_sig = entry_ofdm->ofdm_weak_signal_on; |
296 | (!aniState->ofdmWeakSigDetectOff != | 175 | if (ah->opmode == NL80211_IFTYPE_STATION && |
297 | entry_ofdm->ofdm_weak_signal_on)) { | 176 | BEACON_RSSI(ah) <= aniState->rssiThrHigh) |
177 | weak_sig = true; | ||
178 | |||
179 | if (aniState->ofdmWeakSigDetect != weak_sig) | ||
298 | ath9k_hw_ani_control(ah, | 180 | ath9k_hw_ani_control(ah, |
299 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | 181 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, |
300 | entry_ofdm->ofdm_weak_signal_on); | 182 | entry_ofdm->ofdm_weak_signal_on); |
183 | |||
184 | if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) { | ||
185 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; | ||
186 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI; | ||
187 | } else { | ||
188 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI; | ||
189 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; | ||
301 | } | 190 | } |
302 | } | 191 | } |
303 | 192 | ||
@@ -308,43 +197,35 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) | |||
308 | if (!DO_ANI(ah)) | 197 | if (!DO_ANI(ah)) |
309 | return; | 198 | return; |
310 | 199 | ||
311 | if (!use_new_ani(ah)) { | ||
312 | ath9k_hw_ani_ofdm_err_trigger_old(ah); | ||
313 | return; | ||
314 | } | ||
315 | |||
316 | aniState = &ah->curchan->ani; | 200 | aniState = &ah->curchan->ani; |
317 | 201 | ||
318 | if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) | 202 | if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) |
319 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1); | 203 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); |
320 | } | 204 | } |
321 | 205 | ||
322 | /* | 206 | /* |
323 | * Set the ANI settings to match an CCK level. | 207 | * Set the ANI settings to match an CCK level. |
324 | */ | 208 | */ |
325 | static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel) | 209 | static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, |
210 | bool scan) | ||
326 | { | 211 | { |
327 | struct ar5416AniState *aniState = &ah->curchan->ani; | 212 | struct ar5416AniState *aniState = &ah->curchan->ani; |
328 | struct ath_common *common = ath9k_hw_common(ah); | 213 | struct ath_common *common = ath9k_hw_common(ah); |
329 | const struct ani_ofdm_level_entry *entry_ofdm; | 214 | const struct ani_ofdm_level_entry *entry_ofdm; |
330 | const struct ani_cck_level_entry *entry_cck; | 215 | const struct ani_cck_level_entry *entry_cck; |
331 | 216 | ||
332 | aniState->noiseFloor = BEACON_RSSI(ah); | ||
333 | ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", | 217 | ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", |
334 | aniState->cckNoiseImmunityLevel, immunityLevel, | 218 | aniState->cckNoiseImmunityLevel, immunityLevel, |
335 | aniState->noiseFloor, aniState->rssiThrLow, | 219 | BEACON_RSSI(ah), aniState->rssiThrLow, |
336 | aniState->rssiThrHigh); | 220 | aniState->rssiThrHigh); |
337 | 221 | ||
338 | if ((ah->opmode == NL80211_IFTYPE_STATION || | 222 | if (ah->opmode == NL80211_IFTYPE_STATION && |
339 | ah->opmode == NL80211_IFTYPE_ADHOC) && | 223 | BEACON_RSSI(ah) <= aniState->rssiThrLow && |
340 | aniState->noiseFloor <= aniState->rssiThrLow && | ||
341 | immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI) | 224 | immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI) |
342 | immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI; | 225 | immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI; |
343 | 226 | ||
344 | if (aniState->update_ani) | 227 | if (!scan) |
345 | aniState->cckNoiseImmunityLevel = | 228 | aniState->cckNoiseImmunityLevel = immunityLevel; |
346 | (immunityLevel > ATH9K_ANI_CCK_DEF_LEVEL) ? | ||
347 | immunityLevel : ATH9K_ANI_CCK_DEF_LEVEL; | ||
348 | 229 | ||
349 | entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; | 230 | entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; |
350 | entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; | 231 | entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; |
@@ -359,7 +240,7 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel) | |||
359 | if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah)) | 240 | if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah)) |
360 | return; | 241 | return; |
361 | 242 | ||
362 | if (aniState->mrcCCKOff == entry_cck->mrc_cck_on) | 243 | if (aniState->mrcCCK != entry_cck->mrc_cck_on) |
363 | ath9k_hw_ani_control(ah, | 244 | ath9k_hw_ani_control(ah, |
364 | ATH9K_ANI_MRC_CCK, | 245 | ATH9K_ANI_MRC_CCK, |
365 | entry_cck->mrc_cck_on); | 246 | entry_cck->mrc_cck_on); |
@@ -372,68 +253,11 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) | |||
372 | if (!DO_ANI(ah)) | 253 | if (!DO_ANI(ah)) |
373 | return; | 254 | return; |
374 | 255 | ||
375 | if (!use_new_ani(ah)) { | ||
376 | ath9k_hw_ani_cck_err_trigger_old(ah); | ||
377 | return; | ||
378 | } | ||
379 | |||
380 | aniState = &ah->curchan->ani; | 256 | aniState = &ah->curchan->ani; |
381 | 257 | ||
382 | if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) | 258 | if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) |
383 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1); | 259 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, |
384 | } | 260 | false); |
385 | |||
386 | static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah) | ||
387 | { | ||
388 | struct ar5416AniState *aniState; | ||
389 | int32_t rssi; | ||
390 | |||
391 | aniState = &ah->curchan->ani; | ||
392 | |||
393 | if (ah->opmode == NL80211_IFTYPE_AP) { | ||
394 | if (aniState->firstepLevel > 0) { | ||
395 | if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
396 | aniState->firstepLevel - 1)) | ||
397 | return; | ||
398 | } | ||
399 | } else { | ||
400 | rssi = BEACON_RSSI(ah); | ||
401 | if (rssi > aniState->rssiThrHigh) { | ||
402 | /* XXX: Handle me */ | ||
403 | } else if (rssi > aniState->rssiThrLow) { | ||
404 | if (aniState->ofdmWeakSigDetectOff) { | ||
405 | if (ath9k_hw_ani_control(ah, | ||
406 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
407 | true)) | ||
408 | return; | ||
409 | } | ||
410 | if (aniState->firstepLevel > 0) { | ||
411 | if (ath9k_hw_ani_control(ah, | ||
412 | ATH9K_ANI_FIRSTEP_LEVEL, | ||
413 | aniState->firstepLevel - 1)) | ||
414 | return; | ||
415 | } | ||
416 | } else { | ||
417 | if (aniState->firstepLevel > 0) { | ||
418 | if (ath9k_hw_ani_control(ah, | ||
419 | ATH9K_ANI_FIRSTEP_LEVEL, | ||
420 | aniState->firstepLevel - 1)) | ||
421 | return; | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | |||
426 | if (aniState->spurImmunityLevel > 0) { | ||
427 | if (ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, | ||
428 | aniState->spurImmunityLevel - 1)) | ||
429 | return; | ||
430 | } | ||
431 | |||
432 | if (aniState->noiseImmunityLevel > 0) { | ||
433 | ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, | ||
434 | aniState->noiseImmunityLevel - 1); | ||
435 | return; | ||
436 | } | ||
437 | } | 261 | } |
438 | 262 | ||
439 | /* | 263 | /* |
@@ -446,87 +270,18 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) | |||
446 | 270 | ||
447 | aniState = &ah->curchan->ani; | 271 | aniState = &ah->curchan->ani; |
448 | 272 | ||
449 | if (!use_new_ani(ah)) { | ||
450 | ath9k_hw_ani_lower_immunity_old(ah); | ||
451 | return; | ||
452 | } | ||
453 | |||
454 | /* lower OFDM noise immunity */ | 273 | /* lower OFDM noise immunity */ |
455 | if (aniState->ofdmNoiseImmunityLevel > 0 && | 274 | if (aniState->ofdmNoiseImmunityLevel > 0 && |
456 | (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) { | 275 | (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) { |
457 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1); | 276 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1, |
277 | false); | ||
458 | return; | 278 | return; |
459 | } | 279 | } |
460 | 280 | ||
461 | /* lower CCK noise immunity */ | 281 | /* lower CCK noise immunity */ |
462 | if (aniState->cckNoiseImmunityLevel > 0) | 282 | if (aniState->cckNoiseImmunityLevel > 0) |
463 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); | 283 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1, |
464 | } | 284 | false); |
465 | |||
466 | static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning) | ||
467 | { | ||
468 | struct ar5416AniState *aniState; | ||
469 | struct ath9k_channel *chan = ah->curchan; | ||
470 | struct ath_common *common = ath9k_hw_common(ah); | ||
471 | |||
472 | if (!DO_ANI(ah)) | ||
473 | return; | ||
474 | |||
475 | aniState = &ah->curchan->ani; | ||
476 | |||
477 | if (ah->opmode != NL80211_IFTYPE_STATION | ||
478 | && ah->opmode != NL80211_IFTYPE_ADHOC) { | ||
479 | ath_dbg(common, ANI, "Reset ANI state opmode %u\n", ah->opmode); | ||
480 | ah->stats.ast_ani_reset++; | ||
481 | |||
482 | if (ah->opmode == NL80211_IFTYPE_AP) { | ||
483 | /* | ||
484 | * ath9k_hw_ani_control() will only process items set on | ||
485 | * ah->ani_function | ||
486 | */ | ||
487 | if (IS_CHAN_2GHZ(chan)) | ||
488 | ah->ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL | | ||
489 | ATH9K_ANI_FIRSTEP_LEVEL); | ||
490 | else | ||
491 | ah->ani_function = 0; | ||
492 | } | ||
493 | |||
494 | ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0); | ||
495 | ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); | ||
496 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 0); | ||
497 | ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
498 | !ATH9K_ANI_USE_OFDM_WEAK_SIG); | ||
499 | ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR, | ||
500 | ATH9K_ANI_CCK_WEAK_SIG_THR); | ||
501 | |||
502 | ath9k_ani_restart(ah); | ||
503 | return; | ||
504 | } | ||
505 | |||
506 | if (aniState->noiseImmunityLevel != 0) | ||
507 | ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, | ||
508 | aniState->noiseImmunityLevel); | ||
509 | if (aniState->spurImmunityLevel != 0) | ||
510 | ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, | ||
511 | aniState->spurImmunityLevel); | ||
512 | if (aniState->ofdmWeakSigDetectOff) | ||
513 | ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, | ||
514 | !aniState->ofdmWeakSigDetectOff); | ||
515 | if (aniState->cckWeakSigThreshold) | ||
516 | ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR, | ||
517 | aniState->cckWeakSigThreshold); | ||
518 | if (aniState->firstepLevel != 0) | ||
519 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, | ||
520 | aniState->firstepLevel); | ||
521 | |||
522 | ath9k_ani_restart(ah); | ||
523 | |||
524 | ENABLE_REGWRITE_BUFFER(ah); | ||
525 | |||
526 | REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); | ||
527 | REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); | ||
528 | |||
529 | REGWRITE_BUFFER_FLUSH(ah); | ||
530 | } | 285 | } |
531 | 286 | ||
532 | /* | 287 | /* |
@@ -539,13 +294,11 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
539 | struct ar5416AniState *aniState = &ah->curchan->ani; | 294 | struct ar5416AniState *aniState = &ah->curchan->ani; |
540 | struct ath9k_channel *chan = ah->curchan; | 295 | struct ath9k_channel *chan = ah->curchan; |
541 | struct ath_common *common = ath9k_hw_common(ah); | 296 | struct ath_common *common = ath9k_hw_common(ah); |
297 | int ofdm_nil, cck_nil; | ||
542 | 298 | ||
543 | if (!DO_ANI(ah)) | 299 | if (!DO_ANI(ah)) |
544 | return; | 300 | return; |
545 | 301 | ||
546 | if (!use_new_ani(ah)) | ||
547 | return ath9k_ani_reset_old(ah, is_scanning); | ||
548 | |||
549 | BUG_ON(aniState == NULL); | 302 | BUG_ON(aniState == NULL); |
550 | ah->stats.ast_ani_reset++; | 303 | ah->stats.ast_ani_reset++; |
551 | 304 | ||
@@ -563,6 +316,11 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
563 | /* always allow mode (on/off) to be controlled */ | 316 | /* always allow mode (on/off) to be controlled */ |
564 | ah->ani_function |= ATH9K_ANI_MODE; | 317 | ah->ani_function |= ATH9K_ANI_MODE; |
565 | 318 | ||
319 | ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL, | ||
320 | aniState->ofdmNoiseImmunityLevel); | ||
321 | cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL, | ||
322 | aniState->cckNoiseImmunityLevel); | ||
323 | |||
566 | if (is_scanning || | 324 | if (is_scanning || |
567 | (ah->opmode != NL80211_IFTYPE_STATION && | 325 | (ah->opmode != NL80211_IFTYPE_STATION && |
568 | ah->opmode != NL80211_IFTYPE_ADHOC)) { | 326 | ah->opmode != NL80211_IFTYPE_ADHOC)) { |
@@ -585,9 +343,8 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
585 | aniState->ofdmNoiseImmunityLevel, | 343 | aniState->ofdmNoiseImmunityLevel, |
586 | aniState->cckNoiseImmunityLevel); | 344 | aniState->cckNoiseImmunityLevel); |
587 | 345 | ||
588 | aniState->update_ani = false; | 346 | ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL; |
589 | ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL); | 347 | cck_nil = ATH9K_ANI_CCK_DEF_LEVEL; |
590 | ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL); | ||
591 | } | 348 | } |
592 | } else { | 349 | } else { |
593 | /* | 350 | /* |
@@ -601,13 +358,9 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
601 | is_scanning, | 358 | is_scanning, |
602 | aniState->ofdmNoiseImmunityLevel, | 359 | aniState->ofdmNoiseImmunityLevel, |
603 | aniState->cckNoiseImmunityLevel); | 360 | aniState->cckNoiseImmunityLevel); |
604 | |||
605 | aniState->update_ani = true; | ||
606 | ath9k_hw_set_ofdm_nil(ah, | ||
607 | aniState->ofdmNoiseImmunityLevel); | ||
608 | ath9k_hw_set_cck_nil(ah, | ||
609 | aniState->cckNoiseImmunityLevel); | ||
610 | } | 361 | } |
362 | ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning); | ||
363 | ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning); | ||
611 | 364 | ||
612 | /* | 365 | /* |
613 | * enable phy counters if hw supports or if not, enable phy | 366 | * enable phy counters if hw supports or if not, enable phy |
@@ -627,9 +380,6 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) | |||
627 | { | 380 | { |
628 | struct ath_common *common = ath9k_hw_common(ah); | 381 | struct ath_common *common = ath9k_hw_common(ah); |
629 | struct ar5416AniState *aniState = &ah->curchan->ani; | 382 | struct ar5416AniState *aniState = &ah->curchan->ani; |
630 | u32 ofdm_base = 0; | ||
631 | u32 cck_base = 0; | ||
632 | u32 ofdmPhyErrCnt, cckPhyErrCnt; | ||
633 | u32 phyCnt1, phyCnt2; | 383 | u32 phyCnt1, phyCnt2; |
634 | int32_t listenTime; | 384 | int32_t listenTime; |
635 | 385 | ||
@@ -642,11 +392,6 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) | |||
642 | return false; | 392 | return false; |
643 | } | 393 | } |
644 | 394 | ||
645 | if (!use_new_ani(ah)) { | ||
646 | ofdm_base = AR_PHY_COUNTMAX - ah->config.ofdm_trig_high; | ||
647 | cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high; | ||
648 | } | ||
649 | |||
650 | aniState->listenTime += listenTime; | 395 | aniState->listenTime += listenTime; |
651 | 396 | ||
652 | ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); | 397 | ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); |
@@ -654,35 +399,12 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) | |||
654 | phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); | 399 | phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); |
655 | phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); | 400 | phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); |
656 | 401 | ||
657 | if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) { | 402 | ah->stats.ast_ani_ofdmerrs += phyCnt1 - aniState->ofdmPhyErrCount; |
658 | if (phyCnt1 < ofdm_base) { | 403 | aniState->ofdmPhyErrCount = phyCnt1; |
659 | ath_dbg(common, ANI, | ||
660 | "phyCnt1 0x%x, resetting counter value to 0x%x\n", | ||
661 | phyCnt1, ofdm_base); | ||
662 | REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base); | ||
663 | REG_WRITE(ah, AR_PHY_ERR_MASK_1, | ||
664 | AR_PHY_ERR_OFDM_TIMING); | ||
665 | } | ||
666 | if (phyCnt2 < cck_base) { | ||
667 | ath_dbg(common, ANI, | ||
668 | "phyCnt2 0x%x, resetting counter value to 0x%x\n", | ||
669 | phyCnt2, cck_base); | ||
670 | REG_WRITE(ah, AR_PHY_ERR_2, cck_base); | ||
671 | REG_WRITE(ah, AR_PHY_ERR_MASK_2, | ||
672 | AR_PHY_ERR_CCK_TIMING); | ||
673 | } | ||
674 | return false; | ||
675 | } | ||
676 | 404 | ||
677 | ofdmPhyErrCnt = phyCnt1 - ofdm_base; | 405 | ah->stats.ast_ani_cckerrs += phyCnt2 - aniState->cckPhyErrCount; |
678 | ah->stats.ast_ani_ofdmerrs += | 406 | aniState->cckPhyErrCount = phyCnt2; |
679 | ofdmPhyErrCnt - aniState->ofdmPhyErrCount; | ||
680 | aniState->ofdmPhyErrCount = ofdmPhyErrCnt; | ||
681 | 407 | ||
682 | cckPhyErrCnt = phyCnt2 - cck_base; | ||
683 | ah->stats.ast_ani_cckerrs += | ||
684 | cckPhyErrCnt - aniState->cckPhyErrCount; | ||
685 | aniState->cckPhyErrCount = cckPhyErrCnt; | ||
686 | return true; | 408 | return true; |
687 | } | 409 | } |
688 | 410 | ||
@@ -716,21 +438,10 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) | |||
716 | 438 | ||
717 | if (aniState->listenTime > ah->aniperiod) { | 439 | if (aniState->listenTime > ah->aniperiod) { |
718 | if (cckPhyErrRate < ah->config.cck_trig_low && | 440 | if (cckPhyErrRate < ah->config.cck_trig_low && |
719 | ((ofdmPhyErrRate < ah->config.ofdm_trig_low && | 441 | ofdmPhyErrRate < ah->config.ofdm_trig_low) { |
720 | aniState->ofdmNoiseImmunityLevel < | ||
721 | ATH9K_ANI_OFDM_DEF_LEVEL) || | ||
722 | (ofdmPhyErrRate < ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI && | ||
723 | aniState->ofdmNoiseImmunityLevel >= | ||
724 | ATH9K_ANI_OFDM_DEF_LEVEL))) { | ||
725 | ath9k_hw_ani_lower_immunity(ah); | 442 | ath9k_hw_ani_lower_immunity(ah); |
726 | aniState->ofdmsTurn = !aniState->ofdmsTurn; | 443 | aniState->ofdmsTurn = !aniState->ofdmsTurn; |
727 | } else if ((ofdmPhyErrRate > ah->config.ofdm_trig_high && | 444 | } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) { |
728 | aniState->ofdmNoiseImmunityLevel >= | ||
729 | ATH9K_ANI_OFDM_DEF_LEVEL) || | ||
730 | (ofdmPhyErrRate > | ||
731 | ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI && | ||
732 | aniState->ofdmNoiseImmunityLevel < | ||
733 | ATH9K_ANI_OFDM_DEF_LEVEL)) { | ||
734 | ath9k_hw_ani_ofdm_err_trigger(ah); | 445 | ath9k_hw_ani_ofdm_err_trigger(ah); |
735 | aniState->ofdmsTurn = false; | 446 | aniState->ofdmsTurn = false; |
736 | } else if (cckPhyErrRate > ah->config.cck_trig_high) { | 447 | } else if (cckPhyErrRate > ah->config.cck_trig_high) { |
@@ -778,49 +489,6 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah) | |||
778 | } | 489 | } |
779 | EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); | 490 | EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); |
780 | 491 | ||
781 | /* | ||
782 | * Process a MIB interrupt. We may potentially be invoked because | ||
783 | * any of the MIB counters overflow/trigger so don't assume we're | ||
784 | * here because a PHY error counter triggered. | ||
785 | */ | ||
786 | void ath9k_hw_proc_mib_event(struct ath_hw *ah) | ||
787 | { | ||
788 | u32 phyCnt1, phyCnt2; | ||
789 | |||
790 | /* Reset these counters regardless */ | ||
791 | REG_WRITE(ah, AR_FILT_OFDM, 0); | ||
792 | REG_WRITE(ah, AR_FILT_CCK, 0); | ||
793 | if (!(REG_READ(ah, AR_SLP_MIB_CTRL) & AR_SLP_MIB_PENDING)) | ||
794 | REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR); | ||
795 | |||
796 | /* Clear the mib counters and save them in the stats */ | ||
797 | ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); | ||
798 | |||
799 | if (!DO_ANI(ah)) { | ||
800 | /* | ||
801 | * We must always clear the interrupt cause by | ||
802 | * resetting the phy error regs. | ||
803 | */ | ||
804 | REG_WRITE(ah, AR_PHY_ERR_1, 0); | ||
805 | REG_WRITE(ah, AR_PHY_ERR_2, 0); | ||
806 | return; | ||
807 | } | ||
808 | |||
809 | /* NB: these are not reset-on-read */ | ||
810 | phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); | ||
811 | phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); | ||
812 | if (((phyCnt1 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK) || | ||
813 | ((phyCnt2 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK)) { | ||
814 | |||
815 | if (!use_new_ani(ah)) | ||
816 | ath9k_hw_ani_read_counters(ah); | ||
817 | |||
818 | /* NB: always restart to insure the h/w counters are reset */ | ||
819 | ath9k_ani_restart(ah); | ||
820 | } | ||
821 | } | ||
822 | EXPORT_SYMBOL(ath9k_hw_proc_mib_event); | ||
823 | |||
824 | void ath9k_hw_ani_setup(struct ath_hw *ah) | 492 | void ath9k_hw_ani_setup(struct ath_hw *ah) |
825 | { | 493 | { |
826 | int i; | 494 | int i; |
@@ -845,66 +513,37 @@ void ath9k_hw_ani_init(struct ath_hw *ah) | |||
845 | 513 | ||
846 | ath_dbg(common, ANI, "Initialize ANI\n"); | 514 | ath_dbg(common, ANI, "Initialize ANI\n"); |
847 | 515 | ||
848 | if (use_new_ani(ah)) { | 516 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; |
849 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW; | 517 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; |
850 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_NEW; | ||
851 | 518 | ||
852 | ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_NEW; | 519 | ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH; |
853 | ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_NEW; | 520 | ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW; |
854 | } else { | ||
855 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD; | ||
856 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD; | ||
857 | |||
858 | ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD; | ||
859 | ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD; | ||
860 | } | ||
861 | 521 | ||
862 | for (i = 0; i < ARRAY_SIZE(ah->channels); i++) { | 522 | for (i = 0; i < ARRAY_SIZE(ah->channels); i++) { |
863 | struct ath9k_channel *chan = &ah->channels[i]; | 523 | struct ath9k_channel *chan = &ah->channels[i]; |
864 | struct ar5416AniState *ani = &chan->ani; | 524 | struct ar5416AniState *ani = &chan->ani; |
865 | 525 | ||
866 | if (use_new_ani(ah)) { | 526 | ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; |
867 | ani->spurImmunityLevel = | ||
868 | ATH9K_ANI_SPUR_IMMUNE_LVL_NEW; | ||
869 | 527 | ||
870 | ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW; | 528 | ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; |
871 | 529 | ||
872 | if (AR_SREV_9300_20_OR_LATER(ah)) | 530 | ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false; |
873 | ani->mrcCCKOff = | 531 | |
874 | !ATH9K_ANI_ENABLE_MRC_CCK; | 532 | ani->ofdmsTurn = true; |
875 | else | ||
876 | ani->mrcCCKOff = true; | ||
877 | |||
878 | ani->ofdmsTurn = true; | ||
879 | } else { | ||
880 | ani->spurImmunityLevel = | ||
881 | ATH9K_ANI_SPUR_IMMUNE_LVL_OLD; | ||
882 | ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_OLD; | ||
883 | |||
884 | ani->cckWeakSigThreshold = | ||
885 | ATH9K_ANI_CCK_WEAK_SIG_THR; | ||
886 | } | ||
887 | 533 | ||
888 | ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; | 534 | ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; |
889 | ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; | 535 | ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; |
890 | ani->ofdmWeakSigDetectOff = | 536 | ani->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; |
891 | !ATH9K_ANI_USE_OFDM_WEAK_SIG; | ||
892 | ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; | 537 | ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; |
893 | ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; | 538 | ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; |
894 | ani->update_ani = false; | ||
895 | } | 539 | } |
896 | 540 | ||
897 | /* | 541 | /* |
898 | * since we expect some ongoing maintenance on the tables, let's sanity | 542 | * since we expect some ongoing maintenance on the tables, let's sanity |
899 | * check here default level should not modify INI setting. | 543 | * check here default level should not modify INI setting. |
900 | */ | 544 | */ |
901 | if (use_new_ani(ah)) { | 545 | ah->aniperiod = ATH9K_ANI_PERIOD; |
902 | ah->aniperiod = ATH9K_ANI_PERIOD_NEW; | 546 | ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL; |
903 | ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW; | ||
904 | } else { | ||
905 | ah->aniperiod = ATH9K_ANI_PERIOD_OLD; | ||
906 | ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_OLD; | ||
907 | } | ||
908 | 547 | ||
909 | if (ah->config.enable_ani) | 548 | if (ah->config.enable_ani) |
910 | ah->proc_phyerr |= HAL_PROCESS_ANI; | 549 | ah->proc_phyerr |= HAL_PROCESS_ANI; |
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h index 72e2b874e179..1485bf5e3518 100644 --- a/drivers/net/wireless/ath/ath9k/ani.h +++ b/drivers/net/wireless/ath/ath9k/ani.h | |||
@@ -24,42 +24,34 @@ | |||
24 | #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi) | 24 | #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi) |
25 | 25 | ||
26 | /* units are errors per second */ | 26 | /* units are errors per second */ |
27 | #define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500 | 27 | #define ATH9K_ANI_OFDM_TRIG_HIGH 3500 |
28 | #define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 3500 | ||
29 | #define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000 | 28 | #define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000 |
30 | 29 | ||
31 | /* units are errors per second */ | 30 | /* units are errors per second */ |
32 | #define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200 | 31 | #define ATH9K_ANI_OFDM_TRIG_LOW 400 |
33 | #define ATH9K_ANI_OFDM_TRIG_LOW_NEW 400 | ||
34 | #define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900 | 32 | #define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900 |
35 | 33 | ||
36 | /* units are errors per second */ | 34 | /* units are errors per second */ |
37 | #define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200 | 35 | #define ATH9K_ANI_CCK_TRIG_HIGH 600 |
38 | #define ATH9K_ANI_CCK_TRIG_HIGH_NEW 600 | ||
39 | 36 | ||
40 | /* units are errors per second */ | 37 | /* units are errors per second */ |
41 | #define ATH9K_ANI_CCK_TRIG_LOW_OLD 100 | 38 | #define ATH9K_ANI_CCK_TRIG_LOW 300 |
42 | #define ATH9K_ANI_CCK_TRIG_LOW_NEW 300 | ||
43 | 39 | ||
44 | #define ATH9K_ANI_NOISE_IMMUNE_LVL 4 | 40 | #define ATH9K_ANI_NOISE_IMMUNE_LVL 4 |
45 | #define ATH9K_ANI_USE_OFDM_WEAK_SIG true | 41 | #define ATH9K_ANI_USE_OFDM_WEAK_SIG true |
46 | #define ATH9K_ANI_CCK_WEAK_SIG_THR false | 42 | #define ATH9K_ANI_CCK_WEAK_SIG_THR false |
47 | 43 | ||
48 | #define ATH9K_ANI_SPUR_IMMUNE_LVL_OLD 7 | 44 | #define ATH9K_ANI_SPUR_IMMUNE_LVL 3 |
49 | #define ATH9K_ANI_SPUR_IMMUNE_LVL_NEW 3 | ||
50 | 45 | ||
51 | #define ATH9K_ANI_FIRSTEP_LVL_OLD 0 | 46 | #define ATH9K_ANI_FIRSTEP_LVL 2 |
52 | #define ATH9K_ANI_FIRSTEP_LVL_NEW 2 | ||
53 | 47 | ||
54 | #define ATH9K_ANI_RSSI_THR_HIGH 40 | 48 | #define ATH9K_ANI_RSSI_THR_HIGH 40 |
55 | #define ATH9K_ANI_RSSI_THR_LOW 7 | 49 | #define ATH9K_ANI_RSSI_THR_LOW 7 |
56 | 50 | ||
57 | #define ATH9K_ANI_PERIOD_OLD 100 | 51 | #define ATH9K_ANI_PERIOD 300 |
58 | #define ATH9K_ANI_PERIOD_NEW 300 | ||
59 | 52 | ||
60 | /* in ms */ | 53 | /* in ms */ |
61 | #define ATH9K_ANI_POLLINTERVAL_OLD 100 | 54 | #define ATH9K_ANI_POLLINTERVAL 1000 |
62 | #define ATH9K_ANI_POLLINTERVAL_NEW 1000 | ||
63 | 55 | ||
64 | #define HAL_NOISE_IMMUNE_MAX 4 | 56 | #define HAL_NOISE_IMMUNE_MAX 4 |
65 | #define HAL_SPUR_IMMUNE_MAX 7 | 57 | #define HAL_SPUR_IMMUNE_MAX 7 |
@@ -70,8 +62,6 @@ | |||
70 | #define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0 | 62 | #define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0 |
71 | #define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22 | 63 | #define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22 |
72 | 64 | ||
73 | #define ATH9K_ANI_ENABLE_MRC_CCK true | ||
74 | |||
75 | /* values here are relative to the INI */ | 65 | /* values here are relative to the INI */ |
76 | 66 | ||
77 | enum ath9k_ani_cmd { | 67 | enum ath9k_ani_cmd { |
@@ -119,16 +109,14 @@ struct ar5416AniState { | |||
119 | u8 ofdmNoiseImmunityLevel; | 109 | u8 ofdmNoiseImmunityLevel; |
120 | u8 cckNoiseImmunityLevel; | 110 | u8 cckNoiseImmunityLevel; |
121 | bool ofdmsTurn; | 111 | bool ofdmsTurn; |
122 | u8 mrcCCKOff; | 112 | u8 mrcCCK; |
123 | u8 spurImmunityLevel; | 113 | u8 spurImmunityLevel; |
124 | u8 firstepLevel; | 114 | u8 firstepLevel; |
125 | u8 ofdmWeakSigDetectOff; | 115 | u8 ofdmWeakSigDetect; |
126 | u8 cckWeakSigThreshold; | 116 | u8 cckWeakSigThreshold; |
127 | bool update_ani; | ||
128 | u32 listenTime; | 117 | u32 listenTime; |
129 | int32_t rssiThrLow; | 118 | int32_t rssiThrLow; |
130 | int32_t rssiThrHigh; | 119 | int32_t rssiThrHigh; |
131 | u32 noiseFloor; | ||
132 | u32 ofdmPhyErrCount; | 120 | u32 ofdmPhyErrCount; |
133 | u32 cckPhyErrCount; | 121 | u32 cckPhyErrCount; |
134 | int16_t pktRssi[2]; | 122 | int16_t pktRssi[2]; |
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index c7492c6a2519..874186bfda41 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -995,141 +995,6 @@ static u32 ar5008_hw_compute_pll_control(struct ath_hw *ah, | |||
995 | return pll; | 995 | return pll; |
996 | } | 996 | } |
997 | 997 | ||
998 | static bool ar5008_hw_ani_control_old(struct ath_hw *ah, | ||
999 | enum ath9k_ani_cmd cmd, | ||
1000 | int param) | ||
1001 | { | ||
1002 | struct ar5416AniState *aniState = &ah->curchan->ani; | ||
1003 | struct ath_common *common = ath9k_hw_common(ah); | ||
1004 | |||
1005 | switch (cmd & ah->ani_function) { | ||
1006 | case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{ | ||
1007 | u32 level = param; | ||
1008 | |||
1009 | if (level >= ARRAY_SIZE(ah->totalSizeDesired)) { | ||
1010 | ath_dbg(common, ANI, "level out of range (%u > %zu)\n", | ||
1011 | level, ARRAY_SIZE(ah->totalSizeDesired)); | ||
1012 | return false; | ||
1013 | } | ||
1014 | |||
1015 | REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, | ||
1016 | AR_PHY_DESIRED_SZ_TOT_DES, | ||
1017 | ah->totalSizeDesired[level]); | ||
1018 | REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, | ||
1019 | AR_PHY_AGC_CTL1_COARSE_LOW, | ||
1020 | ah->coarse_low[level]); | ||
1021 | REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, | ||
1022 | AR_PHY_AGC_CTL1_COARSE_HIGH, | ||
1023 | ah->coarse_high[level]); | ||
1024 | REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, | ||
1025 | AR_PHY_FIND_SIG_FIRPWR, | ||
1026 | ah->firpwr[level]); | ||
1027 | |||
1028 | if (level > aniState->noiseImmunityLevel) | ||
1029 | ah->stats.ast_ani_niup++; | ||
1030 | else if (level < aniState->noiseImmunityLevel) | ||
1031 | ah->stats.ast_ani_nidown++; | ||
1032 | aniState->noiseImmunityLevel = level; | ||
1033 | break; | ||
1034 | } | ||
1035 | case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{ | ||
1036 | u32 on = param ? 1 : 0; | ||
1037 | |||
1038 | if (on) | ||
1039 | REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, | ||
1040 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); | ||
1041 | else | ||
1042 | REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, | ||
1043 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); | ||
1044 | |||
1045 | if (!on != aniState->ofdmWeakSigDetectOff) { | ||
1046 | if (on) | ||
1047 | ah->stats.ast_ani_ofdmon++; | ||
1048 | else | ||
1049 | ah->stats.ast_ani_ofdmoff++; | ||
1050 | aniState->ofdmWeakSigDetectOff = !on; | ||
1051 | } | ||
1052 | break; | ||
1053 | } | ||
1054 | case ATH9K_ANI_CCK_WEAK_SIGNAL_THR:{ | ||
1055 | static const int weakSigThrCck[] = { 8, 6 }; | ||
1056 | u32 high = param ? 1 : 0; | ||
1057 | |||
1058 | REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT, | ||
1059 | AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK, | ||
1060 | weakSigThrCck[high]); | ||
1061 | if (high != aniState->cckWeakSigThreshold) { | ||
1062 | if (high) | ||
1063 | ah->stats.ast_ani_cckhigh++; | ||
1064 | else | ||
1065 | ah->stats.ast_ani_ccklow++; | ||
1066 | aniState->cckWeakSigThreshold = high; | ||
1067 | } | ||
1068 | break; | ||
1069 | } | ||
1070 | case ATH9K_ANI_FIRSTEP_LEVEL:{ | ||
1071 | static const int firstep[] = { 0, 4, 8 }; | ||
1072 | u32 level = param; | ||
1073 | |||
1074 | if (level >= ARRAY_SIZE(firstep)) { | ||
1075 | ath_dbg(common, ANI, "level out of range (%u > %zu)\n", | ||
1076 | level, ARRAY_SIZE(firstep)); | ||
1077 | return false; | ||
1078 | } | ||
1079 | REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, | ||
1080 | AR_PHY_FIND_SIG_FIRSTEP, | ||
1081 | firstep[level]); | ||
1082 | if (level > aniState->firstepLevel) | ||
1083 | ah->stats.ast_ani_stepup++; | ||
1084 | else if (level < aniState->firstepLevel) | ||
1085 | ah->stats.ast_ani_stepdown++; | ||
1086 | aniState->firstepLevel = level; | ||
1087 | break; | ||
1088 | } | ||
1089 | case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{ | ||
1090 | static const int cycpwrThr1[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; | ||
1091 | u32 level = param; | ||
1092 | |||
1093 | if (level >= ARRAY_SIZE(cycpwrThr1)) { | ||
1094 | ath_dbg(common, ANI, "level out of range (%u > %zu)\n", | ||
1095 | level, ARRAY_SIZE(cycpwrThr1)); | ||
1096 | return false; | ||
1097 | } | ||
1098 | REG_RMW_FIELD(ah, AR_PHY_TIMING5, | ||
1099 | AR_PHY_TIMING5_CYCPWR_THR1, | ||
1100 | cycpwrThr1[level]); | ||
1101 | if (level > aniState->spurImmunityLevel) | ||
1102 | ah->stats.ast_ani_spurup++; | ||
1103 | else if (level < aniState->spurImmunityLevel) | ||
1104 | ah->stats.ast_ani_spurdown++; | ||
1105 | aniState->spurImmunityLevel = level; | ||
1106 | break; | ||
1107 | } | ||
1108 | case ATH9K_ANI_PRESENT: | ||
1109 | break; | ||
1110 | default: | ||
1111 | ath_dbg(common, ANI, "invalid cmd %u\n", cmd); | ||
1112 | return false; | ||
1113 | } | ||
1114 | |||
1115 | ath_dbg(common, ANI, "ANI parameters:\n"); | ||
1116 | ath_dbg(common, ANI, | ||
1117 | "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n", | ||
1118 | aniState->noiseImmunityLevel, | ||
1119 | aniState->spurImmunityLevel, | ||
1120 | !aniState->ofdmWeakSigDetectOff); | ||
1121 | ath_dbg(common, ANI, | ||
1122 | "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n", | ||
1123 | aniState->cckWeakSigThreshold, | ||
1124 | aniState->firstepLevel, | ||
1125 | aniState->listenTime); | ||
1126 | ath_dbg(common, ANI, "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n", | ||
1127 | aniState->ofdmPhyErrCount, | ||
1128 | aniState->cckPhyErrCount); | ||
1129 | |||
1130 | return true; | ||
1131 | } | ||
1132 | |||
1133 | static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | 998 | static bool ar5008_hw_ani_control_new(struct ath_hw *ah, |
1134 | enum ath9k_ani_cmd cmd, | 999 | enum ath9k_ani_cmd cmd, |
1135 | int param) | 1000 | int param) |
@@ -1206,18 +1071,18 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1206 | REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, | 1071 | REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, |
1207 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); | 1072 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); |
1208 | 1073 | ||
1209 | if (!on != aniState->ofdmWeakSigDetectOff) { | 1074 | if (on != aniState->ofdmWeakSigDetect) { |
1210 | ath_dbg(common, ANI, | 1075 | ath_dbg(common, ANI, |
1211 | "** ch %d: ofdm weak signal: %s=>%s\n", | 1076 | "** ch %d: ofdm weak signal: %s=>%s\n", |
1212 | chan->channel, | 1077 | chan->channel, |
1213 | !aniState->ofdmWeakSigDetectOff ? | 1078 | aniState->ofdmWeakSigDetect ? |
1214 | "on" : "off", | 1079 | "on" : "off", |
1215 | on ? "on" : "off"); | 1080 | on ? "on" : "off"); |
1216 | if (on) | 1081 | if (on) |
1217 | ah->stats.ast_ani_ofdmon++; | 1082 | ah->stats.ast_ani_ofdmon++; |
1218 | else | 1083 | else |
1219 | ah->stats.ast_ani_ofdmoff++; | 1084 | ah->stats.ast_ani_ofdmoff++; |
1220 | aniState->ofdmWeakSigDetectOff = !on; | 1085 | aniState->ofdmWeakSigDetect = on; |
1221 | } | 1086 | } |
1222 | break; | 1087 | break; |
1223 | } | 1088 | } |
@@ -1236,7 +1101,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1236 | * from INI file & cap value | 1101 | * from INI file & cap value |
1237 | */ | 1102 | */ |
1238 | value = firstep_table[level] - | 1103 | value = firstep_table[level] - |
1239 | firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] + | 1104 | firstep_table[ATH9K_ANI_FIRSTEP_LVL] + |
1240 | aniState->iniDef.firstep; | 1105 | aniState->iniDef.firstep; |
1241 | if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) | 1106 | if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) |
1242 | value = ATH9K_SIG_FIRSTEP_SETTING_MIN; | 1107 | value = ATH9K_SIG_FIRSTEP_SETTING_MIN; |
@@ -1251,7 +1116,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1251 | * from INI file & cap value | 1116 | * from INI file & cap value |
1252 | */ | 1117 | */ |
1253 | value2 = firstep_table[level] - | 1118 | value2 = firstep_table[level] - |
1254 | firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] + | 1119 | firstep_table[ATH9K_ANI_FIRSTEP_LVL] + |
1255 | aniState->iniDef.firstepLow; | 1120 | aniState->iniDef.firstepLow; |
1256 | if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) | 1121 | if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) |
1257 | value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; | 1122 | value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; |
@@ -1267,7 +1132,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1267 | chan->channel, | 1132 | chan->channel, |
1268 | aniState->firstepLevel, | 1133 | aniState->firstepLevel, |
1269 | level, | 1134 | level, |
1270 | ATH9K_ANI_FIRSTEP_LVL_NEW, | 1135 | ATH9K_ANI_FIRSTEP_LVL, |
1271 | value, | 1136 | value, |
1272 | aniState->iniDef.firstep); | 1137 | aniState->iniDef.firstep); |
1273 | ath_dbg(common, ANI, | 1138 | ath_dbg(common, ANI, |
@@ -1275,7 +1140,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1275 | chan->channel, | 1140 | chan->channel, |
1276 | aniState->firstepLevel, | 1141 | aniState->firstepLevel, |
1277 | level, | 1142 | level, |
1278 | ATH9K_ANI_FIRSTEP_LVL_NEW, | 1143 | ATH9K_ANI_FIRSTEP_LVL, |
1279 | value2, | 1144 | value2, |
1280 | aniState->iniDef.firstepLow); | 1145 | aniState->iniDef.firstepLow); |
1281 | if (level > aniState->firstepLevel) | 1146 | if (level > aniState->firstepLevel) |
@@ -1300,7 +1165,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1300 | * from INI file & cap value | 1165 | * from INI file & cap value |
1301 | */ | 1166 | */ |
1302 | value = cycpwrThr1_table[level] - | 1167 | value = cycpwrThr1_table[level] - |
1303 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] + | 1168 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + |
1304 | aniState->iniDef.cycpwrThr1; | 1169 | aniState->iniDef.cycpwrThr1; |
1305 | if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) | 1170 | if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) |
1306 | value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; | 1171 | value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; |
@@ -1316,7 +1181,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1316 | * from INI file & cap value | 1181 | * from INI file & cap value |
1317 | */ | 1182 | */ |
1318 | value2 = cycpwrThr1_table[level] - | 1183 | value2 = cycpwrThr1_table[level] - |
1319 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] + | 1184 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + |
1320 | aniState->iniDef.cycpwrThr1Ext; | 1185 | aniState->iniDef.cycpwrThr1Ext; |
1321 | if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) | 1186 | if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) |
1322 | value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; | 1187 | value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; |
@@ -1331,7 +1196,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1331 | chan->channel, | 1196 | chan->channel, |
1332 | aniState->spurImmunityLevel, | 1197 | aniState->spurImmunityLevel, |
1333 | level, | 1198 | level, |
1334 | ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, | 1199 | ATH9K_ANI_SPUR_IMMUNE_LVL, |
1335 | value, | 1200 | value, |
1336 | aniState->iniDef.cycpwrThr1); | 1201 | aniState->iniDef.cycpwrThr1); |
1337 | ath_dbg(common, ANI, | 1202 | ath_dbg(common, ANI, |
@@ -1339,7 +1204,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1339 | chan->channel, | 1204 | chan->channel, |
1340 | aniState->spurImmunityLevel, | 1205 | aniState->spurImmunityLevel, |
1341 | level, | 1206 | level, |
1342 | ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, | 1207 | ATH9K_ANI_SPUR_IMMUNE_LVL, |
1343 | value2, | 1208 | value2, |
1344 | aniState->iniDef.cycpwrThr1Ext); | 1209 | aniState->iniDef.cycpwrThr1Ext); |
1345 | if (level > aniState->spurImmunityLevel) | 1210 | if (level > aniState->spurImmunityLevel) |
@@ -1367,9 +1232,9 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1367 | ath_dbg(common, ANI, | 1232 | ath_dbg(common, ANI, |
1368 | "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", | 1233 | "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", |
1369 | aniState->spurImmunityLevel, | 1234 | aniState->spurImmunityLevel, |
1370 | !aniState->ofdmWeakSigDetectOff ? "on" : "off", | 1235 | aniState->ofdmWeakSigDetect ? "on" : "off", |
1371 | aniState->firstepLevel, | 1236 | aniState->firstepLevel, |
1372 | !aniState->mrcCCKOff ? "on" : "off", | 1237 | aniState->mrcCCK ? "on" : "off", |
1373 | aniState->listenTime, | 1238 | aniState->listenTime, |
1374 | aniState->ofdmPhyErrCount, | 1239 | aniState->ofdmPhyErrCount, |
1375 | aniState->cckPhyErrCount); | 1240 | aniState->cckPhyErrCount); |
@@ -1454,10 +1319,10 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah) | |||
1454 | AR_PHY_EXT_TIMING5_CYCPWR_THR1); | 1319 | AR_PHY_EXT_TIMING5_CYCPWR_THR1); |
1455 | 1320 | ||
1456 | /* these levels just got reset to defaults by the INI */ | 1321 | /* these levels just got reset to defaults by the INI */ |
1457 | aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW; | 1322 | aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; |
1458 | aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW; | 1323 | aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; |
1459 | aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; | 1324 | aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; |
1460 | aniState->mrcCCKOff = true; /* not available on pre AR9003 */ | 1325 | aniState->mrcCCK = false; /* not available on pre AR9003 */ |
1461 | } | 1326 | } |
1462 | 1327 | ||
1463 | static void ar5008_hw_set_nf_limits(struct ath_hw *ah) | 1328 | static void ar5008_hw_set_nf_limits(struct ath_hw *ah) |
@@ -1545,11 +1410,8 @@ void ar5008_hw_attach_phy_ops(struct ath_hw *ah) | |||
1545 | priv_ops->do_getnf = ar5008_hw_do_getnf; | 1410 | priv_ops->do_getnf = ar5008_hw_do_getnf; |
1546 | priv_ops->set_radar_params = ar5008_hw_set_radar_params; | 1411 | priv_ops->set_radar_params = ar5008_hw_set_radar_params; |
1547 | 1412 | ||
1548 | if (modparam_force_new_ani) { | 1413 | priv_ops->ani_control = ar5008_hw_ani_control_new; |
1549 | priv_ops->ani_control = ar5008_hw_ani_control_new; | 1414 | priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs; |
1550 | priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs; | ||
1551 | } else | ||
1552 | priv_ops->ani_control = ar5008_hw_ani_control_old; | ||
1553 | 1415 | ||
1554 | if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) | 1416 | if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) |
1555 | priv_ops->compute_pll_control = ar9160_hw_compute_pll_control; | 1417 | priv_ops->compute_pll_control = ar9160_hw_compute_pll_control; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c index d9a69fc470cd..edf21ea4fe93 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c | |||
@@ -21,10 +21,6 @@ | |||
21 | #include "ar9002_initvals.h" | 21 | #include "ar9002_initvals.h" |
22 | #include "ar9002_phy.h" | 22 | #include "ar9002_phy.h" |
23 | 23 | ||
24 | int modparam_force_new_ani; | ||
25 | module_param_named(force_new_ani, modparam_force_new_ani, int, 0444); | ||
26 | MODULE_PARM_DESC(force_new_ani, "Force new ANI for AR5008, AR9001, AR9002"); | ||
27 | |||
28 | /* General hardware code for the A5008/AR9001/AR9002 hadware families */ | 24 | /* General hardware code for the A5008/AR9001/AR9002 hadware families */ |
29 | 25 | ||
30 | static void ar9002_hw_init_mode_regs(struct ath_hw *ah) | 26 | static void ar9002_hw_init_mode_regs(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index 952cb2b4656b..89bf94d4d8a1 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010-2011 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c b/drivers/net/wireless/ath/ath9k/ar9003_mci.c index cc2853ade8f8..61558375bfbf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c | |||
@@ -767,10 +767,6 @@ static void ar9003_mci_mute_bt(struct ath_hw *ah) | |||
767 | { | 767 | { |
768 | /* disable all MCI messages */ | 768 | /* disable all MCI messages */ |
769 | REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000); | 769 | REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000); |
770 | REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS0, 0xffffffff); | ||
771 | REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS1, 0xffffffff); | ||
772 | REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS2, 0xffffffff); | ||
773 | REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS3, 0xffffffff); | ||
774 | REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); | 770 | REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); |
775 | 771 | ||
776 | /* wait pending HW messages to flush out */ | 772 | /* wait pending HW messages to flush out */ |
@@ -1019,9 +1015,14 @@ void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force) | |||
1019 | return; | 1015 | return; |
1020 | 1016 | ||
1021 | if (mci->is_2g) { | 1017 | if (mci->is_2g) { |
1022 | ar9003_mci_send_2g5g_status(ah, true); | 1018 | if (!force) { |
1019 | ar9003_mci_send_2g5g_status(ah, true); | ||
1023 | 1020 | ||
1024 | REG_SET_BIT(ah, AR_MCI_TX_CTRL, | 1021 | ar9003_mci_send_lna_transfer(ah, true); |
1022 | udelay(5); | ||
1023 | } | ||
1024 | |||
1025 | REG_CLR_BIT(ah, AR_MCI_TX_CTRL, | ||
1025 | AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); | 1026 | AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); |
1026 | REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL, | 1027 | REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL, |
1027 | AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); | 1028 | AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); |
@@ -1029,6 +1030,11 @@ void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force) | |||
1029 | if (!(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA)) | 1030 | if (!(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA)) |
1030 | ar9003_mci_osla_setup(ah, true); | 1031 | ar9003_mci_osla_setup(ah, true); |
1031 | } else { | 1032 | } else { |
1033 | if (!force) { | ||
1034 | ar9003_mci_send_lna_take(ah, true); | ||
1035 | udelay(5); | ||
1036 | } | ||
1037 | |||
1032 | REG_SET_BIT(ah, AR_MCI_TX_CTRL, | 1038 | REG_SET_BIT(ah, AR_MCI_TX_CTRL, |
1033 | AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); | 1039 | AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); |
1034 | REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, | 1040 | REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, |
@@ -1255,6 +1261,9 @@ void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah) | |||
1255 | 1261 | ||
1256 | ath_dbg(common, MCI, "Give LNA and SPDT control to BT\n"); | 1262 | ath_dbg(common, MCI, "Give LNA and SPDT control to BT\n"); |
1257 | 1263 | ||
1264 | ar9003_mci_send_lna_take(ah, true); | ||
1265 | udelay(50); | ||
1266 | |||
1258 | REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); | 1267 | REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); |
1259 | mci->is_2g = false; | 1268 | mci->is_2g = false; |
1260 | mci->update_2g5g = true; | 1269 | mci->update_2g5g = true; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index d6baf69cdc14..6b91ebb158fe 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -173,7 +173,7 @@ static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, | |||
173 | int cur_bb_spur, negative = 0, cck_spur_freq; | 173 | int cur_bb_spur, negative = 0, cck_spur_freq; |
174 | int i; | 174 | int i; |
175 | int range, max_spur_cnts, synth_freq; | 175 | int range, max_spur_cnts, synth_freq; |
176 | u8 *spur_fbin_ptr = NULL; | 176 | u8 *spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, IS_CHAN_2GHZ(chan)); |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Need to verify range +/- 10 MHz in control channel, otherwise spur | 179 | * Need to verify range +/- 10 MHz in control channel, otherwise spur |
@@ -181,8 +181,6 @@ static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, | |||
181 | */ | 181 | */ |
182 | 182 | ||
183 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah)) { | 183 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah)) { |
184 | spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, | ||
185 | IS_CHAN_2GHZ(chan)); | ||
186 | if (spur_fbin_ptr[0] == 0) /* No spur */ | 184 | if (spur_fbin_ptr[0] == 0) /* No spur */ |
187 | return; | 185 | return; |
188 | max_spur_cnts = 5; | 186 | max_spur_cnts = 5; |
@@ -825,18 +823,18 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
825 | REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, | 823 | REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, |
826 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); | 824 | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); |
827 | 825 | ||
828 | if (!on != aniState->ofdmWeakSigDetectOff) { | 826 | if (on != aniState->ofdmWeakSigDetect) { |
829 | ath_dbg(common, ANI, | 827 | ath_dbg(common, ANI, |
830 | "** ch %d: ofdm weak signal: %s=>%s\n", | 828 | "** ch %d: ofdm weak signal: %s=>%s\n", |
831 | chan->channel, | 829 | chan->channel, |
832 | !aniState->ofdmWeakSigDetectOff ? | 830 | aniState->ofdmWeakSigDetect ? |
833 | "on" : "off", | 831 | "on" : "off", |
834 | on ? "on" : "off"); | 832 | on ? "on" : "off"); |
835 | if (on) | 833 | if (on) |
836 | ah->stats.ast_ani_ofdmon++; | 834 | ah->stats.ast_ani_ofdmon++; |
837 | else | 835 | else |
838 | ah->stats.ast_ani_ofdmoff++; | 836 | ah->stats.ast_ani_ofdmoff++; |
839 | aniState->ofdmWeakSigDetectOff = !on; | 837 | aniState->ofdmWeakSigDetect = on; |
840 | } | 838 | } |
841 | break; | 839 | break; |
842 | } | 840 | } |
@@ -855,7 +853,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
855 | * from INI file & cap value | 853 | * from INI file & cap value |
856 | */ | 854 | */ |
857 | value = firstep_table[level] - | 855 | value = firstep_table[level] - |
858 | firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] + | 856 | firstep_table[ATH9K_ANI_FIRSTEP_LVL] + |
859 | aniState->iniDef.firstep; | 857 | aniState->iniDef.firstep; |
860 | if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) | 858 | if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) |
861 | value = ATH9K_SIG_FIRSTEP_SETTING_MIN; | 859 | value = ATH9K_SIG_FIRSTEP_SETTING_MIN; |
@@ -870,7 +868,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
870 | * from INI file & cap value | 868 | * from INI file & cap value |
871 | */ | 869 | */ |
872 | value2 = firstep_table[level] - | 870 | value2 = firstep_table[level] - |
873 | firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] + | 871 | firstep_table[ATH9K_ANI_FIRSTEP_LVL] + |
874 | aniState->iniDef.firstepLow; | 872 | aniState->iniDef.firstepLow; |
875 | if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) | 873 | if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) |
876 | value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; | 874 | value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; |
@@ -886,7 +884,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
886 | chan->channel, | 884 | chan->channel, |
887 | aniState->firstepLevel, | 885 | aniState->firstepLevel, |
888 | level, | 886 | level, |
889 | ATH9K_ANI_FIRSTEP_LVL_NEW, | 887 | ATH9K_ANI_FIRSTEP_LVL, |
890 | value, | 888 | value, |
891 | aniState->iniDef.firstep); | 889 | aniState->iniDef.firstep); |
892 | ath_dbg(common, ANI, | 890 | ath_dbg(common, ANI, |
@@ -894,7 +892,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
894 | chan->channel, | 892 | chan->channel, |
895 | aniState->firstepLevel, | 893 | aniState->firstepLevel, |
896 | level, | 894 | level, |
897 | ATH9K_ANI_FIRSTEP_LVL_NEW, | 895 | ATH9K_ANI_FIRSTEP_LVL, |
898 | value2, | 896 | value2, |
899 | aniState->iniDef.firstepLow); | 897 | aniState->iniDef.firstepLow); |
900 | if (level > aniState->firstepLevel) | 898 | if (level > aniState->firstepLevel) |
@@ -919,7 +917,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
919 | * from INI file & cap value | 917 | * from INI file & cap value |
920 | */ | 918 | */ |
921 | value = cycpwrThr1_table[level] - | 919 | value = cycpwrThr1_table[level] - |
922 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] + | 920 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + |
923 | aniState->iniDef.cycpwrThr1; | 921 | aniState->iniDef.cycpwrThr1; |
924 | if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) | 922 | if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) |
925 | value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; | 923 | value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; |
@@ -935,7 +933,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
935 | * from INI file & cap value | 933 | * from INI file & cap value |
936 | */ | 934 | */ |
937 | value2 = cycpwrThr1_table[level] - | 935 | value2 = cycpwrThr1_table[level] - |
938 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] + | 936 | cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + |
939 | aniState->iniDef.cycpwrThr1Ext; | 937 | aniState->iniDef.cycpwrThr1Ext; |
940 | if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) | 938 | if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) |
941 | value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; | 939 | value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; |
@@ -950,7 +948,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
950 | chan->channel, | 948 | chan->channel, |
951 | aniState->spurImmunityLevel, | 949 | aniState->spurImmunityLevel, |
952 | level, | 950 | level, |
953 | ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, | 951 | ATH9K_ANI_SPUR_IMMUNE_LVL, |
954 | value, | 952 | value, |
955 | aniState->iniDef.cycpwrThr1); | 953 | aniState->iniDef.cycpwrThr1); |
956 | ath_dbg(common, ANI, | 954 | ath_dbg(common, ANI, |
@@ -958,7 +956,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
958 | chan->channel, | 956 | chan->channel, |
959 | aniState->spurImmunityLevel, | 957 | aniState->spurImmunityLevel, |
960 | level, | 958 | level, |
961 | ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, | 959 | ATH9K_ANI_SPUR_IMMUNE_LVL, |
962 | value2, | 960 | value2, |
963 | aniState->iniDef.cycpwrThr1Ext); | 961 | aniState->iniDef.cycpwrThr1Ext); |
964 | if (level > aniState->spurImmunityLevel) | 962 | if (level > aniState->spurImmunityLevel) |
@@ -979,16 +977,16 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
979 | AR_PHY_MRC_CCK_ENABLE, is_on); | 977 | AR_PHY_MRC_CCK_ENABLE, is_on); |
980 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, | 978 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, |
981 | AR_PHY_MRC_CCK_MUX_REG, is_on); | 979 | AR_PHY_MRC_CCK_MUX_REG, is_on); |
982 | if (!is_on != aniState->mrcCCKOff) { | 980 | if (is_on != aniState->mrcCCK) { |
983 | ath_dbg(common, ANI, "** ch %d: MRC CCK: %s=>%s\n", | 981 | ath_dbg(common, ANI, "** ch %d: MRC CCK: %s=>%s\n", |
984 | chan->channel, | 982 | chan->channel, |
985 | !aniState->mrcCCKOff ? "on" : "off", | 983 | aniState->mrcCCK ? "on" : "off", |
986 | is_on ? "on" : "off"); | 984 | is_on ? "on" : "off"); |
987 | if (is_on) | 985 | if (is_on) |
988 | ah->stats.ast_ani_ccklow++; | 986 | ah->stats.ast_ani_ccklow++; |
989 | else | 987 | else |
990 | ah->stats.ast_ani_cckhigh++; | 988 | ah->stats.ast_ani_cckhigh++; |
991 | aniState->mrcCCKOff = !is_on; | 989 | aniState->mrcCCK = is_on; |
992 | } | 990 | } |
993 | break; | 991 | break; |
994 | } | 992 | } |
@@ -1002,9 +1000,9 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
1002 | ath_dbg(common, ANI, | 1000 | ath_dbg(common, ANI, |
1003 | "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", | 1001 | "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", |
1004 | aniState->spurImmunityLevel, | 1002 | aniState->spurImmunityLevel, |
1005 | !aniState->ofdmWeakSigDetectOff ? "on" : "off", | 1003 | aniState->ofdmWeakSigDetect ? "on" : "off", |
1006 | aniState->firstepLevel, | 1004 | aniState->firstepLevel, |
1007 | !aniState->mrcCCKOff ? "on" : "off", | 1005 | aniState->mrcCCK ? "on" : "off", |
1008 | aniState->listenTime, | 1006 | aniState->listenTime, |
1009 | aniState->ofdmPhyErrCount, | 1007 | aniState->ofdmPhyErrCount, |
1010 | aniState->cckPhyErrCount); | 1008 | aniState->cckPhyErrCount); |
@@ -1111,10 +1109,10 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah) | |||
1111 | AR_PHY_EXT_CYCPWR_THR1); | 1109 | AR_PHY_EXT_CYCPWR_THR1); |
1112 | 1110 | ||
1113 | /* these levels just got reset to defaults by the INI */ | 1111 | /* these levels just got reset to defaults by the INI */ |
1114 | aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW; | 1112 | aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; |
1115 | aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW; | 1113 | aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; |
1116 | aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; | 1114 | aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; |
1117 | aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK; | 1115 | aniState->mrcCCK = true; |
1118 | } | 1116 | } |
1119 | 1117 | ||
1120 | static void ar9003_hw_set_radar_params(struct ath_hw *ah, | 1118 | static void ar9003_hw_set_radar_params(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h index 1bd3a3d22101..6e1756bc3833 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h | |||
@@ -337,12 +337,7 @@ static const u32 ar9331_modes_low_ob_db_tx_gain_1p1[][5] = { | |||
337 | {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, | 337 | {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, |
338 | }; | 338 | }; |
339 | 339 | ||
340 | static const u32 ar9331_1p1_baseband_core_txfir_coeff_japan_2484[][2] = { | 340 | #define ar9331_1p1_baseband_core_txfir_coeff_japan_2484 ar9462_2p0_baseband_core_txfir_coeff_japan_2484 |
341 | /* Addr allmodes */ | ||
342 | {0x0000a398, 0x00000000}, | ||
343 | {0x0000a39c, 0x6f7f0301}, | ||
344 | {0x0000a3a0, 0xca9228ee}, | ||
345 | }; | ||
346 | 341 | ||
347 | static const u32 ar9331_1p1_xtal_25M[][2] = { | 342 | static const u32 ar9331_1p1_xtal_25M[][2] = { |
348 | /* Addr allmodes */ | 343 | /* Addr allmodes */ |
@@ -783,17 +778,7 @@ static const u32 ar9331_modes_high_power_tx_gain_1p1[][5] = { | |||
783 | {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, | 778 | {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, |
784 | }; | 779 | }; |
785 | 780 | ||
786 | static const u32 ar9331_1p1_mac_postamble[][5] = { | 781 | #define ar9331_1p1_mac_postamble ar9300_2p2_mac_postamble |
787 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
788 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | ||
789 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | ||
790 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | ||
791 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | ||
792 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | ||
793 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | ||
794 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | ||
795 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | ||
796 | }; | ||
797 | 782 | ||
798 | static const u32 ar9331_1p1_soc_preamble[][2] = { | 783 | static const u32 ar9331_1p1_soc_preamble[][2] = { |
799 | /* Addr allmodes */ | 784 | /* Addr allmodes */ |
@@ -1112,38 +1097,4 @@ static const u32 ar9331_common_tx_gain_offset1_1[][1] = { | |||
1112 | {0x00000000}, | 1097 | {0x00000000}, |
1113 | }; | 1098 | }; |
1114 | 1099 | ||
1115 | static const u32 ar9331_1p1_chansel_xtal_25M[] = { | ||
1116 | 0x0101479e, | ||
1117 | 0x0101d027, | ||
1118 | 0x010258af, | ||
1119 | 0x0102e138, | ||
1120 | 0x010369c0, | ||
1121 | 0x0103f249, | ||
1122 | 0x01047ad1, | ||
1123 | 0x0105035a, | ||
1124 | 0x01058be2, | ||
1125 | 0x0106146b, | ||
1126 | 0x01069cf3, | ||
1127 | 0x0107257c, | ||
1128 | 0x0107ae04, | ||
1129 | 0x0108f5b2, | ||
1130 | }; | ||
1131 | |||
1132 | static const u32 ar9331_1p1_chansel_xtal_40M[] = { | ||
1133 | 0x00a0ccbe, | ||
1134 | 0x00a12213, | ||
1135 | 0x00a17769, | ||
1136 | 0x00a1ccbe, | ||
1137 | 0x00a22213, | ||
1138 | 0x00a27769, | ||
1139 | 0x00a2ccbe, | ||
1140 | 0x00a32213, | ||
1141 | 0x00a37769, | ||
1142 | 0x00a3ccbe, | ||
1143 | 0x00a42213, | ||
1144 | 0x00a47769, | ||
1145 | 0x00a4ccbe, | ||
1146 | 0x00a5998b, | ||
1147 | }; | ||
1148 | |||
1149 | #endif /* INITVALS_9330_1P1_H */ | 1100 | #endif /* INITVALS_9330_1P1_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h index 0e6ca0834b34..57ed8a112173 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
@@ -17,8 +18,8 @@ | |||
17 | #ifndef INITVALS_9330_1P2_H | 18 | #ifndef INITVALS_9330_1P2_H |
18 | #define INITVALS_9330_1P2_H | 19 | #define INITVALS_9330_1P2_H |
19 | 20 | ||
20 | static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p2[][5] = { | 21 | static const u32 ar9331_modes_high_ob_db_tx_gain_1p2[][5] = { |
21 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 22 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
22 | {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, | 23 | {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, |
23 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | 24 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, |
24 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | 25 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, |
@@ -102,8 +103,14 @@ static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p2[][5] = { | |||
102 | {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | 103 | {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, |
103 | }; | 104 | }; |
104 | 105 | ||
106 | #define ar9331_modes_high_power_tx_gain_1p2 ar9331_modes_high_ob_db_tx_gain_1p2 | ||
107 | |||
108 | #define ar9331_modes_low_ob_db_tx_gain_1p2 ar9331_modes_high_power_tx_gain_1p2 | ||
109 | |||
110 | #define ar9331_modes_lowest_ob_db_tx_gain_1p2 ar9331_modes_low_ob_db_tx_gain_1p2 | ||
111 | |||
105 | static const u32 ar9331_1p2_baseband_postamble[][5] = { | 112 | static const u32 ar9331_1p2_baseband_postamble[][5] = { |
106 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 113 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
107 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, | 114 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, |
108 | {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, | 115 | {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, |
109 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | 116 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, |
@@ -147,191 +154,6 @@ static const u32 ar9331_1p2_baseband_postamble[][5] = { | |||
147 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 154 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
148 | }; | 155 | }; |
149 | 156 | ||
150 | static const u32 ar9331_modes_high_ob_db_tx_gain_1p2[][5] = { | ||
151 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
152 | {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, | ||
153 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
154 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
155 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
156 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | ||
157 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | ||
158 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | ||
159 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | ||
160 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | ||
161 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, | ||
162 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, | ||
163 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, | ||
164 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x3f001620, 0x3f001620}, | ||
165 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x41001621, 0x41001621}, | ||
166 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x44001640, 0x44001640}, | ||
167 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x46001641, 0x46001641}, | ||
168 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x48001642, 0x48001642}, | ||
169 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x4b001644, 0x4b001644}, | ||
170 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4e001a81, 0x4e001a81}, | ||
171 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x51001a83, 0x51001a83}, | ||
172 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x54001c84, 0x54001c84}, | ||
173 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x57001ce3, 0x57001ce3}, | ||
174 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x5b001ce5, 0x5b001ce5}, | ||
175 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5f001ce9, 0x5f001ce9}, | ||
176 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x66001eec, 0x66001eec}, | ||
177 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x66001eec, 0x66001eec}, | ||
178 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x66001eec, 0x66001eec}, | ||
179 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
180 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
181 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
182 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
183 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
184 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
185 | {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
186 | {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
187 | {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
188 | {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, | ||
189 | {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, | ||
190 | {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, | ||
191 | {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, | ||
192 | {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, | ||
193 | {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, | ||
194 | {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, | ||
195 | {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, | ||
196 | {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, | ||
197 | {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, | ||
198 | {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, | ||
199 | {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, | ||
200 | {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, | ||
201 | {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, | ||
202 | {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, | ||
203 | {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, | ||
204 | {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, | ||
205 | {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, | ||
206 | {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, | ||
207 | {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, | ||
208 | {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, | ||
209 | {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, | ||
210 | {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, | ||
211 | {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
212 | {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
213 | {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
214 | {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
215 | {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
216 | {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
217 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
218 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
219 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
220 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
221 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
222 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
223 | {0x0000a618, 0x02008501, 0x02008501, 0x02008501, 0x02008501}, | ||
224 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, | ||
225 | {0x0000a620, 0x0300c802, 0x0300c802, 0x0300c802, 0x0300c802}, | ||
226 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x0300cc03, 0x0300cc03}, | ||
227 | {0x0000a628, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
228 | {0x0000a62c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
229 | {0x0000a630, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
230 | {0x0000a634, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
231 | {0x0000a638, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
232 | {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
233 | }; | ||
234 | |||
235 | static const u32 ar9331_modes_low_ob_db_tx_gain_1p2[][5] = { | ||
236 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
237 | {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, | ||
238 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
239 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
240 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
241 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | ||
242 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | ||
243 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | ||
244 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | ||
245 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | ||
246 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, | ||
247 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, | ||
248 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, | ||
249 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x3f001620, 0x3f001620}, | ||
250 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x41001621, 0x41001621}, | ||
251 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x44001640, 0x44001640}, | ||
252 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x46001641, 0x46001641}, | ||
253 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x48001642, 0x48001642}, | ||
254 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x4b001644, 0x4b001644}, | ||
255 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4e001a81, 0x4e001a81}, | ||
256 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x51001a83, 0x51001a83}, | ||
257 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x54001c84, 0x54001c84}, | ||
258 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x57001ce3, 0x57001ce3}, | ||
259 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x5b001ce5, 0x5b001ce5}, | ||
260 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5f001ce9, 0x5f001ce9}, | ||
261 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x66001eec, 0x66001eec}, | ||
262 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x66001eec, 0x66001eec}, | ||
263 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x66001eec, 0x66001eec}, | ||
264 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
265 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
266 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
267 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
268 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
269 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
270 | {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
271 | {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
272 | {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
273 | {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, | ||
274 | {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, | ||
275 | {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, | ||
276 | {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, | ||
277 | {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, | ||
278 | {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, | ||
279 | {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, | ||
280 | {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, | ||
281 | {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, | ||
282 | {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, | ||
283 | {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, | ||
284 | {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, | ||
285 | {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, | ||
286 | {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, | ||
287 | {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, | ||
288 | {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, | ||
289 | {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, | ||
290 | {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, | ||
291 | {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, | ||
292 | {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, | ||
293 | {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, | ||
294 | {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, | ||
295 | {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, | ||
296 | {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
297 | {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
298 | {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
299 | {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
300 | {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
301 | {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
302 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
303 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
304 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
305 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
306 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
307 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
308 | {0x0000a618, 0x02008501, 0x02008501, 0x02008501, 0x02008501}, | ||
309 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, | ||
310 | {0x0000a620, 0x0300c802, 0x0300c802, 0x0300c802, 0x0300c802}, | ||
311 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x0300cc03, 0x0300cc03}, | ||
312 | {0x0000a628, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
313 | {0x0000a62c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
314 | {0x0000a630, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
315 | {0x0000a634, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
316 | {0x0000a638, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
317 | {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
318 | }; | ||
319 | |||
320 | static const u32 ar9331_1p2_baseband_core_txfir_coeff_japan_2484[][2] = { | ||
321 | /* Addr allmodes */ | ||
322 | {0x0000a398, 0x00000000}, | ||
323 | {0x0000a39c, 0x6f7f0301}, | ||
324 | {0x0000a3a0, 0xca9228ee}, | ||
325 | }; | ||
326 | |||
327 | static const u32 ar9331_1p2_xtal_25M[][2] = { | ||
328 | /* Addr allmodes */ | ||
329 | {0x00007038, 0x000002f8}, | ||
330 | {0x00008244, 0x0010f3d7}, | ||
331 | {0x0000824c, 0x0001e7ae}, | ||
332 | {0x0001609c, 0x0f508f29}, | ||
333 | }; | ||
334 | |||
335 | static const u32 ar9331_1p2_radio_core[][2] = { | 157 | static const u32 ar9331_1p2_radio_core[][2] = { |
336 | /* Addr allmodes */ | 158 | /* Addr allmodes */ |
337 | {0x00016000, 0x36db6db6}, | 159 | {0x00016000, 0x36db6db6}, |
@@ -397,684 +219,24 @@ static const u32 ar9331_1p2_radio_core[][2] = { | |||
397 | {0x000163d4, 0x00000000}, | 219 | {0x000163d4, 0x00000000}, |
398 | }; | 220 | }; |
399 | 221 | ||
400 | static const u32 ar9331_1p2_soc_postamble[][5] = { | 222 | #define ar9331_1p2_baseband_core_txfir_coeff_japan_2484 ar9331_1p1_baseband_core_txfir_coeff_japan_2484 |
401 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
402 | {0x00007010, 0x00000022, 0x00000022, 0x00000022, 0x00000022}, | ||
403 | }; | ||
404 | 223 | ||
405 | static const u32 ar9331_common_wo_xlna_rx_gain_1p2[][2] = { | 224 | #define ar9331_1p2_xtal_25M ar9331_1p1_xtal_25M |
406 | /* Addr allmodes */ | ||
407 | {0x0000a000, 0x00060005}, | ||
408 | {0x0000a004, 0x00810080}, | ||
409 | {0x0000a008, 0x00830082}, | ||
410 | {0x0000a00c, 0x00850084}, | ||
411 | {0x0000a010, 0x01820181}, | ||
412 | {0x0000a014, 0x01840183}, | ||
413 | {0x0000a018, 0x01880185}, | ||
414 | {0x0000a01c, 0x018a0189}, | ||
415 | {0x0000a020, 0x02850284}, | ||
416 | {0x0000a024, 0x02890288}, | ||
417 | {0x0000a028, 0x028b028a}, | ||
418 | {0x0000a02c, 0x03850384}, | ||
419 | {0x0000a030, 0x03890388}, | ||
420 | {0x0000a034, 0x038b038a}, | ||
421 | {0x0000a038, 0x038d038c}, | ||
422 | {0x0000a03c, 0x03910390}, | ||
423 | {0x0000a040, 0x03930392}, | ||
424 | {0x0000a044, 0x03950394}, | ||
425 | {0x0000a048, 0x00000396}, | ||
426 | {0x0000a04c, 0x00000000}, | ||
427 | {0x0000a050, 0x00000000}, | ||
428 | {0x0000a054, 0x00000000}, | ||
429 | {0x0000a058, 0x00000000}, | ||
430 | {0x0000a05c, 0x00000000}, | ||
431 | {0x0000a060, 0x00000000}, | ||
432 | {0x0000a064, 0x00000000}, | ||
433 | {0x0000a068, 0x00000000}, | ||
434 | {0x0000a06c, 0x00000000}, | ||
435 | {0x0000a070, 0x00000000}, | ||
436 | {0x0000a074, 0x00000000}, | ||
437 | {0x0000a078, 0x00000000}, | ||
438 | {0x0000a07c, 0x00000000}, | ||
439 | {0x0000a080, 0x28282828}, | ||
440 | {0x0000a084, 0x28282828}, | ||
441 | {0x0000a088, 0x28282828}, | ||
442 | {0x0000a08c, 0x28282828}, | ||
443 | {0x0000a090, 0x28282828}, | ||
444 | {0x0000a094, 0x24242428}, | ||
445 | {0x0000a098, 0x171e1e1e}, | ||
446 | {0x0000a09c, 0x02020b0b}, | ||
447 | {0x0000a0a0, 0x02020202}, | ||
448 | {0x0000a0a4, 0x00000000}, | ||
449 | {0x0000a0a8, 0x00000000}, | ||
450 | {0x0000a0ac, 0x00000000}, | ||
451 | {0x0000a0b0, 0x00000000}, | ||
452 | {0x0000a0b4, 0x00000000}, | ||
453 | {0x0000a0b8, 0x00000000}, | ||
454 | {0x0000a0bc, 0x00000000}, | ||
455 | {0x0000a0c0, 0x22072208}, | ||
456 | {0x0000a0c4, 0x22052206}, | ||
457 | {0x0000a0c8, 0x22032204}, | ||
458 | {0x0000a0cc, 0x22012202}, | ||
459 | {0x0000a0d0, 0x221f2200}, | ||
460 | {0x0000a0d4, 0x221d221e}, | ||
461 | {0x0000a0d8, 0x33023303}, | ||
462 | {0x0000a0dc, 0x33003301}, | ||
463 | {0x0000a0e0, 0x331e331f}, | ||
464 | {0x0000a0e4, 0x4402331d}, | ||
465 | {0x0000a0e8, 0x44004401}, | ||
466 | {0x0000a0ec, 0x441e441f}, | ||
467 | {0x0000a0f0, 0x55025503}, | ||
468 | {0x0000a0f4, 0x55005501}, | ||
469 | {0x0000a0f8, 0x551e551f}, | ||
470 | {0x0000a0fc, 0x6602551d}, | ||
471 | {0x0000a100, 0x66006601}, | ||
472 | {0x0000a104, 0x661e661f}, | ||
473 | {0x0000a108, 0x7703661d}, | ||
474 | {0x0000a10c, 0x77017702}, | ||
475 | {0x0000a110, 0x00007700}, | ||
476 | {0x0000a114, 0x00000000}, | ||
477 | {0x0000a118, 0x00000000}, | ||
478 | {0x0000a11c, 0x00000000}, | ||
479 | {0x0000a120, 0x00000000}, | ||
480 | {0x0000a124, 0x00000000}, | ||
481 | {0x0000a128, 0x00000000}, | ||
482 | {0x0000a12c, 0x00000000}, | ||
483 | {0x0000a130, 0x00000000}, | ||
484 | {0x0000a134, 0x00000000}, | ||
485 | {0x0000a138, 0x00000000}, | ||
486 | {0x0000a13c, 0x00000000}, | ||
487 | {0x0000a140, 0x001f0000}, | ||
488 | {0x0000a144, 0x111f1100}, | ||
489 | {0x0000a148, 0x111d111e}, | ||
490 | {0x0000a14c, 0x111b111c}, | ||
491 | {0x0000a150, 0x22032204}, | ||
492 | {0x0000a154, 0x22012202}, | ||
493 | {0x0000a158, 0x221f2200}, | ||
494 | {0x0000a15c, 0x221d221e}, | ||
495 | {0x0000a160, 0x33013302}, | ||
496 | {0x0000a164, 0x331f3300}, | ||
497 | {0x0000a168, 0x4402331e}, | ||
498 | {0x0000a16c, 0x44004401}, | ||
499 | {0x0000a170, 0x441e441f}, | ||
500 | {0x0000a174, 0x55015502}, | ||
501 | {0x0000a178, 0x551f5500}, | ||
502 | {0x0000a17c, 0x6602551e}, | ||
503 | {0x0000a180, 0x66006601}, | ||
504 | {0x0000a184, 0x661e661f}, | ||
505 | {0x0000a188, 0x7703661d}, | ||
506 | {0x0000a18c, 0x77017702}, | ||
507 | {0x0000a190, 0x00007700}, | ||
508 | {0x0000a194, 0x00000000}, | ||
509 | {0x0000a198, 0x00000000}, | ||
510 | {0x0000a19c, 0x00000000}, | ||
511 | {0x0000a1a0, 0x00000000}, | ||
512 | {0x0000a1a4, 0x00000000}, | ||
513 | {0x0000a1a8, 0x00000000}, | ||
514 | {0x0000a1ac, 0x00000000}, | ||
515 | {0x0000a1b0, 0x00000000}, | ||
516 | {0x0000a1b4, 0x00000000}, | ||
517 | {0x0000a1b8, 0x00000000}, | ||
518 | {0x0000a1bc, 0x00000000}, | ||
519 | {0x0000a1c0, 0x00000000}, | ||
520 | {0x0000a1c4, 0x00000000}, | ||
521 | {0x0000a1c8, 0x00000000}, | ||
522 | {0x0000a1cc, 0x00000000}, | ||
523 | {0x0000a1d0, 0x00000000}, | ||
524 | {0x0000a1d4, 0x00000000}, | ||
525 | {0x0000a1d8, 0x00000000}, | ||
526 | {0x0000a1dc, 0x00000000}, | ||
527 | {0x0000a1e0, 0x00000000}, | ||
528 | {0x0000a1e4, 0x00000000}, | ||
529 | {0x0000a1e8, 0x00000000}, | ||
530 | {0x0000a1ec, 0x00000000}, | ||
531 | {0x0000a1f0, 0x00000396}, | ||
532 | {0x0000a1f4, 0x00000396}, | ||
533 | {0x0000a1f8, 0x00000396}, | ||
534 | {0x0000a1fc, 0x00000296}, | ||
535 | }; | ||
536 | 225 | ||
537 | static const u32 ar9331_1p2_baseband_core[][2] = { | 226 | #define ar9331_1p2_xtal_40M ar9331_1p1_xtal_40M |
538 | /* Addr allmodes */ | ||
539 | {0x00009800, 0xafe68e30}, | ||
540 | {0x00009804, 0xfd14e000}, | ||
541 | {0x00009808, 0x9c0a8f6b}, | ||
542 | {0x0000980c, 0x04800000}, | ||
543 | {0x00009814, 0x9280c00a}, | ||
544 | {0x00009818, 0x00000000}, | ||
545 | {0x0000981c, 0x00020028}, | ||
546 | {0x00009834, 0x5f3ca3de}, | ||
547 | {0x00009838, 0x0108ecff}, | ||
548 | {0x0000983c, 0x14750600}, | ||
549 | {0x00009880, 0x201fff00}, | ||
550 | {0x00009884, 0x00001042}, | ||
551 | {0x000098a4, 0x00200400}, | ||
552 | {0x000098b0, 0x32840bbe}, | ||
553 | {0x000098d0, 0x004b6a8e}, | ||
554 | {0x000098d4, 0x00000820}, | ||
555 | {0x000098dc, 0x00000000}, | ||
556 | {0x000098f0, 0x00000000}, | ||
557 | {0x000098f4, 0x00000000}, | ||
558 | {0x00009c04, 0x00000000}, | ||
559 | {0x00009c08, 0x03200000}, | ||
560 | {0x00009c0c, 0x00000000}, | ||
561 | {0x00009c10, 0x00000000}, | ||
562 | {0x00009c14, 0x00046384}, | ||
563 | {0x00009c18, 0x05b6b440}, | ||
564 | {0x00009c1c, 0x00b6b440}, | ||
565 | {0x00009d00, 0xc080a333}, | ||
566 | {0x00009d04, 0x40206c10}, | ||
567 | {0x00009d08, 0x009c4060}, | ||
568 | {0x00009d0c, 0x1883800a}, | ||
569 | {0x00009d10, 0x01834061}, | ||
570 | {0x00009d14, 0x00c00400}, | ||
571 | {0x00009d18, 0x00000000}, | ||
572 | {0x00009e08, 0x0038233c}, | ||
573 | {0x00009e24, 0x9927b515}, | ||
574 | {0x00009e28, 0x12ef0200}, | ||
575 | {0x00009e30, 0x06336f77}, | ||
576 | {0x00009e34, 0x6af6532f}, | ||
577 | {0x00009e38, 0x0cc80c00}, | ||
578 | {0x00009e40, 0x0d261820}, | ||
579 | {0x00009e4c, 0x00001004}, | ||
580 | {0x00009e50, 0x00ff03f1}, | ||
581 | {0x00009fc0, 0x803e4788}, | ||
582 | {0x00009fc4, 0x0001efb5}, | ||
583 | {0x00009fcc, 0x40000014}, | ||
584 | {0x0000a20c, 0x00000000}, | ||
585 | {0x0000a220, 0x00000000}, | ||
586 | {0x0000a224, 0x00000000}, | ||
587 | {0x0000a228, 0x10002310}, | ||
588 | {0x0000a23c, 0x00000000}, | ||
589 | {0x0000a244, 0x0c000000}, | ||
590 | {0x0000a2a0, 0x00000001}, | ||
591 | {0x0000a2c0, 0x00000001}, | ||
592 | {0x0000a2c8, 0x00000000}, | ||
593 | {0x0000a2cc, 0x18c43433}, | ||
594 | {0x0000a2d4, 0x00000000}, | ||
595 | {0x0000a2dc, 0x00000000}, | ||
596 | {0x0000a2e0, 0x00000000}, | ||
597 | {0x0000a2e4, 0x00000000}, | ||
598 | {0x0000a2e8, 0x00000000}, | ||
599 | {0x0000a2ec, 0x00000000}, | ||
600 | {0x0000a2f0, 0x00000000}, | ||
601 | {0x0000a2f4, 0x00000000}, | ||
602 | {0x0000a2f8, 0x00000000}, | ||
603 | {0x0000a344, 0x00000000}, | ||
604 | {0x0000a34c, 0x00000000}, | ||
605 | {0x0000a350, 0x0000a000}, | ||
606 | {0x0000a364, 0x00000000}, | ||
607 | {0x0000a370, 0x00000000}, | ||
608 | {0x0000a390, 0x00000001}, | ||
609 | {0x0000a394, 0x00000444}, | ||
610 | {0x0000a398, 0x001f0e0f}, | ||
611 | {0x0000a39c, 0x0075393f}, | ||
612 | {0x0000a3a0, 0xb79f6427}, | ||
613 | {0x0000a3a4, 0x00000000}, | ||
614 | {0x0000a3a8, 0xaaaaaaaa}, | ||
615 | {0x0000a3ac, 0x3c466478}, | ||
616 | {0x0000a3c0, 0x20202020}, | ||
617 | {0x0000a3c4, 0x22222220}, | ||
618 | {0x0000a3c8, 0x20200020}, | ||
619 | {0x0000a3cc, 0x20202020}, | ||
620 | {0x0000a3d0, 0x20202020}, | ||
621 | {0x0000a3d4, 0x20202020}, | ||
622 | {0x0000a3d8, 0x20202020}, | ||
623 | {0x0000a3dc, 0x20202020}, | ||
624 | {0x0000a3e0, 0x20202020}, | ||
625 | {0x0000a3e4, 0x20202020}, | ||
626 | {0x0000a3e8, 0x20202020}, | ||
627 | {0x0000a3ec, 0x20202020}, | ||
628 | {0x0000a3f0, 0x00000000}, | ||
629 | {0x0000a3f4, 0x00000006}, | ||
630 | {0x0000a3f8, 0x0cdbd380}, | ||
631 | {0x0000a3fc, 0x000f0f01}, | ||
632 | {0x0000a400, 0x8fa91f01}, | ||
633 | {0x0000a404, 0x00000000}, | ||
634 | {0x0000a408, 0x0e79e5c6}, | ||
635 | {0x0000a40c, 0x00820820}, | ||
636 | {0x0000a414, 0x1ce739ce}, | ||
637 | {0x0000a418, 0x2d001dce}, | ||
638 | {0x0000a41c, 0x1ce739ce}, | ||
639 | {0x0000a420, 0x000001ce}, | ||
640 | {0x0000a424, 0x1ce739ce}, | ||
641 | {0x0000a428, 0x000001ce}, | ||
642 | {0x0000a42c, 0x1ce739ce}, | ||
643 | {0x0000a430, 0x1ce739ce}, | ||
644 | {0x0000a434, 0x00000000}, | ||
645 | {0x0000a438, 0x00001801}, | ||
646 | {0x0000a43c, 0x00000000}, | ||
647 | {0x0000a440, 0x00000000}, | ||
648 | {0x0000a444, 0x00000000}, | ||
649 | {0x0000a448, 0x04000000}, | ||
650 | {0x0000a44c, 0x00000001}, | ||
651 | {0x0000a450, 0x00010000}, | ||
652 | {0x0000a458, 0x00000000}, | ||
653 | {0x0000a640, 0x00000000}, | ||
654 | {0x0000a644, 0x3fad9d74}, | ||
655 | {0x0000a648, 0x0048060a}, | ||
656 | {0x0000a64c, 0x00003c37}, | ||
657 | {0x0000a670, 0x03020100}, | ||
658 | {0x0000a674, 0x09080504}, | ||
659 | {0x0000a678, 0x0d0c0b0a}, | ||
660 | {0x0000a67c, 0x13121110}, | ||
661 | {0x0000a680, 0x31301514}, | ||
662 | {0x0000a684, 0x35343332}, | ||
663 | {0x0000a688, 0x00000036}, | ||
664 | {0x0000a690, 0x00000838}, | ||
665 | {0x0000a7c0, 0x00000000}, | ||
666 | {0x0000a7c4, 0xfffffffc}, | ||
667 | {0x0000a7c8, 0x00000000}, | ||
668 | {0x0000a7cc, 0x00000000}, | ||
669 | {0x0000a7d0, 0x00000000}, | ||
670 | {0x0000a7d4, 0x00000004}, | ||
671 | {0x0000a7dc, 0x00000001}, | ||
672 | }; | ||
673 | 227 | ||
674 | static const u32 ar9331_modes_high_power_tx_gain_1p2[][5] = { | 228 | #define ar9331_1p2_baseband_core ar9331_1p1_baseband_core |
675 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
676 | {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, | ||
677 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
678 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
679 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
680 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | ||
681 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | ||
682 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | ||
683 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | ||
684 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | ||
685 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, | ||
686 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, | ||
687 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, | ||
688 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x3f001620, 0x3f001620}, | ||
689 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x41001621, 0x41001621}, | ||
690 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x44001640, 0x44001640}, | ||
691 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x46001641, 0x46001641}, | ||
692 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x48001642, 0x48001642}, | ||
693 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x4b001644, 0x4b001644}, | ||
694 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4e001a81, 0x4e001a81}, | ||
695 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x51001a83, 0x51001a83}, | ||
696 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x54001c84, 0x54001c84}, | ||
697 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x57001ce3, 0x57001ce3}, | ||
698 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x5b001ce5, 0x5b001ce5}, | ||
699 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5f001ce9, 0x5f001ce9}, | ||
700 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x66001eec, 0x66001eec}, | ||
701 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x66001eec, 0x66001eec}, | ||
702 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x66001eec, 0x66001eec}, | ||
703 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
704 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
705 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
706 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
707 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
708 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, | ||
709 | {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
710 | {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
711 | {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
712 | {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, | ||
713 | {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, | ||
714 | {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, | ||
715 | {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, | ||
716 | {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, | ||
717 | {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, | ||
718 | {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, | ||
719 | {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, | ||
720 | {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, | ||
721 | {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, | ||
722 | {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, | ||
723 | {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, | ||
724 | {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, | ||
725 | {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, | ||
726 | {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, | ||
727 | {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, | ||
728 | {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, | ||
729 | {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, | ||
730 | {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, | ||
731 | {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, | ||
732 | {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, | ||
733 | {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, | ||
734 | {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, | ||
735 | {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
736 | {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
737 | {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
738 | {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
739 | {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
740 | {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, | ||
741 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
742 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
743 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
744 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
745 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
746 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
747 | {0x0000a618, 0x02008501, 0x02008501, 0x02008501, 0x02008501}, | ||
748 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, | ||
749 | {0x0000a620, 0x0300c802, 0x0300c802, 0x0300c802, 0x0300c802}, | ||
750 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x0300cc03, 0x0300cc03}, | ||
751 | {0x0000a628, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
752 | {0x0000a62c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
753 | {0x0000a630, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
754 | {0x0000a634, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
755 | {0x0000a638, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
756 | {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, | ||
757 | }; | ||
758 | 229 | ||
759 | static const u32 ar9331_1p2_mac_postamble[][5] = { | 230 | #define ar9331_1p2_soc_postamble ar9331_1p1_soc_postamble |
760 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
761 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | ||
762 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | ||
763 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | ||
764 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | ||
765 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | ||
766 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | ||
767 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | ||
768 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | ||
769 | }; | ||
770 | 231 | ||
771 | static const u32 ar9331_1p2_soc_preamble[][2] = { | 232 | #define ar9331_1p2_mac_postamble ar9331_1p1_mac_postamble |
772 | /* Addr allmodes */ | ||
773 | {0x00007020, 0x00000000}, | ||
774 | {0x00007034, 0x00000002}, | ||
775 | {0x00007038, 0x000002f8}, | ||
776 | }; | ||
777 | 233 | ||
778 | static const u32 ar9331_1p2_xtal_40M[][2] = { | 234 | #define ar9331_1p2_soc_preamble ar9331_1p1_soc_preamble |
779 | /* Addr allmodes */ | ||
780 | {0x00007038, 0x000004c2}, | ||
781 | {0x00008244, 0x0010f400}, | ||
782 | {0x0000824c, 0x0001e800}, | ||
783 | {0x0001609c, 0x0b283f31}, | ||
784 | }; | ||
785 | 235 | ||
786 | static const u32 ar9331_1p2_mac_core[][2] = { | 236 | #define ar9331_1p2_mac_core ar9331_1p1_mac_core |
787 | /* Addr allmodes */ | ||
788 | {0x00000008, 0x00000000}, | ||
789 | {0x00000030, 0x00020085}, | ||
790 | {0x00000034, 0x00000005}, | ||
791 | {0x00000040, 0x00000000}, | ||
792 | {0x00000044, 0x00000000}, | ||
793 | {0x00000048, 0x00000008}, | ||
794 | {0x0000004c, 0x00000010}, | ||
795 | {0x00000050, 0x00000000}, | ||
796 | {0x00001040, 0x002ffc0f}, | ||
797 | {0x00001044, 0x002ffc0f}, | ||
798 | {0x00001048, 0x002ffc0f}, | ||
799 | {0x0000104c, 0x002ffc0f}, | ||
800 | {0x00001050, 0x002ffc0f}, | ||
801 | {0x00001054, 0x002ffc0f}, | ||
802 | {0x00001058, 0x002ffc0f}, | ||
803 | {0x0000105c, 0x002ffc0f}, | ||
804 | {0x00001060, 0x002ffc0f}, | ||
805 | {0x00001064, 0x002ffc0f}, | ||
806 | {0x000010f0, 0x00000100}, | ||
807 | {0x00001270, 0x00000000}, | ||
808 | {0x000012b0, 0x00000000}, | ||
809 | {0x000012f0, 0x00000000}, | ||
810 | {0x0000143c, 0x00000000}, | ||
811 | {0x0000147c, 0x00000000}, | ||
812 | {0x00008000, 0x00000000}, | ||
813 | {0x00008004, 0x00000000}, | ||
814 | {0x00008008, 0x00000000}, | ||
815 | {0x0000800c, 0x00000000}, | ||
816 | {0x00008018, 0x00000000}, | ||
817 | {0x00008020, 0x00000000}, | ||
818 | {0x00008038, 0x00000000}, | ||
819 | {0x0000803c, 0x00000000}, | ||
820 | {0x00008040, 0x00000000}, | ||
821 | {0x00008044, 0x00000000}, | ||
822 | {0x00008048, 0x00000000}, | ||
823 | {0x0000804c, 0xffffffff}, | ||
824 | {0x00008054, 0x00000000}, | ||
825 | {0x00008058, 0x00000000}, | ||
826 | {0x0000805c, 0x000fc78f}, | ||
827 | {0x00008060, 0x0000000f}, | ||
828 | {0x00008064, 0x00000000}, | ||
829 | {0x00008070, 0x00000310}, | ||
830 | {0x00008074, 0x00000020}, | ||
831 | {0x00008078, 0x00000000}, | ||
832 | {0x0000809c, 0x0000000f}, | ||
833 | {0x000080a0, 0x00000000}, | ||
834 | {0x000080a4, 0x02ff0000}, | ||
835 | {0x000080a8, 0x0e070605}, | ||
836 | {0x000080ac, 0x0000000d}, | ||
837 | {0x000080b0, 0x00000000}, | ||
838 | {0x000080b4, 0x00000000}, | ||
839 | {0x000080b8, 0x00000000}, | ||
840 | {0x000080bc, 0x00000000}, | ||
841 | {0x000080c0, 0x2a800000}, | ||
842 | {0x000080c4, 0x06900168}, | ||
843 | {0x000080c8, 0x13881c20}, | ||
844 | {0x000080cc, 0x01f40000}, | ||
845 | {0x000080d0, 0x00252500}, | ||
846 | {0x000080d4, 0x00a00000}, | ||
847 | {0x000080d8, 0x00400000}, | ||
848 | {0x000080dc, 0x00000000}, | ||
849 | {0x000080e0, 0xffffffff}, | ||
850 | {0x000080e4, 0x0000ffff}, | ||
851 | {0x000080e8, 0x3f3f3f3f}, | ||
852 | {0x000080ec, 0x00000000}, | ||
853 | {0x000080f0, 0x00000000}, | ||
854 | {0x000080f4, 0x00000000}, | ||
855 | {0x000080fc, 0x00020000}, | ||
856 | {0x00008100, 0x00000000}, | ||
857 | {0x00008108, 0x00000052}, | ||
858 | {0x0000810c, 0x00000000}, | ||
859 | {0x00008110, 0x00000000}, | ||
860 | {0x00008114, 0x000007ff}, | ||
861 | {0x00008118, 0x000000aa}, | ||
862 | {0x0000811c, 0x00003210}, | ||
863 | {0x00008124, 0x00000000}, | ||
864 | {0x00008128, 0x00000000}, | ||
865 | {0x0000812c, 0x00000000}, | ||
866 | {0x00008130, 0x00000000}, | ||
867 | {0x00008134, 0x00000000}, | ||
868 | {0x00008138, 0x00000000}, | ||
869 | {0x0000813c, 0x0000ffff}, | ||
870 | {0x00008144, 0xffffffff}, | ||
871 | {0x00008168, 0x00000000}, | ||
872 | {0x0000816c, 0x00000000}, | ||
873 | {0x00008170, 0x18486200}, | ||
874 | {0x00008174, 0x33332210}, | ||
875 | {0x00008178, 0x00000000}, | ||
876 | {0x0000817c, 0x00020000}, | ||
877 | {0x000081c0, 0x00000000}, | ||
878 | {0x000081c4, 0x33332210}, | ||
879 | {0x000081c8, 0x00000000}, | ||
880 | {0x000081cc, 0x00000000}, | ||
881 | {0x000081d4, 0x00000000}, | ||
882 | {0x000081ec, 0x00000000}, | ||
883 | {0x000081f0, 0x00000000}, | ||
884 | {0x000081f4, 0x00000000}, | ||
885 | {0x000081f8, 0x00000000}, | ||
886 | {0x000081fc, 0x00000000}, | ||
887 | {0x00008240, 0x00100000}, | ||
888 | {0x00008248, 0x00000800}, | ||
889 | {0x00008250, 0x00000000}, | ||
890 | {0x00008254, 0x00000000}, | ||
891 | {0x00008258, 0x00000000}, | ||
892 | {0x0000825c, 0x40000000}, | ||
893 | {0x00008260, 0x00080922}, | ||
894 | {0x00008264, 0x9d400010}, | ||
895 | {0x00008268, 0xffffffff}, | ||
896 | {0x0000826c, 0x0000ffff}, | ||
897 | {0x00008270, 0x00000000}, | ||
898 | {0x00008274, 0x40000000}, | ||
899 | {0x00008278, 0x003e4180}, | ||
900 | {0x0000827c, 0x00000004}, | ||
901 | {0x00008284, 0x0000002c}, | ||
902 | {0x00008288, 0x0000002c}, | ||
903 | {0x0000828c, 0x000000ff}, | ||
904 | {0x00008294, 0x00000000}, | ||
905 | {0x00008298, 0x00000000}, | ||
906 | {0x0000829c, 0x00000000}, | ||
907 | {0x00008300, 0x00000140}, | ||
908 | {0x00008314, 0x00000000}, | ||
909 | {0x0000831c, 0x0000010d}, | ||
910 | {0x00008328, 0x00000000}, | ||
911 | {0x0000832c, 0x00000007}, | ||
912 | {0x00008330, 0x00000302}, | ||
913 | {0x00008334, 0x00000700}, | ||
914 | {0x00008338, 0x00ff0000}, | ||
915 | {0x0000833c, 0x02400000}, | ||
916 | {0x00008340, 0x000107ff}, | ||
917 | {0x00008344, 0xaa48105b}, | ||
918 | {0x00008348, 0x008f0000}, | ||
919 | {0x0000835c, 0x00000000}, | ||
920 | {0x00008360, 0xffffffff}, | ||
921 | {0x00008364, 0xffffffff}, | ||
922 | {0x00008368, 0x00000000}, | ||
923 | {0x00008370, 0x00000000}, | ||
924 | {0x00008374, 0x000000ff}, | ||
925 | {0x00008378, 0x00000000}, | ||
926 | {0x0000837c, 0x00000000}, | ||
927 | {0x00008380, 0xffffffff}, | ||
928 | {0x00008384, 0xffffffff}, | ||
929 | {0x00008390, 0xffffffff}, | ||
930 | {0x00008394, 0xffffffff}, | ||
931 | {0x00008398, 0x00000000}, | ||
932 | {0x0000839c, 0x00000000}, | ||
933 | {0x000083a0, 0x00000000}, | ||
934 | {0x000083a4, 0x0000fa14}, | ||
935 | {0x000083a8, 0x000f0c00}, | ||
936 | {0x000083ac, 0x33332210}, | ||
937 | {0x000083b0, 0x33332210}, | ||
938 | {0x000083b4, 0x33332210}, | ||
939 | {0x000083b8, 0x33332210}, | ||
940 | {0x000083bc, 0x00000000}, | ||
941 | {0x000083c0, 0x00000000}, | ||
942 | {0x000083c4, 0x00000000}, | ||
943 | {0x000083c8, 0x00000000}, | ||
944 | {0x000083cc, 0x00000200}, | ||
945 | {0x000083d0, 0x000301ff}, | ||
946 | }; | ||
947 | 237 | ||
948 | static const u32 ar9331_common_rx_gain_1p2[][2] = { | 238 | #define ar9331_common_wo_xlna_rx_gain_1p2 ar9331_common_wo_xlna_rx_gain_1p1 |
949 | /* Addr allmodes */ | 239 | |
950 | {0x0000a000, 0x00010000}, | 240 | #define ar9331_common_rx_gain_1p2 ar9485_common_rx_gain_1_1 |
951 | {0x0000a004, 0x00030002}, | ||
952 | {0x0000a008, 0x00050004}, | ||
953 | {0x0000a00c, 0x00810080}, | ||
954 | {0x0000a010, 0x01800082}, | ||
955 | {0x0000a014, 0x01820181}, | ||
956 | {0x0000a018, 0x01840183}, | ||
957 | {0x0000a01c, 0x01880185}, | ||
958 | {0x0000a020, 0x018a0189}, | ||
959 | {0x0000a024, 0x02850284}, | ||
960 | {0x0000a028, 0x02890288}, | ||
961 | {0x0000a02c, 0x03850384}, | ||
962 | {0x0000a030, 0x03890388}, | ||
963 | {0x0000a034, 0x038b038a}, | ||
964 | {0x0000a038, 0x038d038c}, | ||
965 | {0x0000a03c, 0x03910390}, | ||
966 | {0x0000a040, 0x03930392}, | ||
967 | {0x0000a044, 0x03950394}, | ||
968 | {0x0000a048, 0x00000396}, | ||
969 | {0x0000a04c, 0x00000000}, | ||
970 | {0x0000a050, 0x00000000}, | ||
971 | {0x0000a054, 0x00000000}, | ||
972 | {0x0000a058, 0x00000000}, | ||
973 | {0x0000a05c, 0x00000000}, | ||
974 | {0x0000a060, 0x00000000}, | ||
975 | {0x0000a064, 0x00000000}, | ||
976 | {0x0000a068, 0x00000000}, | ||
977 | {0x0000a06c, 0x00000000}, | ||
978 | {0x0000a070, 0x00000000}, | ||
979 | {0x0000a074, 0x00000000}, | ||
980 | {0x0000a078, 0x00000000}, | ||
981 | {0x0000a07c, 0x00000000}, | ||
982 | {0x0000a080, 0x28282828}, | ||
983 | {0x0000a084, 0x28282828}, | ||
984 | {0x0000a088, 0x28282828}, | ||
985 | {0x0000a08c, 0x28282828}, | ||
986 | {0x0000a090, 0x28282828}, | ||
987 | {0x0000a094, 0x21212128}, | ||
988 | {0x0000a098, 0x171c1c1c}, | ||
989 | {0x0000a09c, 0x02020212}, | ||
990 | {0x0000a0a0, 0x00000202}, | ||
991 | {0x0000a0a4, 0x00000000}, | ||
992 | {0x0000a0a8, 0x00000000}, | ||
993 | {0x0000a0ac, 0x00000000}, | ||
994 | {0x0000a0b0, 0x00000000}, | ||
995 | {0x0000a0b4, 0x00000000}, | ||
996 | {0x0000a0b8, 0x00000000}, | ||
997 | {0x0000a0bc, 0x00000000}, | ||
998 | {0x0000a0c0, 0x001f0000}, | ||
999 | {0x0000a0c4, 0x111f1100}, | ||
1000 | {0x0000a0c8, 0x111d111e}, | ||
1001 | {0x0000a0cc, 0x111b111c}, | ||
1002 | {0x0000a0d0, 0x22032204}, | ||
1003 | {0x0000a0d4, 0x22012202}, | ||
1004 | {0x0000a0d8, 0x221f2200}, | ||
1005 | {0x0000a0dc, 0x221d221e}, | ||
1006 | {0x0000a0e0, 0x33013302}, | ||
1007 | {0x0000a0e4, 0x331f3300}, | ||
1008 | {0x0000a0e8, 0x4402331e}, | ||
1009 | {0x0000a0ec, 0x44004401}, | ||
1010 | {0x0000a0f0, 0x441e441f}, | ||
1011 | {0x0000a0f4, 0x55015502}, | ||
1012 | {0x0000a0f8, 0x551f5500}, | ||
1013 | {0x0000a0fc, 0x6602551e}, | ||
1014 | {0x0000a100, 0x66006601}, | ||
1015 | {0x0000a104, 0x661e661f}, | ||
1016 | {0x0000a108, 0x7703661d}, | ||
1017 | {0x0000a10c, 0x77017702}, | ||
1018 | {0x0000a110, 0x00007700}, | ||
1019 | {0x0000a114, 0x00000000}, | ||
1020 | {0x0000a118, 0x00000000}, | ||
1021 | {0x0000a11c, 0x00000000}, | ||
1022 | {0x0000a120, 0x00000000}, | ||
1023 | {0x0000a124, 0x00000000}, | ||
1024 | {0x0000a128, 0x00000000}, | ||
1025 | {0x0000a12c, 0x00000000}, | ||
1026 | {0x0000a130, 0x00000000}, | ||
1027 | {0x0000a134, 0x00000000}, | ||
1028 | {0x0000a138, 0x00000000}, | ||
1029 | {0x0000a13c, 0x00000000}, | ||
1030 | {0x0000a140, 0x001f0000}, | ||
1031 | {0x0000a144, 0x111f1100}, | ||
1032 | {0x0000a148, 0x111d111e}, | ||
1033 | {0x0000a14c, 0x111b111c}, | ||
1034 | {0x0000a150, 0x22032204}, | ||
1035 | {0x0000a154, 0x22012202}, | ||
1036 | {0x0000a158, 0x221f2200}, | ||
1037 | {0x0000a15c, 0x221d221e}, | ||
1038 | {0x0000a160, 0x33013302}, | ||
1039 | {0x0000a164, 0x331f3300}, | ||
1040 | {0x0000a168, 0x4402331e}, | ||
1041 | {0x0000a16c, 0x44004401}, | ||
1042 | {0x0000a170, 0x441e441f}, | ||
1043 | {0x0000a174, 0x55015502}, | ||
1044 | {0x0000a178, 0x551f5500}, | ||
1045 | {0x0000a17c, 0x6602551e}, | ||
1046 | {0x0000a180, 0x66006601}, | ||
1047 | {0x0000a184, 0x661e661f}, | ||
1048 | {0x0000a188, 0x7703661d}, | ||
1049 | {0x0000a18c, 0x77017702}, | ||
1050 | {0x0000a190, 0x00007700}, | ||
1051 | {0x0000a194, 0x00000000}, | ||
1052 | {0x0000a198, 0x00000000}, | ||
1053 | {0x0000a19c, 0x00000000}, | ||
1054 | {0x0000a1a0, 0x00000000}, | ||
1055 | {0x0000a1a4, 0x00000000}, | ||
1056 | {0x0000a1a8, 0x00000000}, | ||
1057 | {0x0000a1ac, 0x00000000}, | ||
1058 | {0x0000a1b0, 0x00000000}, | ||
1059 | {0x0000a1b4, 0x00000000}, | ||
1060 | {0x0000a1b8, 0x00000000}, | ||
1061 | {0x0000a1bc, 0x00000000}, | ||
1062 | {0x0000a1c0, 0x00000000}, | ||
1063 | {0x0000a1c4, 0x00000000}, | ||
1064 | {0x0000a1c8, 0x00000000}, | ||
1065 | {0x0000a1cc, 0x00000000}, | ||
1066 | {0x0000a1d0, 0x00000000}, | ||
1067 | {0x0000a1d4, 0x00000000}, | ||
1068 | {0x0000a1d8, 0x00000000}, | ||
1069 | {0x0000a1dc, 0x00000000}, | ||
1070 | {0x0000a1e0, 0x00000000}, | ||
1071 | {0x0000a1e4, 0x00000000}, | ||
1072 | {0x0000a1e8, 0x00000000}, | ||
1073 | {0x0000a1ec, 0x00000000}, | ||
1074 | {0x0000a1f0, 0x00000396}, | ||
1075 | {0x0000a1f4, 0x00000396}, | ||
1076 | {0x0000a1f8, 0x00000396}, | ||
1077 | {0x0000a1fc, 0x00000296}, | ||
1078 | }; | ||
1079 | 241 | ||
1080 | #endif /* INITVALS_9330_1P2_H */ | 242 | #endif /* INITVALS_9330_1P2_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h index 815a8af1beef..1d8235e19f0f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
@@ -18,16 +19,16 @@ | |||
18 | #define INITVALS_9340_H | 19 | #define INITVALS_9340_H |
19 | 20 | ||
20 | static const u32 ar9340_1p0_radio_postamble[][5] = { | 21 | static const u32 ar9340_1p0_radio_postamble[][5] = { |
21 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 22 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
22 | {0x000160ac, 0xa4646800, 0xa4646800, 0xa4646800, 0xa4646800}, | 23 | {0x000160ac, 0xa4646800, 0xa4646800, 0xa4646800, 0xa4646800}, |
23 | {0x0001610c, 0x08000000, 0x08000000, 0x00000000, 0x00000000}, | 24 | {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, |
24 | {0x00016140, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, | 25 | {0x00016140, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, |
25 | {0x0001650c, 0x08000000, 0x08000000, 0x00000000, 0x00000000}, | 26 | {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, |
26 | {0x00016540, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, | 27 | {0x00016540, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, |
27 | }; | 28 | }; |
28 | 29 | ||
29 | static const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5] = { | 30 | static const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5] = { |
30 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 31 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
31 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 32 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
32 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 33 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
33 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 34 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
@@ -99,21 +100,10 @@ static const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5] = { | |||
99 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | 100 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, |
100 | }; | 101 | }; |
101 | 102 | ||
102 | static const u32 ar9340Modes_fast_clock_1p0[][3] = { | 103 | #define ar9340Modes_fast_clock_1p0 ar9300Modes_fast_clock_2p2 |
103 | /* Addr 5G_HT20 5G_HT40 */ | ||
104 | {0x00001030, 0x00000268, 0x000004d0}, | ||
105 | {0x00001070, 0x0000018c, 0x00000318}, | ||
106 | {0x000010b0, 0x00000fd0, 0x00001fa0}, | ||
107 | {0x00008014, 0x044c044c, 0x08980898}, | ||
108 | {0x0000801c, 0x148ec02b, 0x148ec057}, | ||
109 | {0x00008318, 0x000044c0, 0x00008980}, | ||
110 | {0x00009e00, 0x03721821, 0x03721821}, | ||
111 | {0x0000a230, 0x0000000b, 0x00000016}, | ||
112 | {0x0000a254, 0x00000898, 0x00001130}, | ||
113 | }; | ||
114 | 104 | ||
115 | static const u32 ar9340_1p0_radio_core[][2] = { | 105 | static const u32 ar9340_1p0_radio_core[][2] = { |
116 | /* Addr allmodes */ | 106 | /* Addr allmodes */ |
117 | {0x00016000, 0x36db6db6}, | 107 | {0x00016000, 0x36db6db6}, |
118 | {0x00016004, 0x6db6db40}, | 108 | {0x00016004, 0x6db6db40}, |
119 | {0x00016008, 0x73f00000}, | 109 | {0x00016008, 0x73f00000}, |
@@ -146,15 +136,13 @@ static const u32 ar9340_1p0_radio_core[][2] = { | |||
146 | {0x00016100, 0x04cb0001}, | 136 | {0x00016100, 0x04cb0001}, |
147 | {0x00016104, 0xfff80000}, | 137 | {0x00016104, 0xfff80000}, |
148 | {0x00016108, 0x00080010}, | 138 | {0x00016108, 0x00080010}, |
149 | {0x0001610c, 0x00000000}, | ||
150 | {0x00016140, 0x50804008}, | 139 | {0x00016140, 0x50804008}, |
151 | {0x00016144, 0x01884080}, | 140 | {0x00016144, 0x01884080}, |
152 | {0x00016148, 0x000080c0}, | 141 | {0x00016148, 0x000080c0}, |
153 | {0x00016280, 0x01000015}, | 142 | {0x00016280, 0x01000015}, |
154 | {0x00016284, 0x05530000}, | 143 | {0x00016284, 0x15530000}, |
155 | {0x00016288, 0x00318000}, | 144 | {0x00016288, 0x00318000}, |
156 | {0x0001628c, 0x50000000}, | 145 | {0x0001628c, 0x50000000}, |
157 | {0x00016290, 0x4080294f}, | ||
158 | {0x00016380, 0x00000000}, | 146 | {0x00016380, 0x00000000}, |
159 | {0x00016384, 0x00000000}, | 147 | {0x00016384, 0x00000000}, |
160 | {0x00016388, 0x00800700}, | 148 | {0x00016388, 0x00800700}, |
@@ -219,52 +207,43 @@ static const u32 ar9340_1p0_radio_core[][2] = { | |||
219 | }; | 207 | }; |
220 | 208 | ||
221 | static const u32 ar9340_1p0_radio_core_40M[][2] = { | 209 | static const u32 ar9340_1p0_radio_core_40M[][2] = { |
210 | /* Addr allmodes */ | ||
222 | {0x0001609c, 0x02566f3a}, | 211 | {0x0001609c, 0x02566f3a}, |
223 | {0x000160ac, 0xa4647c00}, | 212 | {0x000160ac, 0xa4647c00}, |
224 | {0x000160b0, 0x01885f5a}, | 213 | {0x000160b0, 0x01885f5a}, |
225 | }; | 214 | }; |
226 | 215 | ||
227 | static const u32 ar9340_1p0_mac_postamble[][5] = { | 216 | #define ar9340_1p0_mac_postamble ar9300_2p2_mac_postamble |
228 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
229 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | ||
230 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | ||
231 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | ||
232 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | ||
233 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | ||
234 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | ||
235 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | ||
236 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | ||
237 | }; | ||
238 | 217 | ||
239 | static const u32 ar9340_1p0_soc_postamble[][5] = { | 218 | #define ar9340_1p0_soc_postamble ar9300_2p2_soc_postamble |
240 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
241 | {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, | ||
242 | }; | ||
243 | 219 | ||
244 | static const u32 ar9340_1p0_baseband_postamble[][5] = { | 220 | static const u32 ar9340_1p0_baseband_postamble[][5] = { |
245 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 221 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
246 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, | 222 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, |
247 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a022e, 0x206a022e}, | 223 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a022e, 0x206a022e}, |
248 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | 224 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, |
249 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, | 225 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, |
250 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | 226 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
251 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, | 227 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, |
252 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, | 228 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, |
253 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | 229 | {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, |
254 | {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, | 230 | {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, |
255 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, | 231 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, |
256 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e}, | 232 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e}, |
257 | {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, | 233 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, |
258 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 234 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
259 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 235 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
260 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 236 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, |
261 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 237 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
238 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, | ||
262 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, | 239 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, |
263 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, | 240 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, |
264 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | 241 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
265 | {0x0000a204, 0x00003fc0, 0x00003fc4, 0x00003fc4, 0x00003fc0}, | 242 | {0x0000a204, 0x00003ec0, 0x00003ec4, 0x00003ec4, 0x00003ec0}, |
266 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, | 243 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, |
244 | {0x0000a22c, 0x07e26a2f, 0x07e26a2f, 0x01026a2f, 0x01026a2f}, | ||
267 | {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, | 245 | {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, |
246 | {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, | ||
268 | {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, | 247 | {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, |
269 | {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, | 248 | {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, |
270 | {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, | 249 | {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, |
@@ -277,11 +256,11 @@ static const u32 ar9340_1p0_baseband_postamble[][5] = { | |||
277 | {0x0000a288, 0x00000220, 0x00000220, 0x00000110, 0x00000110}, | 256 | {0x0000a288, 0x00000220, 0x00000220, 0x00000110, 0x00000110}, |
278 | {0x0000a28c, 0x00011111, 0x00011111, 0x00022222, 0x00022222}, | 257 | {0x0000a28c, 0x00011111, 0x00011111, 0x00022222, 0x00022222}, |
279 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | 258 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, |
280 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, | 259 | {0x0000a2d0, 0x00041983, 0x00041983, 0x00041982, 0x00041982}, |
281 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | 260 | {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, |
282 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 261 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
283 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 262 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
284 | {0x0000ae04, 0x00180000, 0x00180000, 0x00180000, 0x00180000}, | 263 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, |
285 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 264 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
286 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 265 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
287 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | 266 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, |
@@ -289,21 +268,21 @@ static const u32 ar9340_1p0_baseband_postamble[][5] = { | |||
289 | }; | 268 | }; |
290 | 269 | ||
291 | static const u32 ar9340_1p0_baseband_core[][2] = { | 270 | static const u32 ar9340_1p0_baseband_core[][2] = { |
292 | /* Addr allmodes */ | 271 | /* Addr allmodes */ |
293 | {0x00009800, 0xafe68e30}, | 272 | {0x00009800, 0xafe68e30}, |
294 | {0x00009804, 0xfd14e000}, | 273 | {0x00009804, 0xfd14e000}, |
295 | {0x00009808, 0x9c0a9f6b}, | 274 | {0x00009808, 0x9c0a9f6b}, |
296 | {0x0000980c, 0x04900000}, | 275 | {0x0000980c, 0x04900000}, |
297 | {0x00009814, 0xb280c00a}, | 276 | {0x00009814, 0x3280c00a}, |
298 | {0x00009818, 0x00000000}, | 277 | {0x00009818, 0x00000000}, |
299 | {0x0000981c, 0x00020028}, | 278 | {0x0000981c, 0x00020028}, |
300 | {0x00009834, 0x5f3ca3de}, | 279 | {0x00009834, 0x6400a190}, |
301 | {0x00009838, 0x0108ecff}, | 280 | {0x00009838, 0x0108ecff}, |
302 | {0x0000983c, 0x14750600}, | 281 | {0x0000983c, 0x14000600}, |
303 | {0x00009880, 0x201fff00}, | 282 | {0x00009880, 0x201fff00}, |
304 | {0x00009884, 0x00001042}, | 283 | {0x00009884, 0x00001042}, |
305 | {0x000098a4, 0x00200400}, | 284 | {0x000098a4, 0x00200400}, |
306 | {0x000098b0, 0x52440bbe}, | 285 | {0x000098b0, 0x32840bbe}, |
307 | {0x000098d0, 0x004b6a8e}, | 286 | {0x000098d0, 0x004b6a8e}, |
308 | {0x000098d4, 0x00000820}, | 287 | {0x000098d4, 0x00000820}, |
309 | {0x000098dc, 0x00000000}, | 288 | {0x000098dc, 0x00000000}, |
@@ -329,7 +308,6 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
329 | {0x00009e30, 0x06336f77}, | 308 | {0x00009e30, 0x06336f77}, |
330 | {0x00009e34, 0x6af6532f}, | 309 | {0x00009e34, 0x6af6532f}, |
331 | {0x00009e38, 0x0cc80c00}, | 310 | {0x00009e38, 0x0cc80c00}, |
332 | {0x00009e3c, 0xcf946222}, | ||
333 | {0x00009e40, 0x0d261820}, | 311 | {0x00009e40, 0x0d261820}, |
334 | {0x00009e4c, 0x00001004}, | 312 | {0x00009e4c, 0x00001004}, |
335 | {0x00009e50, 0x00ff03f1}, | 313 | {0x00009e50, 0x00ff03f1}, |
@@ -342,8 +320,6 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
342 | {0x0000a220, 0x00000000}, | 320 | {0x0000a220, 0x00000000}, |
343 | {0x0000a224, 0x00000000}, | 321 | {0x0000a224, 0x00000000}, |
344 | {0x0000a228, 0x10002310}, | 322 | {0x0000a228, 0x10002310}, |
345 | {0x0000a22c, 0x01036a1e}, | ||
346 | {0x0000a234, 0x10000fff}, | ||
347 | {0x0000a23c, 0x00000000}, | 323 | {0x0000a23c, 0x00000000}, |
348 | {0x0000a244, 0x0c000000}, | 324 | {0x0000a244, 0x0c000000}, |
349 | {0x0000a2a0, 0x00000001}, | 325 | {0x0000a2a0, 0x00000001}, |
@@ -351,10 +327,6 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
351 | {0x0000a2c8, 0x00000000}, | 327 | {0x0000a2c8, 0x00000000}, |
352 | {0x0000a2cc, 0x18c43433}, | 328 | {0x0000a2cc, 0x18c43433}, |
353 | {0x0000a2d4, 0x00000000}, | 329 | {0x0000a2d4, 0x00000000}, |
354 | {0x0000a2dc, 0x00000000}, | ||
355 | {0x0000a2e0, 0x00000000}, | ||
356 | {0x0000a2e4, 0x00000000}, | ||
357 | {0x0000a2e8, 0x00000000}, | ||
358 | {0x0000a2ec, 0x00000000}, | 330 | {0x0000a2ec, 0x00000000}, |
359 | {0x0000a2f0, 0x00000000}, | 331 | {0x0000a2f0, 0x00000000}, |
360 | {0x0000a2f4, 0x00000000}, | 332 | {0x0000a2f4, 0x00000000}, |
@@ -385,7 +357,7 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
385 | {0x0000a3e8, 0x20202020}, | 357 | {0x0000a3e8, 0x20202020}, |
386 | {0x0000a3ec, 0x20202020}, | 358 | {0x0000a3ec, 0x20202020}, |
387 | {0x0000a3f0, 0x00000000}, | 359 | {0x0000a3f0, 0x00000000}, |
388 | {0x0000a3f4, 0x00000246}, | 360 | {0x0000a3f4, 0x00000000}, |
389 | {0x0000a3f8, 0x0cdbd380}, | 361 | {0x0000a3f8, 0x0cdbd380}, |
390 | {0x0000a3fc, 0x000f0f01}, | 362 | {0x0000a3fc, 0x000f0f01}, |
391 | {0x0000a400, 0x8fa91f01}, | 363 | {0x0000a400, 0x8fa91f01}, |
@@ -402,33 +374,17 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
402 | {0x0000a430, 0x1ce739ce}, | 374 | {0x0000a430, 0x1ce739ce}, |
403 | {0x0000a434, 0x00000000}, | 375 | {0x0000a434, 0x00000000}, |
404 | {0x0000a438, 0x00001801}, | 376 | {0x0000a438, 0x00001801}, |
405 | {0x0000a43c, 0x00000000}, | 377 | {0x0000a43c, 0x00100000}, |
406 | {0x0000a440, 0x00000000}, | 378 | {0x0000a440, 0x00000000}, |
407 | {0x0000a444, 0x00000000}, | 379 | {0x0000a444, 0x00000000}, |
408 | {0x0000a448, 0x04000080}, | 380 | {0x0000a448, 0x05000080}, |
409 | {0x0000a44c, 0x00000001}, | 381 | {0x0000a44c, 0x00000001}, |
410 | {0x0000a450, 0x00010000}, | 382 | {0x0000a450, 0x00010000}, |
411 | {0x0000a458, 0x00000000}, | 383 | {0x0000a458, 0x00000000}, |
412 | {0x0000a600, 0x00000000}, | ||
413 | {0x0000a604, 0x00000000}, | ||
414 | {0x0000a608, 0x00000000}, | ||
415 | {0x0000a60c, 0x00000000}, | ||
416 | {0x0000a610, 0x00000000}, | ||
417 | {0x0000a614, 0x00000000}, | ||
418 | {0x0000a618, 0x00000000}, | ||
419 | {0x0000a61c, 0x00000000}, | ||
420 | {0x0000a620, 0x00000000}, | ||
421 | {0x0000a624, 0x00000000}, | ||
422 | {0x0000a628, 0x00000000}, | ||
423 | {0x0000a62c, 0x00000000}, | ||
424 | {0x0000a630, 0x00000000}, | ||
425 | {0x0000a634, 0x00000000}, | ||
426 | {0x0000a638, 0x00000000}, | ||
427 | {0x0000a63c, 0x00000000}, | ||
428 | {0x0000a640, 0x00000000}, | 384 | {0x0000a640, 0x00000000}, |
429 | {0x0000a644, 0x3fad9d74}, | 385 | {0x0000a644, 0x3fad9d74}, |
430 | {0x0000a648, 0x0048060a}, | 386 | {0x0000a648, 0x0048060a}, |
431 | {0x0000a64c, 0x00000637}, | 387 | {0x0000a64c, 0x00003c37}, |
432 | {0x0000a670, 0x03020100}, | 388 | {0x0000a670, 0x03020100}, |
433 | {0x0000a674, 0x09080504}, | 389 | {0x0000a674, 0x09080504}, |
434 | {0x0000a678, 0x0d0c0b0a}, | 390 | {0x0000a678, 0x0d0c0b0a}, |
@@ -451,10 +407,6 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
451 | {0x0000a8f4, 0x00000000}, | 407 | {0x0000a8f4, 0x00000000}, |
452 | {0x0000b2d0, 0x00000080}, | 408 | {0x0000b2d0, 0x00000080}, |
453 | {0x0000b2d4, 0x00000000}, | 409 | {0x0000b2d4, 0x00000000}, |
454 | {0x0000b2dc, 0x00000000}, | ||
455 | {0x0000b2e0, 0x00000000}, | ||
456 | {0x0000b2e4, 0x00000000}, | ||
457 | {0x0000b2e8, 0x00000000}, | ||
458 | {0x0000b2ec, 0x00000000}, | 410 | {0x0000b2ec, 0x00000000}, |
459 | {0x0000b2f0, 0x00000000}, | 411 | {0x0000b2f0, 0x00000000}, |
460 | {0x0000b2f4, 0x00000000}, | 412 | {0x0000b2f4, 0x00000000}, |
@@ -465,80 +417,108 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
465 | }; | 417 | }; |
466 | 418 | ||
467 | static const u32 ar9340Modes_high_power_tx_gain_table_1p0[][5] = { | 419 | static const u32 ar9340Modes_high_power_tx_gain_table_1p0[][5] = { |
468 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 420 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
421 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
422 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
423 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
424 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
425 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
426 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
427 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
428 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
429 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
430 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
431 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
432 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
433 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
434 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
435 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
436 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
437 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
438 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
439 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
440 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
441 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
442 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
443 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
444 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
469 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | 445 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
470 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 446 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
471 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | 447 | {0x0000a504, 0x04002222, 0x04002222, 0x02000001, 0x02000001}, |
472 | {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | 448 | {0x0000a508, 0x09002421, 0x09002421, 0x05000003, 0x05000003}, |
473 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | 449 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0a000005, 0x0a000005}, |
474 | {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | 450 | {0x0000a510, 0x13004620, 0x13004620, 0x0e000201, 0x0e000201}, |
475 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | 451 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000203, 0x11000203}, |
476 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | 452 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x14000401, 0x14000401}, |
477 | {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | 453 | {0x0000a51c, 0x21005420, 0x21005420, 0x18000403, 0x18000403}, |
478 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | 454 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000602, 0x1b000602}, |
479 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | 455 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000802, 0x1f000802}, |
480 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | 456 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x21000620, 0x21000620}, |
481 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | 457 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x25000820, 0x25000820}, |
482 | {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | 458 | {0x0000a530, 0x38005e65, 0x38005e65, 0x29000822, 0x29000822}, |
483 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | 459 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2d000824, 0x2d000824}, |
484 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | 460 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x30000828, 0x30000828}, |
485 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | 461 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x3400082a, 0x3400082a}, |
486 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | 462 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38000849, 0x38000849}, |
487 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | 463 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b000a2c, 0x3b000a2c}, |
488 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | 464 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e000e2b, 0x3e000e2b}, |
489 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | 465 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42000e2d, 0x42000e2d}, |
490 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | 466 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x4500124a, 0x4500124a}, |
491 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | 467 | {0x0000a554, 0x61027f12, 0x61027f12, 0x4900124c, 0x4900124c}, |
492 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | 468 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c00126c, 0x4c00126c}, |
493 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | 469 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x4f00128c, 0x4f00128c}, |
494 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | 470 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x52001290, 0x52001290}, |
495 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 471 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
496 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 472 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
497 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 473 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
498 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 474 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
499 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 475 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
500 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 476 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
501 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | 477 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, |
502 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | 478 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, |
503 | {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | 479 | {0x0000a584, 0x04802222, 0x04802222, 0x02800001, 0x02800001}, |
504 | {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | 480 | {0x0000a588, 0x09802421, 0x09802421, 0x05800003, 0x05800003}, |
505 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | 481 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0a800005, 0x0a800005}, |
506 | {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | 482 | {0x0000a590, 0x13804620, 0x13804620, 0x0e800201, 0x0e800201}, |
507 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | 483 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800203, 0x11800203}, |
508 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | 484 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x14800401, 0x14800401}, |
509 | {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | 485 | {0x0000a59c, 0x21805420, 0x21805420, 0x18800403, 0x18800403}, |
510 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | 486 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800602, 0x1b800602}, |
511 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | 487 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800802, 0x1f800802}, |
512 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | 488 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x21800620, 0x21800620}, |
513 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | 489 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x25800820, 0x25800820}, |
514 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | 490 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x29800822, 0x29800822}, |
515 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | 491 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2d800824, 0x2d800824}, |
516 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | 492 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x30800828, 0x30800828}, |
517 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | 493 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x3480082a, 0x3480082a}, |
518 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | 494 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38800849, 0x38800849}, |
519 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | 495 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b800a2c, 0x3b800a2c}, |
520 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | 496 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e800e2b, 0x3e800e2b}, |
521 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | 497 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42800e2d, 0x42800e2d}, |
522 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | 498 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x4580124a, 0x4580124a}, |
523 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | 499 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x4980124c, 0x4980124c}, |
524 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | 500 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c80126c, 0x4c80126c}, |
525 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | 501 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x4f80128c, 0x4f80128c}, |
526 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | 502 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x52801290, 0x52801290}, |
527 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 503 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
528 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 504 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
529 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 505 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
530 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 506 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
531 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 507 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
532 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 508 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
533 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 509 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, |
534 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | 510 | {0x00016044, 0x056db2db, 0x056db2db, 0x022492db, 0x022492db}, |
535 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | 511 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, |
536 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | 512 | {0x00016444, 0x056db2db, 0x056db2db, 0x022492db, 0x022492db}, |
537 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | 513 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, |
538 | }; | 514 | }; |
539 | 515 | ||
540 | static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { | 516 | static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { |
541 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 517 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
518 | {0x0000a2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, | ||
519 | {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, | ||
520 | {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, | ||
521 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
542 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | 522 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
543 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 523 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
544 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | 524 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
@@ -559,7 +539,7 @@ static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { | |||
559 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | 539 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
560 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | 540 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
561 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | 541 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
562 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | 542 | {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
563 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | 543 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
564 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | 544 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
565 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | 545 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
@@ -604,13 +584,43 @@ static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { | |||
604 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 584 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
605 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 585 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
606 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 586 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
587 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
588 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
589 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
590 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
591 | {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
592 | {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
593 | {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
594 | {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
595 | {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
596 | {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
597 | {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
598 | {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
599 | {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
600 | {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
601 | {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
602 | {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
603 | {0x0000b2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, | ||
604 | {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, | ||
605 | {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, | ||
606 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
607 | {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, | 607 | {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, |
608 | {0x00016048, 0x8e481266, 0x8e481266, 0x8e481266, 0x8e481266}, | 608 | {0x00016048, 0x8e481666, 0x8e481666, 0x8e481266, 0x8e481266}, |
609 | {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, | ||
609 | {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, | 610 | {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, |
610 | {0x00016448, 0x8e481266, 0x8e481266, 0x8e481266, 0x8e481266}, | 611 | {0x00016448, 0x8e481666, 0x8e481666, 0x8e481266, 0x8e481266}, |
611 | }; | 612 | }; |
613 | |||
612 | static const u32 ar9340Modes_ub124_tx_gain_table_1p0[][5] = { | 614 | static const u32 ar9340Modes_ub124_tx_gain_table_1p0[][5] = { |
613 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 615 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
616 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, | ||
617 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a00ae, 0x206a00ae}, | ||
618 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, | ||
619 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec82d2e, 0x7ec82d2e}, | ||
620 | {0x0000a2dc, 0xfef5d402, 0xfef5d402, 0xfdab5b52, 0xfdab5b52}, | ||
621 | {0x0000a2e0, 0xfe896600, 0xfe896600, 0xfd339c84, 0xfd339c84}, | ||
622 | {0x0000a2e4, 0xff01f800, 0xff01f800, 0xfec3e000, 0xfec3e000}, | ||
623 | {0x0000a2e8, 0xfffe0000, 0xfffe0000, 0xfffc0000, 0xfffc0000}, | ||
614 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | 624 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
615 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 625 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
616 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | 626 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
@@ -676,15 +686,34 @@ static const u32 ar9340Modes_ub124_tx_gain_table_1p0[][5] = { | |||
676 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 686 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
677 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 687 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
678 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 688 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
679 | {0x00016044, 0x036db2db, 0x036db2db, 0x036db2db, 0x036db2db}, | 689 | {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, |
680 | {0x00016048, 0x69b65266, 0x69b65266, 0x69b65266, 0x69b65266}, | 690 | {0x00016048, 0x8e480086, 0x8e480086, 0x8e480086, 0x8e480086}, |
681 | {0x00016444, 0x036db2db, 0x036db2db, 0x036db2db, 0x036db2db}, | 691 | {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, |
682 | {0x00016448, 0x69b65266, 0x69b65266, 0x69b65266, 0x69b65266}, | 692 | {0x00016448, 0x8e480086, 0x8e480086, 0x8e480086, 0x8e480086}, |
693 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
694 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
695 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
696 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
697 | {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
698 | {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
699 | {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
700 | {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
701 | {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
702 | {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
703 | {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
704 | {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
705 | {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
706 | {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
707 | {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
708 | {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
709 | {0x0000b2dc, 0xfef5d402, 0xfef5d402, 0xfdab5b52, 0xfdab5b52}, | ||
710 | {0x0000b2e0, 0xfe896600, 0xfe896600, 0xfd339c84, 0xfd339c84}, | ||
711 | {0x0000b2e4, 0xff01f800, 0xff01f800, 0xfec3e000, 0xfec3e000}, | ||
712 | {0x0000b2e8, 0xfffe0000, 0xfffe0000, 0xfffc0000, 0xfffc0000}, | ||
683 | }; | 713 | }; |
684 | 714 | ||
685 | |||
686 | static const u32 ar9340Common_rx_gain_table_1p0[][2] = { | 715 | static const u32 ar9340Common_rx_gain_table_1p0[][2] = { |
687 | /* Addr allmodes */ | 716 | /* Addr allmodes */ |
688 | {0x0000a000, 0x00010000}, | 717 | {0x0000a000, 0x00010000}, |
689 | {0x0000a004, 0x00030002}, | 718 | {0x0000a004, 0x00030002}, |
690 | {0x0000a008, 0x00050004}, | 719 | {0x0000a008, 0x00050004}, |
@@ -845,14 +874,14 @@ static const u32 ar9340Common_rx_gain_table_1p0[][2] = { | |||
845 | {0x0000b074, 0x00000000}, | 874 | {0x0000b074, 0x00000000}, |
846 | {0x0000b078, 0x00000000}, | 875 | {0x0000b078, 0x00000000}, |
847 | {0x0000b07c, 0x00000000}, | 876 | {0x0000b07c, 0x00000000}, |
848 | {0x0000b080, 0x32323232}, | 877 | {0x0000b080, 0x23232323}, |
849 | {0x0000b084, 0x2f2f3232}, | 878 | {0x0000b084, 0x21232323}, |
850 | {0x0000b088, 0x23282a2d}, | 879 | {0x0000b088, 0x19191c1e}, |
851 | {0x0000b08c, 0x1c1e2123}, | 880 | {0x0000b08c, 0x12141417}, |
852 | {0x0000b090, 0x14171919}, | 881 | {0x0000b090, 0x07070e0e}, |
853 | {0x0000b094, 0x0e0e1214}, | 882 | {0x0000b094, 0x03030305}, |
854 | {0x0000b098, 0x03050707}, | 883 | {0x0000b098, 0x00000003}, |
855 | {0x0000b09c, 0x00030303}, | 884 | {0x0000b09c, 0x00000000}, |
856 | {0x0000b0a0, 0x00000000}, | 885 | {0x0000b0a0, 0x00000000}, |
857 | {0x0000b0a4, 0x00000000}, | 886 | {0x0000b0a4, 0x00000000}, |
858 | {0x0000b0a8, 0x00000000}, | 887 | {0x0000b0a8, 0x00000000}, |
@@ -944,7 +973,11 @@ static const u32 ar9340Common_rx_gain_table_1p0[][2] = { | |||
944 | }; | 973 | }; |
945 | 974 | ||
946 | static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { | 975 | static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { |
947 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 976 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
977 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
978 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
979 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
980 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
948 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 981 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
949 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 982 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
950 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 983 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
@@ -952,8 +985,8 @@ static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { | |||
952 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | 985 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, |
953 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | 986 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, |
954 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, | 987 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, |
955 | {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, | 988 | {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, |
956 | {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, | 989 | {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, |
957 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, | 990 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, |
958 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, | 991 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, |
959 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, | 992 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, |
@@ -965,19 +998,19 @@ static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { | |||
965 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, | 998 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, |
966 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, | 999 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, |
967 | {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, | 1000 | {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, |
968 | {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, | 1001 | {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83}, |
969 | {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, | 1002 | {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84}, |
970 | {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, | 1003 | {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3}, |
971 | {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, | 1004 | {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5}, |
972 | {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, | 1005 | {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9}, |
973 | {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, | 1006 | {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb}, |
974 | {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1007 | {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
975 | {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1008 | {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
976 | {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1009 | {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
977 | {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1010 | {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
978 | {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1011 | {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
979 | {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1012 | {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
980 | {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | 1013 | {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, |
981 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 1014 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
982 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | 1015 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, |
983 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | 1016 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, |
@@ -1010,14 +1043,40 @@ static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { | |||
1010 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 1043 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
1011 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 1044 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
1012 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 1045 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
1046 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1047 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1048 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1049 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1050 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1051 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
1052 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
1053 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
1054 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
1055 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
1056 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
1057 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
1058 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1059 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1060 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1061 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1062 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
1063 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
1064 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
1065 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1013 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | 1066 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, |
1014 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | 1067 | {0x00016048, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, |
1068 | {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, | ||
1069 | {0x00016288, 0xf0318000, 0xf0318000, 0xf0318000, 0xf0318000}, | ||
1015 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | 1070 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, |
1016 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | 1071 | {0x00016448, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, |
1017 | }; | 1072 | }; |
1018 | 1073 | ||
1019 | static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { | 1074 | static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { |
1020 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 1075 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
1076 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
1077 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
1078 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
1079 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1021 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 1080 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
1022 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1081 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1023 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 1082 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
@@ -1025,8 +1084,8 @@ static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { | |||
1025 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | 1084 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, |
1026 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | 1085 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, |
1027 | {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, | 1086 | {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, |
1028 | {0x0000a518, 0x21020220, 0x21020220, 0x15000402, 0x15000402}, | 1087 | {0x0000a518, 0x21002220, 0x21002220, 0x15000402, 0x15000402}, |
1029 | {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, | 1088 | {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, |
1030 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, | 1089 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, |
1031 | {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, | 1090 | {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, |
1032 | {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, | 1091 | {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, |
@@ -1038,19 +1097,19 @@ static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { | |||
1038 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, | 1097 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, |
1039 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3b001861, 0x3b001861}, | 1098 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3b001861, 0x3b001861}, |
1040 | {0x0000a548, 0x5702286c, 0x5702286c, 0x3e001a81, 0x3e001a81}, | 1099 | {0x0000a548, 0x5702286c, 0x5702286c, 0x3e001a81, 0x3e001a81}, |
1041 | {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x42001a83, 0x42001a83}, | 1100 | {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x42001a83, 0x42001a83}, |
1042 | {0x0000a550, 0x61042a6c, 0x61042a6c, 0x44001c84, 0x44001c84}, | 1101 | {0x0000a550, 0x61024a6c, 0x61024a6c, 0x44001c84, 0x44001c84}, |
1043 | {0x0000a554, 0x66062a6c, 0x66062a6c, 0x48001ce3, 0x48001ce3}, | 1102 | {0x0000a554, 0x66026a6c, 0x66026a6c, 0x48001ce3, 0x48001ce3}, |
1044 | {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x4c001ce5, 0x4c001ce5}, | 1103 | {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x4c001ce5, 0x4c001ce5}, |
1045 | {0x0000a55c, 0x7006308c, 0x7006308c, 0x50001ce9, 0x50001ce9}, | 1104 | {0x0000a55c, 0x7002708c, 0x7002708c, 0x50001ce9, 0x50001ce9}, |
1046 | {0x0000a560, 0x730a308a, 0x730a308a, 0x54001ceb, 0x54001ceb}, | 1105 | {0x0000a560, 0x7302b08a, 0x7302b08a, 0x54001ceb, 0x54001ceb}, |
1047 | {0x0000a564, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1106 | {0x0000a564, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1048 | {0x0000a568, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1107 | {0x0000a568, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1049 | {0x0000a56c, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1108 | {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1050 | {0x0000a570, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1109 | {0x0000a570, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1051 | {0x0000a574, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1110 | {0x0000a574, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1052 | {0x0000a578, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1111 | {0x0000a578, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1053 | {0x0000a57c, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | 1112 | {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, |
1054 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 1113 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
1055 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | 1114 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, |
1056 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | 1115 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, |
@@ -1083,14 +1142,36 @@ static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { | |||
1083 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | 1142 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, |
1084 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | 1143 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, |
1085 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | 1144 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, |
1145 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1146 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1147 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1148 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1149 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1150 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
1151 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
1152 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
1153 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
1154 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
1155 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
1156 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
1157 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1158 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1159 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1160 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1161 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
1162 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
1163 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
1164 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1086 | {0x00016044, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, | 1165 | {0x00016044, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, |
1087 | {0x00016048, 0x24927266, 0x24927266, 0x8e483266, 0x8e483266}, | 1166 | {0x00016048, 0x24925666, 0x24925666, 0x8e481266, 0x8e481266}, |
1167 | {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, | ||
1168 | {0x00016288, 0x30318000, 0x30318000, 0x00318000, 0x00318000}, | ||
1088 | {0x00016444, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, | 1169 | {0x00016444, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, |
1089 | {0x00016448, 0x24927266, 0x24927266, 0x8e482266, 0x8e482266}, | 1170 | {0x00016448, 0x24925666, 0x24925666, 0x8e481266, 0x8e481266}, |
1090 | }; | 1171 | }; |
1091 | 1172 | ||
1092 | static const u32 ar9340_1p0_mac_core[][2] = { | 1173 | static const u32 ar9340_1p0_mac_core[][2] = { |
1093 | /* Addr allmodes */ | 1174 | /* Addr allmodes */ |
1094 | {0x00000008, 0x00000000}, | 1175 | {0x00000008, 0x00000000}, |
1095 | {0x00000030, 0x00020085}, | 1176 | {0x00000030, 0x00020085}, |
1096 | {0x00000034, 0x00000005}, | 1177 | {0x00000034, 0x00000005}, |
@@ -1119,6 +1200,7 @@ static const u32 ar9340_1p0_mac_core[][2] = { | |||
1119 | {0x00008004, 0x00000000}, | 1200 | {0x00008004, 0x00000000}, |
1120 | {0x00008008, 0x00000000}, | 1201 | {0x00008008, 0x00000000}, |
1121 | {0x0000800c, 0x00000000}, | 1202 | {0x0000800c, 0x00000000}, |
1203 | {0x00008010, 0x00080800}, | ||
1122 | {0x00008018, 0x00000000}, | 1204 | {0x00008018, 0x00000000}, |
1123 | {0x00008020, 0x00000000}, | 1205 | {0x00008020, 0x00000000}, |
1124 | {0x00008038, 0x00000000}, | 1206 | {0x00008038, 0x00000000}, |
@@ -1146,7 +1228,7 @@ static const u32 ar9340_1p0_mac_core[][2] = { | |||
1146 | {0x000080bc, 0x00000000}, | 1228 | {0x000080bc, 0x00000000}, |
1147 | {0x000080c0, 0x2a800000}, | 1229 | {0x000080c0, 0x2a800000}, |
1148 | {0x000080c4, 0x06900168}, | 1230 | {0x000080c4, 0x06900168}, |
1149 | {0x000080c8, 0x13881c20}, | 1231 | {0x000080c8, 0x13881c22}, |
1150 | {0x000080cc, 0x01f40000}, | 1232 | {0x000080cc, 0x01f40000}, |
1151 | {0x000080d0, 0x00252500}, | 1233 | {0x000080d0, 0x00252500}, |
1152 | {0x000080d4, 0x00a00000}, | 1234 | {0x000080d4, 0x00a00000}, |
@@ -1250,276 +1332,17 @@ static const u32 ar9340_1p0_mac_core[][2] = { | |||
1250 | {0x000083c4, 0x00000000}, | 1332 | {0x000083c4, 0x00000000}, |
1251 | {0x000083c8, 0x00000000}, | 1333 | {0x000083c8, 0x00000000}, |
1252 | {0x000083cc, 0x00000200}, | 1334 | {0x000083cc, 0x00000200}, |
1253 | {0x000083d0, 0x000301ff}, | 1335 | {0x000083d0, 0x000101ff}, |
1254 | }; | 1336 | }; |
1255 | 1337 | ||
1256 | static const u32 ar9340Common_wo_xlna_rx_gain_table_1p0[][2] = { | 1338 | #define ar9340Common_wo_xlna_rx_gain_table_1p0 ar9300Common_wo_xlna_rx_gain_table_2p2 |
1257 | /* Addr allmodes */ | ||
1258 | {0x0000a000, 0x00010000}, | ||
1259 | {0x0000a004, 0x00030002}, | ||
1260 | {0x0000a008, 0x00050004}, | ||
1261 | {0x0000a00c, 0x00810080}, | ||
1262 | {0x0000a010, 0x00830082}, | ||
1263 | {0x0000a014, 0x01810180}, | ||
1264 | {0x0000a018, 0x01830182}, | ||
1265 | {0x0000a01c, 0x01850184}, | ||
1266 | {0x0000a020, 0x01890188}, | ||
1267 | {0x0000a024, 0x018b018a}, | ||
1268 | {0x0000a028, 0x018d018c}, | ||
1269 | {0x0000a02c, 0x03820190}, | ||
1270 | {0x0000a030, 0x03840383}, | ||
1271 | {0x0000a034, 0x03880385}, | ||
1272 | {0x0000a038, 0x038a0389}, | ||
1273 | {0x0000a03c, 0x038c038b}, | ||
1274 | {0x0000a040, 0x0390038d}, | ||
1275 | {0x0000a044, 0x03920391}, | ||
1276 | {0x0000a048, 0x03940393}, | ||
1277 | {0x0000a04c, 0x03960395}, | ||
1278 | {0x0000a050, 0x00000000}, | ||
1279 | {0x0000a054, 0x00000000}, | ||
1280 | {0x0000a058, 0x00000000}, | ||
1281 | {0x0000a05c, 0x00000000}, | ||
1282 | {0x0000a060, 0x00000000}, | ||
1283 | {0x0000a064, 0x00000000}, | ||
1284 | {0x0000a068, 0x00000000}, | ||
1285 | {0x0000a06c, 0x00000000}, | ||
1286 | {0x0000a070, 0x00000000}, | ||
1287 | {0x0000a074, 0x00000000}, | ||
1288 | {0x0000a078, 0x00000000}, | ||
1289 | {0x0000a07c, 0x00000000}, | ||
1290 | {0x0000a080, 0x29292929}, | ||
1291 | {0x0000a084, 0x29292929}, | ||
1292 | {0x0000a088, 0x29292929}, | ||
1293 | {0x0000a08c, 0x29292929}, | ||
1294 | {0x0000a090, 0x22292929}, | ||
1295 | {0x0000a094, 0x1d1d2222}, | ||
1296 | {0x0000a098, 0x0c111117}, | ||
1297 | {0x0000a09c, 0x00030303}, | ||
1298 | {0x0000a0a0, 0x00000000}, | ||
1299 | {0x0000a0a4, 0x00000000}, | ||
1300 | {0x0000a0a8, 0x00000000}, | ||
1301 | {0x0000a0ac, 0x00000000}, | ||
1302 | {0x0000a0b0, 0x00000000}, | ||
1303 | {0x0000a0b4, 0x00000000}, | ||
1304 | {0x0000a0b8, 0x00000000}, | ||
1305 | {0x0000a0bc, 0x00000000}, | ||
1306 | {0x0000a0c0, 0x001f0000}, | ||
1307 | {0x0000a0c4, 0x01000101}, | ||
1308 | {0x0000a0c8, 0x011e011f}, | ||
1309 | {0x0000a0cc, 0x011c011d}, | ||
1310 | {0x0000a0d0, 0x02030204}, | ||
1311 | {0x0000a0d4, 0x02010202}, | ||
1312 | {0x0000a0d8, 0x021f0200}, | ||
1313 | {0x0000a0dc, 0x0302021e}, | ||
1314 | {0x0000a0e0, 0x03000301}, | ||
1315 | {0x0000a0e4, 0x031e031f}, | ||
1316 | {0x0000a0e8, 0x0402031d}, | ||
1317 | {0x0000a0ec, 0x04000401}, | ||
1318 | {0x0000a0f0, 0x041e041f}, | ||
1319 | {0x0000a0f4, 0x0502041d}, | ||
1320 | {0x0000a0f8, 0x05000501}, | ||
1321 | {0x0000a0fc, 0x051e051f}, | ||
1322 | {0x0000a100, 0x06010602}, | ||
1323 | {0x0000a104, 0x061f0600}, | ||
1324 | {0x0000a108, 0x061d061e}, | ||
1325 | {0x0000a10c, 0x07020703}, | ||
1326 | {0x0000a110, 0x07000701}, | ||
1327 | {0x0000a114, 0x00000000}, | ||
1328 | {0x0000a118, 0x00000000}, | ||
1329 | {0x0000a11c, 0x00000000}, | ||
1330 | {0x0000a120, 0x00000000}, | ||
1331 | {0x0000a124, 0x00000000}, | ||
1332 | {0x0000a128, 0x00000000}, | ||
1333 | {0x0000a12c, 0x00000000}, | ||
1334 | {0x0000a130, 0x00000000}, | ||
1335 | {0x0000a134, 0x00000000}, | ||
1336 | {0x0000a138, 0x00000000}, | ||
1337 | {0x0000a13c, 0x00000000}, | ||
1338 | {0x0000a140, 0x001f0000}, | ||
1339 | {0x0000a144, 0x01000101}, | ||
1340 | {0x0000a148, 0x011e011f}, | ||
1341 | {0x0000a14c, 0x011c011d}, | ||
1342 | {0x0000a150, 0x02030204}, | ||
1343 | {0x0000a154, 0x02010202}, | ||
1344 | {0x0000a158, 0x021f0200}, | ||
1345 | {0x0000a15c, 0x0302021e}, | ||
1346 | {0x0000a160, 0x03000301}, | ||
1347 | {0x0000a164, 0x031e031f}, | ||
1348 | {0x0000a168, 0x0402031d}, | ||
1349 | {0x0000a16c, 0x04000401}, | ||
1350 | {0x0000a170, 0x041e041f}, | ||
1351 | {0x0000a174, 0x0502041d}, | ||
1352 | {0x0000a178, 0x05000501}, | ||
1353 | {0x0000a17c, 0x051e051f}, | ||
1354 | {0x0000a180, 0x06010602}, | ||
1355 | {0x0000a184, 0x061f0600}, | ||
1356 | {0x0000a188, 0x061d061e}, | ||
1357 | {0x0000a18c, 0x07020703}, | ||
1358 | {0x0000a190, 0x07000701}, | ||
1359 | {0x0000a194, 0x00000000}, | ||
1360 | {0x0000a198, 0x00000000}, | ||
1361 | {0x0000a19c, 0x00000000}, | ||
1362 | {0x0000a1a0, 0x00000000}, | ||
1363 | {0x0000a1a4, 0x00000000}, | ||
1364 | {0x0000a1a8, 0x00000000}, | ||
1365 | {0x0000a1ac, 0x00000000}, | ||
1366 | {0x0000a1b0, 0x00000000}, | ||
1367 | {0x0000a1b4, 0x00000000}, | ||
1368 | {0x0000a1b8, 0x00000000}, | ||
1369 | {0x0000a1bc, 0x00000000}, | ||
1370 | {0x0000a1c0, 0x00000000}, | ||
1371 | {0x0000a1c4, 0x00000000}, | ||
1372 | {0x0000a1c8, 0x00000000}, | ||
1373 | {0x0000a1cc, 0x00000000}, | ||
1374 | {0x0000a1d0, 0x00000000}, | ||
1375 | {0x0000a1d4, 0x00000000}, | ||
1376 | {0x0000a1d8, 0x00000000}, | ||
1377 | {0x0000a1dc, 0x00000000}, | ||
1378 | {0x0000a1e0, 0x00000000}, | ||
1379 | {0x0000a1e4, 0x00000000}, | ||
1380 | {0x0000a1e8, 0x00000000}, | ||
1381 | {0x0000a1ec, 0x00000000}, | ||
1382 | {0x0000a1f0, 0x00000396}, | ||
1383 | {0x0000a1f4, 0x00000396}, | ||
1384 | {0x0000a1f8, 0x00000396}, | ||
1385 | {0x0000a1fc, 0x00000196}, | ||
1386 | {0x0000b000, 0x00010000}, | ||
1387 | {0x0000b004, 0x00030002}, | ||
1388 | {0x0000b008, 0x00050004}, | ||
1389 | {0x0000b00c, 0x00810080}, | ||
1390 | {0x0000b010, 0x00830082}, | ||
1391 | {0x0000b014, 0x01810180}, | ||
1392 | {0x0000b018, 0x01830182}, | ||
1393 | {0x0000b01c, 0x01850184}, | ||
1394 | {0x0000b020, 0x02810280}, | ||
1395 | {0x0000b024, 0x02830282}, | ||
1396 | {0x0000b028, 0x02850284}, | ||
1397 | {0x0000b02c, 0x02890288}, | ||
1398 | {0x0000b030, 0x028b028a}, | ||
1399 | {0x0000b034, 0x0388028c}, | ||
1400 | {0x0000b038, 0x038a0389}, | ||
1401 | {0x0000b03c, 0x038c038b}, | ||
1402 | {0x0000b040, 0x0390038d}, | ||
1403 | {0x0000b044, 0x03920391}, | ||
1404 | {0x0000b048, 0x03940393}, | ||
1405 | {0x0000b04c, 0x03960395}, | ||
1406 | {0x0000b050, 0x00000000}, | ||
1407 | {0x0000b054, 0x00000000}, | ||
1408 | {0x0000b058, 0x00000000}, | ||
1409 | {0x0000b05c, 0x00000000}, | ||
1410 | {0x0000b060, 0x00000000}, | ||
1411 | {0x0000b064, 0x00000000}, | ||
1412 | {0x0000b068, 0x00000000}, | ||
1413 | {0x0000b06c, 0x00000000}, | ||
1414 | {0x0000b070, 0x00000000}, | ||
1415 | {0x0000b074, 0x00000000}, | ||
1416 | {0x0000b078, 0x00000000}, | ||
1417 | {0x0000b07c, 0x00000000}, | ||
1418 | {0x0000b080, 0x32323232}, | ||
1419 | {0x0000b084, 0x2f2f3232}, | ||
1420 | {0x0000b088, 0x23282a2d}, | ||
1421 | {0x0000b08c, 0x1c1e2123}, | ||
1422 | {0x0000b090, 0x14171919}, | ||
1423 | {0x0000b094, 0x0e0e1214}, | ||
1424 | {0x0000b098, 0x03050707}, | ||
1425 | {0x0000b09c, 0x00030303}, | ||
1426 | {0x0000b0a0, 0x00000000}, | ||
1427 | {0x0000b0a4, 0x00000000}, | ||
1428 | {0x0000b0a8, 0x00000000}, | ||
1429 | {0x0000b0ac, 0x00000000}, | ||
1430 | {0x0000b0b0, 0x00000000}, | ||
1431 | {0x0000b0b4, 0x00000000}, | ||
1432 | {0x0000b0b8, 0x00000000}, | ||
1433 | {0x0000b0bc, 0x00000000}, | ||
1434 | {0x0000b0c0, 0x003f0020}, | ||
1435 | {0x0000b0c4, 0x00400041}, | ||
1436 | {0x0000b0c8, 0x0140005f}, | ||
1437 | {0x0000b0cc, 0x0160015f}, | ||
1438 | {0x0000b0d0, 0x017e017f}, | ||
1439 | {0x0000b0d4, 0x02410242}, | ||
1440 | {0x0000b0d8, 0x025f0240}, | ||
1441 | {0x0000b0dc, 0x027f0260}, | ||
1442 | {0x0000b0e0, 0x0341027e}, | ||
1443 | {0x0000b0e4, 0x035f0340}, | ||
1444 | {0x0000b0e8, 0x037f0360}, | ||
1445 | {0x0000b0ec, 0x04400441}, | ||
1446 | {0x0000b0f0, 0x0460045f}, | ||
1447 | {0x0000b0f4, 0x0541047f}, | ||
1448 | {0x0000b0f8, 0x055f0540}, | ||
1449 | {0x0000b0fc, 0x057f0560}, | ||
1450 | {0x0000b100, 0x06400641}, | ||
1451 | {0x0000b104, 0x0660065f}, | ||
1452 | {0x0000b108, 0x067e067f}, | ||
1453 | {0x0000b10c, 0x07410742}, | ||
1454 | {0x0000b110, 0x075f0740}, | ||
1455 | {0x0000b114, 0x077f0760}, | ||
1456 | {0x0000b118, 0x07800781}, | ||
1457 | {0x0000b11c, 0x07a0079f}, | ||
1458 | {0x0000b120, 0x07c107bf}, | ||
1459 | {0x0000b124, 0x000007c0}, | ||
1460 | {0x0000b128, 0x00000000}, | ||
1461 | {0x0000b12c, 0x00000000}, | ||
1462 | {0x0000b130, 0x00000000}, | ||
1463 | {0x0000b134, 0x00000000}, | ||
1464 | {0x0000b138, 0x00000000}, | ||
1465 | {0x0000b13c, 0x00000000}, | ||
1466 | {0x0000b140, 0x003f0020}, | ||
1467 | {0x0000b144, 0x00400041}, | ||
1468 | {0x0000b148, 0x0140005f}, | ||
1469 | {0x0000b14c, 0x0160015f}, | ||
1470 | {0x0000b150, 0x017e017f}, | ||
1471 | {0x0000b154, 0x02410242}, | ||
1472 | {0x0000b158, 0x025f0240}, | ||
1473 | {0x0000b15c, 0x027f0260}, | ||
1474 | {0x0000b160, 0x0341027e}, | ||
1475 | {0x0000b164, 0x035f0340}, | ||
1476 | {0x0000b168, 0x037f0360}, | ||
1477 | {0x0000b16c, 0x04400441}, | ||
1478 | {0x0000b170, 0x0460045f}, | ||
1479 | {0x0000b174, 0x0541047f}, | ||
1480 | {0x0000b178, 0x055f0540}, | ||
1481 | {0x0000b17c, 0x057f0560}, | ||
1482 | {0x0000b180, 0x06400641}, | ||
1483 | {0x0000b184, 0x0660065f}, | ||
1484 | {0x0000b188, 0x067e067f}, | ||
1485 | {0x0000b18c, 0x07410742}, | ||
1486 | {0x0000b190, 0x075f0740}, | ||
1487 | {0x0000b194, 0x077f0760}, | ||
1488 | {0x0000b198, 0x07800781}, | ||
1489 | {0x0000b19c, 0x07a0079f}, | ||
1490 | {0x0000b1a0, 0x07c107bf}, | ||
1491 | {0x0000b1a4, 0x000007c0}, | ||
1492 | {0x0000b1a8, 0x00000000}, | ||
1493 | {0x0000b1ac, 0x00000000}, | ||
1494 | {0x0000b1b0, 0x00000000}, | ||
1495 | {0x0000b1b4, 0x00000000}, | ||
1496 | {0x0000b1b8, 0x00000000}, | ||
1497 | {0x0000b1bc, 0x00000000}, | ||
1498 | {0x0000b1c0, 0x00000000}, | ||
1499 | {0x0000b1c4, 0x00000000}, | ||
1500 | {0x0000b1c8, 0x00000000}, | ||
1501 | {0x0000b1cc, 0x00000000}, | ||
1502 | {0x0000b1d0, 0x00000000}, | ||
1503 | {0x0000b1d4, 0x00000000}, | ||
1504 | {0x0000b1d8, 0x00000000}, | ||
1505 | {0x0000b1dc, 0x00000000}, | ||
1506 | {0x0000b1e0, 0x00000000}, | ||
1507 | {0x0000b1e4, 0x00000000}, | ||
1508 | {0x0000b1e8, 0x00000000}, | ||
1509 | {0x0000b1ec, 0x00000000}, | ||
1510 | {0x0000b1f0, 0x00000396}, | ||
1511 | {0x0000b1f4, 0x00000396}, | ||
1512 | {0x0000b1f8, 0x00000396}, | ||
1513 | {0x0000b1fc, 0x00000196}, | ||
1514 | }; | ||
1515 | 1339 | ||
1516 | static const u32 ar9340_1p0_soc_preamble[][2] = { | 1340 | static const u32 ar9340_1p0_soc_preamble[][2] = { |
1517 | /* Addr allmodes */ | 1341 | /* Addr allmodes */ |
1518 | {0x000040a4, 0x00a0c1c9}, | ||
1519 | {0x00007008, 0x00000000}, | 1342 | {0x00007008, 0x00000000}, |
1520 | {0x00007020, 0x00000000}, | 1343 | {0x00007020, 0x00000000}, |
1521 | {0x00007034, 0x00000002}, | 1344 | {0x00007034, 0x00000002}, |
1522 | {0x00007038, 0x000004c2}, | 1345 | {0x00007038, 0x000004c2}, |
1523 | }; | 1346 | }; |
1524 | 1347 | ||
1525 | #endif | 1348 | #endif /* INITVALS_9340_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h index 8f406ff2c95e..4ef7dcccaa2f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
@@ -61,7 +62,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = { | |||
61 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, | 62 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, |
62 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, | 63 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, |
63 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | 64 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
64 | {0x0000a204, 0x013187c0, 0x013187c4, 0x013187c4, 0x013187c0}, | 65 | {0x0000a204, 0x01318fc0, 0x01318fc4, 0x01318fc4, 0x01318fc0}, |
65 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, | 66 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, |
66 | {0x0000a22c, 0x01026a2f, 0x01026a27, 0x01026a2f, 0x01026a2f}, | 67 | {0x0000a22c, 0x01026a2f, 0x01026a27, 0x01026a2f, 0x01026a2f}, |
67 | {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, | 68 | {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, |
@@ -1007,7 +1008,7 @@ static const u32 ar9462_2p0_radio_core[][2] = { | |||
1007 | 1008 | ||
1008 | static const u32 ar9462_2p0_soc_preamble[][2] = { | 1009 | static const u32 ar9462_2p0_soc_preamble[][2] = { |
1009 | /* Addr allmodes */ | 1010 | /* Addr allmodes */ |
1010 | {0x000040a4 ,0x00a0c1c9}, | 1011 | {0x000040a4, 0x00a0c1c9}, |
1011 | {0x00007020, 0x00000000}, | 1012 | {0x00007020, 0x00000000}, |
1012 | {0x00007034, 0x00000002}, | 1013 | {0x00007034, 0x00000002}, |
1013 | {0x00007038, 0x000004c2}, | 1014 | {0x00007038, 0x000004c2}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h index d16d029f81a9..fb4497fc7a3d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010-2011 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
@@ -17,360 +18,151 @@ | |||
17 | #ifndef INITVALS_9485_H | 18 | #ifndef INITVALS_9485_H |
18 | #define INITVALS_9485_H | 19 | #define INITVALS_9485_H |
19 | 20 | ||
20 | static const u32 ar9485_1_1_mac_core[][2] = { | 21 | /* AR9485 1.0 */ |
21 | /* Addr allmodes */ | ||
22 | {0x00000008, 0x00000000}, | ||
23 | {0x00000030, 0x00020085}, | ||
24 | {0x00000034, 0x00000005}, | ||
25 | {0x00000040, 0x00000000}, | ||
26 | {0x00000044, 0x00000000}, | ||
27 | {0x00000048, 0x00000008}, | ||
28 | {0x0000004c, 0x00000010}, | ||
29 | {0x00000050, 0x00000000}, | ||
30 | {0x00001040, 0x002ffc0f}, | ||
31 | {0x00001044, 0x002ffc0f}, | ||
32 | {0x00001048, 0x002ffc0f}, | ||
33 | {0x0000104c, 0x002ffc0f}, | ||
34 | {0x00001050, 0x002ffc0f}, | ||
35 | {0x00001054, 0x002ffc0f}, | ||
36 | {0x00001058, 0x002ffc0f}, | ||
37 | {0x0000105c, 0x002ffc0f}, | ||
38 | {0x00001060, 0x002ffc0f}, | ||
39 | {0x00001064, 0x002ffc0f}, | ||
40 | {0x000010f0, 0x00000100}, | ||
41 | {0x00001270, 0x00000000}, | ||
42 | {0x000012b0, 0x00000000}, | ||
43 | {0x000012f0, 0x00000000}, | ||
44 | {0x0000143c, 0x00000000}, | ||
45 | {0x0000147c, 0x00000000}, | ||
46 | {0x00008000, 0x00000000}, | ||
47 | {0x00008004, 0x00000000}, | ||
48 | {0x00008008, 0x00000000}, | ||
49 | {0x0000800c, 0x00000000}, | ||
50 | {0x00008018, 0x00000000}, | ||
51 | {0x00008020, 0x00000000}, | ||
52 | {0x00008038, 0x00000000}, | ||
53 | {0x0000803c, 0x00000000}, | ||
54 | {0x00008040, 0x00000000}, | ||
55 | {0x00008044, 0x00000000}, | ||
56 | {0x00008048, 0x00000000}, | ||
57 | {0x0000804c, 0xffffffff}, | ||
58 | {0x00008054, 0x00000000}, | ||
59 | {0x00008058, 0x00000000}, | ||
60 | {0x0000805c, 0x000fc78f}, | ||
61 | {0x00008060, 0x0000000f}, | ||
62 | {0x00008064, 0x00000000}, | ||
63 | {0x00008070, 0x00000310}, | ||
64 | {0x00008074, 0x00000020}, | ||
65 | {0x00008078, 0x00000000}, | ||
66 | {0x0000809c, 0x0000000f}, | ||
67 | {0x000080a0, 0x00000000}, | ||
68 | {0x000080a4, 0x02ff0000}, | ||
69 | {0x000080a8, 0x0e070605}, | ||
70 | {0x000080ac, 0x0000000d}, | ||
71 | {0x000080b0, 0x00000000}, | ||
72 | {0x000080b4, 0x00000000}, | ||
73 | {0x000080b8, 0x00000000}, | ||
74 | {0x000080bc, 0x00000000}, | ||
75 | {0x000080c0, 0x2a800000}, | ||
76 | {0x000080c4, 0x06900168}, | ||
77 | {0x000080c8, 0x13881c22}, | ||
78 | {0x000080cc, 0x01f40000}, | ||
79 | {0x000080d0, 0x00252500}, | ||
80 | {0x000080d4, 0x00a00000}, | ||
81 | {0x000080d8, 0x00400000}, | ||
82 | {0x000080dc, 0x00000000}, | ||
83 | {0x000080e0, 0xffffffff}, | ||
84 | {0x000080e4, 0x0000ffff}, | ||
85 | {0x000080e8, 0x3f3f3f3f}, | ||
86 | {0x000080ec, 0x00000000}, | ||
87 | {0x000080f0, 0x00000000}, | ||
88 | {0x000080f4, 0x00000000}, | ||
89 | {0x000080fc, 0x00020000}, | ||
90 | {0x00008100, 0x00000000}, | ||
91 | {0x00008108, 0x00000052}, | ||
92 | {0x0000810c, 0x00000000}, | ||
93 | {0x00008110, 0x00000000}, | ||
94 | {0x00008114, 0x000007ff}, | ||
95 | {0x00008118, 0x000000aa}, | ||
96 | {0x0000811c, 0x00003210}, | ||
97 | {0x00008124, 0x00000000}, | ||
98 | {0x00008128, 0x00000000}, | ||
99 | {0x0000812c, 0x00000000}, | ||
100 | {0x00008130, 0x00000000}, | ||
101 | {0x00008134, 0x00000000}, | ||
102 | {0x00008138, 0x00000000}, | ||
103 | {0x0000813c, 0x0000ffff}, | ||
104 | {0x00008144, 0xffffffff}, | ||
105 | {0x00008168, 0x00000000}, | ||
106 | {0x0000816c, 0x00000000}, | ||
107 | {0x00008170, 0x18486200}, | ||
108 | {0x00008174, 0x33332210}, | ||
109 | {0x00008178, 0x00000000}, | ||
110 | {0x0000817c, 0x00020000}, | ||
111 | {0x000081c0, 0x00000000}, | ||
112 | {0x000081c4, 0x33332210}, | ||
113 | {0x000081d4, 0x00000000}, | ||
114 | {0x000081ec, 0x00000000}, | ||
115 | {0x000081f0, 0x00000000}, | ||
116 | {0x000081f4, 0x00000000}, | ||
117 | {0x000081f8, 0x00000000}, | ||
118 | {0x000081fc, 0x00000000}, | ||
119 | {0x00008240, 0x00100000}, | ||
120 | {0x00008244, 0x0010f400}, | ||
121 | {0x00008248, 0x00000800}, | ||
122 | {0x0000824c, 0x0001e800}, | ||
123 | {0x00008250, 0x00000000}, | ||
124 | {0x00008254, 0x00000000}, | ||
125 | {0x00008258, 0x00000000}, | ||
126 | {0x0000825c, 0x40000000}, | ||
127 | {0x00008260, 0x00080922}, | ||
128 | {0x00008264, 0x9ca00010}, | ||
129 | {0x00008268, 0xffffffff}, | ||
130 | {0x0000826c, 0x0000ffff}, | ||
131 | {0x00008270, 0x00000000}, | ||
132 | {0x00008274, 0x40000000}, | ||
133 | {0x00008278, 0x003e4180}, | ||
134 | {0x0000827c, 0x00000004}, | ||
135 | {0x00008284, 0x0000002c}, | ||
136 | {0x00008288, 0x0000002c}, | ||
137 | {0x0000828c, 0x000000ff}, | ||
138 | {0x00008294, 0x00000000}, | ||
139 | {0x00008298, 0x00000000}, | ||
140 | {0x0000829c, 0x00000000}, | ||
141 | {0x00008300, 0x00000140}, | ||
142 | {0x00008314, 0x00000000}, | ||
143 | {0x0000831c, 0x0000010d}, | ||
144 | {0x00008328, 0x00000000}, | ||
145 | {0x0000832c, 0x00000007}, | ||
146 | {0x00008330, 0x00000302}, | ||
147 | {0x00008334, 0x00000700}, | ||
148 | {0x00008338, 0x00ff0000}, | ||
149 | {0x0000833c, 0x02400000}, | ||
150 | {0x00008340, 0x000107ff}, | ||
151 | {0x00008344, 0xa248105b}, | ||
152 | {0x00008348, 0x008f0000}, | ||
153 | {0x0000835c, 0x00000000}, | ||
154 | {0x00008360, 0xffffffff}, | ||
155 | {0x00008364, 0xffffffff}, | ||
156 | {0x00008368, 0x00000000}, | ||
157 | {0x00008370, 0x00000000}, | ||
158 | {0x00008374, 0x000000ff}, | ||
159 | {0x00008378, 0x00000000}, | ||
160 | {0x0000837c, 0x00000000}, | ||
161 | {0x00008380, 0xffffffff}, | ||
162 | {0x00008384, 0xffffffff}, | ||
163 | {0x00008390, 0xffffffff}, | ||
164 | {0x00008394, 0xffffffff}, | ||
165 | {0x00008398, 0x00000000}, | ||
166 | {0x0000839c, 0x00000000}, | ||
167 | {0x000083a0, 0x00000000}, | ||
168 | {0x000083a4, 0x0000fa14}, | ||
169 | {0x000083a8, 0x000f0c00}, | ||
170 | {0x000083ac, 0x33332210}, | ||
171 | {0x000083b0, 0x33332210}, | ||
172 | {0x000083b4, 0x33332210}, | ||
173 | {0x000083b8, 0x33332210}, | ||
174 | {0x000083bc, 0x00000000}, | ||
175 | {0x000083c0, 0x00000000}, | ||
176 | {0x000083c4, 0x00000000}, | ||
177 | {0x000083c8, 0x00000000}, | ||
178 | {0x000083cc, 0x00000200}, | ||
179 | {0x000083d0, 0x000301ff}, | ||
180 | }; | ||
181 | 22 | ||
182 | static const u32 ar9485_1_1_baseband_core[][2] = { | 23 | #define ar9485_1_1_mac_postamble ar9300_2p2_mac_postamble |
183 | /* Addr allmodes */ | ||
184 | {0x00009800, 0xafe68e30}, | ||
185 | {0x00009804, 0xfd14e000}, | ||
186 | {0x00009808, 0x9c0a8f6b}, | ||
187 | {0x0000980c, 0x04800000}, | ||
188 | {0x00009814, 0x9280c00a}, | ||
189 | {0x00009818, 0x00000000}, | ||
190 | {0x0000981c, 0x00020028}, | ||
191 | {0x00009834, 0x5f3ca3de}, | ||
192 | {0x00009838, 0x0108ecff}, | ||
193 | {0x0000983c, 0x14750600}, | ||
194 | {0x00009880, 0x201fff00}, | ||
195 | {0x00009884, 0x00001042}, | ||
196 | {0x000098a4, 0x00200400}, | ||
197 | {0x000098b0, 0x52440bbe}, | ||
198 | {0x000098d0, 0x004b6a8e}, | ||
199 | {0x000098d4, 0x00000820}, | ||
200 | {0x000098dc, 0x00000000}, | ||
201 | {0x000098f0, 0x00000000}, | ||
202 | {0x000098f4, 0x00000000}, | ||
203 | {0x00009c04, 0x00000000}, | ||
204 | {0x00009c08, 0x03200000}, | ||
205 | {0x00009c0c, 0x00000000}, | ||
206 | {0x00009c10, 0x00000000}, | ||
207 | {0x00009c14, 0x00046384}, | ||
208 | {0x00009c18, 0x05b6b440}, | ||
209 | {0x00009c1c, 0x00b6b440}, | ||
210 | {0x00009d00, 0xc080a333}, | ||
211 | {0x00009d04, 0x40206c10}, | ||
212 | {0x00009d08, 0x009c4060}, | ||
213 | {0x00009d0c, 0x1883800a}, | ||
214 | {0x00009d10, 0x01834061}, | ||
215 | {0x00009d14, 0x00c00400}, | ||
216 | {0x00009d18, 0x00000000}, | ||
217 | {0x00009d1c, 0x00000000}, | ||
218 | {0x00009e08, 0x0038233c}, | ||
219 | {0x00009e24, 0x9927b515}, | ||
220 | {0x00009e28, 0x12ef0200}, | ||
221 | {0x00009e30, 0x06336f77}, | ||
222 | {0x00009e34, 0x6af6532f}, | ||
223 | {0x00009e38, 0x0cc80c00}, | ||
224 | {0x00009e40, 0x0d261820}, | ||
225 | {0x00009e4c, 0x00001004}, | ||
226 | {0x00009e50, 0x00ff03f1}, | ||
227 | {0x00009fc0, 0x80be4788}, | ||
228 | {0x00009fc4, 0x0001efb5}, | ||
229 | {0x00009fcc, 0x40000014}, | ||
230 | {0x0000a20c, 0x00000000}, | ||
231 | {0x0000a210, 0x00000000}, | ||
232 | {0x0000a220, 0x00000000}, | ||
233 | {0x0000a224, 0x00000000}, | ||
234 | {0x0000a228, 0x10002310}, | ||
235 | {0x0000a23c, 0x00000000}, | ||
236 | {0x0000a244, 0x0c000000}, | ||
237 | {0x0000a2a0, 0x00000001}, | ||
238 | {0x0000a2c0, 0x00000001}, | ||
239 | {0x0000a2c8, 0x00000000}, | ||
240 | {0x0000a2cc, 0x18c43433}, | ||
241 | {0x0000a2d4, 0x00000000}, | ||
242 | {0x0000a2dc, 0x00000000}, | ||
243 | {0x0000a2e0, 0x00000000}, | ||
244 | {0x0000a2e4, 0x00000000}, | ||
245 | {0x0000a2e8, 0x00000000}, | ||
246 | {0x0000a2ec, 0x00000000}, | ||
247 | {0x0000a2f0, 0x00000000}, | ||
248 | {0x0000a2f4, 0x00000000}, | ||
249 | {0x0000a2f8, 0x00000000}, | ||
250 | {0x0000a344, 0x00000000}, | ||
251 | {0x0000a34c, 0x00000000}, | ||
252 | {0x0000a350, 0x0000a000}, | ||
253 | {0x0000a364, 0x00000000}, | ||
254 | {0x0000a370, 0x00000000}, | ||
255 | {0x0000a390, 0x00000001}, | ||
256 | {0x0000a394, 0x00000444}, | ||
257 | {0x0000a398, 0x001f0e0f}, | ||
258 | {0x0000a39c, 0x0075393f}, | ||
259 | {0x0000a3a0, 0xb79f6427}, | ||
260 | {0x0000a3a4, 0x000000ff}, | ||
261 | {0x0000a3a8, 0x3b3b3b3b}, | ||
262 | {0x0000a3ac, 0x2f2f2f2f}, | ||
263 | {0x0000a3c0, 0x20202020}, | ||
264 | {0x0000a3c4, 0x22222220}, | ||
265 | {0x0000a3c8, 0x20200020}, | ||
266 | {0x0000a3cc, 0x20202020}, | ||
267 | {0x0000a3d0, 0x20202020}, | ||
268 | {0x0000a3d4, 0x20202020}, | ||
269 | {0x0000a3d8, 0x20202020}, | ||
270 | {0x0000a3dc, 0x20202020}, | ||
271 | {0x0000a3e0, 0x20202020}, | ||
272 | {0x0000a3e4, 0x20202020}, | ||
273 | {0x0000a3e8, 0x20202020}, | ||
274 | {0x0000a3ec, 0x20202020}, | ||
275 | {0x0000a3f0, 0x00000000}, | ||
276 | {0x0000a3f4, 0x00000006}, | ||
277 | {0x0000a3f8, 0x0cdbd380}, | ||
278 | {0x0000a3fc, 0x000f0f01}, | ||
279 | {0x0000a400, 0x8fa91f01}, | ||
280 | {0x0000a404, 0x00000000}, | ||
281 | {0x0000a408, 0x0e79e5c6}, | ||
282 | {0x0000a40c, 0x00820820}, | ||
283 | {0x0000a414, 0x1ce739cf}, | ||
284 | {0x0000a418, 0x2d0019ce}, | ||
285 | {0x0000a41c, 0x1ce739ce}, | ||
286 | {0x0000a420, 0x000001ce}, | ||
287 | {0x0000a424, 0x1ce739ce}, | ||
288 | {0x0000a428, 0x000001ce}, | ||
289 | {0x0000a42c, 0x1ce739ce}, | ||
290 | {0x0000a430, 0x1ce739ce}, | ||
291 | {0x0000a434, 0x00000000}, | ||
292 | {0x0000a438, 0x00001801}, | ||
293 | {0x0000a43c, 0x00000000}, | ||
294 | {0x0000a440, 0x00000000}, | ||
295 | {0x0000a444, 0x00000000}, | ||
296 | {0x0000a448, 0x04000000}, | ||
297 | {0x0000a44c, 0x00000001}, | ||
298 | {0x0000a450, 0x00010000}, | ||
299 | {0x0000a5c4, 0xbfad9d74}, | ||
300 | {0x0000a5c8, 0x0048060a}, | ||
301 | {0x0000a5cc, 0x00000637}, | ||
302 | {0x0000a760, 0x03020100}, | ||
303 | {0x0000a764, 0x09080504}, | ||
304 | {0x0000a768, 0x0d0c0b0a}, | ||
305 | {0x0000a76c, 0x13121110}, | ||
306 | {0x0000a770, 0x31301514}, | ||
307 | {0x0000a774, 0x35343332}, | ||
308 | {0x0000a778, 0x00000036}, | ||
309 | {0x0000a780, 0x00000838}, | ||
310 | {0x0000a7c0, 0x00000000}, | ||
311 | {0x0000a7c4, 0xfffffffc}, | ||
312 | {0x0000a7c8, 0x00000000}, | ||
313 | {0x0000a7cc, 0x00000000}, | ||
314 | {0x0000a7d0, 0x00000000}, | ||
315 | {0x0000a7d4, 0x00000004}, | ||
316 | {0x0000a7dc, 0x00000000}, | ||
317 | }; | ||
318 | 24 | ||
319 | static const u32 ar9485Common_1_1[][2] = { | 25 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { |
320 | /* Addr allmodes */ | 26 | /* Addr allmodes */ |
321 | {0x00007010, 0x00000022}, | 27 | {0x00018c00, 0x18012e5e}, |
322 | {0x00007020, 0x00000000}, | 28 | {0x00018c04, 0x000801d8}, |
323 | {0x00007034, 0x00000002}, | 29 | {0x00018c08, 0x0000080c}, |
324 | {0x00007038, 0x000004c2}, | ||
325 | }; | 30 | }; |
326 | 31 | ||
327 | static const u32 ar9485_1_1_baseband_postamble[][5] = { | 32 | static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = { |
328 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 33 | /* Addr allmodes */ |
329 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, | 34 | {0x0000a000, 0x00060005}, |
330 | {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, | 35 | {0x0000a004, 0x00810080}, |
331 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | 36 | {0x0000a008, 0x00830082}, |
332 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, | 37 | {0x0000a00c, 0x00850084}, |
333 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | 38 | {0x0000a010, 0x01820181}, |
334 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, | 39 | {0x0000a014, 0x01840183}, |
335 | {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, | 40 | {0x0000a018, 0x01880185}, |
336 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | 41 | {0x0000a01c, 0x018a0189}, |
337 | {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, | 42 | {0x0000a020, 0x02850284}, |
338 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, | 43 | {0x0000a024, 0x02890288}, |
339 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec80d2e, 0x7ec80d2e}, | 44 | {0x0000a028, 0x028b028a}, |
340 | {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, | 45 | {0x0000a02c, 0x03850384}, |
341 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 46 | {0x0000a030, 0x03890388}, |
342 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 47 | {0x0000a034, 0x038b038a}, |
343 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 48 | {0x0000a038, 0x038d038c}, |
344 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 49 | {0x0000a03c, 0x03910390}, |
345 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, | 50 | {0x0000a040, 0x03930392}, |
346 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, | 51 | {0x0000a044, 0x03950394}, |
347 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, | 52 | {0x0000a048, 0x00000396}, |
348 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | 53 | {0x0000a04c, 0x00000000}, |
349 | {0x0000a204, 0x01303fc0, 0x01303fc4, 0x01303fc4, 0x01303fc0}, | 54 | {0x0000a050, 0x00000000}, |
350 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, | 55 | {0x0000a054, 0x00000000}, |
351 | {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, | 56 | {0x0000a058, 0x00000000}, |
352 | {0x0000a234, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff}, | 57 | {0x0000a05c, 0x00000000}, |
353 | {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, | 58 | {0x0000a060, 0x00000000}, |
354 | {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, | 59 | {0x0000a064, 0x00000000}, |
355 | {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, | 60 | {0x0000a068, 0x00000000}, |
356 | {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, | 61 | {0x0000a06c, 0x00000000}, |
357 | {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, | 62 | {0x0000a070, 0x00000000}, |
358 | {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, | 63 | {0x0000a074, 0x00000000}, |
359 | {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, | 64 | {0x0000a078, 0x00000000}, |
360 | {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, | 65 | {0x0000a07c, 0x00000000}, |
361 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, | 66 | {0x0000a080, 0x28282828}, |
362 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 67 | {0x0000a084, 0x28282828}, |
363 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 68 | {0x0000a088, 0x28282828}, |
364 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | 69 | {0x0000a08c, 0x28282828}, |
365 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, | 70 | {0x0000a090, 0x28282828}, |
366 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | 71 | {0x0000a094, 0x24242428}, |
367 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 72 | {0x0000a098, 0x171e1e1e}, |
368 | {0x0000be04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, | 73 | {0x0000a09c, 0x02020b0b}, |
369 | {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 74 | {0x0000a0a0, 0x02020202}, |
75 | {0x0000a0a4, 0x00000000}, | ||
76 | {0x0000a0a8, 0x00000000}, | ||
77 | {0x0000a0ac, 0x00000000}, | ||
78 | {0x0000a0b0, 0x00000000}, | ||
79 | {0x0000a0b4, 0x00000000}, | ||
80 | {0x0000a0b8, 0x00000000}, | ||
81 | {0x0000a0bc, 0x00000000}, | ||
82 | {0x0000a0c0, 0x22072208}, | ||
83 | {0x0000a0c4, 0x22052206}, | ||
84 | {0x0000a0c8, 0x22032204}, | ||
85 | {0x0000a0cc, 0x22012202}, | ||
86 | {0x0000a0d0, 0x221f2200}, | ||
87 | {0x0000a0d4, 0x221d221e}, | ||
88 | {0x0000a0d8, 0x33023303}, | ||
89 | {0x0000a0dc, 0x33003301}, | ||
90 | {0x0000a0e0, 0x331e331f}, | ||
91 | {0x0000a0e4, 0x4402331d}, | ||
92 | {0x0000a0e8, 0x44004401}, | ||
93 | {0x0000a0ec, 0x441e441f}, | ||
94 | {0x0000a0f0, 0x55025503}, | ||
95 | {0x0000a0f4, 0x55005501}, | ||
96 | {0x0000a0f8, 0x551e551f}, | ||
97 | {0x0000a0fc, 0x6602551d}, | ||
98 | {0x0000a100, 0x66006601}, | ||
99 | {0x0000a104, 0x661e661f}, | ||
100 | {0x0000a108, 0x7703661d}, | ||
101 | {0x0000a10c, 0x77017702}, | ||
102 | {0x0000a110, 0x00007700}, | ||
103 | {0x0000a114, 0x00000000}, | ||
104 | {0x0000a118, 0x00000000}, | ||
105 | {0x0000a11c, 0x00000000}, | ||
106 | {0x0000a120, 0x00000000}, | ||
107 | {0x0000a124, 0x00000000}, | ||
108 | {0x0000a128, 0x00000000}, | ||
109 | {0x0000a12c, 0x00000000}, | ||
110 | {0x0000a130, 0x00000000}, | ||
111 | {0x0000a134, 0x00000000}, | ||
112 | {0x0000a138, 0x00000000}, | ||
113 | {0x0000a13c, 0x00000000}, | ||
114 | {0x0000a140, 0x001f0000}, | ||
115 | {0x0000a144, 0x111f1100}, | ||
116 | {0x0000a148, 0x111d111e}, | ||
117 | {0x0000a14c, 0x111b111c}, | ||
118 | {0x0000a150, 0x22032204}, | ||
119 | {0x0000a154, 0x22012202}, | ||
120 | {0x0000a158, 0x221f2200}, | ||
121 | {0x0000a15c, 0x221d221e}, | ||
122 | {0x0000a160, 0x33013302}, | ||
123 | {0x0000a164, 0x331f3300}, | ||
124 | {0x0000a168, 0x4402331e}, | ||
125 | {0x0000a16c, 0x44004401}, | ||
126 | {0x0000a170, 0x441e441f}, | ||
127 | {0x0000a174, 0x55015502}, | ||
128 | {0x0000a178, 0x551f5500}, | ||
129 | {0x0000a17c, 0x6602551e}, | ||
130 | {0x0000a180, 0x66006601}, | ||
131 | {0x0000a184, 0x661e661f}, | ||
132 | {0x0000a188, 0x7703661d}, | ||
133 | {0x0000a18c, 0x77017702}, | ||
134 | {0x0000a190, 0x00007700}, | ||
135 | {0x0000a194, 0x00000000}, | ||
136 | {0x0000a198, 0x00000000}, | ||
137 | {0x0000a19c, 0x00000000}, | ||
138 | {0x0000a1a0, 0x00000000}, | ||
139 | {0x0000a1a4, 0x00000000}, | ||
140 | {0x0000a1a8, 0x00000000}, | ||
141 | {0x0000a1ac, 0x00000000}, | ||
142 | {0x0000a1b0, 0x00000000}, | ||
143 | {0x0000a1b4, 0x00000000}, | ||
144 | {0x0000a1b8, 0x00000000}, | ||
145 | {0x0000a1bc, 0x00000000}, | ||
146 | {0x0000a1c0, 0x00000000}, | ||
147 | {0x0000a1c4, 0x00000000}, | ||
148 | {0x0000a1c8, 0x00000000}, | ||
149 | {0x0000a1cc, 0x00000000}, | ||
150 | {0x0000a1d0, 0x00000000}, | ||
151 | {0x0000a1d4, 0x00000000}, | ||
152 | {0x0000a1d8, 0x00000000}, | ||
153 | {0x0000a1dc, 0x00000000}, | ||
154 | {0x0000a1e0, 0x00000000}, | ||
155 | {0x0000a1e4, 0x00000000}, | ||
156 | {0x0000a1e8, 0x00000000}, | ||
157 | {0x0000a1ec, 0x00000000}, | ||
158 | {0x0000a1f0, 0x00000396}, | ||
159 | {0x0000a1f4, 0x00000396}, | ||
160 | {0x0000a1f8, 0x00000396}, | ||
161 | {0x0000a1fc, 0x00000296}, | ||
370 | }; | 162 | }; |
371 | 163 | ||
372 | static const u32 ar9485Modes_high_ob_db_tx_gain_1_1[][5] = { | 164 | static const u32 ar9485Modes_high_power_tx_gain_1_1[][5] = { |
373 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 165 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
374 | {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, | 166 | {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, |
375 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, | 167 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, |
376 | {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 168 | {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
@@ -442,102 +234,34 @@ static const u32 ar9485Modes_high_ob_db_tx_gain_1_1[][5] = { | |||
442 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, | 234 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, |
443 | }; | 235 | }; |
444 | 236 | ||
445 | static const u32 ar9485_modes_lowest_ob_db_tx_gain_1_1[][5] = { | 237 | #define ar9485Modes_high_ob_db_tx_gain_1_1 ar9485Modes_high_power_tx_gain_1_1 |
446 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
447 | {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, | ||
448 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, | ||
449 | {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
450 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
451 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
452 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
453 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | ||
454 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | ||
455 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | ||
456 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | ||
457 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | ||
458 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, | ||
459 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, | ||
460 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, | ||
461 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, | ||
462 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, | ||
463 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, | ||
464 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, | ||
465 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, | ||
466 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, | ||
467 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, | ||
468 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, | ||
469 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, | ||
470 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, | ||
471 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, | ||
472 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, | ||
473 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, | ||
474 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
475 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, | ||
476 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
477 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
478 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
479 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
480 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
481 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
482 | {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
483 | {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
484 | {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
485 | {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
486 | {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
487 | {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
488 | {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
489 | {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
490 | {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
491 | {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
492 | {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
493 | {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
494 | {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
495 | {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
496 | {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
497 | {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
498 | {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
499 | {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
500 | {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
501 | {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
502 | {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
503 | {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
504 | {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
505 | {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
506 | {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
507 | {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
508 | {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
509 | {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
510 | {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
511 | {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
512 | {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
513 | {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
514 | {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, | ||
515 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, | ||
516 | }; | ||
517 | 238 | ||
518 | static const u32 ar9485_1_1_radio_postamble[][2] = { | 239 | #define ar9485Modes_low_ob_db_tx_gain_1_1 ar9485Modes_high_ob_db_tx_gain_1_1 |
519 | /* Addr allmodes */ | ||
520 | {0x0001609c, 0x0b283f31}, | ||
521 | {0x000160ac, 0x24611800}, | ||
522 | {0x000160b0, 0x03284f3e}, | ||
523 | {0x0001610c, 0x00170000}, | ||
524 | {0x00016140, 0x50804008}, | ||
525 | }; | ||
526 | 240 | ||
527 | static const u32 ar9485_1_1_mac_postamble[][5] = { | 241 | #define ar9485_modes_lowest_ob_db_tx_gain_1_1 ar9485Modes_low_ob_db_tx_gain_1_1 |
528 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 242 | |
529 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | 243 | static const u32 ar9485_1_1[][2] = { |
530 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | 244 | /* Addr allmodes */ |
531 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | 245 | {0x0000a580, 0x00000000}, |
532 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | 246 | {0x0000a584, 0x00000000}, |
533 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | 247 | {0x0000a588, 0x00000000}, |
534 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | 248 | {0x0000a58c, 0x00000000}, |
535 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | 249 | {0x0000a590, 0x00000000}, |
536 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | 250 | {0x0000a594, 0x00000000}, |
251 | {0x0000a598, 0x00000000}, | ||
252 | {0x0000a59c, 0x00000000}, | ||
253 | {0x0000a5a0, 0x00000000}, | ||
254 | {0x0000a5a4, 0x00000000}, | ||
255 | {0x0000a5a8, 0x00000000}, | ||
256 | {0x0000a5ac, 0x00000000}, | ||
257 | {0x0000a5b0, 0x00000000}, | ||
258 | {0x0000a5b4, 0x00000000}, | ||
259 | {0x0000a5b8, 0x00000000}, | ||
260 | {0x0000a5bc, 0x00000000}, | ||
537 | }; | 261 | }; |
538 | 262 | ||
539 | static const u32 ar9485_1_1_radio_core[][2] = { | 263 | static const u32 ar9485_1_1_radio_core[][2] = { |
540 | /* Addr allmodes */ | 264 | /* Addr allmodes */ |
541 | {0x00016000, 0x36db6db6}, | 265 | {0x00016000, 0x36db6db6}, |
542 | {0x00016004, 0x6db6db40}, | 266 | {0x00016004, 0x6db6db40}, |
543 | {0x00016008, 0x73800000}, | 267 | {0x00016008, 0x73800000}, |
@@ -601,294 +325,145 @@ static const u32 ar9485_1_1_radio_core[][2] = { | |||
601 | {0x00016c44, 0x12000000}, | 325 | {0x00016c44, 0x12000000}, |
602 | }; | 326 | }; |
603 | 327 | ||
604 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { | 328 | static const u32 ar9485_1_1_baseband_core[][2] = { |
605 | /* Addr allmodes */ | 329 | /* Addr allmodes */ |
606 | {0x00018c00, 0x18052e5e}, | 330 | {0x00009800, 0xafe68e30}, |
607 | {0x00018c04, 0x000801d8}, | 331 | {0x00009804, 0xfd14e000}, |
608 | {0x00018c08, 0x0000080c}, | 332 | {0x00009808, 0x9c0a8f6b}, |
609 | }; | 333 | {0x0000980c, 0x04800000}, |
610 | 334 | {0x00009814, 0x9280c00a}, | |
611 | static const u32 ar9485Modes_high_power_tx_gain_1_1[][5] = { | 335 | {0x00009818, 0x00000000}, |
612 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 336 | {0x0000981c, 0x00020028}, |
613 | {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, | 337 | {0x00009834, 0x5f3ca3de}, |
614 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, | 338 | {0x00009838, 0x0108ecff}, |
615 | {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 339 | {0x0000983c, 0x14750600}, |
616 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | 340 | {0x00009880, 0x201fff00}, |
617 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | 341 | {0x00009884, 0x00001042}, |
618 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | 342 | {0x000098a4, 0x00200400}, |
619 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | 343 | {0x000098b0, 0x52440bbe}, |
620 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | 344 | {0x000098d0, 0x004b6a8e}, |
621 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | 345 | {0x000098d4, 0x00000820}, |
622 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | 346 | {0x000098dc, 0x00000000}, |
623 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | 347 | {0x000098f0, 0x00000000}, |
624 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, | 348 | {0x000098f4, 0x00000000}, |
625 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, | 349 | {0x00009c04, 0x00000000}, |
626 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, | 350 | {0x00009c08, 0x03200000}, |
627 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, | 351 | {0x00009c0c, 0x00000000}, |
628 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, | 352 | {0x00009c10, 0x00000000}, |
629 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, | 353 | {0x00009c14, 0x00046384}, |
630 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, | 354 | {0x00009c18, 0x05b6b440}, |
631 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, | 355 | {0x00009c1c, 0x00b6b440}, |
632 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, | 356 | {0x00009d00, 0xc080a333}, |
633 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, | 357 | {0x00009d04, 0x40206c10}, |
634 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, | 358 | {0x00009d08, 0x009c4060}, |
635 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, | 359 | {0x00009d0c, 0x1883800a}, |
636 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, | 360 | {0x00009d10, 0x01834061}, |
637 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, | 361 | {0x00009d14, 0x00c00400}, |
638 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, | 362 | {0x00009d18, 0x00000000}, |
639 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, | 363 | {0x00009d1c, 0x00000000}, |
640 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, | 364 | {0x00009e08, 0x0038233c}, |
641 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, | 365 | {0x00009e24, 0x9927b515}, |
642 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 366 | {0x00009e28, 0x12ef0200}, |
643 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 367 | {0x00009e30, 0x06336f77}, |
644 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 368 | {0x00009e34, 0x6af6532f}, |
645 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 369 | {0x00009e38, 0x0cc80c00}, |
646 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 370 | {0x00009e40, 0x0d261820}, |
647 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 371 | {0x00009e4c, 0x00001004}, |
648 | {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 372 | {0x00009e50, 0x00ff03f1}, |
649 | {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 373 | {0x00009fc0, 0x80be4788}, |
650 | {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 374 | {0x00009fc4, 0x0001efb5}, |
651 | {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 375 | {0x00009fcc, 0x40000014}, |
652 | {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 376 | {0x0000a20c, 0x00000000}, |
653 | {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 377 | {0x0000a210, 0x00000000}, |
654 | {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 378 | {0x0000a220, 0x00000000}, |
655 | {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 379 | {0x0000a224, 0x00000000}, |
656 | {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 380 | {0x0000a228, 0x10002310}, |
657 | {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 381 | {0x0000a23c, 0x00000000}, |
658 | {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 382 | {0x0000a244, 0x0c000000}, |
659 | {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 383 | {0x0000a2a0, 0x00000001}, |
660 | {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 384 | {0x0000a2c0, 0x00000001}, |
661 | {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 385 | {0x0000a2c8, 0x00000000}, |
662 | {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 386 | {0x0000a2cc, 0x18c43433}, |
663 | {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 387 | {0x0000a2d4, 0x00000000}, |
664 | {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 388 | {0x0000a2dc, 0x00000000}, |
665 | {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 389 | {0x0000a2e0, 0x00000000}, |
666 | {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 390 | {0x0000a2e4, 0x00000000}, |
667 | {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 391 | {0x0000a2e8, 0x00000000}, |
668 | {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 392 | {0x0000a2ec, 0x00000000}, |
669 | {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 393 | {0x0000a2f0, 0x00000000}, |
670 | {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 394 | {0x0000a2f4, 0x00000000}, |
671 | {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 395 | {0x0000a2f8, 0x00000000}, |
672 | {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 396 | {0x0000a344, 0x00000000}, |
673 | {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 397 | {0x0000a34c, 0x00000000}, |
674 | {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 398 | {0x0000a350, 0x0000a000}, |
675 | {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 399 | {0x0000a364, 0x00000000}, |
676 | {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 400 | {0x0000a370, 0x00000000}, |
677 | {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 401 | {0x0000a390, 0x00000001}, |
678 | {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 402 | {0x0000a394, 0x00000444}, |
679 | {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 403 | {0x0000a398, 0x001f0e0f}, |
680 | {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, | 404 | {0x0000a39c, 0x0075393f}, |
681 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, | 405 | {0x0000a3a0, 0xb79f6427}, |
682 | }; | 406 | {0x0000a3a4, 0x000000ff}, |
683 | 407 | {0x0000a3a8, 0x3b3b3b3b}, | |
684 | static const u32 ar9485_1_1[][2] = { | 408 | {0x0000a3ac, 0x2f2f2f2f}, |
685 | /* Addr allmodes */ | 409 | {0x0000a3c0, 0x20202020}, |
686 | {0x0000a580, 0x00000000}, | 410 | {0x0000a3c4, 0x22222220}, |
687 | {0x0000a584, 0x00000000}, | 411 | {0x0000a3c8, 0x20200020}, |
688 | {0x0000a588, 0x00000000}, | 412 | {0x0000a3cc, 0x20202020}, |
689 | {0x0000a58c, 0x00000000}, | 413 | {0x0000a3d0, 0x20202020}, |
690 | {0x0000a590, 0x00000000}, | 414 | {0x0000a3d4, 0x20202020}, |
691 | {0x0000a594, 0x00000000}, | 415 | {0x0000a3d8, 0x20202020}, |
692 | {0x0000a598, 0x00000000}, | 416 | {0x0000a3dc, 0x20202020}, |
693 | {0x0000a59c, 0x00000000}, | 417 | {0x0000a3e0, 0x20202020}, |
694 | {0x0000a5a0, 0x00000000}, | 418 | {0x0000a3e4, 0x20202020}, |
695 | {0x0000a5a4, 0x00000000}, | 419 | {0x0000a3e8, 0x20202020}, |
696 | {0x0000a5a8, 0x00000000}, | 420 | {0x0000a3ec, 0x20202020}, |
697 | {0x0000a5ac, 0x00000000}, | 421 | {0x0000a3f0, 0x00000000}, |
698 | {0x0000a5b0, 0x00000000}, | 422 | {0x0000a3f4, 0x00000006}, |
699 | {0x0000a5b4, 0x00000000}, | 423 | {0x0000a3f8, 0x0cdbd380}, |
700 | {0x0000a5b8, 0x00000000}, | 424 | {0x0000a3fc, 0x000f0f01}, |
701 | {0x0000a5bc, 0x00000000}, | 425 | {0x0000a400, 0x8fa91f01}, |
702 | }; | 426 | {0x0000a404, 0x00000000}, |
703 | 427 | {0x0000a408, 0x0e79e5c6}, | |
704 | static const u32 ar9485_modes_green_ob_db_tx_gain_1_1[][5] = { | 428 | {0x0000a40c, 0x00820820}, |
705 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 429 | {0x0000a414, 0x1ce739cf}, |
706 | {0x000098bc, 0x00000003, 0x00000003, 0x00000003, 0x00000003}, | 430 | {0x0000a418, 0x2d0019ce}, |
707 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, | 431 | {0x0000a41c, 0x1ce739ce}, |
708 | {0x0000a458, 0x80000000, 0x80000000, 0x80000000, 0x80000000}, | 432 | {0x0000a420, 0x000001ce}, |
709 | {0x0000a500, 0x00022200, 0x00022200, 0x00000006, 0x00000006}, | 433 | {0x0000a424, 0x1ce739ce}, |
710 | {0x0000a504, 0x05062002, 0x05062002, 0x03000201, 0x03000201}, | 434 | {0x0000a428, 0x000001ce}, |
711 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x06000203, 0x06000203}, | 435 | {0x0000a42c, 0x1ce739ce}, |
712 | {0x0000a50c, 0x11062202, 0x11062202, 0x0a000401, 0x0a000401}, | 436 | {0x0000a430, 0x1ce739ce}, |
713 | {0x0000a510, 0x17022e00, 0x17022e00, 0x0e000403, 0x0e000403}, | 437 | {0x0000a434, 0x00000000}, |
714 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x12000405, 0x12000405}, | 438 | {0x0000a438, 0x00001801}, |
715 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x15000604, 0x15000604}, | 439 | {0x0000a43c, 0x00000000}, |
716 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x18000605, 0x18000605}, | 440 | {0x0000a440, 0x00000000}, |
717 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x1c000a04, 0x1c000a04}, | 441 | {0x0000a444, 0x00000000}, |
718 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x21000a06, 0x21000a06}, | 442 | {0x0000a448, 0x04000000}, |
719 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x29000a24, 0x29000a24}, | 443 | {0x0000a44c, 0x00000001}, |
720 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x2f000e21, 0x2f000e21}, | 444 | {0x0000a450, 0x00010000}, |
721 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x31000e20, 0x31000e20}, | 445 | {0x0000a5c4, 0xbfad9d74}, |
722 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x33000e20, 0x33000e20}, | 446 | {0x0000a5c8, 0x0048060a}, |
723 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, | 447 | {0x0000a5cc, 0x00000637}, |
724 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, | 448 | {0x0000a760, 0x03020100}, |
725 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, | 449 | {0x0000a764, 0x09080504}, |
726 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, | 450 | {0x0000a768, 0x0d0c0b0a}, |
727 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, | 451 | {0x0000a76c, 0x13121110}, |
728 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, | 452 | {0x0000a770, 0x31301514}, |
729 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, | 453 | {0x0000a774, 0x35343332}, |
730 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, | 454 | {0x0000a778, 0x00000036}, |
731 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, | 455 | {0x0000a780, 0x00000838}, |
732 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, | 456 | {0x0000a7c0, 0x00000000}, |
733 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, | 457 | {0x0000a7c4, 0xfffffffc}, |
734 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, | 458 | {0x0000a7c8, 0x00000000}, |
735 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 459 | {0x0000a7cc, 0x00000000}, |
736 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 460 | {0x0000a7d0, 0x00000000}, |
737 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 461 | {0x0000a7d4, 0x00000004}, |
738 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | 462 | {0x0000a7dc, 0x00000000}, |
739 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
740 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
741 | {0x0000b500, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
742 | {0x0000b504, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
743 | {0x0000b508, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
744 | {0x0000b50c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
745 | {0x0000b510, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
746 | {0x0000b514, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
747 | {0x0000b518, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
748 | {0x0000b51c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
749 | {0x0000b520, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
750 | {0x0000b524, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
751 | {0x0000b528, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, | ||
752 | {0x0000b52c, 0x0000002a, 0x0000002a, 0x0000002a, 0x0000002a}, | ||
753 | {0x0000b530, 0x0000003a, 0x0000003a, 0x0000003a, 0x0000003a}, | ||
754 | {0x0000b534, 0x0000004a, 0x0000004a, 0x0000004a, 0x0000004a}, | ||
755 | {0x0000b538, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
756 | {0x0000b53c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
757 | {0x0000b540, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
758 | {0x0000b544, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
759 | {0x0000b548, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
760 | {0x0000b54c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
761 | {0x0000b550, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
762 | {0x0000b554, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
763 | {0x0000b558, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
764 | {0x0000b55c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
765 | {0x0000b560, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
766 | {0x0000b564, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
767 | {0x0000b568, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
768 | {0x0000b56c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
769 | {0x0000b570, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
770 | {0x0000b574, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
771 | {0x0000b578, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
772 | {0x0000b57c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, | ||
773 | {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, | ||
774 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, | ||
775 | }; | ||
776 | |||
777 | static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { | ||
778 | /* Addr allmodes */ | ||
779 | {0x00018c00, 0x18013e5e}, | ||
780 | {0x00018c04, 0x000801d8}, | ||
781 | {0x00018c08, 0x0000080c}, | ||
782 | }; | ||
783 | |||
784 | static const u32 ar9485_1_1_soc_preamble[][2] = { | ||
785 | /* Addr allmodes */ | ||
786 | {0x00004014, 0xba280400}, | ||
787 | {0x00004090, 0x00aa10aa}, | ||
788 | {0x000040a4, 0x00a0c9c9}, | ||
789 | {0x00007010, 0x00000022}, | ||
790 | {0x00007020, 0x00000000}, | ||
791 | {0x00007034, 0x00000002}, | ||
792 | {0x00007038, 0x000004c2}, | ||
793 | {0x00007048, 0x00000002}, | ||
794 | }; | ||
795 | |||
796 | static const u32 ar9485_1_1_baseband_core_txfir_coeff_japan_2484[][2] = { | ||
797 | /* Addr allmodes */ | ||
798 | {0x0000a398, 0x00000000}, | ||
799 | {0x0000a39c, 0x6f7f0301}, | ||
800 | {0x0000a3a0, 0xca9228ee}, | ||
801 | }; | ||
802 | |||
803 | static const u32 ar9485Modes_low_ob_db_tx_gain_1_1[][5] = { | ||
804 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
805 | {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, | ||
806 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, | ||
807 | {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
808 | {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, | ||
809 | {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, | ||
810 | {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, | ||
811 | {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, | ||
812 | {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, | ||
813 | {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, | ||
814 | {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, | ||
815 | {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, | ||
816 | {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, | ||
817 | {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, | ||
818 | {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, | ||
819 | {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, | ||
820 | {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, | ||
821 | {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, | ||
822 | {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, | ||
823 | {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, | ||
824 | {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, | ||
825 | {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, | ||
826 | {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, | ||
827 | {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, | ||
828 | {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, | ||
829 | {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, | ||
830 | {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, | ||
831 | {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, | ||
832 | {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
833 | {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, | ||
834 | {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
835 | {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
836 | {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
837 | {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
838 | {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
839 | {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, | ||
840 | {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
841 | {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
842 | {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
843 | {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
844 | {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
845 | {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
846 | {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
847 | {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
848 | {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
849 | {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
850 | {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
851 | {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
852 | {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
853 | {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
854 | {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
855 | {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
856 | {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
857 | {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
858 | {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
859 | {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
860 | {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
861 | {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
862 | {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
863 | {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
864 | {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
865 | {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
866 | {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
867 | {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
868 | {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
869 | {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
870 | {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
871 | {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
872 | {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, | ||
873 | {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, | ||
874 | }; | ||
875 | |||
876 | static const u32 ar9485_fast_clock_1_1_baseband_postamble[][3] = { | ||
877 | /* Addr 5G_HT2 5G_HT40 */ | ||
878 | {0x00009e00, 0x03721821, 0x03721821}, | ||
879 | {0x0000a230, 0x0000400b, 0x00004016}, | ||
880 | {0x0000a254, 0x00000898, 0x00001130}, | ||
881 | }; | ||
882 | |||
883 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { | ||
884 | /* Addr allmodes */ | ||
885 | {0x00018c00, 0x18012e5e}, | ||
886 | {0x00018c04, 0x000801d8}, | ||
887 | {0x00018c08, 0x0000080c}, | ||
888 | }; | 463 | }; |
889 | 464 | ||
890 | static const u32 ar9485_common_rx_gain_1_1[][2] = { | 465 | static const u32 ar9485_common_rx_gain_1_1[][2] = { |
891 | /* Addr allmodes */ | 466 | /* Addr allmodes */ |
892 | {0x0000a000, 0x00010000}, | 467 | {0x0000a000, 0x00010000}, |
893 | {0x0000a004, 0x00030002}, | 468 | {0x0000a004, 0x00030002}, |
894 | {0x0000a008, 0x00050004}, | 469 | {0x0000a008, 0x00050004}, |
@@ -1019,143 +594,260 @@ static const u32 ar9485_common_rx_gain_1_1[][2] = { | |||
1019 | {0x0000a1fc, 0x00000296}, | 594 | {0x0000a1fc, 0x00000296}, |
1020 | }; | 595 | }; |
1021 | 596 | ||
597 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { | ||
598 | /* Addr allmodes */ | ||
599 | {0x00018c00, 0x18052e5e}, | ||
600 | {0x00018c04, 0x000801d8}, | ||
601 | {0x00018c08, 0x0000080c}, | ||
602 | }; | ||
603 | |||
1022 | static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { | 604 | static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { |
1023 | /* Addr allmodes */ | 605 | /* Addr allmodes */ |
1024 | {0x00018c00, 0x18053e5e}, | 606 | {0x00018c00, 0x18053e5e}, |
1025 | {0x00018c04, 0x000801d8}, | 607 | {0x00018c04, 0x000801d8}, |
1026 | {0x00018c08, 0x0000080c}, | 608 | {0x00018c08, 0x0000080c}, |
1027 | }; | 609 | }; |
1028 | 610 | ||
1029 | static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = { | 611 | static const u32 ar9485_1_1_soc_preamble[][2] = { |
1030 | /* Addr allmodes */ | 612 | /* Addr allmodes */ |
1031 | {0x0000a000, 0x00060005}, | 613 | {0x00004014, 0xba280400}, |
1032 | {0x0000a004, 0x00810080}, | 614 | {0x00004090, 0x00aa10aa}, |
1033 | {0x0000a008, 0x00830082}, | 615 | {0x000040a4, 0x00a0c9c9}, |
1034 | {0x0000a00c, 0x00850084}, | 616 | {0x00007010, 0x00000022}, |
1035 | {0x0000a010, 0x01820181}, | 617 | {0x00007020, 0x00000000}, |
1036 | {0x0000a014, 0x01840183}, | 618 | {0x00007034, 0x00000002}, |
1037 | {0x0000a018, 0x01880185}, | 619 | {0x00007038, 0x000004c2}, |
1038 | {0x0000a01c, 0x018a0189}, | 620 | {0x00007048, 0x00000002}, |
1039 | {0x0000a020, 0x02850284}, | 621 | }; |
1040 | {0x0000a024, 0x02890288}, | 622 | |
1041 | {0x0000a028, 0x028b028a}, | 623 | static const u32 ar9485_fast_clock_1_1_baseband_postamble[][3] = { |
1042 | {0x0000a02c, 0x03850384}, | 624 | /* Addr 5G_HT20 5G_HT40 */ |
1043 | {0x0000a030, 0x03890388}, | 625 | {0x00009e00, 0x03721821, 0x03721821}, |
1044 | {0x0000a034, 0x038b038a}, | 626 | {0x0000a230, 0x0000400b, 0x00004016}, |
1045 | {0x0000a038, 0x038d038c}, | 627 | {0x0000a254, 0x00000898, 0x00001130}, |
1046 | {0x0000a03c, 0x03910390}, | 628 | }; |
1047 | {0x0000a040, 0x03930392}, | 629 | |
1048 | {0x0000a044, 0x03950394}, | 630 | static const u32 ar9485_1_1_baseband_postamble[][5] = { |
1049 | {0x0000a048, 0x00000396}, | 631 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
1050 | {0x0000a04c, 0x00000000}, | 632 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, |
1051 | {0x0000a050, 0x00000000}, | 633 | {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, |
1052 | {0x0000a054, 0x00000000}, | 634 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, |
1053 | {0x0000a058, 0x00000000}, | 635 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, |
1054 | {0x0000a05c, 0x00000000}, | 636 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
1055 | {0x0000a060, 0x00000000}, | 637 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, |
1056 | {0x0000a064, 0x00000000}, | 638 | {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, |
1057 | {0x0000a068, 0x00000000}, | 639 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, |
1058 | {0x0000a06c, 0x00000000}, | 640 | {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, |
1059 | {0x0000a070, 0x00000000}, | 641 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, |
1060 | {0x0000a074, 0x00000000}, | 642 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec80d2e, 0x7ec80d2e}, |
1061 | {0x0000a078, 0x00000000}, | 643 | {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, |
1062 | {0x0000a07c, 0x00000000}, | 644 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1063 | {0x0000a080, 0x28282828}, | 645 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
1064 | {0x0000a084, 0x28282828}, | 646 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, |
1065 | {0x0000a088, 0x28282828}, | 647 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
1066 | {0x0000a08c, 0x28282828}, | 648 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, |
1067 | {0x0000a090, 0x28282828}, | 649 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, |
1068 | {0x0000a094, 0x24242428}, | 650 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, |
1069 | {0x0000a098, 0x171e1e1e}, | 651 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
1070 | {0x0000a09c, 0x02020b0b}, | 652 | {0x0000a204, 0x01303fc0, 0x01303fc4, 0x01303fc4, 0x01303fc0}, |
1071 | {0x0000a0a0, 0x02020202}, | 653 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, |
1072 | {0x0000a0a4, 0x00000000}, | 654 | {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, |
1073 | {0x0000a0a8, 0x00000000}, | 655 | {0x0000a234, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff}, |
1074 | {0x0000a0ac, 0x00000000}, | 656 | {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, |
1075 | {0x0000a0b0, 0x00000000}, | 657 | {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, |
1076 | {0x0000a0b4, 0x00000000}, | 658 | {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, |
1077 | {0x0000a0b8, 0x00000000}, | 659 | {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, |
1078 | {0x0000a0bc, 0x00000000}, | 660 | {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, |
1079 | {0x0000a0c0, 0x22072208}, | 661 | {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, |
1080 | {0x0000a0c4, 0x22052206}, | 662 | {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, |
1081 | {0x0000a0c8, 0x22032204}, | 663 | {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, |
1082 | {0x0000a0cc, 0x22012202}, | 664 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, |
1083 | {0x0000a0d0, 0x221f2200}, | 665 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1084 | {0x0000a0d4, 0x221d221e}, | 666 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1085 | {0x0000a0d8, 0x33023303}, | 667 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, |
1086 | {0x0000a0dc, 0x33003301}, | 668 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, |
1087 | {0x0000a0e0, 0x331e331f}, | 669 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, |
1088 | {0x0000a0e4, 0x4402331d}, | 670 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1089 | {0x0000a0e8, 0x44004401}, | 671 | {0x0000be04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, |
1090 | {0x0000a0ec, 0x441e441f}, | 672 | {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1091 | {0x0000a0f0, 0x55025503}, | 673 | }; |
1092 | {0x0000a0f4, 0x55005501}, | 674 | |
1093 | {0x0000a0f8, 0x551e551f}, | 675 | static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { |
1094 | {0x0000a0fc, 0x6602551d}, | 676 | /* Addr allmodes */ |
1095 | {0x0000a100, 0x66006601}, | 677 | {0x00018c00, 0x18013e5e}, |
1096 | {0x0000a104, 0x661e661f}, | 678 | {0x00018c04, 0x000801d8}, |
1097 | {0x0000a108, 0x7703661d}, | 679 | {0x00018c08, 0x0000080c}, |
1098 | {0x0000a10c, 0x77017702}, | 680 | }; |
1099 | {0x0000a110, 0x00007700}, | 681 | |
1100 | {0x0000a114, 0x00000000}, | 682 | static const u32 ar9485_1_1_radio_postamble[][2] = { |
1101 | {0x0000a118, 0x00000000}, | 683 | /* Addr allmodes */ |
1102 | {0x0000a11c, 0x00000000}, | 684 | {0x0001609c, 0x0b283f31}, |
1103 | {0x0000a120, 0x00000000}, | 685 | {0x000160ac, 0x24611800}, |
1104 | {0x0000a124, 0x00000000}, | 686 | {0x000160b0, 0x03284f3e}, |
1105 | {0x0000a128, 0x00000000}, | 687 | {0x0001610c, 0x00170000}, |
1106 | {0x0000a12c, 0x00000000}, | 688 | {0x00016140, 0x50804008}, |
1107 | {0x0000a130, 0x00000000}, | 689 | }; |
1108 | {0x0000a134, 0x00000000}, | 690 | |
1109 | {0x0000a138, 0x00000000}, | 691 | static const u32 ar9485_1_1_mac_core[][2] = { |
1110 | {0x0000a13c, 0x00000000}, | 692 | /* Addr allmodes */ |
1111 | {0x0000a140, 0x001f0000}, | 693 | {0x00000008, 0x00000000}, |
1112 | {0x0000a144, 0x111f1100}, | 694 | {0x00000030, 0x00020085}, |
1113 | {0x0000a148, 0x111d111e}, | 695 | {0x00000034, 0x00000005}, |
1114 | {0x0000a14c, 0x111b111c}, | 696 | {0x00000040, 0x00000000}, |
1115 | {0x0000a150, 0x22032204}, | 697 | {0x00000044, 0x00000000}, |
1116 | {0x0000a154, 0x22012202}, | 698 | {0x00000048, 0x00000008}, |
1117 | {0x0000a158, 0x221f2200}, | 699 | {0x0000004c, 0x00000010}, |
1118 | {0x0000a15c, 0x221d221e}, | 700 | {0x00000050, 0x00000000}, |
1119 | {0x0000a160, 0x33013302}, | 701 | {0x00001040, 0x002ffc0f}, |
1120 | {0x0000a164, 0x331f3300}, | 702 | {0x00001044, 0x002ffc0f}, |
1121 | {0x0000a168, 0x4402331e}, | 703 | {0x00001048, 0x002ffc0f}, |
1122 | {0x0000a16c, 0x44004401}, | 704 | {0x0000104c, 0x002ffc0f}, |
1123 | {0x0000a170, 0x441e441f}, | 705 | {0x00001050, 0x002ffc0f}, |
1124 | {0x0000a174, 0x55015502}, | 706 | {0x00001054, 0x002ffc0f}, |
1125 | {0x0000a178, 0x551f5500}, | 707 | {0x00001058, 0x002ffc0f}, |
1126 | {0x0000a17c, 0x6602551e}, | 708 | {0x0000105c, 0x002ffc0f}, |
1127 | {0x0000a180, 0x66006601}, | 709 | {0x00001060, 0x002ffc0f}, |
1128 | {0x0000a184, 0x661e661f}, | 710 | {0x00001064, 0x002ffc0f}, |
1129 | {0x0000a188, 0x7703661d}, | 711 | {0x000010f0, 0x00000100}, |
1130 | {0x0000a18c, 0x77017702}, | 712 | {0x00001270, 0x00000000}, |
1131 | {0x0000a190, 0x00007700}, | 713 | {0x000012b0, 0x00000000}, |
1132 | {0x0000a194, 0x00000000}, | 714 | {0x000012f0, 0x00000000}, |
1133 | {0x0000a198, 0x00000000}, | 715 | {0x0000143c, 0x00000000}, |
1134 | {0x0000a19c, 0x00000000}, | 716 | {0x0000147c, 0x00000000}, |
1135 | {0x0000a1a0, 0x00000000}, | 717 | {0x00008000, 0x00000000}, |
1136 | {0x0000a1a4, 0x00000000}, | 718 | {0x00008004, 0x00000000}, |
1137 | {0x0000a1a8, 0x00000000}, | 719 | {0x00008008, 0x00000000}, |
1138 | {0x0000a1ac, 0x00000000}, | 720 | {0x0000800c, 0x00000000}, |
1139 | {0x0000a1b0, 0x00000000}, | 721 | {0x00008018, 0x00000000}, |
1140 | {0x0000a1b4, 0x00000000}, | 722 | {0x00008020, 0x00000000}, |
1141 | {0x0000a1b8, 0x00000000}, | 723 | {0x00008038, 0x00000000}, |
1142 | {0x0000a1bc, 0x00000000}, | 724 | {0x0000803c, 0x00000000}, |
1143 | {0x0000a1c0, 0x00000000}, | 725 | {0x00008040, 0x00000000}, |
1144 | {0x0000a1c4, 0x00000000}, | 726 | {0x00008044, 0x00000000}, |
1145 | {0x0000a1c8, 0x00000000}, | 727 | {0x00008048, 0x00000000}, |
1146 | {0x0000a1cc, 0x00000000}, | 728 | {0x0000804c, 0xffffffff}, |
1147 | {0x0000a1d0, 0x00000000}, | 729 | {0x00008054, 0x00000000}, |
1148 | {0x0000a1d4, 0x00000000}, | 730 | {0x00008058, 0x00000000}, |
1149 | {0x0000a1d8, 0x00000000}, | 731 | {0x0000805c, 0x000fc78f}, |
1150 | {0x0000a1dc, 0x00000000}, | 732 | {0x00008060, 0x0000000f}, |
1151 | {0x0000a1e0, 0x00000000}, | 733 | {0x00008064, 0x00000000}, |
1152 | {0x0000a1e4, 0x00000000}, | 734 | {0x00008070, 0x00000310}, |
1153 | {0x0000a1e8, 0x00000000}, | 735 | {0x00008074, 0x00000020}, |
1154 | {0x0000a1ec, 0x00000000}, | 736 | {0x00008078, 0x00000000}, |
1155 | {0x0000a1f0, 0x00000396}, | 737 | {0x0000809c, 0x0000000f}, |
1156 | {0x0000a1f4, 0x00000396}, | 738 | {0x000080a0, 0x00000000}, |
1157 | {0x0000a1f8, 0x00000396}, | 739 | {0x000080a4, 0x02ff0000}, |
1158 | {0x0000a1fc, 0x00000296}, | 740 | {0x000080a8, 0x0e070605}, |
741 | {0x000080ac, 0x0000000d}, | ||
742 | {0x000080b0, 0x00000000}, | ||
743 | {0x000080b4, 0x00000000}, | ||
744 | {0x000080b8, 0x00000000}, | ||
745 | {0x000080bc, 0x00000000}, | ||
746 | {0x000080c0, 0x2a800000}, | ||
747 | {0x000080c4, 0x06900168}, | ||
748 | {0x000080c8, 0x13881c22}, | ||
749 | {0x000080cc, 0x01f40000}, | ||
750 | {0x000080d0, 0x00252500}, | ||
751 | {0x000080d4, 0x00a00000}, | ||
752 | {0x000080d8, 0x00400000}, | ||
753 | {0x000080dc, 0x00000000}, | ||
754 | {0x000080e0, 0xffffffff}, | ||
755 | {0x000080e4, 0x0000ffff}, | ||
756 | {0x000080e8, 0x3f3f3f3f}, | ||
757 | {0x000080ec, 0x00000000}, | ||
758 | {0x000080f0, 0x00000000}, | ||
759 | {0x000080f4, 0x00000000}, | ||
760 | {0x000080fc, 0x00020000}, | ||
761 | {0x00008100, 0x00000000}, | ||
762 | {0x00008108, 0x00000052}, | ||
763 | {0x0000810c, 0x00000000}, | ||
764 | {0x00008110, 0x00000000}, | ||
765 | {0x00008114, 0x000007ff}, | ||
766 | {0x00008118, 0x000000aa}, | ||
767 | {0x0000811c, 0x00003210}, | ||
768 | {0x00008124, 0x00000000}, | ||
769 | {0x00008128, 0x00000000}, | ||
770 | {0x0000812c, 0x00000000}, | ||
771 | {0x00008130, 0x00000000}, | ||
772 | {0x00008134, 0x00000000}, | ||
773 | {0x00008138, 0x00000000}, | ||
774 | {0x0000813c, 0x0000ffff}, | ||
775 | {0x00008144, 0xffffffff}, | ||
776 | {0x00008168, 0x00000000}, | ||
777 | {0x0000816c, 0x00000000}, | ||
778 | {0x00008170, 0x18486200}, | ||
779 | {0x00008174, 0x33332210}, | ||
780 | {0x00008178, 0x00000000}, | ||
781 | {0x0000817c, 0x00020000}, | ||
782 | {0x000081c0, 0x00000000}, | ||
783 | {0x000081c4, 0x33332210}, | ||
784 | {0x000081d4, 0x00000000}, | ||
785 | {0x000081ec, 0x00000000}, | ||
786 | {0x000081f0, 0x00000000}, | ||
787 | {0x000081f4, 0x00000000}, | ||
788 | {0x000081f8, 0x00000000}, | ||
789 | {0x000081fc, 0x00000000}, | ||
790 | {0x00008240, 0x00100000}, | ||
791 | {0x00008244, 0x0010f400}, | ||
792 | {0x00008248, 0x00000800}, | ||
793 | {0x0000824c, 0x0001e800}, | ||
794 | {0x00008250, 0x00000000}, | ||
795 | {0x00008254, 0x00000000}, | ||
796 | {0x00008258, 0x00000000}, | ||
797 | {0x0000825c, 0x40000000}, | ||
798 | {0x00008260, 0x00080922}, | ||
799 | {0x00008264, 0x9ca00010}, | ||
800 | {0x00008268, 0xffffffff}, | ||
801 | {0x0000826c, 0x0000ffff}, | ||
802 | {0x00008270, 0x00000000}, | ||
803 | {0x00008274, 0x40000000}, | ||
804 | {0x00008278, 0x003e4180}, | ||
805 | {0x0000827c, 0x00000004}, | ||
806 | {0x00008284, 0x0000002c}, | ||
807 | {0x00008288, 0x0000002c}, | ||
808 | {0x0000828c, 0x000000ff}, | ||
809 | {0x00008294, 0x00000000}, | ||
810 | {0x00008298, 0x00000000}, | ||
811 | {0x0000829c, 0x00000000}, | ||
812 | {0x00008300, 0x00000140}, | ||
813 | {0x00008314, 0x00000000}, | ||
814 | {0x0000831c, 0x0000010d}, | ||
815 | {0x00008328, 0x00000000}, | ||
816 | {0x0000832c, 0x00000007}, | ||
817 | {0x00008330, 0x00000302}, | ||
818 | {0x00008334, 0x00000700}, | ||
819 | {0x00008338, 0x00ff0000}, | ||
820 | {0x0000833c, 0x02400000}, | ||
821 | {0x00008340, 0x000107ff}, | ||
822 | {0x00008344, 0xa248105b}, | ||
823 | {0x00008348, 0x008f0000}, | ||
824 | {0x0000835c, 0x00000000}, | ||
825 | {0x00008360, 0xffffffff}, | ||
826 | {0x00008364, 0xffffffff}, | ||
827 | {0x00008368, 0x00000000}, | ||
828 | {0x00008370, 0x00000000}, | ||
829 | {0x00008374, 0x000000ff}, | ||
830 | {0x00008378, 0x00000000}, | ||
831 | {0x0000837c, 0x00000000}, | ||
832 | {0x00008380, 0xffffffff}, | ||
833 | {0x00008384, 0xffffffff}, | ||
834 | {0x00008390, 0xffffffff}, | ||
835 | {0x00008394, 0xffffffff}, | ||
836 | {0x00008398, 0x00000000}, | ||
837 | {0x0000839c, 0x00000000}, | ||
838 | {0x000083a0, 0x00000000}, | ||
839 | {0x000083a4, 0x0000fa14}, | ||
840 | {0x000083a8, 0x000f0c00}, | ||
841 | {0x000083ac, 0x33332210}, | ||
842 | {0x000083b0, 0x33332210}, | ||
843 | {0x000083b4, 0x33332210}, | ||
844 | {0x000083b8, 0x33332210}, | ||
845 | {0x000083bc, 0x00000000}, | ||
846 | {0x000083c0, 0x00000000}, | ||
847 | {0x000083c4, 0x00000000}, | ||
848 | {0x000083c8, 0x00000000}, | ||
849 | {0x000083cc, 0x00000200}, | ||
850 | {0x000083d0, 0x000301ff}, | ||
1159 | }; | 851 | }; |
1160 | 852 | ||
1161 | #endif | 853 | #endif /* INITVALS_9485_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h index 06b3f0df9fad..6e1915aee712 100644 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010 Atheros Communications Inc. | 2 | * Copyright (c) 2010-2011 Atheros Communications Inc. |
3 | * Copyright (c) 2011-2012 Qualcomm Atheros Inc. | ||
3 | * | 4 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
@@ -19,18 +20,7 @@ | |||
19 | 20 | ||
20 | /* AR9580 1.0 */ | 21 | /* AR9580 1.0 */ |
21 | 22 | ||
22 | static const u32 ar9580_1p0_modes_fast_clock[][3] = { | 23 | #define ar9580_1p0_modes_fast_clock ar9300Modes_fast_clock_2p2 |
23 | /* Addr 5G_HT20 5G_HT40 */ | ||
24 | {0x00001030, 0x00000268, 0x000004d0}, | ||
25 | {0x00001070, 0x0000018c, 0x00000318}, | ||
26 | {0x000010b0, 0x00000fd0, 0x00001fa0}, | ||
27 | {0x00008014, 0x044c044c, 0x08980898}, | ||
28 | {0x0000801c, 0x148ec02b, 0x148ec057}, | ||
29 | {0x00008318, 0x000044c0, 0x00008980}, | ||
30 | {0x00009e00, 0x0372131c, 0x0372131c}, | ||
31 | {0x0000a230, 0x0000000b, 0x00000016}, | ||
32 | {0x0000a254, 0x00000898, 0x00001130}, | ||
33 | }; | ||
34 | 24 | ||
35 | static const u32 ar9580_1p0_radio_postamble[][5] = { | 25 | static const u32 ar9580_1p0_radio_postamble[][5] = { |
36 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 26 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
@@ -208,17 +198,7 @@ static const u32 ar9580_1p0_baseband_core[][2] = { | |||
208 | {0x0000c420, 0x00000000}, | 198 | {0x0000c420, 0x00000000}, |
209 | }; | 199 | }; |
210 | 200 | ||
211 | static const u32 ar9580_1p0_mac_postamble[][5] = { | 201 | #define ar9580_1p0_mac_postamble ar9300_2p2_mac_postamble |
212 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
213 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | ||
214 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | ||
215 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | ||
216 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | ||
217 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | ||
218 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | ||
219 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | ||
220 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | ||
221 | }; | ||
222 | 202 | ||
223 | static const u32 ar9580_1p0_low_ob_db_tx_gain_table[][5] = { | 203 | static const u32 ar9580_1p0_low_ob_db_tx_gain_table[][5] = { |
224 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 204 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
@@ -326,111 +306,7 @@ static const u32 ar9580_1p0_low_ob_db_tx_gain_table[][5] = { | |||
326 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 306 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
327 | }; | 307 | }; |
328 | 308 | ||
329 | static const u32 ar9580_1p0_high_power_tx_gain_table[][5] = { | 309 | #define ar9580_1p0_high_power_tx_gain_table ar9580_1p0_low_ob_db_tx_gain_table |
330 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
331 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
332 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
333 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
334 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
335 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | ||
336 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
337 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | ||
338 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | ||
339 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | ||
340 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | ||
341 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, | ||
342 | {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, | ||
343 | {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, | ||
344 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, | ||
345 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, | ||
346 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, | ||
347 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, | ||
348 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, | ||
349 | {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, | ||
350 | {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, | ||
351 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, | ||
352 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, | ||
353 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, | ||
354 | {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, | ||
355 | {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83}, | ||
356 | {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84}, | ||
357 | {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3}, | ||
358 | {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5}, | ||
359 | {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9}, | ||
360 | {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb}, | ||
361 | {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
362 | {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
363 | {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
364 | {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
365 | {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
366 | {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
367 | {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, | ||
368 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | ||
369 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | ||
370 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | ||
371 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | ||
372 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, | ||
373 | {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, | ||
374 | {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, | ||
375 | {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, | ||
376 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, | ||
377 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, | ||
378 | {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, | ||
379 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, | ||
380 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, | ||
381 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, | ||
382 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, | ||
383 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, | ||
384 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, | ||
385 | {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, | ||
386 | {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, | ||
387 | {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x47801a83, 0x47801a83}, | ||
388 | {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x4a801c84, 0x4a801c84}, | ||
389 | {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x4e801ce3, 0x4e801ce3}, | ||
390 | {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x52801ce5, 0x52801ce5}, | ||
391 | {0x0000a5dc, 0x7082708c, 0x7082708c, 0x56801ce9, 0x56801ce9}, | ||
392 | {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x5a801ceb, 0x5a801ceb}, | ||
393 | {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
394 | {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
395 | {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
396 | {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
397 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
398 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
399 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | ||
400 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
401 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
402 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
403 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
404 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
405 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
406 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
407 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
408 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
409 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
410 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
411 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
412 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
413 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
414 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
415 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
416 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
417 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
418 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
419 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
420 | {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
421 | {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
422 | {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
423 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
424 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | ||
425 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, | ||
426 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
427 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | ||
428 | {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, | ||
429 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
430 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | ||
431 | {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, | ||
432 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
433 | }; | ||
434 | 310 | ||
435 | static const u32 ar9580_1p0_lowest_ob_db_tx_gain_table[][5] = { | 311 | static const u32 ar9580_1p0_lowest_ob_db_tx_gain_table[][5] = { |
436 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 312 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
@@ -538,12 +414,7 @@ static const u32 ar9580_1p0_lowest_ob_db_tx_gain_table[][5] = { | |||
538 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 414 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
539 | }; | 415 | }; |
540 | 416 | ||
541 | static const u32 ar9580_1p0_baseband_core_txfir_coeff_japan_2484[][2] = { | 417 | #define ar9580_1p0_baseband_core_txfir_coeff_japan_2484 ar9462_2p0_baseband_core_txfir_coeff_japan_2484 |
542 | /* Addr allmodes */ | ||
543 | {0x0000a398, 0x00000000}, | ||
544 | {0x0000a39c, 0x6f7f0301}, | ||
545 | {0x0000a3a0, 0xca9228ee}, | ||
546 | }; | ||
547 | 418 | ||
548 | static const u32 ar9580_1p0_mac_core[][2] = { | 419 | static const u32 ar9580_1p0_mac_core[][2] = { |
549 | /* Addr allmodes */ | 420 | /* Addr allmodes */ |
@@ -808,376 +679,11 @@ static const u32 ar9580_1p0_mixed_ob_db_tx_gain_table[][5] = { | |||
808 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 679 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
809 | }; | 680 | }; |
810 | 681 | ||
811 | static const u32 ar9580_1p0_wo_xlna_rx_gain_table[][2] = { | 682 | #define ar9580_1p0_wo_xlna_rx_gain_table ar9300Common_wo_xlna_rx_gain_table_2p2 |
812 | /* Addr allmodes */ | ||
813 | {0x0000a000, 0x00010000}, | ||
814 | {0x0000a004, 0x00030002}, | ||
815 | {0x0000a008, 0x00050004}, | ||
816 | {0x0000a00c, 0x00810080}, | ||
817 | {0x0000a010, 0x00830082}, | ||
818 | {0x0000a014, 0x01810180}, | ||
819 | {0x0000a018, 0x01830182}, | ||
820 | {0x0000a01c, 0x01850184}, | ||
821 | {0x0000a020, 0x01890188}, | ||
822 | {0x0000a024, 0x018b018a}, | ||
823 | {0x0000a028, 0x018d018c}, | ||
824 | {0x0000a02c, 0x03820190}, | ||
825 | {0x0000a030, 0x03840383}, | ||
826 | {0x0000a034, 0x03880385}, | ||
827 | {0x0000a038, 0x038a0389}, | ||
828 | {0x0000a03c, 0x038c038b}, | ||
829 | {0x0000a040, 0x0390038d}, | ||
830 | {0x0000a044, 0x03920391}, | ||
831 | {0x0000a048, 0x03940393}, | ||
832 | {0x0000a04c, 0x03960395}, | ||
833 | {0x0000a050, 0x00000000}, | ||
834 | {0x0000a054, 0x00000000}, | ||
835 | {0x0000a058, 0x00000000}, | ||
836 | {0x0000a05c, 0x00000000}, | ||
837 | {0x0000a060, 0x00000000}, | ||
838 | {0x0000a064, 0x00000000}, | ||
839 | {0x0000a068, 0x00000000}, | ||
840 | {0x0000a06c, 0x00000000}, | ||
841 | {0x0000a070, 0x00000000}, | ||
842 | {0x0000a074, 0x00000000}, | ||
843 | {0x0000a078, 0x00000000}, | ||
844 | {0x0000a07c, 0x00000000}, | ||
845 | {0x0000a080, 0x29292929}, | ||
846 | {0x0000a084, 0x29292929}, | ||
847 | {0x0000a088, 0x29292929}, | ||
848 | {0x0000a08c, 0x29292929}, | ||
849 | {0x0000a090, 0x22292929}, | ||
850 | {0x0000a094, 0x1d1d2222}, | ||
851 | {0x0000a098, 0x0c111117}, | ||
852 | {0x0000a09c, 0x00030303}, | ||
853 | {0x0000a0a0, 0x00000000}, | ||
854 | {0x0000a0a4, 0x00000000}, | ||
855 | {0x0000a0a8, 0x00000000}, | ||
856 | {0x0000a0ac, 0x00000000}, | ||
857 | {0x0000a0b0, 0x00000000}, | ||
858 | {0x0000a0b4, 0x00000000}, | ||
859 | {0x0000a0b8, 0x00000000}, | ||
860 | {0x0000a0bc, 0x00000000}, | ||
861 | {0x0000a0c0, 0x001f0000}, | ||
862 | {0x0000a0c4, 0x01000101}, | ||
863 | {0x0000a0c8, 0x011e011f}, | ||
864 | {0x0000a0cc, 0x011c011d}, | ||
865 | {0x0000a0d0, 0x02030204}, | ||
866 | {0x0000a0d4, 0x02010202}, | ||
867 | {0x0000a0d8, 0x021f0200}, | ||
868 | {0x0000a0dc, 0x0302021e}, | ||
869 | {0x0000a0e0, 0x03000301}, | ||
870 | {0x0000a0e4, 0x031e031f}, | ||
871 | {0x0000a0e8, 0x0402031d}, | ||
872 | {0x0000a0ec, 0x04000401}, | ||
873 | {0x0000a0f0, 0x041e041f}, | ||
874 | {0x0000a0f4, 0x0502041d}, | ||
875 | {0x0000a0f8, 0x05000501}, | ||
876 | {0x0000a0fc, 0x051e051f}, | ||
877 | {0x0000a100, 0x06010602}, | ||
878 | {0x0000a104, 0x061f0600}, | ||
879 | {0x0000a108, 0x061d061e}, | ||
880 | {0x0000a10c, 0x07020703}, | ||
881 | {0x0000a110, 0x07000701}, | ||
882 | {0x0000a114, 0x00000000}, | ||
883 | {0x0000a118, 0x00000000}, | ||
884 | {0x0000a11c, 0x00000000}, | ||
885 | {0x0000a120, 0x00000000}, | ||
886 | {0x0000a124, 0x00000000}, | ||
887 | {0x0000a128, 0x00000000}, | ||
888 | {0x0000a12c, 0x00000000}, | ||
889 | {0x0000a130, 0x00000000}, | ||
890 | {0x0000a134, 0x00000000}, | ||
891 | {0x0000a138, 0x00000000}, | ||
892 | {0x0000a13c, 0x00000000}, | ||
893 | {0x0000a140, 0x001f0000}, | ||
894 | {0x0000a144, 0x01000101}, | ||
895 | {0x0000a148, 0x011e011f}, | ||
896 | {0x0000a14c, 0x011c011d}, | ||
897 | {0x0000a150, 0x02030204}, | ||
898 | {0x0000a154, 0x02010202}, | ||
899 | {0x0000a158, 0x021f0200}, | ||
900 | {0x0000a15c, 0x0302021e}, | ||
901 | {0x0000a160, 0x03000301}, | ||
902 | {0x0000a164, 0x031e031f}, | ||
903 | {0x0000a168, 0x0402031d}, | ||
904 | {0x0000a16c, 0x04000401}, | ||
905 | {0x0000a170, 0x041e041f}, | ||
906 | {0x0000a174, 0x0502041d}, | ||
907 | {0x0000a178, 0x05000501}, | ||
908 | {0x0000a17c, 0x051e051f}, | ||
909 | {0x0000a180, 0x06010602}, | ||
910 | {0x0000a184, 0x061f0600}, | ||
911 | {0x0000a188, 0x061d061e}, | ||
912 | {0x0000a18c, 0x07020703}, | ||
913 | {0x0000a190, 0x07000701}, | ||
914 | {0x0000a194, 0x00000000}, | ||
915 | {0x0000a198, 0x00000000}, | ||
916 | {0x0000a19c, 0x00000000}, | ||
917 | {0x0000a1a0, 0x00000000}, | ||
918 | {0x0000a1a4, 0x00000000}, | ||
919 | {0x0000a1a8, 0x00000000}, | ||
920 | {0x0000a1ac, 0x00000000}, | ||
921 | {0x0000a1b0, 0x00000000}, | ||
922 | {0x0000a1b4, 0x00000000}, | ||
923 | {0x0000a1b8, 0x00000000}, | ||
924 | {0x0000a1bc, 0x00000000}, | ||
925 | {0x0000a1c0, 0x00000000}, | ||
926 | {0x0000a1c4, 0x00000000}, | ||
927 | {0x0000a1c8, 0x00000000}, | ||
928 | {0x0000a1cc, 0x00000000}, | ||
929 | {0x0000a1d0, 0x00000000}, | ||
930 | {0x0000a1d4, 0x00000000}, | ||
931 | {0x0000a1d8, 0x00000000}, | ||
932 | {0x0000a1dc, 0x00000000}, | ||
933 | {0x0000a1e0, 0x00000000}, | ||
934 | {0x0000a1e4, 0x00000000}, | ||
935 | {0x0000a1e8, 0x00000000}, | ||
936 | {0x0000a1ec, 0x00000000}, | ||
937 | {0x0000a1f0, 0x00000396}, | ||
938 | {0x0000a1f4, 0x00000396}, | ||
939 | {0x0000a1f8, 0x00000396}, | ||
940 | {0x0000a1fc, 0x00000196}, | ||
941 | {0x0000b000, 0x00010000}, | ||
942 | {0x0000b004, 0x00030002}, | ||
943 | {0x0000b008, 0x00050004}, | ||
944 | {0x0000b00c, 0x00810080}, | ||
945 | {0x0000b010, 0x00830082}, | ||
946 | {0x0000b014, 0x01810180}, | ||
947 | {0x0000b018, 0x01830182}, | ||
948 | {0x0000b01c, 0x01850184}, | ||
949 | {0x0000b020, 0x02810280}, | ||
950 | {0x0000b024, 0x02830282}, | ||
951 | {0x0000b028, 0x02850284}, | ||
952 | {0x0000b02c, 0x02890288}, | ||
953 | {0x0000b030, 0x028b028a}, | ||
954 | {0x0000b034, 0x0388028c}, | ||
955 | {0x0000b038, 0x038a0389}, | ||
956 | {0x0000b03c, 0x038c038b}, | ||
957 | {0x0000b040, 0x0390038d}, | ||
958 | {0x0000b044, 0x03920391}, | ||
959 | {0x0000b048, 0x03940393}, | ||
960 | {0x0000b04c, 0x03960395}, | ||
961 | {0x0000b050, 0x00000000}, | ||
962 | {0x0000b054, 0x00000000}, | ||
963 | {0x0000b058, 0x00000000}, | ||
964 | {0x0000b05c, 0x00000000}, | ||
965 | {0x0000b060, 0x00000000}, | ||
966 | {0x0000b064, 0x00000000}, | ||
967 | {0x0000b068, 0x00000000}, | ||
968 | {0x0000b06c, 0x00000000}, | ||
969 | {0x0000b070, 0x00000000}, | ||
970 | {0x0000b074, 0x00000000}, | ||
971 | {0x0000b078, 0x00000000}, | ||
972 | {0x0000b07c, 0x00000000}, | ||
973 | {0x0000b080, 0x32323232}, | ||
974 | {0x0000b084, 0x2f2f3232}, | ||
975 | {0x0000b088, 0x23282a2d}, | ||
976 | {0x0000b08c, 0x1c1e2123}, | ||
977 | {0x0000b090, 0x14171919}, | ||
978 | {0x0000b094, 0x0e0e1214}, | ||
979 | {0x0000b098, 0x03050707}, | ||
980 | {0x0000b09c, 0x00030303}, | ||
981 | {0x0000b0a0, 0x00000000}, | ||
982 | {0x0000b0a4, 0x00000000}, | ||
983 | {0x0000b0a8, 0x00000000}, | ||
984 | {0x0000b0ac, 0x00000000}, | ||
985 | {0x0000b0b0, 0x00000000}, | ||
986 | {0x0000b0b4, 0x00000000}, | ||
987 | {0x0000b0b8, 0x00000000}, | ||
988 | {0x0000b0bc, 0x00000000}, | ||
989 | {0x0000b0c0, 0x003f0020}, | ||
990 | {0x0000b0c4, 0x00400041}, | ||
991 | {0x0000b0c8, 0x0140005f}, | ||
992 | {0x0000b0cc, 0x0160015f}, | ||
993 | {0x0000b0d0, 0x017e017f}, | ||
994 | {0x0000b0d4, 0x02410242}, | ||
995 | {0x0000b0d8, 0x025f0240}, | ||
996 | {0x0000b0dc, 0x027f0260}, | ||
997 | {0x0000b0e0, 0x0341027e}, | ||
998 | {0x0000b0e4, 0x035f0340}, | ||
999 | {0x0000b0e8, 0x037f0360}, | ||
1000 | {0x0000b0ec, 0x04400441}, | ||
1001 | {0x0000b0f0, 0x0460045f}, | ||
1002 | {0x0000b0f4, 0x0541047f}, | ||
1003 | {0x0000b0f8, 0x055f0540}, | ||
1004 | {0x0000b0fc, 0x057f0560}, | ||
1005 | {0x0000b100, 0x06400641}, | ||
1006 | {0x0000b104, 0x0660065f}, | ||
1007 | {0x0000b108, 0x067e067f}, | ||
1008 | {0x0000b10c, 0x07410742}, | ||
1009 | {0x0000b110, 0x075f0740}, | ||
1010 | {0x0000b114, 0x077f0760}, | ||
1011 | {0x0000b118, 0x07800781}, | ||
1012 | {0x0000b11c, 0x07a0079f}, | ||
1013 | {0x0000b120, 0x07c107bf}, | ||
1014 | {0x0000b124, 0x000007c0}, | ||
1015 | {0x0000b128, 0x00000000}, | ||
1016 | {0x0000b12c, 0x00000000}, | ||
1017 | {0x0000b130, 0x00000000}, | ||
1018 | {0x0000b134, 0x00000000}, | ||
1019 | {0x0000b138, 0x00000000}, | ||
1020 | {0x0000b13c, 0x00000000}, | ||
1021 | {0x0000b140, 0x003f0020}, | ||
1022 | {0x0000b144, 0x00400041}, | ||
1023 | {0x0000b148, 0x0140005f}, | ||
1024 | {0x0000b14c, 0x0160015f}, | ||
1025 | {0x0000b150, 0x017e017f}, | ||
1026 | {0x0000b154, 0x02410242}, | ||
1027 | {0x0000b158, 0x025f0240}, | ||
1028 | {0x0000b15c, 0x027f0260}, | ||
1029 | {0x0000b160, 0x0341027e}, | ||
1030 | {0x0000b164, 0x035f0340}, | ||
1031 | {0x0000b168, 0x037f0360}, | ||
1032 | {0x0000b16c, 0x04400441}, | ||
1033 | {0x0000b170, 0x0460045f}, | ||
1034 | {0x0000b174, 0x0541047f}, | ||
1035 | {0x0000b178, 0x055f0540}, | ||
1036 | {0x0000b17c, 0x057f0560}, | ||
1037 | {0x0000b180, 0x06400641}, | ||
1038 | {0x0000b184, 0x0660065f}, | ||
1039 | {0x0000b188, 0x067e067f}, | ||
1040 | {0x0000b18c, 0x07410742}, | ||
1041 | {0x0000b190, 0x075f0740}, | ||
1042 | {0x0000b194, 0x077f0760}, | ||
1043 | {0x0000b198, 0x07800781}, | ||
1044 | {0x0000b19c, 0x07a0079f}, | ||
1045 | {0x0000b1a0, 0x07c107bf}, | ||
1046 | {0x0000b1a4, 0x000007c0}, | ||
1047 | {0x0000b1a8, 0x00000000}, | ||
1048 | {0x0000b1ac, 0x00000000}, | ||
1049 | {0x0000b1b0, 0x00000000}, | ||
1050 | {0x0000b1b4, 0x00000000}, | ||
1051 | {0x0000b1b8, 0x00000000}, | ||
1052 | {0x0000b1bc, 0x00000000}, | ||
1053 | {0x0000b1c0, 0x00000000}, | ||
1054 | {0x0000b1c4, 0x00000000}, | ||
1055 | {0x0000b1c8, 0x00000000}, | ||
1056 | {0x0000b1cc, 0x00000000}, | ||
1057 | {0x0000b1d0, 0x00000000}, | ||
1058 | {0x0000b1d4, 0x00000000}, | ||
1059 | {0x0000b1d8, 0x00000000}, | ||
1060 | {0x0000b1dc, 0x00000000}, | ||
1061 | {0x0000b1e0, 0x00000000}, | ||
1062 | {0x0000b1e4, 0x00000000}, | ||
1063 | {0x0000b1e8, 0x00000000}, | ||
1064 | {0x0000b1ec, 0x00000000}, | ||
1065 | {0x0000b1f0, 0x00000396}, | ||
1066 | {0x0000b1f4, 0x00000396}, | ||
1067 | {0x0000b1f8, 0x00000396}, | ||
1068 | {0x0000b1fc, 0x00000196}, | ||
1069 | }; | ||
1070 | 683 | ||
1071 | static const u32 ar9580_1p0_soc_postamble[][5] = { | 684 | #define ar9580_1p0_soc_postamble ar9300_2p2_soc_postamble |
1072 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
1073 | {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, | ||
1074 | }; | ||
1075 | 685 | ||
1076 | static const u32 ar9580_1p0_high_ob_db_tx_gain_table[][5] = { | 686 | #define ar9580_1p0_high_ob_db_tx_gain_table ar9300Modes_high_ob_db_tx_gain_table_2p2 |
1077 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
1078 | {0x0000a2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, | ||
1079 | {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, | ||
1080 | {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, | ||
1081 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1082 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | ||
1083 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | ||
1084 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | ||
1085 | {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | ||
1086 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | ||
1087 | {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | ||
1088 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | ||
1089 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | ||
1090 | {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | ||
1091 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | ||
1092 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | ||
1093 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | ||
1094 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | ||
1095 | {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | ||
1096 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | ||
1097 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | ||
1098 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | ||
1099 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | ||
1100 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | ||
1101 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | ||
1102 | {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, | ||
1103 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | ||
1104 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | ||
1105 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | ||
1106 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | ||
1107 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | ||
1108 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1109 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1110 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1111 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1112 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1113 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1114 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
1115 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | ||
1116 | {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | ||
1117 | {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | ||
1118 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | ||
1119 | {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | ||
1120 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | ||
1121 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | ||
1122 | {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | ||
1123 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | ||
1124 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | ||
1125 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | ||
1126 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | ||
1127 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | ||
1128 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | ||
1129 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | ||
1130 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | ||
1131 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | ||
1132 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | ||
1133 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | ||
1134 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | ||
1135 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | ||
1136 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | ||
1137 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | ||
1138 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | ||
1139 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | ||
1140 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1141 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1142 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1143 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1144 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1145 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1146 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
1147 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1148 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1149 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1150 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1151 | {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
1152 | {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
1153 | {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
1154 | {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
1155 | {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
1156 | {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
1157 | {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
1158 | {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1159 | {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1160 | {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1161 | {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1162 | {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1163 | {0x0000b2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, | ||
1164 | {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, | ||
1165 | {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, | ||
1166 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1167 | {0x0000c2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, | ||
1168 | {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, | ||
1169 | {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, | ||
1170 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
1171 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | ||
1172 | {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, | ||
1173 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
1174 | {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | ||
1175 | {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, | ||
1176 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
1177 | {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | ||
1178 | {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, | ||
1179 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | ||
1180 | }; | ||
1181 | 687 | ||
1182 | static const u32 ar9580_1p0_soc_preamble[][2] = { | 688 | static const u32 ar9580_1p0_soc_preamble[][2] = { |
1183 | /* Addr allmodes */ | 689 | /* Addr allmodes */ |
@@ -1189,265 +695,7 @@ static const u32 ar9580_1p0_soc_preamble[][2] = { | |||
1189 | {0x00007048, 0x00000008}, | 695 | {0x00007048, 0x00000008}, |
1190 | }; | 696 | }; |
1191 | 697 | ||
1192 | static const u32 ar9580_1p0_rx_gain_table[][2] = { | 698 | #define ar9580_1p0_rx_gain_table ar9462_common_rx_gain_table_2p0 |
1193 | /* Addr allmodes */ | ||
1194 | {0x0000a000, 0x00010000}, | ||
1195 | {0x0000a004, 0x00030002}, | ||
1196 | {0x0000a008, 0x00050004}, | ||
1197 | {0x0000a00c, 0x00810080}, | ||
1198 | {0x0000a010, 0x00830082}, | ||
1199 | {0x0000a014, 0x01810180}, | ||
1200 | {0x0000a018, 0x01830182}, | ||
1201 | {0x0000a01c, 0x01850184}, | ||
1202 | {0x0000a020, 0x01890188}, | ||
1203 | {0x0000a024, 0x018b018a}, | ||
1204 | {0x0000a028, 0x018d018c}, | ||
1205 | {0x0000a02c, 0x01910190}, | ||
1206 | {0x0000a030, 0x01930192}, | ||
1207 | {0x0000a034, 0x01950194}, | ||
1208 | {0x0000a038, 0x038a0196}, | ||
1209 | {0x0000a03c, 0x038c038b}, | ||
1210 | {0x0000a040, 0x0390038d}, | ||
1211 | {0x0000a044, 0x03920391}, | ||
1212 | {0x0000a048, 0x03940393}, | ||
1213 | {0x0000a04c, 0x03960395}, | ||
1214 | {0x0000a050, 0x00000000}, | ||
1215 | {0x0000a054, 0x00000000}, | ||
1216 | {0x0000a058, 0x00000000}, | ||
1217 | {0x0000a05c, 0x00000000}, | ||
1218 | {0x0000a060, 0x00000000}, | ||
1219 | {0x0000a064, 0x00000000}, | ||
1220 | {0x0000a068, 0x00000000}, | ||
1221 | {0x0000a06c, 0x00000000}, | ||
1222 | {0x0000a070, 0x00000000}, | ||
1223 | {0x0000a074, 0x00000000}, | ||
1224 | {0x0000a078, 0x00000000}, | ||
1225 | {0x0000a07c, 0x00000000}, | ||
1226 | {0x0000a080, 0x22222229}, | ||
1227 | {0x0000a084, 0x1d1d1d1d}, | ||
1228 | {0x0000a088, 0x1d1d1d1d}, | ||
1229 | {0x0000a08c, 0x1d1d1d1d}, | ||
1230 | {0x0000a090, 0x171d1d1d}, | ||
1231 | {0x0000a094, 0x11111717}, | ||
1232 | {0x0000a098, 0x00030311}, | ||
1233 | {0x0000a09c, 0x00000000}, | ||
1234 | {0x0000a0a0, 0x00000000}, | ||
1235 | {0x0000a0a4, 0x00000000}, | ||
1236 | {0x0000a0a8, 0x00000000}, | ||
1237 | {0x0000a0ac, 0x00000000}, | ||
1238 | {0x0000a0b0, 0x00000000}, | ||
1239 | {0x0000a0b4, 0x00000000}, | ||
1240 | {0x0000a0b8, 0x00000000}, | ||
1241 | {0x0000a0bc, 0x00000000}, | ||
1242 | {0x0000a0c0, 0x001f0000}, | ||
1243 | {0x0000a0c4, 0x01000101}, | ||
1244 | {0x0000a0c8, 0x011e011f}, | ||
1245 | {0x0000a0cc, 0x011c011d}, | ||
1246 | {0x0000a0d0, 0x02030204}, | ||
1247 | {0x0000a0d4, 0x02010202}, | ||
1248 | {0x0000a0d8, 0x021f0200}, | ||
1249 | {0x0000a0dc, 0x0302021e}, | ||
1250 | {0x0000a0e0, 0x03000301}, | ||
1251 | {0x0000a0e4, 0x031e031f}, | ||
1252 | {0x0000a0e8, 0x0402031d}, | ||
1253 | {0x0000a0ec, 0x04000401}, | ||
1254 | {0x0000a0f0, 0x041e041f}, | ||
1255 | {0x0000a0f4, 0x0502041d}, | ||
1256 | {0x0000a0f8, 0x05000501}, | ||
1257 | {0x0000a0fc, 0x051e051f}, | ||
1258 | {0x0000a100, 0x06010602}, | ||
1259 | {0x0000a104, 0x061f0600}, | ||
1260 | {0x0000a108, 0x061d061e}, | ||
1261 | {0x0000a10c, 0x07020703}, | ||
1262 | {0x0000a110, 0x07000701}, | ||
1263 | {0x0000a114, 0x00000000}, | ||
1264 | {0x0000a118, 0x00000000}, | ||
1265 | {0x0000a11c, 0x00000000}, | ||
1266 | {0x0000a120, 0x00000000}, | ||
1267 | {0x0000a124, 0x00000000}, | ||
1268 | {0x0000a128, 0x00000000}, | ||
1269 | {0x0000a12c, 0x00000000}, | ||
1270 | {0x0000a130, 0x00000000}, | ||
1271 | {0x0000a134, 0x00000000}, | ||
1272 | {0x0000a138, 0x00000000}, | ||
1273 | {0x0000a13c, 0x00000000}, | ||
1274 | {0x0000a140, 0x001f0000}, | ||
1275 | {0x0000a144, 0x01000101}, | ||
1276 | {0x0000a148, 0x011e011f}, | ||
1277 | {0x0000a14c, 0x011c011d}, | ||
1278 | {0x0000a150, 0x02030204}, | ||
1279 | {0x0000a154, 0x02010202}, | ||
1280 | {0x0000a158, 0x021f0200}, | ||
1281 | {0x0000a15c, 0x0302021e}, | ||
1282 | {0x0000a160, 0x03000301}, | ||
1283 | {0x0000a164, 0x031e031f}, | ||
1284 | {0x0000a168, 0x0402031d}, | ||
1285 | {0x0000a16c, 0x04000401}, | ||
1286 | {0x0000a170, 0x041e041f}, | ||
1287 | {0x0000a174, 0x0502041d}, | ||
1288 | {0x0000a178, 0x05000501}, | ||
1289 | {0x0000a17c, 0x051e051f}, | ||
1290 | {0x0000a180, 0x06010602}, | ||
1291 | {0x0000a184, 0x061f0600}, | ||
1292 | {0x0000a188, 0x061d061e}, | ||
1293 | {0x0000a18c, 0x07020703}, | ||
1294 | {0x0000a190, 0x07000701}, | ||
1295 | {0x0000a194, 0x00000000}, | ||
1296 | {0x0000a198, 0x00000000}, | ||
1297 | {0x0000a19c, 0x00000000}, | ||
1298 | {0x0000a1a0, 0x00000000}, | ||
1299 | {0x0000a1a4, 0x00000000}, | ||
1300 | {0x0000a1a8, 0x00000000}, | ||
1301 | {0x0000a1ac, 0x00000000}, | ||
1302 | {0x0000a1b0, 0x00000000}, | ||
1303 | {0x0000a1b4, 0x00000000}, | ||
1304 | {0x0000a1b8, 0x00000000}, | ||
1305 | {0x0000a1bc, 0x00000000}, | ||
1306 | {0x0000a1c0, 0x00000000}, | ||
1307 | {0x0000a1c4, 0x00000000}, | ||
1308 | {0x0000a1c8, 0x00000000}, | ||
1309 | {0x0000a1cc, 0x00000000}, | ||
1310 | {0x0000a1d0, 0x00000000}, | ||
1311 | {0x0000a1d4, 0x00000000}, | ||
1312 | {0x0000a1d8, 0x00000000}, | ||
1313 | {0x0000a1dc, 0x00000000}, | ||
1314 | {0x0000a1e0, 0x00000000}, | ||
1315 | {0x0000a1e4, 0x00000000}, | ||
1316 | {0x0000a1e8, 0x00000000}, | ||
1317 | {0x0000a1ec, 0x00000000}, | ||
1318 | {0x0000a1f0, 0x00000396}, | ||
1319 | {0x0000a1f4, 0x00000396}, | ||
1320 | {0x0000a1f8, 0x00000396}, | ||
1321 | {0x0000a1fc, 0x00000196}, | ||
1322 | {0x0000b000, 0x00010000}, | ||
1323 | {0x0000b004, 0x00030002}, | ||
1324 | {0x0000b008, 0x00050004}, | ||
1325 | {0x0000b00c, 0x00810080}, | ||
1326 | {0x0000b010, 0x00830082}, | ||
1327 | {0x0000b014, 0x01810180}, | ||
1328 | {0x0000b018, 0x01830182}, | ||
1329 | {0x0000b01c, 0x01850184}, | ||
1330 | {0x0000b020, 0x02810280}, | ||
1331 | {0x0000b024, 0x02830282}, | ||
1332 | {0x0000b028, 0x02850284}, | ||
1333 | {0x0000b02c, 0x02890288}, | ||
1334 | {0x0000b030, 0x028b028a}, | ||
1335 | {0x0000b034, 0x0388028c}, | ||
1336 | {0x0000b038, 0x038a0389}, | ||
1337 | {0x0000b03c, 0x038c038b}, | ||
1338 | {0x0000b040, 0x0390038d}, | ||
1339 | {0x0000b044, 0x03920391}, | ||
1340 | {0x0000b048, 0x03940393}, | ||
1341 | {0x0000b04c, 0x03960395}, | ||
1342 | {0x0000b050, 0x00000000}, | ||
1343 | {0x0000b054, 0x00000000}, | ||
1344 | {0x0000b058, 0x00000000}, | ||
1345 | {0x0000b05c, 0x00000000}, | ||
1346 | {0x0000b060, 0x00000000}, | ||
1347 | {0x0000b064, 0x00000000}, | ||
1348 | {0x0000b068, 0x00000000}, | ||
1349 | {0x0000b06c, 0x00000000}, | ||
1350 | {0x0000b070, 0x00000000}, | ||
1351 | {0x0000b074, 0x00000000}, | ||
1352 | {0x0000b078, 0x00000000}, | ||
1353 | {0x0000b07c, 0x00000000}, | ||
1354 | {0x0000b080, 0x2a2d2f32}, | ||
1355 | {0x0000b084, 0x21232328}, | ||
1356 | {0x0000b088, 0x19191c1e}, | ||
1357 | {0x0000b08c, 0x12141417}, | ||
1358 | {0x0000b090, 0x07070e0e}, | ||
1359 | {0x0000b094, 0x03030305}, | ||
1360 | {0x0000b098, 0x00000003}, | ||
1361 | {0x0000b09c, 0x00000000}, | ||
1362 | {0x0000b0a0, 0x00000000}, | ||
1363 | {0x0000b0a4, 0x00000000}, | ||
1364 | {0x0000b0a8, 0x00000000}, | ||
1365 | {0x0000b0ac, 0x00000000}, | ||
1366 | {0x0000b0b0, 0x00000000}, | ||
1367 | {0x0000b0b4, 0x00000000}, | ||
1368 | {0x0000b0b8, 0x00000000}, | ||
1369 | {0x0000b0bc, 0x00000000}, | ||
1370 | {0x0000b0c0, 0x003f0020}, | ||
1371 | {0x0000b0c4, 0x00400041}, | ||
1372 | {0x0000b0c8, 0x0140005f}, | ||
1373 | {0x0000b0cc, 0x0160015f}, | ||
1374 | {0x0000b0d0, 0x017e017f}, | ||
1375 | {0x0000b0d4, 0x02410242}, | ||
1376 | {0x0000b0d8, 0x025f0240}, | ||
1377 | {0x0000b0dc, 0x027f0260}, | ||
1378 | {0x0000b0e0, 0x0341027e}, | ||
1379 | {0x0000b0e4, 0x035f0340}, | ||
1380 | {0x0000b0e8, 0x037f0360}, | ||
1381 | {0x0000b0ec, 0x04400441}, | ||
1382 | {0x0000b0f0, 0x0460045f}, | ||
1383 | {0x0000b0f4, 0x0541047f}, | ||
1384 | {0x0000b0f8, 0x055f0540}, | ||
1385 | {0x0000b0fc, 0x057f0560}, | ||
1386 | {0x0000b100, 0x06400641}, | ||
1387 | {0x0000b104, 0x0660065f}, | ||
1388 | {0x0000b108, 0x067e067f}, | ||
1389 | {0x0000b10c, 0x07410742}, | ||
1390 | {0x0000b110, 0x075f0740}, | ||
1391 | {0x0000b114, 0x077f0760}, | ||
1392 | {0x0000b118, 0x07800781}, | ||
1393 | {0x0000b11c, 0x07a0079f}, | ||
1394 | {0x0000b120, 0x07c107bf}, | ||
1395 | {0x0000b124, 0x000007c0}, | ||
1396 | {0x0000b128, 0x00000000}, | ||
1397 | {0x0000b12c, 0x00000000}, | ||
1398 | {0x0000b130, 0x00000000}, | ||
1399 | {0x0000b134, 0x00000000}, | ||
1400 | {0x0000b138, 0x00000000}, | ||
1401 | {0x0000b13c, 0x00000000}, | ||
1402 | {0x0000b140, 0x003f0020}, | ||
1403 | {0x0000b144, 0x00400041}, | ||
1404 | {0x0000b148, 0x0140005f}, | ||
1405 | {0x0000b14c, 0x0160015f}, | ||
1406 | {0x0000b150, 0x017e017f}, | ||
1407 | {0x0000b154, 0x02410242}, | ||
1408 | {0x0000b158, 0x025f0240}, | ||
1409 | {0x0000b15c, 0x027f0260}, | ||
1410 | {0x0000b160, 0x0341027e}, | ||
1411 | {0x0000b164, 0x035f0340}, | ||
1412 | {0x0000b168, 0x037f0360}, | ||
1413 | {0x0000b16c, 0x04400441}, | ||
1414 | {0x0000b170, 0x0460045f}, | ||
1415 | {0x0000b174, 0x0541047f}, | ||
1416 | {0x0000b178, 0x055f0540}, | ||
1417 | {0x0000b17c, 0x057f0560}, | ||
1418 | {0x0000b180, 0x06400641}, | ||
1419 | {0x0000b184, 0x0660065f}, | ||
1420 | {0x0000b188, 0x067e067f}, | ||
1421 | {0x0000b18c, 0x07410742}, | ||
1422 | {0x0000b190, 0x075f0740}, | ||
1423 | {0x0000b194, 0x077f0760}, | ||
1424 | {0x0000b198, 0x07800781}, | ||
1425 | {0x0000b19c, 0x07a0079f}, | ||
1426 | {0x0000b1a0, 0x07c107bf}, | ||
1427 | {0x0000b1a4, 0x000007c0}, | ||
1428 | {0x0000b1a8, 0x00000000}, | ||
1429 | {0x0000b1ac, 0x00000000}, | ||
1430 | {0x0000b1b0, 0x00000000}, | ||
1431 | {0x0000b1b4, 0x00000000}, | ||
1432 | {0x0000b1b8, 0x00000000}, | ||
1433 | {0x0000b1bc, 0x00000000}, | ||
1434 | {0x0000b1c0, 0x00000000}, | ||
1435 | {0x0000b1c4, 0x00000000}, | ||
1436 | {0x0000b1c8, 0x00000000}, | ||
1437 | {0x0000b1cc, 0x00000000}, | ||
1438 | {0x0000b1d0, 0x00000000}, | ||
1439 | {0x0000b1d4, 0x00000000}, | ||
1440 | {0x0000b1d8, 0x00000000}, | ||
1441 | {0x0000b1dc, 0x00000000}, | ||
1442 | {0x0000b1e0, 0x00000000}, | ||
1443 | {0x0000b1e4, 0x00000000}, | ||
1444 | {0x0000b1e8, 0x00000000}, | ||
1445 | {0x0000b1ec, 0x00000000}, | ||
1446 | {0x0000b1f0, 0x00000396}, | ||
1447 | {0x0000b1f4, 0x00000396}, | ||
1448 | {0x0000b1f8, 0x00000396}, | ||
1449 | {0x0000b1fc, 0x00000196}, | ||
1450 | }; | ||
1451 | 699 | ||
1452 | static const u32 ar9580_1p0_radio_core[][2] = { | 700 | static const u32 ar9580_1p0_radio_core[][2] = { |
1453 | /* Addr allmodes */ | 701 | /* Addr allmodes */ |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index f72c4a36d01b..fe39eb4c42a1 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -722,6 +722,7 @@ extern int ath9k_modparam_nohwcrypt; | |||
722 | extern int led_blink; | 722 | extern int led_blink; |
723 | extern bool is_ath9k_unloaded; | 723 | extern bool is_ath9k_unloaded; |
724 | 724 | ||
725 | u8 ath9k_parse_mpdudensity(u8 mpdudensity); | ||
725 | irqreturn_t ath_isr(int irq, void *dev); | 726 | irqreturn_t ath_isr(int irq, void *dev); |
726 | int ath9k_init_device(u16 devid, struct ath_softc *sc, | 727 | int ath9k_init_device(u16 devid, struct ath_softc *sc, |
727 | const struct ath_bus_ops *bus_ops); | 728 | const struct ath_bus_ops *bus_ops); |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 2831258d9507..5c3192ffc196 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -348,8 +348,6 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) | |||
348 | sc->debug.stats.istats.txok++; | 348 | sc->debug.stats.istats.txok++; |
349 | if (status & ATH9K_INT_TXURN) | 349 | if (status & ATH9K_INT_TXURN) |
350 | sc->debug.stats.istats.txurn++; | 350 | sc->debug.stats.istats.txurn++; |
351 | if (status & ATH9K_INT_MIB) | ||
352 | sc->debug.stats.istats.mib++; | ||
353 | if (status & ATH9K_INT_RXPHY) | 351 | if (status & ATH9K_INT_RXPHY) |
354 | sc->debug.stats.istats.rxphyerr++; | 352 | sc->debug.stats.istats.rxphyerr++; |
355 | if (status & ATH9K_INT_RXKCM) | 353 | if (status & ATH9K_INT_RXKCM) |
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 26032cb59b8a..9ae6a4d97691 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c | |||
@@ -416,7 +416,7 @@ int ath9k_init_btcoex(struct ath_softc *sc) | |||
416 | txq = sc->tx.txq_map[WME_AC_BE]; | 416 | txq = sc->tx.txq_map[WME_AC_BE]; |
417 | ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); | 417 | ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); |
418 | sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; | 418 | sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; |
419 | if (AR_SREV_9462(ah)) { | 419 | if (ath9k_hw_mci_is_enabled(ah)) { |
420 | sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; | 420 | sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; |
421 | INIT_LIST_HEAD(&sc->btcoex.mci.info); | 421 | INIT_LIST_HEAD(&sc->btcoex.mci.info); |
422 | 422 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 135795257d95..936e920fb88e 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -453,7 +453,6 @@ struct ath9k_htc_priv { | |||
453 | u8 num_sta_assoc_vif; | 453 | u8 num_sta_assoc_vif; |
454 | u8 num_ap_vif; | 454 | u8 num_ap_vif; |
455 | 455 | ||
456 | u16 op_flags; | ||
457 | u16 curtxpow; | 456 | u16 curtxpow; |
458 | u16 txpowlimit; | 457 | u16 txpowlimit; |
459 | u16 nvifs; | 458 | u16 nvifs; |
@@ -461,6 +460,7 @@ struct ath9k_htc_priv { | |||
461 | bool rearm_ani; | 460 | bool rearm_ani; |
462 | bool reconfig_beacon; | 461 | bool reconfig_beacon; |
463 | unsigned int rxfilter; | 462 | unsigned int rxfilter; |
463 | unsigned long op_flags; | ||
464 | 464 | ||
465 | struct ath9k_hw_cal_data caldata; | 465 | struct ath9k_hw_cal_data caldata; |
466 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; | 466 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; |
@@ -572,8 +572,6 @@ bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, | |||
572 | 572 | ||
573 | void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); | 573 | void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); |
574 | void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw); | 574 | void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw); |
575 | void ath9k_htc_radio_enable(struct ieee80211_hw *hw); | ||
576 | void ath9k_htc_radio_disable(struct ieee80211_hw *hw); | ||
577 | 575 | ||
578 | #ifdef CONFIG_MAC80211_LEDS | 576 | #ifdef CONFIG_MAC80211_LEDS |
579 | void ath9k_init_leds(struct ath9k_htc_priv *priv); | 577 | void ath9k_init_leds(struct ath9k_htc_priv *priv); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c index 2eadffb7971c..77d541feb910 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | |||
@@ -207,9 +207,9 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv, | |||
207 | else | 207 | else |
208 | priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; | 208 | priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; |
209 | 209 | ||
210 | if (priv->op_flags & OP_TSF_RESET) { | 210 | if (test_bit(OP_TSF_RESET, &priv->op_flags)) { |
211 | ath9k_hw_reset_tsf(priv->ah); | 211 | ath9k_hw_reset_tsf(priv->ah); |
212 | priv->op_flags &= ~OP_TSF_RESET; | 212 | clear_bit(OP_TSF_RESET, &priv->op_flags); |
213 | } else { | 213 | } else { |
214 | /* | 214 | /* |
215 | * Pull nexttbtt forward to reflect the current TSF. | 215 | * Pull nexttbtt forward to reflect the current TSF. |
@@ -221,7 +221,7 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv, | |||
221 | } while (nexttbtt < tsftu); | 221 | } while (nexttbtt < tsftu); |
222 | } | 222 | } |
223 | 223 | ||
224 | if (priv->op_flags & OP_ENABLE_BEACON) | 224 | if (test_bit(OP_ENABLE_BEACON, &priv->op_flags)) |
225 | imask |= ATH9K_INT_SWBA; | 225 | imask |= ATH9K_INT_SWBA; |
226 | 226 | ||
227 | ath_dbg(common, CONFIG, | 227 | ath_dbg(common, CONFIG, |
@@ -269,7 +269,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv, | |||
269 | else | 269 | else |
270 | priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; | 270 | priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; |
271 | 271 | ||
272 | if (priv->op_flags & OP_ENABLE_BEACON) | 272 | if (test_bit(OP_ENABLE_BEACON, &priv->op_flags)) |
273 | imask |= ATH9K_INT_SWBA; | 273 | imask |= ATH9K_INT_SWBA; |
274 | 274 | ||
275 | ath_dbg(common, CONFIG, | 275 | ath_dbg(common, CONFIG, |
@@ -365,7 +365,7 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv, | |||
365 | vif = priv->cur_beacon_conf.bslot[slot]; | 365 | vif = priv->cur_beacon_conf.bslot[slot]; |
366 | avp = (struct ath9k_htc_vif *)vif->drv_priv; | 366 | avp = (struct ath9k_htc_vif *)vif->drv_priv; |
367 | 367 | ||
368 | if (unlikely(priv->op_flags & OP_SCANNING)) { | 368 | if (unlikely(test_bit(OP_SCANNING, &priv->op_flags))) { |
369 | spin_unlock_bh(&priv->beacon_lock); | 369 | spin_unlock_bh(&priv->beacon_lock); |
370 | return; | 370 | return; |
371 | } | 371 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c index 1c10e2e5c237..07df279c8d46 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | |||
@@ -37,17 +37,18 @@ static void ath_detect_bt_priority(struct ath9k_htc_priv *priv) | |||
37 | 37 | ||
38 | if (time_after(jiffies, btcoex->bt_priority_time + | 38 | if (time_after(jiffies, btcoex->bt_priority_time + |
39 | msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { | 39 | msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { |
40 | priv->op_flags &= ~(OP_BT_PRIORITY_DETECTED | OP_BT_SCAN); | 40 | clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); |
41 | clear_bit(OP_BT_SCAN, &priv->op_flags); | ||
41 | /* Detect if colocated bt started scanning */ | 42 | /* Detect if colocated bt started scanning */ |
42 | if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { | 43 | if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { |
43 | ath_dbg(ath9k_hw_common(ah), BTCOEX, | 44 | ath_dbg(ath9k_hw_common(ah), BTCOEX, |
44 | "BT scan detected\n"); | 45 | "BT scan detected\n"); |
45 | priv->op_flags |= (OP_BT_SCAN | | 46 | set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); |
46 | OP_BT_PRIORITY_DETECTED); | 47 | set_bit(OP_BT_SCAN, &priv->op_flags); |
47 | } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { | 48 | } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { |
48 | ath_dbg(ath9k_hw_common(ah), BTCOEX, | 49 | ath_dbg(ath9k_hw_common(ah), BTCOEX, |
49 | "BT priority traffic detected\n"); | 50 | "BT priority traffic detected\n"); |
50 | priv->op_flags |= OP_BT_PRIORITY_DETECTED; | 51 | set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); |
51 | } | 52 | } |
52 | 53 | ||
53 | btcoex->bt_priority_cnt = 0; | 54 | btcoex->bt_priority_cnt = 0; |
@@ -67,26 +68,23 @@ static void ath_btcoex_period_work(struct work_struct *work) | |||
67 | struct ath_btcoex *btcoex = &priv->btcoex; | 68 | struct ath_btcoex *btcoex = &priv->btcoex; |
68 | struct ath_common *common = ath9k_hw_common(priv->ah); | 69 | struct ath_common *common = ath9k_hw_common(priv->ah); |
69 | u32 timer_period; | 70 | u32 timer_period; |
70 | bool is_btscan; | ||
71 | int ret; | 71 | int ret; |
72 | 72 | ||
73 | ath_detect_bt_priority(priv); | 73 | ath_detect_bt_priority(priv); |
74 | 74 | ||
75 | is_btscan = !!(priv->op_flags & OP_BT_SCAN); | ||
76 | |||
77 | ret = ath9k_htc_update_cap_target(priv, | 75 | ret = ath9k_htc_update_cap_target(priv, |
78 | !!(priv->op_flags & OP_BT_PRIORITY_DETECTED)); | 76 | test_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags)); |
79 | if (ret) { | 77 | if (ret) { |
80 | ath_err(common, "Unable to set BTCOEX parameters\n"); | 78 | ath_err(common, "Unable to set BTCOEX parameters\n"); |
81 | return; | 79 | return; |
82 | } | 80 | } |
83 | 81 | ||
84 | ath9k_hw_btcoex_bt_stomp(priv->ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : | 82 | ath9k_hw_btcoex_bt_stomp(priv->ah, test_bit(OP_BT_SCAN, &priv->op_flags) ? |
85 | btcoex->bt_stomp_type); | 83 | ATH_BTCOEX_STOMP_ALL : btcoex->bt_stomp_type); |
86 | 84 | ||
87 | ath9k_hw_btcoex_enable(priv->ah); | 85 | ath9k_hw_btcoex_enable(priv->ah); |
88 | timer_period = is_btscan ? btcoex->btscan_no_stomp : | 86 | timer_period = test_bit(OP_BT_SCAN, &priv->op_flags) ? |
89 | btcoex->btcoex_no_stomp; | 87 | btcoex->btscan_no_stomp : btcoex->btcoex_no_stomp; |
90 | ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work, | 88 | ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work, |
91 | msecs_to_jiffies(timer_period)); | 89 | msecs_to_jiffies(timer_period)); |
92 | ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, | 90 | ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, |
@@ -104,14 +102,15 @@ static void ath_btcoex_duty_cycle_work(struct work_struct *work) | |||
104 | struct ath_hw *ah = priv->ah; | 102 | struct ath_hw *ah = priv->ah; |
105 | struct ath_btcoex *btcoex = &priv->btcoex; | 103 | struct ath_btcoex *btcoex = &priv->btcoex; |
106 | struct ath_common *common = ath9k_hw_common(ah); | 104 | struct ath_common *common = ath9k_hw_common(ah); |
107 | bool is_btscan = priv->op_flags & OP_BT_SCAN; | ||
108 | 105 | ||
109 | ath_dbg(common, BTCOEX, "time slice work for bt and wlan\n"); | 106 | ath_dbg(common, BTCOEX, "time slice work for bt and wlan\n"); |
110 | 107 | ||
111 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) | 108 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || |
109 | test_bit(OP_BT_SCAN, &priv->op_flags)) | ||
112 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); | 110 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); |
113 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) | 111 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) |
114 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); | 112 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); |
113 | |||
115 | ath9k_hw_btcoex_enable(priv->ah); | 114 | ath9k_hw_btcoex_enable(priv->ah); |
116 | } | 115 | } |
117 | 116 | ||
@@ -141,7 +140,8 @@ static void ath_htc_resume_btcoex_work(struct ath9k_htc_priv *priv) | |||
141 | 140 | ||
142 | btcoex->bt_priority_cnt = 0; | 141 | btcoex->bt_priority_cnt = 0; |
143 | btcoex->bt_priority_time = jiffies; | 142 | btcoex->bt_priority_time = jiffies; |
144 | priv->op_flags &= ~(OP_BT_PRIORITY_DETECTED | OP_BT_SCAN); | 143 | clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); |
144 | clear_bit(OP_BT_SCAN, &priv->op_flags); | ||
145 | ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, 0); | 145 | ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, 0); |
146 | } | 146 | } |
147 | 147 | ||
@@ -310,95 +310,3 @@ void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv) | |||
310 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | 310 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) |
311 | wiphy_rfkill_start_polling(priv->hw->wiphy); | 311 | wiphy_rfkill_start_polling(priv->hw->wiphy); |
312 | } | 312 | } |
313 | |||
314 | void ath9k_htc_radio_enable(struct ieee80211_hw *hw) | ||
315 | { | ||
316 | struct ath9k_htc_priv *priv = hw->priv; | ||
317 | struct ath_hw *ah = priv->ah; | ||
318 | struct ath_common *common = ath9k_hw_common(ah); | ||
319 | int ret; | ||
320 | u8 cmd_rsp; | ||
321 | |||
322 | if (!ah->curchan) | ||
323 | ah->curchan = ath9k_cmn_get_curchannel(hw, ah); | ||
324 | |||
325 | /* Reset the HW */ | ||
326 | ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | ||
327 | if (ret) { | ||
328 | ath_err(common, | ||
329 | "Unable to reset hardware; reset status %d (freq %u MHz)\n", | ||
330 | ret, ah->curchan->channel); | ||
331 | } | ||
332 | |||
333 | ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit, | ||
334 | &priv->curtxpow); | ||
335 | |||
336 | /* Start RX */ | ||
337 | WMI_CMD(WMI_START_RECV_CMDID); | ||
338 | ath9k_host_rx_init(priv); | ||
339 | |||
340 | /* Start TX */ | ||
341 | htc_start(priv->htc); | ||
342 | spin_lock_bh(&priv->tx.tx_lock); | ||
343 | priv->tx.flags &= ~ATH9K_HTC_OP_TX_QUEUES_STOP; | ||
344 | spin_unlock_bh(&priv->tx.tx_lock); | ||
345 | ieee80211_wake_queues(hw); | ||
346 | |||
347 | WMI_CMD(WMI_ENABLE_INTR_CMDID); | ||
348 | |||
349 | /* Enable LED */ | ||
350 | ath9k_hw_cfg_output(ah, ah->led_pin, | ||
351 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
352 | ath9k_hw_set_gpio(ah, ah->led_pin, 0); | ||
353 | } | ||
354 | |||
355 | void ath9k_htc_radio_disable(struct ieee80211_hw *hw) | ||
356 | { | ||
357 | struct ath9k_htc_priv *priv = hw->priv; | ||
358 | struct ath_hw *ah = priv->ah; | ||
359 | struct ath_common *common = ath9k_hw_common(ah); | ||
360 | int ret; | ||
361 | u8 cmd_rsp; | ||
362 | |||
363 | ath9k_htc_ps_wakeup(priv); | ||
364 | |||
365 | /* Disable LED */ | ||
366 | ath9k_hw_set_gpio(ah, ah->led_pin, 1); | ||
367 | ath9k_hw_cfg_gpio_input(ah, ah->led_pin); | ||
368 | |||
369 | WMI_CMD(WMI_DISABLE_INTR_CMDID); | ||
370 | |||
371 | /* Stop TX */ | ||
372 | ieee80211_stop_queues(hw); | ||
373 | ath9k_htc_tx_drain(priv); | ||
374 | WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); | ||
375 | |||
376 | /* Stop RX */ | ||
377 | WMI_CMD(WMI_STOP_RECV_CMDID); | ||
378 | |||
379 | /* Clear the WMI event queue */ | ||
380 | ath9k_wmi_event_drain(priv); | ||
381 | |||
382 | /* | ||
383 | * The MIB counters have to be disabled here, | ||
384 | * since the target doesn't do it. | ||
385 | */ | ||
386 | ath9k_hw_disable_mib_counters(ah); | ||
387 | |||
388 | if (!ah->curchan) | ||
389 | ah->curchan = ath9k_cmn_get_curchannel(hw, ah); | ||
390 | |||
391 | /* Reset the HW */ | ||
392 | ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | ||
393 | if (ret) { | ||
394 | ath_err(common, | ||
395 | "Unable to reset hardware; reset status %d (freq %u MHz)\n", | ||
396 | ret, ah->curchan->channel); | ||
397 | } | ||
398 | |||
399 | /* Disable the PHY */ | ||
400 | ath9k_hw_phy_disable(ah); | ||
401 | |||
402 | ath9k_htc_ps_restore(priv); | ||
403 | ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP); | ||
404 | } | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 25213d521bc2..a035a380d669 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -611,7 +611,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, | |||
611 | struct ath_common *common; | 611 | struct ath_common *common; |
612 | int i, ret = 0, csz = 0; | 612 | int i, ret = 0, csz = 0; |
613 | 613 | ||
614 | priv->op_flags |= OP_INVALID; | 614 | set_bit(OP_INVALID, &priv->op_flags); |
615 | 615 | ||
616 | ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL); | 616 | ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL); |
617 | if (!ah) | 617 | if (!ah) |
@@ -718,7 +718,7 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, | |||
718 | 718 | ||
719 | hw->queues = 4; | 719 | hw->queues = 4; |
720 | hw->channel_change_time = 5000; | 720 | hw->channel_change_time = 5000; |
721 | hw->max_listen_interval = 10; | 721 | hw->max_listen_interval = 1; |
722 | 722 | ||
723 | hw->vif_data_size = sizeof(struct ath9k_htc_vif); | 723 | hw->vif_data_size = sizeof(struct ath9k_htc_vif); |
724 | hw->sta_data_size = sizeof(struct ath9k_htc_sta); | 724 | hw->sta_data_size = sizeof(struct ath9k_htc_sta); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index abbd6effd60d..374c32ed905a 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -75,14 +75,19 @@ unlock: | |||
75 | 75 | ||
76 | void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv) | 76 | void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv) |
77 | { | 77 | { |
78 | bool reset; | ||
79 | |||
78 | mutex_lock(&priv->htc_pm_lock); | 80 | mutex_lock(&priv->htc_pm_lock); |
79 | if (--priv->ps_usecount != 0) | 81 | if (--priv->ps_usecount != 0) |
80 | goto unlock; | 82 | goto unlock; |
81 | 83 | ||
82 | if (priv->ps_idle) | 84 | if (priv->ps_idle) { |
85 | ath9k_hw_setrxabort(priv->ah, true); | ||
86 | ath9k_hw_stopdmarecv(priv->ah, &reset); | ||
83 | ath9k_hw_setpower(priv->ah, ATH9K_PM_FULL_SLEEP); | 87 | ath9k_hw_setpower(priv->ah, ATH9K_PM_FULL_SLEEP); |
84 | else if (priv->ps_enabled) | 88 | } else if (priv->ps_enabled) { |
85 | ath9k_hw_setpower(priv->ah, ATH9K_PM_NETWORK_SLEEP); | 89 | ath9k_hw_setpower(priv->ah, ATH9K_PM_NETWORK_SLEEP); |
90 | } | ||
86 | 91 | ||
87 | unlock: | 92 | unlock: |
88 | mutex_unlock(&priv->htc_pm_lock); | 93 | mutex_unlock(&priv->htc_pm_lock); |
@@ -250,7 +255,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv, | |||
250 | u8 cmd_rsp; | 255 | u8 cmd_rsp; |
251 | int ret; | 256 | int ret; |
252 | 257 | ||
253 | if (priv->op_flags & OP_INVALID) | 258 | if (test_bit(OP_INVALID, &priv->op_flags)) |
254 | return -EIO; | 259 | return -EIO; |
255 | 260 | ||
256 | fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL); | 261 | fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL); |
@@ -304,7 +309,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv, | |||
304 | 309 | ||
305 | htc_start(priv->htc); | 310 | htc_start(priv->htc); |
306 | 311 | ||
307 | if (!(priv->op_flags & OP_SCANNING) && | 312 | if (!test_bit(OP_SCANNING, &priv->op_flags) && |
308 | !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) | 313 | !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) |
309 | ath9k_htc_vif_reconfig(priv); | 314 | ath9k_htc_vif_reconfig(priv); |
310 | 315 | ||
@@ -750,7 +755,7 @@ void ath9k_htc_start_ani(struct ath9k_htc_priv *priv) | |||
750 | common->ani.shortcal_timer = timestamp; | 755 | common->ani.shortcal_timer = timestamp; |
751 | common->ani.checkani_timer = timestamp; | 756 | common->ani.checkani_timer = timestamp; |
752 | 757 | ||
753 | priv->op_flags |= OP_ANI_RUNNING; | 758 | set_bit(OP_ANI_RUNNING, &priv->op_flags); |
754 | 759 | ||
755 | ieee80211_queue_delayed_work(common->hw, &priv->ani_work, | 760 | ieee80211_queue_delayed_work(common->hw, &priv->ani_work, |
756 | msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); | 761 | msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); |
@@ -759,7 +764,7 @@ void ath9k_htc_start_ani(struct ath9k_htc_priv *priv) | |||
759 | void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv) | 764 | void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv) |
760 | { | 765 | { |
761 | cancel_delayed_work_sync(&priv->ani_work); | 766 | cancel_delayed_work_sync(&priv->ani_work); |
762 | priv->op_flags &= ~OP_ANI_RUNNING; | 767 | clear_bit(OP_ANI_RUNNING, &priv->op_flags); |
763 | } | 768 | } |
764 | 769 | ||
765 | void ath9k_htc_ani_work(struct work_struct *work) | 770 | void ath9k_htc_ani_work(struct work_struct *work) |
@@ -944,7 +949,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw) | |||
944 | ath_dbg(common, CONFIG, | 949 | ath_dbg(common, CONFIG, |
945 | "Failed to update capability in target\n"); | 950 | "Failed to update capability in target\n"); |
946 | 951 | ||
947 | priv->op_flags &= ~OP_INVALID; | 952 | clear_bit(OP_INVALID, &priv->op_flags); |
948 | htc_start(priv->htc); | 953 | htc_start(priv->htc); |
949 | 954 | ||
950 | spin_lock_bh(&priv->tx.tx_lock); | 955 | spin_lock_bh(&priv->tx.tx_lock); |
@@ -973,7 +978,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
973 | 978 | ||
974 | mutex_lock(&priv->mutex); | 979 | mutex_lock(&priv->mutex); |
975 | 980 | ||
976 | if (priv->op_flags & OP_INVALID) { | 981 | if (test_bit(OP_INVALID, &priv->op_flags)) { |
977 | ath_dbg(common, ANY, "Device not present\n"); | 982 | ath_dbg(common, ANY, "Device not present\n"); |
978 | mutex_unlock(&priv->mutex); | 983 | mutex_unlock(&priv->mutex); |
979 | return; | 984 | return; |
@@ -1015,7 +1020,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
1015 | ath9k_htc_ps_restore(priv); | 1020 | ath9k_htc_ps_restore(priv); |
1016 | ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP); | 1021 | ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP); |
1017 | 1022 | ||
1018 | priv->op_flags |= OP_INVALID; | 1023 | set_bit(OP_INVALID, &priv->op_flags); |
1019 | 1024 | ||
1020 | ath_dbg(common, CONFIG, "Driver halt\n"); | 1025 | ath_dbg(common, CONFIG, "Driver halt\n"); |
1021 | mutex_unlock(&priv->mutex); | 1026 | mutex_unlock(&priv->mutex); |
@@ -1105,7 +1110,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw, | |||
1105 | ath9k_htc_set_opmode(priv); | 1110 | ath9k_htc_set_opmode(priv); |
1106 | 1111 | ||
1107 | if ((priv->ah->opmode == NL80211_IFTYPE_AP) && | 1112 | if ((priv->ah->opmode == NL80211_IFTYPE_AP) && |
1108 | !(priv->op_flags & OP_ANI_RUNNING)) { | 1113 | !test_bit(OP_ANI_RUNNING, &priv->op_flags)) { |
1109 | ath9k_hw_set_tsfadjust(priv->ah, 1); | 1114 | ath9k_hw_set_tsfadjust(priv->ah, 1); |
1110 | ath9k_htc_start_ani(priv); | 1115 | ath9k_htc_start_ani(priv); |
1111 | } | 1116 | } |
@@ -1178,24 +1183,20 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1178 | struct ath9k_htc_priv *priv = hw->priv; | 1183 | struct ath9k_htc_priv *priv = hw->priv; |
1179 | struct ath_common *common = ath9k_hw_common(priv->ah); | 1184 | struct ath_common *common = ath9k_hw_common(priv->ah); |
1180 | struct ieee80211_conf *conf = &hw->conf; | 1185 | struct ieee80211_conf *conf = &hw->conf; |
1186 | bool chip_reset = false; | ||
1187 | int ret = 0; | ||
1181 | 1188 | ||
1182 | mutex_lock(&priv->mutex); | 1189 | mutex_lock(&priv->mutex); |
1190 | ath9k_htc_ps_wakeup(priv); | ||
1183 | 1191 | ||
1184 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | 1192 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { |
1185 | bool enable_radio = false; | ||
1186 | bool idle = !!(conf->flags & IEEE80211_CONF_IDLE); | ||
1187 | |||
1188 | mutex_lock(&priv->htc_pm_lock); | 1193 | mutex_lock(&priv->htc_pm_lock); |
1189 | if (!idle && priv->ps_idle) | ||
1190 | enable_radio = true; | ||
1191 | priv->ps_idle = idle; | ||
1192 | mutex_unlock(&priv->htc_pm_lock); | ||
1193 | 1194 | ||
1194 | if (enable_radio) { | 1195 | priv->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
1195 | ath_dbg(common, CONFIG, "not-idle: enabling radio\n"); | 1196 | if (priv->ps_idle) |
1196 | ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); | 1197 | chip_reset = true; |
1197 | ath9k_htc_radio_enable(hw); | 1198 | |
1198 | } | 1199 | mutex_unlock(&priv->htc_pm_lock); |
1199 | } | 1200 | } |
1200 | 1201 | ||
1201 | /* | 1202 | /* |
@@ -1210,7 +1211,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1210 | ath9k_htc_remove_monitor_interface(priv); | 1211 | ath9k_htc_remove_monitor_interface(priv); |
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1214 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { |
1214 | struct ieee80211_channel *curchan = hw->conf.channel; | 1215 | struct ieee80211_channel *curchan = hw->conf.channel; |
1215 | int pos = curchan->hw_value; | 1216 | int pos = curchan->hw_value; |
1216 | 1217 | ||
@@ -1223,8 +1224,8 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1223 | 1224 | ||
1224 | if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { | 1225 | if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { |
1225 | ath_err(common, "Unable to set channel\n"); | 1226 | ath_err(common, "Unable to set channel\n"); |
1226 | mutex_unlock(&priv->mutex); | 1227 | ret = -EINVAL; |
1227 | return -EINVAL; | 1228 | goto out; |
1228 | } | 1229 | } |
1229 | 1230 | ||
1230 | } | 1231 | } |
@@ -1246,21 +1247,10 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1246 | priv->txpowlimit, &priv->curtxpow); | 1247 | priv->txpowlimit, &priv->curtxpow); |
1247 | } | 1248 | } |
1248 | 1249 | ||
1249 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | ||
1250 | mutex_lock(&priv->htc_pm_lock); | ||
1251 | if (!priv->ps_idle) { | ||
1252 | mutex_unlock(&priv->htc_pm_lock); | ||
1253 | goto out; | ||
1254 | } | ||
1255 | mutex_unlock(&priv->htc_pm_lock); | ||
1256 | |||
1257 | ath_dbg(common, CONFIG, "idle: disabling radio\n"); | ||
1258 | ath9k_htc_radio_disable(hw); | ||
1259 | } | ||
1260 | |||
1261 | out: | 1250 | out: |
1251 | ath9k_htc_ps_restore(priv); | ||
1262 | mutex_unlock(&priv->mutex); | 1252 | mutex_unlock(&priv->mutex); |
1263 | return 0; | 1253 | return ret; |
1264 | } | 1254 | } |
1265 | 1255 | ||
1266 | #define SUPPORTED_FILTERS \ | 1256 | #define SUPPORTED_FILTERS \ |
@@ -1285,7 +1275,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw, | |||
1285 | changed_flags &= SUPPORTED_FILTERS; | 1275 | changed_flags &= SUPPORTED_FILTERS; |
1286 | *total_flags &= SUPPORTED_FILTERS; | 1276 | *total_flags &= SUPPORTED_FILTERS; |
1287 | 1277 | ||
1288 | if (priv->op_flags & OP_INVALID) { | 1278 | if (test_bit(OP_INVALID, &priv->op_flags)) { |
1289 | ath_dbg(ath9k_hw_common(priv->ah), ANY, | 1279 | ath_dbg(ath9k_hw_common(priv->ah), ANY, |
1290 | "Unable to configure filter on invalid state\n"); | 1280 | "Unable to configure filter on invalid state\n"); |
1291 | mutex_unlock(&priv->mutex); | 1281 | mutex_unlock(&priv->mutex); |
@@ -1516,7 +1506,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1516 | ath_dbg(common, CONFIG, "Beacon enabled for BSS: %pM\n", | 1506 | ath_dbg(common, CONFIG, "Beacon enabled for BSS: %pM\n", |
1517 | bss_conf->bssid); | 1507 | bss_conf->bssid); |
1518 | ath9k_htc_set_tsfadjust(priv, vif); | 1508 | ath9k_htc_set_tsfadjust(priv, vif); |
1519 | priv->op_flags |= OP_ENABLE_BEACON; | 1509 | set_bit(OP_ENABLE_BEACON, &priv->op_flags); |
1520 | ath9k_htc_beacon_config(priv, vif); | 1510 | ath9k_htc_beacon_config(priv, vif); |
1521 | } | 1511 | } |
1522 | 1512 | ||
@@ -1529,7 +1519,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1529 | ath_dbg(common, CONFIG, | 1519 | ath_dbg(common, CONFIG, |
1530 | "Beacon disabled for BSS: %pM\n", | 1520 | "Beacon disabled for BSS: %pM\n", |
1531 | bss_conf->bssid); | 1521 | bss_conf->bssid); |
1532 | priv->op_flags &= ~OP_ENABLE_BEACON; | 1522 | clear_bit(OP_ENABLE_BEACON, &priv->op_flags); |
1533 | ath9k_htc_beacon_config(priv, vif); | 1523 | ath9k_htc_beacon_config(priv, vif); |
1534 | } | 1524 | } |
1535 | } | 1525 | } |
@@ -1542,7 +1532,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1542 | (priv->nvifs == 1) && | 1532 | (priv->nvifs == 1) && |
1543 | (priv->num_ap_vif == 1) && | 1533 | (priv->num_ap_vif == 1) && |
1544 | (vif->type == NL80211_IFTYPE_AP)) { | 1534 | (vif->type == NL80211_IFTYPE_AP)) { |
1545 | priv->op_flags |= OP_TSF_RESET; | 1535 | set_bit(OP_TSF_RESET, &priv->op_flags); |
1546 | } | 1536 | } |
1547 | ath_dbg(common, CONFIG, | 1537 | ath_dbg(common, CONFIG, |
1548 | "Beacon interval changed for BSS: %pM\n", | 1538 | "Beacon interval changed for BSS: %pM\n", |
@@ -1654,7 +1644,7 @@ static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw) | |||
1654 | 1644 | ||
1655 | mutex_lock(&priv->mutex); | 1645 | mutex_lock(&priv->mutex); |
1656 | spin_lock_bh(&priv->beacon_lock); | 1646 | spin_lock_bh(&priv->beacon_lock); |
1657 | priv->op_flags |= OP_SCANNING; | 1647 | set_bit(OP_SCANNING, &priv->op_flags); |
1658 | spin_unlock_bh(&priv->beacon_lock); | 1648 | spin_unlock_bh(&priv->beacon_lock); |
1659 | cancel_work_sync(&priv->ps_work); | 1649 | cancel_work_sync(&priv->ps_work); |
1660 | ath9k_htc_stop_ani(priv); | 1650 | ath9k_htc_stop_ani(priv); |
@@ -1667,7 +1657,7 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw) | |||
1667 | 1657 | ||
1668 | mutex_lock(&priv->mutex); | 1658 | mutex_lock(&priv->mutex); |
1669 | spin_lock_bh(&priv->beacon_lock); | 1659 | spin_lock_bh(&priv->beacon_lock); |
1670 | priv->op_flags &= ~OP_SCANNING; | 1660 | clear_bit(OP_SCANNING, &priv->op_flags); |
1671 | spin_unlock_bh(&priv->beacon_lock); | 1661 | spin_unlock_bh(&priv->beacon_lock); |
1672 | ath9k_htc_ps_wakeup(priv); | 1662 | ath9k_htc_ps_wakeup(priv); |
1673 | ath9k_htc_vif_reconfig(priv); | 1663 | ath9k_htc_vif_reconfig(priv); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 3e40a6461512..47e61d0da33b 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -916,7 +916,7 @@ void ath9k_host_rx_init(struct ath9k_htc_priv *priv) | |||
916 | { | 916 | { |
917 | ath9k_hw_rxena(priv->ah); | 917 | ath9k_hw_rxena(priv->ah); |
918 | ath9k_htc_opmode_init(priv); | 918 | ath9k_htc_opmode_init(priv); |
919 | ath9k_hw_startpcureceive(priv->ah, (priv->op_flags & OP_SCANNING)); | 919 | ath9k_hw_startpcureceive(priv->ah, test_bit(OP_SCANNING, &priv->op_flags)); |
920 | priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER; | 920 | priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER; |
921 | } | 921 | } |
922 | 922 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 03d590924c64..94096607cbdd 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -1019,16 +1019,8 @@ void ar9002_hw_attach_ops(struct ath_hw *ah); | |||
1019 | void ar9003_hw_attach_ops(struct ath_hw *ah); | 1019 | void ar9003_hw_attach_ops(struct ath_hw *ah); |
1020 | 1020 | ||
1021 | void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); | 1021 | void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); |
1022 | /* | 1022 | |
1023 | * ANI work can be shared between all families but a next | ||
1024 | * generation implementation of ANI will be used only for AR9003 only | ||
1025 | * for now as the other families still need to be tested with the same | ||
1026 | * next generation ANI. Feel free to start testing it though for the | ||
1027 | * older families (AR5008, AR9001, AR9002) by using modparam_force_new_ani. | ||
1028 | */ | ||
1029 | extern int modparam_force_new_ani; | ||
1030 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); | 1023 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); |
1031 | void ath9k_hw_proc_mib_event(struct ath_hw *ah); | ||
1032 | void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); | 1024 | void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); |
1033 | 1025 | ||
1034 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 1026 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
@@ -1038,7 +1030,8 @@ static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) | |||
1038 | } | 1030 | } |
1039 | static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) | 1031 | static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) |
1040 | { | 1032 | { |
1041 | return ah->btcoex_hw.enabled && (ah->caps.hw_caps & ATH9K_HW_CAP_MCI); | 1033 | return ah->common.btcoex_enabled && |
1034 | (ah->caps.hw_caps & ATH9K_HW_CAP_MCI); | ||
1042 | 1035 | ||
1043 | } | 1036 | } |
1044 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); | 1037 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index a105c9426251..91650fe50461 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -407,6 +407,7 @@ void ath_ani_calibrate(unsigned long data) | |||
407 | longcal ? "long" : "", shortcal ? "short" : "", | 407 | longcal ? "long" : "", shortcal ? "short" : "", |
408 | aniflag ? "ani" : "", common->ani.caldone ? "true" : "false"); | 408 | aniflag ? "ani" : "", common->ani.caldone ? "true" : "false"); |
409 | 409 | ||
410 | ath9k_debug_samp_bb_mac(sc); | ||
410 | ath9k_ps_restore(sc); | 411 | ath9k_ps_restore(sc); |
411 | 412 | ||
412 | set_timer: | 413 | set_timer: |
@@ -415,7 +416,6 @@ set_timer: | |||
415 | * The interval must be the shortest necessary to satisfy ANI, | 416 | * The interval must be the shortest necessary to satisfy ANI, |
416 | * short calibration and long calibration. | 417 | * short calibration and long calibration. |
417 | */ | 418 | */ |
418 | ath9k_debug_samp_bb_mac(sc); | ||
419 | cal_interval = ATH_LONG_CALINTERVAL; | 419 | cal_interval = ATH_LONG_CALINTERVAL; |
420 | if (sc->sc_ah->config.enable_ani) | 420 | if (sc->sc_ah->config.enable_ani) |
421 | cal_interval = min(cal_interval, | 421 | cal_interval = min(cal_interval, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 52561b341d68..e4e73f061a22 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include "ath9k.h" | 19 | #include "ath9k.h" |
20 | #include "btcoex.h" | 20 | #include "btcoex.h" |
21 | 21 | ||
22 | static u8 parse_mpdudensity(u8 mpdudensity) | 22 | u8 ath9k_parse_mpdudensity(u8 mpdudensity) |
23 | { | 23 | { |
24 | /* | 24 | /* |
25 | * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing": | 25 | * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing": |
@@ -150,8 +150,10 @@ static void __ath_cancel_work(struct ath_softc *sc) | |||
150 | cancel_work_sync(&sc->hw_check_work); | 150 | cancel_work_sync(&sc->hw_check_work); |
151 | cancel_delayed_work_sync(&sc->tx_complete_work); | 151 | cancel_delayed_work_sync(&sc->tx_complete_work); |
152 | cancel_delayed_work_sync(&sc->hw_pll_work); | 152 | cancel_delayed_work_sync(&sc->hw_pll_work); |
153 | |||
153 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 154 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
154 | cancel_work_sync(&sc->mci_work); | 155 | if (ath9k_hw_mci_is_enabled(sc->sc_ah)) |
156 | cancel_work_sync(&sc->mci_work); | ||
155 | #endif | 157 | #endif |
156 | } | 158 | } |
157 | 159 | ||
@@ -320,6 +322,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
320 | struct ieee80211_vif *vif) | 322 | struct ieee80211_vif *vif) |
321 | { | 323 | { |
322 | struct ath_node *an; | 324 | struct ath_node *an; |
325 | u8 density; | ||
323 | an = (struct ath_node *)sta->drv_priv; | 326 | an = (struct ath_node *)sta->drv_priv; |
324 | 327 | ||
325 | #ifdef CONFIG_ATH9K_DEBUGFS | 328 | #ifdef CONFIG_ATH9K_DEBUGFS |
@@ -334,7 +337,8 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
334 | ath_tx_node_init(sc, an); | 337 | ath_tx_node_init(sc, an); |
335 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | 338 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + |
336 | sta->ht_cap.ampdu_factor); | 339 | sta->ht_cap.ampdu_factor); |
337 | an->mpdudensity = parse_mpdudensity(sta->ht_cap.ampdu_density); | 340 | density = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density); |
341 | an->mpdudensity = density; | ||
338 | } | 342 | } |
339 | } | 343 | } |
340 | 344 | ||
@@ -516,24 +520,6 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
516 | ath9k_hw_set_interrupts(ah); | 520 | ath9k_hw_set_interrupts(ah); |
517 | } | 521 | } |
518 | 522 | ||
519 | if (status & ATH9K_INT_MIB) { | ||
520 | /* | ||
521 | * Disable interrupts until we service the MIB | ||
522 | * interrupt; otherwise it will continue to | ||
523 | * fire. | ||
524 | */ | ||
525 | ath9k_hw_disable_interrupts(ah); | ||
526 | /* | ||
527 | * Let the hal handle the event. We assume | ||
528 | * it will clear whatever condition caused | ||
529 | * the interrupt. | ||
530 | */ | ||
531 | spin_lock(&common->cc_lock); | ||
532 | ath9k_hw_proc_mib_event(ah); | ||
533 | spin_unlock(&common->cc_lock); | ||
534 | ath9k_hw_enable_interrupts(ah); | ||
535 | } | ||
536 | |||
537 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) | 523 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) |
538 | if (status & ATH9K_INT_TIM_TIMER) { | 524 | if (status & ATH9K_INT_TIM_TIMER) { |
539 | if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) | 525 | if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) |
@@ -959,14 +945,10 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, | |||
959 | /* | 945 | /* |
960 | * Enable MIB interrupts when there are hardware phy counters. | 946 | * Enable MIB interrupts when there are hardware phy counters. |
961 | */ | 947 | */ |
962 | if ((iter_data.nstations + iter_data.nadhocs + iter_data.nmeshes) > 0) { | 948 | if ((iter_data.nstations + iter_data.nadhocs + iter_data.nmeshes) > 0) |
963 | if (ah->config.enable_ani) | ||
964 | ah->imask |= ATH9K_INT_MIB; | ||
965 | ah->imask |= ATH9K_INT_TSFOOR; | 949 | ah->imask |= ATH9K_INT_TSFOOR; |
966 | } else { | 950 | else |
967 | ah->imask &= ~ATH9K_INT_MIB; | ||
968 | ah->imask &= ~ATH9K_INT_TSFOOR; | 951 | ah->imask &= ~ATH9K_INT_TSFOOR; |
969 | } | ||
970 | 952 | ||
971 | ath9k_hw_set_interrupts(ah); | 953 | ath9k_hw_set_interrupts(ah); |
972 | 954 | ||
diff --git a/drivers/net/wireless/ath/ath9k/mci.c b/drivers/net/wireless/ath/ath9k/mci.c index 7d34a504d617..64cc782587d8 100644 --- a/drivers/net/wireless/ath/ath9k/mci.c +++ b/drivers/net/wireless/ath/ath9k/mci.c | |||
@@ -233,8 +233,21 @@ static void ath_mci_process_profile(struct ath_softc *sc, | |||
233 | struct ath_mci_profile_info *entry = NULL; | 233 | struct ath_mci_profile_info *entry = NULL; |
234 | 234 | ||
235 | entry = ath_mci_find_profile(mci, info); | 235 | entry = ath_mci_find_profile(mci, info); |
236 | if (entry) | 236 | if (entry) { |
237 | /* | ||
238 | * Two MCI interrupts are generated while connecting to | ||
239 | * headset and A2DP profile, but only one MCI interrupt | ||
240 | * is generated with last added profile type while disconnecting | ||
241 | * both profiles. | ||
242 | * So while adding second profile type decrement | ||
243 | * the first one. | ||
244 | */ | ||
245 | if (entry->type != info->type) { | ||
246 | DEC_PROF(mci, entry); | ||
247 | INC_PROF(mci, info); | ||
248 | } | ||
237 | memcpy(entry, info, 10); | 249 | memcpy(entry, info, 10); |
250 | } | ||
238 | 251 | ||
239 | if (info->start) { | 252 | if (info->start) { |
240 | if (!entry && !ath_mci_add_profile(common, mci, info)) | 253 | if (!entry && !ath_mci_add_profile(common, mci, info)) |
@@ -335,7 +348,7 @@ static void ath_mci_msg(struct ath_softc *sc, u8 opcode, u8 *rx_payload) | |||
335 | 348 | ||
336 | seq_num = *((u32 *)(rx_payload + 12)); | 349 | seq_num = *((u32 *)(rx_payload + 12)); |
337 | ath_dbg(common, MCI, | 350 | ath_dbg(common, MCI, |
338 | "BT_Status_Update: is_link=%d, linkId=%d, state=%d, SEQ=%d\n", | 351 | "BT_Status_Update: is_link=%d, linkId=%d, state=%d, SEQ=%u\n", |
339 | profile_status.is_link, profile_status.conn_handle, | 352 | profile_status.is_link, profile_status.conn_handle, |
340 | profile_status.is_critical, seq_num); | 353 | profile_status.is_critical, seq_num); |
341 | 354 | ||
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 75acefbd4937..5046b282a93c 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -2162,10 +2162,6 @@ enum { | |||
2162 | #define AR_BTCOEX_CTRL_SPDT_POLARITY 0x80000000 | 2162 | #define AR_BTCOEX_CTRL_SPDT_POLARITY 0x80000000 |
2163 | #define AR_BTCOEX_CTRL_SPDT_POLARITY_S 31 | 2163 | #define AR_BTCOEX_CTRL_SPDT_POLARITY_S 31 |
2164 | 2164 | ||
2165 | #define AR_BTCOEX_WL_WEIGHTS0 0x18b0 | ||
2166 | #define AR_BTCOEX_WL_WEIGHTS1 0x18b4 | ||
2167 | #define AR_BTCOEX_WL_WEIGHTS2 0x18b8 | ||
2168 | #define AR_BTCOEX_WL_WEIGHTS3 0x18bc | ||
2169 | #define AR_BTCOEX_MAX_TXPWR(_x) (0x18c0 + ((_x) << 2)) | 2165 | #define AR_BTCOEX_MAX_TXPWR(_x) (0x18c0 + ((_x) << 2)) |
2170 | #define AR_BTCOEX_WL_LNA 0x1940 | 2166 | #define AR_BTCOEX_WL_LNA 0x1940 |
2171 | #define AR_BTCOEX_RFGAIN_CTRL 0x1944 | 2167 | #define AR_BTCOEX_RFGAIN_CTRL 0x1944 |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 8d8306039edb..cafb4a09729a 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1165,6 +1165,7 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1165 | { | 1165 | { |
1166 | struct ath_atx_tid *txtid; | 1166 | struct ath_atx_tid *txtid; |
1167 | struct ath_node *an; | 1167 | struct ath_node *an; |
1168 | u8 density; | ||
1168 | 1169 | ||
1169 | an = (struct ath_node *)sta->drv_priv; | 1170 | an = (struct ath_node *)sta->drv_priv; |
1170 | txtid = ATH_AN_2_TID(an, tid); | 1171 | txtid = ATH_AN_2_TID(an, tid); |
@@ -1172,6 +1173,17 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1172 | if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) | 1173 | if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) |
1173 | return -EAGAIN; | 1174 | return -EAGAIN; |
1174 | 1175 | ||
1176 | /* update ampdu factor/density, they may have changed. This may happen | ||
1177 | * in HT IBSS when a beacon with HT-info is received after the station | ||
1178 | * has already been added. | ||
1179 | */ | ||
1180 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | ||
1181 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | ||
1182 | sta->ht_cap.ampdu_factor); | ||
1183 | density = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density); | ||
1184 | an->mpdudensity = density; | ||
1185 | } | ||
1186 | |||
1175 | txtid->state |= AGGR_ADDBA_PROGRESS; | 1187 | txtid->state |= AGGR_ADDBA_PROGRESS; |
1176 | txtid->paused = true; | 1188 | txtid->paused = true; |
1177 | *ssn = txtid->seq_start = txtid->seq_next; | 1189 | *ssn = txtid->seq_start = txtid->seq_next; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 82f51dbd0d66..49765d34b4e0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 | 45 | #define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 |
46 | #define SDIO_DEVICE_ID_BROADCOM_4330 0x4330 | 46 | #define SDIO_DEVICE_ID_BROADCOM_4330 0x4330 |
47 | #define SDIO_DEVICE_ID_BROADCOM_4334 0x4334 | ||
47 | 48 | ||
48 | #define SDIO_FUNC1_BLOCKSIZE 64 | 49 | #define SDIO_FUNC1_BLOCKSIZE 64 |
49 | #define SDIO_FUNC2_BLOCKSIZE 512 | 50 | #define SDIO_FUNC2_BLOCKSIZE 512 |
@@ -52,6 +53,7 @@ | |||
52 | static const struct sdio_device_id brcmf_sdmmc_ids[] = { | 53 | static const struct sdio_device_id brcmf_sdmmc_ids[] = { |
53 | {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, | 54 | {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, |
54 | {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4330)}, | 55 | {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4330)}, |
56 | {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334)}, | ||
55 | { /* end: all zeroes */ }, | 57 | { /* end: all zeroes */ }, |
56 | }; | 58 | }; |
57 | MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); | 59 | MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index 366916494be4..537f499cc5d2 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -36,6 +36,13 @@ struct dngl_stats { | |||
36 | unsigned long multicast; /* multicast packets received */ | 36 | unsigned long multicast; /* multicast packets received */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct brcmf_bus_dcmd { | ||
40 | char *name; | ||
41 | char *param; | ||
42 | int param_len; | ||
43 | struct list_head list; | ||
44 | }; | ||
45 | |||
39 | /* interface structure between common and bus layer */ | 46 | /* interface structure between common and bus layer */ |
40 | struct brcmf_bus { | 47 | struct brcmf_bus { |
41 | u8 type; /* bus type */ | 48 | u8 type; /* bus type */ |
@@ -50,6 +57,7 @@ struct brcmf_bus { | |||
50 | unsigned long tx_realloc; /* Tx packets realloced for headroom */ | 57 | unsigned long tx_realloc; /* Tx packets realloced for headroom */ |
51 | struct dngl_stats dstats; /* Stats for dongle-based data */ | 58 | struct dngl_stats dstats; /* Stats for dongle-based data */ |
52 | u8 align; /* bus alignment requirement */ | 59 | u8 align; /* bus alignment requirement */ |
60 | struct list_head dcmd_list; | ||
53 | 61 | ||
54 | /* interface functions pointers */ | 62 | /* interface functions pointers */ |
55 | /* Stop bus module: clear pending frames, disable data flow */ | 63 | /* Stop bus module: clear pending frames, disable data flow */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index 236cb9fa460c..2621dd3d7dcd 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -800,13 +800,13 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
800 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for | 800 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for |
801 | "event_msgs" + '\0' + bitvec */ | 801 | "event_msgs" + '\0' + bitvec */ |
802 | char buf[128], *ptr; | 802 | char buf[128], *ptr; |
803 | u32 dongle_align = drvr->bus_if->align; | ||
804 | u32 glom = 0; | ||
805 | u32 roaming = 1; | 803 | u32 roaming = 1; |
806 | uint bcn_timeout = 3; | 804 | uint bcn_timeout = 3; |
807 | int scan_assoc_time = 40; | 805 | int scan_assoc_time = 40; |
808 | int scan_unassoc_time = 40; | 806 | int scan_unassoc_time = 40; |
809 | int i; | 807 | int i; |
808 | struct brcmf_bus_dcmd *cmdlst; | ||
809 | struct list_head *cur, *q; | ||
810 | 810 | ||
811 | mutex_lock(&drvr->proto_block); | 811 | mutex_lock(&drvr->proto_block); |
812 | 812 | ||
@@ -827,17 +827,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
827 | /* Print fw version info */ | 827 | /* Print fw version info */ |
828 | brcmf_dbg(ERROR, "Firmware version = %s\n", buf); | 828 | brcmf_dbg(ERROR, "Firmware version = %s\n", buf); |
829 | 829 | ||
830 | /* Match Host and Dongle rx alignment */ | ||
831 | brcmf_c_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, | ||
832 | sizeof(iovbuf)); | ||
833 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | ||
834 | sizeof(iovbuf)); | ||
835 | |||
836 | /* disable glom option per default */ | ||
837 | brcmf_c_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); | ||
838 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | ||
839 | sizeof(iovbuf)); | ||
840 | |||
841 | /* Setup timeout if Beacons are lost and roam is off to report | 830 | /* Setup timeout if Beacons are lost and roam is off to report |
842 | link down */ | 831 | link down */ |
843 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | 832 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, |
@@ -874,6 +863,20 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
874 | 0, true); | 863 | 0, true); |
875 | } | 864 | } |
876 | 865 | ||
866 | /* set bus specific command if there is any */ | ||
867 | list_for_each_safe(cur, q, &drvr->bus_if->dcmd_list) { | ||
868 | cmdlst = list_entry(cur, struct brcmf_bus_dcmd, list); | ||
869 | if (cmdlst->name && cmdlst->param && cmdlst->param_len) { | ||
870 | brcmf_c_mkiovar(cmdlst->name, cmdlst->param, | ||
871 | cmdlst->param_len, iovbuf, | ||
872 | sizeof(iovbuf)); | ||
873 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | ||
874 | iovbuf, sizeof(iovbuf)); | ||
875 | } | ||
876 | list_del(cur); | ||
877 | kfree(cmdlst); | ||
878 | } | ||
879 | |||
877 | mutex_unlock(&drvr->proto_block); | 880 | mutex_unlock(&drvr->proto_block); |
878 | 881 | ||
879 | return 0; | 882 | return 0; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 01cf6c03390b..57bf1d7ee80f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -1020,6 +1020,8 @@ int brcmf_attach(uint bus_hdrlen, struct device *dev) | |||
1020 | INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address); | 1020 | INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address); |
1021 | INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list); | 1021 | INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list); |
1022 | 1022 | ||
1023 | INIT_LIST_HEAD(&drvr->bus_if->dcmd_list); | ||
1024 | |||
1023 | return ret; | 1025 | return ret; |
1024 | 1026 | ||
1025 | fail: | 1027 | fail: |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index b023766954a6..472f2ef5c652 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/firmware.h> | 31 | #include <linux/firmware.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/bcma/bcma.h> | 33 | #include <linux/bcma/bcma.h> |
34 | #include <linux/debugfs.h> | ||
35 | #include <linux/vmalloc.h> | ||
34 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
35 | #include <defs.h> | 37 | #include <defs.h> |
36 | #include <brcmu_wifi.h> | 38 | #include <brcmu_wifi.h> |
@@ -48,6 +50,9 @@ | |||
48 | 50 | ||
49 | #define CBUF_LEN (128) | 51 | #define CBUF_LEN (128) |
50 | 52 | ||
53 | /* Device console log buffer state */ | ||
54 | #define CONSOLE_BUFFER_MAX 2024 | ||
55 | |||
51 | struct rte_log_le { | 56 | struct rte_log_le { |
52 | __le32 buf; /* Can't be pointer on (64-bit) hosts */ | 57 | __le32 buf; /* Can't be pointer on (64-bit) hosts */ |
53 | __le32 buf_size; | 58 | __le32 buf_size; |
@@ -281,7 +286,7 @@ struct rte_console { | |||
281 | * Shared structure between dongle and the host. | 286 | * Shared structure between dongle and the host. |
282 | * The structure contains pointers to trap or assert information. | 287 | * The structure contains pointers to trap or assert information. |
283 | */ | 288 | */ |
284 | #define SDPCM_SHARED_VERSION 0x0002 | 289 | #define SDPCM_SHARED_VERSION 0x0003 |
285 | #define SDPCM_SHARED_VERSION_MASK 0x00FF | 290 | #define SDPCM_SHARED_VERSION_MASK 0x00FF |
286 | #define SDPCM_SHARED_ASSERT_BUILT 0x0100 | 291 | #define SDPCM_SHARED_ASSERT_BUILT 0x0100 |
287 | #define SDPCM_SHARED_ASSERT 0x0200 | 292 | #define SDPCM_SHARED_ASSERT 0x0200 |
@@ -428,6 +433,29 @@ struct brcmf_console { | |||
428 | u8 *buf; /* Log buffer (host copy) */ | 433 | u8 *buf; /* Log buffer (host copy) */ |
429 | uint last; /* Last buffer read index */ | 434 | uint last; /* Last buffer read index */ |
430 | }; | 435 | }; |
436 | |||
437 | struct brcmf_trap_info { | ||
438 | __le32 type; | ||
439 | __le32 epc; | ||
440 | __le32 cpsr; | ||
441 | __le32 spsr; | ||
442 | __le32 r0; /* a1 */ | ||
443 | __le32 r1; /* a2 */ | ||
444 | __le32 r2; /* a3 */ | ||
445 | __le32 r3; /* a4 */ | ||
446 | __le32 r4; /* v1 */ | ||
447 | __le32 r5; /* v2 */ | ||
448 | __le32 r6; /* v3 */ | ||
449 | __le32 r7; /* v4 */ | ||
450 | __le32 r8; /* v5 */ | ||
451 | __le32 r9; /* sb/v6 */ | ||
452 | __le32 r10; /* sl/v7 */ | ||
453 | __le32 r11; /* fp/v8 */ | ||
454 | __le32 r12; /* ip */ | ||
455 | __le32 r13; /* sp */ | ||
456 | __le32 r14; /* lr */ | ||
457 | __le32 pc; /* r15 */ | ||
458 | }; | ||
431 | #endif /* DEBUG */ | 459 | #endif /* DEBUG */ |
432 | 460 | ||
433 | struct sdpcm_shared { | 461 | struct sdpcm_shared { |
@@ -439,6 +467,7 @@ struct sdpcm_shared { | |||
439 | u32 console_addr; /* Address of struct rte_console */ | 467 | u32 console_addr; /* Address of struct rte_console */ |
440 | u32 msgtrace_addr; | 468 | u32 msgtrace_addr; |
441 | u8 tag[32]; | 469 | u8 tag[32]; |
470 | u32 brpt_addr; | ||
442 | }; | 471 | }; |
443 | 472 | ||
444 | struct sdpcm_shared_le { | 473 | struct sdpcm_shared_le { |
@@ -450,6 +479,7 @@ struct sdpcm_shared_le { | |||
450 | __le32 console_addr; /* Address of struct rte_console */ | 479 | __le32 console_addr; /* Address of struct rte_console */ |
451 | __le32 msgtrace_addr; | 480 | __le32 msgtrace_addr; |
452 | u8 tag[32]; | 481 | u8 tag[32]; |
482 | __le32 brpt_addr; | ||
453 | }; | 483 | }; |
454 | 484 | ||
455 | 485 | ||
@@ -2953,13 +2983,311 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2953 | } | 2983 | } |
2954 | 2984 | ||
2955 | #ifdef DEBUG | 2985 | #ifdef DEBUG |
2986 | static inline bool brcmf_sdio_valid_shared_address(u32 addr) | ||
2987 | { | ||
2988 | return !(addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)); | ||
2989 | } | ||
2990 | |||
2991 | static int brcmf_sdio_readshared(struct brcmf_sdio *bus, | ||
2992 | struct sdpcm_shared *sh) | ||
2993 | { | ||
2994 | u32 addr; | ||
2995 | int rv; | ||
2996 | u32 shaddr = 0; | ||
2997 | struct sdpcm_shared_le sh_le; | ||
2998 | __le32 addr_le; | ||
2999 | |||
3000 | shaddr = bus->ramsize - 4; | ||
3001 | |||
3002 | /* | ||
3003 | * Read last word in socram to determine | ||
3004 | * address of sdpcm_shared structure | ||
3005 | */ | ||
3006 | rv = brcmf_sdbrcm_membytes(bus, false, shaddr, | ||
3007 | (u8 *)&addr_le, 4); | ||
3008 | if (rv < 0) | ||
3009 | return rv; | ||
3010 | |||
3011 | addr = le32_to_cpu(addr_le); | ||
3012 | |||
3013 | brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr); | ||
3014 | |||
3015 | /* | ||
3016 | * Check if addr is valid. | ||
3017 | * NVRAM length at the end of memory should have been overwritten. | ||
3018 | */ | ||
3019 | if (!brcmf_sdio_valid_shared_address(addr)) { | ||
3020 | brcmf_dbg(ERROR, "invalid sdpcm_shared address 0x%08X\n", | ||
3021 | addr); | ||
3022 | return -EINVAL; | ||
3023 | } | ||
3024 | |||
3025 | /* Read hndrte_shared structure */ | ||
3026 | rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&sh_le, | ||
3027 | sizeof(struct sdpcm_shared_le)); | ||
3028 | if (rv < 0) | ||
3029 | return rv; | ||
3030 | |||
3031 | /* Endianness */ | ||
3032 | sh->flags = le32_to_cpu(sh_le.flags); | ||
3033 | sh->trap_addr = le32_to_cpu(sh_le.trap_addr); | ||
3034 | sh->assert_exp_addr = le32_to_cpu(sh_le.assert_exp_addr); | ||
3035 | sh->assert_file_addr = le32_to_cpu(sh_le.assert_file_addr); | ||
3036 | sh->assert_line = le32_to_cpu(sh_le.assert_line); | ||
3037 | sh->console_addr = le32_to_cpu(sh_le.console_addr); | ||
3038 | sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr); | ||
3039 | |||
3040 | if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { | ||
3041 | brcmf_dbg(ERROR, | ||
3042 | "sdpcm_shared version mismatch: dhd %d dongle %d\n", | ||
3043 | SDPCM_SHARED_VERSION, | ||
3044 | sh->flags & SDPCM_SHARED_VERSION_MASK); | ||
3045 | return -EPROTO; | ||
3046 | } | ||
3047 | |||
3048 | return 0; | ||
3049 | } | ||
3050 | |||
3051 | static int brcmf_sdio_dump_console(struct brcmf_sdio *bus, | ||
3052 | struct sdpcm_shared *sh, char __user *data, | ||
3053 | size_t count) | ||
3054 | { | ||
3055 | u32 addr, console_ptr, console_size, console_index; | ||
3056 | char *conbuf = NULL; | ||
3057 | __le32 sh_val; | ||
3058 | int rv; | ||
3059 | loff_t pos = 0; | ||
3060 | int nbytes = 0; | ||
3061 | |||
3062 | /* obtain console information from device memory */ | ||
3063 | addr = sh->console_addr + offsetof(struct rte_console, log_le); | ||
3064 | rv = brcmf_sdbrcm_membytes(bus, false, addr, | ||
3065 | (u8 *)&sh_val, sizeof(u32)); | ||
3066 | if (rv < 0) | ||
3067 | return rv; | ||
3068 | console_ptr = le32_to_cpu(sh_val); | ||
3069 | |||
3070 | addr = sh->console_addr + offsetof(struct rte_console, log_le.buf_size); | ||
3071 | rv = brcmf_sdbrcm_membytes(bus, false, addr, | ||
3072 | (u8 *)&sh_val, sizeof(u32)); | ||
3073 | if (rv < 0) | ||
3074 | return rv; | ||
3075 | console_size = le32_to_cpu(sh_val); | ||
3076 | |||
3077 | addr = sh->console_addr + offsetof(struct rte_console, log_le.idx); | ||
3078 | rv = brcmf_sdbrcm_membytes(bus, false, addr, | ||
3079 | (u8 *)&sh_val, sizeof(u32)); | ||
3080 | if (rv < 0) | ||
3081 | return rv; | ||
3082 | console_index = le32_to_cpu(sh_val); | ||
3083 | |||
3084 | /* allocate buffer for console data */ | ||
3085 | if (console_size <= CONSOLE_BUFFER_MAX) | ||
3086 | conbuf = vzalloc(console_size+1); | ||
3087 | |||
3088 | if (!conbuf) | ||
3089 | return -ENOMEM; | ||
3090 | |||
3091 | /* obtain the console data from device */ | ||
3092 | conbuf[console_size] = '\0'; | ||
3093 | rv = brcmf_sdbrcm_membytes(bus, false, console_ptr, (u8 *)conbuf, | ||
3094 | console_size); | ||
3095 | if (rv < 0) | ||
3096 | goto done; | ||
3097 | |||
3098 | rv = simple_read_from_buffer(data, count, &pos, | ||
3099 | conbuf + console_index, | ||
3100 | console_size - console_index); | ||
3101 | if (rv < 0) | ||
3102 | goto done; | ||
3103 | |||
3104 | nbytes = rv; | ||
3105 | if (console_index > 0) { | ||
3106 | pos = 0; | ||
3107 | rv = simple_read_from_buffer(data+nbytes, count, &pos, | ||
3108 | conbuf, console_index - 1); | ||
3109 | if (rv < 0) | ||
3110 | goto done; | ||
3111 | rv += nbytes; | ||
3112 | } | ||
3113 | done: | ||
3114 | vfree(conbuf); | ||
3115 | return rv; | ||
3116 | } | ||
3117 | |||
3118 | static int brcmf_sdio_trap_info(struct brcmf_sdio *bus, struct sdpcm_shared *sh, | ||
3119 | char __user *data, size_t count) | ||
3120 | { | ||
3121 | int error, res; | ||
3122 | char buf[350]; | ||
3123 | struct brcmf_trap_info tr; | ||
3124 | int nbytes; | ||
3125 | loff_t pos = 0; | ||
3126 | |||
3127 | if ((sh->flags & SDPCM_SHARED_TRAP) == 0) | ||
3128 | return 0; | ||
3129 | |||
3130 | error = brcmf_sdbrcm_membytes(bus, false, sh->trap_addr, (u8 *)&tr, | ||
3131 | sizeof(struct brcmf_trap_info)); | ||
3132 | if (error < 0) | ||
3133 | return error; | ||
3134 | |||
3135 | nbytes = brcmf_sdio_dump_console(bus, sh, data, count); | ||
3136 | if (nbytes < 0) | ||
3137 | return nbytes; | ||
3138 | |||
3139 | res = scnprintf(buf, sizeof(buf), | ||
3140 | "dongle trap info: type 0x%x @ epc 0x%08x\n" | ||
3141 | " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" | ||
3142 | " lr 0x%08x pc 0x%08x offset 0x%x\n" | ||
3143 | " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" | ||
3144 | " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", | ||
3145 | le32_to_cpu(tr.type), le32_to_cpu(tr.epc), | ||
3146 | le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), | ||
3147 | le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), | ||
3148 | le32_to_cpu(tr.pc), sh->trap_addr, | ||
3149 | le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), | ||
3150 | le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), | ||
3151 | le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), | ||
3152 | le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); | ||
3153 | |||
3154 | error = simple_read_from_buffer(data+nbytes, count, &pos, buf, res); | ||
3155 | if (error < 0) | ||
3156 | return error; | ||
3157 | |||
3158 | nbytes += error; | ||
3159 | return nbytes; | ||
3160 | } | ||
3161 | |||
3162 | static int brcmf_sdio_assert_info(struct brcmf_sdio *bus, | ||
3163 | struct sdpcm_shared *sh, char __user *data, | ||
3164 | size_t count) | ||
3165 | { | ||
3166 | int error = 0; | ||
3167 | char buf[200]; | ||
3168 | char file[80] = "?"; | ||
3169 | char expr[80] = "<???>"; | ||
3170 | int res; | ||
3171 | loff_t pos = 0; | ||
3172 | |||
3173 | if ((sh->flags & SDPCM_SHARED_ASSERT_BUILT) == 0) { | ||
3174 | brcmf_dbg(INFO, "firmware not built with -assert\n"); | ||
3175 | return 0; | ||
3176 | } else if ((sh->flags & SDPCM_SHARED_ASSERT) == 0) { | ||
3177 | brcmf_dbg(INFO, "no assert in dongle\n"); | ||
3178 | return 0; | ||
3179 | } | ||
3180 | |||
3181 | if (sh->assert_file_addr != 0) { | ||
3182 | error = brcmf_sdbrcm_membytes(bus, false, sh->assert_file_addr, | ||
3183 | (u8 *)file, 80); | ||
3184 | if (error < 0) | ||
3185 | return error; | ||
3186 | } | ||
3187 | if (sh->assert_exp_addr != 0) { | ||
3188 | error = brcmf_sdbrcm_membytes(bus, false, sh->assert_exp_addr, | ||
3189 | (u8 *)expr, 80); | ||
3190 | if (error < 0) | ||
3191 | return error; | ||
3192 | } | ||
3193 | |||
3194 | res = scnprintf(buf, sizeof(buf), | ||
3195 | "dongle assert: %s:%d: assert(%s)\n", | ||
3196 | file, sh->assert_line, expr); | ||
3197 | return simple_read_from_buffer(data, count, &pos, buf, res); | ||
3198 | } | ||
3199 | |||
3200 | static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) | ||
3201 | { | ||
3202 | int error; | ||
3203 | struct sdpcm_shared sh; | ||
3204 | |||
3205 | down(&bus->sdsem); | ||
3206 | error = brcmf_sdio_readshared(bus, &sh); | ||
3207 | up(&bus->sdsem); | ||
3208 | |||
3209 | if (error < 0) | ||
3210 | return error; | ||
3211 | |||
3212 | if ((sh.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) | ||
3213 | brcmf_dbg(INFO, "firmware not built with -assert\n"); | ||
3214 | else if (sh.flags & SDPCM_SHARED_ASSERT) | ||
3215 | brcmf_dbg(ERROR, "assertion in dongle\n"); | ||
3216 | |||
3217 | if (sh.flags & SDPCM_SHARED_TRAP) | ||
3218 | brcmf_dbg(ERROR, "firmware trap in dongle\n"); | ||
3219 | |||
3220 | return 0; | ||
3221 | } | ||
3222 | |||
3223 | static int brcmf_sdbrcm_died_dump(struct brcmf_sdio *bus, char __user *data, | ||
3224 | size_t count, loff_t *ppos) | ||
3225 | { | ||
3226 | int error = 0; | ||
3227 | struct sdpcm_shared sh; | ||
3228 | int nbytes = 0; | ||
3229 | loff_t pos = *ppos; | ||
3230 | |||
3231 | if (pos != 0) | ||
3232 | return 0; | ||
3233 | |||
3234 | down(&bus->sdsem); | ||
3235 | error = brcmf_sdio_readshared(bus, &sh); | ||
3236 | if (error < 0) | ||
3237 | goto done; | ||
3238 | |||
3239 | error = brcmf_sdio_assert_info(bus, &sh, data, count); | ||
3240 | if (error < 0) | ||
3241 | goto done; | ||
3242 | |||
3243 | nbytes = error; | ||
3244 | error = brcmf_sdio_trap_info(bus, &sh, data, count); | ||
3245 | if (error < 0) | ||
3246 | goto done; | ||
3247 | |||
3248 | error += nbytes; | ||
3249 | *ppos += error; | ||
3250 | done: | ||
3251 | up(&bus->sdsem); | ||
3252 | return error; | ||
3253 | } | ||
3254 | |||
3255 | static ssize_t brcmf_sdio_forensic_read(struct file *f, char __user *data, | ||
3256 | size_t count, loff_t *ppos) | ||
3257 | { | ||
3258 | struct brcmf_sdio *bus = f->private_data; | ||
3259 | int res; | ||
3260 | |||
3261 | res = brcmf_sdbrcm_died_dump(bus, data, count, ppos); | ||
3262 | if (res > 0) | ||
3263 | *ppos += res; | ||
3264 | return (ssize_t)res; | ||
3265 | } | ||
3266 | |||
3267 | static const struct file_operations brcmf_sdio_forensic_ops = { | ||
3268 | .owner = THIS_MODULE, | ||
3269 | .open = simple_open, | ||
3270 | .read = brcmf_sdio_forensic_read | ||
3271 | }; | ||
3272 | |||
2956 | static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) | 3273 | static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) |
2957 | { | 3274 | { |
2958 | struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; | 3275 | struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; |
3276 | struct dentry *dentry = brcmf_debugfs_get_devdir(drvr); | ||
2959 | 3277 | ||
3278 | if (IS_ERR_OR_NULL(dentry)) | ||
3279 | return; | ||
3280 | |||
3281 | debugfs_create_file("forensics", S_IRUGO, dentry, bus, | ||
3282 | &brcmf_sdio_forensic_ops); | ||
2960 | brcmf_debugfs_create_sdio_count(drvr, &bus->sdcnt); | 3283 | brcmf_debugfs_create_sdio_count(drvr, &bus->sdcnt); |
2961 | } | 3284 | } |
2962 | #else | 3285 | #else |
3286 | static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) | ||
3287 | { | ||
3288 | return 0; | ||
3289 | } | ||
3290 | |||
2963 | static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) | 3291 | static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) |
2964 | { | 3292 | { |
2965 | } | 3293 | } |
@@ -2991,11 +3319,13 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2991 | rxlen, msglen); | 3319 | rxlen, msglen); |
2992 | } else if (timeleft == 0) { | 3320 | } else if (timeleft == 0) { |
2993 | brcmf_dbg(ERROR, "resumed on timeout\n"); | 3321 | brcmf_dbg(ERROR, "resumed on timeout\n"); |
3322 | brcmf_sdbrcm_checkdied(bus); | ||
2994 | } else if (pending) { | 3323 | } else if (pending) { |
2995 | brcmf_dbg(CTL, "cancelled\n"); | 3324 | brcmf_dbg(CTL, "cancelled\n"); |
2996 | return -ERESTARTSYS; | 3325 | return -ERESTARTSYS; |
2997 | } else { | 3326 | } else { |
2998 | brcmf_dbg(CTL, "resumed for unknown reason?\n"); | 3327 | brcmf_dbg(CTL, "resumed for unknown reason?\n"); |
3328 | brcmf_sdbrcm_checkdied(bus); | ||
2999 | } | 3329 | } |
3000 | 3330 | ||
3001 | if (rxlen) | 3331 | if (rxlen) |
@@ -3006,45 +3336,10 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) | |||
3006 | return rxlen ? (int)rxlen : -ETIMEDOUT; | 3336 | return rxlen ? (int)rxlen : -ETIMEDOUT; |
3007 | } | 3337 | } |
3008 | 3338 | ||
3009 | static int brcmf_sdbrcm_downloadvars(struct brcmf_sdio *bus, void *arg, int len) | ||
3010 | { | ||
3011 | int bcmerror = 0; | ||
3012 | |||
3013 | brcmf_dbg(TRACE, "Enter\n"); | ||
3014 | |||
3015 | /* Basic sanity checks */ | ||
3016 | if (bus->sdiodev->bus_if->drvr_up) { | ||
3017 | bcmerror = -EISCONN; | ||
3018 | goto err; | ||
3019 | } | ||
3020 | if (!len) { | ||
3021 | bcmerror = -EOVERFLOW; | ||
3022 | goto err; | ||
3023 | } | ||
3024 | |||
3025 | /* Free the old ones and replace with passed variables */ | ||
3026 | kfree(bus->vars); | ||
3027 | |||
3028 | bus->vars = kmalloc(len, GFP_ATOMIC); | ||
3029 | bus->varsz = bus->vars ? len : 0; | ||
3030 | if (bus->vars == NULL) { | ||
3031 | bcmerror = -ENOMEM; | ||
3032 | goto err; | ||
3033 | } | ||
3034 | |||
3035 | /* Copy the passed variables, which should include the | ||
3036 | terminating double-null */ | ||
3037 | memcpy(bus->vars, arg, bus->varsz); | ||
3038 | err: | ||
3039 | return bcmerror; | ||
3040 | } | ||
3041 | |||
3042 | static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus) | 3339 | static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus) |
3043 | { | 3340 | { |
3044 | int bcmerror = 0; | 3341 | int bcmerror = 0; |
3045 | u32 varsize; | ||
3046 | u32 varaddr; | 3342 | u32 varaddr; |
3047 | u8 *vbuffer; | ||
3048 | u32 varsizew; | 3343 | u32 varsizew; |
3049 | __le32 varsizew_le; | 3344 | __le32 varsizew_le; |
3050 | #ifdef DEBUG | 3345 | #ifdef DEBUG |
@@ -3053,56 +3348,44 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus) | |||
3053 | 3348 | ||
3054 | /* Even if there are no vars are to be written, we still | 3349 | /* Even if there are no vars are to be written, we still |
3055 | need to set the ramsize. */ | 3350 | need to set the ramsize. */ |
3056 | varsize = bus->varsz ? roundup(bus->varsz, 4) : 0; | 3351 | varaddr = (bus->ramsize - 4) - bus->varsz; |
3057 | varaddr = (bus->ramsize - 4) - varsize; | ||
3058 | 3352 | ||
3059 | if (bus->vars) { | 3353 | if (bus->vars) { |
3060 | vbuffer = kzalloc(varsize, GFP_ATOMIC); | ||
3061 | if (!vbuffer) | ||
3062 | return -ENOMEM; | ||
3063 | |||
3064 | memcpy(vbuffer, bus->vars, bus->varsz); | ||
3065 | |||
3066 | /* Write the vars list */ | 3354 | /* Write the vars list */ |
3067 | bcmerror = | 3355 | bcmerror = brcmf_sdbrcm_membytes(bus, true, varaddr, |
3068 | brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize); | 3356 | bus->vars, bus->varsz); |
3069 | #ifdef DEBUG | 3357 | #ifdef DEBUG |
3070 | /* Verify NVRAM bytes */ | 3358 | /* Verify NVRAM bytes */ |
3071 | brcmf_dbg(INFO, "Compare NVRAM dl & ul; varsize=%d\n", varsize); | 3359 | brcmf_dbg(INFO, "Compare NVRAM dl & ul; varsize=%d\n", |
3072 | nvram_ularray = kmalloc(varsize, GFP_ATOMIC); | 3360 | bus->varsz); |
3073 | if (!nvram_ularray) { | 3361 | nvram_ularray = kmalloc(bus->varsz, GFP_ATOMIC); |
3074 | kfree(vbuffer); | 3362 | if (!nvram_ularray) |
3075 | return -ENOMEM; | 3363 | return -ENOMEM; |
3076 | } | ||
3077 | 3364 | ||
3078 | /* Upload image to verify downloaded contents. */ | 3365 | /* Upload image to verify downloaded contents. */ |
3079 | memset(nvram_ularray, 0xaa, varsize); | 3366 | memset(nvram_ularray, 0xaa, bus->varsz); |
3080 | 3367 | ||
3081 | /* Read the vars list to temp buffer for comparison */ | 3368 | /* Read the vars list to temp buffer for comparison */ |
3082 | bcmerror = | 3369 | bcmerror = brcmf_sdbrcm_membytes(bus, false, varaddr, |
3083 | brcmf_sdbrcm_membytes(bus, false, varaddr, nvram_ularray, | 3370 | nvram_ularray, bus->varsz); |
3084 | varsize); | ||
3085 | if (bcmerror) { | 3371 | if (bcmerror) { |
3086 | brcmf_dbg(ERROR, "error %d on reading %d nvram bytes at 0x%08x\n", | 3372 | brcmf_dbg(ERROR, "error %d on reading %d nvram bytes at 0x%08x\n", |
3087 | bcmerror, varsize, varaddr); | 3373 | bcmerror, bus->varsz, varaddr); |
3088 | } | 3374 | } |
3089 | /* Compare the org NVRAM with the one read from RAM */ | 3375 | /* Compare the org NVRAM with the one read from RAM */ |
3090 | if (memcmp(vbuffer, nvram_ularray, varsize)) | 3376 | if (memcmp(bus->vars, nvram_ularray, bus->varsz)) |
3091 | brcmf_dbg(ERROR, "Downloaded NVRAM image is corrupted\n"); | 3377 | brcmf_dbg(ERROR, "Downloaded NVRAM image is corrupted\n"); |
3092 | else | 3378 | else |
3093 | brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n"); | 3379 | brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n"); |
3094 | 3380 | ||
3095 | kfree(nvram_ularray); | 3381 | kfree(nvram_ularray); |
3096 | #endif /* DEBUG */ | 3382 | #endif /* DEBUG */ |
3097 | |||
3098 | kfree(vbuffer); | ||
3099 | } | 3383 | } |
3100 | 3384 | ||
3101 | /* adjust to the user specified RAM */ | 3385 | /* adjust to the user specified RAM */ |
3102 | brcmf_dbg(INFO, "Physical memory size: %d\n", bus->ramsize); | 3386 | brcmf_dbg(INFO, "Physical memory size: %d\n", bus->ramsize); |
3103 | brcmf_dbg(INFO, "Vars are at %d, orig varsize is %d\n", | 3387 | brcmf_dbg(INFO, "Vars are at %d, orig varsize is %d\n", |
3104 | varaddr, varsize); | 3388 | varaddr, bus->varsz); |
3105 | varsize = ((bus->ramsize - 4) - varaddr); | ||
3106 | 3389 | ||
3107 | /* | 3390 | /* |
3108 | * Determine the length token: | 3391 | * Determine the length token: |
@@ -3113,13 +3396,13 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus) | |||
3113 | varsizew = 0; | 3396 | varsizew = 0; |
3114 | varsizew_le = cpu_to_le32(0); | 3397 | varsizew_le = cpu_to_le32(0); |
3115 | } else { | 3398 | } else { |
3116 | varsizew = varsize / 4; | 3399 | varsizew = bus->varsz / 4; |
3117 | varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); | 3400 | varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); |
3118 | varsizew_le = cpu_to_le32(varsizew); | 3401 | varsizew_le = cpu_to_le32(varsizew); |
3119 | } | 3402 | } |
3120 | 3403 | ||
3121 | brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n", | 3404 | brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n", |
3122 | varsize, varsizew); | 3405 | bus->varsz, varsizew); |
3123 | 3406 | ||
3124 | /* Write the length token to the last word */ | 3407 | /* Write the length token to the last word */ |
3125 | bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->ramsize - 4), | 3408 | bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->ramsize - 4), |
@@ -3243,13 +3526,21 @@ err: | |||
3243 | * by two NULs. | 3526 | * by two NULs. |
3244 | */ | 3527 | */ |
3245 | 3528 | ||
3246 | static uint brcmf_process_nvram_vars(char *varbuf, uint len) | 3529 | static int brcmf_process_nvram_vars(struct brcmf_sdio *bus) |
3247 | { | 3530 | { |
3531 | char *varbuf; | ||
3248 | char *dp; | 3532 | char *dp; |
3249 | bool findNewline; | 3533 | bool findNewline; |
3250 | int column; | 3534 | int column; |
3251 | uint buf_len, n; | 3535 | int ret = 0; |
3536 | uint buf_len, n, len; | ||
3537 | |||
3538 | len = bus->firmware->size; | ||
3539 | varbuf = vmalloc(len); | ||
3540 | if (!varbuf) | ||
3541 | return -ENOMEM; | ||
3252 | 3542 | ||
3543 | memcpy(varbuf, bus->firmware->data, len); | ||
3253 | dp = varbuf; | 3544 | dp = varbuf; |
3254 | 3545 | ||
3255 | findNewline = false; | 3546 | findNewline = false; |
@@ -3278,56 +3569,44 @@ static uint brcmf_process_nvram_vars(char *varbuf, uint len) | |||
3278 | column++; | 3569 | column++; |
3279 | } | 3570 | } |
3280 | buf_len = dp - varbuf; | 3571 | buf_len = dp - varbuf; |
3281 | |||
3282 | while (dp < varbuf + n) | 3572 | while (dp < varbuf + n) |
3283 | *dp++ = 0; | 3573 | *dp++ = 0; |
3284 | 3574 | ||
3285 | return buf_len; | 3575 | kfree(bus->vars); |
3576 | /* roundup needed for download to device */ | ||
3577 | bus->varsz = roundup(buf_len + 1, 4); | ||
3578 | bus->vars = kmalloc(bus->varsz, GFP_KERNEL); | ||
3579 | if (bus->vars == NULL) { | ||
3580 | bus->varsz = 0; | ||
3581 | ret = -ENOMEM; | ||
3582 | goto err; | ||
3583 | } | ||
3584 | |||
3585 | /* copy the processed variables and add null termination */ | ||
3586 | memcpy(bus->vars, varbuf, buf_len); | ||
3587 | bus->vars[buf_len] = 0; | ||
3588 | err: | ||
3589 | vfree(varbuf); | ||
3590 | return ret; | ||
3286 | } | 3591 | } |
3287 | 3592 | ||
3288 | static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus) | 3593 | static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus) |
3289 | { | 3594 | { |
3290 | uint len; | ||
3291 | char *memblock = NULL; | ||
3292 | char *bufp; | ||
3293 | int ret; | 3595 | int ret; |
3294 | 3596 | ||
3597 | if (bus->sdiodev->bus_if->drvr_up) | ||
3598 | return -EISCONN; | ||
3599 | |||
3295 | ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME, | 3600 | ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME, |
3296 | &bus->sdiodev->func[2]->dev); | 3601 | &bus->sdiodev->func[2]->dev); |
3297 | if (ret) { | 3602 | if (ret) { |
3298 | brcmf_dbg(ERROR, "Fail to request nvram %d\n", ret); | 3603 | brcmf_dbg(ERROR, "Fail to request nvram %d\n", ret); |
3299 | return ret; | 3604 | return ret; |
3300 | } | 3605 | } |
3301 | bus->fw_ptr = 0; | ||
3302 | 3606 | ||
3303 | memblock = kmalloc(MEMBLOCK, GFP_ATOMIC); | 3607 | ret = brcmf_process_nvram_vars(bus); |
3304 | if (memblock == NULL) { | ||
3305 | ret = -ENOMEM; | ||
3306 | goto err; | ||
3307 | } | ||
3308 | |||
3309 | len = brcmf_sdbrcm_get_image(memblock, MEMBLOCK, bus); | ||
3310 | |||
3311 | if (len > 0 && len < MEMBLOCK) { | ||
3312 | bufp = memblock; | ||
3313 | bufp[len] = 0; | ||
3314 | len = brcmf_process_nvram_vars(bufp, len); | ||
3315 | bufp += len; | ||
3316 | *bufp++ = 0; | ||
3317 | if (len) | ||
3318 | ret = brcmf_sdbrcm_downloadvars(bus, memblock, len + 1); | ||
3319 | if (ret) | ||
3320 | brcmf_dbg(ERROR, "error downloading vars: %d\n", ret); | ||
3321 | } else { | ||
3322 | brcmf_dbg(ERROR, "error reading nvram file: %d\n", len); | ||
3323 | ret = -EIO; | ||
3324 | } | ||
3325 | |||
3326 | err: | ||
3327 | kfree(memblock); | ||
3328 | 3608 | ||
3329 | release_firmware(bus->firmware); | 3609 | release_firmware(bus->firmware); |
3330 | bus->fw_ptr = 0; | ||
3331 | 3610 | ||
3332 | return ret; | 3611 | return ret; |
3333 | } | 3612 | } |
@@ -3606,6 +3885,8 @@ static bool brcmf_sdbrcm_chipmatch(u16 chipid) | |||
3606 | return true; | 3885 | return true; |
3607 | if (chipid == BCM4330_CHIP_ID) | 3886 | if (chipid == BCM4330_CHIP_ID) |
3608 | return true; | 3887 | return true; |
3888 | if (chipid == BCM4334_CHIP_ID) | ||
3889 | return true; | ||
3609 | return false; | 3890 | return false; |
3610 | } | 3891 | } |
3611 | 3892 | ||
@@ -3817,6 +4098,7 @@ static void brcmf_sdbrcm_release_dongle(struct brcmf_sdio *bus) | |||
3817 | static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) | 4098 | static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) |
3818 | { | 4099 | { |
3819 | brcmf_dbg(TRACE, "Enter\n"); | 4100 | brcmf_dbg(TRACE, "Enter\n"); |
4101 | |||
3820 | if (bus) { | 4102 | if (bus) { |
3821 | /* De-register interrupt handler */ | 4103 | /* De-register interrupt handler */ |
3822 | brcmf_sdio_intr_unregister(bus->sdiodev); | 4104 | brcmf_sdio_intr_unregister(bus->sdiodev); |
@@ -3838,6 +4120,10 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3838 | { | 4120 | { |
3839 | int ret; | 4121 | int ret; |
3840 | struct brcmf_sdio *bus; | 4122 | struct brcmf_sdio *bus; |
4123 | struct brcmf_bus_dcmd *dlst; | ||
4124 | u32 dngl_txglom; | ||
4125 | u32 dngl_txglomalign; | ||
4126 | u8 idx; | ||
3841 | 4127 | ||
3842 | brcmf_dbg(TRACE, "Enter\n"); | 4128 | brcmf_dbg(TRACE, "Enter\n"); |
3843 | 4129 | ||
@@ -3923,6 +4209,26 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3923 | brcmf_sdio_debugfs_create(bus); | 4209 | brcmf_sdio_debugfs_create(bus); |
3924 | brcmf_dbg(INFO, "completed!!\n"); | 4210 | brcmf_dbg(INFO, "completed!!\n"); |
3925 | 4211 | ||
4212 | /* sdio bus core specific dcmd */ | ||
4213 | idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV); | ||
4214 | dlst = kzalloc(sizeof(struct brcmf_bus_dcmd), GFP_KERNEL); | ||
4215 | if (dlst) { | ||
4216 | if (bus->ci->c_inf[idx].rev < 12) { | ||
4217 | /* for sdio core rev < 12, disable txgloming */ | ||
4218 | dngl_txglom = 0; | ||
4219 | dlst->name = "bus:txglom"; | ||
4220 | dlst->param = (char *)&dngl_txglom; | ||
4221 | dlst->param_len = sizeof(u32); | ||
4222 | } else { | ||
4223 | /* otherwise, set txglomalign */ | ||
4224 | dngl_txglomalign = bus->sdiodev->bus_if->align; | ||
4225 | dlst->name = "bus:txglomalign"; | ||
4226 | dlst->param = (char *)&dngl_txglomalign; | ||
4227 | dlst->param_len = sizeof(u32); | ||
4228 | } | ||
4229 | list_add(&dlst->list, &bus->sdiodev->bus_if->dcmd_list); | ||
4230 | } | ||
4231 | |||
3926 | /* if firmware path present try to download and bring up bus */ | 4232 | /* if firmware path present try to download and bring up bus */ |
3927 | ret = brcmf_bus_start(bus->sdiodev->dev); | 4233 | ret = brcmf_bus_start(bus->sdiodev->dev); |
3928 | if (ret != 0) { | 4234 | if (ret != 0) { |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c index f8e1f1c84d08..58155e23d220 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c | |||
@@ -403,6 +403,23 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, | |||
403 | ci->c_inf[3].cib = 0x03004211; | 403 | ci->c_inf[3].cib = 0x03004211; |
404 | ci->ramsize = 0x48000; | 404 | ci->ramsize = 0x48000; |
405 | break; | 405 | break; |
406 | case BCM4334_CHIP_ID: | ||
407 | ci->c_inf[0].wrapbase = 0x18100000; | ||
408 | ci->c_inf[0].cib = 0x29004211; | ||
409 | ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; | ||
410 | ci->c_inf[1].base = 0x18002000; | ||
411 | ci->c_inf[1].wrapbase = 0x18102000; | ||
412 | ci->c_inf[1].cib = 0x0d004211; | ||
413 | ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; | ||
414 | ci->c_inf[2].base = 0x18004000; | ||
415 | ci->c_inf[2].wrapbase = 0x18104000; | ||
416 | ci->c_inf[2].cib = 0x13080401; | ||
417 | ci->c_inf[3].id = BCMA_CORE_ARM_CM3; | ||
418 | ci->c_inf[3].base = 0x18003000; | ||
419 | ci->c_inf[3].wrapbase = 0x18103000; | ||
420 | ci->c_inf[3].cib = 0x07004211; | ||
421 | ci->ramsize = 0x80000; | ||
422 | break; | ||
406 | default: | 423 | default: |
407 | brcmf_dbg(ERROR, "chipid 0x%x is not supported\n", ci->chip); | 424 | brcmf_dbg(ERROR, "chipid 0x%x is not supported\n", ci->chip); |
408 | return -ENODEV; | 425 | return -ENODEV; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c index eb77ac3cfb6b..2d365d3486df 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c | |||
@@ -15,7 +15,9 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <net/cfg80211.h> | ||
18 | #include <net/mac80211.h> | 19 | #include <net/mac80211.h> |
20 | #include <net/regulatory.h> | ||
19 | 21 | ||
20 | #include <defs.h> | 22 | #include <defs.h> |
21 | #include "pub.h" | 23 | #include "pub.h" |
@@ -23,73 +25,17 @@ | |||
23 | #include "main.h" | 25 | #include "main.h" |
24 | #include "stf.h" | 26 | #include "stf.h" |
25 | #include "channel.h" | 27 | #include "channel.h" |
28 | #include "mac80211_if.h" | ||
26 | 29 | ||
27 | /* QDB() macro takes a dB value and converts to a quarter dB value */ | 30 | /* QDB() macro takes a dB value and converts to a quarter dB value */ |
28 | #define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR) | 31 | #define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR) |
29 | 32 | ||
30 | #define LOCALE_CHAN_01_11 (1<<0) | ||
31 | #define LOCALE_CHAN_12_13 (1<<1) | ||
32 | #define LOCALE_CHAN_14 (1<<2) | ||
33 | #define LOCALE_SET_5G_LOW_JP1 (1<<3) /* 34-48, step 2 */ | ||
34 | #define LOCALE_SET_5G_LOW_JP2 (1<<4) /* 34-46, step 4 */ | ||
35 | #define LOCALE_SET_5G_LOW1 (1<<5) /* 36-48, step 4 */ | ||
36 | #define LOCALE_SET_5G_LOW2 (1<<6) /* 52 */ | ||
37 | #define LOCALE_SET_5G_LOW3 (1<<7) /* 56-64, step 4 */ | ||
38 | #define LOCALE_SET_5G_MID1 (1<<8) /* 100-116, step 4 */ | ||
39 | #define LOCALE_SET_5G_MID2 (1<<9) /* 120-124, step 4 */ | ||
40 | #define LOCALE_SET_5G_MID3 (1<<10) /* 128 */ | ||
41 | #define LOCALE_SET_5G_HIGH1 (1<<11) /* 132-140, step 4 */ | ||
42 | #define LOCALE_SET_5G_HIGH2 (1<<12) /* 149-161, step 4 */ | ||
43 | #define LOCALE_SET_5G_HIGH3 (1<<13) /* 165 */ | ||
44 | #define LOCALE_CHAN_52_140_ALL (1<<14) | ||
45 | #define LOCALE_SET_5G_HIGH4 (1<<15) /* 184-216 */ | ||
46 | |||
47 | #define LOCALE_CHAN_36_64 (LOCALE_SET_5G_LOW1 | \ | ||
48 | LOCALE_SET_5G_LOW2 | \ | ||
49 | LOCALE_SET_5G_LOW3) | ||
50 | #define LOCALE_CHAN_52_64 (LOCALE_SET_5G_LOW2 | LOCALE_SET_5G_LOW3) | ||
51 | #define LOCALE_CHAN_100_124 (LOCALE_SET_5G_MID1 | LOCALE_SET_5G_MID2) | ||
52 | #define LOCALE_CHAN_100_140 (LOCALE_SET_5G_MID1 | LOCALE_SET_5G_MID2 | \ | ||
53 | LOCALE_SET_5G_MID3 | LOCALE_SET_5G_HIGH1) | ||
54 | #define LOCALE_CHAN_149_165 (LOCALE_SET_5G_HIGH2 | LOCALE_SET_5G_HIGH3) | ||
55 | #define LOCALE_CHAN_184_216 LOCALE_SET_5G_HIGH4 | ||
56 | |||
57 | #define LOCALE_CHAN_01_14 (LOCALE_CHAN_01_11 | \ | ||
58 | LOCALE_CHAN_12_13 | \ | ||
59 | LOCALE_CHAN_14) | ||
60 | |||
61 | #define LOCALE_RADAR_SET_NONE 0 | ||
62 | #define LOCALE_RADAR_SET_1 1 | ||
63 | |||
64 | #define LOCALE_RESTRICTED_NONE 0 | ||
65 | #define LOCALE_RESTRICTED_SET_2G_SHORT 1 | ||
66 | #define LOCALE_RESTRICTED_CHAN_165 2 | ||
67 | #define LOCALE_CHAN_ALL_5G 3 | ||
68 | #define LOCALE_RESTRICTED_JAPAN_LEGACY 4 | ||
69 | #define LOCALE_RESTRICTED_11D_2G 5 | ||
70 | #define LOCALE_RESTRICTED_11D_5G 6 | ||
71 | #define LOCALE_RESTRICTED_LOW_HI 7 | ||
72 | #define LOCALE_RESTRICTED_12_13_14 8 | ||
73 | |||
74 | #define LOCALE_2G_IDX_i 0 | ||
75 | #define LOCALE_5G_IDX_11 0 | ||
76 | #define LOCALE_MIMO_IDX_bn 0 | 33 | #define LOCALE_MIMO_IDX_bn 0 |
77 | #define LOCALE_MIMO_IDX_11n 0 | 34 | #define LOCALE_MIMO_IDX_11n 0 |
78 | 35 | ||
79 | /* max of BAND_5G_PWR_LVLS and 6 for 2.4 GHz */ | ||
80 | #define BRCMS_MAXPWR_TBL_SIZE 6 | ||
81 | /* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */ | 36 | /* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */ |
82 | #define BRCMS_MAXPWR_MIMO_TBL_SIZE 14 | 37 | #define BRCMS_MAXPWR_MIMO_TBL_SIZE 14 |
83 | 38 | ||
84 | /* power level in group of 2.4GHz band channels: | ||
85 | * maxpwr[0] - CCK channels [1] | ||
86 | * maxpwr[1] - CCK channels [2-10] | ||
87 | * maxpwr[2] - CCK channels [11-14] | ||
88 | * maxpwr[3] - OFDM channels [1] | ||
89 | * maxpwr[4] - OFDM channels [2-10] | ||
90 | * maxpwr[5] - OFDM channels [11-14] | ||
91 | */ | ||
92 | |||
93 | /* maxpwr mapping to 5GHz band channels: | 39 | /* maxpwr mapping to 5GHz band channels: |
94 | * maxpwr[0] - channels [34-48] | 40 | * maxpwr[0] - channels [34-48] |
95 | * maxpwr[1] - channels [52-60] | 41 | * maxpwr[1] - channels [52-60] |
@@ -101,16 +47,8 @@ | |||
101 | 47 | ||
102 | #define LC(id) LOCALE_MIMO_IDX_ ## id | 48 | #define LC(id) LOCALE_MIMO_IDX_ ## id |
103 | 49 | ||
104 | #define LC_2G(id) LOCALE_2G_IDX_ ## id | 50 | #define LOCALES(mimo2, mimo5) \ |
105 | 51 | {LC(mimo2), LC(mimo5)} | |
106 | #define LC_5G(id) LOCALE_5G_IDX_ ## id | ||
107 | |||
108 | #define LOCALES(band2, band5, mimo2, mimo5) \ | ||
109 | {LC_2G(band2), LC_5G(band5), LC(mimo2), LC(mimo5)} | ||
110 | |||
111 | /* macro to get 2.4 GHz channel group index for tx power */ | ||
112 | #define CHANNEL_POWER_IDX_2G_CCK(c) (((c) < 2) ? 0 : (((c) < 11) ? 1 : 2)) | ||
113 | #define CHANNEL_POWER_IDX_2G_OFDM(c) (((c) < 2) ? 3 : (((c) < 11) ? 4 : 5)) | ||
114 | 52 | ||
115 | /* macro to get 5 GHz channel group index for tx power */ | 53 | /* macro to get 5 GHz channel group index for tx power */ |
116 | #define CHANNEL_POWER_IDX_5G(c) (((c) < 52) ? 0 : \ | 54 | #define CHANNEL_POWER_IDX_5G(c) (((c) < 52) ? 0 : \ |
@@ -118,18 +56,37 @@ | |||
118 | (((c) < 100) ? 2 : \ | 56 | (((c) < 100) ? 2 : \ |
119 | (((c) < 149) ? 3 : 4)))) | 57 | (((c) < 149) ? 3 : 4)))) |
120 | 58 | ||
121 | #define ISDFS_EU(fl) (((fl) & BRCMS_DFS_EU) == BRCMS_DFS_EU) | 59 | #define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0) |
122 | 60 | #define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \ | |
123 | struct brcms_cm_band { | 61 | NL80211_RRF_PASSIVE_SCAN | \ |
124 | /* struct locale_info flags */ | 62 | NL80211_RRF_NO_IBSS) |
125 | u8 locale_flags; | 63 | |
126 | /* List of valid channels in the country */ | 64 | #define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \ |
127 | struct brcms_chanvec valid_channels; | 65 | NL80211_RRF_PASSIVE_SCAN | \ |
128 | /* List of restricted use channels */ | 66 | NL80211_RRF_NO_IBSS) |
129 | const struct brcms_chanvec *restricted_channels; | 67 | #define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \ |
130 | /* List of radar sensitive channels */ | 68 | NL80211_RRF_PASSIVE_SCAN | \ |
131 | const struct brcms_chanvec *radar_channels; | 69 | NL80211_RRF_DFS | \ |
132 | u8 PAD[8]; | 70 | NL80211_RRF_NO_IBSS) |
71 | #define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \ | ||
72 | NL80211_RRF_PASSIVE_SCAN | \ | ||
73 | NL80211_RRF_DFS | \ | ||
74 | NL80211_RRF_NO_IBSS) | ||
75 | #define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \ | ||
76 | NL80211_RRF_PASSIVE_SCAN | \ | ||
77 | NL80211_RRF_NO_IBSS) | ||
78 | |||
79 | static const struct ieee80211_regdomain brcms_regdom_x2 = { | ||
80 | .n_reg_rules = 7, | ||
81 | .alpha2 = "X2", | ||
82 | .reg_rules = { | ||
83 | BRCM_2GHZ_2412_2462, | ||
84 | BRCM_2GHZ_2467_2472, | ||
85 | BRCM_5GHZ_5180_5240, | ||
86 | BRCM_5GHZ_5260_5320, | ||
87 | BRCM_5GHZ_5500_5700, | ||
88 | BRCM_5GHZ_5745_5825, | ||
89 | } | ||
133 | }; | 90 | }; |
134 | 91 | ||
135 | /* locale per-channel tx power limits for MIMO frames | 92 | /* locale per-channel tx power limits for MIMO frames |
@@ -141,337 +98,23 @@ struct locale_mimo_info { | |||
141 | s8 maxpwr20[BRCMS_MAXPWR_MIMO_TBL_SIZE]; | 98 | s8 maxpwr20[BRCMS_MAXPWR_MIMO_TBL_SIZE]; |
142 | /* tx 40 MHz power limits, qdBm units */ | 99 | /* tx 40 MHz power limits, qdBm units */ |
143 | s8 maxpwr40[BRCMS_MAXPWR_MIMO_TBL_SIZE]; | 100 | s8 maxpwr40[BRCMS_MAXPWR_MIMO_TBL_SIZE]; |
144 | u8 flags; | ||
145 | }; | 101 | }; |
146 | 102 | ||
147 | /* Country names and abbreviations with locale defined from ISO 3166 */ | 103 | /* Country names and abbreviations with locale defined from ISO 3166 */ |
148 | struct country_info { | 104 | struct country_info { |
149 | const u8 locale_2G; /* 2.4G band locale */ | ||
150 | const u8 locale_5G; /* 5G band locale */ | ||
151 | const u8 locale_mimo_2G; /* 2.4G mimo info */ | 105 | const u8 locale_mimo_2G; /* 2.4G mimo info */ |
152 | const u8 locale_mimo_5G; /* 5G mimo info */ | 106 | const u8 locale_mimo_5G; /* 5G mimo info */ |
153 | }; | 107 | }; |
154 | 108 | ||
109 | struct brcms_regd { | ||
110 | struct country_info country; | ||
111 | const struct ieee80211_regdomain *regdomain; | ||
112 | }; | ||
113 | |||
155 | struct brcms_cm_info { | 114 | struct brcms_cm_info { |
156 | struct brcms_pub *pub; | 115 | struct brcms_pub *pub; |
157 | struct brcms_c_info *wlc; | 116 | struct brcms_c_info *wlc; |
158 | char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */ | 117 | const struct brcms_regd *world_regd; |
159 | uint srom_regrev; /* Regulatory Rev for the SROM ccode */ | ||
160 | const struct country_info *country; /* current country def */ | ||
161 | char ccode[BRCM_CNTRY_BUF_SZ]; /* current internal Country Code */ | ||
162 | uint regrev; /* current Regulatory Revision */ | ||
163 | char country_abbrev[BRCM_CNTRY_BUF_SZ]; /* current advertised ccode */ | ||
164 | /* per-band state (one per phy/radio) */ | ||
165 | struct brcms_cm_band bandstate[MAXBANDS]; | ||
166 | /* quiet channels currently for radar sensitivity or 11h support */ | ||
167 | /* channels on which we cannot transmit */ | ||
168 | struct brcms_chanvec quiet_channels; | ||
169 | }; | ||
170 | |||
171 | /* locale channel and power info. */ | ||
172 | struct locale_info { | ||
173 | u32 valid_channels; | ||
174 | /* List of radar sensitive channels */ | ||
175 | u8 radar_channels; | ||
176 | /* List of channels used only if APs are detected */ | ||
177 | u8 restricted_channels; | ||
178 | /* Max tx pwr in qdBm for each sub-band */ | ||
179 | s8 maxpwr[BRCMS_MAXPWR_TBL_SIZE]; | ||
180 | /* Country IE advertised max tx pwr in dBm per sub-band */ | ||
181 | s8 pub_maxpwr[BAND_5G_PWR_LVLS]; | ||
182 | u8 flags; | ||
183 | }; | ||
184 | |||
185 | /* Regulatory Matrix Spreadsheet (CLM) MIMO v3.7.9 */ | ||
186 | |||
187 | /* | ||
188 | * Some common channel sets | ||
189 | */ | ||
190 | |||
191 | /* No channels */ | ||
192 | static const struct brcms_chanvec chanvec_none = { | ||
193 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
194 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
196 | 0x00, 0x00, 0x00, 0x00} | ||
197 | }; | ||
198 | |||
199 | /* All 2.4 GHz HW channels */ | ||
200 | static const struct brcms_chanvec chanvec_all_2G = { | ||
201 | {0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
203 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
204 | 0x00, 0x00, 0x00, 0x00} | ||
205 | }; | ||
206 | |||
207 | /* All 5 GHz HW channels */ | ||
208 | static const struct brcms_chanvec chanvec_all_5G = { | ||
209 | {0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x11, 0x11, | ||
210 | 0x01, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11, | ||
211 | 0x11, 0x11, 0x20, 0x22, 0x22, 0x00, 0x00, 0x11, | ||
212 | 0x11, 0x11, 0x11, 0x01} | ||
213 | }; | ||
214 | |||
215 | /* | ||
216 | * Radar channel sets | ||
217 | */ | ||
218 | |||
219 | /* Channels 52 - 64, 100 - 140 */ | ||
220 | static const struct brcms_chanvec radar_set1 = { | ||
221 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, /* 52 - 60 */ | ||
222 | 0x01, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11, /* 64, 100 - 124 */ | ||
223 | 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 128 - 140 */ | ||
224 | 0x00, 0x00, 0x00, 0x00} | ||
225 | }; | ||
226 | |||
227 | /* | ||
228 | * Restricted channel sets | ||
229 | */ | ||
230 | |||
231 | /* Channels 34, 38, 42, 46 */ | ||
232 | static const struct brcms_chanvec restricted_set_japan_legacy = { | ||
233 | {0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, | ||
234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
235 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
236 | 0x00, 0x00, 0x00, 0x00} | ||
237 | }; | ||
238 | |||
239 | /* Channels 12, 13 */ | ||
240 | static const struct brcms_chanvec restricted_set_2g_short = { | ||
241 | {0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
244 | 0x00, 0x00, 0x00, 0x00} | ||
245 | }; | ||
246 | |||
247 | /* Channel 165 */ | ||
248 | static const struct brcms_chanvec restricted_chan_165 = { | ||
249 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
251 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, | ||
252 | 0x00, 0x00, 0x00, 0x00} | ||
253 | }; | ||
254 | |||
255 | /* Channels 36 - 48 & 149 - 165 */ | ||
256 | static const struct brcms_chanvec restricted_low_hi = { | ||
257 | {0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x01, 0x00, | ||
258 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
259 | 0x00, 0x00, 0x20, 0x22, 0x22, 0x00, 0x00, 0x00, | ||
260 | 0x00, 0x00, 0x00, 0x00} | ||
261 | }; | ||
262 | |||
263 | /* Channels 12 - 14 */ | ||
264 | static const struct brcms_chanvec restricted_set_12_13_14 = { | ||
265 | {0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
266 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
267 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
268 | 0x00, 0x00, 0x00, 0x00} | ||
269 | }; | ||
270 | |||
271 | /* global memory to provide working buffer for expanded locale */ | ||
272 | |||
273 | static const struct brcms_chanvec *g_table_radar_set[] = { | ||
274 | &chanvec_none, | ||
275 | &radar_set1 | ||
276 | }; | ||
277 | |||
278 | static const struct brcms_chanvec *g_table_restricted_chan[] = { | ||
279 | &chanvec_none, /* restricted_set_none */ | ||
280 | &restricted_set_2g_short, | ||
281 | &restricted_chan_165, | ||
282 | &chanvec_all_5G, | ||
283 | &restricted_set_japan_legacy, | ||
284 | &chanvec_all_2G, /* restricted_set_11d_2G */ | ||
285 | &chanvec_all_5G, /* restricted_set_11d_5G */ | ||
286 | &restricted_low_hi, | ||
287 | &restricted_set_12_13_14 | ||
288 | }; | ||
289 | |||
290 | static const struct brcms_chanvec locale_2g_01_11 = { | ||
291 | {0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
293 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
294 | 0x00, 0x00, 0x00, 0x00} | ||
295 | }; | ||
296 | |||
297 | static const struct brcms_chanvec locale_2g_12_13 = { | ||
298 | {0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
301 | 0x00, 0x00, 0x00, 0x00} | ||
302 | }; | ||
303 | |||
304 | static const struct brcms_chanvec locale_2g_14 = { | ||
305 | {0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
308 | 0x00, 0x00, 0x00, 0x00} | ||
309 | }; | ||
310 | |||
311 | static const struct brcms_chanvec locale_5g_LOW_JP1 = { | ||
312 | {0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, | ||
313 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
314 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
315 | 0x00, 0x00, 0x00, 0x00} | ||
316 | }; | ||
317 | |||
318 | static const struct brcms_chanvec locale_5g_LOW_JP2 = { | ||
319 | {0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, | ||
320 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
322 | 0x00, 0x00, 0x00, 0x00} | ||
323 | }; | ||
324 | |||
325 | static const struct brcms_chanvec locale_5g_LOW1 = { | ||
326 | {0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x01, 0x00, | ||
327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
329 | 0x00, 0x00, 0x00, 0x00} | ||
330 | }; | ||
331 | |||
332 | static const struct brcms_chanvec locale_5g_LOW2 = { | ||
333 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, | ||
334 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
336 | 0x00, 0x00, 0x00, 0x00} | ||
337 | }; | ||
338 | |||
339 | static const struct brcms_chanvec locale_5g_LOW3 = { | ||
340 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, | ||
341 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
343 | 0x00, 0x00, 0x00, 0x00} | ||
344 | }; | ||
345 | |||
346 | static const struct brcms_chanvec locale_5g_MID1 = { | ||
347 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
348 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x00, | ||
349 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
350 | 0x00, 0x00, 0x00, 0x00} | ||
351 | }; | ||
352 | |||
353 | static const struct brcms_chanvec locale_5g_MID2 = { | ||
354 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
355 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, | ||
356 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
357 | 0x00, 0x00, 0x00, 0x00} | ||
358 | }; | ||
359 | |||
360 | static const struct brcms_chanvec locale_5g_MID3 = { | ||
361 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
362 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
363 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
364 | 0x00, 0x00, 0x00, 0x00} | ||
365 | }; | ||
366 | |||
367 | static const struct brcms_chanvec locale_5g_HIGH1 = { | ||
368 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
369 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
370 | 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
371 | 0x00, 0x00, 0x00, 0x00} | ||
372 | }; | ||
373 | |||
374 | static const struct brcms_chanvec locale_5g_HIGH2 = { | ||
375 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
376 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
377 | 0x00, 0x00, 0x20, 0x22, 0x02, 0x00, 0x00, 0x00, | ||
378 | 0x00, 0x00, 0x00, 0x00} | ||
379 | }; | ||
380 | |||
381 | static const struct brcms_chanvec locale_5g_HIGH3 = { | ||
382 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
383 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
384 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, | ||
385 | 0x00, 0x00, 0x00, 0x00} | ||
386 | }; | ||
387 | |||
388 | static const struct brcms_chanvec locale_5g_52_140_ALL = { | ||
389 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, | ||
390 | 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, | ||
391 | 0x11, 0x11, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, | ||
392 | 0x00, 0x00, 0x00, 0x00} | ||
393 | }; | ||
394 | |||
395 | static const struct brcms_chanvec locale_5g_HIGH4 = { | ||
396 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
397 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
398 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, | ||
399 | 0x11, 0x11, 0x11, 0x11} | ||
400 | }; | ||
401 | |||
402 | static const struct brcms_chanvec *g_table_locale_base[] = { | ||
403 | &locale_2g_01_11, | ||
404 | &locale_2g_12_13, | ||
405 | &locale_2g_14, | ||
406 | &locale_5g_LOW_JP1, | ||
407 | &locale_5g_LOW_JP2, | ||
408 | &locale_5g_LOW1, | ||
409 | &locale_5g_LOW2, | ||
410 | &locale_5g_LOW3, | ||
411 | &locale_5g_MID1, | ||
412 | &locale_5g_MID2, | ||
413 | &locale_5g_MID3, | ||
414 | &locale_5g_HIGH1, | ||
415 | &locale_5g_HIGH2, | ||
416 | &locale_5g_HIGH3, | ||
417 | &locale_5g_52_140_ALL, | ||
418 | &locale_5g_HIGH4 | ||
419 | }; | ||
420 | |||
421 | static void brcms_c_locale_add_channels(struct brcms_chanvec *target, | ||
422 | const struct brcms_chanvec *channels) | ||
423 | { | ||
424 | u8 i; | ||
425 | for (i = 0; i < sizeof(struct brcms_chanvec); i++) | ||
426 | target->vec[i] |= channels->vec[i]; | ||
427 | } | ||
428 | |||
429 | static void brcms_c_locale_get_channels(const struct locale_info *locale, | ||
430 | struct brcms_chanvec *channels) | ||
431 | { | ||
432 | u8 i; | ||
433 | |||
434 | memset(channels, 0, sizeof(struct brcms_chanvec)); | ||
435 | |||
436 | for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) { | ||
437 | if (locale->valid_channels & (1 << i)) | ||
438 | brcms_c_locale_add_channels(channels, | ||
439 | g_table_locale_base[i]); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | /* | ||
444 | * Locale Definitions - 2.4 GHz | ||
445 | */ | ||
446 | static const struct locale_info locale_i = { /* locale i. channel 1 - 13 */ | ||
447 | LOCALE_CHAN_01_11 | LOCALE_CHAN_12_13, | ||
448 | LOCALE_RADAR_SET_NONE, | ||
449 | LOCALE_RESTRICTED_SET_2G_SHORT, | ||
450 | {QDB(19), QDB(19), QDB(19), | ||
451 | QDB(19), QDB(19), QDB(19)}, | ||
452 | {20, 20, 20, 0}, | ||
453 | BRCMS_EIRP | ||
454 | }; | ||
455 | |||
456 | /* | ||
457 | * Locale Definitions - 5 GHz | ||
458 | */ | ||
459 | static const struct locale_info locale_11 = { | ||
460 | /* locale 11. channel 36 - 48, 52 - 64, 100 - 140, 149 - 165 */ | ||
461 | LOCALE_CHAN_36_64 | LOCALE_CHAN_100_140 | LOCALE_CHAN_149_165, | ||
462 | LOCALE_RADAR_SET_1, | ||
463 | LOCALE_RESTRICTED_NONE, | ||
464 | {QDB(21), QDB(21), QDB(21), QDB(21), QDB(21)}, | ||
465 | {23, 23, 23, 30, 30}, | ||
466 | BRCMS_EIRP | BRCMS_DFS_EU | ||
467 | }; | ||
468 | |||
469 | static const struct locale_info *g_locale_2g_table[] = { | ||
470 | &locale_i | ||
471 | }; | ||
472 | |||
473 | static const struct locale_info *g_locale_5g_table[] = { | ||
474 | &locale_11 | ||
475 | }; | 118 | }; |
476 | 119 | ||
477 | /* | 120 | /* |
@@ -484,7 +127,6 @@ static const struct locale_mimo_info locale_bn = { | |||
484 | {0, 0, QDB(13), QDB(13), QDB(13), | 127 | {0, 0, QDB(13), QDB(13), QDB(13), |
485 | QDB(13), QDB(13), QDB(13), QDB(13), QDB(13), | 128 | QDB(13), QDB(13), QDB(13), QDB(13), QDB(13), |
486 | QDB(13), 0, 0}, | 129 | QDB(13), 0, 0}, |
487 | 0 | ||
488 | }; | 130 | }; |
489 | 131 | ||
490 | static const struct locale_mimo_info *g_mimo_2g_table[] = { | 132 | static const struct locale_mimo_info *g_mimo_2g_table[] = { |
@@ -497,114 +139,20 @@ static const struct locale_mimo_info *g_mimo_2g_table[] = { | |||
497 | static const struct locale_mimo_info locale_11n = { | 139 | static const struct locale_mimo_info locale_11n = { |
498 | { /* 12.5 dBm */ 50, 50, 50, QDB(15), QDB(15)}, | 140 | { /* 12.5 dBm */ 50, 50, 50, QDB(15), QDB(15)}, |
499 | {QDB(14), QDB(15), QDB(15), QDB(15), QDB(15)}, | 141 | {QDB(14), QDB(15), QDB(15), QDB(15), QDB(15)}, |
500 | 0 | ||
501 | }; | 142 | }; |
502 | 143 | ||
503 | static const struct locale_mimo_info *g_mimo_5g_table[] = { | 144 | static const struct locale_mimo_info *g_mimo_5g_table[] = { |
504 | &locale_11n | 145 | &locale_11n |
505 | }; | 146 | }; |
506 | 147 | ||
507 | static const struct { | 148 | static const struct brcms_regd cntry_locales[] = { |
508 | char abbrev[BRCM_CNTRY_BUF_SZ]; /* country abbreviation */ | 149 | /* Worldwide RoW 2, must always be at index 0 */ |
509 | struct country_info country; | ||
510 | } cntry_locales[] = { | ||
511 | { | 150 | { |
512 | "X2", LOCALES(i, 11, bn, 11n)}, /* Worldwide RoW 2 */ | 151 | .country = LOCALES(bn, 11n), |
513 | }; | 152 | .regdomain = &brcms_regdom_x2, |
514 | 153 | }, | |
515 | #ifdef SUPPORT_40MHZ | ||
516 | /* 20MHz channel info for 40MHz pairing support */ | ||
517 | struct chan20_info { | ||
518 | u8 sb; | ||
519 | u8 adj_sbs; | ||
520 | }; | 154 | }; |
521 | 155 | ||
522 | /* indicates adjacent channels that are allowed for a 40 Mhz channel and | ||
523 | * those that permitted by the HT | ||
524 | */ | ||
525 | struct chan20_info chan20_info[] = { | ||
526 | /* 11b/11g */ | ||
527 | /* 0 */ {1, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
528 | /* 1 */ {2, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
529 | /* 2 */ {3, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
530 | /* 3 */ {4, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
531 | /* 4 */ {5, (CH_UPPER_SB | CH_LOWER_SB | CH_EWA_VALID)}, | ||
532 | /* 5 */ {6, (CH_UPPER_SB | CH_LOWER_SB | CH_EWA_VALID)}, | ||
533 | /* 6 */ {7, (CH_UPPER_SB | CH_LOWER_SB | CH_EWA_VALID)}, | ||
534 | /* 7 */ {8, (CH_UPPER_SB | CH_LOWER_SB | CH_EWA_VALID)}, | ||
535 | /* 8 */ {9, (CH_UPPER_SB | CH_LOWER_SB | CH_EWA_VALID)}, | ||
536 | /* 9 */ {10, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
537 | /* 10 */ {11, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
538 | /* 11 */ {12, (CH_LOWER_SB)}, | ||
539 | /* 12 */ {13, (CH_LOWER_SB)}, | ||
540 | /* 13 */ {14, (CH_LOWER_SB)}, | ||
541 | |||
542 | /* 11a japan high */ | ||
543 | /* 14 */ {34, (CH_UPPER_SB)}, | ||
544 | /* 15 */ {38, (CH_LOWER_SB)}, | ||
545 | /* 16 */ {42, (CH_LOWER_SB)}, | ||
546 | /* 17 */ {46, (CH_LOWER_SB)}, | ||
547 | |||
548 | /* 11a usa low */ | ||
549 | /* 18 */ {36, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
550 | /* 19 */ {40, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
551 | /* 20 */ {44, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
552 | /* 21 */ {48, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
553 | /* 22 */ {52, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
554 | /* 23 */ {56, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
555 | /* 24 */ {60, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
556 | /* 25 */ {64, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
557 | |||
558 | /* 11a Europe */ | ||
559 | /* 26 */ {100, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
560 | /* 27 */ {104, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
561 | /* 28 */ {108, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
562 | /* 29 */ {112, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
563 | /* 30 */ {116, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
564 | /* 31 */ {120, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
565 | /* 32 */ {124, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
566 | /* 33 */ {128, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
567 | /* 34 */ {132, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
568 | /* 35 */ {136, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
569 | /* 36 */ {140, (CH_LOWER_SB)}, | ||
570 | |||
571 | /* 11a usa high, ref5 only */ | ||
572 | /* The 0x80 bit in pdiv means these are REF5, other entries are REF20 */ | ||
573 | /* 37 */ {149, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
574 | /* 38 */ {153, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
575 | /* 39 */ {157, (CH_UPPER_SB | CH_EWA_VALID)}, | ||
576 | /* 40 */ {161, (CH_LOWER_SB | CH_EWA_VALID)}, | ||
577 | /* 41 */ {165, (CH_LOWER_SB)}, | ||
578 | |||
579 | /* 11a japan */ | ||
580 | /* 42 */ {184, (CH_UPPER_SB)}, | ||
581 | /* 43 */ {188, (CH_LOWER_SB)}, | ||
582 | /* 44 */ {192, (CH_UPPER_SB)}, | ||
583 | /* 45 */ {196, (CH_LOWER_SB)}, | ||
584 | /* 46 */ {200, (CH_UPPER_SB)}, | ||
585 | /* 47 */ {204, (CH_LOWER_SB)}, | ||
586 | /* 48 */ {208, (CH_UPPER_SB)}, | ||
587 | /* 49 */ {212, (CH_LOWER_SB)}, | ||
588 | /* 50 */ {216, (CH_LOWER_SB)} | ||
589 | }; | ||
590 | #endif /* SUPPORT_40MHZ */ | ||
591 | |||
592 | static const struct locale_info *brcms_c_get_locale_2g(u8 locale_idx) | ||
593 | { | ||
594 | if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) | ||
595 | return NULL; /* error condition */ | ||
596 | |||
597 | return g_locale_2g_table[locale_idx]; | ||
598 | } | ||
599 | |||
600 | static const struct locale_info *brcms_c_get_locale_5g(u8 locale_idx) | ||
601 | { | ||
602 | if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) | ||
603 | return NULL; /* error condition */ | ||
604 | |||
605 | return g_locale_5g_table[locale_idx]; | ||
606 | } | ||
607 | |||
608 | static const struct locale_mimo_info *brcms_c_get_mimo_2g(u8 locale_idx) | 156 | static const struct locale_mimo_info *brcms_c_get_mimo_2g(u8 locale_idx) |
609 | { | 157 | { |
610 | if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) | 158 | if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) |
@@ -621,13 +169,6 @@ static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx) | |||
621 | return g_mimo_5g_table[locale_idx]; | 169 | return g_mimo_5g_table[locale_idx]; |
622 | } | 170 | } |
623 | 171 | ||
624 | static int | ||
625 | brcms_c_country_aggregate_map(struct brcms_cm_info *wlc_cm, const char *ccode, | ||
626 | char *mapped_ccode, uint *mapped_regrev) | ||
627 | { | ||
628 | return false; | ||
629 | } | ||
630 | |||
631 | /* | 172 | /* |
632 | * Indicates whether the country provided is valid to pass | 173 | * Indicates whether the country provided is valid to pass |
633 | * to cfg80211 or not. | 174 | * to cfg80211 or not. |
@@ -662,155 +203,24 @@ static bool brcms_c_country_valid(const char *ccode) | |||
662 | return true; | 203 | return true; |
663 | } | 204 | } |
664 | 205 | ||
665 | /* Lookup a country info structure from a null terminated country | 206 | static const struct brcms_regd *brcms_world_regd(const char *regdom, int len) |
666 | * abbreviation and regrev directly with no translation. | ||
667 | */ | ||
668 | static const struct country_info * | ||
669 | brcms_c_country_lookup_direct(const char *ccode, uint regrev) | ||
670 | { | 207 | { |
671 | uint size, i; | 208 | const struct brcms_regd *regd = NULL; |
672 | 209 | int i; | |
673 | /* Should just return 0 for single locale driver. */ | ||
674 | /* Keep it this way in case we add more locales. (for now anyway) */ | ||
675 | |||
676 | /* | ||
677 | * all other country def arrays are for regrev == 0, so if | ||
678 | * regrev is non-zero, fail | ||
679 | */ | ||
680 | if (regrev > 0) | ||
681 | return NULL; | ||
682 | |||
683 | /* find matched table entry from country code */ | ||
684 | size = ARRAY_SIZE(cntry_locales); | ||
685 | for (i = 0; i < size; i++) { | ||
686 | if (strcmp(ccode, cntry_locales[i].abbrev) == 0) | ||
687 | return &cntry_locales[i].country; | ||
688 | } | ||
689 | return NULL; | ||
690 | } | ||
691 | |||
692 | static const struct country_info * | ||
693 | brcms_c_countrycode_map(struct brcms_cm_info *wlc_cm, const char *ccode, | ||
694 | char *mapped_ccode, uint *mapped_regrev) | ||
695 | { | ||
696 | struct brcms_c_info *wlc = wlc_cm->wlc; | ||
697 | const struct country_info *country; | ||
698 | uint srom_regrev = wlc_cm->srom_regrev; | ||
699 | const char *srom_ccode = wlc_cm->srom_ccode; | ||
700 | int mapped; | ||
701 | |||
702 | /* check for currently supported ccode size */ | ||
703 | if (strlen(ccode) > (BRCM_CNTRY_BUF_SZ - 1)) { | ||
704 | wiphy_err(wlc->wiphy, "wl%d: %s: ccode \"%s\" too long for " | ||
705 | "match\n", wlc->pub->unit, __func__, ccode); | ||
706 | return NULL; | ||
707 | } | ||
708 | |||
709 | /* default mapping is the given ccode and regrev 0 */ | ||
710 | strncpy(mapped_ccode, ccode, BRCM_CNTRY_BUF_SZ); | ||
711 | *mapped_regrev = 0; | ||
712 | |||
713 | /* If the desired country code matches the srom country code, | ||
714 | * then the mapped country is the srom regulatory rev. | ||
715 | * Otherwise look for an aggregate mapping. | ||
716 | */ | ||
717 | if (!strcmp(srom_ccode, ccode)) { | ||
718 | *mapped_regrev = srom_regrev; | ||
719 | mapped = 0; | ||
720 | wiphy_err(wlc->wiphy, "srom_code == ccode %s\n", __func__); | ||
721 | } else { | ||
722 | mapped = | ||
723 | brcms_c_country_aggregate_map(wlc_cm, ccode, mapped_ccode, | ||
724 | mapped_regrev); | ||
725 | } | ||
726 | |||
727 | /* find the matching built-in country definition */ | ||
728 | country = brcms_c_country_lookup_direct(mapped_ccode, *mapped_regrev); | ||
729 | |||
730 | /* if there is not an exact rev match, default to rev zero */ | ||
731 | if (country == NULL && *mapped_regrev != 0) { | ||
732 | *mapped_regrev = 0; | ||
733 | country = | ||
734 | brcms_c_country_lookup_direct(mapped_ccode, *mapped_regrev); | ||
735 | } | ||
736 | |||
737 | return country; | ||
738 | } | ||
739 | |||
740 | /* Lookup a country info structure from a null terminated country code | ||
741 | * The lookup is case sensitive. | ||
742 | */ | ||
743 | static const struct country_info * | ||
744 | brcms_c_country_lookup(struct brcms_c_info *wlc, const char *ccode) | ||
745 | { | ||
746 | const struct country_info *country; | ||
747 | char mapped_ccode[BRCM_CNTRY_BUF_SZ]; | ||
748 | uint mapped_regrev; | ||
749 | |||
750 | /* | ||
751 | * map the country code to a built-in country code, regrev, and | ||
752 | * country_info struct | ||
753 | */ | ||
754 | country = brcms_c_countrycode_map(wlc->cmi, ccode, mapped_ccode, | ||
755 | &mapped_regrev); | ||
756 | |||
757 | return country; | ||
758 | } | ||
759 | |||
760 | /* | ||
761 | * reset the quiet channels vector to the union | ||
762 | * of the restricted and radar channel sets | ||
763 | */ | ||
764 | static void brcms_c_quiet_channels_reset(struct brcms_cm_info *wlc_cm) | ||
765 | { | ||
766 | struct brcms_c_info *wlc = wlc_cm->wlc; | ||
767 | uint i, j; | ||
768 | struct brcms_band *band; | ||
769 | const struct brcms_chanvec *chanvec; | ||
770 | |||
771 | memset(&wlc_cm->quiet_channels, 0, sizeof(struct brcms_chanvec)); | ||
772 | |||
773 | band = wlc->band; | ||
774 | for (i = 0; i < wlc->pub->_nbands; | ||
775 | i++, band = wlc->bandstate[OTHERBANDUNIT(wlc)]) { | ||
776 | |||
777 | /* initialize quiet channels for restricted channels */ | ||
778 | chanvec = wlc_cm->bandstate[band->bandunit].restricted_channels; | ||
779 | for (j = 0; j < sizeof(struct brcms_chanvec); j++) | ||
780 | wlc_cm->quiet_channels.vec[j] |= chanvec->vec[j]; | ||
781 | 210 | ||
211 | for (i = 0; i < ARRAY_SIZE(cntry_locales); i++) { | ||
212 | if (!strncmp(regdom, cntry_locales[i].regdomain->alpha2, len)) { | ||
213 | regd = &cntry_locales[i]; | ||
214 | break; | ||
215 | } | ||
782 | } | 216 | } |
783 | } | ||
784 | |||
785 | /* Is the channel valid for the current locale and current band? */ | ||
786 | static bool brcms_c_valid_channel20(struct brcms_cm_info *wlc_cm, uint val) | ||
787 | { | ||
788 | struct brcms_c_info *wlc = wlc_cm->wlc; | ||
789 | 217 | ||
790 | return ((val < MAXCHANNEL) && | 218 | return regd; |
791 | isset(wlc_cm->bandstate[wlc->band->bandunit].valid_channels.vec, | ||
792 | val)); | ||
793 | } | 219 | } |
794 | 220 | ||
795 | /* Is the channel valid for the current locale and specified band? */ | 221 | static const struct brcms_regd *brcms_default_world_regd(void) |
796 | static bool brcms_c_valid_channel20_in_band(struct brcms_cm_info *wlc_cm, | ||
797 | uint bandunit, uint val) | ||
798 | { | ||
799 | return ((val < MAXCHANNEL) | ||
800 | && isset(wlc_cm->bandstate[bandunit].valid_channels.vec, val)); | ||
801 | } | ||
802 | |||
803 | /* Is the channel valid for the current locale? (but don't consider channels not | ||
804 | * available due to bandlocking) | ||
805 | */ | ||
806 | static bool brcms_c_valid_channel20_db(struct brcms_cm_info *wlc_cm, uint val) | ||
807 | { | 222 | { |
808 | struct brcms_c_info *wlc = wlc_cm->wlc; | 223 | return &cntry_locales[0]; |
809 | |||
810 | return brcms_c_valid_channel20(wlc->cmi, val) || | ||
811 | (!wlc->bandlocked | ||
812 | && brcms_c_valid_channel20_in_band(wlc->cmi, | ||
813 | OTHERBANDUNIT(wlc), val)); | ||
814 | } | 224 | } |
815 | 225 | ||
816 | /* JP, J1 - J10 are Japan ccodes */ | 226 | /* JP, J1 - J10 are Japan ccodes */ |
@@ -820,12 +230,6 @@ static bool brcms_c_japan_ccode(const char *ccode) | |||
820 | (ccode[1] == 'P' || (ccode[1] >= '1' && ccode[1] <= '9'))); | 230 | (ccode[1] == 'P' || (ccode[1] >= '1' && ccode[1] <= '9'))); |
821 | } | 231 | } |
822 | 232 | ||
823 | /* Returns true if currently set country is Japan or variant */ | ||
824 | static bool brcms_c_japan(struct brcms_c_info *wlc) | ||
825 | { | ||
826 | return brcms_c_japan_ccode(wlc->cmi->country_abbrev); | ||
827 | } | ||
828 | |||
829 | static void | 233 | static void |
830 | brcms_c_channel_min_txpower_limits_with_local_constraint( | 234 | brcms_c_channel_min_txpower_limits_with_local_constraint( |
831 | struct brcms_cm_info *wlc_cm, struct txpwr_limits *txpwr, | 235 | struct brcms_cm_info *wlc_cm, struct txpwr_limits *txpwr, |
@@ -901,140 +305,16 @@ brcms_c_channel_min_txpower_limits_with_local_constraint( | |||
901 | 305 | ||
902 | } | 306 | } |
903 | 307 | ||
904 | /* Update the radio state (enable/disable) and tx power targets | ||
905 | * based on a new set of channel/regulatory information | ||
906 | */ | ||
907 | static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm) | ||
908 | { | ||
909 | struct brcms_c_info *wlc = wlc_cm->wlc; | ||
910 | uint chan; | ||
911 | struct txpwr_limits txpwr; | ||
912 | |||
913 | /* search for the existence of any valid channel */ | ||
914 | for (chan = 0; chan < MAXCHANNEL; chan++) { | ||
915 | if (brcms_c_valid_channel20_db(wlc->cmi, chan)) | ||
916 | break; | ||
917 | } | ||
918 | if (chan == MAXCHANNEL) | ||
919 | chan = INVCHANNEL; | ||
920 | |||
921 | /* | ||
922 | * based on the channel search above, set or | ||
923 | * clear WL_RADIO_COUNTRY_DISABLE. | ||
924 | */ | ||
925 | if (chan == INVCHANNEL) { | ||
926 | /* | ||
927 | * country/locale with no valid channels, set | ||
928 | * the radio disable bit | ||
929 | */ | ||
930 | mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | ||
931 | wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\" " | ||
932 | "nbands %d bandlocked %d\n", wlc->pub->unit, | ||
933 | __func__, wlc_cm->country_abbrev, wlc->pub->_nbands, | ||
934 | wlc->bandlocked); | ||
935 | } else if (mboolisset(wlc->pub->radio_disabled, | ||
936 | WL_RADIO_COUNTRY_DISABLE)) { | ||
937 | /* | ||
938 | * country/locale with valid channel, clear | ||
939 | * the radio disable bit | ||
940 | */ | ||
941 | mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | ||
942 | } | ||
943 | |||
944 | /* | ||
945 | * Now that the country abbreviation is set, if the radio supports 2G, | ||
946 | * then set channel 14 restrictions based on the new locale. | ||
947 | */ | ||
948 | if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) | ||
949 | wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, | ||
950 | brcms_c_japan(wlc) ? true : | ||
951 | false); | ||
952 | |||
953 | if (wlc->pub->up && chan != INVCHANNEL) { | ||
954 | brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); | ||
955 | brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm, | ||
956 | &txpwr, BRCMS_TXPWR_MAX); | ||
957 | wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); | ||
958 | } | ||
959 | } | ||
960 | |||
961 | static int | ||
962 | brcms_c_channels_init(struct brcms_cm_info *wlc_cm, | ||
963 | const struct country_info *country) | ||
964 | { | ||
965 | struct brcms_c_info *wlc = wlc_cm->wlc; | ||
966 | uint i, j; | ||
967 | struct brcms_band *band; | ||
968 | const struct locale_info *li; | ||
969 | struct brcms_chanvec sup_chan; | ||
970 | const struct locale_mimo_info *li_mimo; | ||
971 | |||
972 | band = wlc->band; | ||
973 | for (i = 0; i < wlc->pub->_nbands; | ||
974 | i++, band = wlc->bandstate[OTHERBANDUNIT(wlc)]) { | ||
975 | |||
976 | li = (band->bandtype == BRCM_BAND_5G) ? | ||
977 | brcms_c_get_locale_5g(country->locale_5G) : | ||
978 | brcms_c_get_locale_2g(country->locale_2G); | ||
979 | wlc_cm->bandstate[band->bandunit].locale_flags = li->flags; | ||
980 | li_mimo = (band->bandtype == BRCM_BAND_5G) ? | ||
981 | brcms_c_get_mimo_5g(country->locale_mimo_5G) : | ||
982 | brcms_c_get_mimo_2g(country->locale_mimo_2G); | ||
983 | |||
984 | /* merge the mimo non-mimo locale flags */ | ||
985 | wlc_cm->bandstate[band->bandunit].locale_flags |= | ||
986 | li_mimo->flags; | ||
987 | |||
988 | wlc_cm->bandstate[band->bandunit].restricted_channels = | ||
989 | g_table_restricted_chan[li->restricted_channels]; | ||
990 | wlc_cm->bandstate[band->bandunit].radar_channels = | ||
991 | g_table_radar_set[li->radar_channels]; | ||
992 | |||
993 | /* | ||
994 | * set the channel availability, masking out the channels | ||
995 | * that may not be supported on this phy. | ||
996 | */ | ||
997 | wlc_phy_chanspec_band_validch(band->pi, band->bandtype, | ||
998 | &sup_chan); | ||
999 | brcms_c_locale_get_channels(li, | ||
1000 | &wlc_cm->bandstate[band->bandunit]. | ||
1001 | valid_channels); | ||
1002 | for (j = 0; j < sizeof(struct brcms_chanvec); j++) | ||
1003 | wlc_cm->bandstate[band->bandunit].valid_channels. | ||
1004 | vec[j] &= sup_chan.vec[j]; | ||
1005 | } | ||
1006 | |||
1007 | brcms_c_quiet_channels_reset(wlc_cm); | ||
1008 | brcms_c_channels_commit(wlc_cm); | ||
1009 | |||
1010 | return 0; | ||
1011 | } | ||
1012 | |||
1013 | /* | 308 | /* |
1014 | * set the driver's current country and regulatory information | 309 | * set the driver's current country and regulatory information |
1015 | * using a country code as the source. Look up built in country | 310 | * using a country code as the source. Look up built in country |
1016 | * information found with the country code. | 311 | * information found with the country code. |
1017 | */ | 312 | */ |
1018 | static void | 313 | static void |
1019 | brcms_c_set_country_common(struct brcms_cm_info *wlc_cm, | 314 | brcms_c_set_country(struct brcms_cm_info *wlc_cm, |
1020 | const char *country_abbrev, | 315 | const struct brcms_regd *regd) |
1021 | const char *ccode, uint regrev, | ||
1022 | const struct country_info *country) | ||
1023 | { | 316 | { |
1024 | const struct locale_info *locale; | ||
1025 | struct brcms_c_info *wlc = wlc_cm->wlc; | 317 | struct brcms_c_info *wlc = wlc_cm->wlc; |
1026 | char prev_country_abbrev[BRCM_CNTRY_BUF_SZ]; | ||
1027 | |||
1028 | /* save current country state */ | ||
1029 | wlc_cm->country = country; | ||
1030 | |||
1031 | memset(&prev_country_abbrev, 0, BRCM_CNTRY_BUF_SZ); | ||
1032 | strncpy(prev_country_abbrev, wlc_cm->country_abbrev, | ||
1033 | BRCM_CNTRY_BUF_SZ - 1); | ||
1034 | |||
1035 | strncpy(wlc_cm->country_abbrev, country_abbrev, BRCM_CNTRY_BUF_SZ - 1); | ||
1036 | strncpy(wlc_cm->ccode, ccode, BRCM_CNTRY_BUF_SZ - 1); | ||
1037 | wlc_cm->regrev = regrev; | ||
1038 | 318 | ||
1039 | if ((wlc->pub->_n_enab & SUPPORT_11N) != | 319 | if ((wlc->pub->_n_enab & SUPPORT_11N) != |
1040 | wlc->protection->nmode_user) | 320 | wlc->protection->nmode_user) |
@@ -1042,75 +322,19 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm, | |||
1042 | 322 | ||
1043 | brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); | 323 | brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); |
1044 | brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); | 324 | brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); |
1045 | /* set or restore gmode as required by regulatory */ | ||
1046 | locale = brcms_c_get_locale_2g(country->locale_2G); | ||
1047 | if (locale && (locale->flags & BRCMS_NO_OFDM)) | ||
1048 | brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); | ||
1049 | else | ||
1050 | brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); | ||
1051 | 325 | ||
1052 | brcms_c_channels_init(wlc_cm, country); | 326 | brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); |
1053 | 327 | ||
1054 | return; | 328 | return; |
1055 | } | 329 | } |
1056 | 330 | ||
1057 | static int | ||
1058 | brcms_c_set_countrycode_rev(struct brcms_cm_info *wlc_cm, | ||
1059 | const char *country_abbrev, | ||
1060 | const char *ccode, int regrev) | ||
1061 | { | ||
1062 | const struct country_info *country; | ||
1063 | char mapped_ccode[BRCM_CNTRY_BUF_SZ]; | ||
1064 | uint mapped_regrev; | ||
1065 | |||
1066 | /* if regrev is -1, lookup the mapped country code, | ||
1067 | * otherwise use the ccode and regrev directly | ||
1068 | */ | ||
1069 | if (regrev == -1) { | ||
1070 | /* | ||
1071 | * map the country code to a built-in country | ||
1072 | * code, regrev, and country_info | ||
1073 | */ | ||
1074 | country = | ||
1075 | brcms_c_countrycode_map(wlc_cm, ccode, mapped_ccode, | ||
1076 | &mapped_regrev); | ||
1077 | } else { | ||
1078 | /* find the matching built-in country definition */ | ||
1079 | country = brcms_c_country_lookup_direct(ccode, regrev); | ||
1080 | strncpy(mapped_ccode, ccode, BRCM_CNTRY_BUF_SZ); | ||
1081 | mapped_regrev = regrev; | ||
1082 | } | ||
1083 | |||
1084 | if (country == NULL) | ||
1085 | return -EINVAL; | ||
1086 | |||
1087 | /* set the driver state for the country */ | ||
1088 | brcms_c_set_country_common(wlc_cm, country_abbrev, mapped_ccode, | ||
1089 | mapped_regrev, country); | ||
1090 | |||
1091 | return 0; | ||
1092 | } | ||
1093 | |||
1094 | /* | ||
1095 | * set the driver's current country and regulatory information using | ||
1096 | * a country code as the source. Lookup built in country information | ||
1097 | * found with the country code. | ||
1098 | */ | ||
1099 | static int | ||
1100 | brcms_c_set_countrycode(struct brcms_cm_info *wlc_cm, const char *ccode) | ||
1101 | { | ||
1102 | char country_abbrev[BRCM_CNTRY_BUF_SZ]; | ||
1103 | strncpy(country_abbrev, ccode, BRCM_CNTRY_BUF_SZ); | ||
1104 | return brcms_c_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1); | ||
1105 | } | ||
1106 | |||
1107 | struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) | 331 | struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) |
1108 | { | 332 | { |
1109 | struct brcms_cm_info *wlc_cm; | 333 | struct brcms_cm_info *wlc_cm; |
1110 | char country_abbrev[BRCM_CNTRY_BUF_SZ]; | ||
1111 | const struct country_info *country; | ||
1112 | struct brcms_pub *pub = wlc->pub; | 334 | struct brcms_pub *pub = wlc->pub; |
1113 | struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; | 335 | struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; |
336 | const char *ccode = sprom->alpha2; | ||
337 | int ccode_len = sizeof(sprom->alpha2); | ||
1114 | 338 | ||
1115 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 339 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); |
1116 | 340 | ||
@@ -1122,24 +346,27 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) | |||
1122 | wlc->cmi = wlc_cm; | 346 | wlc->cmi = wlc_cm; |
1123 | 347 | ||
1124 | /* store the country code for passing up as a regulatory hint */ | 348 | /* store the country code for passing up as a regulatory hint */ |
1125 | if (sprom->alpha2 && brcms_c_country_valid(sprom->alpha2)) | 349 | wlc_cm->world_regd = brcms_world_regd(ccode, ccode_len); |
1126 | strncpy(wlc->pub->srom_ccode, sprom->alpha2, sizeof(sprom->alpha2)); | 350 | if (brcms_c_country_valid(ccode)) |
351 | strncpy(wlc->pub->srom_ccode, ccode, ccode_len); | ||
1127 | 352 | ||
1128 | /* | 353 | /* |
1129 | * internal country information which must match | 354 | * If no custom world domain is found in the SROM, use the |
1130 | * regulatory constraints in firmware | 355 | * default "X2" domain. |
1131 | */ | 356 | */ |
1132 | memset(country_abbrev, 0, BRCM_CNTRY_BUF_SZ); | 357 | if (!wlc_cm->world_regd) { |
1133 | strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1); | 358 | wlc_cm->world_regd = brcms_default_world_regd(); |
1134 | country = brcms_c_country_lookup(wlc, country_abbrev); | 359 | ccode = wlc_cm->world_regd->regdomain->alpha2; |
360 | ccode_len = BRCM_CNTRY_BUF_SZ - 1; | ||
361 | } | ||
1135 | 362 | ||
1136 | /* save default country for exiting 11d regulatory mode */ | 363 | /* save default country for exiting 11d regulatory mode */ |
1137 | strncpy(wlc->country_default, country_abbrev, BRCM_CNTRY_BUF_SZ - 1); | 364 | strncpy(wlc->country_default, ccode, ccode_len); |
1138 | 365 | ||
1139 | /* initialize autocountry_default to driver default */ | 366 | /* initialize autocountry_default to driver default */ |
1140 | strncpy(wlc->autocountry_default, "X2", BRCM_CNTRY_BUF_SZ - 1); | 367 | strncpy(wlc->autocountry_default, ccode, ccode_len); |
1141 | 368 | ||
1142 | brcms_c_set_countrycode(wlc_cm, country_abbrev); | 369 | brcms_c_set_country(wlc_cm, wlc_cm->world_regd); |
1143 | 370 | ||
1144 | return wlc_cm; | 371 | return wlc_cm; |
1145 | } | 372 | } |
@@ -1149,31 +376,15 @@ void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm) | |||
1149 | kfree(wlc_cm); | 376 | kfree(wlc_cm); |
1150 | } | 377 | } |
1151 | 378 | ||
1152 | u8 | ||
1153 | brcms_c_channel_locale_flags_in_band(struct brcms_cm_info *wlc_cm, | ||
1154 | uint bandunit) | ||
1155 | { | ||
1156 | return wlc_cm->bandstate[bandunit].locale_flags; | ||
1157 | } | ||
1158 | |||
1159 | static bool | ||
1160 | brcms_c_quiet_chanspec(struct brcms_cm_info *wlc_cm, u16 chspec) | ||
1161 | { | ||
1162 | return (wlc_cm->wlc->pub->_n_enab & SUPPORT_11N) && | ||
1163 | CHSPEC_IS40(chspec) ? | ||
1164 | (isset(wlc_cm->quiet_channels.vec, | ||
1165 | lower_20_sb(CHSPEC_CHANNEL(chspec))) || | ||
1166 | isset(wlc_cm->quiet_channels.vec, | ||
1167 | upper_20_sb(CHSPEC_CHANNEL(chspec)))) : | ||
1168 | isset(wlc_cm->quiet_channels.vec, CHSPEC_CHANNEL(chspec)); | ||
1169 | } | ||
1170 | |||
1171 | void | 379 | void |
1172 | brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec, | 380 | brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec, |
1173 | u8 local_constraint_qdbm) | 381 | u8 local_constraint_qdbm) |
1174 | { | 382 | { |
1175 | struct brcms_c_info *wlc = wlc_cm->wlc; | 383 | struct brcms_c_info *wlc = wlc_cm->wlc; |
384 | struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; | ||
385 | const struct ieee80211_reg_rule *reg_rule; | ||
1176 | struct txpwr_limits txpwr; | 386 | struct txpwr_limits txpwr; |
387 | int ret; | ||
1177 | 388 | ||
1178 | brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr); | 389 | brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr); |
1179 | 390 | ||
@@ -1181,8 +392,15 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec, | |||
1181 | wlc_cm, &txpwr, local_constraint_qdbm | 392 | wlc_cm, &txpwr, local_constraint_qdbm |
1182 | ); | 393 | ); |
1183 | 394 | ||
395 | /* set or restore gmode as required by regulatory */ | ||
396 | ret = freq_reg_info(wlc->wiphy, ch->center_freq, 0, ®_rule); | ||
397 | if (!ret && (reg_rule->flags & NL80211_RRF_NO_OFDM)) | ||
398 | brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); | ||
399 | else | ||
400 | brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); | ||
401 | |||
1184 | brcms_b_set_chanspec(wlc->hw, chanspec, | 402 | brcms_b_set_chanspec(wlc->hw, chanspec, |
1185 | (brcms_c_quiet_chanspec(wlc_cm, chanspec) != 0), | 403 | !!(ch->flags & IEEE80211_CHAN_PASSIVE_SCAN), |
1186 | &txpwr); | 404 | &txpwr); |
1187 | } | 405 | } |
1188 | 406 | ||
@@ -1191,15 +409,14 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, | |||
1191 | struct txpwr_limits *txpwr) | 409 | struct txpwr_limits *txpwr) |
1192 | { | 410 | { |
1193 | struct brcms_c_info *wlc = wlc_cm->wlc; | 411 | struct brcms_c_info *wlc = wlc_cm->wlc; |
412 | struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; | ||
1194 | uint i; | 413 | uint i; |
1195 | uint chan; | 414 | uint chan; |
1196 | int maxpwr; | 415 | int maxpwr; |
1197 | int delta; | 416 | int delta; |
1198 | const struct country_info *country; | 417 | const struct country_info *country; |
1199 | struct brcms_band *band; | 418 | struct brcms_band *band; |
1200 | const struct locale_info *li; | ||
1201 | int conducted_max = BRCMS_TXPWR_MAX; | 419 | int conducted_max = BRCMS_TXPWR_MAX; |
1202 | int conducted_ofdm_max = BRCMS_TXPWR_MAX; | ||
1203 | const struct locale_mimo_info *li_mimo; | 420 | const struct locale_mimo_info *li_mimo; |
1204 | int maxpwr20, maxpwr40; | 421 | int maxpwr20, maxpwr40; |
1205 | int maxpwr_idx; | 422 | int maxpwr_idx; |
@@ -1207,67 +424,35 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, | |||
1207 | 424 | ||
1208 | memset(txpwr, 0, sizeof(struct txpwr_limits)); | 425 | memset(txpwr, 0, sizeof(struct txpwr_limits)); |
1209 | 426 | ||
1210 | if (!brcms_c_valid_chanspec_db(wlc_cm, chanspec)) { | 427 | if (WARN_ON(!ch)) |
1211 | country = brcms_c_country_lookup(wlc, wlc->autocountry_default); | 428 | return; |
1212 | if (country == NULL) | 429 | |
1213 | return; | 430 | country = &wlc_cm->world_regd->country; |
1214 | } else { | ||
1215 | country = wlc_cm->country; | ||
1216 | } | ||
1217 | 431 | ||
1218 | chan = CHSPEC_CHANNEL(chanspec); | 432 | chan = CHSPEC_CHANNEL(chanspec); |
1219 | band = wlc->bandstate[chspec_bandunit(chanspec)]; | 433 | band = wlc->bandstate[chspec_bandunit(chanspec)]; |
1220 | li = (band->bandtype == BRCM_BAND_5G) ? | ||
1221 | brcms_c_get_locale_5g(country->locale_5G) : | ||
1222 | brcms_c_get_locale_2g(country->locale_2G); | ||
1223 | |||
1224 | li_mimo = (band->bandtype == BRCM_BAND_5G) ? | 434 | li_mimo = (band->bandtype == BRCM_BAND_5G) ? |
1225 | brcms_c_get_mimo_5g(country->locale_mimo_5G) : | 435 | brcms_c_get_mimo_5g(country->locale_mimo_5G) : |
1226 | brcms_c_get_mimo_2g(country->locale_mimo_2G); | 436 | brcms_c_get_mimo_2g(country->locale_mimo_2G); |
1227 | 437 | ||
1228 | if (li->flags & BRCMS_EIRP) { | 438 | delta = band->antgain; |
1229 | delta = band->antgain; | ||
1230 | } else { | ||
1231 | delta = 0; | ||
1232 | if (band->antgain > QDB(6)) | ||
1233 | delta = band->antgain - QDB(6); /* Excess over 6 dB */ | ||
1234 | } | ||
1235 | 439 | ||
1236 | if (li == &locale_i) { | 440 | if (band->bandtype == BRCM_BAND_2G) |
1237 | conducted_max = QDB(22); | 441 | conducted_max = QDB(22); |
1238 | conducted_ofdm_max = QDB(22); | 442 | |
1239 | } | 443 | maxpwr = QDB(ch->max_power) - delta; |
444 | maxpwr = max(maxpwr, 0); | ||
445 | maxpwr = min(maxpwr, conducted_max); | ||
1240 | 446 | ||
1241 | /* CCK txpwr limits for 2.4G band */ | 447 | /* CCK txpwr limits for 2.4G band */ |
1242 | if (band->bandtype == BRCM_BAND_2G) { | 448 | if (band->bandtype == BRCM_BAND_2G) { |
1243 | maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_CCK(chan)]; | ||
1244 | |||
1245 | maxpwr = maxpwr - delta; | ||
1246 | maxpwr = max(maxpwr, 0); | ||
1247 | maxpwr = min(maxpwr, conducted_max); | ||
1248 | |||
1249 | for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) | 449 | for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) |
1250 | txpwr->cck[i] = (u8) maxpwr; | 450 | txpwr->cck[i] = (u8) maxpwr; |
1251 | } | 451 | } |
1252 | 452 | ||
1253 | /* OFDM txpwr limits for 2.4G or 5G bands */ | 453 | for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) { |
1254 | if (band->bandtype == BRCM_BAND_2G) | ||
1255 | maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_OFDM(chan)]; | ||
1256 | else | ||
1257 | maxpwr = li->maxpwr[CHANNEL_POWER_IDX_5G(chan)]; | ||
1258 | |||
1259 | maxpwr = maxpwr - delta; | ||
1260 | maxpwr = max(maxpwr, 0); | ||
1261 | maxpwr = min(maxpwr, conducted_ofdm_max); | ||
1262 | |||
1263 | /* Keep OFDM lmit below CCK limit */ | ||
1264 | if (band->bandtype == BRCM_BAND_2G) | ||
1265 | maxpwr = min_t(int, maxpwr, txpwr->cck[0]); | ||
1266 | |||
1267 | for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) | ||
1268 | txpwr->ofdm[i] = (u8) maxpwr; | 454 | txpwr->ofdm[i] = (u8) maxpwr; |
1269 | 455 | ||
1270 | for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) { | ||
1271 | /* | 456 | /* |
1272 | * OFDM 40 MHz SISO has the same power as the corresponding | 457 | * OFDM 40 MHz SISO has the same power as the corresponding |
1273 | * MCS0-7 rate unless overriden by the locale specific code. | 458 | * MCS0-7 rate unless overriden by the locale specific code. |
@@ -1282,14 +467,9 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, | |||
1282 | txpwr->ofdm_40_cdd[i] = 0; | 467 | txpwr->ofdm_40_cdd[i] = 0; |
1283 | } | 468 | } |
1284 | 469 | ||
1285 | /* MIMO/HT specific limits */ | 470 | delta = 0; |
1286 | if (li_mimo->flags & BRCMS_EIRP) { | 471 | if (band->antgain > QDB(6)) |
1287 | delta = band->antgain; | 472 | delta = band->antgain - QDB(6); /* Excess over 6 dB */ |
1288 | } else { | ||
1289 | delta = 0; | ||
1290 | if (band->antgain > QDB(6)) | ||
1291 | delta = band->antgain - QDB(6); /* Excess over 6 dB */ | ||
1292 | } | ||
1293 | 473 | ||
1294 | if (band->bandtype == BRCM_BAND_2G) | 474 | if (band->bandtype == BRCM_BAND_2G) |
1295 | maxpwr_idx = (chan - 1); | 475 | maxpwr_idx = (chan - 1); |
@@ -1431,8 +611,7 @@ static bool brcms_c_chspec_malformed(u16 chanspec) | |||
1431 | * and they are also a legal HT combination | 611 | * and they are also a legal HT combination |
1432 | */ | 612 | */ |
1433 | static bool | 613 | static bool |
1434 | brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec, | 614 | brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec) |
1435 | bool dualband) | ||
1436 | { | 615 | { |
1437 | struct brcms_c_info *wlc = wlc_cm->wlc; | 616 | struct brcms_c_info *wlc = wlc_cm->wlc; |
1438 | u8 channel = CHSPEC_CHANNEL(chspec); | 617 | u8 channel = CHSPEC_CHANNEL(chspec); |
@@ -1448,59 +627,166 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec, | |||
1448 | chspec_bandunit(chspec)) | 627 | chspec_bandunit(chspec)) |
1449 | return false; | 628 | return false; |
1450 | 629 | ||
1451 | /* Check a 20Mhz channel */ | 630 | return true; |
1452 | if (CHSPEC_IS20(chspec)) { | 631 | } |
1453 | if (dualband) | 632 | |
1454 | return brcms_c_valid_channel20_db(wlc_cm->wlc->cmi, | 633 | bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, u16 chspec) |
1455 | channel); | 634 | { |
1456 | else | 635 | return brcms_c_valid_chanspec_ext(wlc_cm, chspec); |
1457 | return brcms_c_valid_channel20(wlc_cm->wlc->cmi, | 636 | } |
1458 | channel); | 637 | |
638 | static bool brcms_is_radar_freq(u16 center_freq) | ||
639 | { | ||
640 | return center_freq >= 5260 && center_freq <= 5700; | ||
641 | } | ||
642 | |||
643 | static void brcms_reg_apply_radar_flags(struct wiphy *wiphy) | ||
644 | { | ||
645 | struct ieee80211_supported_band *sband; | ||
646 | struct ieee80211_channel *ch; | ||
647 | int i; | ||
648 | |||
649 | sband = wiphy->bands[IEEE80211_BAND_5GHZ]; | ||
650 | if (!sband) | ||
651 | return; | ||
652 | |||
653 | for (i = 0; i < sband->n_channels; i++) { | ||
654 | ch = &sband->channels[i]; | ||
655 | |||
656 | if (!brcms_is_radar_freq(ch->center_freq)) | ||
657 | continue; | ||
658 | |||
659 | /* | ||
660 | * All channels in this range should be passive and have | ||
661 | * DFS enabled. | ||
662 | */ | ||
663 | if (!(ch->flags & IEEE80211_CHAN_DISABLED)) | ||
664 | ch->flags |= IEEE80211_CHAN_RADAR | | ||
665 | IEEE80211_CHAN_NO_IBSS | | ||
666 | IEEE80211_CHAN_PASSIVE_SCAN; | ||
1459 | } | 667 | } |
1460 | #ifdef SUPPORT_40MHZ | 668 | } |
1461 | /* | 669 | |
1462 | * We know we are now checking a 40MHZ channel, so we should | 670 | static void |
1463 | * only be here for NPHYS | 671 | brcms_reg_apply_beaconing_flags(struct wiphy *wiphy, |
1464 | */ | 672 | enum nl80211_reg_initiator initiator) |
1465 | if (BRCMS_ISNPHY(wlc->band) || BRCMS_ISSSLPNPHY(wlc->band)) { | 673 | { |
1466 | u8 upper_sideband = 0, idx; | 674 | struct ieee80211_supported_band *sband; |
1467 | u8 num_ch20_entries = | 675 | struct ieee80211_channel *ch; |
1468 | sizeof(chan20_info) / sizeof(struct chan20_info); | 676 | const struct ieee80211_reg_rule *rule; |
1469 | 677 | int band, i, ret; | |
1470 | if (!VALID_40CHANSPEC_IN_BAND(wlc, chspec_bandunit(chspec))) | 678 | |
1471 | return false; | 679 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
1472 | 680 | sband = wiphy->bands[band]; | |
1473 | if (dualband) { | 681 | if (!sband) |
1474 | if (!brcms_c_valid_channel20_db(wlc->cmi, | 682 | continue; |
1475 | lower_20_sb(channel)) || | 683 | |
1476 | !brcms_c_valid_channel20_db(wlc->cmi, | 684 | for (i = 0; i < sband->n_channels; i++) { |
1477 | upper_20_sb(channel))) | 685 | ch = &sband->channels[i]; |
1478 | return false; | 686 | |
1479 | } else { | 687 | if (ch->flags & |
1480 | if (!brcms_c_valid_channel20(wlc->cmi, | 688 | (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_RADAR)) |
1481 | lower_20_sb(channel)) || | 689 | continue; |
1482 | !brcms_c_valid_channel20(wlc->cmi, | 690 | |
1483 | upper_20_sb(channel))) | 691 | if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { |
1484 | return false; | 692 | ret = freq_reg_info(wiphy, ch->center_freq, |
693 | 0, &rule); | ||
694 | if (ret) | ||
695 | continue; | ||
696 | |||
697 | if (!(rule->flags & NL80211_RRF_NO_IBSS)) | ||
698 | ch->flags &= ~IEEE80211_CHAN_NO_IBSS; | ||
699 | if (!(rule->flags & NL80211_RRF_PASSIVE_SCAN)) | ||
700 | ch->flags &= | ||
701 | ~IEEE80211_CHAN_PASSIVE_SCAN; | ||
702 | } else if (ch->beacon_found) { | ||
703 | ch->flags &= ~(IEEE80211_CHAN_NO_IBSS | | ||
704 | IEEE80211_CHAN_PASSIVE_SCAN); | ||
705 | } | ||
1485 | } | 706 | } |
707 | } | ||
708 | } | ||
1486 | 709 | ||
1487 | /* find the lower sideband info in the sideband array */ | 710 | static int brcms_reg_notifier(struct wiphy *wiphy, |
1488 | for (idx = 0; idx < num_ch20_entries; idx++) { | 711 | struct regulatory_request *request) |
1489 | if (chan20_info[idx].sb == lower_20_sb(channel)) | 712 | { |
1490 | upper_sideband = chan20_info[idx].adj_sbs; | 713 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
714 | struct brcms_info *wl = hw->priv; | ||
715 | struct brcms_c_info *wlc = wl->wlc; | ||
716 | struct ieee80211_supported_band *sband; | ||
717 | struct ieee80211_channel *ch; | ||
718 | int band, i; | ||
719 | bool ch_found = false; | ||
720 | |||
721 | brcms_reg_apply_radar_flags(wiphy); | ||
722 | |||
723 | if (request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) | ||
724 | brcms_reg_apply_beaconing_flags(wiphy, request->initiator); | ||
725 | |||
726 | /* Disable radio if all channels disallowed by regulatory */ | ||
727 | for (band = 0; !ch_found && band < IEEE80211_NUM_BANDS; band++) { | ||
728 | sband = wiphy->bands[band]; | ||
729 | if (!sband) | ||
730 | continue; | ||
731 | |||
732 | for (i = 0; !ch_found && i < sband->n_channels; i++) { | ||
733 | ch = &sband->channels[i]; | ||
734 | |||
735 | if (!(ch->flags & IEEE80211_CHAN_DISABLED)) | ||
736 | ch_found = true; | ||
1491 | } | 737 | } |
1492 | /* check that the lower sideband allows an upper sideband */ | ||
1493 | if ((upper_sideband & (CH_UPPER_SB | CH_EWA_VALID)) == | ||
1494 | (CH_UPPER_SB | CH_EWA_VALID)) | ||
1495 | return true; | ||
1496 | return false; | ||
1497 | } | 738 | } |
1498 | #endif /* 40 MHZ */ | ||
1499 | 739 | ||
1500 | return false; | 740 | if (ch_found) { |
741 | mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | ||
742 | } else { | ||
743 | mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | ||
744 | wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\"\n", | ||
745 | wlc->pub->unit, __func__, request->alpha2); | ||
746 | } | ||
747 | |||
748 | if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) | ||
749 | wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, | ||
750 | brcms_c_japan_ccode(request->alpha2)); | ||
751 | |||
752 | return 0; | ||
1501 | } | 753 | } |
1502 | 754 | ||
1503 | bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, u16 chspec) | 755 | void brcms_c_regd_init(struct brcms_c_info *wlc) |
1504 | { | 756 | { |
1505 | return brcms_c_valid_chanspec_ext(wlc_cm, chspec, true); | 757 | struct wiphy *wiphy = wlc->wiphy; |
758 | const struct brcms_regd *regd = wlc->cmi->world_regd; | ||
759 | struct ieee80211_supported_band *sband; | ||
760 | struct ieee80211_channel *ch; | ||
761 | struct brcms_chanvec sup_chan; | ||
762 | struct brcms_band *band; | ||
763 | int band_idx, i; | ||
764 | |||
765 | /* Disable any channels not supported by the phy */ | ||
766 | for (band_idx = 0; band_idx < IEEE80211_NUM_BANDS; band_idx++) { | ||
767 | if (band_idx == IEEE80211_BAND_2GHZ) | ||
768 | band = wlc->bandstate[BAND_2G_INDEX]; | ||
769 | else | ||
770 | band = wlc->bandstate[BAND_5G_INDEX]; | ||
771 | |||
772 | /* skip if band not initialized */ | ||
773 | if (band->pi == NULL) | ||
774 | continue; | ||
775 | |||
776 | wlc_phy_chanspec_band_validch(band->pi, band->bandtype, | ||
777 | &sup_chan); | ||
778 | |||
779 | sband = wiphy->bands[band_idx]; | ||
780 | for (i = 0; i < sband->n_channels; i++) { | ||
781 | ch = &sband->channels[i]; | ||
782 | if (!isset(sup_chan.vec, ch->hw_value)) | ||
783 | ch->flags |= IEEE80211_CHAN_DISABLED; | ||
784 | } | ||
785 | } | ||
786 | |||
787 | wlc->wiphy->reg_notifier = brcms_reg_notifier; | ||
788 | wlc->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | ||
789 | WIPHY_FLAG_STRICT_REGULATORY; | ||
790 | wiphy_apply_custom_regulatory(wlc->wiphy, regd->regdomain); | ||
791 | brcms_reg_apply_beaconing_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER); | ||
1506 | } | 792 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.h b/drivers/net/wireless/brcm80211/brcmsmac/channel.h index 808cb4fbfbe7..006483a0abe6 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.h | |||
@@ -37,9 +37,6 @@ brcms_c_channel_mgr_attach(struct brcms_c_info *wlc); | |||
37 | 37 | ||
38 | extern void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm); | 38 | extern void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm); |
39 | 39 | ||
40 | extern u8 brcms_c_channel_locale_flags_in_band(struct brcms_cm_info *wlc_cm, | ||
41 | uint bandunit); | ||
42 | |||
43 | extern bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, | 40 | extern bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, |
44 | u16 chspec); | 41 | u16 chspec); |
45 | 42 | ||
@@ -49,5 +46,6 @@ extern void brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, | |||
49 | extern void brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, | 46 | extern void brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, |
50 | u16 chanspec, | 47 | u16 chanspec, |
51 | u8 local_constraint_qdbm); | 48 | u8 local_constraint_qdbm); |
49 | extern void brcms_c_regd_init(struct brcms_c_info *wlc); | ||
52 | 50 | ||
53 | #endif /* _WLC_CHANNEL_H */ | 51 | #endif /* _WLC_CHANNEL_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 341e06a0d6ec..2d5a40412690 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -1050,6 +1050,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) | |||
1050 | goto fail; | 1050 | goto fail; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | brcms_c_regd_init(wl->wlc); | ||
1054 | |||
1053 | memcpy(perm, &wl->pub->cur_etheraddr, ETH_ALEN); | 1055 | memcpy(perm, &wl->pub->cur_etheraddr, ETH_ALEN); |
1054 | if (WARN_ON(!is_valid_ether_addr(perm))) | 1056 | if (WARN_ON(!is_valid_ether_addr(perm))) |
1055 | goto fail; | 1057 | goto fail; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index e67556780a31..bb00b6528d8f 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/pci_ids.h> | 19 | #include <linux/pci_ids.h> |
20 | #include <linux/if_ether.h> | 20 | #include <linux/if_ether.h> |
21 | #include <net/cfg80211.h> | ||
21 | #include <net/mac80211.h> | 22 | #include <net/mac80211.h> |
22 | #include <brcm_hw_ids.h> | 23 | #include <brcm_hw_ids.h> |
23 | #include <aiutils.h> | 24 | #include <aiutils.h> |
@@ -3139,20 +3140,6 @@ void brcms_c_reset(struct brcms_c_info *wlc) | |||
3139 | brcms_b_reset(wlc->hw); | 3140 | brcms_b_reset(wlc->hw); |
3140 | } | 3141 | } |
3141 | 3142 | ||
3142 | /* Return the channel the driver should initialize during brcms_c_init. | ||
3143 | * the channel may have to be changed from the currently configured channel | ||
3144 | * if other configurations are in conflict (bandlocked, 11n mode disabled, | ||
3145 | * invalid channel for current country, etc.) | ||
3146 | */ | ||
3147 | static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc) | ||
3148 | { | ||
3149 | u16 chanspec = | ||
3150 | 1 | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE | | ||
3151 | WL_CHANSPEC_BAND_2G; | ||
3152 | |||
3153 | return chanspec; | ||
3154 | } | ||
3155 | |||
3156 | void brcms_c_init_scb(struct scb *scb) | 3143 | void brcms_c_init_scb(struct scb *scb) |
3157 | { | 3144 | { |
3158 | int i; | 3145 | int i; |
@@ -5129,6 +5116,8 @@ static void brcms_c_wme_retries_write(struct brcms_c_info *wlc) | |||
5129 | /* make interface operational */ | 5116 | /* make interface operational */ |
5130 | int brcms_c_up(struct brcms_c_info *wlc) | 5117 | int brcms_c_up(struct brcms_c_info *wlc) |
5131 | { | 5118 | { |
5119 | struct ieee80211_channel *ch; | ||
5120 | |||
5132 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 5121 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); |
5133 | 5122 | ||
5134 | /* HW is turned off so don't try to access it */ | 5123 | /* HW is turned off so don't try to access it */ |
@@ -5195,8 +5184,9 @@ int brcms_c_up(struct brcms_c_info *wlc) | |||
5195 | wlc->pub->up = true; | 5184 | wlc->pub->up = true; |
5196 | 5185 | ||
5197 | if (wlc->bandinit_pending) { | 5186 | if (wlc->bandinit_pending) { |
5187 | ch = wlc->pub->ieee_hw->conf.channel; | ||
5198 | brcms_c_suspend_mac_and_wait(wlc); | 5188 | brcms_c_suspend_mac_and_wait(wlc); |
5199 | brcms_c_set_chanspec(wlc, wlc->default_bss->chanspec); | 5189 | brcms_c_set_chanspec(wlc, ch20mhz_chspec(ch->hw_value)); |
5200 | wlc->bandinit_pending = false; | 5190 | wlc->bandinit_pending = false; |
5201 | brcms_c_enable_mac(wlc); | 5191 | brcms_c_enable_mac(wlc); |
5202 | } | 5192 | } |
@@ -5397,11 +5387,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) | |||
5397 | else | 5387 | else |
5398 | return -EINVAL; | 5388 | return -EINVAL; |
5399 | 5389 | ||
5400 | /* Legacy or bust when no OFDM is supported by regulatory */ | ||
5401 | if ((brcms_c_channel_locale_flags_in_band(wlc->cmi, band->bandunit) & | ||
5402 | BRCMS_NO_OFDM) && (gmode != GMODE_LEGACY_B)) | ||
5403 | return -EINVAL; | ||
5404 | |||
5405 | /* update configuration value */ | 5390 | /* update configuration value */ |
5406 | if (config) | 5391 | if (config) |
5407 | brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER, gmode); | 5392 | brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER, gmode); |
@@ -8201,19 +8186,12 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8201 | void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) | 8186 | void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) |
8202 | { | 8187 | { |
8203 | struct bcma_device *core = wlc->hw->d11core; | 8188 | struct bcma_device *core = wlc->hw->d11core; |
8189 | struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; | ||
8204 | u16 chanspec; | 8190 | u16 chanspec; |
8205 | 8191 | ||
8206 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 8192 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); |
8207 | 8193 | ||
8208 | /* | 8194 | chanspec = ch20mhz_chspec(ch->hw_value); |
8209 | * This will happen if a big-hammer was executed. In | ||
8210 | * that case, we want to go back to the channel that | ||
8211 | * we were on and not new channel | ||
8212 | */ | ||
8213 | if (wlc->pub->associated) | ||
8214 | chanspec = wlc->home_chanspec; | ||
8215 | else | ||
8216 | chanspec = brcms_c_init_chanspec(wlc); | ||
8217 | 8195 | ||
8218 | brcms_b_init(wlc->hw, chanspec); | 8196 | brcms_b_init(wlc->hw, chanspec); |
8219 | 8197 | ||
diff --git a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h index 333193f20e1c..bcc79b4e3267 100644 --- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h +++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h | |||
@@ -37,5 +37,6 @@ | |||
37 | #define BCM4329_CHIP_ID 0x4329 | 37 | #define BCM4329_CHIP_ID 0x4329 |
38 | #define BCM4330_CHIP_ID 0x4330 | 38 | #define BCM4330_CHIP_ID 0x4330 |
39 | #define BCM4331_CHIP_ID 0x4331 | 39 | #define BCM4331_CHIP_ID 0x4331 |
40 | #define BCM4334_CHIP_ID 0x4334 | ||
40 | 41 | ||
41 | #endif /* _BRCM_HW_IDS_H_ */ | 42 | #endif /* _BRCM_HW_IDS_H_ */ |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index cbf2dc18341f..763c7529921b 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4717,10 +4717,11 @@ il_check_stuck_queue(struct il_priv *il, int cnt) | |||
4717 | struct il_tx_queue *txq = &il->txq[cnt]; | 4717 | struct il_tx_queue *txq = &il->txq[cnt]; |
4718 | struct il_queue *q = &txq->q; | 4718 | struct il_queue *q = &txq->q; |
4719 | unsigned long timeout; | 4719 | unsigned long timeout; |
4720 | unsigned long now = jiffies; | ||
4720 | int ret; | 4721 | int ret; |
4721 | 4722 | ||
4722 | if (q->read_ptr == q->write_ptr) { | 4723 | if (q->read_ptr == q->write_ptr) { |
4723 | txq->time_stamp = jiffies; | 4724 | txq->time_stamp = now; |
4724 | return 0; | 4725 | return 0; |
4725 | } | 4726 | } |
4726 | 4727 | ||
@@ -4728,9 +4729,9 @@ il_check_stuck_queue(struct il_priv *il, int cnt) | |||
4728 | txq->time_stamp + | 4729 | txq->time_stamp + |
4729 | msecs_to_jiffies(il->cfg->wd_timeout); | 4730 | msecs_to_jiffies(il->cfg->wd_timeout); |
4730 | 4731 | ||
4731 | if (time_after(jiffies, timeout)) { | 4732 | if (time_after(now, timeout)) { |
4732 | IL_ERR("Queue %d stuck for %u ms.\n", q->id, | 4733 | IL_ERR("Queue %d stuck for %u ms.\n", q->id, |
4733 | il->cfg->wd_timeout); | 4734 | jiffies_to_msecs(now - txq->time_stamp)); |
4734 | ret = il_force_reset(il, false); | 4735 | ret = il_force_reset(il, false); |
4735 | return (ret == -EAGAIN) ? 0 : 1; | 4736 | return (ret == -EAGAIN) ? 0 : 1; |
4736 | } | 4737 | } |
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h index 6d102413dd94..9bb16bdf6d26 100644 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ b/drivers/net/wireless/iwlwifi/dvm/agn.h | |||
@@ -269,7 +269,7 @@ void iwl_scan_offchannel_skb_status(struct iwl_priv *priv); | |||
269 | #define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ | 269 | #define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ |
270 | #define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ | 270 | #define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ |
271 | 271 | ||
272 | #define IWL_SCAN_CHECK_WATCHDOG (HZ * 7) | 272 | #define IWL_SCAN_CHECK_WATCHDOG (HZ * 15) |
273 | 273 | ||
274 | 274 | ||
275 | /* bt coex */ | 275 | /* bt coex */ |
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h index 4620b657948a..54cf085ddc89 100644 --- a/drivers/net/wireless/iwlwifi/dvm/dev.h +++ b/drivers/net/wireless/iwlwifi/dvm/dev.h | |||
@@ -568,7 +568,6 @@ enum iwl_scan_type { | |||
568 | * | 568 | * |
569 | * @tx_chains_num: Number of TX chains | 569 | * @tx_chains_num: Number of TX chains |
570 | * @rx_chains_num: Number of RX chains | 570 | * @rx_chains_num: Number of RX chains |
571 | * @sku: sku read from EEPROM | ||
572 | * @ct_kill_threshold: temperature threshold - in hw dependent unit | 571 | * @ct_kill_threshold: temperature threshold - in hw dependent unit |
573 | * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit | 572 | * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit |
574 | * relevant for 1000, 6000 and up | 573 | * relevant for 1000, 6000 and up |
@@ -579,7 +578,6 @@ struct iwl_hw_params { | |||
579 | u8 tx_chains_num; | 578 | u8 tx_chains_num; |
580 | u8 rx_chains_num; | 579 | u8 rx_chains_num; |
581 | bool use_rts_for_aggregation; | 580 | bool use_rts_for_aggregation; |
582 | u16 sku; | ||
583 | u32 ct_kill_threshold; | 581 | u32 ct_kill_threshold; |
584 | u32 ct_kill_exit_threshold; | 582 | u32 ct_kill_exit_threshold; |
585 | 583 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c index 0521a6be09d2..349c205d5f62 100644 --- a/drivers/net/wireless/iwlwifi/dvm/devices.c +++ b/drivers/net/wireless/iwlwifi/dvm/devices.c | |||
@@ -250,17 +250,6 @@ struct iwl_lib_ops iwl2030_lib = { | |||
250 | */ | 250 | */ |
251 | 251 | ||
252 | /* NIC configuration for 5000 series */ | 252 | /* NIC configuration for 5000 series */ |
253 | static void iwl5000_nic_config(struct iwl_priv *priv) | ||
254 | { | ||
255 | /* W/A : NIC is stuck in a reset state after Early PCIe power off | ||
256 | * (PCIe power is lost before PERST# is asserted), | ||
257 | * causing ME FW to lose ownership and not being able to obtain it back. | ||
258 | */ | ||
259 | iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG, | ||
260 | APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, | ||
261 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); | ||
262 | } | ||
263 | |||
264 | static const struct iwl_sensitivity_ranges iwl5000_sensitivity = { | 253 | static const struct iwl_sensitivity_ranges iwl5000_sensitivity = { |
265 | .min_nrg_cck = 100, | 254 | .min_nrg_cck = 100, |
266 | .auto_corr_min_ofdm = 90, | 255 | .auto_corr_min_ofdm = 90, |
@@ -433,14 +422,12 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | |||
433 | struct iwl_lib_ops iwl5000_lib = { | 422 | struct iwl_lib_ops iwl5000_lib = { |
434 | .set_hw_params = iwl5000_hw_set_hw_params, | 423 | .set_hw_params = iwl5000_hw_set_hw_params, |
435 | .set_channel_switch = iwl5000_hw_channel_switch, | 424 | .set_channel_switch = iwl5000_hw_channel_switch, |
436 | .nic_config = iwl5000_nic_config, | ||
437 | .temperature = iwlagn_temperature, | 425 | .temperature = iwlagn_temperature, |
438 | }; | 426 | }; |
439 | 427 | ||
440 | struct iwl_lib_ops iwl5150_lib = { | 428 | struct iwl_lib_ops iwl5150_lib = { |
441 | .set_hw_params = iwl5150_hw_set_hw_params, | 429 | .set_hw_params = iwl5150_hw_set_hw_params, |
442 | .set_channel_switch = iwl5000_hw_channel_switch, | 430 | .set_channel_switch = iwl5000_hw_channel_switch, |
443 | .nic_config = iwl5000_nic_config, | ||
444 | .temperature = iwl5150_temperature, | 431 | .temperature = iwl5150_temperature, |
445 | }; | 432 | }; |
446 | 433 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c index 76f259283c3a..207ae91a83aa 100644 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c | |||
@@ -160,7 +160,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) | |||
160 | IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK | | 160 | IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK | |
161 | IWL_PAN_SCD_MULTICAST_MSK; | 161 | IWL_PAN_SCD_MULTICAST_MSK; |
162 | 162 | ||
163 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) | 163 | if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE) |
164 | flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; | 164 | flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; |
165 | 165 | ||
166 | IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", | 166 | IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index 2f10346c6ba1..a5f7bce96325 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -164,7 +164,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
164 | hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; | 164 | hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; |
165 | */ | 165 | */ |
166 | 166 | ||
167 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) | 167 | if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE) |
168 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 168 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
169 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 169 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
170 | 170 | ||
@@ -649,7 +649,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
649 | IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", | 649 | IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", |
650 | sta->addr, tid); | 650 | sta->addr, tid); |
651 | 651 | ||
652 | if (!(priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE)) | 652 | if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)) |
653 | return -EACCES; | 653 | return -EACCES; |
654 | 654 | ||
655 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 655 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
@@ -1048,8 +1048,18 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw, | |||
1048 | mutex_lock(&priv->mutex); | 1048 | mutex_lock(&priv->mutex); |
1049 | 1049 | ||
1050 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | 1050 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { |
1051 | err = -EBUSY; | 1051 | /* mac80211 should not scan while ROC or ROC while scanning */ |
1052 | goto out; | 1052 | if (WARN_ON_ONCE(priv->scan_type != IWL_SCAN_RADIO_RESET)) { |
1053 | err = -EBUSY; | ||
1054 | goto out; | ||
1055 | } | ||
1056 | |||
1057 | iwl_scan_cancel_timeout(priv, 100); | ||
1058 | |||
1059 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
1060 | err = -EBUSY; | ||
1061 | goto out; | ||
1062 | } | ||
1053 | } | 1063 | } |
1054 | 1064 | ||
1055 | priv->hw_roc_channel = channel; | 1065 | priv->hw_roc_channel = channel; |
@@ -1413,13 +1423,11 @@ static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, | |||
1413 | } | 1423 | } |
1414 | 1424 | ||
1415 | static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, | 1425 | static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, |
1416 | struct ieee80211_vif *vif, | 1426 | struct ieee80211_vif *vif, |
1417 | enum nl80211_iftype newtype, bool newp2p) | 1427 | enum nl80211_iftype newtype, bool newp2p) |
1418 | { | 1428 | { |
1419 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1429 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
1420 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | 1430 | struct iwl_rxon_context *ctx, *tmp; |
1421 | struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1422 | struct iwl_rxon_context *tmp; | ||
1423 | enum nl80211_iftype newviftype = newtype; | 1431 | enum nl80211_iftype newviftype = newtype; |
1424 | u32 interface_modes; | 1432 | u32 interface_modes; |
1425 | int err; | 1433 | int err; |
@@ -1430,6 +1438,18 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, | |||
1430 | 1438 | ||
1431 | mutex_lock(&priv->mutex); | 1439 | mutex_lock(&priv->mutex); |
1432 | 1440 | ||
1441 | ctx = iwl_rxon_ctx_from_vif(vif); | ||
1442 | |||
1443 | /* | ||
1444 | * To simplify this code, only support changes on the | ||
1445 | * BSS context. The PAN context is usually reassigned | ||
1446 | * by creating/removing P2P interfaces anyway. | ||
1447 | */ | ||
1448 | if (ctx->ctxid != IWL_RXON_CTX_BSS) { | ||
1449 | err = -EBUSY; | ||
1450 | goto out; | ||
1451 | } | ||
1452 | |||
1433 | if (!ctx->vif || !iwl_is_ready_rf(priv)) { | 1453 | if (!ctx->vif || !iwl_is_ready_rf(priv)) { |
1434 | /* | 1454 | /* |
1435 | * Huh? But wait ... this can maybe happen when | 1455 | * Huh? But wait ... this can maybe happen when |
@@ -1439,32 +1459,19 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, | |||
1439 | goto out; | 1459 | goto out; |
1440 | } | 1460 | } |
1441 | 1461 | ||
1462 | /* Check if the switch is supported in the same context */ | ||
1442 | interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; | 1463 | interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; |
1443 | |||
1444 | if (!(interface_modes & BIT(newtype))) { | 1464 | if (!(interface_modes & BIT(newtype))) { |
1445 | err = -EBUSY; | 1465 | err = -EBUSY; |
1446 | goto out; | 1466 | goto out; |
1447 | } | 1467 | } |
1448 | 1468 | ||
1449 | /* | ||
1450 | * Refuse a change that should be done by moving from the PAN | ||
1451 | * context to the BSS context instead, if the BSS context is | ||
1452 | * available and can support the new interface type. | ||
1453 | */ | ||
1454 | if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif && | ||
1455 | (bss_ctx->interface_modes & BIT(newtype) || | ||
1456 | bss_ctx->exclusive_interface_modes & BIT(newtype))) { | ||
1457 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); | ||
1458 | err = -EBUSY; | ||
1459 | goto out; | ||
1460 | } | ||
1461 | |||
1462 | if (ctx->exclusive_interface_modes & BIT(newtype)) { | 1469 | if (ctx->exclusive_interface_modes & BIT(newtype)) { |
1463 | for_each_context(priv, tmp) { | 1470 | for_each_context(priv, tmp) { |
1464 | if (ctx == tmp) | 1471 | if (ctx == tmp) |
1465 | continue; | 1472 | continue; |
1466 | 1473 | ||
1467 | if (!tmp->vif) | 1474 | if (!tmp->is_active) |
1468 | continue; | 1475 | continue; |
1469 | 1476 | ||
1470 | /* | 1477 | /* |
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index e620af3d592d..abfd7916bde6 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -51,11 +51,13 @@ | |||
51 | #include "iwl-op-mode.h" | 51 | #include "iwl-op-mode.h" |
52 | #include "iwl-drv.h" | 52 | #include "iwl-drv.h" |
53 | #include "iwl-modparams.h" | 53 | #include "iwl-modparams.h" |
54 | #include "iwl-prph.h" | ||
54 | 55 | ||
55 | #include "dev.h" | 56 | #include "dev.h" |
56 | #include "calib.h" | 57 | #include "calib.h" |
57 | #include "agn.h" | 58 | #include "agn.h" |
58 | 59 | ||
60 | |||
59 | /****************************************************************************** | 61 | /****************************************************************************** |
60 | * | 62 | * |
61 | * module boiler plate | 63 | * module boiler plate |
@@ -1185,9 +1187,6 @@ static void iwl_set_hw_params(struct iwl_priv *priv) | |||
1185 | priv->hw_params.use_rts_for_aggregation = | 1187 | priv->hw_params.use_rts_for_aggregation = |
1186 | priv->cfg->ht_params->use_rts_for_aggregation; | 1188 | priv->cfg->ht_params->use_rts_for_aggregation; |
1187 | 1189 | ||
1188 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) | ||
1189 | priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE; | ||
1190 | |||
1191 | /* Device-specific setup */ | 1190 | /* Device-specific setup */ |
1192 | priv->lib->set_hw_params(priv); | 1191 | priv->lib->set_hw_params(priv); |
1193 | } | 1192 | } |
@@ -1232,20 +1231,20 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
1232 | { | 1231 | { |
1233 | u16 radio_cfg; | 1232 | u16 radio_cfg; |
1234 | 1233 | ||
1235 | priv->hw_params.sku = priv->eeprom_data->sku; | 1234 | priv->eeprom_data->sku = priv->eeprom_data->sku; |
1236 | 1235 | ||
1237 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && | 1236 | if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE && |
1238 | !priv->cfg->ht_params) { | 1237 | !priv->cfg->ht_params) { |
1239 | IWL_ERR(priv, "Invalid 11n configuration\n"); | 1238 | IWL_ERR(priv, "Invalid 11n configuration\n"); |
1240 | return -EINVAL; | 1239 | return -EINVAL; |
1241 | } | 1240 | } |
1242 | 1241 | ||
1243 | if (!priv->hw_params.sku) { | 1242 | if (!priv->eeprom_data->sku) { |
1244 | IWL_ERR(priv, "Invalid device sku\n"); | 1243 | IWL_ERR(priv, "Invalid device sku\n"); |
1245 | return -EINVAL; | 1244 | return -EINVAL; |
1246 | } | 1245 | } |
1247 | 1246 | ||
1248 | IWL_INFO(priv, "Device SKU: 0x%X\n", priv->hw_params.sku); | 1247 | IWL_INFO(priv, "Device SKU: 0x%X\n", priv->eeprom_data->sku); |
1249 | 1248 | ||
1250 | radio_cfg = priv->eeprom_data->radio_cfg; | 1249 | radio_cfg = priv->eeprom_data->radio_cfg; |
1251 | 1250 | ||
@@ -1352,6 +1351,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1352 | trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED; | 1351 | trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED; |
1353 | trans_cfg.command_names = iwl_dvm_cmd_strings; | 1352 | trans_cfg.command_names = iwl_dvm_cmd_strings; |
1354 | 1353 | ||
1354 | WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE < | ||
1355 | priv->cfg->base_params->num_of_queues); | ||
1356 | |||
1355 | ucode_flags = fw->ucode_capa.flags; | 1357 | ucode_flags = fw->ucode_capa.flags; |
1356 | 1358 | ||
1357 | #ifndef CONFIG_IWLWIFI_P2P | 1359 | #ifndef CONFIG_IWLWIFI_P2P |
@@ -1448,7 +1450,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1448 | ************************/ | 1450 | ************************/ |
1449 | iwl_set_hw_params(priv); | 1451 | iwl_set_hw_params(priv); |
1450 | 1452 | ||
1451 | if (!(priv->hw_params.sku & EEPROM_SKU_CAP_IPAN_ENABLE)) { | 1453 | if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_IPAN_ENABLE)) { |
1452 | IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); | 1454 | IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); |
1453 | ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; | 1455 | ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; |
1454 | /* | 1456 | /* |
@@ -2073,7 +2075,16 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode) | |||
2073 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | 2075 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | |
2074 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | 2076 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); |
2075 | 2077 | ||
2076 | priv->lib->nic_config(priv); | 2078 | /* W/A : NIC is stuck in a reset state after Early PCIe power off |
2079 | * (PCIe power is lost before PERST# is asserted), | ||
2080 | * causing ME FW to lose ownership and not being able to obtain it back. | ||
2081 | */ | ||
2082 | iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG, | ||
2083 | APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, | ||
2084 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); | ||
2085 | |||
2086 | if (priv->lib->nic_config) | ||
2087 | priv->lib->nic_config(priv); | ||
2077 | } | 2088 | } |
2078 | 2089 | ||
2079 | static void iwl_wimax_active(struct iwl_op_mode *op_mode) | 2090 | static void iwl_wimax_active(struct iwl_op_mode *op_mode) |
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c index 2f271c96ed39..6633074258c7 100644 --- a/drivers/net/wireless/iwlwifi/dvm/scan.c +++ b/drivers/net/wireless/iwlwifi/dvm/scan.c | |||
@@ -51,6 +51,9 @@ | |||
51 | #define IWL_CHANNEL_TUNE_TIME 5 | 51 | #define IWL_CHANNEL_TUNE_TIME 5 |
52 | #define MAX_SCAN_CHANNEL 50 | 52 | #define MAX_SCAN_CHANNEL 50 |
53 | 53 | ||
54 | /* For reset radio, need minimal dwell time only */ | ||
55 | #define IWL_RADIO_RESET_DWELL_TIME 5 | ||
56 | |||
54 | static int iwl_send_scan_abort(struct iwl_priv *priv) | 57 | static int iwl_send_scan_abort(struct iwl_priv *priv) |
55 | { | 58 | { |
56 | int ret; | 59 | int ret; |
@@ -469,45 +472,39 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv, | |||
469 | return 0; | 472 | return 0; |
470 | } | 473 | } |
471 | 474 | ||
472 | static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | 475 | static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv, |
473 | struct ieee80211_vif *vif, | 476 | struct ieee80211_vif *vif, |
474 | enum ieee80211_band band, | 477 | enum ieee80211_band band, |
475 | struct iwl_scan_channel *scan_ch) | 478 | struct iwl_scan_channel *scan_ch) |
476 | { | 479 | { |
477 | const struct ieee80211_supported_band *sband; | 480 | const struct ieee80211_supported_band *sband; |
478 | u16 passive_dwell = 0; | 481 | u16 channel; |
479 | u16 active_dwell = 0; | ||
480 | int added = 0; | ||
481 | u16 channel = 0; | ||
482 | 482 | ||
483 | sband = iwl_get_hw_mode(priv, band); | 483 | sband = iwl_get_hw_mode(priv, band); |
484 | if (!sband) { | 484 | if (!sband) { |
485 | IWL_ERR(priv, "invalid band\n"); | 485 | IWL_ERR(priv, "invalid band\n"); |
486 | return added; | 486 | return 0; |
487 | } | 487 | } |
488 | 488 | ||
489 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | ||
490 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | ||
491 | |||
492 | if (passive_dwell <= active_dwell) | ||
493 | passive_dwell = active_dwell + 1; | ||
494 | |||
495 | channel = iwl_get_single_channel_number(priv, band); | 489 | channel = iwl_get_single_channel_number(priv, band); |
496 | if (channel) { | 490 | if (channel) { |
497 | scan_ch->channel = cpu_to_le16(channel); | 491 | scan_ch->channel = cpu_to_le16(channel); |
498 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; | 492 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; |
499 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 493 | scan_ch->active_dwell = |
500 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | 494 | cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); |
495 | scan_ch->passive_dwell = | ||
496 | cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); | ||
501 | /* Set txpower levels to defaults */ | 497 | /* Set txpower levels to defaults */ |
502 | scan_ch->dsp_atten = 110; | 498 | scan_ch->dsp_atten = 110; |
503 | if (band == IEEE80211_BAND_5GHZ) | 499 | if (band == IEEE80211_BAND_5GHZ) |
504 | scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; | 500 | scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; |
505 | else | 501 | else |
506 | scan_ch->tx_gain = ((1 << 5) | (5 << 3)); | 502 | scan_ch->tx_gain = ((1 << 5) | (5 << 3)); |
507 | added++; | 503 | return 1; |
508 | } else | 504 | } |
509 | IWL_ERR(priv, "no valid channel found\n"); | 505 | |
510 | return added; | 506 | IWL_ERR(priv, "no valid channel found\n"); |
507 | return 0; | ||
511 | } | 508 | } |
512 | 509 | ||
513 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, | 510 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, |
@@ -723,6 +720,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
723 | switch (priv->scan_type) { | 720 | switch (priv->scan_type) { |
724 | case IWL_SCAN_RADIO_RESET: | 721 | case IWL_SCAN_RADIO_RESET: |
725 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); | 722 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); |
723 | /* | ||
724 | * Override quiet time as firmware checks that active | ||
725 | * dwell is >= quiet; since we use passive scan it'll | ||
726 | * not actually be used. | ||
727 | */ | ||
728 | scan->quiet_time = cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); | ||
726 | break; | 729 | break; |
727 | case IWL_SCAN_NORMAL: | 730 | case IWL_SCAN_NORMAL: |
728 | if (priv->scan_request->n_ssids) { | 731 | if (priv->scan_request->n_ssids) { |
@@ -896,7 +899,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
896 | switch (priv->scan_type) { | 899 | switch (priv->scan_type) { |
897 | case IWL_SCAN_RADIO_RESET: | 900 | case IWL_SCAN_RADIO_RESET: |
898 | scan->channel_count = | 901 | scan->channel_count = |
899 | iwl_get_single_channel_for_scan(priv, vif, band, | 902 | iwl_get_channel_for_reset_scan(priv, vif, band, |
900 | (void *)&scan->data[cmd_len]); | 903 | (void *)&scan->data[cmd_len]); |
901 | break; | 904 | break; |
902 | case IWL_SCAN_NORMAL: | 905 | case IWL_SCAN_NORMAL: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c index c87a05cbec12..f10170fe8799 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c | |||
@@ -853,6 +853,9 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, | |||
853 | EEPROM_RADIO_CONFIG); | 853 | EEPROM_RADIO_CONFIG); |
854 | data->sku = iwl_eeprom_query16(eeprom, eeprom_size, | 854 | data->sku = iwl_eeprom_query16(eeprom, eeprom_size, |
855 | EEPROM_SKU_CAP); | 855 | EEPROM_SKU_CAP); |
856 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) | ||
857 | data->sku &= ~EEPROM_SKU_CAP_11N_ENABLE; | ||
858 | |||
856 | data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size, | 859 | data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size, |
857 | EEPROM_VERSION); | 860 | EEPROM_VERSION); |
858 | 861 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c b/drivers/net/wireless/iwlwifi/iwl-notif-wait.c index 5cfed29b1b18..c61f2070f15a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c +++ b/drivers/net/wireless/iwlwifi/iwl-notif-wait.c | |||
@@ -121,13 +121,12 @@ EXPORT_SYMBOL_GPL(iwl_notification_wait_notify); | |||
121 | 121 | ||
122 | void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait) | 122 | void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait) |
123 | { | 123 | { |
124 | unsigned long flags; | ||
125 | struct iwl_notification_wait *wait_entry; | 124 | struct iwl_notification_wait *wait_entry; |
126 | 125 | ||
127 | spin_lock_irqsave(¬if_wait->notif_wait_lock, flags); | 126 | spin_lock(¬if_wait->notif_wait_lock); |
128 | list_for_each_entry(wait_entry, ¬if_wait->notif_waits, list) | 127 | list_for_each_entry(wait_entry, ¬if_wait->notif_waits, list) |
129 | wait_entry->aborted = true; | 128 | wait_entry->aborted = true; |
130 | spin_unlock_irqrestore(¬if_wait->notif_wait_lock, flags); | 129 | spin_unlock(¬if_wait->notif_wait_lock); |
131 | 130 | ||
132 | wake_up_all(¬if_wait->notif_waitq); | 131 | wake_up_all(¬if_wait->notif_waitq); |
133 | } | 132 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h index cd9ef114d3a3..64886f95664f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h | |||
@@ -111,22 +111,25 @@ struct iwl_cfg; | |||
111 | * May sleep | 111 | * May sleep |
112 | * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the | 112 | * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the |
113 | * HCMD the this Rx responds to. | 113 | * HCMD the this Rx responds to. |
114 | * Must be atomic. | 114 | * Must be atomic and called with BH disabled. |
115 | * @queue_full: notifies that a HW queue is full. | 115 | * @queue_full: notifies that a HW queue is full. |
116 | * Must be atomic | 116 | * Must be atomic and called with BH disabled. |
117 | * @queue_not_full: notifies that a HW queue is not full any more. | 117 | * @queue_not_full: notifies that a HW queue is not full any more. |
118 | * Must be atomic | 118 | * Must be atomic and called with BH disabled. |
119 | * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that | 119 | * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that |
120 | * the radio is killed. Must be atomic. | 120 | * the radio is killed. Must be atomic. |
121 | * @free_skb: allows the transport layer to free skbs that haven't been | 121 | * @free_skb: allows the transport layer to free skbs that haven't been |
122 | * reclaimed by the op_mode. This can happen when the driver is freed and | 122 | * reclaimed by the op_mode. This can happen when the driver is freed and |
123 | * there are Tx packets pending in the transport layer. | 123 | * there are Tx packets pending in the transport layer. |
124 | * Must be atomic | 124 | * Must be atomic |
125 | * @nic_error: error notification. Must be atomic | 125 | * @nic_error: error notification. Must be atomic and must be called with BH |
126 | * @cmd_queue_full: Called when the command queue gets full. Must be atomic. | 126 | * disabled. |
127 | * @cmd_queue_full: Called when the command queue gets full. Must be atomic and | ||
128 | * called with BH disabled. | ||
127 | * @nic_config: configure NIC, called before firmware is started. | 129 | * @nic_config: configure NIC, called before firmware is started. |
128 | * May sleep | 130 | * May sleep |
129 | * @wimax_active: invoked when WiMax becomes active. Must be atomic. | 131 | * @wimax_active: invoked when WiMax becomes active. Must be atomic and called |
132 | * with BH disabled. | ||
130 | */ | 133 | */ |
131 | struct iwl_op_mode_ops { | 134 | struct iwl_op_mode_ops { |
132 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, | 135 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, |
@@ -165,7 +168,6 @@ struct iwl_op_mode { | |||
165 | static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode) | 168 | static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode) |
166 | { | 169 | { |
167 | might_sleep(); | 170 | might_sleep(); |
168 | |||
169 | op_mode->ops->stop(op_mode); | 171 | op_mode->ops->stop(op_mode); |
170 | } | 172 | } |
171 | 173 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index d6860c070c16..be143eb4aa4f 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -867,24 +867,23 @@ void iwl_disable_ict(struct iwl_trans *trans) | |||
867 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 867 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
868 | } | 868 | } |
869 | 869 | ||
870 | /* legacy (non-ICT) ISR. Assumes that trans_pcie->irq_lock is held */ | ||
870 | static irqreturn_t iwl_isr(int irq, void *data) | 871 | static irqreturn_t iwl_isr(int irq, void *data) |
871 | { | 872 | { |
872 | struct iwl_trans *trans = data; | 873 | struct iwl_trans *trans = data; |
873 | struct iwl_trans_pcie *trans_pcie; | 874 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
874 | u32 inta, inta_mask; | 875 | u32 inta, inta_mask; |
875 | unsigned long flags; | ||
876 | #ifdef CONFIG_IWLWIFI_DEBUG | 876 | #ifdef CONFIG_IWLWIFI_DEBUG |
877 | u32 inta_fh; | 877 | u32 inta_fh; |
878 | #endif | 878 | #endif |
879 | |||
880 | lockdep_assert_held(&trans_pcie->irq_lock); | ||
881 | |||
879 | if (!trans) | 882 | if (!trans) |
880 | return IRQ_NONE; | 883 | return IRQ_NONE; |
881 | 884 | ||
882 | trace_iwlwifi_dev_irq(trans->dev); | 885 | trace_iwlwifi_dev_irq(trans->dev); |
883 | 886 | ||
884 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
885 | |||
886 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | ||
887 | |||
888 | /* Disable (but don't clear!) interrupts here to avoid | 887 | /* Disable (but don't clear!) interrupts here to avoid |
889 | * back-to-back ISRs and sporadic interrupts from our NIC. | 888 | * back-to-back ISRs and sporadic interrupts from our NIC. |
890 | * If we have something to service, the tasklet will re-enable ints. | 889 | * If we have something to service, the tasklet will re-enable ints. |
@@ -907,7 +906,7 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
907 | /* Hardware disappeared. It might have already raised | 906 | /* Hardware disappeared. It might have already raised |
908 | * an interrupt */ | 907 | * an interrupt */ |
909 | IWL_WARN(trans, "HARDWARE GONE?? INTA == 0x%08x\n", inta); | 908 | IWL_WARN(trans, "HARDWARE GONE?? INTA == 0x%08x\n", inta); |
910 | goto unplugged; | 909 | return IRQ_HANDLED; |
911 | } | 910 | } |
912 | 911 | ||
913 | #ifdef CONFIG_IWLWIFI_DEBUG | 912 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -926,18 +925,13 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
926 | !trans_pcie->inta) | 925 | !trans_pcie->inta) |
927 | iwl_enable_interrupts(trans); | 926 | iwl_enable_interrupts(trans); |
928 | 927 | ||
929 | unplugged: | 928 | none: |
930 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | ||
931 | return IRQ_HANDLED; | ||
932 | |||
933 | none: | ||
934 | /* re-enable interrupts here since we don't have anything to service. */ | 929 | /* re-enable interrupts here since we don't have anything to service. */ |
935 | /* only Re-enable if disabled by irq and no schedules tasklet. */ | 930 | /* only Re-enable if disabled by irq and no schedules tasklet. */ |
936 | if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && | 931 | if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && |
937 | !trans_pcie->inta) | 932 | !trans_pcie->inta) |
938 | iwl_enable_interrupts(trans); | 933 | iwl_enable_interrupts(trans); |
939 | 934 | ||
940 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | ||
941 | return IRQ_NONE; | 935 | return IRQ_NONE; |
942 | } | 936 | } |
943 | 937 | ||
@@ -963,15 +957,19 @@ irqreturn_t iwl_isr_ict(int irq, void *data) | |||
963 | 957 | ||
964 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 958 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
965 | 959 | ||
960 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | ||
961 | |||
966 | /* dram interrupt table not set yet, | 962 | /* dram interrupt table not set yet, |
967 | * use legacy interrupt. | 963 | * use legacy interrupt. |
968 | */ | 964 | */ |
969 | if (!trans_pcie->use_ict) | 965 | if (unlikely(!trans_pcie->use_ict)) { |
970 | return iwl_isr(irq, data); | 966 | irqreturn_t ret = iwl_isr(irq, data); |
967 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | ||
968 | return ret; | ||
969 | } | ||
971 | 970 | ||
972 | trace_iwlwifi_dev_irq(trans->dev); | 971 | trace_iwlwifi_dev_irq(trans->dev); |
973 | 972 | ||
974 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | ||
975 | 973 | ||
976 | /* Disable (but don't clear!) interrupts here to avoid | 974 | /* Disable (but don't clear!) interrupts here to avoid |
977 | * back-to-back ISRs and sporadic interrupts from our NIC. | 975 | * back-to-back ISRs and sporadic interrupts from our NIC. |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 32ab8ea56135..d1950838f17f 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -296,6 +296,7 @@ static void iwlagn_free_dma_ptr(struct iwl_trans *trans, | |||
296 | static void iwl_trans_pcie_queue_stuck_timer(unsigned long data) | 296 | static void iwl_trans_pcie_queue_stuck_timer(unsigned long data) |
297 | { | 297 | { |
298 | struct iwl_tx_queue *txq = (void *)data; | 298 | struct iwl_tx_queue *txq = (void *)data; |
299 | struct iwl_queue *q = &txq->q; | ||
299 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; | 300 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; |
300 | struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); | 301 | struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); |
301 | u32 scd_sram_addr = trans_pcie->scd_base_addr + | 302 | u32 scd_sram_addr = trans_pcie->scd_base_addr + |
@@ -346,6 +347,14 @@ static void iwl_trans_pcie_queue_stuck_timer(unsigned long data) | |||
346 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); | 347 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); |
347 | } | 348 | } |
348 | 349 | ||
350 | for (i = q->read_ptr; i != q->write_ptr; | ||
351 | i = iwl_queue_inc_wrap(i, q->n_bd)) { | ||
352 | struct iwl_tx_cmd *tx_cmd = | ||
353 | (struct iwl_tx_cmd *)txq->entries[i].cmd->payload; | ||
354 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, | ||
355 | get_unaligned_le32(&tx_cmd->scratch)); | ||
356 | } | ||
357 | |||
349 | iwl_op_mode_nic_error(trans->op_mode); | 358 | iwl_op_mode_nic_error(trans->op_mode); |
350 | } | 359 | } |
351 | 360 | ||
@@ -1037,15 +1046,12 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
1037 | 1046 | ||
1038 | /* | 1047 | /* |
1039 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask | 1048 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask |
1040 | * must be called under the irq lock and with MAC access | ||
1041 | */ | 1049 | */ |
1042 | static void iwl_trans_txq_set_sched(struct iwl_trans *trans, u32 mask) | 1050 | static void iwl_trans_txq_set_sched(struct iwl_trans *trans, u32 mask) |
1043 | { | 1051 | { |
1044 | struct iwl_trans_pcie __maybe_unused *trans_pcie = | 1052 | struct iwl_trans_pcie __maybe_unused *trans_pcie = |
1045 | IWL_TRANS_GET_PCIE_TRANS(trans); | 1053 | IWL_TRANS_GET_PCIE_TRANS(trans); |
1046 | 1054 | ||
1047 | lockdep_assert_held(&trans_pcie->irq_lock); | ||
1048 | |||
1049 | iwl_write_prph(trans, SCD_TXFACT, mask); | 1055 | iwl_write_prph(trans, SCD_TXFACT, mask); |
1050 | } | 1056 | } |
1051 | 1057 | ||
@@ -1053,12 +1059,9 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
1053 | { | 1059 | { |
1054 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 1060 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
1055 | u32 a; | 1061 | u32 a; |
1056 | unsigned long flags; | ||
1057 | int i, chan; | 1062 | int i, chan; |
1058 | u32 reg_val; | 1063 | u32 reg_val; |
1059 | 1064 | ||
1060 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | ||
1061 | |||
1062 | /* make sure all queue are not stopped/used */ | 1065 | /* make sure all queue are not stopped/used */ |
1063 | memset(trans_pcie->queue_stopped, 0, sizeof(trans_pcie->queue_stopped)); | 1066 | memset(trans_pcie->queue_stopped, 0, sizeof(trans_pcie->queue_stopped)); |
1064 | memset(trans_pcie->queue_used, 0, sizeof(trans_pcie->queue_used)); | 1067 | memset(trans_pcie->queue_used, 0, sizeof(trans_pcie->queue_used)); |
@@ -1109,8 +1112,6 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
1109 | iwl_write_direct32(trans, FH_TX_CHICKEN_BITS_REG, | 1112 | iwl_write_direct32(trans, FH_TX_CHICKEN_BITS_REG, |
1110 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); | 1113 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); |
1111 | 1114 | ||
1112 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | ||
1113 | |||
1114 | /* Enable L1-Active */ | 1115 | /* Enable L1-Active */ |
1115 | iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG, | 1116 | iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG, |
1116 | APMG_PCIDEV_STT_VAL_L1_ACT_DIS); | 1117 | APMG_PCIDEV_STT_VAL_L1_ACT_DIS); |
@@ -2017,7 +2018,9 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file, | |||
2017 | if (!trans->op_mode) | 2018 | if (!trans->op_mode) |
2018 | return -EAGAIN; | 2019 | return -EAGAIN; |
2019 | 2020 | ||
2021 | local_bh_disable(); | ||
2020 | iwl_op_mode_nic_error(trans->op_mode); | 2022 | iwl_op_mode_nic_error(trans->op_mode); |
2023 | local_bh_enable(); | ||
2021 | 2024 | ||
2022 | return count; | 2025 | return count; |
2023 | } | 2026 | } |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index a9ba3f7ea62b..f578d0b2172d 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -678,8 +678,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, | |||
678 | continue; | 678 | continue; |
679 | 679 | ||
680 | if (data2->idle || !data2->started || | 680 | if (data2->idle || !data2->started || |
681 | !hwsim_ps_rx_ok(data2, skb) || | 681 | !hwsim_ps_rx_ok(data2, skb) || !data2->channel || |
682 | !data->channel || !data2->channel || | ||
683 | data->channel->center_freq != data2->channel->center_freq || | 682 | data->channel->center_freq != data2->channel->center_freq || |
684 | !(data->group & data2->group)) | 683 | !(data->group & data2->group)) |
685 | continue; | 684 | continue; |
@@ -1486,7 +1485,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, | |||
1486 | struct mac80211_hwsim_data *data2; | 1485 | struct mac80211_hwsim_data *data2; |
1487 | struct ieee80211_tx_info *txi; | 1486 | struct ieee80211_tx_info *txi; |
1488 | struct hwsim_tx_rate *tx_attempts; | 1487 | struct hwsim_tx_rate *tx_attempts; |
1489 | struct sk_buff __user *ret_skb; | 1488 | unsigned long ret_skb_ptr; |
1490 | struct sk_buff *skb, *tmp; | 1489 | struct sk_buff *skb, *tmp; |
1491 | struct mac_address *src; | 1490 | struct mac_address *src; |
1492 | unsigned int hwsim_flags; | 1491 | unsigned int hwsim_flags; |
@@ -1504,8 +1503,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, | |||
1504 | info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER]); | 1503 | info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER]); |
1505 | hwsim_flags = nla_get_u32(info->attrs[HWSIM_ATTR_FLAGS]); | 1504 | hwsim_flags = nla_get_u32(info->attrs[HWSIM_ATTR_FLAGS]); |
1506 | 1505 | ||
1507 | ret_skb = (struct sk_buff __user *) | 1506 | ret_skb_ptr = nla_get_u64(info->attrs[HWSIM_ATTR_COOKIE]); |
1508 | (unsigned long) nla_get_u64(info->attrs[HWSIM_ATTR_COOKIE]); | ||
1509 | 1507 | ||
1510 | data2 = get_hwsim_data_ref_from_addr(src); | 1508 | data2 = get_hwsim_data_ref_from_addr(src); |
1511 | 1509 | ||
@@ -1514,7 +1512,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, | |||
1514 | 1512 | ||
1515 | /* look for the skb matching the cookie passed back from user */ | 1513 | /* look for the skb matching the cookie passed back from user */ |
1516 | skb_queue_walk_safe(&data2->pending, skb, tmp) { | 1514 | skb_queue_walk_safe(&data2->pending, skb, tmp) { |
1517 | if (skb == ret_skb) { | 1515 | if ((unsigned long)skb == ret_skb_ptr) { |
1518 | skb_unlink(skb, &data2->pending); | 1516 | skb_unlink(skb, &data2->pending); |
1519 | found = true; | 1517 | found = true; |
1520 | break; | 1518 | break; |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 80e9b2a39058..4b2733af1a0e 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -170,7 +170,9 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev, | |||
170 | if (!priv->sec_info.wep_enabled) | 170 | if (!priv->sec_info.wep_enabled) |
171 | return 0; | 171 | return 0; |
172 | 172 | ||
173 | if (mwifiex_set_encode(priv, NULL, 0, key_index, NULL, 0)) { | 173 | if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { |
174 | priv->wep_key_curr_index = key_index; | ||
175 | } else if (mwifiex_set_encode(priv, NULL, 0, key_index, NULL, 0)) { | ||
174 | wiphy_err(wiphy, "set default Tx key index\n"); | 176 | wiphy_err(wiphy, "set default Tx key index\n"); |
175 | return -EFAULT; | 177 | return -EFAULT; |
176 | } | 178 | } |
@@ -187,9 +189,25 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
187 | struct key_params *params) | 189 | struct key_params *params) |
188 | { | 190 | { |
189 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); | 191 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); |
192 | struct mwifiex_wep_key *wep_key; | ||
190 | const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 193 | const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
191 | const u8 *peer_mac = pairwise ? mac_addr : bc_mac; | 194 | const u8 *peer_mac = pairwise ? mac_addr : bc_mac; |
192 | 195 | ||
196 | if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP && | ||
197 | (params->cipher == WLAN_CIPHER_SUITE_WEP40 || | ||
198 | params->cipher == WLAN_CIPHER_SUITE_WEP104)) { | ||
199 | if (params->key && params->key_len) { | ||
200 | wep_key = &priv->wep_key[key_index]; | ||
201 | memset(wep_key, 0, sizeof(struct mwifiex_wep_key)); | ||
202 | memcpy(wep_key->key_material, params->key, | ||
203 | params->key_len); | ||
204 | wep_key->key_index = key_index; | ||
205 | wep_key->key_length = params->key_len; | ||
206 | priv->sec_info.wep_enabled = 1; | ||
207 | } | ||
208 | return 0; | ||
209 | } | ||
210 | |||
193 | if (mwifiex_set_encode(priv, params->key, params->key_len, | 211 | if (mwifiex_set_encode(priv, params->key, params->key_len, |
194 | key_index, peer_mac, 0)) { | 212 | key_index, peer_mac, 0)) { |
195 | wiphy_err(wiphy, "crypto keys added\n"); | 213 | wiphy_err(wiphy, "crypto keys added\n"); |
@@ -242,13 +260,13 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) | |||
242 | flag = 1; | 260 | flag = 1; |
243 | first_chan = (u32) ch->hw_value; | 261 | first_chan = (u32) ch->hw_value; |
244 | next_chan = first_chan; | 262 | next_chan = first_chan; |
245 | max_pwr = ch->max_power; | 263 | max_pwr = ch->max_reg_power; |
246 | no_of_parsed_chan = 1; | 264 | no_of_parsed_chan = 1; |
247 | continue; | 265 | continue; |
248 | } | 266 | } |
249 | 267 | ||
250 | if (ch->hw_value == next_chan + 1 && | 268 | if (ch->hw_value == next_chan + 1 && |
251 | ch->max_power == max_pwr) { | 269 | ch->max_reg_power == max_pwr) { |
252 | next_chan++; | 270 | next_chan++; |
253 | no_of_parsed_chan++; | 271 | no_of_parsed_chan++; |
254 | } else { | 272 | } else { |
@@ -259,7 +277,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) | |||
259 | no_of_triplet++; | 277 | no_of_triplet++; |
260 | first_chan = (u32) ch->hw_value; | 278 | first_chan = (u32) ch->hw_value; |
261 | next_chan = first_chan; | 279 | next_chan = first_chan; |
262 | max_pwr = ch->max_power; | 280 | max_pwr = ch->max_reg_power; |
263 | no_of_parsed_chan = 1; | 281 | no_of_parsed_chan = 1; |
264 | } | 282 | } |
265 | } | 283 | } |
@@ -384,13 +402,13 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, | |||
384 | cfp.freq = chan->center_freq; | 402 | cfp.freq = chan->center_freq; |
385 | cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); | 403 | cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); |
386 | 404 | ||
387 | if (mwifiex_bss_set_channel(priv, &cfp)) | 405 | if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) { |
388 | return -EFAULT; | 406 | if (mwifiex_bss_set_channel(priv, &cfp)) |
389 | 407 | return -EFAULT; | |
390 | if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) | ||
391 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); | 408 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); |
392 | else | 409 | } |
393 | return mwifiex_uap_set_channel(priv, cfp.channel); | 410 | |
411 | return 0; | ||
394 | } | 412 | } |
395 | 413 | ||
396 | /* | 414 | /* |
@@ -961,12 +979,25 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
961 | return -EINVAL; | 979 | return -EINVAL; |
962 | } | 980 | } |
963 | 981 | ||
982 | bss_cfg->channel = | ||
983 | (u8)ieee80211_frequency_to_channel(params->channel->center_freq); | ||
984 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; | ||
985 | |||
986 | if (mwifiex_set_rf_channel(priv, params->channel, | ||
987 | params->channel_type)) { | ||
988 | kfree(bss_cfg); | ||
989 | wiphy_err(wiphy, "Failed to set band config information!\n"); | ||
990 | return -1; | ||
991 | } | ||
992 | |||
964 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { | 993 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { |
965 | kfree(bss_cfg); | 994 | kfree(bss_cfg); |
966 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); | 995 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); |
967 | return -1; | 996 | return -1; |
968 | } | 997 | } |
969 | 998 | ||
999 | mwifiex_set_ht_params(priv, bss_cfg, params); | ||
1000 | |||
970 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, | 1001 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, |
971 | HostCmd_ACT_GEN_SET, 0, NULL)) { | 1002 | HostCmd_ACT_GEN_SET, 0, NULL)) { |
972 | wiphy_err(wiphy, "Failed to stop the BSS\n"); | 1003 | wiphy_err(wiphy, "Failed to stop the BSS\n"); |
@@ -990,6 +1021,16 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
990 | return -1; | 1021 | return -1; |
991 | } | 1022 | } |
992 | 1023 | ||
1024 | if (priv->sec_info.wep_enabled) | ||
1025 | priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE; | ||
1026 | else | ||
1027 | priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE; | ||
1028 | |||
1029 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL, | ||
1030 | HostCmd_ACT_GEN_SET, 0, | ||
1031 | &priv->curr_pkt_filter)) | ||
1032 | return -1; | ||
1033 | |||
993 | return 0; | 1034 | return 0; |
994 | } | 1035 | } |
995 | 1036 | ||
@@ -1381,7 +1422,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, | |||
1381 | 1422 | ||
1382 | priv->user_scan_cfg->chan_list[i].scan_time = 0; | 1423 | priv->user_scan_cfg->chan_list[i].scan_time = 0; |
1383 | } | 1424 | } |
1384 | if (mwifiex_set_user_scan_ioctl(priv, priv->user_scan_cfg)) | 1425 | if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) |
1385 | return -EFAULT; | 1426 | return -EFAULT; |
1386 | 1427 | ||
1387 | if (request->ie && request->ie_len) { | 1428 | if (request->ie && request->ie_len) { |
@@ -1702,7 +1743,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) | |||
1702 | 1743 | ||
1703 | memcpy(wiphy->perm_addr, priv->curr_addr, ETH_ALEN); | 1744 | memcpy(wiphy->perm_addr, priv->curr_addr, ETH_ALEN); |
1704 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; | 1745 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
1705 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | WIPHY_FLAG_CUSTOM_REGULATORY; | 1746 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; |
1706 | 1747 | ||
1707 | /* Reserve space for mwifiex specific private data for BSS */ | 1748 | /* Reserve space for mwifiex specific private data for BSS */ |
1708 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); | 1749 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 51e023ec1de4..c68adec3cc8b 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -578,6 +578,7 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, | |||
578 | } else { | 578 | } else { |
579 | adapter->cmd_queued = cmd_node; | 579 | adapter->cmd_queued = cmd_node; |
580 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); | 580 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); |
581 | queue_work(adapter->workqueue, &adapter->main_work); | ||
581 | } | 582 | } |
582 | 583 | ||
583 | return ret; | 584 | return ret; |
@@ -1102,7 +1103,8 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, | |||
1102 | &resp->params.opt_hs_cfg; | 1103 | &resp->params.opt_hs_cfg; |
1103 | uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); | 1104 | uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); |
1104 | 1105 | ||
1105 | if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE)) { | 1106 | if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && |
1107 | adapter->iface_type == MWIFIEX_SDIO) { | ||
1106 | mwifiex_hs_activated_event(priv, true); | 1108 | mwifiex_hs_activated_event(priv, true); |
1107 | return 0; | 1109 | return 0; |
1108 | } else { | 1110 | } else { |
@@ -1114,6 +1116,9 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, | |||
1114 | } | 1116 | } |
1115 | if (conditions != HOST_SLEEP_CFG_CANCEL) { | 1117 | if (conditions != HOST_SLEEP_CFG_CANCEL) { |
1116 | adapter->is_hs_configured = true; | 1118 | adapter->is_hs_configured = true; |
1119 | if (adapter->iface_type == MWIFIEX_USB || | ||
1120 | adapter->iface_type == MWIFIEX_PCIE) | ||
1121 | mwifiex_hs_activated_event(priv, true); | ||
1117 | } else { | 1122 | } else { |
1118 | adapter->is_hs_configured = false; | 1123 | adapter->is_hs_configured = false; |
1119 | if (adapter->hs_activated) | 1124 | if (adapter->hs_activated) |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 561452a5c818..ffb6cdfdb797 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -124,6 +124,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
124 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) | 124 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) |
125 | #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) | 125 | #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) |
126 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) | 126 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) |
127 | #define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 59) | ||
127 | #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) | 128 | #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) |
128 | #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) | 129 | #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) |
129 | #define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 65) | 130 | #define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 65) |
@@ -162,6 +163,12 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
162 | 163 | ||
163 | #define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11)) | 164 | #define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11)) |
164 | 165 | ||
166 | #define MWIFIEX_DEF_HT_CAP (IEEE80211_HT_CAP_DSSSCCK40 | \ | ||
167 | (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \ | ||
168 | IEEE80211_HT_CAP_SM_PS) | ||
169 | |||
170 | #define MWIFIEX_DEF_AMPDU IEEE80211_HT_AMPDU_PARM_FACTOR | ||
171 | |||
165 | /* dev_cap bitmap | 172 | /* dev_cap bitmap |
166 | * BIT | 173 | * BIT |
167 | * 0-16 reserved | 174 | * 0-16 reserved |
@@ -219,6 +226,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
219 | #define HostCmd_CMD_RF_REG_ACCESS 0x001b | 226 | #define HostCmd_CMD_RF_REG_ACCESS 0x001b |
220 | #define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad | 227 | #define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad |
221 | #define HostCmd_CMD_802_11_RF_CHANNEL 0x001d | 228 | #define HostCmd_CMD_802_11_RF_CHANNEL 0x001d |
229 | #define HostCmd_CMD_RF_TX_PWR 0x001e | ||
222 | #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 | 230 | #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 |
223 | #define HostCmd_CMD_MAC_CONTROL 0x0028 | 231 | #define HostCmd_CMD_MAC_CONTROL 0x0028 |
224 | #define HostCmd_CMD_802_11_AD_HOC_START 0x002b | 232 | #define HostCmd_CMD_802_11_AD_HOC_START 0x002b |
@@ -869,6 +877,13 @@ struct host_cmd_ds_txpwr_cfg { | |||
869 | __le32 mode; | 877 | __le32 mode; |
870 | } __packed; | 878 | } __packed; |
871 | 879 | ||
880 | struct host_cmd_ds_rf_tx_pwr { | ||
881 | __le16 action; | ||
882 | __le16 cur_level; | ||
883 | u8 max_power; | ||
884 | u8 min_power; | ||
885 | } __packed; | ||
886 | |||
872 | struct mwifiex_bcn_param { | 887 | struct mwifiex_bcn_param { |
873 | u8 bssid[ETH_ALEN]; | 888 | u8 bssid[ETH_ALEN]; |
874 | u8 rssi; | 889 | u8 rssi; |
@@ -1195,6 +1210,13 @@ struct host_cmd_tlv_passphrase { | |||
1195 | u8 passphrase[0]; | 1210 | u8 passphrase[0]; |
1196 | } __packed; | 1211 | } __packed; |
1197 | 1212 | ||
1213 | struct host_cmd_tlv_wep_key { | ||
1214 | struct host_cmd_tlv tlv; | ||
1215 | u8 key_index; | ||
1216 | u8 is_default; | ||
1217 | u8 key[1]; | ||
1218 | }; | ||
1219 | |||
1198 | struct host_cmd_tlv_auth_type { | 1220 | struct host_cmd_tlv_auth_type { |
1199 | struct host_cmd_tlv tlv; | 1221 | struct host_cmd_tlv tlv; |
1200 | u8 auth_type; | 1222 | u8 auth_type; |
@@ -1347,6 +1369,7 @@ struct host_cmd_ds_command { | |||
1347 | struct host_cmd_ds_tx_rate_query tx_rate; | 1369 | struct host_cmd_ds_tx_rate_query tx_rate; |
1348 | struct host_cmd_ds_tx_rate_cfg tx_rate_cfg; | 1370 | struct host_cmd_ds_tx_rate_cfg tx_rate_cfg; |
1349 | struct host_cmd_ds_txpwr_cfg txp_cfg; | 1371 | struct host_cmd_ds_txpwr_cfg txp_cfg; |
1372 | struct host_cmd_ds_rf_tx_pwr txp; | ||
1350 | struct host_cmd_ds_802_11_ps_mode_enh psmode_enh; | 1373 | struct host_cmd_ds_802_11_ps_mode_enh psmode_enh; |
1351 | struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg; | 1374 | struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg; |
1352 | struct host_cmd_ds_802_11_scan scan; | 1375 | struct host_cmd_ds_802_11_scan scan; |
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c index 383820a52beb..8374e33f195a 100644 --- a/drivers/net/wireless/mwifiex/ie.c +++ b/drivers/net/wireless/mwifiex/ie.c | |||
@@ -225,29 +225,46 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, | |||
225 | struct cfg80211_ap_settings *params) | 225 | struct cfg80211_ap_settings *params) |
226 | { | 226 | { |
227 | struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL; | 227 | struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL; |
228 | struct mwifiex_ie *ar_ie = NULL, *rsn_ie = NULL; | 228 | struct mwifiex_ie *ar_ie = NULL, *gen_ie = NULL; |
229 | struct ieee_types_header *ie = NULL; | 229 | struct ieee_types_header *rsn_ie = NULL, *wpa_ie = NULL; |
230 | u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK; | 230 | u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK; |
231 | u16 ar_idx = MWIFIEX_AUTO_IDX_MASK, rsn_idx = MWIFIEX_AUTO_IDX_MASK; | 231 | u16 ar_idx = MWIFIEX_AUTO_IDX_MASK, rsn_idx = MWIFIEX_AUTO_IDX_MASK; |
232 | u16 mask; | 232 | u16 mask, ie_len = 0; |
233 | const u8 *vendor_ie; | ||
233 | int ret = 0; | 234 | int ret = 0; |
234 | 235 | ||
235 | if (params->beacon.tail && params->beacon.tail_len) { | 236 | if (params->beacon.tail && params->beacon.tail_len) { |
236 | ie = (void *)cfg80211_find_ie(WLAN_EID_RSN, params->beacon.tail, | 237 | gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); |
237 | params->beacon.tail_len); | 238 | if (!gen_ie) |
238 | if (ie) { | 239 | return -ENOMEM; |
239 | rsn_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); | 240 | gen_ie->ie_index = cpu_to_le16(rsn_idx); |
240 | if (!rsn_ie) | 241 | mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP | |
241 | return -ENOMEM; | 242 | MGMT_MASK_ASSOC_RESP; |
242 | 243 | gen_ie->mgmt_subtype_mask = cpu_to_le16(mask); | |
243 | rsn_ie->ie_index = cpu_to_le16(rsn_idx); | 244 | |
244 | mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP | | 245 | rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN, |
245 | MGMT_MASK_ASSOC_RESP; | 246 | params->beacon.tail, |
246 | rsn_ie->mgmt_subtype_mask = cpu_to_le16(mask); | 247 | params->beacon.tail_len); |
247 | rsn_ie->ie_length = cpu_to_le16(ie->len + 2); | 248 | if (rsn_ie) { |
248 | memcpy(rsn_ie->ie_buffer, ie, ie->len + 2); | 249 | memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2); |
249 | 250 | ie_len = rsn_ie->len + 2; | |
250 | if (mwifiex_update_uap_custom_ie(priv, rsn_ie, &rsn_idx, | 251 | gen_ie->ie_length = cpu_to_le16(ie_len); |
252 | } | ||
253 | |||
254 | vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, | ||
255 | WLAN_OUI_TYPE_MICROSOFT_WPA, | ||
256 | params->beacon.tail, | ||
257 | params->beacon.tail_len); | ||
258 | if (vendor_ie) { | ||
259 | wpa_ie = (struct ieee_types_header *)vendor_ie; | ||
260 | memcpy(gen_ie->ie_buffer + ie_len, | ||
261 | wpa_ie, wpa_ie->len + 2); | ||
262 | ie_len += wpa_ie->len + 2; | ||
263 | gen_ie->ie_length = cpu_to_le16(ie_len); | ||
264 | } | ||
265 | |||
266 | if (rsn_ie || wpa_ie) { | ||
267 | if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx, | ||
251 | NULL, NULL, | 268 | NULL, NULL, |
252 | NULL, NULL)) { | 269 | NULL, NULL)) { |
253 | ret = -1; | 270 | ret = -1; |
@@ -320,7 +337,7 @@ done: | |||
320 | kfree(beacon_ie); | 337 | kfree(beacon_ie); |
321 | kfree(pr_ie); | 338 | kfree(pr_ie); |
322 | kfree(ar_ie); | 339 | kfree(ar_ie); |
323 | kfree(rsn_ie); | 340 | kfree(gen_ie); |
324 | 341 | ||
325 | return ret; | 342 | return ret; |
326 | } | 343 | } |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index 0f18ef6a30c8..b543a4d82ff3 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -103,6 +103,7 @@ static void scan_delay_timer_fn(unsigned long data) | |||
103 | msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC)); | 103 | msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC)); |
104 | adapter->scan_delay_cnt++; | 104 | adapter->scan_delay_cnt++; |
105 | } | 105 | } |
106 | queue_work(priv->adapter->workqueue, &priv->adapter->main_work); | ||
106 | } else { | 107 | } else { |
107 | /* | 108 | /* |
108 | * Tx data queue is empty. Get scan command from scan_pending_q | 109 | * Tx data queue is empty. Get scan command from scan_pending_q |
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index e6be6ee75951..9f088fb88cb7 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define _MWIFIEX_IOCTL_H_ | 21 | #define _MWIFIEX_IOCTL_H_ |
22 | 22 | ||
23 | #include <net/mac80211.h> | 23 | #include <net/mac80211.h> |
24 | #include <net/lib80211.h> | ||
24 | 25 | ||
25 | enum { | 26 | enum { |
26 | MWIFIEX_SCAN_TYPE_UNCHANGED = 0, | 27 | MWIFIEX_SCAN_TYPE_UNCHANGED = 0, |
@@ -71,6 +72,13 @@ struct wpa_param { | |||
71 | u8 passphrase[MWIFIEX_WPA_PASSHPHRASE_LEN]; | 72 | u8 passphrase[MWIFIEX_WPA_PASSHPHRASE_LEN]; |
72 | }; | 73 | }; |
73 | 74 | ||
75 | struct wep_key { | ||
76 | u8 key_index; | ||
77 | u8 is_default; | ||
78 | u16 length; | ||
79 | u8 key[WLAN_KEY_LEN_WEP104]; | ||
80 | }; | ||
81 | |||
74 | #define KEY_MGMT_ON_HOST 0x03 | 82 | #define KEY_MGMT_ON_HOST 0x03 |
75 | #define MWIFIEX_AUTH_MODE_AUTO 0xFF | 83 | #define MWIFIEX_AUTH_MODE_AUTO 0xFF |
76 | #define BAND_CONFIG_MANUAL 0x00 | 84 | #define BAND_CONFIG_MANUAL 0x00 |
@@ -90,6 +98,8 @@ struct mwifiex_uap_bss_param { | |||
90 | u16 key_mgmt; | 98 | u16 key_mgmt; |
91 | u16 key_mgmt_operation; | 99 | u16 key_mgmt_operation; |
92 | struct wpa_param wpa_cfg; | 100 | struct wpa_param wpa_cfg; |
101 | struct wep_key wep_cfg[NUM_WEP_KEYS]; | ||
102 | struct ieee80211_ht_cap ht_cap; | ||
93 | }; | 103 | }; |
94 | 104 | ||
95 | enum { | 105 | enum { |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 0f06f07a70e6..f0219efc8953 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -190,7 +190,8 @@ process_start: | |||
190 | adapter->tx_lock_flag) | 190 | adapter->tx_lock_flag) |
191 | break; | 191 | break; |
192 | 192 | ||
193 | if (adapter->scan_processing || adapter->data_sent || | 193 | if ((adapter->scan_processing && |
194 | !adapter->scan_delay_cnt) || adapter->data_sent || | ||
194 | mwifiex_wmm_lists_empty(adapter)) { | 195 | mwifiex_wmm_lists_empty(adapter)) { |
195 | if (adapter->cmd_sent || adapter->curr_cmd || | 196 | if (adapter->cmd_sent || adapter->curr_cmd || |
196 | (!is_command_pending(adapter))) | 197 | (!is_command_pending(adapter))) |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 5b32221077c4..7cd95cc99a85 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -840,6 +840,9 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, | |||
840 | int mwifiex_set_secure_params(struct mwifiex_private *priv, | 840 | int mwifiex_set_secure_params(struct mwifiex_private *priv, |
841 | struct mwifiex_uap_bss_param *bss_config, | 841 | struct mwifiex_uap_bss_param *bss_config, |
842 | struct cfg80211_ap_settings *params); | 842 | struct cfg80211_ap_settings *params); |
843 | void mwifiex_set_ht_params(struct mwifiex_private *priv, | ||
844 | struct mwifiex_uap_bss_param *bss_cfg, | ||
845 | struct cfg80211_ap_settings *params); | ||
843 | 846 | ||
844 | /* | 847 | /* |
845 | * This function checks if the queuing is RA based or not. | 848 | * This function checks if the queuing is RA based or not. |
@@ -946,8 +949,8 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, | |||
946 | struct mwifiex_rate_cfg *rate); | 949 | struct mwifiex_rate_cfg *rate); |
947 | int mwifiex_request_scan(struct mwifiex_private *priv, | 950 | int mwifiex_request_scan(struct mwifiex_private *priv, |
948 | struct cfg80211_ssid *req_ssid); | 951 | struct cfg80211_ssid *req_ssid); |
949 | int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv, | 952 | int mwifiex_scan_networks(struct mwifiex_private *priv, |
950 | struct mwifiex_user_scan_cfg *scan_req); | 953 | const struct mwifiex_user_scan_cfg *user_scan_in); |
951 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); | 954 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); |
952 | 955 | ||
953 | int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel); | 956 | int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel); |
@@ -990,7 +993,6 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, | |||
990 | 993 | ||
991 | int mwifiex_main_process(struct mwifiex_adapter *); | 994 | int mwifiex_main_process(struct mwifiex_adapter *); |
992 | 995 | ||
993 | int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel); | ||
994 | int mwifiex_bss_set_channel(struct mwifiex_private *, | 996 | int mwifiex_bss_set_channel(struct mwifiex_private *, |
995 | struct mwifiex_chan_freq_power *cfp); | 997 | struct mwifiex_chan_freq_power *cfp); |
996 | int mwifiex_get_bss_info(struct mwifiex_private *, | 998 | int mwifiex_get_bss_info(struct mwifiex_private *, |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 98c6aabd5a48..04dc7ca4ac22 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1294,8 +1294,8 @@ mwifiex_radio_type_to_band(u8 radio_type) | |||
1294 | * order to send the appropriate scan commands to firmware to populate or | 1294 | * order to send the appropriate scan commands to firmware to populate or |
1295 | * update the internal driver scan table. | 1295 | * update the internal driver scan table. |
1296 | */ | 1296 | */ |
1297 | static int mwifiex_scan_networks(struct mwifiex_private *priv, | 1297 | int mwifiex_scan_networks(struct mwifiex_private *priv, |
1298 | const struct mwifiex_user_scan_cfg *user_scan_in) | 1298 | const struct mwifiex_user_scan_cfg *user_scan_in) |
1299 | { | 1299 | { |
1300 | int ret = 0; | 1300 | int ret = 0; |
1301 | struct mwifiex_adapter *adapter = priv->adapter; | 1301 | struct mwifiex_adapter *adapter = priv->adapter; |
@@ -1360,6 +1360,7 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1360 | adapter->cmd_queued = cmd_node; | 1360 | adapter->cmd_queued = cmd_node; |
1361 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, | 1361 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, |
1362 | true); | 1362 | true); |
1363 | queue_work(adapter->workqueue, &adapter->main_work); | ||
1363 | } else { | 1364 | } else { |
1364 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1365 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1365 | flags); | 1366 | flags); |
@@ -1376,26 +1377,6 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1376 | } | 1377 | } |
1377 | 1378 | ||
1378 | /* | 1379 | /* |
1379 | * Sends IOCTL request to start a scan with user configurations. | ||
1380 | * | ||
1381 | * This function allocates the IOCTL request buffer, fills it | ||
1382 | * with requisite parameters and calls the IOCTL handler. | ||
1383 | * | ||
1384 | * Upon completion, it also generates a wireless event to notify | ||
1385 | * applications. | ||
1386 | */ | ||
1387 | int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv, | ||
1388 | struct mwifiex_user_scan_cfg *scan_req) | ||
1389 | { | ||
1390 | int status; | ||
1391 | |||
1392 | status = mwifiex_scan_networks(priv, scan_req); | ||
1393 | queue_work(priv->adapter->workqueue, &priv->adapter->main_work); | ||
1394 | |||
1395 | return status; | ||
1396 | } | ||
1397 | |||
1398 | /* | ||
1399 | * This function prepares a scan command to be sent to the firmware. | 1380 | * This function prepares a scan command to be sent to the firmware. |
1400 | * | 1381 | * |
1401 | * This uses the scan command configuration sent to the command processing | 1382 | * This uses the scan command configuration sent to the command processing |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 1ff1362d8cdf..b9cd9ed48c45 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -260,6 +260,23 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, | |||
260 | } | 260 | } |
261 | 261 | ||
262 | /* | 262 | /* |
263 | * This function prepares command to get RF Tx power. | ||
264 | */ | ||
265 | static int mwifiex_cmd_rf_tx_power(struct mwifiex_private *priv, | ||
266 | struct host_cmd_ds_command *cmd, | ||
267 | u16 cmd_action, void *data_buf) | ||
268 | { | ||
269 | struct host_cmd_ds_rf_tx_pwr *txp = &cmd->params.txp; | ||
270 | |||
271 | cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_tx_pwr) | ||
272 | + S_DS_GEN); | ||
273 | cmd->command = cpu_to_le16(HostCmd_CMD_RF_TX_PWR); | ||
274 | txp->action = cpu_to_le16(cmd_action); | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | /* | ||
263 | * This function prepares command to set Host Sleep configuration. | 280 | * This function prepares command to set Host Sleep configuration. |
264 | * | 281 | * |
265 | * Preparation includes - | 282 | * Preparation includes - |
@@ -1049,6 +1066,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, | |||
1049 | ret = mwifiex_cmd_tx_power_cfg(cmd_ptr, cmd_action, | 1066 | ret = mwifiex_cmd_tx_power_cfg(cmd_ptr, cmd_action, |
1050 | data_buf); | 1067 | data_buf); |
1051 | break; | 1068 | break; |
1069 | case HostCmd_CMD_RF_TX_PWR: | ||
1070 | ret = mwifiex_cmd_rf_tx_power(priv, cmd_ptr, cmd_action, | ||
1071 | data_buf); | ||
1072 | break; | ||
1052 | case HostCmd_CMD_802_11_PS_MODE_ENH: | 1073 | case HostCmd_CMD_802_11_PS_MODE_ENH: |
1053 | ret = mwifiex_cmd_enh_power_mode(priv, cmd_ptr, cmd_action, | 1074 | ret = mwifiex_cmd_enh_power_mode(priv, cmd_ptr, cmd_action, |
1054 | (uint16_t)cmd_oid, data_buf); | 1075 | (uint16_t)cmd_oid, data_buf); |
@@ -1277,7 +1298,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) | |||
1277 | priv->data_rate = 0; | 1298 | priv->data_rate = 0; |
1278 | 1299 | ||
1279 | /* get tx power */ | 1300 | /* get tx power */ |
1280 | ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_TXPWR_CFG, | 1301 | ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_RF_TX_PWR, |
1281 | HostCmd_ACT_GEN_GET, 0, NULL); | 1302 | HostCmd_ACT_GEN_GET, 0, NULL); |
1282 | if (ret) | 1303 | if (ret) |
1283 | return -1; | 1304 | return -1; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index bd40541ebd5a..78fc352c85c4 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -451,6 +451,30 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, | |||
451 | } | 451 | } |
452 | 452 | ||
453 | /* | 453 | /* |
454 | * This function handles the command response of get RF Tx power. | ||
455 | */ | ||
456 | static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv, | ||
457 | struct host_cmd_ds_command *resp) | ||
458 | { | ||
459 | struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp; | ||
460 | u16 action = le16_to_cpu(txp->action); | ||
461 | |||
462 | priv->tx_power_level = le16_to_cpu(txp->cur_level); | ||
463 | |||
464 | if (action == HostCmd_ACT_GEN_GET) { | ||
465 | priv->max_tx_power_level = txp->max_power; | ||
466 | priv->min_tx_power_level = txp->min_power; | ||
467 | } | ||
468 | |||
469 | dev_dbg(priv->adapter->dev, | ||
470 | "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n", | ||
471 | priv->tx_power_level, priv->max_tx_power_level, | ||
472 | priv->min_tx_power_level); | ||
473 | |||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | /* | ||
454 | * This function handles the command response of set/get MAC address. | 478 | * This function handles the command response of set/get MAC address. |
455 | * | 479 | * |
456 | * Handling includes saving the MAC address in driver. | 480 | * Handling includes saving the MAC address in driver. |
@@ -841,6 +865,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, | |||
841 | case HostCmd_CMD_TXPWR_CFG: | 865 | case HostCmd_CMD_TXPWR_CFG: |
842 | ret = mwifiex_ret_tx_power_cfg(priv, resp); | 866 | ret = mwifiex_ret_tx_power_cfg(priv, resp); |
843 | break; | 867 | break; |
868 | case HostCmd_CMD_RF_TX_PWR: | ||
869 | ret = mwifiex_ret_rf_tx_power(priv, resp); | ||
870 | break; | ||
844 | case HostCmd_CMD_802_11_PS_MODE_ENH: | 871 | case HostCmd_CMD_802_11_PS_MODE_ENH: |
845 | ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); | 872 | ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); |
846 | break; | 873 | break; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 106c449477b2..f2fd2423214f 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -66,9 +66,6 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | |||
66 | dev_dbg(adapter->dev, "cmd pending\n"); | 66 | dev_dbg(adapter->dev, "cmd pending\n"); |
67 | atomic_inc(&adapter->cmd_pending); | 67 | atomic_inc(&adapter->cmd_pending); |
68 | 68 | ||
69 | /* Status pending, wake up main process */ | ||
70 | queue_work(adapter->workqueue, &adapter->main_work); | ||
71 | |||
72 | /* Wait for completion */ | 69 | /* Wait for completion */ |
73 | wait_event_interruptible(adapter->cmd_wait_q.wait, | 70 | wait_event_interruptible(adapter->cmd_wait_q.wait, |
74 | *(cmd_queued->condition)); | 71 | *(cmd_queued->condition)); |
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 89f9a2a45de3..f40e93fe894a 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
@@ -26,6 +26,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
26 | struct mwifiex_uap_bss_param *bss_config, | 26 | struct mwifiex_uap_bss_param *bss_config, |
27 | struct cfg80211_ap_settings *params) { | 27 | struct cfg80211_ap_settings *params) { |
28 | int i; | 28 | int i; |
29 | struct mwifiex_wep_key wep_key; | ||
29 | 30 | ||
30 | if (!params->privacy) { | 31 | if (!params->privacy) { |
31 | bss_config->protocol = PROTOCOL_NO_SECURITY; | 32 | bss_config->protocol = PROTOCOL_NO_SECURITY; |
@@ -65,7 +66,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
65 | } | 66 | } |
66 | if (params->crypto.wpa_versions & | 67 | if (params->crypto.wpa_versions & |
67 | NL80211_WPA_VERSION_2) { | 68 | NL80211_WPA_VERSION_2) { |
68 | bss_config->protocol = PROTOCOL_WPA2; | 69 | bss_config->protocol |= PROTOCOL_WPA2; |
69 | bss_config->key_mgmt = KEY_MGMT_EAP; | 70 | bss_config->key_mgmt = KEY_MGMT_EAP; |
70 | } | 71 | } |
71 | break; | 72 | break; |
@@ -77,7 +78,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
77 | } | 78 | } |
78 | if (params->crypto.wpa_versions & | 79 | if (params->crypto.wpa_versions & |
79 | NL80211_WPA_VERSION_2) { | 80 | NL80211_WPA_VERSION_2) { |
80 | bss_config->protocol = PROTOCOL_WPA2; | 81 | bss_config->protocol |= PROTOCOL_WPA2; |
81 | bss_config->key_mgmt = KEY_MGMT_PSK; | 82 | bss_config->key_mgmt = KEY_MGMT_PSK; |
82 | } | 83 | } |
83 | break; | 84 | break; |
@@ -91,10 +92,19 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
91 | case WLAN_CIPHER_SUITE_WEP104: | 92 | case WLAN_CIPHER_SUITE_WEP104: |
92 | break; | 93 | break; |
93 | case WLAN_CIPHER_SUITE_TKIP: | 94 | case WLAN_CIPHER_SUITE_TKIP: |
94 | bss_config->wpa_cfg.pairwise_cipher_wpa = CIPHER_TKIP; | 95 | if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) |
96 | bss_config->wpa_cfg.pairwise_cipher_wpa |= | ||
97 | CIPHER_TKIP; | ||
98 | if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) | ||
99 | bss_config->wpa_cfg.pairwise_cipher_wpa2 |= | ||
100 | CIPHER_TKIP; | ||
95 | break; | 101 | break; |
96 | case WLAN_CIPHER_SUITE_CCMP: | 102 | case WLAN_CIPHER_SUITE_CCMP: |
97 | bss_config->wpa_cfg.pairwise_cipher_wpa2 = | 103 | if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) |
104 | bss_config->wpa_cfg.pairwise_cipher_wpa |= | ||
105 | CIPHER_AES_CCMP; | ||
106 | if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) | ||
107 | bss_config->wpa_cfg.pairwise_cipher_wpa2 |= | ||
98 | CIPHER_AES_CCMP; | 108 | CIPHER_AES_CCMP; |
99 | default: | 109 | default: |
100 | break; | 110 | break; |
@@ -104,6 +114,27 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
104 | switch (params->crypto.cipher_group) { | 114 | switch (params->crypto.cipher_group) { |
105 | case WLAN_CIPHER_SUITE_WEP40: | 115 | case WLAN_CIPHER_SUITE_WEP40: |
106 | case WLAN_CIPHER_SUITE_WEP104: | 116 | case WLAN_CIPHER_SUITE_WEP104: |
117 | if (priv->sec_info.wep_enabled) { | ||
118 | bss_config->protocol = PROTOCOL_STATIC_WEP; | ||
119 | bss_config->key_mgmt = KEY_MGMT_NONE; | ||
120 | bss_config->wpa_cfg.length = 0; | ||
121 | |||
122 | for (i = 0; i < NUM_WEP_KEYS; i++) { | ||
123 | wep_key = priv->wep_key[i]; | ||
124 | bss_config->wep_cfg[i].key_index = i; | ||
125 | |||
126 | if (priv->wep_key_curr_index == i) | ||
127 | bss_config->wep_cfg[i].is_default = 1; | ||
128 | else | ||
129 | bss_config->wep_cfg[i].is_default = 0; | ||
130 | |||
131 | bss_config->wep_cfg[i].length = | ||
132 | wep_key.key_length; | ||
133 | memcpy(&bss_config->wep_cfg[i].key, | ||
134 | &wep_key.key_material, | ||
135 | wep_key.key_length); | ||
136 | } | ||
137 | } | ||
107 | break; | 138 | break; |
108 | case WLAN_CIPHER_SUITE_TKIP: | 139 | case WLAN_CIPHER_SUITE_TKIP: |
109 | bss_config->wpa_cfg.group_cipher = CIPHER_TKIP; | 140 | bss_config->wpa_cfg.group_cipher = CIPHER_TKIP; |
@@ -118,6 +149,33 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
118 | return 0; | 149 | return 0; |
119 | } | 150 | } |
120 | 151 | ||
152 | /* This function updates 11n related parameters from IE and sets them into | ||
153 | * bss_config structure. | ||
154 | */ | ||
155 | void | ||
156 | mwifiex_set_ht_params(struct mwifiex_private *priv, | ||
157 | struct mwifiex_uap_bss_param *bss_cfg, | ||
158 | struct cfg80211_ap_settings *params) | ||
159 | { | ||
160 | const u8 *ht_ie; | ||
161 | |||
162 | if (!ISSUPP_11NENABLED(priv->adapter->fw_cap_info)) | ||
163 | return; | ||
164 | |||
165 | ht_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, params->beacon.tail, | ||
166 | params->beacon.tail_len); | ||
167 | if (ht_ie) { | ||
168 | memcpy(&bss_cfg->ht_cap, ht_ie + 2, | ||
169 | sizeof(struct ieee80211_ht_cap)); | ||
170 | } else { | ||
171 | memset(&bss_cfg->ht_cap , 0, sizeof(struct ieee80211_ht_cap)); | ||
172 | bss_cfg->ht_cap.cap_info = cpu_to_le16(MWIFIEX_DEF_HT_CAP); | ||
173 | bss_cfg->ht_cap.ampdu_params_info = MWIFIEX_DEF_AMPDU; | ||
174 | } | ||
175 | |||
176 | return; | ||
177 | } | ||
178 | |||
121 | /* This function initializes some of mwifiex_uap_bss_param variables. | 179 | /* This function initializes some of mwifiex_uap_bss_param variables. |
122 | * This helps FW in ignoring invalid values. These values may or may not | 180 | * This helps FW in ignoring invalid values. These values may or may not |
123 | * be get updated to valid ones at later stage. | 181 | * be get updated to valid ones at later stage. |
@@ -135,6 +193,120 @@ void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) | |||
135 | } | 193 | } |
136 | 194 | ||
137 | /* This function parses BSS related parameters from structure | 195 | /* This function parses BSS related parameters from structure |
196 | * and prepares TLVs specific to WPA/WPA2 security. | ||
197 | * These TLVs are appended to command buffer. | ||
198 | */ | ||
199 | static void | ||
200 | mwifiex_uap_bss_wpa(u8 **tlv_buf, void *cmd_buf, u16 *param_size) | ||
201 | { | ||
202 | struct host_cmd_tlv_pwk_cipher *pwk_cipher; | ||
203 | struct host_cmd_tlv_gwk_cipher *gwk_cipher; | ||
204 | struct host_cmd_tlv_passphrase *passphrase; | ||
205 | struct host_cmd_tlv_akmp *tlv_akmp; | ||
206 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; | ||
207 | u16 cmd_size = *param_size; | ||
208 | u8 *tlv = *tlv_buf; | ||
209 | |||
210 | tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; | ||
211 | tlv_akmp->tlv.type = cpu_to_le16(TLV_TYPE_UAP_AKMP); | ||
212 | tlv_akmp->tlv.len = cpu_to_le16(sizeof(struct host_cmd_tlv_akmp) - | ||
213 | sizeof(struct host_cmd_tlv)); | ||
214 | tlv_akmp->key_mgmt_operation = cpu_to_le16(bss_cfg->key_mgmt_operation); | ||
215 | tlv_akmp->key_mgmt = cpu_to_le16(bss_cfg->key_mgmt); | ||
216 | cmd_size += sizeof(struct host_cmd_tlv_akmp); | ||
217 | tlv += sizeof(struct host_cmd_tlv_akmp); | ||
218 | |||
219 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa & VALID_CIPHER_BITMAP) { | ||
220 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
221 | pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
222 | pwk_cipher->tlv.len = | ||
223 | cpu_to_le16(sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
224 | sizeof(struct host_cmd_tlv)); | ||
225 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA); | ||
226 | pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa; | ||
227 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
228 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
229 | } | ||
230 | |||
231 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 & VALID_CIPHER_BITMAP) { | ||
232 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
233 | pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
234 | pwk_cipher->tlv.len = | ||
235 | cpu_to_le16(sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
236 | sizeof(struct host_cmd_tlv)); | ||
237 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA2); | ||
238 | pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa2; | ||
239 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
240 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
241 | } | ||
242 | |||
243 | if (bss_cfg->wpa_cfg.group_cipher & VALID_CIPHER_BITMAP) { | ||
244 | gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; | ||
245 | gwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_GWK_CIPHER); | ||
246 | gwk_cipher->tlv.len = | ||
247 | cpu_to_le16(sizeof(struct host_cmd_tlv_gwk_cipher) - | ||
248 | sizeof(struct host_cmd_tlv)); | ||
249 | gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; | ||
250 | cmd_size += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
251 | tlv += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
252 | } | ||
253 | |||
254 | if (bss_cfg->wpa_cfg.length) { | ||
255 | passphrase = (struct host_cmd_tlv_passphrase *)tlv; | ||
256 | passphrase->tlv.type = cpu_to_le16(TLV_TYPE_UAP_WPA_PASSPHRASE); | ||
257 | passphrase->tlv.len = cpu_to_le16(bss_cfg->wpa_cfg.length); | ||
258 | memcpy(passphrase->passphrase, bss_cfg->wpa_cfg.passphrase, | ||
259 | bss_cfg->wpa_cfg.length); | ||
260 | cmd_size += sizeof(struct host_cmd_tlv) + | ||
261 | bss_cfg->wpa_cfg.length; | ||
262 | tlv += sizeof(struct host_cmd_tlv) + bss_cfg->wpa_cfg.length; | ||
263 | } | ||
264 | |||
265 | *param_size = cmd_size; | ||
266 | *tlv_buf = tlv; | ||
267 | |||
268 | return; | ||
269 | } | ||
270 | |||
271 | /* This function parses BSS related parameters from structure | ||
272 | * and prepares TLVs specific to WEP encryption. | ||
273 | * These TLVs are appended to command buffer. | ||
274 | */ | ||
275 | static void | ||
276 | mwifiex_uap_bss_wep(u8 **tlv_buf, void *cmd_buf, u16 *param_size) | ||
277 | { | ||
278 | struct host_cmd_tlv_wep_key *wep_key; | ||
279 | u16 cmd_size = *param_size; | ||
280 | int i; | ||
281 | u8 *tlv = *tlv_buf; | ||
282 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; | ||
283 | |||
284 | for (i = 0; i < NUM_WEP_KEYS; i++) { | ||
285 | if (bss_cfg->wep_cfg[i].length && | ||
286 | (bss_cfg->wep_cfg[i].length == WLAN_KEY_LEN_WEP40 || | ||
287 | bss_cfg->wep_cfg[i].length == WLAN_KEY_LEN_WEP104)) { | ||
288 | wep_key = (struct host_cmd_tlv_wep_key *)tlv; | ||
289 | wep_key->tlv.type = cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); | ||
290 | wep_key->tlv.len = | ||
291 | cpu_to_le16(bss_cfg->wep_cfg[i].length + 2); | ||
292 | wep_key->key_index = bss_cfg->wep_cfg[i].key_index; | ||
293 | wep_key->is_default = bss_cfg->wep_cfg[i].is_default; | ||
294 | memcpy(wep_key->key, bss_cfg->wep_cfg[i].key, | ||
295 | bss_cfg->wep_cfg[i].length); | ||
296 | cmd_size += sizeof(struct host_cmd_tlv) + 2 + | ||
297 | bss_cfg->wep_cfg[i].length; | ||
298 | tlv += sizeof(struct host_cmd_tlv) + 2 + | ||
299 | bss_cfg->wep_cfg[i].length; | ||
300 | } | ||
301 | } | ||
302 | |||
303 | *param_size = cmd_size; | ||
304 | *tlv_buf = tlv; | ||
305 | |||
306 | return; | ||
307 | } | ||
308 | |||
309 | /* This function parses BSS related parameters from structure | ||
138 | * and prepares TLVs. These TLVs are appended to command buffer. | 310 | * and prepares TLVs. These TLVs are appended to command buffer. |
139 | */ | 311 | */ |
140 | static int | 312 | static int |
@@ -148,12 +320,9 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
148 | struct host_cmd_tlv_frag_threshold *frag_threshold; | 320 | struct host_cmd_tlv_frag_threshold *frag_threshold; |
149 | struct host_cmd_tlv_rts_threshold *rts_threshold; | 321 | struct host_cmd_tlv_rts_threshold *rts_threshold; |
150 | struct host_cmd_tlv_retry_limit *retry_limit; | 322 | struct host_cmd_tlv_retry_limit *retry_limit; |
151 | struct host_cmd_tlv_pwk_cipher *pwk_cipher; | ||
152 | struct host_cmd_tlv_gwk_cipher *gwk_cipher; | ||
153 | struct host_cmd_tlv_encrypt_protocol *encrypt_protocol; | 323 | struct host_cmd_tlv_encrypt_protocol *encrypt_protocol; |
154 | struct host_cmd_tlv_auth_type *auth_type; | 324 | struct host_cmd_tlv_auth_type *auth_type; |
155 | struct host_cmd_tlv_passphrase *passphrase; | 325 | struct mwifiex_ie_types_htcap *htcap; |
156 | struct host_cmd_tlv_akmp *tlv_akmp; | ||
157 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; | 326 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; |
158 | u16 cmd_size = *param_size; | 327 | u16 cmd_size = *param_size; |
159 | 328 | ||
@@ -243,70 +412,11 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
243 | } | 412 | } |
244 | if ((bss_cfg->protocol & PROTOCOL_WPA) || | 413 | if ((bss_cfg->protocol & PROTOCOL_WPA) || |
245 | (bss_cfg->protocol & PROTOCOL_WPA2) || | 414 | (bss_cfg->protocol & PROTOCOL_WPA2) || |
246 | (bss_cfg->protocol & PROTOCOL_EAP)) { | 415 | (bss_cfg->protocol & PROTOCOL_EAP)) |
247 | tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; | 416 | mwifiex_uap_bss_wpa(&tlv, cmd_buf, &cmd_size); |
248 | tlv_akmp->tlv.type = cpu_to_le16(TLV_TYPE_UAP_AKMP); | 417 | else |
249 | tlv_akmp->tlv.len = | 418 | mwifiex_uap_bss_wep(&tlv, cmd_buf, &cmd_size); |
250 | cpu_to_le16(sizeof(struct host_cmd_tlv_akmp) - | 419 | |
251 | sizeof(struct host_cmd_tlv)); | ||
252 | tlv_akmp->key_mgmt_operation = | ||
253 | cpu_to_le16(bss_cfg->key_mgmt_operation); | ||
254 | tlv_akmp->key_mgmt = cpu_to_le16(bss_cfg->key_mgmt); | ||
255 | cmd_size += sizeof(struct host_cmd_tlv_akmp); | ||
256 | tlv += sizeof(struct host_cmd_tlv_akmp); | ||
257 | |||
258 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa & | ||
259 | VALID_CIPHER_BITMAP) { | ||
260 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
261 | pwk_cipher->tlv.type = | ||
262 | cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
263 | pwk_cipher->tlv.len = cpu_to_le16( | ||
264 | sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
265 | sizeof(struct host_cmd_tlv)); | ||
266 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA); | ||
267 | pwk_cipher->cipher = | ||
268 | bss_cfg->wpa_cfg.pairwise_cipher_wpa; | ||
269 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
270 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
271 | } | ||
272 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 & | ||
273 | VALID_CIPHER_BITMAP) { | ||
274 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
275 | pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
276 | pwk_cipher->tlv.len = cpu_to_le16( | ||
277 | sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
278 | sizeof(struct host_cmd_tlv)); | ||
279 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA2); | ||
280 | pwk_cipher->cipher = | ||
281 | bss_cfg->wpa_cfg.pairwise_cipher_wpa2; | ||
282 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
283 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
284 | } | ||
285 | if (bss_cfg->wpa_cfg.group_cipher & VALID_CIPHER_BITMAP) { | ||
286 | gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; | ||
287 | gwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_GWK_CIPHER); | ||
288 | gwk_cipher->tlv.len = cpu_to_le16( | ||
289 | sizeof(struct host_cmd_tlv_gwk_cipher) - | ||
290 | sizeof(struct host_cmd_tlv)); | ||
291 | gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; | ||
292 | cmd_size += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
293 | tlv += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
294 | } | ||
295 | if (bss_cfg->wpa_cfg.length) { | ||
296 | passphrase = (struct host_cmd_tlv_passphrase *)tlv; | ||
297 | passphrase->tlv.type = | ||
298 | cpu_to_le16(TLV_TYPE_UAP_WPA_PASSPHRASE); | ||
299 | passphrase->tlv.len = | ||
300 | cpu_to_le16(bss_cfg->wpa_cfg.length); | ||
301 | memcpy(passphrase->passphrase, | ||
302 | bss_cfg->wpa_cfg.passphrase, | ||
303 | bss_cfg->wpa_cfg.length); | ||
304 | cmd_size += sizeof(struct host_cmd_tlv) + | ||
305 | bss_cfg->wpa_cfg.length; | ||
306 | tlv += sizeof(struct host_cmd_tlv) + | ||
307 | bss_cfg->wpa_cfg.length; | ||
308 | } | ||
309 | } | ||
310 | if ((bss_cfg->auth_mode <= WLAN_AUTH_SHARED_KEY) || | 420 | if ((bss_cfg->auth_mode <= WLAN_AUTH_SHARED_KEY) || |
311 | (bss_cfg->auth_mode == MWIFIEX_AUTH_MODE_AUTO)) { | 421 | (bss_cfg->auth_mode == MWIFIEX_AUTH_MODE_AUTO)) { |
312 | auth_type = (struct host_cmd_tlv_auth_type *)tlv; | 422 | auth_type = (struct host_cmd_tlv_auth_type *)tlv; |
@@ -330,6 +440,25 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
330 | tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); | 440 | tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); |
331 | } | 441 | } |
332 | 442 | ||
443 | if (bss_cfg->ht_cap.cap_info) { | ||
444 | htcap = (struct mwifiex_ie_types_htcap *)tlv; | ||
445 | htcap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); | ||
446 | htcap->header.len = | ||
447 | cpu_to_le16(sizeof(struct ieee80211_ht_cap)); | ||
448 | htcap->ht_cap.cap_info = bss_cfg->ht_cap.cap_info; | ||
449 | htcap->ht_cap.ampdu_params_info = | ||
450 | bss_cfg->ht_cap.ampdu_params_info; | ||
451 | memcpy(&htcap->ht_cap.mcs, &bss_cfg->ht_cap.mcs, | ||
452 | sizeof(struct ieee80211_mcs_info)); | ||
453 | htcap->ht_cap.extended_ht_cap_info = | ||
454 | bss_cfg->ht_cap.extended_ht_cap_info; | ||
455 | htcap->ht_cap.tx_BF_cap_info = bss_cfg->ht_cap.tx_BF_cap_info; | ||
456 | htcap->ht_cap.antenna_selection_info = | ||
457 | bss_cfg->ht_cap.antenna_selection_info; | ||
458 | cmd_size += sizeof(struct mwifiex_ie_types_htcap); | ||
459 | tlv += sizeof(struct mwifiex_ie_types_htcap); | ||
460 | } | ||
461 | |||
333 | *param_size = cmd_size; | 462 | *param_size = cmd_size; |
334 | 463 | ||
335 | return 0; | 464 | return 0; |
@@ -421,33 +550,3 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, | |||
421 | 550 | ||
422 | return 0; | 551 | return 0; |
423 | } | 552 | } |
424 | |||
425 | /* This function sets the RF channel for AP. | ||
426 | * | ||
427 | * This function populates channel information in AP config structure | ||
428 | * and sends command to configure channel information in AP. | ||
429 | */ | ||
430 | int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel) | ||
431 | { | ||
432 | struct mwifiex_uap_bss_param *bss_cfg; | ||
433 | struct wiphy *wiphy = priv->wdev->wiphy; | ||
434 | |||
435 | bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); | ||
436 | if (!bss_cfg) | ||
437 | return -ENOMEM; | ||
438 | |||
439 | mwifiex_set_sys_config_invalid_data(bss_cfg); | ||
440 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; | ||
441 | bss_cfg->channel = channel; | ||
442 | |||
443 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, | ||
444 | HostCmd_ACT_GEN_SET, | ||
445 | UAP_BSS_PARAMS_I, bss_cfg)) { | ||
446 | wiphy_err(wiphy, "Failed to set the uAP channel\n"); | ||
447 | kfree(bss_cfg); | ||
448 | return -1; | ||
449 | } | ||
450 | |||
451 | kfree(bss_cfg); | ||
452 | return 0; | ||
453 | } | ||
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 299c3879582d..c7548da6573d 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -99,6 +99,14 @@ config RT2800PCI_RT53XX | |||
99 | rt2800pci driver. | 99 | rt2800pci driver. |
100 | Supported chips: RT5390 | 100 | Supported chips: RT5390 |
101 | 101 | ||
102 | config RT2800PCI_RT3290 | ||
103 | bool "rt2800pci - Include support for rt3290 devices (EXPERIMENTAL)" | ||
104 | depends on EXPERIMENTAL | ||
105 | default y | ||
106 | ---help--- | ||
107 | This adds support for rt3290 wireless chipset family to the | ||
108 | rt2800pci driver. | ||
109 | Supported chips: RT3290 | ||
102 | endif | 110 | endif |
103 | 111 | ||
104 | config RT2500USB | 112 | config RT2500USB |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 1ca88cdc6ece..e252e9bafd0e 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -68,6 +68,7 @@ | |||
68 | #define RF3320 0x000b | 68 | #define RF3320 0x000b |
69 | #define RF3322 0x000c | 69 | #define RF3322 0x000c |
70 | #define RF3053 0x000d | 70 | #define RF3053 0x000d |
71 | #define RF3290 0x3290 | ||
71 | #define RF5360 0x5360 | 72 | #define RF5360 0x5360 |
72 | #define RF5370 0x5370 | 73 | #define RF5370 0x5370 |
73 | #define RF5372 0x5372 | 74 | #define RF5372 0x5372 |
@@ -117,6 +118,12 @@ | |||
117 | * Registers. | 118 | * Registers. |
118 | */ | 119 | */ |
119 | 120 | ||
121 | |||
122 | /* | ||
123 | * MAC_CSR0_3290: MAC_CSR0 for RT3290 to identity MAC version number. | ||
124 | */ | ||
125 | #define MAC_CSR0_3290 0x0000 | ||
126 | |||
120 | /* | 127 | /* |
121 | * E2PROM_CSR: PCI EEPROM control register. | 128 | * E2PROM_CSR: PCI EEPROM control register. |
122 | * RELOAD: Write 1 to reload eeprom content. | 129 | * RELOAD: Write 1 to reload eeprom content. |
@@ -133,6 +140,150 @@ | |||
133 | #define E2PROM_CSR_RELOAD FIELD32(0x00000080) | 140 | #define E2PROM_CSR_RELOAD FIELD32(0x00000080) |
134 | 141 | ||
135 | /* | 142 | /* |
143 | * CMB_CTRL_CFG | ||
144 | */ | ||
145 | #define CMB_CTRL 0x0020 | ||
146 | #define AUX_OPT_BIT0 FIELD32(0x00000001) | ||
147 | #define AUX_OPT_BIT1 FIELD32(0x00000002) | ||
148 | #define AUX_OPT_BIT2 FIELD32(0x00000004) | ||
149 | #define AUX_OPT_BIT3 FIELD32(0x00000008) | ||
150 | #define AUX_OPT_BIT4 FIELD32(0x00000010) | ||
151 | #define AUX_OPT_BIT5 FIELD32(0x00000020) | ||
152 | #define AUX_OPT_BIT6 FIELD32(0x00000040) | ||
153 | #define AUX_OPT_BIT7 FIELD32(0x00000080) | ||
154 | #define AUX_OPT_BIT8 FIELD32(0x00000100) | ||
155 | #define AUX_OPT_BIT9 FIELD32(0x00000200) | ||
156 | #define AUX_OPT_BIT10 FIELD32(0x00000400) | ||
157 | #define AUX_OPT_BIT11 FIELD32(0x00000800) | ||
158 | #define AUX_OPT_BIT12 FIELD32(0x00001000) | ||
159 | #define AUX_OPT_BIT13 FIELD32(0x00002000) | ||
160 | #define AUX_OPT_BIT14 FIELD32(0x00004000) | ||
161 | #define AUX_OPT_BIT15 FIELD32(0x00008000) | ||
162 | #define LDO25_LEVEL FIELD32(0x00030000) | ||
163 | #define LDO25_LARGEA FIELD32(0x00040000) | ||
164 | #define LDO25_FRC_ON FIELD32(0x00080000) | ||
165 | #define CMB_RSV FIELD32(0x00300000) | ||
166 | #define XTAL_RDY FIELD32(0x00400000) | ||
167 | #define PLL_LD FIELD32(0x00800000) | ||
168 | #define LDO_CORE_LEVEL FIELD32(0x0F000000) | ||
169 | #define LDO_BGSEL FIELD32(0x30000000) | ||
170 | #define LDO3_EN FIELD32(0x40000000) | ||
171 | #define LDO0_EN FIELD32(0x80000000) | ||
172 | |||
173 | /* | ||
174 | * EFUSE_CSR_3290: RT3290 EEPROM | ||
175 | */ | ||
176 | #define EFUSE_CTRL_3290 0x0024 | ||
177 | |||
178 | /* | ||
179 | * EFUSE_DATA3 of 3290 | ||
180 | */ | ||
181 | #define EFUSE_DATA3_3290 0x0028 | ||
182 | |||
183 | /* | ||
184 | * EFUSE_DATA2 of 3290 | ||
185 | */ | ||
186 | #define EFUSE_DATA2_3290 0x002c | ||
187 | |||
188 | /* | ||
189 | * EFUSE_DATA1 of 3290 | ||
190 | */ | ||
191 | #define EFUSE_DATA1_3290 0x0030 | ||
192 | |||
193 | /* | ||
194 | * EFUSE_DATA0 of 3290 | ||
195 | */ | ||
196 | #define EFUSE_DATA0_3290 0x0034 | ||
197 | |||
198 | /* | ||
199 | * OSC_CTRL_CFG | ||
200 | * Ring oscillator configuration | ||
201 | */ | ||
202 | #define OSC_CTRL 0x0038 | ||
203 | #define OSC_REF_CYCLE FIELD32(0x00001fff) | ||
204 | #define OSC_RSV FIELD32(0x0000e000) | ||
205 | #define OSC_CAL_CNT FIELD32(0x0fff0000) | ||
206 | #define OSC_CAL_ACK FIELD32(0x10000000) | ||
207 | #define OSC_CLK_32K_VLD FIELD32(0x20000000) | ||
208 | #define OSC_CAL_REQ FIELD32(0x40000000) | ||
209 | #define OSC_ROSC_EN FIELD32(0x80000000) | ||
210 | |||
211 | /* | ||
212 | * COEX_CFG_0 | ||
213 | */ | ||
214 | #define COEX_CFG0 0x0040 | ||
215 | #define COEX_CFG_ANT FIELD32(0xff000000) | ||
216 | /* | ||
217 | * COEX_CFG_1 | ||
218 | */ | ||
219 | #define COEX_CFG1 0x0044 | ||
220 | |||
221 | /* | ||
222 | * COEX_CFG_2 | ||
223 | */ | ||
224 | #define COEX_CFG2 0x0048 | ||
225 | #define BT_COEX_CFG1 FIELD32(0xff000000) | ||
226 | #define BT_COEX_CFG0 FIELD32(0x00ff0000) | ||
227 | #define WL_COEX_CFG1 FIELD32(0x0000ff00) | ||
228 | #define WL_COEX_CFG0 FIELD32(0x000000ff) | ||
229 | /* | ||
230 | * PLL_CTRL_CFG | ||
231 | * PLL configuration register | ||
232 | */ | ||
233 | #define PLL_CTRL 0x0050 | ||
234 | #define PLL_RESERVED_INPUT1 FIELD32(0x000000ff) | ||
235 | #define PLL_RESERVED_INPUT2 FIELD32(0x0000ff00) | ||
236 | #define PLL_CONTROL FIELD32(0x00070000) | ||
237 | #define PLL_LPF_R1 FIELD32(0x00080000) | ||
238 | #define PLL_LPF_C1_CTRL FIELD32(0x00300000) | ||
239 | #define PLL_LPF_C2_CTRL FIELD32(0x00c00000) | ||
240 | #define PLL_CP_CURRENT_CTRL FIELD32(0x03000000) | ||
241 | #define PLL_PFD_DELAY_CTRL FIELD32(0x0c000000) | ||
242 | #define PLL_LOCK_CTRL FIELD32(0x70000000) | ||
243 | #define PLL_VBGBK_EN FIELD32(0x80000000) | ||
244 | |||
245 | |||
246 | /* | ||
247 | * WLAN_CTRL_CFG | ||
248 | * RT3290 wlan configuration | ||
249 | */ | ||
250 | #define WLAN_FUN_CTRL 0x0080 | ||
251 | #define WLAN_EN FIELD32(0x00000001) | ||
252 | #define WLAN_CLK_EN FIELD32(0x00000002) | ||
253 | #define WLAN_RSV1 FIELD32(0x00000004) | ||
254 | #define WLAN_RESET FIELD32(0x00000008) | ||
255 | #define PCIE_APP0_CLK_REQ FIELD32(0x00000010) | ||
256 | #define FRC_WL_ANT_SET FIELD32(0x00000020) | ||
257 | #define INV_TR_SW0 FIELD32(0x00000040) | ||
258 | #define WLAN_GPIO_IN_BIT0 FIELD32(0x00000100) | ||
259 | #define WLAN_GPIO_IN_BIT1 FIELD32(0x00000200) | ||
260 | #define WLAN_GPIO_IN_BIT2 FIELD32(0x00000400) | ||
261 | #define WLAN_GPIO_IN_BIT3 FIELD32(0x00000800) | ||
262 | #define WLAN_GPIO_IN_BIT4 FIELD32(0x00001000) | ||
263 | #define WLAN_GPIO_IN_BIT5 FIELD32(0x00002000) | ||
264 | #define WLAN_GPIO_IN_BIT6 FIELD32(0x00004000) | ||
265 | #define WLAN_GPIO_IN_BIT7 FIELD32(0x00008000) | ||
266 | #define WLAN_GPIO_IN_BIT_ALL FIELD32(0x0000ff00) | ||
267 | #define WLAN_GPIO_OUT_BIT0 FIELD32(0x00010000) | ||
268 | #define WLAN_GPIO_OUT_BIT1 FIELD32(0x00020000) | ||
269 | #define WLAN_GPIO_OUT_BIT2 FIELD32(0x00040000) | ||
270 | #define WLAN_GPIO_OUT_BIT3 FIELD32(0x00050000) | ||
271 | #define WLAN_GPIO_OUT_BIT4 FIELD32(0x00100000) | ||
272 | #define WLAN_GPIO_OUT_BIT5 FIELD32(0x00200000) | ||
273 | #define WLAN_GPIO_OUT_BIT6 FIELD32(0x00400000) | ||
274 | #define WLAN_GPIO_OUT_BIT7 FIELD32(0x00800000) | ||
275 | #define WLAN_GPIO_OUT_BIT_ALL FIELD32(0x00ff0000) | ||
276 | #define WLAN_GPIO_OUT_OE_BIT0 FIELD32(0x01000000) | ||
277 | #define WLAN_GPIO_OUT_OE_BIT1 FIELD32(0x02000000) | ||
278 | #define WLAN_GPIO_OUT_OE_BIT2 FIELD32(0x04000000) | ||
279 | #define WLAN_GPIO_OUT_OE_BIT3 FIELD32(0x08000000) | ||
280 | #define WLAN_GPIO_OUT_OE_BIT4 FIELD32(0x10000000) | ||
281 | #define WLAN_GPIO_OUT_OE_BIT5 FIELD32(0x20000000) | ||
282 | #define WLAN_GPIO_OUT_OE_BIT6 FIELD32(0x40000000) | ||
283 | #define WLAN_GPIO_OUT_OE_BIT7 FIELD32(0x80000000) | ||
284 | #define WLAN_GPIO_OUT_OE_BIT_ALL FIELD32(0xff000000) | ||
285 | |||
286 | /* | ||
136 | * AUX_CTRL: Aux/PCI-E related configuration | 287 | * AUX_CTRL: Aux/PCI-E related configuration |
137 | */ | 288 | */ |
138 | #define AUX_CTRL 0x10c | 289 | #define AUX_CTRL 0x10c |
@@ -1763,9 +1914,11 @@ struct mac_iveiv_entry { | |||
1763 | /* | 1914 | /* |
1764 | * BBP 3: RX Antenna | 1915 | * BBP 3: RX Antenna |
1765 | */ | 1916 | */ |
1766 | #define BBP3_RX_ADC FIELD8(0x03) | 1917 | #define BBP3_RX_ADC FIELD8(0x03) |
1767 | #define BBP3_RX_ANTENNA FIELD8(0x18) | 1918 | #define BBP3_RX_ANTENNA FIELD8(0x18) |
1768 | #define BBP3_HT40_MINUS FIELD8(0x20) | 1919 | #define BBP3_HT40_MINUS FIELD8(0x20) |
1920 | #define BBP3_ADC_MODE_SWITCH FIELD8(0x40) | ||
1921 | #define BBP3_ADC_INIT_MODE FIELD8(0x80) | ||
1769 | 1922 | ||
1770 | /* | 1923 | /* |
1771 | * BBP 4: Bandwidth | 1924 | * BBP 4: Bandwidth |
@@ -1775,6 +1928,14 @@ struct mac_iveiv_entry { | |||
1775 | #define BBP4_MAC_IF_CTRL FIELD8(0x40) | 1928 | #define BBP4_MAC_IF_CTRL FIELD8(0x40) |
1776 | 1929 | ||
1777 | /* | 1930 | /* |
1931 | * BBP 47: Bandwidth | ||
1932 | */ | ||
1933 | #define BBP47_TSSI_REPORT_SEL FIELD8(0x03) | ||
1934 | #define BBP47_TSSI_UPDATE_REQ FIELD8(0x04) | ||
1935 | #define BBP47_TSSI_TSSI_MODE FIELD8(0x18) | ||
1936 | #define BBP47_TSSI_ADC6 FIELD8(0x80) | ||
1937 | |||
1938 | /* | ||
1778 | * BBP 109 | 1939 | * BBP 109 |
1779 | */ | 1940 | */ |
1780 | #define BBP109_TX0_POWER FIELD8(0x0f) | 1941 | #define BBP109_TX0_POWER FIELD8(0x0f) |
@@ -1917,6 +2078,16 @@ struct mac_iveiv_entry { | |||
1917 | #define RFCSR27_R4 FIELD8(0x40) | 2078 | #define RFCSR27_R4 FIELD8(0x40) |
1918 | 2079 | ||
1919 | /* | 2080 | /* |
2081 | * RFCSR 29: | ||
2082 | */ | ||
2083 | #define RFCSR29_ADC6_TEST FIELD8(0x01) | ||
2084 | #define RFCSR29_ADC6_INT_TEST FIELD8(0x02) | ||
2085 | #define RFCSR29_RSSI_RESET FIELD8(0x04) | ||
2086 | #define RFCSR29_RSSI_ON FIELD8(0x08) | ||
2087 | #define RFCSR29_RSSI_RIP_CTRL FIELD8(0x30) | ||
2088 | #define RFCSR29_RSSI_GAIN FIELD8(0xc0) | ||
2089 | |||
2090 | /* | ||
1920 | * RFCSR 30: | 2091 | * RFCSR 30: |
1921 | */ | 2092 | */ |
1922 | #define RFCSR30_TX_H20M FIELD8(0x02) | 2093 | #define RFCSR30_TX_H20M FIELD8(0x02) |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 4d3747c3010b..068276ee8aff 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -354,16 +354,15 @@ int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, | |||
354 | * of 4kb. Certain USB chipsets however require different firmware, | 354 | * of 4kb. Certain USB chipsets however require different firmware, |
355 | * which Ralink only provides attached to the original firmware | 355 | * which Ralink only provides attached to the original firmware |
356 | * file. Thus for USB devices, firmware files have a length | 356 | * file. Thus for USB devices, firmware files have a length |
357 | * which is a multiple of 4kb. | 357 | * which is a multiple of 4kb. The firmware for rt3290 chip also |
358 | * have a length which is a multiple of 4kb. | ||
358 | */ | 359 | */ |
359 | if (rt2x00_is_usb(rt2x00dev)) { | 360 | if (rt2x00_is_usb(rt2x00dev) || rt2x00_rt(rt2x00dev, RT3290)) |
360 | fw_len = 4096; | 361 | fw_len = 4096; |
361 | multiple = true; | 362 | else |
362 | } else { | ||
363 | fw_len = 8192; | 363 | fw_len = 8192; |
364 | multiple = true; | ||
365 | } | ||
366 | 364 | ||
365 | multiple = true; | ||
367 | /* | 366 | /* |
368 | * Validate the firmware length | 367 | * Validate the firmware length |
369 | */ | 368 | */ |
@@ -415,7 +414,8 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
415 | return -EBUSY; | 414 | return -EBUSY; |
416 | 415 | ||
417 | if (rt2x00_is_pci(rt2x00dev)) { | 416 | if (rt2x00_is_pci(rt2x00dev)) { |
418 | if (rt2x00_rt(rt2x00dev, RT3572) || | 417 | if (rt2x00_rt(rt2x00dev, RT3290) || |
418 | rt2x00_rt(rt2x00dev, RT3572) || | ||
419 | rt2x00_rt(rt2x00dev, RT5390) || | 419 | rt2x00_rt(rt2x00dev, RT5390) || |
420 | rt2x00_rt(rt2x00dev, RT5392)) { | 420 | rt2x00_rt(rt2x00dev, RT5392)) { |
421 | rt2800_register_read(rt2x00dev, AUX_CTRL, ®); | 421 | rt2800_register_read(rt2x00dev, AUX_CTRL, ®); |
@@ -851,8 +851,13 @@ int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
851 | { | 851 | { |
852 | u32 reg; | 852 | u32 reg; |
853 | 853 | ||
854 | rt2800_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); | 854 | if (rt2x00_rt(rt2x00dev, RT3290)) { |
855 | return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2); | 855 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); |
856 | return rt2x00_get_field32(reg, WLAN_GPIO_IN_BIT0); | ||
857 | } else { | ||
858 | rt2800_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); | ||
859 | return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2); | ||
860 | } | ||
856 | } | 861 | } |
857 | EXPORT_SYMBOL_GPL(rt2800_rfkill_poll); | 862 | EXPORT_SYMBOL_GPL(rt2800_rfkill_poll); |
858 | 863 | ||
@@ -1935,9 +1940,54 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev, | |||
1935 | rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); | 1940 | rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); |
1936 | } | 1941 | } |
1937 | 1942 | ||
1943 | #define RT3290_POWER_BOUND 0x27 | ||
1944 | #define RT3290_FREQ_OFFSET_BOUND 0x5f | ||
1938 | #define RT5390_POWER_BOUND 0x27 | 1945 | #define RT5390_POWER_BOUND 0x27 |
1939 | #define RT5390_FREQ_OFFSET_BOUND 0x5f | 1946 | #define RT5390_FREQ_OFFSET_BOUND 0x5f |
1940 | 1947 | ||
1948 | static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev, | ||
1949 | struct ieee80211_conf *conf, | ||
1950 | struct rf_channel *rf, | ||
1951 | struct channel_info *info) | ||
1952 | { | ||
1953 | u8 rfcsr; | ||
1954 | |||
1955 | rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); | ||
1956 | rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); | ||
1957 | rt2800_rfcsr_read(rt2x00dev, 11, &rfcsr); | ||
1958 | rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf2); | ||
1959 | rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); | ||
1960 | |||
1961 | rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr); | ||
1962 | if (info->default_power1 > RT3290_POWER_BOUND) | ||
1963 | rt2x00_set_field8(&rfcsr, RFCSR49_TX, RT3290_POWER_BOUND); | ||
1964 | else | ||
1965 | rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); | ||
1966 | rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); | ||
1967 | |||
1968 | rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); | ||
1969 | if (rt2x00dev->freq_offset > RT3290_FREQ_OFFSET_BOUND) | ||
1970 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, | ||
1971 | RT3290_FREQ_OFFSET_BOUND); | ||
1972 | else | ||
1973 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); | ||
1974 | rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); | ||
1975 | |||
1976 | if (rf->channel <= 14) { | ||
1977 | if (rf->channel == 6) | ||
1978 | rt2800_bbp_write(rt2x00dev, 68, 0x0c); | ||
1979 | else | ||
1980 | rt2800_bbp_write(rt2x00dev, 68, 0x0b); | ||
1981 | |||
1982 | if (rf->channel >= 1 && rf->channel <= 6) | ||
1983 | rt2800_bbp_write(rt2x00dev, 59, 0x0f); | ||
1984 | else if (rf->channel >= 7 && rf->channel <= 11) | ||
1985 | rt2800_bbp_write(rt2x00dev, 59, 0x0e); | ||
1986 | else if (rf->channel >= 12 && rf->channel <= 14) | ||
1987 | rt2800_bbp_write(rt2x00dev, 59, 0x0d); | ||
1988 | } | ||
1989 | } | ||
1990 | |||
1941 | static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, | 1991 | static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, |
1942 | struct ieee80211_conf *conf, | 1992 | struct ieee80211_conf *conf, |
1943 | struct rf_channel *rf, | 1993 | struct rf_channel *rf, |
@@ -2036,15 +2086,6 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, | |||
2036 | } | 2086 | } |
2037 | } | 2087 | } |
2038 | } | 2088 | } |
2039 | |||
2040 | rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); | ||
2041 | rt2x00_set_field8(&rfcsr, RFCSR30_TX_H20M, 0); | ||
2042 | rt2x00_set_field8(&rfcsr, RFCSR30_RX_H20M, 0); | ||
2043 | rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); | ||
2044 | |||
2045 | rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); | ||
2046 | rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); | ||
2047 | rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); | ||
2048 | } | 2089 | } |
2049 | 2090 | ||
2050 | static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | 2091 | static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, |
@@ -2054,7 +2095,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
2054 | { | 2095 | { |
2055 | u32 reg; | 2096 | u32 reg; |
2056 | unsigned int tx_pin; | 2097 | unsigned int tx_pin; |
2057 | u8 bbp; | 2098 | u8 bbp, rfcsr; |
2058 | 2099 | ||
2059 | if (rf->channel <= 14) { | 2100 | if (rf->channel <= 14) { |
2060 | info->default_power1 = TXPOWER_G_TO_DEV(info->default_power1); | 2101 | info->default_power1 = TXPOWER_G_TO_DEV(info->default_power1); |
@@ -2075,6 +2116,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
2075 | case RF3052: | 2116 | case RF3052: |
2076 | rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); | 2117 | rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); |
2077 | break; | 2118 | break; |
2119 | case RF3290: | ||
2120 | rt2800_config_channel_rf3290(rt2x00dev, conf, rf, info); | ||
2121 | break; | ||
2078 | case RF5360: | 2122 | case RF5360: |
2079 | case RF5370: | 2123 | case RF5370: |
2080 | case RF5372: | 2124 | case RF5372: |
@@ -2086,6 +2130,22 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
2086 | rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); | 2130 | rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); |
2087 | } | 2131 | } |
2088 | 2132 | ||
2133 | if (rt2x00_rf(rt2x00dev, RF3290) || | ||
2134 | rt2x00_rf(rt2x00dev, RF5360) || | ||
2135 | rt2x00_rf(rt2x00dev, RF5370) || | ||
2136 | rt2x00_rf(rt2x00dev, RF5372) || | ||
2137 | rt2x00_rf(rt2x00dev, RF5390) || | ||
2138 | rt2x00_rf(rt2x00dev, RF5392)) { | ||
2139 | rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); | ||
2140 | rt2x00_set_field8(&rfcsr, RFCSR30_TX_H20M, 0); | ||
2141 | rt2x00_set_field8(&rfcsr, RFCSR30_RX_H20M, 0); | ||
2142 | rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); | ||
2143 | |||
2144 | rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); | ||
2145 | rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); | ||
2146 | rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); | ||
2147 | } | ||
2148 | |||
2089 | /* | 2149 | /* |
2090 | * Change BBP settings | 2150 | * Change BBP settings |
2091 | */ | 2151 | */ |
@@ -2566,6 +2626,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev) | |||
2566 | rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); | 2626 | rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); |
2567 | rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); | 2627 | rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); |
2568 | break; | 2628 | break; |
2629 | case RF3290: | ||
2569 | case RF5360: | 2630 | case RF5360: |
2570 | case RF5370: | 2631 | case RF5370: |
2571 | case RF5372: | 2632 | case RF5372: |
@@ -2701,6 +2762,7 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) | |||
2701 | if (rt2x00_rt(rt2x00dev, RT3070) || | 2762 | if (rt2x00_rt(rt2x00dev, RT3070) || |
2702 | rt2x00_rt(rt2x00dev, RT3071) || | 2763 | rt2x00_rt(rt2x00dev, RT3071) || |
2703 | rt2x00_rt(rt2x00dev, RT3090) || | 2764 | rt2x00_rt(rt2x00dev, RT3090) || |
2765 | rt2x00_rt(rt2x00dev, RT3290) || | ||
2704 | rt2x00_rt(rt2x00dev, RT3390) || | 2766 | rt2x00_rt(rt2x00dev, RT3390) || |
2705 | rt2x00_rt(rt2x00dev, RT5390) || | 2767 | rt2x00_rt(rt2x00dev, RT5390) || |
2706 | rt2x00_rt(rt2x00dev, RT5392)) | 2768 | rt2x00_rt(rt2x00dev, RT5392)) |
@@ -2797,10 +2859,54 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
2797 | rt2x00_set_field32(®, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2); | 2859 | rt2x00_set_field32(®, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2); |
2798 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); | 2860 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); |
2799 | 2861 | ||
2862 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
2863 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
2864 | if (rt2x00_get_field32(reg, WLAN_EN) == 1) { | ||
2865 | rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 1); | ||
2866 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
2867 | } | ||
2868 | |||
2869 | rt2800_register_read(rt2x00dev, CMB_CTRL, ®); | ||
2870 | if (!(rt2x00_get_field32(reg, LDO0_EN) == 1)) { | ||
2871 | rt2x00_set_field32(®, LDO0_EN, 1); | ||
2872 | rt2x00_set_field32(®, LDO_BGSEL, 3); | ||
2873 | rt2800_register_write(rt2x00dev, CMB_CTRL, reg); | ||
2874 | } | ||
2875 | |||
2876 | rt2800_register_read(rt2x00dev, OSC_CTRL, ®); | ||
2877 | rt2x00_set_field32(®, OSC_ROSC_EN, 1); | ||
2878 | rt2x00_set_field32(®, OSC_CAL_REQ, 1); | ||
2879 | rt2x00_set_field32(®, OSC_REF_CYCLE, 0x27); | ||
2880 | rt2800_register_write(rt2x00dev, OSC_CTRL, reg); | ||
2881 | |||
2882 | rt2800_register_read(rt2x00dev, COEX_CFG0, ®); | ||
2883 | rt2x00_set_field32(®, COEX_CFG_ANT, 0x5e); | ||
2884 | rt2800_register_write(rt2x00dev, COEX_CFG0, reg); | ||
2885 | |||
2886 | rt2800_register_read(rt2x00dev, COEX_CFG2, ®); | ||
2887 | rt2x00_set_field32(®, BT_COEX_CFG1, 0x00); | ||
2888 | rt2x00_set_field32(®, BT_COEX_CFG0, 0x17); | ||
2889 | rt2x00_set_field32(®, WL_COEX_CFG1, 0x93); | ||
2890 | rt2x00_set_field32(®, WL_COEX_CFG0, 0x7f); | ||
2891 | rt2800_register_write(rt2x00dev, COEX_CFG2, reg); | ||
2892 | |||
2893 | rt2800_register_read(rt2x00dev, PLL_CTRL, ®); | ||
2894 | rt2x00_set_field32(®, PLL_CONTROL, 1); | ||
2895 | rt2800_register_write(rt2x00dev, PLL_CTRL, reg); | ||
2896 | } | ||
2897 | |||
2800 | if (rt2x00_rt(rt2x00dev, RT3071) || | 2898 | if (rt2x00_rt(rt2x00dev, RT3071) || |
2801 | rt2x00_rt(rt2x00dev, RT3090) || | 2899 | rt2x00_rt(rt2x00dev, RT3090) || |
2900 | rt2x00_rt(rt2x00dev, RT3290) || | ||
2802 | rt2x00_rt(rt2x00dev, RT3390)) { | 2901 | rt2x00_rt(rt2x00dev, RT3390)) { |
2803 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); | 2902 | |
2903 | if (rt2x00_rt(rt2x00dev, RT3290)) | ||
2904 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, | ||
2905 | 0x00000404); | ||
2906 | else | ||
2907 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, | ||
2908 | 0x00000400); | ||
2909 | |||
2804 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); | 2910 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); |
2805 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | 2911 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || |
2806 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || | 2912 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || |
@@ -3209,14 +3315,16 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3209 | rt2800_wait_bbp_ready(rt2x00dev))) | 3315 | rt2800_wait_bbp_ready(rt2x00dev))) |
3210 | return -EACCES; | 3316 | return -EACCES; |
3211 | 3317 | ||
3212 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3318 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3213 | rt2x00_rt(rt2x00dev, RT5392)) { | 3319 | rt2x00_rt(rt2x00dev, RT5390) || |
3320 | rt2x00_rt(rt2x00dev, RT5392)) { | ||
3214 | rt2800_bbp_read(rt2x00dev, 4, &value); | 3321 | rt2800_bbp_read(rt2x00dev, 4, &value); |
3215 | rt2x00_set_field8(&value, BBP4_MAC_IF_CTRL, 1); | 3322 | rt2x00_set_field8(&value, BBP4_MAC_IF_CTRL, 1); |
3216 | rt2800_bbp_write(rt2x00dev, 4, value); | 3323 | rt2800_bbp_write(rt2x00dev, 4, value); |
3217 | } | 3324 | } |
3218 | 3325 | ||
3219 | if (rt2800_is_305x_soc(rt2x00dev) || | 3326 | if (rt2800_is_305x_soc(rt2x00dev) || |
3327 | rt2x00_rt(rt2x00dev, RT3290) || | ||
3220 | rt2x00_rt(rt2x00dev, RT3572) || | 3328 | rt2x00_rt(rt2x00dev, RT3572) || |
3221 | rt2x00_rt(rt2x00dev, RT5390) || | 3329 | rt2x00_rt(rt2x00dev, RT5390) || |
3222 | rt2x00_rt(rt2x00dev, RT5392)) | 3330 | rt2x00_rt(rt2x00dev, RT5392)) |
@@ -3225,20 +3333,26 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3225 | rt2800_bbp_write(rt2x00dev, 65, 0x2c); | 3333 | rt2800_bbp_write(rt2x00dev, 65, 0x2c); |
3226 | rt2800_bbp_write(rt2x00dev, 66, 0x38); | 3334 | rt2800_bbp_write(rt2x00dev, 66, 0x38); |
3227 | 3335 | ||
3228 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3336 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3229 | rt2x00_rt(rt2x00dev, RT5392)) | 3337 | rt2x00_rt(rt2x00dev, RT5390) || |
3338 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3230 | rt2800_bbp_write(rt2x00dev, 68, 0x0b); | 3339 | rt2800_bbp_write(rt2x00dev, 68, 0x0b); |
3231 | 3340 | ||
3232 | if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { | 3341 | if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { |
3233 | rt2800_bbp_write(rt2x00dev, 69, 0x16); | 3342 | rt2800_bbp_write(rt2x00dev, 69, 0x16); |
3234 | rt2800_bbp_write(rt2x00dev, 73, 0x12); | 3343 | rt2800_bbp_write(rt2x00dev, 73, 0x12); |
3235 | } else if (rt2x00_rt(rt2x00dev, RT5390) || | 3344 | } else if (rt2x00_rt(rt2x00dev, RT3290) || |
3236 | rt2x00_rt(rt2x00dev, RT5392)) { | 3345 | rt2x00_rt(rt2x00dev, RT5390) || |
3346 | rt2x00_rt(rt2x00dev, RT5392)) { | ||
3237 | rt2800_bbp_write(rt2x00dev, 69, 0x12); | 3347 | rt2800_bbp_write(rt2x00dev, 69, 0x12); |
3238 | rt2800_bbp_write(rt2x00dev, 73, 0x13); | 3348 | rt2800_bbp_write(rt2x00dev, 73, 0x13); |
3239 | rt2800_bbp_write(rt2x00dev, 75, 0x46); | 3349 | rt2800_bbp_write(rt2x00dev, 75, 0x46); |
3240 | rt2800_bbp_write(rt2x00dev, 76, 0x28); | 3350 | rt2800_bbp_write(rt2x00dev, 76, 0x28); |
3241 | rt2800_bbp_write(rt2x00dev, 77, 0x59); | 3351 | |
3352 | if (rt2x00_rt(rt2x00dev, RT3290)) | ||
3353 | rt2800_bbp_write(rt2x00dev, 77, 0x58); | ||
3354 | else | ||
3355 | rt2800_bbp_write(rt2x00dev, 77, 0x59); | ||
3242 | } else { | 3356 | } else { |
3243 | rt2800_bbp_write(rt2x00dev, 69, 0x12); | 3357 | rt2800_bbp_write(rt2x00dev, 69, 0x12); |
3244 | rt2800_bbp_write(rt2x00dev, 73, 0x10); | 3358 | rt2800_bbp_write(rt2x00dev, 73, 0x10); |
@@ -3263,23 +3377,33 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3263 | rt2800_bbp_write(rt2x00dev, 81, 0x37); | 3377 | rt2800_bbp_write(rt2x00dev, 81, 0x37); |
3264 | } | 3378 | } |
3265 | 3379 | ||
3380 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
3381 | rt2800_bbp_write(rt2x00dev, 74, 0x0b); | ||
3382 | rt2800_bbp_write(rt2x00dev, 79, 0x18); | ||
3383 | rt2800_bbp_write(rt2x00dev, 80, 0x09); | ||
3384 | rt2800_bbp_write(rt2x00dev, 81, 0x33); | ||
3385 | } | ||
3386 | |||
3266 | rt2800_bbp_write(rt2x00dev, 82, 0x62); | 3387 | rt2800_bbp_write(rt2x00dev, 82, 0x62); |
3267 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3388 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3268 | rt2x00_rt(rt2x00dev, RT5392)) | 3389 | rt2x00_rt(rt2x00dev, RT5390) || |
3390 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3269 | rt2800_bbp_write(rt2x00dev, 83, 0x7a); | 3391 | rt2800_bbp_write(rt2x00dev, 83, 0x7a); |
3270 | else | 3392 | else |
3271 | rt2800_bbp_write(rt2x00dev, 83, 0x6a); | 3393 | rt2800_bbp_write(rt2x00dev, 83, 0x6a); |
3272 | 3394 | ||
3273 | if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) | 3395 | if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) |
3274 | rt2800_bbp_write(rt2x00dev, 84, 0x19); | 3396 | rt2800_bbp_write(rt2x00dev, 84, 0x19); |
3275 | else if (rt2x00_rt(rt2x00dev, RT5390) || | 3397 | else if (rt2x00_rt(rt2x00dev, RT3290) || |
3276 | rt2x00_rt(rt2x00dev, RT5392)) | 3398 | rt2x00_rt(rt2x00dev, RT5390) || |
3399 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3277 | rt2800_bbp_write(rt2x00dev, 84, 0x9a); | 3400 | rt2800_bbp_write(rt2x00dev, 84, 0x9a); |
3278 | else | 3401 | else |
3279 | rt2800_bbp_write(rt2x00dev, 84, 0x99); | 3402 | rt2800_bbp_write(rt2x00dev, 84, 0x99); |
3280 | 3403 | ||
3281 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3404 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3282 | rt2x00_rt(rt2x00dev, RT5392)) | 3405 | rt2x00_rt(rt2x00dev, RT5390) || |
3406 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3283 | rt2800_bbp_write(rt2x00dev, 86, 0x38); | 3407 | rt2800_bbp_write(rt2x00dev, 86, 0x38); |
3284 | else | 3408 | else |
3285 | rt2800_bbp_write(rt2x00dev, 86, 0x00); | 3409 | rt2800_bbp_write(rt2x00dev, 86, 0x00); |
@@ -3289,8 +3413,9 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3289 | 3413 | ||
3290 | rt2800_bbp_write(rt2x00dev, 91, 0x04); | 3414 | rt2800_bbp_write(rt2x00dev, 91, 0x04); |
3291 | 3415 | ||
3292 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3416 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3293 | rt2x00_rt(rt2x00dev, RT5392)) | 3417 | rt2x00_rt(rt2x00dev, RT5390) || |
3418 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3294 | rt2800_bbp_write(rt2x00dev, 92, 0x02); | 3419 | rt2800_bbp_write(rt2x00dev, 92, 0x02); |
3295 | else | 3420 | else |
3296 | rt2800_bbp_write(rt2x00dev, 92, 0x00); | 3421 | rt2800_bbp_write(rt2x00dev, 92, 0x00); |
@@ -3304,6 +3429,7 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3304 | rt2x00_rt_rev_gte(rt2x00dev, RT3071, REV_RT3071E) || | 3429 | rt2x00_rt_rev_gte(rt2x00dev, RT3071, REV_RT3071E) || |
3305 | rt2x00_rt_rev_gte(rt2x00dev, RT3090, REV_RT3090E) || | 3430 | rt2x00_rt_rev_gte(rt2x00dev, RT3090, REV_RT3090E) || |
3306 | rt2x00_rt_rev_gte(rt2x00dev, RT3390, REV_RT3390E) || | 3431 | rt2x00_rt_rev_gte(rt2x00dev, RT3390, REV_RT3390E) || |
3432 | rt2x00_rt(rt2x00dev, RT3290) || | ||
3307 | rt2x00_rt(rt2x00dev, RT3572) || | 3433 | rt2x00_rt(rt2x00dev, RT3572) || |
3308 | rt2x00_rt(rt2x00dev, RT5390) || | 3434 | rt2x00_rt(rt2x00dev, RT5390) || |
3309 | rt2x00_rt(rt2x00dev, RT5392) || | 3435 | rt2x00_rt(rt2x00dev, RT5392) || |
@@ -3312,27 +3438,32 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3312 | else | 3438 | else |
3313 | rt2800_bbp_write(rt2x00dev, 103, 0x00); | 3439 | rt2800_bbp_write(rt2x00dev, 103, 0x00); |
3314 | 3440 | ||
3315 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3441 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3316 | rt2x00_rt(rt2x00dev, RT5392)) | 3442 | rt2x00_rt(rt2x00dev, RT5390) || |
3443 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3317 | rt2800_bbp_write(rt2x00dev, 104, 0x92); | 3444 | rt2800_bbp_write(rt2x00dev, 104, 0x92); |
3318 | 3445 | ||
3319 | if (rt2800_is_305x_soc(rt2x00dev)) | 3446 | if (rt2800_is_305x_soc(rt2x00dev)) |
3320 | rt2800_bbp_write(rt2x00dev, 105, 0x01); | 3447 | rt2800_bbp_write(rt2x00dev, 105, 0x01); |
3448 | else if (rt2x00_rt(rt2x00dev, RT3290)) | ||
3449 | rt2800_bbp_write(rt2x00dev, 105, 0x1c); | ||
3321 | else if (rt2x00_rt(rt2x00dev, RT5390) || | 3450 | else if (rt2x00_rt(rt2x00dev, RT5390) || |
3322 | rt2x00_rt(rt2x00dev, RT5392)) | 3451 | rt2x00_rt(rt2x00dev, RT5392)) |
3323 | rt2800_bbp_write(rt2x00dev, 105, 0x3c); | 3452 | rt2800_bbp_write(rt2x00dev, 105, 0x3c); |
3324 | else | 3453 | else |
3325 | rt2800_bbp_write(rt2x00dev, 105, 0x05); | 3454 | rt2800_bbp_write(rt2x00dev, 105, 0x05); |
3326 | 3455 | ||
3327 | if (rt2x00_rt(rt2x00dev, RT5390)) | 3456 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3457 | rt2x00_rt(rt2x00dev, RT5390)) | ||
3328 | rt2800_bbp_write(rt2x00dev, 106, 0x03); | 3458 | rt2800_bbp_write(rt2x00dev, 106, 0x03); |
3329 | else if (rt2x00_rt(rt2x00dev, RT5392)) | 3459 | else if (rt2x00_rt(rt2x00dev, RT5392)) |
3330 | rt2800_bbp_write(rt2x00dev, 106, 0x12); | 3460 | rt2800_bbp_write(rt2x00dev, 106, 0x12); |
3331 | else | 3461 | else |
3332 | rt2800_bbp_write(rt2x00dev, 106, 0x35); | 3462 | rt2800_bbp_write(rt2x00dev, 106, 0x35); |
3333 | 3463 | ||
3334 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3464 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3335 | rt2x00_rt(rt2x00dev, RT5392)) | 3465 | rt2x00_rt(rt2x00dev, RT5390) || |
3466 | rt2x00_rt(rt2x00dev, RT5392)) | ||
3336 | rt2800_bbp_write(rt2x00dev, 128, 0x12); | 3467 | rt2800_bbp_write(rt2x00dev, 128, 0x12); |
3337 | 3468 | ||
3338 | if (rt2x00_rt(rt2x00dev, RT5392)) { | 3469 | if (rt2x00_rt(rt2x00dev, RT5392)) { |
@@ -3357,6 +3488,29 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3357 | rt2800_bbp_write(rt2x00dev, 138, value); | 3488 | rt2800_bbp_write(rt2x00dev, 138, value); |
3358 | } | 3489 | } |
3359 | 3490 | ||
3491 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
3492 | rt2800_bbp_write(rt2x00dev, 67, 0x24); | ||
3493 | rt2800_bbp_write(rt2x00dev, 143, 0x04); | ||
3494 | rt2800_bbp_write(rt2x00dev, 142, 0x99); | ||
3495 | rt2800_bbp_write(rt2x00dev, 150, 0x30); | ||
3496 | rt2800_bbp_write(rt2x00dev, 151, 0x2e); | ||
3497 | rt2800_bbp_write(rt2x00dev, 152, 0x20); | ||
3498 | rt2800_bbp_write(rt2x00dev, 153, 0x34); | ||
3499 | rt2800_bbp_write(rt2x00dev, 154, 0x40); | ||
3500 | rt2800_bbp_write(rt2x00dev, 155, 0x3b); | ||
3501 | rt2800_bbp_write(rt2x00dev, 253, 0x04); | ||
3502 | |||
3503 | rt2800_bbp_read(rt2x00dev, 47, &value); | ||
3504 | rt2x00_set_field8(&value, BBP47_TSSI_ADC6, 1); | ||
3505 | rt2800_bbp_write(rt2x00dev, 47, value); | ||
3506 | |||
3507 | /* Use 5-bit ADC for Acquisition and 8-bit ADC for data */ | ||
3508 | rt2800_bbp_read(rt2x00dev, 3, &value); | ||
3509 | rt2x00_set_field8(&value, BBP3_ADC_MODE_SWITCH, 1); | ||
3510 | rt2x00_set_field8(&value, BBP3_ADC_INIT_MODE, 1); | ||
3511 | rt2800_bbp_write(rt2x00dev, 3, value); | ||
3512 | } | ||
3513 | |||
3360 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3514 | if (rt2x00_rt(rt2x00dev, RT5390) || |
3361 | rt2x00_rt(rt2x00dev, RT5392)) { | 3515 | rt2x00_rt(rt2x00dev, RT5392)) { |
3362 | int ant, div_mode; | 3516 | int ant, div_mode; |
@@ -3489,6 +3643,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
3489 | if (!rt2x00_rt(rt2x00dev, RT3070) && | 3643 | if (!rt2x00_rt(rt2x00dev, RT3070) && |
3490 | !rt2x00_rt(rt2x00dev, RT3071) && | 3644 | !rt2x00_rt(rt2x00dev, RT3071) && |
3491 | !rt2x00_rt(rt2x00dev, RT3090) && | 3645 | !rt2x00_rt(rt2x00dev, RT3090) && |
3646 | !rt2x00_rt(rt2x00dev, RT3290) && | ||
3492 | !rt2x00_rt(rt2x00dev, RT3390) && | 3647 | !rt2x00_rt(rt2x00dev, RT3390) && |
3493 | !rt2x00_rt(rt2x00dev, RT3572) && | 3648 | !rt2x00_rt(rt2x00dev, RT3572) && |
3494 | !rt2x00_rt(rt2x00dev, RT5390) && | 3649 | !rt2x00_rt(rt2x00dev, RT5390) && |
@@ -3499,8 +3654,9 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
3499 | /* | 3654 | /* |
3500 | * Init RF calibration. | 3655 | * Init RF calibration. |
3501 | */ | 3656 | */ |
3502 | if (rt2x00_rt(rt2x00dev, RT5390) || | 3657 | if (rt2x00_rt(rt2x00dev, RT3290) || |
3503 | rt2x00_rt(rt2x00dev, RT5392)) { | 3658 | rt2x00_rt(rt2x00dev, RT5390) || |
3659 | rt2x00_rt(rt2x00dev, RT5392)) { | ||
3504 | rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr); | 3660 | rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr); |
3505 | rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); | 3661 | rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); |
3506 | rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); | 3662 | rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); |
@@ -3538,6 +3694,53 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
3538 | rt2800_rfcsr_write(rt2x00dev, 24, 0x16); | 3694 | rt2800_rfcsr_write(rt2x00dev, 24, 0x16); |
3539 | rt2800_rfcsr_write(rt2x00dev, 25, 0x01); | 3695 | rt2800_rfcsr_write(rt2x00dev, 25, 0x01); |
3540 | rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); | 3696 | rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); |
3697 | } else if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
3698 | rt2800_rfcsr_write(rt2x00dev, 1, 0x0f); | ||
3699 | rt2800_rfcsr_write(rt2x00dev, 2, 0x80); | ||
3700 | rt2800_rfcsr_write(rt2x00dev, 3, 0x08); | ||
3701 | rt2800_rfcsr_write(rt2x00dev, 4, 0x00); | ||
3702 | rt2800_rfcsr_write(rt2x00dev, 6, 0xa0); | ||
3703 | rt2800_rfcsr_write(rt2x00dev, 8, 0xf3); | ||
3704 | rt2800_rfcsr_write(rt2x00dev, 9, 0x02); | ||
3705 | rt2800_rfcsr_write(rt2x00dev, 10, 0x53); | ||
3706 | rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); | ||
3707 | rt2800_rfcsr_write(rt2x00dev, 12, 0x46); | ||
3708 | rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); | ||
3709 | rt2800_rfcsr_write(rt2x00dev, 18, 0x02); | ||
3710 | rt2800_rfcsr_write(rt2x00dev, 22, 0x20); | ||
3711 | rt2800_rfcsr_write(rt2x00dev, 25, 0x83); | ||
3712 | rt2800_rfcsr_write(rt2x00dev, 26, 0x82); | ||
3713 | rt2800_rfcsr_write(rt2x00dev, 27, 0x09); | ||
3714 | rt2800_rfcsr_write(rt2x00dev, 29, 0x10); | ||
3715 | rt2800_rfcsr_write(rt2x00dev, 30, 0x10); | ||
3716 | rt2800_rfcsr_write(rt2x00dev, 31, 0x80); | ||
3717 | rt2800_rfcsr_write(rt2x00dev, 32, 0x80); | ||
3718 | rt2800_rfcsr_write(rt2x00dev, 33, 0x00); | ||
3719 | rt2800_rfcsr_write(rt2x00dev, 34, 0x05); | ||
3720 | rt2800_rfcsr_write(rt2x00dev, 35, 0x12); | ||
3721 | rt2800_rfcsr_write(rt2x00dev, 36, 0x00); | ||
3722 | rt2800_rfcsr_write(rt2x00dev, 38, 0x85); | ||
3723 | rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); | ||
3724 | rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); | ||
3725 | rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); | ||
3726 | rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); | ||
3727 | rt2800_rfcsr_write(rt2x00dev, 43, 0x7b); | ||
3728 | rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); | ||
3729 | rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); | ||
3730 | rt2800_rfcsr_write(rt2x00dev, 46, 0x73); | ||
3731 | rt2800_rfcsr_write(rt2x00dev, 47, 0x00); | ||
3732 | rt2800_rfcsr_write(rt2x00dev, 48, 0x10); | ||
3733 | rt2800_rfcsr_write(rt2x00dev, 49, 0x98); | ||
3734 | rt2800_rfcsr_write(rt2x00dev, 52, 0x38); | ||
3735 | rt2800_rfcsr_write(rt2x00dev, 53, 0x00); | ||
3736 | rt2800_rfcsr_write(rt2x00dev, 54, 0x78); | ||
3737 | rt2800_rfcsr_write(rt2x00dev, 55, 0x43); | ||
3738 | rt2800_rfcsr_write(rt2x00dev, 56, 0x02); | ||
3739 | rt2800_rfcsr_write(rt2x00dev, 57, 0x80); | ||
3740 | rt2800_rfcsr_write(rt2x00dev, 58, 0x7f); | ||
3741 | rt2800_rfcsr_write(rt2x00dev, 59, 0x09); | ||
3742 | rt2800_rfcsr_write(rt2x00dev, 60, 0x45); | ||
3743 | rt2800_rfcsr_write(rt2x00dev, 61, 0xc1); | ||
3541 | } else if (rt2x00_rt(rt2x00dev, RT3390)) { | 3744 | } else if (rt2x00_rt(rt2x00dev, RT3390)) { |
3542 | rt2800_rfcsr_write(rt2x00dev, 0, 0xa0); | 3745 | rt2800_rfcsr_write(rt2x00dev, 0, 0xa0); |
3543 | rt2800_rfcsr_write(rt2x00dev, 1, 0xe1); | 3746 | rt2800_rfcsr_write(rt2x00dev, 1, 0xe1); |
@@ -3946,6 +4149,12 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
3946 | rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); | 4149 | rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); |
3947 | } | 4150 | } |
3948 | 4151 | ||
4152 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
4153 | rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr); | ||
4154 | rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3); | ||
4155 | rt2800_rfcsr_write(rt2x00dev, 29, rfcsr); | ||
4156 | } | ||
4157 | |||
3949 | if (rt2x00_rt(rt2x00dev, RT5390) || | 4158 | if (rt2x00_rt(rt2x00dev, RT5390) || |
3950 | rt2x00_rt(rt2x00dev, RT5392)) { | 4159 | rt2x00_rt(rt2x00dev, RT5392)) { |
3951 | rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr); | 4160 | rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr); |
@@ -4052,9 +4261,14 @@ EXPORT_SYMBOL_GPL(rt2800_disable_radio); | |||
4052 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) | 4261 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) |
4053 | { | 4262 | { |
4054 | u32 reg; | 4263 | u32 reg; |
4264 | u16 efuse_ctrl_reg; | ||
4055 | 4265 | ||
4056 | rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®); | 4266 | if (rt2x00_rt(rt2x00dev, RT3290)) |
4267 | efuse_ctrl_reg = EFUSE_CTRL_3290; | ||
4268 | else | ||
4269 | efuse_ctrl_reg = EFUSE_CTRL; | ||
4057 | 4270 | ||
4271 | rt2800_register_read(rt2x00dev, efuse_ctrl_reg, ®); | ||
4058 | return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT); | 4272 | return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT); |
4059 | } | 4273 | } |
4060 | EXPORT_SYMBOL_GPL(rt2800_efuse_detect); | 4274 | EXPORT_SYMBOL_GPL(rt2800_efuse_detect); |
@@ -4062,27 +4276,44 @@ EXPORT_SYMBOL_GPL(rt2800_efuse_detect); | |||
4062 | static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) | 4276 | static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) |
4063 | { | 4277 | { |
4064 | u32 reg; | 4278 | u32 reg; |
4065 | 4279 | u16 efuse_ctrl_reg; | |
4280 | u16 efuse_data0_reg; | ||
4281 | u16 efuse_data1_reg; | ||
4282 | u16 efuse_data2_reg; | ||
4283 | u16 efuse_data3_reg; | ||
4284 | |||
4285 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
4286 | efuse_ctrl_reg = EFUSE_CTRL_3290; | ||
4287 | efuse_data0_reg = EFUSE_DATA0_3290; | ||
4288 | efuse_data1_reg = EFUSE_DATA1_3290; | ||
4289 | efuse_data2_reg = EFUSE_DATA2_3290; | ||
4290 | efuse_data3_reg = EFUSE_DATA3_3290; | ||
4291 | } else { | ||
4292 | efuse_ctrl_reg = EFUSE_CTRL; | ||
4293 | efuse_data0_reg = EFUSE_DATA0; | ||
4294 | efuse_data1_reg = EFUSE_DATA1; | ||
4295 | efuse_data2_reg = EFUSE_DATA2; | ||
4296 | efuse_data3_reg = EFUSE_DATA3; | ||
4297 | } | ||
4066 | mutex_lock(&rt2x00dev->csr_mutex); | 4298 | mutex_lock(&rt2x00dev->csr_mutex); |
4067 | 4299 | ||
4068 | rt2800_register_read_lock(rt2x00dev, EFUSE_CTRL, ®); | 4300 | rt2800_register_read_lock(rt2x00dev, efuse_ctrl_reg, ®); |
4069 | rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i); | 4301 | rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i); |
4070 | rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0); | 4302 | rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0); |
4071 | rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1); | 4303 | rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1); |
4072 | rt2800_register_write_lock(rt2x00dev, EFUSE_CTRL, reg); | 4304 | rt2800_register_write_lock(rt2x00dev, efuse_ctrl_reg, reg); |
4073 | 4305 | ||
4074 | /* Wait until the EEPROM has been loaded */ | 4306 | /* Wait until the EEPROM has been loaded */ |
4075 | rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®); | 4307 | rt2800_regbusy_read(rt2x00dev, efuse_ctrl_reg, EFUSE_CTRL_KICK, ®); |
4076 | |||
4077 | /* Apparently the data is read from end to start */ | 4308 | /* Apparently the data is read from end to start */ |
4078 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®); | 4309 | rt2800_register_read_lock(rt2x00dev, efuse_data3_reg, ®); |
4079 | /* The returned value is in CPU order, but eeprom is le */ | 4310 | /* The returned value is in CPU order, but eeprom is le */ |
4080 | *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); | 4311 | *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); |
4081 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®); | 4312 | rt2800_register_read_lock(rt2x00dev, efuse_data2_reg, ®); |
4082 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); | 4313 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); |
4083 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®); | 4314 | rt2800_register_read_lock(rt2x00dev, efuse_data1_reg, ®); |
4084 | *(u32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg); | 4315 | *(u32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg); |
4085 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0, ®); | 4316 | rt2800_register_read_lock(rt2x00dev, efuse_data0_reg, ®); |
4086 | *(u32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg); | 4317 | *(u32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg); |
4087 | 4318 | ||
4088 | mutex_unlock(&rt2x00dev->csr_mutex); | 4319 | mutex_unlock(&rt2x00dev->csr_mutex); |
@@ -4244,9 +4475,14 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
4244 | * RT28xx/RT30xx: defined in "EEPROM_NIC_CONF0_RF_TYPE" field | 4475 | * RT28xx/RT30xx: defined in "EEPROM_NIC_CONF0_RF_TYPE" field |
4245 | * RT53xx: defined in "EEPROM_CHIP_ID" field | 4476 | * RT53xx: defined in "EEPROM_CHIP_ID" field |
4246 | */ | 4477 | */ |
4247 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | 4478 | if (rt2x00_rt(rt2x00dev, RT3290)) |
4248 | if (rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5390 || | 4479 | rt2800_register_read(rt2x00dev, MAC_CSR0_3290, ®); |
4249 | rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5392) | 4480 | else |
4481 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | ||
4482 | |||
4483 | if (rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT3290 || | ||
4484 | rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5390 || | ||
4485 | rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5392) | ||
4250 | rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &value); | 4486 | rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &value); |
4251 | else | 4487 | else |
4252 | value = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); | 4488 | value = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); |
@@ -4261,6 +4497,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
4261 | case RT3070: | 4497 | case RT3070: |
4262 | case RT3071: | 4498 | case RT3071: |
4263 | case RT3090: | 4499 | case RT3090: |
4500 | case RT3290: | ||
4264 | case RT3390: | 4501 | case RT3390: |
4265 | case RT3572: | 4502 | case RT3572: |
4266 | case RT5390: | 4503 | case RT5390: |
@@ -4281,6 +4518,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
4281 | case RF3021: | 4518 | case RF3021: |
4282 | case RF3022: | 4519 | case RF3022: |
4283 | case RF3052: | 4520 | case RF3052: |
4521 | case RF3290: | ||
4284 | case RF3320: | 4522 | case RF3320: |
4285 | case RF5360: | 4523 | case RF5360: |
4286 | case RF5370: | 4524 | case RF5370: |
@@ -4597,6 +4835,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
4597 | rt2x00_rf(rt2x00dev, RF2020) || | 4835 | rt2x00_rf(rt2x00dev, RF2020) || |
4598 | rt2x00_rf(rt2x00dev, RF3021) || | 4836 | rt2x00_rf(rt2x00dev, RF3021) || |
4599 | rt2x00_rf(rt2x00dev, RF3022) || | 4837 | rt2x00_rf(rt2x00dev, RF3022) || |
4838 | rt2x00_rf(rt2x00dev, RF3290) || | ||
4600 | rt2x00_rf(rt2x00dev, RF3320) || | 4839 | rt2x00_rf(rt2x00dev, RF3320) || |
4601 | rt2x00_rf(rt2x00dev, RF5360) || | 4840 | rt2x00_rf(rt2x00dev, RF5360) || |
4602 | rt2x00_rf(rt2x00dev, RF5370) || | 4841 | rt2x00_rf(rt2x00dev, RF5370) || |
@@ -4685,6 +4924,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
4685 | case RF3022: | 4924 | case RF3022: |
4686 | case RF3320: | 4925 | case RF3320: |
4687 | case RF3052: | 4926 | case RF3052: |
4927 | case RF3290: | ||
4688 | case RF5360: | 4928 | case RF5360: |
4689 | case RF5370: | 4929 | case RF5370: |
4690 | case RF5372: | 4930 | case RF5372: |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 206158b67426..dd436125fe3d 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -280,7 +280,13 @@ static void rt2800pci_stop_queue(struct data_queue *queue) | |||
280 | */ | 280 | */ |
281 | static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 281 | static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
282 | { | 282 | { |
283 | return FIRMWARE_RT2860; | 283 | /* |
284 | * Chip rt3290 use specific 4KB firmware named rt3290.bin. | ||
285 | */ | ||
286 | if (rt2x00_rt(rt2x00dev, RT3290)) | ||
287 | return FIRMWARE_RT3290; | ||
288 | else | ||
289 | return FIRMWARE_RT2860; | ||
284 | } | 290 | } |
285 | 291 | ||
286 | static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev, | 292 | static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev, |
@@ -974,6 +980,66 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
974 | return rt2800_validate_eeprom(rt2x00dev); | 980 | return rt2800_validate_eeprom(rt2x00dev); |
975 | } | 981 | } |
976 | 982 | ||
983 | static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev) | ||
984 | { | ||
985 | u32 reg; | ||
986 | int i, count; | ||
987 | |||
988 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
989 | if ((rt2x00_get_field32(reg, WLAN_EN) == 1)) | ||
990 | return 0; | ||
991 | |||
992 | rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff); | ||
993 | rt2x00_set_field32(®, FRC_WL_ANT_SET, 1); | ||
994 | rt2x00_set_field32(®, WLAN_CLK_EN, 0); | ||
995 | rt2x00_set_field32(®, WLAN_EN, 1); | ||
996 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
997 | |||
998 | udelay(REGISTER_BUSY_DELAY); | ||
999 | |||
1000 | count = 0; | ||
1001 | do { | ||
1002 | /* | ||
1003 | * Check PLL_LD & XTAL_RDY. | ||
1004 | */ | ||
1005 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
1006 | rt2800_register_read(rt2x00dev, CMB_CTRL, ®); | ||
1007 | if ((rt2x00_get_field32(reg, PLL_LD) == 1) && | ||
1008 | (rt2x00_get_field32(reg, XTAL_RDY) == 1)) | ||
1009 | break; | ||
1010 | udelay(REGISTER_BUSY_DELAY); | ||
1011 | } | ||
1012 | |||
1013 | if (i >= REGISTER_BUSY_COUNT) { | ||
1014 | |||
1015 | if (count >= 10) | ||
1016 | return -EIO; | ||
1017 | |||
1018 | rt2800_register_write(rt2x00dev, 0x58, 0x018); | ||
1019 | udelay(REGISTER_BUSY_DELAY); | ||
1020 | rt2800_register_write(rt2x00dev, 0x58, 0x418); | ||
1021 | udelay(REGISTER_BUSY_DELAY); | ||
1022 | rt2800_register_write(rt2x00dev, 0x58, 0x618); | ||
1023 | udelay(REGISTER_BUSY_DELAY); | ||
1024 | count++; | ||
1025 | } else { | ||
1026 | count = 0; | ||
1027 | } | ||
1028 | |||
1029 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
1030 | rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0); | ||
1031 | rt2x00_set_field32(®, WLAN_CLK_EN, 1); | ||
1032 | rt2x00_set_field32(®, WLAN_RESET, 1); | ||
1033 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
1034 | udelay(10); | ||
1035 | rt2x00_set_field32(®, WLAN_RESET, 0); | ||
1036 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
1037 | udelay(10); | ||
1038 | rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff); | ||
1039 | } while (count != 0); | ||
1040 | |||
1041 | return 0; | ||
1042 | } | ||
977 | static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 1043 | static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
978 | { | 1044 | { |
979 | int retval; | 1045 | int retval; |
@@ -997,6 +1063,17 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
997 | return retval; | 1063 | return retval; |
998 | 1064 | ||
999 | /* | 1065 | /* |
1066 | * In probe phase call rt2800_enable_wlan_rt3290 to enable wlan | ||
1067 | * clk for rt3290. That avoid the MCU fail in start phase. | ||
1068 | */ | ||
1069 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
1070 | retval = rt2800_enable_wlan_rt3290(rt2x00dev); | ||
1071 | |||
1072 | if (retval) | ||
1073 | return retval; | ||
1074 | } | ||
1075 | |||
1076 | /* | ||
1000 | * This device has multiple filters for control frames | 1077 | * This device has multiple filters for control frames |
1001 | * and has a separate filter for PS Poll frames. | 1078 | * and has a separate filter for PS Poll frames. |
1002 | */ | 1079 | */ |
@@ -1175,6 +1252,9 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { | |||
1175 | { PCI_DEVICE(0x1432, 0x7768) }, | 1252 | { PCI_DEVICE(0x1432, 0x7768) }, |
1176 | { PCI_DEVICE(0x1462, 0x891a) }, | 1253 | { PCI_DEVICE(0x1462, 0x891a) }, |
1177 | { PCI_DEVICE(0x1a3b, 0x1059) }, | 1254 | { PCI_DEVICE(0x1a3b, 0x1059) }, |
1255 | #ifdef CONFIG_RT2800PCI_RT3290 | ||
1256 | { PCI_DEVICE(0x1814, 0x3290) }, | ||
1257 | #endif | ||
1178 | #ifdef CONFIG_RT2800PCI_RT33XX | 1258 | #ifdef CONFIG_RT2800PCI_RT33XX |
1179 | { PCI_DEVICE(0x1814, 0x3390) }, | 1259 | { PCI_DEVICE(0x1814, 0x3390) }, |
1180 | #endif | 1260 | #endif |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h index 70e050d904c8..ab22a087c50d 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ b/drivers/net/wireless/rt2x00/rt2800pci.h | |||
@@ -47,6 +47,7 @@ | |||
47 | * 8051 firmware image. | 47 | * 8051 firmware image. |
48 | */ | 48 | */ |
49 | #define FIRMWARE_RT2860 "rt2860.bin" | 49 | #define FIRMWARE_RT2860 "rt2860.bin" |
50 | #define FIRMWARE_RT3290 "rt3290.bin" | ||
50 | #define FIRMWARE_IMAGE_BASE 0x2000 | 51 | #define FIRMWARE_IMAGE_BASE 0x2000 |
51 | 52 | ||
52 | /* | 53 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 20a504072895..6cf336595e25 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -971,6 +971,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
971 | { USB_DEVICE(0x0411, 0x015d) }, | 971 | { USB_DEVICE(0x0411, 0x015d) }, |
972 | { USB_DEVICE(0x0411, 0x016f) }, | 972 | { USB_DEVICE(0x0411, 0x016f) }, |
973 | { USB_DEVICE(0x0411, 0x01a2) }, | 973 | { USB_DEVICE(0x0411, 0x01a2) }, |
974 | { USB_DEVICE(0x0411, 0x01ee) }, | ||
974 | /* Corega */ | 975 | /* Corega */ |
975 | { USB_DEVICE(0x07aa, 0x002f) }, | 976 | { USB_DEVICE(0x07aa, 0x002f) }, |
976 | { USB_DEVICE(0x07aa, 0x003c) }, | 977 | { USB_DEVICE(0x07aa, 0x003c) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 8f754025b06e..8afb546c2b2d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -187,6 +187,7 @@ struct rt2x00_chip { | |||
187 | #define RT3070 0x3070 | 187 | #define RT3070 0x3070 |
188 | #define RT3071 0x3071 | 188 | #define RT3071 0x3071 |
189 | #define RT3090 0x3090 /* 2.4GHz PCIe */ | 189 | #define RT3090 0x3090 /* 2.4GHz PCIe */ |
190 | #define RT3290 0x3290 | ||
190 | #define RT3390 0x3390 | 191 | #define RT3390 0x3390 |
191 | #define RT3572 0x3572 | 192 | #define RT3572 0x3572 |
192 | #define RT3593 0x3593 | 193 | #define RT3593 0x3593 |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 0a4653a92cab..a0c8caef3b0a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -256,6 +256,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops) | |||
256 | struct ieee80211_hw *hw; | 256 | struct ieee80211_hw *hw; |
257 | struct rt2x00_dev *rt2x00dev; | 257 | struct rt2x00_dev *rt2x00dev; |
258 | int retval; | 258 | int retval; |
259 | u16 chip; | ||
259 | 260 | ||
260 | retval = pci_enable_device(pci_dev); | 261 | retval = pci_enable_device(pci_dev); |
261 | if (retval) { | 262 | if (retval) { |
@@ -305,6 +306,14 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops) | |||
305 | if (retval) | 306 | if (retval) |
306 | goto exit_free_device; | 307 | goto exit_free_device; |
307 | 308 | ||
309 | /* | ||
310 | * Because rt3290 chip use different efuse offset to read efuse data. | ||
311 | * So before read efuse it need to indicate it is the | ||
312 | * rt3290 or not. | ||
313 | */ | ||
314 | pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip); | ||
315 | rt2x00dev->chip.rt = chip; | ||
316 | |||
308 | retval = rt2x00lib_probe_dev(rt2x00dev); | 317 | retval = rt2x00lib_probe_dev(rt2x00dev); |
309 | if (retval) | 318 | if (retval) |
310 | goto exit_free_reg; | 319 | goto exit_free_reg; |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 2bebcb71a1e9..3b505395d869 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -47,6 +47,8 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8180_table) = { | |||
47 | { PCI_DEVICE(0x1799, 0x6001) }, | 47 | { PCI_DEVICE(0x1799, 0x6001) }, |
48 | { PCI_DEVICE(0x1799, 0x6020) }, | 48 | { PCI_DEVICE(0x1799, 0x6020) }, |
49 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x3300) }, | 49 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x3300) }, |
50 | { PCI_DEVICE(0x1186, 0x3301) }, | ||
51 | { PCI_DEVICE(0x1432, 0x7106) }, | ||
50 | { } | 52 | { } |
51 | }; | 53 | }; |
52 | 54 | ||
diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c index 2d1a8220d5c0..5b4b4d4eaf9e 100644 --- a/drivers/net/wireless/rtlwifi/cam.c +++ b/drivers/net/wireless/rtlwifi/cam.c | |||
@@ -128,7 +128,7 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, | |||
128 | u32 us_config; | 128 | u32 us_config; |
129 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 129 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
130 | 130 | ||
131 | RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, | 131 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, |
132 | "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n", | 132 | "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n", |
133 | ul_entry_idx, ul_key_id, ul_enc_alg, | 133 | ul_entry_idx, ul_key_id, ul_enc_alg, |
134 | ul_default_key, mac_addr); | 134 | ul_default_key, mac_addr); |
@@ -342,7 +342,8 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) | |||
342 | /* Remove from HW Security CAM */ | 342 | /* Remove from HW Security CAM */ |
343 | memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN); | 343 | memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN); |
344 | rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i); | 344 | rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i); |
345 | pr_info("&&&&&&&&&del entry %d\n", i); | 345 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, |
346 | "del CAM entry %d\n", i); | ||
346 | } | 347 | } |
347 | } | 348 | } |
348 | return; | 349 | return; |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 82d3afcfecd1..31138fdad1f7 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -1273,17 +1273,18 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
1273 | *after reset, release previous pending packet, | 1273 | *after reset, release previous pending packet, |
1274 | *and force the tx idx to the first one | 1274 | *and force the tx idx to the first one |
1275 | */ | 1275 | */ |
1276 | spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); | ||
1277 | for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { | 1276 | for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { |
1278 | if (rtlpci->tx_ring[i].desc) { | 1277 | if (rtlpci->tx_ring[i].desc) { |
1279 | struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[i]; | 1278 | struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[i]; |
1280 | 1279 | ||
1281 | while (skb_queue_len(&ring->queue)) { | 1280 | while (skb_queue_len(&ring->queue)) { |
1282 | struct rtl_tx_desc *entry = | 1281 | struct rtl_tx_desc *entry; |
1283 | &ring->desc[ring->idx]; | 1282 | struct sk_buff *skb; |
1284 | struct sk_buff *skb = | ||
1285 | __skb_dequeue(&ring->queue); | ||
1286 | 1283 | ||
1284 | spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, | ||
1285 | flags); | ||
1286 | entry = &ring->desc[ring->idx]; | ||
1287 | skb = __skb_dequeue(&ring->queue); | ||
1287 | pci_unmap_single(rtlpci->pdev, | 1288 | pci_unmap_single(rtlpci->pdev, |
1288 | rtlpriv->cfg->ops-> | 1289 | rtlpriv->cfg->ops-> |
1289 | get_desc((u8 *) | 1290 | get_desc((u8 *) |
@@ -1291,15 +1292,15 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
1291 | true, | 1292 | true, |
1292 | HW_DESC_TXBUFF_ADDR), | 1293 | HW_DESC_TXBUFF_ADDR), |
1293 | skb->len, PCI_DMA_TODEVICE); | 1294 | skb->len, PCI_DMA_TODEVICE); |
1294 | kfree_skb(skb); | ||
1295 | ring->idx = (ring->idx + 1) % ring->entries; | 1295 | ring->idx = (ring->idx + 1) % ring->entries; |
1296 | spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, | ||
1297 | flags); | ||
1298 | kfree_skb(skb); | ||
1296 | } | 1299 | } |
1297 | ring->idx = 0; | 1300 | ring->idx = 0; |
1298 | } | 1301 | } |
1299 | } | 1302 | } |
1300 | 1303 | ||
1301 | spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); | ||
1302 | |||
1303 | return 0; | 1304 | return 0; |
1304 | } | 1305 | } |
1305 | 1306 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 8d7099bc472c..b917a2a3caf7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
@@ -1247,6 +1247,9 @@ static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw *hw, u8 channel, | |||
1247 | /* Read HT 40 OFDM TX power */ | 1247 | /* Read HT 40 OFDM TX power */ |
1248 | ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_2s[0][index]; | 1248 | ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_2s[0][index]; |
1249 | ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_2s[1][index]; | 1249 | ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_2s[1][index]; |
1250 | } else { | ||
1251 | ofdmpowerLevel[0] = 0; | ||
1252 | ofdmpowerLevel[1] = 0; | ||
1250 | } | 1253 | } |
1251 | } | 1254 | } |
1252 | 1255 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index 730bcc919529..ad4b4803482d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include "../wifi.h" | 30 | #include "../wifi.h" |
31 | #include "../core.h" | 31 | #include "../core.h" |
32 | #include "../pci.h" | ||
33 | #include "../base.h" | 32 | #include "../base.h" |
34 | #include "../pci.h" | 33 | #include "../pci.h" |
35 | #include "reg.h" | 34 | #include "reg.h" |
diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c index d14d69d733a0..6822b845efc1 100644 --- a/drivers/net/wireless/ti/wl1251/cmd.c +++ b/drivers/net/wireless/ti/wl1251/cmd.c | |||
@@ -277,15 +277,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, | |||
277 | join->rx_config_options = wl->rx_config; | 277 | join->rx_config_options = wl->rx_config; |
278 | join->rx_filter_options = wl->rx_filter; | 278 | join->rx_filter_options = wl->rx_filter; |
279 | 279 | ||
280 | /* | ||
281 | * FIXME: disable temporarily all filters because after commit | ||
282 | * 9cef8737 "mac80211: fix managed mode BSSID handling" broke | ||
283 | * association. The filter logic needs to be implemented properly | ||
284 | * and once that is done, this hack can be removed. | ||
285 | */ | ||
286 | join->rx_config_options = 0; | ||
287 | join->rx_filter_options = WL1251_DEFAULT_RX_FILTER; | ||
288 | |||
289 | join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | | 280 | join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | |
290 | RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; | 281 | RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; |
291 | 282 | ||
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index d1afb8e3b2ef..3118c425bcf1 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c | |||
@@ -334,6 +334,12 @@ static int wl1251_join(struct wl1251 *wl, u8 bss_type, u8 channel, | |||
334 | if (ret < 0) | 334 | if (ret < 0) |
335 | goto out; | 335 | goto out; |
336 | 336 | ||
337 | /* | ||
338 | * Join command applies filters, and if we are not associated, | ||
339 | * BSSID filter must be disabled for association to work. | ||
340 | */ | ||
341 | if (is_zero_ether_addr(wl->bssid)) | ||
342 | wl->rx_config &= ~CFG_BSSID_FILTER_EN; | ||
337 | 343 | ||
338 | ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval, | 344 | ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval, |
339 | dtim_period); | 345 | dtim_period); |
@@ -348,33 +354,6 @@ out: | |||
348 | return ret; | 354 | return ret; |
349 | } | 355 | } |
350 | 356 | ||
351 | static void wl1251_filter_work(struct work_struct *work) | ||
352 | { | ||
353 | struct wl1251 *wl = | ||
354 | container_of(work, struct wl1251, filter_work); | ||
355 | int ret; | ||
356 | |||
357 | mutex_lock(&wl->mutex); | ||
358 | |||
359 | if (wl->state == WL1251_STATE_OFF) | ||
360 | goto out; | ||
361 | |||
362 | ret = wl1251_ps_elp_wakeup(wl); | ||
363 | if (ret < 0) | ||
364 | goto out; | ||
365 | |||
366 | ret = wl1251_join(wl, wl->bss_type, wl->channel, wl->beacon_int, | ||
367 | wl->dtim_period); | ||
368 | if (ret < 0) | ||
369 | goto out_sleep; | ||
370 | |||
371 | out_sleep: | ||
372 | wl1251_ps_elp_sleep(wl); | ||
373 | |||
374 | out: | ||
375 | mutex_unlock(&wl->mutex); | ||
376 | } | ||
377 | |||
378 | static void wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 357 | static void wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
379 | { | 358 | { |
380 | struct wl1251 *wl = hw->priv; | 359 | struct wl1251 *wl = hw->priv; |
@@ -478,7 +457,6 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
478 | 457 | ||
479 | cancel_work_sync(&wl->irq_work); | 458 | cancel_work_sync(&wl->irq_work); |
480 | cancel_work_sync(&wl->tx_work); | 459 | cancel_work_sync(&wl->tx_work); |
481 | cancel_work_sync(&wl->filter_work); | ||
482 | cancel_delayed_work_sync(&wl->elp_work); | 460 | cancel_delayed_work_sync(&wl->elp_work); |
483 | 461 | ||
484 | mutex_lock(&wl->mutex); | 462 | mutex_lock(&wl->mutex); |
@@ -681,13 +659,15 @@ out: | |||
681 | FIF_FCSFAIL | \ | 659 | FIF_FCSFAIL | \ |
682 | FIF_BCN_PRBRESP_PROMISC | \ | 660 | FIF_BCN_PRBRESP_PROMISC | \ |
683 | FIF_CONTROL | \ | 661 | FIF_CONTROL | \ |
684 | FIF_OTHER_BSS) | 662 | FIF_OTHER_BSS | \ |
663 | FIF_PROBE_REQ) | ||
685 | 664 | ||
686 | static void wl1251_op_configure_filter(struct ieee80211_hw *hw, | 665 | static void wl1251_op_configure_filter(struct ieee80211_hw *hw, |
687 | unsigned int changed, | 666 | unsigned int changed, |
688 | unsigned int *total,u64 multicast) | 667 | unsigned int *total,u64 multicast) |
689 | { | 668 | { |
690 | struct wl1251 *wl = hw->priv; | 669 | struct wl1251 *wl = hw->priv; |
670 | int ret; | ||
691 | 671 | ||
692 | wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter"); | 672 | wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter"); |
693 | 673 | ||
@@ -698,7 +678,7 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw, | |||
698 | /* no filters which we support changed */ | 678 | /* no filters which we support changed */ |
699 | return; | 679 | return; |
700 | 680 | ||
701 | /* FIXME: wl->rx_config and wl->rx_filter are not protected */ | 681 | mutex_lock(&wl->mutex); |
702 | 682 | ||
703 | wl->rx_config = WL1251_DEFAULT_RX_CONFIG; | 683 | wl->rx_config = WL1251_DEFAULT_RX_CONFIG; |
704 | wl->rx_filter = WL1251_DEFAULT_RX_FILTER; | 684 | wl->rx_filter = WL1251_DEFAULT_RX_FILTER; |
@@ -721,15 +701,25 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw, | |||
721 | } | 701 | } |
722 | if (*total & FIF_CONTROL) | 702 | if (*total & FIF_CONTROL) |
723 | wl->rx_filter |= CFG_RX_CTL_EN; | 703 | wl->rx_filter |= CFG_RX_CTL_EN; |
724 | if (*total & FIF_OTHER_BSS) | 704 | if (*total & FIF_OTHER_BSS || is_zero_ether_addr(wl->bssid)) |
725 | wl->rx_filter &= ~CFG_BSSID_FILTER_EN; | 705 | wl->rx_config &= ~CFG_BSSID_FILTER_EN; |
706 | if (*total & FIF_PROBE_REQ) | ||
707 | wl->rx_filter |= CFG_RX_PREQ_EN; | ||
726 | 708 | ||
727 | /* | 709 | if (wl->state == WL1251_STATE_OFF) |
728 | * FIXME: workqueues need to be properly cancelled on stop(), for | 710 | goto out; |
729 | * now let's just disable changing the filter settings. They will | 711 | |
730 | * be updated any on config(). | 712 | ret = wl1251_ps_elp_wakeup(wl); |
731 | */ | 713 | if (ret < 0) |
732 | /* schedule_work(&wl->filter_work); */ | 714 | goto out; |
715 | |||
716 | /* send filters to firmware */ | ||
717 | wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter); | ||
718 | |||
719 | wl1251_ps_elp_sleep(wl); | ||
720 | |||
721 | out: | ||
722 | mutex_unlock(&wl->mutex); | ||
733 | } | 723 | } |
734 | 724 | ||
735 | /* HW encryption */ | 725 | /* HW encryption */ |
@@ -1390,7 +1380,6 @@ struct ieee80211_hw *wl1251_alloc_hw(void) | |||
1390 | 1380 | ||
1391 | skb_queue_head_init(&wl->tx_queue); | 1381 | skb_queue_head_init(&wl->tx_queue); |
1392 | 1382 | ||
1393 | INIT_WORK(&wl->filter_work, wl1251_filter_work); | ||
1394 | INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); | 1383 | INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); |
1395 | wl->channel = WL1251_DEFAULT_CHANNEL; | 1384 | wl->channel = WL1251_DEFAULT_CHANNEL; |
1396 | wl->scanning = false; | 1385 | wl->scanning = false; |
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h index 9d8f5816c6f9..fd02060038de 100644 --- a/drivers/net/wireless/ti/wl1251/wl1251.h +++ b/drivers/net/wireless/ti/wl1251/wl1251.h | |||
@@ -315,7 +315,6 @@ struct wl1251 { | |||
315 | bool tx_queue_stopped; | 315 | bool tx_queue_stopped; |
316 | 316 | ||
317 | struct work_struct tx_work; | 317 | struct work_struct tx_work; |
318 | struct work_struct filter_work; | ||
319 | 318 | ||
320 | /* Pending TX frames */ | 319 | /* Pending TX frames */ |
321 | struct sk_buff *tx_frames[16]; | 320 | struct sk_buff *tx_frames[16]; |
diff --git a/drivers/net/wireless/ti/wl12xx/cmd.c b/drivers/net/wireless/ti/wl12xx/cmd.c index 50ba7480b790..30be784a40d8 100644 --- a/drivers/net/wireless/ti/wl12xx/cmd.c +++ b/drivers/net/wireless/ti/wl12xx/cmd.c | |||
@@ -174,7 +174,7 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
174 | struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; | 174 | struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; |
175 | struct wl1271_radio_parms_cmd *radio_parms; | 175 | struct wl1271_radio_parms_cmd *radio_parms; |
176 | struct wl1271_ini_general_params *gp = &nvs->general_params; | 176 | struct wl1271_ini_general_params *gp = &nvs->general_params; |
177 | int ret; | 177 | int ret, fem_idx; |
178 | 178 | ||
179 | if (!wl->nvs) | 179 | if (!wl->nvs) |
180 | return -ENODEV; | 180 | return -ENODEV; |
@@ -185,11 +185,13 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
185 | 185 | ||
186 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | 186 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; |
187 | 187 | ||
188 | fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); | ||
189 | |||
188 | /* 2.4GHz parameters */ | 190 | /* 2.4GHz parameters */ |
189 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | 191 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, |
190 | sizeof(struct wl1271_ini_band_params_2)); | 192 | sizeof(struct wl1271_ini_band_params_2)); |
191 | memcpy(&radio_parms->dyn_params_2, | 193 | memcpy(&radio_parms->dyn_params_2, |
192 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | 194 | &nvs->dyn_radio_params_2[fem_idx].params, |
193 | sizeof(struct wl1271_ini_fem_params_2)); | 195 | sizeof(struct wl1271_ini_fem_params_2)); |
194 | 196 | ||
195 | /* 5GHz parameters */ | 197 | /* 5GHz parameters */ |
@@ -197,7 +199,7 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
197 | &nvs->stat_radio_params_5, | 199 | &nvs->stat_radio_params_5, |
198 | sizeof(struct wl1271_ini_band_params_5)); | 200 | sizeof(struct wl1271_ini_band_params_5)); |
199 | memcpy(&radio_parms->dyn_params_5, | 201 | memcpy(&radio_parms->dyn_params_5, |
200 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | 202 | &nvs->dyn_radio_params_5[fem_idx].params, |
201 | sizeof(struct wl1271_ini_fem_params_5)); | 203 | sizeof(struct wl1271_ini_fem_params_5)); |
202 | 204 | ||
203 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | 205 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", |
@@ -216,7 +218,7 @@ int wl128x_cmd_radio_parms(struct wl1271 *wl) | |||
216 | struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; | 218 | struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; |
217 | struct wl128x_radio_parms_cmd *radio_parms; | 219 | struct wl128x_radio_parms_cmd *radio_parms; |
218 | struct wl128x_ini_general_params *gp = &nvs->general_params; | 220 | struct wl128x_ini_general_params *gp = &nvs->general_params; |
219 | int ret; | 221 | int ret, fem_idx; |
220 | 222 | ||
221 | if (!wl->nvs) | 223 | if (!wl->nvs) |
222 | return -ENODEV; | 224 | return -ENODEV; |
@@ -227,11 +229,13 @@ int wl128x_cmd_radio_parms(struct wl1271 *wl) | |||
227 | 229 | ||
228 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | 230 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; |
229 | 231 | ||
232 | fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); | ||
233 | |||
230 | /* 2.4GHz parameters */ | 234 | /* 2.4GHz parameters */ |
231 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | 235 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, |
232 | sizeof(struct wl128x_ini_band_params_2)); | 236 | sizeof(struct wl128x_ini_band_params_2)); |
233 | memcpy(&radio_parms->dyn_params_2, | 237 | memcpy(&radio_parms->dyn_params_2, |
234 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | 238 | &nvs->dyn_radio_params_2[fem_idx].params, |
235 | sizeof(struct wl128x_ini_fem_params_2)); | 239 | sizeof(struct wl128x_ini_fem_params_2)); |
236 | 240 | ||
237 | /* 5GHz parameters */ | 241 | /* 5GHz parameters */ |
@@ -239,7 +243,7 @@ int wl128x_cmd_radio_parms(struct wl1271 *wl) | |||
239 | &nvs->stat_radio_params_5, | 243 | &nvs->stat_radio_params_5, |
240 | sizeof(struct wl128x_ini_band_params_5)); | 244 | sizeof(struct wl128x_ini_band_params_5)); |
241 | memcpy(&radio_parms->dyn_params_5, | 245 | memcpy(&radio_parms->dyn_params_5, |
242 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | 246 | &nvs->dyn_radio_params_5[fem_idx].params, |
243 | sizeof(struct wl128x_ini_fem_params_5)); | 247 | sizeof(struct wl128x_ini_fem_params_5)); |
244 | 248 | ||
245 | radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; | 249 | radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; |
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 85d1600ee340..47ba2e0017f4 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -246,6 +246,7 @@ static struct wlcore_conf wl12xx_conf = { | |||
246 | .forced_ps = false, | 246 | .forced_ps = false, |
247 | .keep_alive_interval = 55000, | 247 | .keep_alive_interval = 55000, |
248 | .max_listen_interval = 20, | 248 | .max_listen_interval = 20, |
249 | .sta_sleep_auth = WL1271_PSM_ILLEGAL, | ||
249 | }, | 250 | }, |
250 | .itrim = { | 251 | .itrim = { |
251 | .enable = false, | 252 | .enable = false, |
@@ -597,8 +598,10 @@ static const int wl12xx_rtable[REG_TABLE_LEN] = { | |||
597 | #define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-4-sr.bin" | 598 | #define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-4-sr.bin" |
598 | #define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-4-plt.bin" | 599 | #define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-4-plt.bin" |
599 | 600 | ||
600 | static void wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) | 601 | static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) |
601 | { | 602 | { |
603 | int ret; | ||
604 | |||
602 | if (wl->chip.id != CHIP_ID_1283_PG20) { | 605 | if (wl->chip.id != CHIP_ID_1283_PG20) { |
603 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; | 606 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; |
604 | struct wl127x_rx_mem_pool_addr rx_mem_addr; | 607 | struct wl127x_rx_mem_pool_addr rx_mem_addr; |
@@ -615,9 +618,13 @@ static void wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) | |||
615 | 618 | ||
616 | rx_mem_addr.addr_extra = rx_mem_addr.addr + 4; | 619 | rx_mem_addr.addr_extra = rx_mem_addr.addr + 4; |
617 | 620 | ||
618 | wl1271_write(wl, WL1271_SLV_REG_DATA, | 621 | ret = wlcore_write(wl, WL1271_SLV_REG_DATA, &rx_mem_addr, |
619 | &rx_mem_addr, sizeof(rx_mem_addr), false); | 622 | sizeof(rx_mem_addr), false); |
623 | if (ret < 0) | ||
624 | return ret; | ||
620 | } | 625 | } |
626 | |||
627 | return 0; | ||
621 | } | 628 | } |
622 | 629 | ||
623 | static int wl12xx_identify_chip(struct wl1271 *wl) | 630 | static int wl12xx_identify_chip(struct wl1271 *wl) |
@@ -681,64 +688,95 @@ out: | |||
681 | return ret; | 688 | return ret; |
682 | } | 689 | } |
683 | 690 | ||
684 | static void wl12xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) | 691 | static int __must_check wl12xx_top_reg_write(struct wl1271 *wl, int addr, |
692 | u16 val) | ||
685 | { | 693 | { |
694 | int ret; | ||
695 | |||
686 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ | 696 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ |
687 | addr = (addr >> 1) + 0x30000; | 697 | addr = (addr >> 1) + 0x30000; |
688 | wl1271_write32(wl, WL12XX_OCP_POR_CTR, addr); | 698 | ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); |
699 | if (ret < 0) | ||
700 | goto out; | ||
689 | 701 | ||
690 | /* write value to OCP_POR_WDATA */ | 702 | /* write value to OCP_POR_WDATA */ |
691 | wl1271_write32(wl, WL12XX_OCP_DATA_WRITE, val); | 703 | ret = wlcore_write32(wl, WL12XX_OCP_DATA_WRITE, val); |
704 | if (ret < 0) | ||
705 | goto out; | ||
692 | 706 | ||
693 | /* write 1 to OCP_CMD */ | 707 | /* write 1 to OCP_CMD */ |
694 | wl1271_write32(wl, WL12XX_OCP_CMD, OCP_CMD_WRITE); | 708 | ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_WRITE); |
709 | if (ret < 0) | ||
710 | goto out; | ||
711 | |||
712 | out: | ||
713 | return ret; | ||
695 | } | 714 | } |
696 | 715 | ||
697 | static u16 wl12xx_top_reg_read(struct wl1271 *wl, int addr) | 716 | static int __must_check wl12xx_top_reg_read(struct wl1271 *wl, int addr, |
717 | u16 *out) | ||
698 | { | 718 | { |
699 | u32 val; | 719 | u32 val; |
700 | int timeout = OCP_CMD_LOOP; | 720 | int timeout = OCP_CMD_LOOP; |
721 | int ret; | ||
701 | 722 | ||
702 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ | 723 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ |
703 | addr = (addr >> 1) + 0x30000; | 724 | addr = (addr >> 1) + 0x30000; |
704 | wl1271_write32(wl, WL12XX_OCP_POR_CTR, addr); | 725 | ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); |
726 | if (ret < 0) | ||
727 | return ret; | ||
705 | 728 | ||
706 | /* write 2 to OCP_CMD */ | 729 | /* write 2 to OCP_CMD */ |
707 | wl1271_write32(wl, WL12XX_OCP_CMD, OCP_CMD_READ); | 730 | ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_READ); |
731 | if (ret < 0) | ||
732 | return ret; | ||
708 | 733 | ||
709 | /* poll for data ready */ | 734 | /* poll for data ready */ |
710 | do { | 735 | do { |
711 | val = wl1271_read32(wl, WL12XX_OCP_DATA_READ); | 736 | ret = wlcore_read32(wl, WL12XX_OCP_DATA_READ, &val); |
737 | if (ret < 0) | ||
738 | return ret; | ||
712 | } while (!(val & OCP_READY_MASK) && --timeout); | 739 | } while (!(val & OCP_READY_MASK) && --timeout); |
713 | 740 | ||
714 | if (!timeout) { | 741 | if (!timeout) { |
715 | wl1271_warning("Top register access timed out."); | 742 | wl1271_warning("Top register access timed out."); |
716 | return 0xffff; | 743 | return -ETIMEDOUT; |
717 | } | 744 | } |
718 | 745 | ||
719 | /* check data status and return if OK */ | 746 | /* check data status and return if OK */ |
720 | if ((val & OCP_STATUS_MASK) == OCP_STATUS_OK) | 747 | if ((val & OCP_STATUS_MASK) != OCP_STATUS_OK) { |
721 | return val & 0xffff; | ||
722 | else { | ||
723 | wl1271_warning("Top register access returned error."); | 748 | wl1271_warning("Top register access returned error."); |
724 | return 0xffff; | 749 | return -EIO; |
725 | } | 750 | } |
751 | |||
752 | if (out) | ||
753 | *out = val & 0xffff; | ||
754 | |||
755 | return 0; | ||
726 | } | 756 | } |
727 | 757 | ||
728 | static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) | 758 | static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) |
729 | { | 759 | { |
730 | u16 spare_reg; | 760 | u16 spare_reg; |
761 | int ret; | ||
731 | 762 | ||
732 | /* Mask bits [2] & [8:4] in the sys_clk_cfg register */ | 763 | /* Mask bits [2] & [8:4] in the sys_clk_cfg register */ |
733 | spare_reg = wl12xx_top_reg_read(wl, WL_SPARE_REG); | 764 | ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); |
765 | if (ret < 0) | ||
766 | return ret; | ||
767 | |||
734 | if (spare_reg == 0xFFFF) | 768 | if (spare_reg == 0xFFFF) |
735 | return -EFAULT; | 769 | return -EFAULT; |
736 | spare_reg |= (BIT(3) | BIT(5) | BIT(6)); | 770 | spare_reg |= (BIT(3) | BIT(5) | BIT(6)); |
737 | wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); | 771 | ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); |
772 | if (ret < 0) | ||
773 | return ret; | ||
738 | 774 | ||
739 | /* Enable FREF_CLK_REQ & mux MCS and coex PLLs to FREF */ | 775 | /* Enable FREF_CLK_REQ & mux MCS and coex PLLs to FREF */ |
740 | wl12xx_top_reg_write(wl, SYS_CLK_CFG_REG, | 776 | ret = wl12xx_top_reg_write(wl, SYS_CLK_CFG_REG, |
741 | WL_CLK_REQ_TYPE_PG2 | MCS_PLL_CLK_SEL_FREF); | 777 | WL_CLK_REQ_TYPE_PG2 | MCS_PLL_CLK_SEL_FREF); |
778 | if (ret < 0) | ||
779 | return ret; | ||
742 | 780 | ||
743 | /* Delay execution for 15msec, to let the HW settle */ | 781 | /* Delay execution for 15msec, to let the HW settle */ |
744 | mdelay(15); | 782 | mdelay(15); |
@@ -749,8 +787,12 @@ static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) | |||
749 | static bool wl128x_is_tcxo_valid(struct wl1271 *wl) | 787 | static bool wl128x_is_tcxo_valid(struct wl1271 *wl) |
750 | { | 788 | { |
751 | u16 tcxo_detection; | 789 | u16 tcxo_detection; |
790 | int ret; | ||
791 | |||
792 | ret = wl12xx_top_reg_read(wl, TCXO_CLK_DETECT_REG, &tcxo_detection); | ||
793 | if (ret < 0) | ||
794 | return false; | ||
752 | 795 | ||
753 | tcxo_detection = wl12xx_top_reg_read(wl, TCXO_CLK_DETECT_REG); | ||
754 | if (tcxo_detection & TCXO_DET_FAILED) | 796 | if (tcxo_detection & TCXO_DET_FAILED) |
755 | return false; | 797 | return false; |
756 | 798 | ||
@@ -760,8 +802,12 @@ static bool wl128x_is_tcxo_valid(struct wl1271 *wl) | |||
760 | static bool wl128x_is_fref_valid(struct wl1271 *wl) | 802 | static bool wl128x_is_fref_valid(struct wl1271 *wl) |
761 | { | 803 | { |
762 | u16 fref_detection; | 804 | u16 fref_detection; |
805 | int ret; | ||
806 | |||
807 | ret = wl12xx_top_reg_read(wl, FREF_CLK_DETECT_REG, &fref_detection); | ||
808 | if (ret < 0) | ||
809 | return false; | ||
763 | 810 | ||
764 | fref_detection = wl12xx_top_reg_read(wl, FREF_CLK_DETECT_REG); | ||
765 | if (fref_detection & FREF_CLK_DETECT_FAIL) | 811 | if (fref_detection & FREF_CLK_DETECT_FAIL) |
766 | return false; | 812 | return false; |
767 | 813 | ||
@@ -770,11 +816,21 @@ static bool wl128x_is_fref_valid(struct wl1271 *wl) | |||
770 | 816 | ||
771 | static int wl128x_manually_configure_mcs_pll(struct wl1271 *wl) | 817 | static int wl128x_manually_configure_mcs_pll(struct wl1271 *wl) |
772 | { | 818 | { |
773 | wl12xx_top_reg_write(wl, MCS_PLL_M_REG, MCS_PLL_M_REG_VAL); | 819 | int ret; |
774 | wl12xx_top_reg_write(wl, MCS_PLL_N_REG, MCS_PLL_N_REG_VAL); | ||
775 | wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, MCS_PLL_CONFIG_REG_VAL); | ||
776 | 820 | ||
777 | return 0; | 821 | ret = wl12xx_top_reg_write(wl, MCS_PLL_M_REG, MCS_PLL_M_REG_VAL); |
822 | if (ret < 0) | ||
823 | goto out; | ||
824 | |||
825 | ret = wl12xx_top_reg_write(wl, MCS_PLL_N_REG, MCS_PLL_N_REG_VAL); | ||
826 | if (ret < 0) | ||
827 | goto out; | ||
828 | |||
829 | ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, | ||
830 | MCS_PLL_CONFIG_REG_VAL); | ||
831 | |||
832 | out: | ||
833 | return ret; | ||
778 | } | 834 | } |
779 | 835 | ||
780 | static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) | 836 | static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) |
@@ -783,13 +839,19 @@ static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) | |||
783 | u16 pll_config; | 839 | u16 pll_config; |
784 | u8 input_freq; | 840 | u8 input_freq; |
785 | struct wl12xx_priv *priv = wl->priv; | 841 | struct wl12xx_priv *priv = wl->priv; |
842 | int ret; | ||
786 | 843 | ||
787 | /* Mask bits [3:1] in the sys_clk_cfg register */ | 844 | /* Mask bits [3:1] in the sys_clk_cfg register */ |
788 | spare_reg = wl12xx_top_reg_read(wl, WL_SPARE_REG); | 845 | ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); |
846 | if (ret < 0) | ||
847 | return ret; | ||
848 | |||
789 | if (spare_reg == 0xFFFF) | 849 | if (spare_reg == 0xFFFF) |
790 | return -EFAULT; | 850 | return -EFAULT; |
791 | spare_reg |= BIT(2); | 851 | spare_reg |= BIT(2); |
792 | wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); | 852 | ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); |
853 | if (ret < 0) | ||
854 | return ret; | ||
793 | 855 | ||
794 | /* Handle special cases of the TCXO clock */ | 856 | /* Handle special cases of the TCXO clock */ |
795 | if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_8 || | 857 | if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_8 || |
@@ -799,14 +861,17 @@ static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) | |||
799 | /* Set the input frequency according to the selected clock source */ | 861 | /* Set the input frequency according to the selected clock source */ |
800 | input_freq = (clk & 1) + 1; | 862 | input_freq = (clk & 1) + 1; |
801 | 863 | ||
802 | pll_config = wl12xx_top_reg_read(wl, MCS_PLL_CONFIG_REG); | 864 | ret = wl12xx_top_reg_read(wl, MCS_PLL_CONFIG_REG, &pll_config); |
865 | if (ret < 0) | ||
866 | return ret; | ||
867 | |||
803 | if (pll_config == 0xFFFF) | 868 | if (pll_config == 0xFFFF) |
804 | return -EFAULT; | 869 | return -EFAULT; |
805 | pll_config |= (input_freq << MCS_SEL_IN_FREQ_SHIFT); | 870 | pll_config |= (input_freq << MCS_SEL_IN_FREQ_SHIFT); |
806 | pll_config |= MCS_PLL_ENABLE_HP; | 871 | pll_config |= MCS_PLL_ENABLE_HP; |
807 | wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, pll_config); | 872 | ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, pll_config); |
808 | 873 | ||
809 | return 0; | 874 | return ret; |
810 | } | 875 | } |
811 | 876 | ||
812 | /* | 877 | /* |
@@ -820,6 +885,7 @@ static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock) | |||
820 | { | 885 | { |
821 | struct wl12xx_priv *priv = wl->priv; | 886 | struct wl12xx_priv *priv = wl->priv; |
822 | u16 sys_clk_cfg; | 887 | u16 sys_clk_cfg; |
888 | int ret; | ||
823 | 889 | ||
824 | /* For XTAL-only modes, FREF will be used after switching from TCXO */ | 890 | /* For XTAL-only modes, FREF will be used after switching from TCXO */ |
825 | if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL || | 891 | if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL || |
@@ -830,7 +896,10 @@ static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock) | |||
830 | } | 896 | } |
831 | 897 | ||
832 | /* Query the HW, to determine which clock source we should use */ | 898 | /* Query the HW, to determine which clock source we should use */ |
833 | sys_clk_cfg = wl12xx_top_reg_read(wl, SYS_CLK_CFG_REG); | 899 | ret = wl12xx_top_reg_read(wl, SYS_CLK_CFG_REG, &sys_clk_cfg); |
900 | if (ret < 0) | ||
901 | return ret; | ||
902 | |||
834 | if (sys_clk_cfg == 0xFFFF) | 903 | if (sys_clk_cfg == 0xFFFF) |
835 | return -EINVAL; | 904 | return -EINVAL; |
836 | if (sys_clk_cfg & PRCM_CM_EN_MUX_WLAN_FREF) | 905 | if (sys_clk_cfg & PRCM_CM_EN_MUX_WLAN_FREF) |
@@ -865,6 +934,7 @@ static int wl127x_boot_clk(struct wl1271 *wl) | |||
865 | struct wl12xx_priv *priv = wl->priv; | 934 | struct wl12xx_priv *priv = wl->priv; |
866 | u32 pause; | 935 | u32 pause; |
867 | u32 clk; | 936 | u32 clk; |
937 | int ret; | ||
868 | 938 | ||
869 | if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3) | 939 | if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3) |
870 | wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION; | 940 | wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION; |
@@ -885,48 +955,74 @@ static int wl127x_boot_clk(struct wl1271 *wl) | |||
885 | if (priv->ref_clock != CONF_REF_CLK_19_2_E) { | 955 | if (priv->ref_clock != CONF_REF_CLK_19_2_E) { |
886 | u16 val; | 956 | u16 val; |
887 | /* Set clock type (open drain) */ | 957 | /* Set clock type (open drain) */ |
888 | val = wl12xx_top_reg_read(wl, OCP_REG_CLK_TYPE); | 958 | ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_TYPE, &val); |
959 | if (ret < 0) | ||
960 | goto out; | ||
961 | |||
889 | val &= FREF_CLK_TYPE_BITS; | 962 | val &= FREF_CLK_TYPE_BITS; |
890 | wl12xx_top_reg_write(wl, OCP_REG_CLK_TYPE, val); | 963 | ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_TYPE, val); |
964 | if (ret < 0) | ||
965 | goto out; | ||
891 | 966 | ||
892 | /* Set clock pull mode (no pull) */ | 967 | /* Set clock pull mode (no pull) */ |
893 | val = wl12xx_top_reg_read(wl, OCP_REG_CLK_PULL); | 968 | ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_PULL, &val); |
969 | if (ret < 0) | ||
970 | goto out; | ||
971 | |||
894 | val |= NO_PULL; | 972 | val |= NO_PULL; |
895 | wl12xx_top_reg_write(wl, OCP_REG_CLK_PULL, val); | 973 | ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_PULL, val); |
974 | if (ret < 0) | ||
975 | goto out; | ||
896 | } else { | 976 | } else { |
897 | u16 val; | 977 | u16 val; |
898 | /* Set clock polarity */ | 978 | /* Set clock polarity */ |
899 | val = wl12xx_top_reg_read(wl, OCP_REG_CLK_POLARITY); | 979 | ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_POLARITY, &val); |
980 | if (ret < 0) | ||
981 | goto out; | ||
982 | |||
900 | val &= FREF_CLK_POLARITY_BITS; | 983 | val &= FREF_CLK_POLARITY_BITS; |
901 | val |= CLK_REQ_OUTN_SEL; | 984 | val |= CLK_REQ_OUTN_SEL; |
902 | wl12xx_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); | 985 | ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); |
986 | if (ret < 0) | ||
987 | goto out; | ||
903 | } | 988 | } |
904 | 989 | ||
905 | wl1271_write32(wl, WL12XX_PLL_PARAMETERS, clk); | 990 | ret = wlcore_write32(wl, WL12XX_PLL_PARAMETERS, clk); |
991 | if (ret < 0) | ||
992 | goto out; | ||
906 | 993 | ||
907 | pause = wl1271_read32(wl, WL12XX_PLL_PARAMETERS); | 994 | ret = wlcore_read32(wl, WL12XX_PLL_PARAMETERS, &pause); |
995 | if (ret < 0) | ||
996 | goto out; | ||
908 | 997 | ||
909 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); | 998 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); |
910 | 999 | ||
911 | pause &= ~(WU_COUNTER_PAUSE_VAL); | 1000 | pause &= ~(WU_COUNTER_PAUSE_VAL); |
912 | pause |= WU_COUNTER_PAUSE_VAL; | 1001 | pause |= WU_COUNTER_PAUSE_VAL; |
913 | wl1271_write32(wl, WL12XX_WU_COUNTER_PAUSE, pause); | 1002 | ret = wlcore_write32(wl, WL12XX_WU_COUNTER_PAUSE, pause); |
914 | 1003 | ||
915 | return 0; | 1004 | out: |
1005 | return ret; | ||
916 | } | 1006 | } |
917 | 1007 | ||
918 | static int wl1271_boot_soft_reset(struct wl1271 *wl) | 1008 | static int wl1271_boot_soft_reset(struct wl1271 *wl) |
919 | { | 1009 | { |
920 | unsigned long timeout; | 1010 | unsigned long timeout; |
921 | u32 boot_data; | 1011 | u32 boot_data; |
1012 | int ret = 0; | ||
922 | 1013 | ||
923 | /* perform soft reset */ | 1014 | /* perform soft reset */ |
924 | wl1271_write32(wl, WL12XX_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); | 1015 | ret = wlcore_write32(wl, WL12XX_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); |
1016 | if (ret < 0) | ||
1017 | goto out; | ||
925 | 1018 | ||
926 | /* SOFT_RESET is self clearing */ | 1019 | /* SOFT_RESET is self clearing */ |
927 | timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); | 1020 | timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); |
928 | while (1) { | 1021 | while (1) { |
929 | boot_data = wl1271_read32(wl, WL12XX_SLV_SOFT_RESET); | 1022 | ret = wlcore_read32(wl, WL12XX_SLV_SOFT_RESET, &boot_data); |
1023 | if (ret < 0) | ||
1024 | goto out; | ||
1025 | |||
930 | wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); | 1026 | wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); |
931 | if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) | 1027 | if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) |
932 | break; | 1028 | break; |
@@ -942,12 +1038,15 @@ static int wl1271_boot_soft_reset(struct wl1271 *wl) | |||
942 | } | 1038 | } |
943 | 1039 | ||
944 | /* disable Rx/Tx */ | 1040 | /* disable Rx/Tx */ |
945 | wl1271_write32(wl, WL12XX_ENABLE, 0x0); | 1041 | ret = wlcore_write32(wl, WL12XX_ENABLE, 0x0); |
1042 | if (ret < 0) | ||
1043 | goto out; | ||
946 | 1044 | ||
947 | /* disable auto calibration on start*/ | 1045 | /* disable auto calibration on start*/ |
948 | wl1271_write32(wl, WL12XX_SPARE_A2, 0xffff); | 1046 | ret = wlcore_write32(wl, WL12XX_SPARE_A2, 0xffff); |
949 | 1047 | ||
950 | return 0; | 1048 | out: |
1049 | return ret; | ||
951 | } | 1050 | } |
952 | 1051 | ||
953 | static int wl12xx_pre_boot(struct wl1271 *wl) | 1052 | static int wl12xx_pre_boot(struct wl1271 *wl) |
@@ -968,16 +1067,23 @@ static int wl12xx_pre_boot(struct wl1271 *wl) | |||
968 | } | 1067 | } |
969 | 1068 | ||
970 | /* Continue the ELP wake up sequence */ | 1069 | /* Continue the ELP wake up sequence */ |
971 | wl1271_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); | 1070 | ret = wlcore_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); |
1071 | if (ret < 0) | ||
1072 | goto out; | ||
1073 | |||
972 | udelay(500); | 1074 | udelay(500); |
973 | 1075 | ||
974 | wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); | 1076 | ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); |
1077 | if (ret < 0) | ||
1078 | goto out; | ||
975 | 1079 | ||
976 | /* Read-modify-write DRPW_SCRATCH_START register (see next state) | 1080 | /* Read-modify-write DRPW_SCRATCH_START register (see next state) |
977 | to be used by DRPw FW. The RTRIM value will be added by the FW | 1081 | to be used by DRPw FW. The RTRIM value will be added by the FW |
978 | before taking DRPw out of reset */ | 1082 | before taking DRPw out of reset */ |
979 | 1083 | ||
980 | clk = wl1271_read32(wl, WL12XX_DRPW_SCRATCH_START); | 1084 | ret = wlcore_read32(wl, WL12XX_DRPW_SCRATCH_START, &clk); |
1085 | if (ret < 0) | ||
1086 | goto out; | ||
981 | 1087 | ||
982 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); | 1088 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); |
983 | 1089 | ||
@@ -986,12 +1092,18 @@ static int wl12xx_pre_boot(struct wl1271 *wl) | |||
986 | else | 1092 | else |
987 | clk |= (priv->ref_clock << 1) << 4; | 1093 | clk |= (priv->ref_clock << 1) << 4; |
988 | 1094 | ||
989 | wl1271_write32(wl, WL12XX_DRPW_SCRATCH_START, clk); | 1095 | ret = wlcore_write32(wl, WL12XX_DRPW_SCRATCH_START, clk); |
1096 | if (ret < 0) | ||
1097 | goto out; | ||
990 | 1098 | ||
991 | wlcore_set_partition(wl, &wl->ptable[PART_WORK]); | 1099 | ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); |
1100 | if (ret < 0) | ||
1101 | goto out; | ||
992 | 1102 | ||
993 | /* Disable interrupts */ | 1103 | /* Disable interrupts */ |
994 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); | 1104 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); |
1105 | if (ret < 0) | ||
1106 | goto out; | ||
995 | 1107 | ||
996 | ret = wl1271_boot_soft_reset(wl); | 1108 | ret = wl1271_boot_soft_reset(wl); |
997 | if (ret < 0) | 1109 | if (ret < 0) |
@@ -1001,47 +1113,72 @@ out: | |||
1001 | return ret; | 1113 | return ret; |
1002 | } | 1114 | } |
1003 | 1115 | ||
1004 | static void wl12xx_pre_upload(struct wl1271 *wl) | 1116 | static int wl12xx_pre_upload(struct wl1271 *wl) |
1005 | { | 1117 | { |
1006 | u32 tmp, polarity; | 1118 | u32 tmp; |
1119 | u16 polarity; | ||
1120 | int ret; | ||
1007 | 1121 | ||
1008 | /* write firmware's last address (ie. it's length) to | 1122 | /* write firmware's last address (ie. it's length) to |
1009 | * ACX_EEPROMLESS_IND_REG */ | 1123 | * ACX_EEPROMLESS_IND_REG */ |
1010 | wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); | 1124 | wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); |
1011 | 1125 | ||
1012 | wl1271_write32(wl, WL12XX_EEPROMLESS_IND, WL12XX_EEPROMLESS_IND); | 1126 | ret = wlcore_write32(wl, WL12XX_EEPROMLESS_IND, WL12XX_EEPROMLESS_IND); |
1127 | if (ret < 0) | ||
1128 | goto out; | ||
1013 | 1129 | ||
1014 | tmp = wlcore_read_reg(wl, REG_CHIP_ID_B); | 1130 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); |
1131 | if (ret < 0) | ||
1132 | goto out; | ||
1015 | 1133 | ||
1016 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); | 1134 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); |
1017 | 1135 | ||
1018 | /* 6. read the EEPROM parameters */ | 1136 | /* 6. read the EEPROM parameters */ |
1019 | tmp = wl1271_read32(wl, WL12XX_SCR_PAD2); | 1137 | ret = wlcore_read32(wl, WL12XX_SCR_PAD2, &tmp); |
1138 | if (ret < 0) | ||
1139 | goto out; | ||
1020 | 1140 | ||
1021 | /* WL1271: The reference driver skips steps 7 to 10 (jumps directly | 1141 | /* WL1271: The reference driver skips steps 7 to 10 (jumps directly |
1022 | * to upload_fw) */ | 1142 | * to upload_fw) */ |
1023 | 1143 | ||
1024 | if (wl->chip.id == CHIP_ID_1283_PG20) | 1144 | if (wl->chip.id == CHIP_ID_1283_PG20) { |
1025 | wl12xx_top_reg_write(wl, SDIO_IO_DS, HCI_IO_DS_6MA); | 1145 | ret = wl12xx_top_reg_write(wl, SDIO_IO_DS, HCI_IO_DS_6MA); |
1146 | if (ret < 0) | ||
1147 | goto out; | ||
1148 | } | ||
1026 | 1149 | ||
1027 | /* polarity must be set before the firmware is loaded */ | 1150 | /* polarity must be set before the firmware is loaded */ |
1028 | polarity = wl12xx_top_reg_read(wl, OCP_REG_POLARITY); | 1151 | ret = wl12xx_top_reg_read(wl, OCP_REG_POLARITY, &polarity); |
1152 | if (ret < 0) | ||
1153 | goto out; | ||
1029 | 1154 | ||
1030 | /* We use HIGH polarity, so unset the LOW bit */ | 1155 | /* We use HIGH polarity, so unset the LOW bit */ |
1031 | polarity &= ~POLARITY_LOW; | 1156 | polarity &= ~POLARITY_LOW; |
1032 | wl12xx_top_reg_write(wl, OCP_REG_POLARITY, polarity); | 1157 | ret = wl12xx_top_reg_write(wl, OCP_REG_POLARITY, polarity); |
1033 | 1158 | ||
1159 | out: | ||
1160 | return ret; | ||
1034 | } | 1161 | } |
1035 | 1162 | ||
1036 | static void wl12xx_enable_interrupts(struct wl1271 *wl) | 1163 | static int wl12xx_enable_interrupts(struct wl1271 *wl) |
1037 | { | 1164 | { |
1038 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL12XX_ACX_ALL_EVENTS_VECTOR); | 1165 | int ret; |
1166 | |||
1167 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, | ||
1168 | WL12XX_ACX_ALL_EVENTS_VECTOR); | ||
1169 | if (ret < 0) | ||
1170 | goto out; | ||
1039 | 1171 | ||
1040 | wlcore_enable_interrupts(wl); | 1172 | wlcore_enable_interrupts(wl); |
1041 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, | 1173 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, |
1042 | WL1271_ACX_INTR_ALL & ~(WL12XX_INTR_MASK)); | 1174 | WL1271_ACX_INTR_ALL & ~(WL12XX_INTR_MASK)); |
1175 | if (ret < 0) | ||
1176 | goto out; | ||
1043 | 1177 | ||
1044 | wl1271_write32(wl, WL12XX_HI_CFG, HI_CFG_DEF_VAL); | 1178 | ret = wlcore_write32(wl, WL12XX_HI_CFG, HI_CFG_DEF_VAL); |
1179 | |||
1180 | out: | ||
1181 | return ret; | ||
1045 | } | 1182 | } |
1046 | 1183 | ||
1047 | static int wl12xx_boot(struct wl1271 *wl) | 1184 | static int wl12xx_boot(struct wl1271 *wl) |
@@ -1056,7 +1193,9 @@ static int wl12xx_boot(struct wl1271 *wl) | |||
1056 | if (ret < 0) | 1193 | if (ret < 0) |
1057 | goto out; | 1194 | goto out; |
1058 | 1195 | ||
1059 | wl12xx_pre_upload(wl); | 1196 | ret = wl12xx_pre_upload(wl); |
1197 | if (ret < 0) | ||
1198 | goto out; | ||
1060 | 1199 | ||
1061 | ret = wlcore_boot_upload_firmware(wl); | 1200 | ret = wlcore_boot_upload_firmware(wl); |
1062 | if (ret < 0) | 1201 | if (ret < 0) |
@@ -1066,22 +1205,30 @@ static int wl12xx_boot(struct wl1271 *wl) | |||
1066 | if (ret < 0) | 1205 | if (ret < 0) |
1067 | goto out; | 1206 | goto out; |
1068 | 1207 | ||
1069 | wl12xx_enable_interrupts(wl); | 1208 | ret = wl12xx_enable_interrupts(wl); |
1070 | 1209 | ||
1071 | out: | 1210 | out: |
1072 | return ret; | 1211 | return ret; |
1073 | } | 1212 | } |
1074 | 1213 | ||
1075 | static void wl12xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, | 1214 | static int wl12xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, |
1076 | void *buf, size_t len) | 1215 | void *buf, size_t len) |
1077 | { | 1216 | { |
1078 | wl1271_write(wl, cmd_box_addr, buf, len, false); | 1217 | int ret; |
1079 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_CMD); | 1218 | |
1219 | ret = wlcore_write(wl, cmd_box_addr, buf, len, false); | ||
1220 | if (ret < 0) | ||
1221 | return ret; | ||
1222 | |||
1223 | ret = wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_CMD); | ||
1224 | |||
1225 | return ret; | ||
1080 | } | 1226 | } |
1081 | 1227 | ||
1082 | static void wl12xx_ack_event(struct wl1271 *wl) | 1228 | static int wl12xx_ack_event(struct wl1271 *wl) |
1083 | { | 1229 | { |
1084 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_EVENT_ACK); | 1230 | return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, |
1231 | WL12XX_INTR_TRIG_EVENT_ACK); | ||
1085 | } | 1232 | } |
1086 | 1233 | ||
1087 | static u32 wl12xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) | 1234 | static u32 wl12xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) |
@@ -1161,13 +1308,13 @@ static u32 wl12xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, | |||
1161 | return data_len - sizeof(*desc) - desc->pad_len; | 1308 | return data_len - sizeof(*desc) - desc->pad_len; |
1162 | } | 1309 | } |
1163 | 1310 | ||
1164 | static void wl12xx_tx_delayed_compl(struct wl1271 *wl) | 1311 | static int wl12xx_tx_delayed_compl(struct wl1271 *wl) |
1165 | { | 1312 | { |
1166 | if (wl->fw_status_1->tx_results_counter == | 1313 | if (wl->fw_status_1->tx_results_counter == |
1167 | (wl->tx_results_count & 0xff)) | 1314 | (wl->tx_results_count & 0xff)) |
1168 | return; | 1315 | return 0; |
1169 | 1316 | ||
1170 | wl1271_tx_complete(wl); | 1317 | return wlcore_tx_complete(wl); |
1171 | } | 1318 | } |
1172 | 1319 | ||
1173 | static int wl12xx_hw_init(struct wl1271 *wl) | 1320 | static int wl12xx_hw_init(struct wl1271 *wl) |
@@ -1268,39 +1415,58 @@ static bool wl12xx_mac_in_fuse(struct wl1271 *wl) | |||
1268 | return supported; | 1415 | return supported; |
1269 | } | 1416 | } |
1270 | 1417 | ||
1271 | static void wl12xx_get_fuse_mac(struct wl1271 *wl) | 1418 | static int wl12xx_get_fuse_mac(struct wl1271 *wl) |
1272 | { | 1419 | { |
1273 | u32 mac1, mac2; | 1420 | u32 mac1, mac2; |
1421 | int ret; | ||
1274 | 1422 | ||
1275 | wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); | 1423 | ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); |
1424 | if (ret < 0) | ||
1425 | goto out; | ||
1276 | 1426 | ||
1277 | mac1 = wl1271_read32(wl, WL12XX_REG_FUSE_BD_ADDR_1); | 1427 | ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_1, &mac1); |
1278 | mac2 = wl1271_read32(wl, WL12XX_REG_FUSE_BD_ADDR_2); | 1428 | if (ret < 0) |
1429 | goto out; | ||
1430 | |||
1431 | ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_2, &mac2); | ||
1432 | if (ret < 0) | ||
1433 | goto out; | ||
1279 | 1434 | ||
1280 | /* these are the two parts of the BD_ADDR */ | 1435 | /* these are the two parts of the BD_ADDR */ |
1281 | wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + | 1436 | wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + |
1282 | ((mac1 & 0xff000000) >> 24); | 1437 | ((mac1 & 0xff000000) >> 24); |
1283 | wl->fuse_nic_addr = mac1 & 0xffffff; | 1438 | wl->fuse_nic_addr = mac1 & 0xffffff; |
1284 | 1439 | ||
1285 | wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); | 1440 | ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); |
1441 | |||
1442 | out: | ||
1443 | return ret; | ||
1286 | } | 1444 | } |
1287 | 1445 | ||
1288 | static s8 wl12xx_get_pg_ver(struct wl1271 *wl) | 1446 | static int wl12xx_get_pg_ver(struct wl1271 *wl, s8 *ver) |
1289 | { | 1447 | { |
1290 | u32 die_info; | 1448 | u16 die_info; |
1449 | int ret; | ||
1291 | 1450 | ||
1292 | if (wl->chip.id == CHIP_ID_1283_PG20) | 1451 | if (wl->chip.id == CHIP_ID_1283_PG20) |
1293 | die_info = wl12xx_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1); | 1452 | ret = wl12xx_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1, |
1453 | &die_info); | ||
1294 | else | 1454 | else |
1295 | die_info = wl12xx_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1); | 1455 | ret = wl12xx_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1, |
1456 | &die_info); | ||
1296 | 1457 | ||
1297 | return (s8) (die_info & PG_VER_MASK) >> PG_VER_OFFSET; | 1458 | if (ret >= 0 && ver) |
1459 | *ver = (s8)((die_info & PG_VER_MASK) >> PG_VER_OFFSET); | ||
1460 | |||
1461 | return ret; | ||
1298 | } | 1462 | } |
1299 | 1463 | ||
1300 | static void wl12xx_get_mac(struct wl1271 *wl) | 1464 | static int wl12xx_get_mac(struct wl1271 *wl) |
1301 | { | 1465 | { |
1302 | if (wl12xx_mac_in_fuse(wl)) | 1466 | if (wl12xx_mac_in_fuse(wl)) |
1303 | wl12xx_get_fuse_mac(wl); | 1467 | return wl12xx_get_fuse_mac(wl); |
1468 | |||
1469 | return 0; | ||
1304 | } | 1470 | } |
1305 | 1471 | ||
1306 | static void wl12xx_set_tx_desc_csum(struct wl1271 *wl, | 1472 | static void wl12xx_set_tx_desc_csum(struct wl1271 *wl, |
@@ -1448,10 +1614,8 @@ static int __devinit wl12xx_probe(struct platform_device *pdev) | |||
1448 | wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; | 1614 | wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; |
1449 | wl->fw_status_priv_len = 0; | 1615 | wl->fw_status_priv_len = 0; |
1450 | wl->stats.fw_stats_len = sizeof(struct wl12xx_acx_statistics); | 1616 | wl->stats.fw_stats_len = sizeof(struct wl12xx_acx_statistics); |
1451 | memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ], &wl12xx_ht_cap, | 1617 | wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, &wl12xx_ht_cap); |
1452 | sizeof(wl12xx_ht_cap)); | 1618 | wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, &wl12xx_ht_cap); |
1453 | memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ], &wl12xx_ht_cap, | ||
1454 | sizeof(wl12xx_ht_cap)); | ||
1455 | wl12xx_conf_init(wl); | 1619 | wl12xx_conf_init(wl); |
1456 | 1620 | ||
1457 | if (!fref_param) { | 1621 | if (!fref_param) { |
diff --git a/drivers/net/wireless/ti/wl18xx/acx.h b/drivers/net/wireless/ti/wl18xx/acx.h index ebbaf611e97b..e2609a6b7341 100644 --- a/drivers/net/wireless/ti/wl18xx/acx.h +++ b/drivers/net/wireless/ti/wl18xx/acx.h | |||
@@ -32,25 +32,21 @@ enum { | |||
32 | /* numbers of bits the length field takes (add 1 for the actual number) */ | 32 | /* numbers of bits the length field takes (add 1 for the actual number) */ |
33 | #define WL18XX_HOST_IF_LEN_SIZE_FIELD 15 | 33 | #define WL18XX_HOST_IF_LEN_SIZE_FIELD 15 |
34 | 34 | ||
35 | #define WL18XX_ACX_EVENTS_VECTOR_PG1 (WL1271_ACX_INTR_WATCHDOG | \ | 35 | #define WL18XX_ACX_EVENTS_VECTOR (WL1271_ACX_INTR_WATCHDOG | \ |
36 | WL1271_ACX_INTR_INIT_COMPLETE | \ | 36 | WL1271_ACX_INTR_INIT_COMPLETE | \ |
37 | WL1271_ACX_INTR_EVENT_A | \ | 37 | WL1271_ACX_INTR_EVENT_A | \ |
38 | WL1271_ACX_INTR_EVENT_B | \ | 38 | WL1271_ACX_INTR_EVENT_B | \ |
39 | WL1271_ACX_INTR_CMD_COMPLETE | \ | 39 | WL1271_ACX_INTR_CMD_COMPLETE | \ |
40 | WL1271_ACX_INTR_HW_AVAILABLE | \ | 40 | WL1271_ACX_INTR_HW_AVAILABLE | \ |
41 | WL1271_ACX_INTR_DATA) | 41 | WL1271_ACX_INTR_DATA | \ |
42 | 42 | WL1271_ACX_SW_INTR_WATCHDOG) | |
43 | #define WL18XX_ACX_EVENTS_VECTOR_PG2 (WL18XX_ACX_EVENTS_VECTOR_PG1 | \ | 43 | |
44 | WL1271_ACX_SW_INTR_WATCHDOG) | 44 | #define WL18XX_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \ |
45 | 45 | WL1271_ACX_INTR_EVENT_A | \ | |
46 | #define WL18XX_INTR_MASK_PG1 (WL1271_ACX_INTR_WATCHDOG | \ | 46 | WL1271_ACX_INTR_EVENT_B | \ |
47 | WL1271_ACX_INTR_EVENT_A | \ | 47 | WL1271_ACX_INTR_HW_AVAILABLE | \ |
48 | WL1271_ACX_INTR_EVENT_B | \ | 48 | WL1271_ACX_INTR_DATA | \ |
49 | WL1271_ACX_INTR_HW_AVAILABLE | \ | 49 | WL1271_ACX_SW_INTR_WATCHDOG) |
50 | WL1271_ACX_INTR_DATA) | ||
51 | |||
52 | #define WL18XX_INTR_MASK_PG2 (WL18XX_INTR_MASK_PG1 | \ | ||
53 | WL1271_ACX_SW_INTR_WATCHDOG) | ||
54 | 50 | ||
55 | struct wl18xx_acx_host_config_bitmap { | 51 | struct wl18xx_acx_host_config_bitmap { |
56 | struct acx_header header; | 52 | struct acx_header header; |
diff --git a/drivers/net/wireless/ti/wl18xx/io.c b/drivers/net/wireless/ti/wl18xx/io.c index 598c057e722b..0c06ccfd1b8c 100644 --- a/drivers/net/wireless/ti/wl18xx/io.c +++ b/drivers/net/wireless/ti/wl18xx/io.c | |||
@@ -24,37 +24,52 @@ | |||
24 | 24 | ||
25 | #include "io.h" | 25 | #include "io.h" |
26 | 26 | ||
27 | void wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) | 27 | int wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) |
28 | { | 28 | { |
29 | u32 tmp; | 29 | u32 tmp; |
30 | int ret; | ||
30 | 31 | ||
31 | if (WARN_ON(addr % 2)) | 32 | if (WARN_ON(addr % 2)) |
32 | return; | 33 | return -EINVAL; |
33 | 34 | ||
34 | if ((addr % 4) == 0) { | 35 | if ((addr % 4) == 0) { |
35 | tmp = wl1271_read32(wl, addr); | 36 | ret = wlcore_read32(wl, addr, &tmp); |
37 | if (ret < 0) | ||
38 | goto out; | ||
39 | |||
36 | tmp = (tmp & 0xffff0000) | val; | 40 | tmp = (tmp & 0xffff0000) | val; |
37 | wl1271_write32(wl, addr, tmp); | 41 | ret = wlcore_write32(wl, addr, tmp); |
38 | } else { | 42 | } else { |
39 | tmp = wl1271_read32(wl, addr - 2); | 43 | ret = wlcore_read32(wl, addr - 2, &tmp); |
44 | if (ret < 0) | ||
45 | goto out; | ||
46 | |||
40 | tmp = (tmp & 0xffff) | (val << 16); | 47 | tmp = (tmp & 0xffff) | (val << 16); |
41 | wl1271_write32(wl, addr - 2, tmp); | 48 | ret = wlcore_write32(wl, addr - 2, tmp); |
42 | } | 49 | } |
50 | |||
51 | out: | ||
52 | return ret; | ||
43 | } | 53 | } |
44 | 54 | ||
45 | u16 wl18xx_top_reg_read(struct wl1271 *wl, int addr) | 55 | int wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out) |
46 | { | 56 | { |
47 | u32 val; | 57 | u32 val; |
58 | int ret; | ||
48 | 59 | ||
49 | if (WARN_ON(addr % 2)) | 60 | if (WARN_ON(addr % 2)) |
50 | return 0; | 61 | return -EINVAL; |
51 | 62 | ||
52 | if ((addr % 4) == 0) { | 63 | if ((addr % 4) == 0) { |
53 | /* address is 4-bytes aligned */ | 64 | /* address is 4-bytes aligned */ |
54 | val = wl1271_read32(wl, addr); | 65 | ret = wlcore_read32(wl, addr, &val); |
55 | return val & 0xffff; | 66 | if (ret >= 0 && out) |
67 | *out = val & 0xffff; | ||
56 | } else { | 68 | } else { |
57 | val = wl1271_read32(wl, addr - 2); | 69 | ret = wlcore_read32(wl, addr - 2, &val); |
58 | return (val & 0xffff0000) >> 16; | 70 | if (ret >= 0 && out) |
71 | *out = (val & 0xffff0000) >> 16; | ||
59 | } | 72 | } |
73 | |||
74 | return ret; | ||
60 | } | 75 | } |
diff --git a/drivers/net/wireless/ti/wl18xx/io.h b/drivers/net/wireless/ti/wl18xx/io.h index be4e126ff617..c32ae30277df 100644 --- a/drivers/net/wireless/ti/wl18xx/io.h +++ b/drivers/net/wireless/ti/wl18xx/io.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #ifndef __WL18XX_IO_H__ | 22 | #ifndef __WL18XX_IO_H__ |
23 | #define __WL18XX_IO_H__ | 23 | #define __WL18XX_IO_H__ |
24 | 24 | ||
25 | void wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val); | 25 | int __must_check wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val); |
26 | u16 wl18xx_top_reg_read(struct wl1271 *wl, int addr); | 26 | int __must_check wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out); |
27 | 27 | ||
28 | #endif /* __WL18XX_IO_H__ */ | 28 | #endif /* __WL18XX_IO_H__ */ |
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index ed9c3650e08a..5e583be8f674 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c | |||
@@ -43,10 +43,11 @@ | |||
43 | 43 | ||
44 | #define WL18XX_RX_CHECKSUM_MASK 0x40 | 44 | #define WL18XX_RX_CHECKSUM_MASK 0x40 |
45 | 45 | ||
46 | static char *ht_mode_param = "wide"; | 46 | static char *ht_mode_param = "default"; |
47 | static char *board_type_param = "hdk"; | 47 | static char *board_type_param = "hdk"; |
48 | static bool checksum_param = false; | 48 | static bool checksum_param = false; |
49 | static bool enable_11a_param = true; | 49 | static bool enable_11a_param = true; |
50 | static int num_rx_desc_param = -1; | ||
50 | 51 | ||
51 | /* phy paramters */ | 52 | /* phy paramters */ |
52 | static int dc2dc_param = -1; | 53 | static int dc2dc_param = -1; |
@@ -372,6 +373,7 @@ static struct wlcore_conf wl18xx_conf = { | |||
372 | .forced_ps = false, | 373 | .forced_ps = false, |
373 | .keep_alive_interval = 55000, | 374 | .keep_alive_interval = 55000, |
374 | .max_listen_interval = 20, | 375 | .max_listen_interval = 20, |
376 | .sta_sleep_auth = WL1271_PSM_ILLEGAL, | ||
375 | }, | 377 | }, |
376 | .itrim = { | 378 | .itrim = { |
377 | .enable = false, | 379 | .enable = false, |
@@ -606,24 +608,15 @@ static int wl18xx_identify_chip(struct wl1271 *wl) | |||
606 | wl->plt_fw_name = WL18XX_FW_NAME; | 608 | wl->plt_fw_name = WL18XX_FW_NAME; |
607 | wl->quirks |= WLCORE_QUIRK_NO_ELP | | 609 | wl->quirks |= WLCORE_QUIRK_NO_ELP | |
608 | WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | | 610 | WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | |
611 | WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | | ||
609 | WLCORE_QUIRK_TX_PAD_LAST_FRAME; | 612 | WLCORE_QUIRK_TX_PAD_LAST_FRAME; |
610 | |||
611 | break; | 613 | break; |
612 | case CHIP_ID_185x_PG10: | 614 | case CHIP_ID_185x_PG10: |
613 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x (185x PG10)", | 615 | wl1271_warning("chip id 0x%x (185x PG10) is deprecated", |
614 | wl->chip.id); | 616 | wl->chip.id); |
615 | wl->sr_fw_name = WL18XX_FW_NAME; | 617 | ret = -ENODEV; |
616 | /* wl18xx uses the same firmware for PLT */ | 618 | goto out; |
617 | wl->plt_fw_name = WL18XX_FW_NAME; | ||
618 | wl->quirks |= WLCORE_QUIRK_NO_ELP | | ||
619 | WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED | | ||
620 | WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | | ||
621 | WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN; | ||
622 | |||
623 | /* PG 1.0 has some problems with MCS_13, so disable it */ | ||
624 | wl->ht_cap[IEEE80211_BAND_2GHZ].mcs.rx_mask[1] &= ~BIT(5); | ||
625 | 619 | ||
626 | break; | ||
627 | default: | 620 | default: |
628 | wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); | 621 | wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); |
629 | ret = -ENODEV; | 622 | ret = -ENODEV; |
@@ -634,123 +627,178 @@ out: | |||
634 | return ret; | 627 | return ret; |
635 | } | 628 | } |
636 | 629 | ||
637 | static void wl18xx_set_clk(struct wl1271 *wl) | 630 | static int wl18xx_set_clk(struct wl1271 *wl) |
638 | { | 631 | { |
639 | u32 clk_freq; | 632 | u16 clk_freq; |
633 | int ret; | ||
640 | 634 | ||
641 | wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); | 635 | ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); |
636 | if (ret < 0) | ||
637 | goto out; | ||
642 | 638 | ||
643 | /* TODO: PG2: apparently we need to read the clk type */ | 639 | /* TODO: PG2: apparently we need to read the clk type */ |
644 | 640 | ||
645 | clk_freq = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT); | 641 | ret = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT, &clk_freq); |
642 | if (ret < 0) | ||
643 | goto out; | ||
644 | |||
646 | wl1271_debug(DEBUG_BOOT, "clock freq %d (%d, %d, %d, %d, %s)", clk_freq, | 645 | wl1271_debug(DEBUG_BOOT, "clock freq %d (%d, %d, %d, %d, %s)", clk_freq, |
647 | wl18xx_clk_table[clk_freq].n, wl18xx_clk_table[clk_freq].m, | 646 | wl18xx_clk_table[clk_freq].n, wl18xx_clk_table[clk_freq].m, |
648 | wl18xx_clk_table[clk_freq].p, wl18xx_clk_table[clk_freq].q, | 647 | wl18xx_clk_table[clk_freq].p, wl18xx_clk_table[clk_freq].q, |
649 | wl18xx_clk_table[clk_freq].swallow ? "swallow" : "spit"); | 648 | wl18xx_clk_table[clk_freq].swallow ? "swallow" : "spit"); |
650 | 649 | ||
651 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, wl18xx_clk_table[clk_freq].n); | 650 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, |
652 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, wl18xx_clk_table[clk_freq].m); | 651 | wl18xx_clk_table[clk_freq].n); |
652 | if (ret < 0) | ||
653 | goto out; | ||
654 | |||
655 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, | ||
656 | wl18xx_clk_table[clk_freq].m); | ||
657 | if (ret < 0) | ||
658 | goto out; | ||
653 | 659 | ||
654 | if (wl18xx_clk_table[clk_freq].swallow) { | 660 | if (wl18xx_clk_table[clk_freq].swallow) { |
655 | /* first the 16 lower bits */ | 661 | /* first the 16 lower bits */ |
656 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1, | 662 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1, |
657 | wl18xx_clk_table[clk_freq].q & | 663 | wl18xx_clk_table[clk_freq].q & |
658 | PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK); | 664 | PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK); |
665 | if (ret < 0) | ||
666 | goto out; | ||
667 | |||
659 | /* then the 16 higher bits, masked out */ | 668 | /* then the 16 higher bits, masked out */ |
660 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2, | 669 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2, |
661 | (wl18xx_clk_table[clk_freq].q >> 16) & | 670 | (wl18xx_clk_table[clk_freq].q >> 16) & |
662 | PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK); | 671 | PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK); |
672 | if (ret < 0) | ||
673 | goto out; | ||
663 | 674 | ||
664 | /* first the 16 lower bits */ | 675 | /* first the 16 lower bits */ |
665 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1, | 676 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1, |
666 | wl18xx_clk_table[clk_freq].p & | 677 | wl18xx_clk_table[clk_freq].p & |
667 | PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK); | 678 | PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK); |
679 | if (ret < 0) | ||
680 | goto out; | ||
681 | |||
668 | /* then the 16 higher bits, masked out */ | 682 | /* then the 16 higher bits, masked out */ |
669 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2, | 683 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2, |
670 | (wl18xx_clk_table[clk_freq].p >> 16) & | 684 | (wl18xx_clk_table[clk_freq].p >> 16) & |
671 | PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK); | 685 | PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK); |
672 | } else { | 686 | } else { |
673 | wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, | 687 | ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, |
674 | PLLSH_WCS_PLL_SWALLOW_EN_VAL2); | 688 | PLLSH_WCS_PLL_SWALLOW_EN_VAL2); |
675 | } | 689 | } |
690 | |||
691 | out: | ||
692 | return ret; | ||
676 | } | 693 | } |
677 | 694 | ||
678 | static void wl18xx_boot_soft_reset(struct wl1271 *wl) | 695 | static int wl18xx_boot_soft_reset(struct wl1271 *wl) |
679 | { | 696 | { |
697 | int ret; | ||
698 | |||
680 | /* disable Rx/Tx */ | 699 | /* disable Rx/Tx */ |
681 | wl1271_write32(wl, WL18XX_ENABLE, 0x0); | 700 | ret = wlcore_write32(wl, WL18XX_ENABLE, 0x0); |
701 | if (ret < 0) | ||
702 | goto out; | ||
682 | 703 | ||
683 | /* disable auto calibration on start*/ | 704 | /* disable auto calibration on start*/ |
684 | wl1271_write32(wl, WL18XX_SPARE_A2, 0xffff); | 705 | ret = wlcore_write32(wl, WL18XX_SPARE_A2, 0xffff); |
706 | |||
707 | out: | ||
708 | return ret; | ||
685 | } | 709 | } |
686 | 710 | ||
687 | static int wl18xx_pre_boot(struct wl1271 *wl) | 711 | static int wl18xx_pre_boot(struct wl1271 *wl) |
688 | { | 712 | { |
689 | wl18xx_set_clk(wl); | 713 | int ret; |
714 | |||
715 | ret = wl18xx_set_clk(wl); | ||
716 | if (ret < 0) | ||
717 | goto out; | ||
690 | 718 | ||
691 | /* Continue the ELP wake up sequence */ | 719 | /* Continue the ELP wake up sequence */ |
692 | wl1271_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); | 720 | ret = wlcore_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); |
721 | if (ret < 0) | ||
722 | goto out; | ||
723 | |||
693 | udelay(500); | 724 | udelay(500); |
694 | 725 | ||
695 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 726 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
727 | if (ret < 0) | ||
728 | goto out; | ||
696 | 729 | ||
697 | /* Disable interrupts */ | 730 | /* Disable interrupts */ |
698 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); | 731 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); |
732 | if (ret < 0) | ||
733 | goto out; | ||
699 | 734 | ||
700 | wl18xx_boot_soft_reset(wl); | 735 | ret = wl18xx_boot_soft_reset(wl); |
701 | 736 | ||
702 | return 0; | 737 | out: |
738 | return ret; | ||
703 | } | 739 | } |
704 | 740 | ||
705 | static void wl18xx_pre_upload(struct wl1271 *wl) | 741 | static int wl18xx_pre_upload(struct wl1271 *wl) |
706 | { | 742 | { |
707 | u32 tmp; | 743 | u32 tmp; |
744 | int ret; | ||
708 | 745 | ||
709 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 746 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
747 | if (ret < 0) | ||
748 | goto out; | ||
710 | 749 | ||
711 | /* TODO: check if this is all needed */ | 750 | /* TODO: check if this is all needed */ |
712 | wl1271_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND); | 751 | ret = wlcore_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND); |
752 | if (ret < 0) | ||
753 | goto out; | ||
713 | 754 | ||
714 | tmp = wlcore_read_reg(wl, REG_CHIP_ID_B); | 755 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); |
756 | if (ret < 0) | ||
757 | goto out; | ||
715 | 758 | ||
716 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); | 759 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); |
717 | 760 | ||
718 | tmp = wl1271_read32(wl, WL18XX_SCR_PAD2); | 761 | ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); |
762 | |||
763 | out: | ||
764 | return ret; | ||
719 | } | 765 | } |
720 | 766 | ||
721 | static void wl18xx_set_mac_and_phy(struct wl1271 *wl) | 767 | static int wl18xx_set_mac_and_phy(struct wl1271 *wl) |
722 | { | 768 | { |
723 | struct wl18xx_priv *priv = wl->priv; | 769 | struct wl18xx_priv *priv = wl->priv; |
724 | size_t len; | 770 | int ret; |
725 | 771 | ||
726 | /* the parameters struct is smaller for PG1 */ | 772 | ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); |
727 | if (wl->chip.id == CHIP_ID_185x_PG10) | 773 | if (ret < 0) |
728 | len = offsetof(struct wl18xx_mac_and_phy_params, psat) + 1; | 774 | goto out; |
729 | else | 775 | |
730 | len = sizeof(struct wl18xx_mac_and_phy_params); | 776 | ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, (u8 *)&priv->conf.phy, |
777 | sizeof(struct wl18xx_mac_and_phy_params), false); | ||
731 | 778 | ||
732 | wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); | 779 | out: |
733 | wl1271_write(wl, WL18XX_PHY_INIT_MEM_ADDR, (u8 *)&priv->conf.phy, len, | 780 | return ret; |
734 | false); | ||
735 | } | 781 | } |
736 | 782 | ||
737 | static void wl18xx_enable_interrupts(struct wl1271 *wl) | 783 | static int wl18xx_enable_interrupts(struct wl1271 *wl) |
738 | { | 784 | { |
739 | u32 event_mask, intr_mask; | 785 | u32 event_mask, intr_mask; |
786 | int ret; | ||
740 | 787 | ||
741 | if (wl->chip.id == CHIP_ID_185x_PG10) { | 788 | event_mask = WL18XX_ACX_EVENTS_VECTOR; |
742 | event_mask = WL18XX_ACX_EVENTS_VECTOR_PG1; | 789 | intr_mask = WL18XX_INTR_MASK; |
743 | intr_mask = WL18XX_INTR_MASK_PG1; | ||
744 | } else { | ||
745 | event_mask = WL18XX_ACX_EVENTS_VECTOR_PG2; | ||
746 | intr_mask = WL18XX_INTR_MASK_PG2; | ||
747 | } | ||
748 | 790 | ||
749 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask); | 791 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask); |
792 | if (ret < 0) | ||
793 | goto out; | ||
750 | 794 | ||
751 | wlcore_enable_interrupts(wl); | 795 | wlcore_enable_interrupts(wl); |
752 | wlcore_write_reg(wl, REG_INTERRUPT_MASK, | 796 | |
753 | WL1271_ACX_INTR_ALL & ~intr_mask); | 797 | ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, |
798 | WL1271_ACX_INTR_ALL & ~intr_mask); | ||
799 | |||
800 | out: | ||
801 | return ret; | ||
754 | } | 802 | } |
755 | 803 | ||
756 | static int wl18xx_boot(struct wl1271 *wl) | 804 | static int wl18xx_boot(struct wl1271 *wl) |
@@ -761,25 +809,29 @@ static int wl18xx_boot(struct wl1271 *wl) | |||
761 | if (ret < 0) | 809 | if (ret < 0) |
762 | goto out; | 810 | goto out; |
763 | 811 | ||
764 | wl18xx_pre_upload(wl); | 812 | ret = wl18xx_pre_upload(wl); |
813 | if (ret < 0) | ||
814 | goto out; | ||
765 | 815 | ||
766 | ret = wlcore_boot_upload_firmware(wl); | 816 | ret = wlcore_boot_upload_firmware(wl); |
767 | if (ret < 0) | 817 | if (ret < 0) |
768 | goto out; | 818 | goto out; |
769 | 819 | ||
770 | wl18xx_set_mac_and_phy(wl); | 820 | ret = wl18xx_set_mac_and_phy(wl); |
821 | if (ret < 0) | ||
822 | goto out; | ||
771 | 823 | ||
772 | ret = wlcore_boot_run_firmware(wl); | 824 | ret = wlcore_boot_run_firmware(wl); |
773 | if (ret < 0) | 825 | if (ret < 0) |
774 | goto out; | 826 | goto out; |
775 | 827 | ||
776 | wl18xx_enable_interrupts(wl); | 828 | ret = wl18xx_enable_interrupts(wl); |
777 | 829 | ||
778 | out: | 830 | out: |
779 | return ret; | 831 | return ret; |
780 | } | 832 | } |
781 | 833 | ||
782 | static void wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, | 834 | static int wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, |
783 | void *buf, size_t len) | 835 | void *buf, size_t len) |
784 | { | 836 | { |
785 | struct wl18xx_priv *priv = wl->priv; | 837 | struct wl18xx_priv *priv = wl->priv; |
@@ -787,13 +839,14 @@ static void wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, | |||
787 | memcpy(priv->cmd_buf, buf, len); | 839 | memcpy(priv->cmd_buf, buf, len); |
788 | memset(priv->cmd_buf + len, 0, WL18XX_CMD_MAX_SIZE - len); | 840 | memset(priv->cmd_buf + len, 0, WL18XX_CMD_MAX_SIZE - len); |
789 | 841 | ||
790 | wl1271_write(wl, cmd_box_addr, priv->cmd_buf, WL18XX_CMD_MAX_SIZE, | 842 | return wlcore_write(wl, cmd_box_addr, priv->cmd_buf, |
791 | false); | 843 | WL18XX_CMD_MAX_SIZE, false); |
792 | } | 844 | } |
793 | 845 | ||
794 | static void wl18xx_ack_event(struct wl1271 *wl) | 846 | static int wl18xx_ack_event(struct wl1271 *wl) |
795 | { | 847 | { |
796 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL18XX_INTR_TRIG_EVENT_ACK); | 848 | return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, |
849 | WL18XX_INTR_TRIG_EVENT_ACK); | ||
797 | } | 850 | } |
798 | 851 | ||
799 | static u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) | 852 | static u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) |
@@ -975,34 +1028,32 @@ static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl, | |||
975 | } else if (!strcmp(ht_mode_param, "mimo")) { | 1028 | } else if (!strcmp(ht_mode_param, "mimo")) { |
976 | wl1271_debug(DEBUG_ACX, "using MIMO rate mask"); | 1029 | wl1271_debug(DEBUG_ACX, "using MIMO rate mask"); |
977 | 1030 | ||
978 | /* | ||
979 | * PG 1.0 has some problems with MCS_13, so disable it | ||
980 | * | ||
981 | * TODO: instead of hacking this in here, we should | ||
982 | * make it more general and change a bit in the | ||
983 | * wlvif->rate_set instead. | ||
984 | */ | ||
985 | if (wl->chip.id == CHIP_ID_185x_PG10) | ||
986 | return CONF_TX_MIMO_RATES & ~CONF_HW_BIT_RATE_MCS_13; | ||
987 | |||
988 | return CONF_TX_MIMO_RATES; | 1031 | return CONF_TX_MIMO_RATES; |
989 | } else { | 1032 | } else { |
990 | return 0; | 1033 | return 0; |
991 | } | 1034 | } |
992 | } | 1035 | } |
993 | 1036 | ||
994 | static s8 wl18xx_get_pg_ver(struct wl1271 *wl) | 1037 | static int wl18xx_get_pg_ver(struct wl1271 *wl, s8 *ver) |
995 | { | 1038 | { |
996 | u32 fuse; | 1039 | u32 fuse; |
1040 | int ret; | ||
997 | 1041 | ||
998 | wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); | 1042 | ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); |
1043 | if (ret < 0) | ||
1044 | goto out; | ||
1045 | |||
1046 | ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_1_3, &fuse); | ||
1047 | if (ret < 0) | ||
1048 | goto out; | ||
999 | 1049 | ||
1000 | fuse = wl1271_read32(wl, WL18XX_REG_FUSE_DATA_1_3); | 1050 | if (ver) |
1001 | fuse = (fuse & WL18XX_PG_VER_MASK) >> WL18XX_PG_VER_OFFSET; | 1051 | *ver = (fuse & WL18XX_PG_VER_MASK) >> WL18XX_PG_VER_OFFSET; |
1002 | 1052 | ||
1003 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 1053 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
1004 | 1054 | ||
1005 | return (s8)fuse; | 1055 | out: |
1056 | return ret; | ||
1006 | } | 1057 | } |
1007 | 1058 | ||
1008 | #define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin" | 1059 | #define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin" |
@@ -1021,8 +1072,7 @@ static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) | |||
1021 | } | 1072 | } |
1022 | 1073 | ||
1023 | if (fw->size != WL18XX_CONF_SIZE) { | 1074 | if (fw->size != WL18XX_CONF_SIZE) { |
1024 | wl1271_error("configuration binary file size is wrong, " | 1075 | wl1271_error("configuration binary file size is wrong, expected %zu got %zu", |
1025 | "expected %ld got %zd", | ||
1026 | WL18XX_CONF_SIZE, fw->size); | 1076 | WL18XX_CONF_SIZE, fw->size); |
1027 | ret = -EINVAL; | 1077 | ret = -EINVAL; |
1028 | goto out; | 1078 | goto out; |
@@ -1069,26 +1119,41 @@ out: | |||
1069 | 1119 | ||
1070 | static int wl18xx_plt_init(struct wl1271 *wl) | 1120 | static int wl18xx_plt_init(struct wl1271 *wl) |
1071 | { | 1121 | { |
1072 | wl1271_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT); | 1122 | int ret; |
1123 | |||
1124 | ret = wlcore_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT); | ||
1125 | if (ret < 0) | ||
1126 | return ret; | ||
1073 | 1127 | ||
1074 | return wl->ops->boot(wl); | 1128 | return wl->ops->boot(wl); |
1075 | } | 1129 | } |
1076 | 1130 | ||
1077 | static void wl18xx_get_mac(struct wl1271 *wl) | 1131 | static int wl18xx_get_mac(struct wl1271 *wl) |
1078 | { | 1132 | { |
1079 | u32 mac1, mac2; | 1133 | u32 mac1, mac2; |
1134 | int ret; | ||
1135 | |||
1136 | ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); | ||
1137 | if (ret < 0) | ||
1138 | goto out; | ||
1080 | 1139 | ||
1081 | wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); | 1140 | ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1, &mac1); |
1141 | if (ret < 0) | ||
1142 | goto out; | ||
1082 | 1143 | ||
1083 | mac1 = wl1271_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1); | 1144 | ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2, &mac2); |
1084 | mac2 = wl1271_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2); | 1145 | if (ret < 0) |
1146 | goto out; | ||
1085 | 1147 | ||
1086 | /* these are the two parts of the BD_ADDR */ | 1148 | /* these are the two parts of the BD_ADDR */ |
1087 | wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + | 1149 | wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + |
1088 | ((mac1 & 0xff000000) >> 24); | 1150 | ((mac1 & 0xff000000) >> 24); |
1089 | wl->fuse_nic_addr = (mac1 & 0xffffff); | 1151 | wl->fuse_nic_addr = (mac1 & 0xffffff); |
1090 | 1152 | ||
1091 | wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); | 1153 | ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); |
1154 | |||
1155 | out: | ||
1156 | return ret; | ||
1092 | } | 1157 | } |
1093 | 1158 | ||
1094 | static int wl18xx_handle_static_data(struct wl1271 *wl, | 1159 | static int wl18xx_handle_static_data(struct wl1271 *wl, |
@@ -1214,8 +1279,8 @@ static struct wlcore_ops wl18xx_ops = { | |||
1214 | .pre_pkt_send = wl18xx_pre_pkt_send, | 1279 | .pre_pkt_send = wl18xx_pre_pkt_send, |
1215 | }; | 1280 | }; |
1216 | 1281 | ||
1217 | /* HT cap appropriate for wide channels */ | 1282 | /* HT cap appropriate for wide channels in 2Ghz */ |
1218 | static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap = { | 1283 | static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_2ghz = { |
1219 | .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | | 1284 | .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | |
1220 | IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_DSSSCCK40, | 1285 | IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_DSSSCCK40, |
1221 | .ht_supported = true, | 1286 | .ht_supported = true, |
@@ -1228,40 +1293,42 @@ static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap = { | |||
1228 | }, | 1293 | }, |
1229 | }; | 1294 | }; |
1230 | 1295 | ||
1231 | /* HT cap appropriate for SISO 20 */ | 1296 | /* HT cap appropriate for wide channels in 5Ghz */ |
1232 | static struct ieee80211_sta_ht_cap wl18xx_siso20_ht_cap = { | 1297 | static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_5ghz = { |
1233 | .cap = IEEE80211_HT_CAP_SGI_20, | 1298 | .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | |
1299 | IEEE80211_HT_CAP_SUP_WIDTH_20_40, | ||
1234 | .ht_supported = true, | 1300 | .ht_supported = true, |
1235 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, | 1301 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, |
1236 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, | 1302 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
1237 | .mcs = { | 1303 | .mcs = { |
1238 | .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, | 1304 | .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
1239 | .rx_highest = cpu_to_le16(72), | 1305 | .rx_highest = cpu_to_le16(150), |
1240 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, | 1306 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
1241 | }, | 1307 | }, |
1242 | }; | 1308 | }; |
1243 | 1309 | ||
1244 | /* HT cap appropriate for MIMO rates in 20mhz channel */ | 1310 | /* HT cap appropriate for SISO 20 */ |
1245 | static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_2ghz = { | 1311 | static struct ieee80211_sta_ht_cap wl18xx_siso20_ht_cap = { |
1246 | .cap = IEEE80211_HT_CAP_SGI_20, | 1312 | .cap = IEEE80211_HT_CAP_SGI_20, |
1247 | .ht_supported = true, | 1313 | .ht_supported = true, |
1248 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, | 1314 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, |
1249 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, | 1315 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
1250 | .mcs = { | 1316 | .mcs = { |
1251 | .rx_mask = { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, }, | 1317 | .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
1252 | .rx_highest = cpu_to_le16(144), | 1318 | .rx_highest = cpu_to_le16(72), |
1253 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, | 1319 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
1254 | }, | 1320 | }, |
1255 | }; | 1321 | }; |
1256 | 1322 | ||
1257 | static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_5ghz = { | 1323 | /* HT cap appropriate for MIMO rates in 20mhz channel */ |
1324 | static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_2ghz = { | ||
1258 | .cap = IEEE80211_HT_CAP_SGI_20, | 1325 | .cap = IEEE80211_HT_CAP_SGI_20, |
1259 | .ht_supported = true, | 1326 | .ht_supported = true, |
1260 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, | 1327 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, |
1261 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, | 1328 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
1262 | .mcs = { | 1329 | .mcs = { |
1263 | .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, | 1330 | .rx_mask = { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, }, |
1264 | .rx_highest = cpu_to_le16(72), | 1331 | .rx_highest = cpu_to_le16(144), |
1265 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, | 1332 | .tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
1266 | }, | 1333 | }, |
1267 | }; | 1334 | }; |
@@ -1286,7 +1353,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev) | |||
1286 | wl->ptable = wl18xx_ptable; | 1353 | wl->ptable = wl18xx_ptable; |
1287 | wl->rtable = wl18xx_rtable; | 1354 | wl->rtable = wl18xx_rtable; |
1288 | wl->num_tx_desc = 32; | 1355 | wl->num_tx_desc = 32; |
1289 | wl->num_rx_desc = 16; | 1356 | wl->num_rx_desc = 32; |
1290 | wl->band_rate_to_idx = wl18xx_band_rate_to_idx; | 1357 | wl->band_rate_to_idx = wl18xx_band_rate_to_idx; |
1291 | wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; | 1358 | wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; |
1292 | wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; | 1359 | wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; |
@@ -1294,32 +1361,8 @@ static int __devinit wl18xx_probe(struct platform_device *pdev) | |||
1294 | wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics); | 1361 | wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics); |
1295 | wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv); | 1362 | wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv); |
1296 | 1363 | ||
1297 | if (!strcmp(ht_mode_param, "wide")) { | 1364 | if (num_rx_desc_param != -1) |
1298 | memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ], | 1365 | wl->num_rx_desc = num_rx_desc_param; |
1299 | &wl18xx_siso40_ht_cap, | ||
1300 | sizeof(wl18xx_siso40_ht_cap)); | ||
1301 | memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ], | ||
1302 | &wl18xx_siso40_ht_cap, | ||
1303 | sizeof(wl18xx_siso40_ht_cap)); | ||
1304 | } else if (!strcmp(ht_mode_param, "mimo")) { | ||
1305 | memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ], | ||
1306 | &wl18xx_mimo_ht_cap_2ghz, | ||
1307 | sizeof(wl18xx_mimo_ht_cap_2ghz)); | ||
1308 | memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ], | ||
1309 | &wl18xx_mimo_ht_cap_5ghz, | ||
1310 | sizeof(wl18xx_mimo_ht_cap_5ghz)); | ||
1311 | } else if (!strcmp(ht_mode_param, "siso20")) { | ||
1312 | memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ], | ||
1313 | &wl18xx_siso20_ht_cap, | ||
1314 | sizeof(wl18xx_siso20_ht_cap)); | ||
1315 | memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ], | ||
1316 | &wl18xx_siso20_ht_cap, | ||
1317 | sizeof(wl18xx_siso20_ht_cap)); | ||
1318 | } else { | ||
1319 | wl1271_error("invalid ht_mode '%s'", ht_mode_param); | ||
1320 | ret = -EINVAL; | ||
1321 | goto out_free; | ||
1322 | } | ||
1323 | 1366 | ||
1324 | ret = wl18xx_conf_init(wl, &pdev->dev); | 1367 | ret = wl18xx_conf_init(wl, &pdev->dev); |
1325 | if (ret < 0) | 1368 | if (ret < 0) |
@@ -1366,6 +1409,37 @@ static int __devinit wl18xx_probe(struct platform_device *pdev) | |||
1366 | if (dc2dc_param != -1) | 1409 | if (dc2dc_param != -1) |
1367 | priv->conf.phy.external_pa_dc2dc = dc2dc_param; | 1410 | priv->conf.phy.external_pa_dc2dc = dc2dc_param; |
1368 | 1411 | ||
1412 | if (!strcmp(ht_mode_param, "default")) { | ||
1413 | /* | ||
1414 | * Only support mimo with multiple antennas. Fall back to | ||
1415 | * siso20. | ||
1416 | */ | ||
1417 | if (priv->conf.phy.number_of_assembled_ant2_4 >= 2) | ||
1418 | wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, | ||
1419 | &wl18xx_mimo_ht_cap_2ghz); | ||
1420 | else | ||
1421 | wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, | ||
1422 | &wl18xx_siso20_ht_cap); | ||
1423 | |||
1424 | /* 5Ghz is always wide */ | ||
1425 | wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, | ||
1426 | &wl18xx_siso40_ht_cap_5ghz); | ||
1427 | } else if (!strcmp(ht_mode_param, "wide")) { | ||
1428 | wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, | ||
1429 | &wl18xx_siso40_ht_cap_2ghz); | ||
1430 | wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, | ||
1431 | &wl18xx_siso40_ht_cap_5ghz); | ||
1432 | } else if (!strcmp(ht_mode_param, "siso20")) { | ||
1433 | wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, | ||
1434 | &wl18xx_siso20_ht_cap); | ||
1435 | wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, | ||
1436 | &wl18xx_siso20_ht_cap); | ||
1437 | } else { | ||
1438 | wl1271_error("invalid ht_mode '%s'", ht_mode_param); | ||
1439 | ret = -EINVAL; | ||
1440 | goto out_free; | ||
1441 | } | ||
1442 | |||
1369 | if (!checksum_param) { | 1443 | if (!checksum_param) { |
1370 | wl18xx_ops.set_rx_csum = NULL; | 1444 | wl18xx_ops.set_rx_csum = NULL; |
1371 | wl18xx_ops.init_vif = NULL; | 1445 | wl18xx_ops.init_vif = NULL; |
@@ -1410,7 +1484,7 @@ static void __exit wl18xx_exit(void) | |||
1410 | module_exit(wl18xx_exit); | 1484 | module_exit(wl18xx_exit); |
1411 | 1485 | ||
1412 | module_param_named(ht_mode, ht_mode_param, charp, S_IRUSR); | 1486 | module_param_named(ht_mode, ht_mode_param, charp, S_IRUSR); |
1413 | MODULE_PARM_DESC(ht_mode, "Force HT mode: wide (default), mimo or siso20"); | 1487 | MODULE_PARM_DESC(ht_mode, "Force HT mode: wide or siso20"); |
1414 | 1488 | ||
1415 | module_param_named(board_type, board_type_param, charp, S_IRUSR); | 1489 | module_param_named(board_type, board_type_param, charp, S_IRUSR); |
1416 | MODULE_PARM_DESC(board_type, "Board type: fpga, hdk (default), evb, com8 or " | 1490 | MODULE_PARM_DESC(board_type, "Board type: fpga, hdk (default), evb, com8 or " |
@@ -1458,6 +1532,11 @@ module_param_named(pwr_limit_reference_11_abg, | |||
1458 | MODULE_PARM_DESC(pwr_limit_reference_11_abg, "Power limit reference: u8 " | 1532 | MODULE_PARM_DESC(pwr_limit_reference_11_abg, "Power limit reference: u8 " |
1459 | "(default is 0xc8)"); | 1533 | "(default is 0xc8)"); |
1460 | 1534 | ||
1535 | module_param_named(num_rx_desc, | ||
1536 | num_rx_desc_param, int, S_IRUSR); | ||
1537 | MODULE_PARM_DESC(num_rx_desc_param, | ||
1538 | "Number of Rx descriptors: u8 (default is 32)"); | ||
1539 | |||
1461 | MODULE_LICENSE("GPL v2"); | 1540 | MODULE_LICENSE("GPL v2"); |
1462 | MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); | 1541 | MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); |
1463 | MODULE_FIRMWARE(WL18XX_FW_NAME); | 1542 | MODULE_FIRMWARE(WL18XX_FW_NAME); |
diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c index b9ec42c83757..ce108a736bd0 100644 --- a/drivers/net/wireless/ti/wlcore/acx.c +++ b/drivers/net/wireless/ti/wlcore/acx.c | |||
@@ -70,7 +70,7 @@ int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth) | |||
70 | struct acx_sleep_auth *auth; | 70 | struct acx_sleep_auth *auth; |
71 | int ret; | 71 | int ret; |
72 | 72 | ||
73 | wl1271_debug(DEBUG_ACX, "acx sleep auth"); | 73 | wl1271_debug(DEBUG_ACX, "acx sleep auth %d", sleep_auth); |
74 | 74 | ||
75 | auth = kzalloc(sizeof(*auth), GFP_KERNEL); | 75 | auth = kzalloc(sizeof(*auth), GFP_KERNEL); |
76 | if (!auth) { | 76 | if (!auth) { |
@@ -81,7 +81,13 @@ int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth) | |||
81 | auth->sleep_auth = sleep_auth; | 81 | auth->sleep_auth = sleep_auth; |
82 | 82 | ||
83 | ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); | 83 | ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); |
84 | if (ret < 0) { | ||
85 | wl1271_error("could not configure sleep_auth to %d: %d", | ||
86 | sleep_auth, ret); | ||
87 | goto out; | ||
88 | } | ||
84 | 89 | ||
90 | wl->sleep_auth = sleep_auth; | ||
85 | out: | 91 | out: |
86 | kfree(auth); | 92 | kfree(auth); |
87 | return ret; | 93 | return ret; |
diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h index c0181258b722..d03215d6b3bd 100644 --- a/drivers/net/wireless/ti/wlcore/acx.h +++ b/drivers/net/wireless/ti/wlcore/acx.h | |||
@@ -118,6 +118,11 @@ enum wl1271_psm_mode { | |||
118 | 118 | ||
119 | /* Extreme low power */ | 119 | /* Extreme low power */ |
120 | WL1271_PSM_ELP = 2, | 120 | WL1271_PSM_ELP = 2, |
121 | |||
122 | WL1271_PSM_MAX = WL1271_PSM_ELP, | ||
123 | |||
124 | /* illegal out of band value of PSM mode */ | ||
125 | WL1271_PSM_ILLEGAL = 0xff | ||
121 | }; | 126 | }; |
122 | 127 | ||
123 | struct acx_sleep_auth { | 128 | struct acx_sleep_auth { |
diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c index 0fda500c01c9..8965960b841a 100644 --- a/drivers/net/wireless/ti/wlcore/boot.c +++ b/drivers/net/wireless/ti/wlcore/boot.c | |||
@@ -33,16 +33,22 @@ | |||
33 | #include "rx.h" | 33 | #include "rx.h" |
34 | #include "hw_ops.h" | 34 | #include "hw_ops.h" |
35 | 35 | ||
36 | static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag) | 36 | static int wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag) |
37 | { | 37 | { |
38 | u32 cpu_ctrl; | 38 | u32 cpu_ctrl; |
39 | int ret; | ||
39 | 40 | ||
40 | /* 10.5.0 run the firmware (I) */ | 41 | /* 10.5.0 run the firmware (I) */ |
41 | cpu_ctrl = wlcore_read_reg(wl, REG_ECPU_CONTROL); | 42 | ret = wlcore_read_reg(wl, REG_ECPU_CONTROL, &cpu_ctrl); |
43 | if (ret < 0) | ||
44 | goto out; | ||
42 | 45 | ||
43 | /* 10.5.1 run the firmware (II) */ | 46 | /* 10.5.1 run the firmware (II) */ |
44 | cpu_ctrl |= flag; | 47 | cpu_ctrl |= flag; |
45 | wlcore_write_reg(wl, REG_ECPU_CONTROL, cpu_ctrl); | 48 | ret = wlcore_write_reg(wl, REG_ECPU_CONTROL, cpu_ctrl); |
49 | |||
50 | out: | ||
51 | return ret; | ||
46 | } | 52 | } |
47 | 53 | ||
48 | static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, | 54 | static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, |
@@ -87,7 +93,9 @@ static int wlcore_boot_static_data(struct wl1271 *wl) | |||
87 | goto out; | 93 | goto out; |
88 | } | 94 | } |
89 | 95 | ||
90 | wl1271_read(wl, wl->cmd_box_addr, static_data, len, false); | 96 | ret = wlcore_read(wl, wl->cmd_box_addr, static_data, len, false); |
97 | if (ret < 0) | ||
98 | goto out_free; | ||
91 | 99 | ||
92 | ret = wlcore_boot_parse_fw_ver(wl, static_data); | 100 | ret = wlcore_boot_parse_fw_ver(wl, static_data); |
93 | if (ret < 0) | 101 | if (ret < 0) |
@@ -109,6 +117,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
109 | struct wlcore_partition_set partition; | 117 | struct wlcore_partition_set partition; |
110 | int addr, chunk_num, partition_limit; | 118 | int addr, chunk_num, partition_limit; |
111 | u8 *p, *chunk; | 119 | u8 *p, *chunk; |
120 | int ret; | ||
112 | 121 | ||
113 | /* whal_FwCtrl_LoadFwImageSm() */ | 122 | /* whal_FwCtrl_LoadFwImageSm() */ |
114 | 123 | ||
@@ -130,7 +139,9 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
130 | 139 | ||
131 | memcpy(&partition, &wl->ptable[PART_DOWN], sizeof(partition)); | 140 | memcpy(&partition, &wl->ptable[PART_DOWN], sizeof(partition)); |
132 | partition.mem.start = dest; | 141 | partition.mem.start = dest; |
133 | wlcore_set_partition(wl, &partition); | 142 | ret = wlcore_set_partition(wl, &partition); |
143 | if (ret < 0) | ||
144 | return ret; | ||
134 | 145 | ||
135 | /* 10.1 set partition limit and chunk num */ | 146 | /* 10.1 set partition limit and chunk num */ |
136 | chunk_num = 0; | 147 | chunk_num = 0; |
@@ -144,7 +155,9 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
144 | partition_limit = chunk_num * CHUNK_SIZE + | 155 | partition_limit = chunk_num * CHUNK_SIZE + |
145 | wl->ptable[PART_DOWN].mem.size; | 156 | wl->ptable[PART_DOWN].mem.size; |
146 | partition.mem.start = addr; | 157 | partition.mem.start = addr; |
147 | wlcore_set_partition(wl, &partition); | 158 | ret = wlcore_set_partition(wl, &partition); |
159 | if (ret < 0) | ||
160 | return ret; | ||
148 | } | 161 | } |
149 | 162 | ||
150 | /* 10.3 upload the chunk */ | 163 | /* 10.3 upload the chunk */ |
@@ -153,7 +166,9 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
153 | memcpy(chunk, p, CHUNK_SIZE); | 166 | memcpy(chunk, p, CHUNK_SIZE); |
154 | wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", | 167 | wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", |
155 | p, addr); | 168 | p, addr); |
156 | wl1271_write(wl, addr, chunk, CHUNK_SIZE, false); | 169 | ret = wlcore_write(wl, addr, chunk, CHUNK_SIZE, false); |
170 | if (ret < 0) | ||
171 | goto out; | ||
157 | 172 | ||
158 | chunk_num++; | 173 | chunk_num++; |
159 | } | 174 | } |
@@ -164,10 +179,11 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
164 | memcpy(chunk, p, fw_data_len % CHUNK_SIZE); | 179 | memcpy(chunk, p, fw_data_len % CHUNK_SIZE); |
165 | wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", | 180 | wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", |
166 | fw_data_len % CHUNK_SIZE, p, addr); | 181 | fw_data_len % CHUNK_SIZE, p, addr); |
167 | wl1271_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); | 182 | ret = wlcore_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); |
168 | 183 | ||
184 | out: | ||
169 | kfree(chunk); | 185 | kfree(chunk); |
170 | return 0; | 186 | return ret; |
171 | } | 187 | } |
172 | 188 | ||
173 | int wlcore_boot_upload_firmware(struct wl1271 *wl) | 189 | int wlcore_boot_upload_firmware(struct wl1271 *wl) |
@@ -210,6 +226,7 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl) | |||
210 | int i; | 226 | int i; |
211 | u32 dest_addr, val; | 227 | u32 dest_addr, val; |
212 | u8 *nvs_ptr, *nvs_aligned; | 228 | u8 *nvs_ptr, *nvs_aligned; |
229 | int ret; | ||
213 | 230 | ||
214 | if (wl->nvs == NULL) { | 231 | if (wl->nvs == NULL) { |
215 | wl1271_error("NVS file is needed during boot"); | 232 | wl1271_error("NVS file is needed during boot"); |
@@ -307,7 +324,9 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl) | |||
307 | wl1271_debug(DEBUG_BOOT, | 324 | wl1271_debug(DEBUG_BOOT, |
308 | "nvs burst write 0x%x: 0x%x", | 325 | "nvs burst write 0x%x: 0x%x", |
309 | dest_addr, val); | 326 | dest_addr, val); |
310 | wl1271_write32(wl, dest_addr, val); | 327 | ret = wlcore_write32(wl, dest_addr, val); |
328 | if (ret < 0) | ||
329 | return ret; | ||
311 | 330 | ||
312 | nvs_ptr += 4; | 331 | nvs_ptr += 4; |
313 | dest_addr += 4; | 332 | dest_addr += 4; |
@@ -333,7 +352,9 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl) | |||
333 | nvs_len -= nvs_ptr - (u8 *)wl->nvs; | 352 | nvs_len -= nvs_ptr - (u8 *)wl->nvs; |
334 | 353 | ||
335 | /* Now we must set the partition correctly */ | 354 | /* Now we must set the partition correctly */ |
336 | wlcore_set_partition(wl, &wl->ptable[PART_WORK]); | 355 | ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); |
356 | if (ret < 0) | ||
357 | return ret; | ||
337 | 358 | ||
338 | /* Copy the NVS tables to a new block to ensure alignment */ | 359 | /* Copy the NVS tables to a new block to ensure alignment */ |
339 | nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); | 360 | nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); |
@@ -341,11 +362,11 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl) | |||
341 | return -ENOMEM; | 362 | return -ENOMEM; |
342 | 363 | ||
343 | /* And finally we upload the NVS tables */ | 364 | /* And finally we upload the NVS tables */ |
344 | wlcore_write_data(wl, REG_CMD_MBOX_ADDRESS, | 365 | ret = wlcore_write_data(wl, REG_CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, |
345 | nvs_aligned, nvs_len, false); | 366 | false); |
346 | 367 | ||
347 | kfree(nvs_aligned); | 368 | kfree(nvs_aligned); |
348 | return 0; | 369 | return ret; |
349 | 370 | ||
350 | out_badnvs: | 371 | out_badnvs: |
351 | wl1271_error("nvs data is malformed"); | 372 | wl1271_error("nvs data is malformed"); |
@@ -359,11 +380,17 @@ int wlcore_boot_run_firmware(struct wl1271 *wl) | |||
359 | u32 chip_id, intr; | 380 | u32 chip_id, intr; |
360 | 381 | ||
361 | /* Make sure we have the boot partition */ | 382 | /* Make sure we have the boot partition */ |
362 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 383 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
384 | if (ret < 0) | ||
385 | return ret; | ||
363 | 386 | ||
364 | wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); | 387 | ret = wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); |
388 | if (ret < 0) | ||
389 | return ret; | ||
365 | 390 | ||
366 | chip_id = wlcore_read_reg(wl, REG_CHIP_ID_B); | 391 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &chip_id); |
392 | if (ret < 0) | ||
393 | return ret; | ||
367 | 394 | ||
368 | wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); | 395 | wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); |
369 | 396 | ||
@@ -376,7 +403,9 @@ int wlcore_boot_run_firmware(struct wl1271 *wl) | |||
376 | loop = 0; | 403 | loop = 0; |
377 | while (loop++ < INIT_LOOP) { | 404 | while (loop++ < INIT_LOOP) { |
378 | udelay(INIT_LOOP_DELAY); | 405 | udelay(INIT_LOOP_DELAY); |
379 | intr = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR); | 406 | ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); |
407 | if (ret < 0) | ||
408 | return ret; | ||
380 | 409 | ||
381 | if (intr == 0xffffffff) { | 410 | if (intr == 0xffffffff) { |
382 | wl1271_error("error reading hardware complete " | 411 | wl1271_error("error reading hardware complete " |
@@ -385,8 +414,10 @@ int wlcore_boot_run_firmware(struct wl1271 *wl) | |||
385 | } | 414 | } |
386 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ | 415 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ |
387 | else if (intr & WL1271_ACX_INTR_INIT_COMPLETE) { | 416 | else if (intr & WL1271_ACX_INTR_INIT_COMPLETE) { |
388 | wlcore_write_reg(wl, REG_INTERRUPT_ACK, | 417 | ret = wlcore_write_reg(wl, REG_INTERRUPT_ACK, |
389 | WL1271_ACX_INTR_INIT_COMPLETE); | 418 | WL1271_ACX_INTR_INIT_COMPLETE); |
419 | if (ret < 0) | ||
420 | return ret; | ||
390 | break; | 421 | break; |
391 | } | 422 | } |
392 | } | 423 | } |
@@ -398,12 +429,17 @@ int wlcore_boot_run_firmware(struct wl1271 *wl) | |||
398 | } | 429 | } |
399 | 430 | ||
400 | /* get hardware config command mail box */ | 431 | /* get hardware config command mail box */ |
401 | wl->cmd_box_addr = wlcore_read_reg(wl, REG_COMMAND_MAILBOX_PTR); | 432 | ret = wlcore_read_reg(wl, REG_COMMAND_MAILBOX_PTR, &wl->cmd_box_addr); |
433 | if (ret < 0) | ||
434 | return ret; | ||
402 | 435 | ||
403 | wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x", wl->cmd_box_addr); | 436 | wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x", wl->cmd_box_addr); |
404 | 437 | ||
405 | /* get hardware config event mail box */ | 438 | /* get hardware config event mail box */ |
406 | wl->mbox_ptr[0] = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR); | 439 | ret = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR, &wl->mbox_ptr[0]); |
440 | if (ret < 0) | ||
441 | return ret; | ||
442 | |||
407 | wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); | 443 | wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); |
408 | 444 | ||
409 | wl1271_debug(DEBUG_MAILBOX, "MBOX ptrs: 0x%x 0x%x", | 445 | wl1271_debug(DEBUG_MAILBOX, "MBOX ptrs: 0x%x 0x%x", |
@@ -445,9 +481,9 @@ int wlcore_boot_run_firmware(struct wl1271 *wl) | |||
445 | } | 481 | } |
446 | 482 | ||
447 | /* set the working partition to its "running" mode offset */ | 483 | /* set the working partition to its "running" mode offset */ |
448 | wlcore_set_partition(wl, &wl->ptable[PART_WORK]); | 484 | ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); |
449 | 485 | ||
450 | /* firmware startup completed */ | 486 | /* firmware startup completed */ |
451 | return 0; | 487 | return ret; |
452 | } | 488 | } |
453 | EXPORT_SYMBOL_GPL(wlcore_boot_run_firmware); | 489 | EXPORT_SYMBOL_GPL(wlcore_boot_run_firmware); |
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 885364ca4344..56c7a2342fdf 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c | |||
@@ -65,17 +65,24 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
65 | WARN_ON(len % 4 != 0); | 65 | WARN_ON(len % 4 != 0); |
66 | WARN_ON(test_bit(WL1271_FLAG_IN_ELP, &wl->flags)); | 66 | WARN_ON(test_bit(WL1271_FLAG_IN_ELP, &wl->flags)); |
67 | 67 | ||
68 | wl1271_write(wl, wl->cmd_box_addr, buf, len, false); | 68 | ret = wlcore_write(wl, wl->cmd_box_addr, buf, len, false); |
69 | if (ret < 0) | ||
70 | goto fail; | ||
69 | 71 | ||
70 | /* | 72 | /* |
71 | * TODO: we just need this because one bit is in a different | 73 | * TODO: we just need this because one bit is in a different |
72 | * place. Is there any better way? | 74 | * place. Is there any better way? |
73 | */ | 75 | */ |
74 | wl->ops->trigger_cmd(wl, wl->cmd_box_addr, buf, len); | 76 | ret = wl->ops->trigger_cmd(wl, wl->cmd_box_addr, buf, len); |
77 | if (ret < 0) | ||
78 | goto fail; | ||
75 | 79 | ||
76 | timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); | 80 | timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); |
77 | 81 | ||
78 | intr = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR); | 82 | ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); |
83 | if (ret < 0) | ||
84 | goto fail; | ||
85 | |||
79 | while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) { | 86 | while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) { |
80 | if (time_after(jiffies, timeout)) { | 87 | if (time_after(jiffies, timeout)) { |
81 | wl1271_error("command complete timeout"); | 88 | wl1271_error("command complete timeout"); |
@@ -89,13 +96,18 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
89 | else | 96 | else |
90 | msleep(1); | 97 | msleep(1); |
91 | 98 | ||
92 | intr = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR); | 99 | ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); |
100 | if (ret < 0) | ||
101 | goto fail; | ||
93 | } | 102 | } |
94 | 103 | ||
95 | /* read back the status code of the command */ | 104 | /* read back the status code of the command */ |
96 | if (res_len == 0) | 105 | if (res_len == 0) |
97 | res_len = sizeof(struct wl1271_cmd_header); | 106 | res_len = sizeof(struct wl1271_cmd_header); |
98 | wl1271_read(wl, wl->cmd_box_addr, cmd, res_len, false); | 107 | |
108 | ret = wlcore_read(wl, wl->cmd_box_addr, cmd, res_len, false); | ||
109 | if (ret < 0) | ||
110 | goto fail; | ||
99 | 111 | ||
100 | status = le16_to_cpu(cmd->status); | 112 | status = le16_to_cpu(cmd->status); |
101 | if (status != CMD_STATUS_SUCCESS) { | 113 | if (status != CMD_STATUS_SUCCESS) { |
@@ -104,11 +116,14 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
104 | goto fail; | 116 | goto fail; |
105 | } | 117 | } |
106 | 118 | ||
107 | wlcore_write_reg(wl, REG_INTERRUPT_ACK, WL1271_ACX_INTR_CMD_COMPLETE); | 119 | ret = wlcore_write_reg(wl, REG_INTERRUPT_ACK, |
120 | WL1271_ACX_INTR_CMD_COMPLETE); | ||
121 | if (ret < 0) | ||
122 | goto fail; | ||
123 | |||
108 | return 0; | 124 | return 0; |
109 | 125 | ||
110 | fail: | 126 | fail: |
111 | WARN_ON(1); | ||
112 | wl12xx_queue_recovery_work(wl); | 127 | wl12xx_queue_recovery_work(wl); |
113 | return ret; | 128 | return ret; |
114 | } | 129 | } |
@@ -117,35 +132,45 @@ fail: | |||
117 | * Poll the mailbox event field until any of the bits in the mask is set or a | 132 | * Poll the mailbox event field until any of the bits in the mask is set or a |
118 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) | 133 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) |
119 | */ | 134 | */ |
120 | static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask) | 135 | static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, |
136 | u32 mask, bool *timeout) | ||
121 | { | 137 | { |
122 | u32 *events_vector; | 138 | u32 *events_vector; |
123 | u32 event; | 139 | u32 event; |
124 | unsigned long timeout; | 140 | unsigned long timeout_time; |
125 | int ret = 0; | 141 | int ret = 0; |
126 | 142 | ||
143 | *timeout = false; | ||
144 | |||
127 | events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA); | 145 | events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA); |
128 | if (!events_vector) | 146 | if (!events_vector) |
129 | return -ENOMEM; | 147 | return -ENOMEM; |
130 | 148 | ||
131 | timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); | 149 | timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); |
132 | 150 | ||
133 | do { | 151 | do { |
134 | if (time_after(jiffies, timeout)) { | 152 | if (time_after(jiffies, timeout_time)) { |
135 | wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", | 153 | wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", |
136 | (int)mask); | 154 | (int)mask); |
137 | ret = -ETIMEDOUT; | 155 | *timeout = true; |
138 | goto out; | 156 | goto out; |
139 | } | 157 | } |
140 | 158 | ||
141 | msleep(1); | 159 | msleep(1); |
142 | 160 | ||
143 | /* read from both event fields */ | 161 | /* read from both event fields */ |
144 | wl1271_read(wl, wl->mbox_ptr[0], events_vector, | 162 | ret = wlcore_read(wl, wl->mbox_ptr[0], events_vector, |
145 | sizeof(*events_vector), false); | 163 | sizeof(*events_vector), false); |
164 | if (ret < 0) | ||
165 | goto out; | ||
166 | |||
146 | event = *events_vector & mask; | 167 | event = *events_vector & mask; |
147 | wl1271_read(wl, wl->mbox_ptr[1], events_vector, | 168 | |
148 | sizeof(*events_vector), false); | 169 | ret = wlcore_read(wl, wl->mbox_ptr[1], events_vector, |
170 | sizeof(*events_vector), false); | ||
171 | if (ret < 0) | ||
172 | goto out; | ||
173 | |||
149 | event |= *events_vector & mask; | 174 | event |= *events_vector & mask; |
150 | } while (!event); | 175 | } while (!event); |
151 | 176 | ||
@@ -157,9 +182,10 @@ out: | |||
157 | static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask) | 182 | static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask) |
158 | { | 183 | { |
159 | int ret; | 184 | int ret; |
185 | bool timeout = false; | ||
160 | 186 | ||
161 | ret = wl1271_cmd_wait_for_event_or_timeout(wl, mask); | 187 | ret = wl1271_cmd_wait_for_event_or_timeout(wl, mask, &timeout); |
162 | if (ret != 0) { | 188 | if (ret != 0 || timeout) { |
163 | wl12xx_queue_recovery_work(wl); | 189 | wl12xx_queue_recovery_work(wl); |
164 | return ret; | 190 | return ret; |
165 | } | 191 | } |
@@ -1412,6 +1438,7 @@ int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid) | |||
1412 | { | 1438 | { |
1413 | struct wl12xx_cmd_remove_peer *cmd; | 1439 | struct wl12xx_cmd_remove_peer *cmd; |
1414 | int ret; | 1440 | int ret; |
1441 | bool timeout = false; | ||
1415 | 1442 | ||
1416 | wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid); | 1443 | wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid); |
1417 | 1444 | ||
@@ -1432,12 +1459,16 @@ int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid) | |||
1432 | goto out_free; | 1459 | goto out_free; |
1433 | } | 1460 | } |
1434 | 1461 | ||
1462 | ret = wl1271_cmd_wait_for_event_or_timeout(wl, | ||
1463 | PEER_REMOVE_COMPLETE_EVENT_ID, | ||
1464 | &timeout); | ||
1435 | /* | 1465 | /* |
1436 | * We are ok with a timeout here. The event is sometimes not sent | 1466 | * We are ok with a timeout here. The event is sometimes not sent |
1437 | * due to a firmware bug. | 1467 | * due to a firmware bug. In case of another error (like SDIO timeout) |
1468 | * queue a recovery. | ||
1438 | */ | 1469 | */ |
1439 | wl1271_cmd_wait_for_event_or_timeout(wl, | 1470 | if (ret) |
1440 | PEER_REMOVE_COMPLETE_EVENT_ID); | 1471 | wl12xx_queue_recovery_work(wl); |
1441 | 1472 | ||
1442 | out_free: | 1473 | out_free: |
1443 | kfree(cmd); | 1474 | kfree(cmd); |
@@ -1754,7 +1785,9 @@ int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif) | |||
1754 | return -EINVAL; | 1785 | return -EINVAL; |
1755 | 1786 | ||
1756 | /* flush all pending packets */ | 1787 | /* flush all pending packets */ |
1757 | wl1271_tx_work_locked(wl); | 1788 | ret = wlcore_tx_work_locked(wl); |
1789 | if (ret < 0) | ||
1790 | goto out; | ||
1758 | 1791 | ||
1759 | if (test_bit(wlvif->dev_role_id, wl->roc_map)) { | 1792 | if (test_bit(wlvif->dev_role_id, wl->roc_map)) { |
1760 | ret = wl12xx_croc(wl, wlvif->dev_role_id); | 1793 | ret = wl12xx_croc(wl, wlvif->dev_role_id); |
diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h index 85171f2bf68e..c8a6510c72cb 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.h +++ b/drivers/net/wireless/ti/wlcore/cmd.h | |||
@@ -652,4 +652,25 @@ struct wl12xx_cmd_stop_channel_switch { | |||
652 | struct wl1271_cmd_header header; | 652 | struct wl1271_cmd_header header; |
653 | } __packed; | 653 | } __packed; |
654 | 654 | ||
655 | /* Used to check radio status after calibration */ | ||
656 | #define MAX_TLV_LENGTH 500 | ||
657 | #define TEST_CMD_P2G_CAL 2 /* TX BiP */ | ||
658 | |||
659 | struct wl1271_cmd_cal_p2g { | ||
660 | struct wl1271_cmd_header header; | ||
661 | |||
662 | struct wl1271_cmd_test_header test; | ||
663 | |||
664 | __le32 ver; | ||
665 | __le16 len; | ||
666 | u8 buf[MAX_TLV_LENGTH]; | ||
667 | u8 type; | ||
668 | u8 padding; | ||
669 | |||
670 | __le16 radio_status; | ||
671 | |||
672 | u8 sub_band_mask; | ||
673 | u8 padding2; | ||
674 | } __packed; | ||
675 | |||
655 | #endif /* __WL1271_CMD_H__ */ | 676 | #endif /* __WL1271_CMD_H__ */ |
diff --git a/drivers/net/wireless/ti/wlcore/conf.h b/drivers/net/wireless/ti/wlcore/conf.h index 03c635872335..d77224f2ac6b 100644 --- a/drivers/net/wireless/ti/wlcore/conf.h +++ b/drivers/net/wireless/ti/wlcore/conf.h | |||
@@ -951,6 +951,12 @@ struct conf_conn_settings { | |||
951 | * Range: u16 | 951 | * Range: u16 |
952 | */ | 952 | */ |
953 | u8 max_listen_interval; | 953 | u8 max_listen_interval; |
954 | |||
955 | /* | ||
956 | * Default sleep authorization for a new STA interface. This determines | ||
957 | * whether we can go to ELP. | ||
958 | */ | ||
959 | u8 sta_sleep_auth; | ||
954 | } __packed; | 960 | } __packed; |
955 | 961 | ||
956 | enum { | 962 | enum { |
@@ -1276,7 +1282,7 @@ struct conf_hangover_settings { | |||
1276 | * version, the two LSB are the lower driver's private conf | 1282 | * version, the two LSB are the lower driver's private conf |
1277 | * version. | 1283 | * version. |
1278 | */ | 1284 | */ |
1279 | #define WLCORE_CONF_VERSION (0x0001 << 16) | 1285 | #define WLCORE_CONF_VERSION (0x0002 << 16) |
1280 | #define WLCORE_CONF_MASK 0xffff0000 | 1286 | #define WLCORE_CONF_MASK 0xffff0000 |
1281 | #define WLCORE_CONF_SIZE (sizeof(struct wlcore_conf_header) + \ | 1287 | #define WLCORE_CONF_SIZE (sizeof(struct wlcore_conf_header) + \ |
1282 | sizeof(struct wlcore_conf)) | 1288 | sizeof(struct wlcore_conf)) |
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c index 689a847005c9..80dbc5304fac 100644 --- a/drivers/net/wireless/ti/wlcore/debugfs.c +++ b/drivers/net/wireless/ti/wlcore/debugfs.c | |||
@@ -38,6 +38,8 @@ | |||
38 | /* ms */ | 38 | /* ms */ |
39 | #define WL1271_DEBUGFS_STATS_LIFETIME 1000 | 39 | #define WL1271_DEBUGFS_STATS_LIFETIME 1000 |
40 | 40 | ||
41 | #define WLCORE_MAX_BLOCK_SIZE ((size_t)(4*PAGE_SIZE)) | ||
42 | |||
41 | /* debugfs macros idea from mac80211 */ | 43 | /* debugfs macros idea from mac80211 */ |
42 | int wl1271_format_buffer(char __user *userbuf, size_t count, | 44 | int wl1271_format_buffer(char __user *userbuf, size_t count, |
43 | loff_t *ppos, char *fmt, ...) | 45 | loff_t *ppos, char *fmt, ...) |
@@ -963,6 +965,257 @@ static const struct file_operations fw_stats_raw_ops = { | |||
963 | .llseek = default_llseek, | 965 | .llseek = default_llseek, |
964 | }; | 966 | }; |
965 | 967 | ||
968 | static ssize_t sleep_auth_read(struct file *file, char __user *user_buf, | ||
969 | size_t count, loff_t *ppos) | ||
970 | { | ||
971 | struct wl1271 *wl = file->private_data; | ||
972 | |||
973 | return wl1271_format_buffer(user_buf, count, | ||
974 | ppos, "%d\n", | ||
975 | wl->sleep_auth); | ||
976 | } | ||
977 | |||
978 | static ssize_t sleep_auth_write(struct file *file, | ||
979 | const char __user *user_buf, | ||
980 | size_t count, loff_t *ppos) | ||
981 | { | ||
982 | struct wl1271 *wl = file->private_data; | ||
983 | unsigned long value; | ||
984 | int ret; | ||
985 | |||
986 | ret = kstrtoul_from_user(user_buf, count, 0, &value); | ||
987 | if (ret < 0) { | ||
988 | wl1271_warning("illegal value in sleep_auth"); | ||
989 | return -EINVAL; | ||
990 | } | ||
991 | |||
992 | if (value < 0 || value > WL1271_PSM_MAX) { | ||
993 | wl1271_warning("sleep_auth must be between 0 and %d", | ||
994 | WL1271_PSM_MAX); | ||
995 | return -ERANGE; | ||
996 | } | ||
997 | |||
998 | mutex_lock(&wl->mutex); | ||
999 | |||
1000 | wl->conf.conn.sta_sleep_auth = value; | ||
1001 | |||
1002 | if (wl->state == WL1271_STATE_OFF) { | ||
1003 | /* this will show up on "read" in case we are off */ | ||
1004 | wl->sleep_auth = value; | ||
1005 | goto out; | ||
1006 | } | ||
1007 | |||
1008 | ret = wl1271_ps_elp_wakeup(wl); | ||
1009 | if (ret < 0) | ||
1010 | goto out; | ||
1011 | |||
1012 | ret = wl1271_acx_sleep_auth(wl, value); | ||
1013 | if (ret < 0) | ||
1014 | goto out_sleep; | ||
1015 | |||
1016 | out_sleep: | ||
1017 | wl1271_ps_elp_sleep(wl); | ||
1018 | out: | ||
1019 | mutex_unlock(&wl->mutex); | ||
1020 | return count; | ||
1021 | } | ||
1022 | |||
1023 | static const struct file_operations sleep_auth_ops = { | ||
1024 | .read = sleep_auth_read, | ||
1025 | .write = sleep_auth_write, | ||
1026 | .open = simple_open, | ||
1027 | .llseek = default_llseek, | ||
1028 | }; | ||
1029 | |||
1030 | static ssize_t dev_mem_read(struct file *file, | ||
1031 | char __user *user_buf, size_t count, | ||
1032 | loff_t *ppos) | ||
1033 | { | ||
1034 | struct wl1271 *wl = file->private_data; | ||
1035 | struct wlcore_partition_set part, old_part; | ||
1036 | size_t bytes = count; | ||
1037 | int ret; | ||
1038 | char *buf; | ||
1039 | |||
1040 | /* only requests of dword-aligned size and offset are supported */ | ||
1041 | if (bytes % 4) | ||
1042 | return -EINVAL; | ||
1043 | |||
1044 | if (*ppos % 4) | ||
1045 | return -EINVAL; | ||
1046 | |||
1047 | /* function should return in reasonable time */ | ||
1048 | bytes = min(bytes, WLCORE_MAX_BLOCK_SIZE); | ||
1049 | |||
1050 | if (bytes == 0) | ||
1051 | return -EINVAL; | ||
1052 | |||
1053 | memset(&part, 0, sizeof(part)); | ||
1054 | part.mem.start = file->f_pos; | ||
1055 | part.mem.size = bytes; | ||
1056 | |||
1057 | buf = kmalloc(bytes, GFP_KERNEL); | ||
1058 | if (!buf) | ||
1059 | return -ENOMEM; | ||
1060 | |||
1061 | mutex_lock(&wl->mutex); | ||
1062 | |||
1063 | if (wl->state == WL1271_STATE_OFF) { | ||
1064 | ret = -EFAULT; | ||
1065 | goto skip_read; | ||
1066 | } | ||
1067 | |||
1068 | ret = wl1271_ps_elp_wakeup(wl); | ||
1069 | if (ret < 0) | ||
1070 | goto skip_read; | ||
1071 | |||
1072 | /* store current partition and switch partition */ | ||
1073 | memcpy(&old_part, &wl->curr_part, sizeof(old_part)); | ||
1074 | ret = wlcore_set_partition(wl, &part); | ||
1075 | if (ret < 0) | ||
1076 | goto part_err; | ||
1077 | |||
1078 | ret = wlcore_raw_read(wl, 0, buf, bytes, false); | ||
1079 | if (ret < 0) | ||
1080 | goto read_err; | ||
1081 | |||
1082 | read_err: | ||
1083 | /* recover partition */ | ||
1084 | ret = wlcore_set_partition(wl, &old_part); | ||
1085 | if (ret < 0) | ||
1086 | goto part_err; | ||
1087 | |||
1088 | part_err: | ||
1089 | wl1271_ps_elp_sleep(wl); | ||
1090 | |||
1091 | skip_read: | ||
1092 | mutex_unlock(&wl->mutex); | ||
1093 | |||
1094 | if (ret == 0) { | ||
1095 | ret = copy_to_user(user_buf, buf, bytes); | ||
1096 | if (ret < bytes) { | ||
1097 | bytes -= ret; | ||
1098 | *ppos += bytes; | ||
1099 | ret = 0; | ||
1100 | } else { | ||
1101 | ret = -EFAULT; | ||
1102 | } | ||
1103 | } | ||
1104 | |||
1105 | kfree(buf); | ||
1106 | |||
1107 | return ((ret == 0) ? bytes : ret); | ||
1108 | } | ||
1109 | |||
1110 | static ssize_t dev_mem_write(struct file *file, const char __user *user_buf, | ||
1111 | size_t count, loff_t *ppos) | ||
1112 | { | ||
1113 | struct wl1271 *wl = file->private_data; | ||
1114 | struct wlcore_partition_set part, old_part; | ||
1115 | size_t bytes = count; | ||
1116 | int ret; | ||
1117 | char *buf; | ||
1118 | |||
1119 | /* only requests of dword-aligned size and offset are supported */ | ||
1120 | if (bytes % 4) | ||
1121 | return -EINVAL; | ||
1122 | |||
1123 | if (*ppos % 4) | ||
1124 | return -EINVAL; | ||
1125 | |||
1126 | /* function should return in reasonable time */ | ||
1127 | bytes = min(bytes, WLCORE_MAX_BLOCK_SIZE); | ||
1128 | |||
1129 | if (bytes == 0) | ||
1130 | return -EINVAL; | ||
1131 | |||
1132 | memset(&part, 0, sizeof(part)); | ||
1133 | part.mem.start = file->f_pos; | ||
1134 | part.mem.size = bytes; | ||
1135 | |||
1136 | buf = kmalloc(bytes, GFP_KERNEL); | ||
1137 | if (!buf) | ||
1138 | return -ENOMEM; | ||
1139 | |||
1140 | ret = copy_from_user(buf, user_buf, bytes); | ||
1141 | if (ret) { | ||
1142 | ret = -EFAULT; | ||
1143 | goto err_out; | ||
1144 | } | ||
1145 | |||
1146 | mutex_lock(&wl->mutex); | ||
1147 | |||
1148 | if (wl->state == WL1271_STATE_OFF) { | ||
1149 | ret = -EFAULT; | ||
1150 | goto skip_write; | ||
1151 | } | ||
1152 | |||
1153 | ret = wl1271_ps_elp_wakeup(wl); | ||
1154 | if (ret < 0) | ||
1155 | goto skip_write; | ||
1156 | |||
1157 | /* store current partition and switch partition */ | ||
1158 | memcpy(&old_part, &wl->curr_part, sizeof(old_part)); | ||
1159 | ret = wlcore_set_partition(wl, &part); | ||
1160 | if (ret < 0) | ||
1161 | goto part_err; | ||
1162 | |||
1163 | ret = wlcore_raw_write(wl, 0, buf, bytes, false); | ||
1164 | if (ret < 0) | ||
1165 | goto write_err; | ||
1166 | |||
1167 | write_err: | ||
1168 | /* recover partition */ | ||
1169 | ret = wlcore_set_partition(wl, &old_part); | ||
1170 | if (ret < 0) | ||
1171 | goto part_err; | ||
1172 | |||
1173 | part_err: | ||
1174 | wl1271_ps_elp_sleep(wl); | ||
1175 | |||
1176 | skip_write: | ||
1177 | mutex_unlock(&wl->mutex); | ||
1178 | |||
1179 | if (ret == 0) | ||
1180 | *ppos += bytes; | ||
1181 | |||
1182 | err_out: | ||
1183 | kfree(buf); | ||
1184 | |||
1185 | return ((ret == 0) ? bytes : ret); | ||
1186 | } | ||
1187 | |||
1188 | static loff_t dev_mem_seek(struct file *file, loff_t offset, int orig) | ||
1189 | { | ||
1190 | loff_t ret; | ||
1191 | |||
1192 | /* only requests of dword-aligned size and offset are supported */ | ||
1193 | if (offset % 4) | ||
1194 | return -EINVAL; | ||
1195 | |||
1196 | switch (orig) { | ||
1197 | case SEEK_SET: | ||
1198 | file->f_pos = offset; | ||
1199 | ret = file->f_pos; | ||
1200 | break; | ||
1201 | case SEEK_CUR: | ||
1202 | file->f_pos += offset; | ||
1203 | ret = file->f_pos; | ||
1204 | break; | ||
1205 | default: | ||
1206 | ret = -EINVAL; | ||
1207 | } | ||
1208 | |||
1209 | return ret; | ||
1210 | } | ||
1211 | |||
1212 | static const struct file_operations dev_mem_ops = { | ||
1213 | .open = simple_open, | ||
1214 | .read = dev_mem_read, | ||
1215 | .write = dev_mem_write, | ||
1216 | .llseek = dev_mem_seek, | ||
1217 | }; | ||
1218 | |||
966 | static int wl1271_debugfs_add_files(struct wl1271 *wl, | 1219 | static int wl1271_debugfs_add_files(struct wl1271 *wl, |
967 | struct dentry *rootdir) | 1220 | struct dentry *rootdir) |
968 | { | 1221 | { |
@@ -988,6 +1241,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl, | |||
988 | DEBUGFS_ADD(irq_blk_threshold, rootdir); | 1241 | DEBUGFS_ADD(irq_blk_threshold, rootdir); |
989 | DEBUGFS_ADD(irq_timeout, rootdir); | 1242 | DEBUGFS_ADD(irq_timeout, rootdir); |
990 | DEBUGFS_ADD(fw_stats_raw, rootdir); | 1243 | DEBUGFS_ADD(fw_stats_raw, rootdir); |
1244 | DEBUGFS_ADD(sleep_auth, rootdir); | ||
991 | 1245 | ||
992 | streaming = debugfs_create_dir("rx_streaming", rootdir); | 1246 | streaming = debugfs_create_dir("rx_streaming", rootdir); |
993 | if (!streaming || IS_ERR(streaming)) | 1247 | if (!streaming || IS_ERR(streaming)) |
@@ -996,6 +1250,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl, | |||
996 | DEBUGFS_ADD_PREFIX(rx_streaming, interval, streaming); | 1250 | DEBUGFS_ADD_PREFIX(rx_streaming, interval, streaming); |
997 | DEBUGFS_ADD_PREFIX(rx_streaming, always, streaming); | 1251 | DEBUGFS_ADD_PREFIX(rx_streaming, always, streaming); |
998 | 1252 | ||
1253 | DEBUGFS_ADD_PREFIX(dev, mem, rootdir); | ||
999 | 1254 | ||
1000 | return 0; | 1255 | return 0; |
1001 | 1256 | ||
diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c index c976f0409865..48907054d493 100644 --- a/drivers/net/wireless/ti/wlcore/event.c +++ b/drivers/net/wireless/ti/wlcore/event.c | |||
@@ -105,6 +105,7 @@ static int wl1271_event_process(struct wl1271 *wl) | |||
105 | u32 vector; | 105 | u32 vector; |
106 | bool disconnect_sta = false; | 106 | bool disconnect_sta = false; |
107 | unsigned long sta_bitmap = 0; | 107 | unsigned long sta_bitmap = 0; |
108 | int ret; | ||
108 | 109 | ||
109 | wl1271_event_mbox_dump(mbox); | 110 | wl1271_event_mbox_dump(mbox); |
110 | 111 | ||
@@ -228,7 +229,9 @@ static int wl1271_event_process(struct wl1271 *wl) | |||
228 | 229 | ||
229 | if ((vector & DUMMY_PACKET_EVENT_ID)) { | 230 | if ((vector & DUMMY_PACKET_EVENT_ID)) { |
230 | wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); | 231 | wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); |
231 | wl1271_tx_dummy_packet(wl); | 232 | ret = wl1271_tx_dummy_packet(wl); |
233 | if (ret < 0) | ||
234 | return ret; | ||
232 | } | 235 | } |
233 | 236 | ||
234 | /* | 237 | /* |
@@ -301,8 +304,10 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) | |||
301 | return -EINVAL; | 304 | return -EINVAL; |
302 | 305 | ||
303 | /* first we read the mbox descriptor */ | 306 | /* first we read the mbox descriptor */ |
304 | wl1271_read(wl, wl->mbox_ptr[mbox_num], wl->mbox, | 307 | ret = wlcore_read(wl, wl->mbox_ptr[mbox_num], wl->mbox, |
305 | sizeof(*wl->mbox), false); | 308 | sizeof(*wl->mbox), false); |
309 | if (ret < 0) | ||
310 | return ret; | ||
306 | 311 | ||
307 | /* process the descriptor */ | 312 | /* process the descriptor */ |
308 | ret = wl1271_event_process(wl); | 313 | ret = wl1271_event_process(wl); |
@@ -313,7 +318,7 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) | |||
313 | * TODO: we just need this because one bit is in a different | 318 | * TODO: we just need this because one bit is in a different |
314 | * place. Is there any better way? | 319 | * place. Is there any better way? |
315 | */ | 320 | */ |
316 | wl->ops->ack_event(wl); | 321 | ret = wl->ops->ack_event(wl); |
317 | 322 | ||
318 | return 0; | 323 | return ret; |
319 | } | 324 | } |
diff --git a/drivers/net/wireless/ti/wlcore/hw_ops.h b/drivers/net/wireless/ti/wlcore/hw_ops.h index 9e7787ba9610..2673d783ec1e 100644 --- a/drivers/net/wireless/ti/wlcore/hw_ops.h +++ b/drivers/net/wireless/ti/wlcore/hw_ops.h | |||
@@ -65,11 +65,13 @@ wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) | |||
65 | return wl->ops->get_rx_buf_align(wl, rx_desc); | 65 | return wl->ops->get_rx_buf_align(wl, rx_desc); |
66 | } | 66 | } |
67 | 67 | ||
68 | static inline void | 68 | static inline int |
69 | wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) | 69 | wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) |
70 | { | 70 | { |
71 | if (wl->ops->prepare_read) | 71 | if (wl->ops->prepare_read) |
72 | wl->ops->prepare_read(wl, rx_desc, len); | 72 | return wl->ops->prepare_read(wl, rx_desc, len); |
73 | |||
74 | return 0; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | static inline u32 | 77 | static inline u32 |
@@ -81,10 +83,12 @@ wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len) | |||
81 | return wl->ops->get_rx_packet_len(wl, rx_data, data_len); | 83 | return wl->ops->get_rx_packet_len(wl, rx_data, data_len); |
82 | } | 84 | } |
83 | 85 | ||
84 | static inline void wlcore_hw_tx_delayed_compl(struct wl1271 *wl) | 86 | static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl) |
85 | { | 87 | { |
86 | if (wl->ops->tx_delayed_compl) | 88 | if (wl->ops->tx_delayed_compl) |
87 | wl->ops->tx_delayed_compl(wl); | 89 | return wl->ops->tx_delayed_compl(wl); |
90 | |||
91 | return 0; | ||
88 | } | 92 | } |
89 | 93 | ||
90 | static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl) | 94 | static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl) |
diff --git a/drivers/net/wireless/ti/wlcore/ini.h b/drivers/net/wireless/ti/wlcore/ini.h index 4cf9ecc56212..d24fe3bbc672 100644 --- a/drivers/net/wireless/ti/wlcore/ini.h +++ b/drivers/net/wireless/ti/wlcore/ini.h | |||
@@ -172,7 +172,19 @@ struct wl128x_ini_fem_params_5 { | |||
172 | 172 | ||
173 | /* NVS data structure */ | 173 | /* NVS data structure */ |
174 | #define WL1271_INI_NVS_SECTION_SIZE 468 | 174 | #define WL1271_INI_NVS_SECTION_SIZE 468 |
175 | #define WL1271_INI_FEM_MODULE_COUNT 2 | 175 | |
176 | /* We have four FEM module types: 0-RFMD, 1-TQS, 2-SKW, 3-TQS_HP */ | ||
177 | #define WL1271_INI_FEM_MODULE_COUNT 4 | ||
178 | |||
179 | /* | ||
180 | * In NVS we only store two FEM module entries - | ||
181 | * FEM modules 0,2,3 are stored in entry 0 | ||
182 | * FEM module 1 is stored in entry 1 | ||
183 | */ | ||
184 | #define WL12XX_NVS_FEM_MODULE_COUNT 2 | ||
185 | |||
186 | #define WL12XX_FEM_TO_NVS_ENTRY(ini_fem_module) \ | ||
187 | ((ini_fem_module) == 1 ? 1 : 0) | ||
176 | 188 | ||
177 | #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800 | 189 | #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800 |
178 | 190 | ||
@@ -188,13 +200,13 @@ struct wl1271_nvs_file { | |||
188 | struct { | 200 | struct { |
189 | struct wl1271_ini_fem_params_2 params; | 201 | struct wl1271_ini_fem_params_2 params; |
190 | u8 padding; | 202 | u8 padding; |
191 | } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; | 203 | } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; |
192 | struct wl1271_ini_band_params_5 stat_radio_params_5; | 204 | struct wl1271_ini_band_params_5 stat_radio_params_5; |
193 | u8 padding3; | 205 | u8 padding3; |
194 | struct { | 206 | struct { |
195 | struct wl1271_ini_fem_params_5 params; | 207 | struct wl1271_ini_fem_params_5 params; |
196 | u8 padding; | 208 | u8 padding; |
197 | } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT]; | 209 | } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; |
198 | } __packed; | 210 | } __packed; |
199 | 211 | ||
200 | struct wl128x_nvs_file { | 212 | struct wl128x_nvs_file { |
@@ -209,12 +221,12 @@ struct wl128x_nvs_file { | |||
209 | struct { | 221 | struct { |
210 | struct wl128x_ini_fem_params_2 params; | 222 | struct wl128x_ini_fem_params_2 params; |
211 | u8 padding; | 223 | u8 padding; |
212 | } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; | 224 | } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; |
213 | struct wl128x_ini_band_params_5 stat_radio_params_5; | 225 | struct wl128x_ini_band_params_5 stat_radio_params_5; |
214 | u8 padding3; | 226 | u8 padding3; |
215 | struct { | 227 | struct { |
216 | struct wl128x_ini_fem_params_5 params; | 228 | struct wl128x_ini_fem_params_5 params; |
217 | u8 padding; | 229 | u8 padding; |
218 | } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT]; | 230 | } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; |
219 | } __packed; | 231 | } __packed; |
220 | #endif | 232 | #endif |
diff --git a/drivers/net/wireless/ti/wlcore/init.c b/drivers/net/wireless/ti/wlcore/init.c index 645abd4b660d..8a8a8971befa 100644 --- a/drivers/net/wireless/ti/wlcore/init.c +++ b/drivers/net/wireless/ti/wlcore/init.c | |||
@@ -554,29 +554,28 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) | |||
554 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); | 554 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
555 | int ret, i; | 555 | int ret, i; |
556 | 556 | ||
557 | /* | 557 | /* consider all existing roles before configuring psm. */ |
558 | * consider all existing roles before configuring psm. | 558 | |
559 | * TODO: reconfigure on interface removal. | 559 | if (wl->ap_count == 0 && is_ap) { /* first AP */ |
560 | */ | 560 | /* Configure for power always on */ |
561 | if (!wl->ap_count) { | 561 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); |
562 | if (is_ap) { | 562 | if (ret < 0) |
563 | /* Configure for power always on */ | 563 | return ret; |
564 | /* first STA, no APs */ | ||
565 | } else if (wl->sta_count == 0 && wl->ap_count == 0 && !is_ap) { | ||
566 | u8 sta_auth = wl->conf.conn.sta_sleep_auth; | ||
567 | /* Configure for power according to debugfs */ | ||
568 | if (sta_auth != WL1271_PSM_ILLEGAL) | ||
569 | ret = wl1271_acx_sleep_auth(wl, sta_auth); | ||
570 | /* Configure for power always on */ | ||
571 | else if (wl->quirks & WLCORE_QUIRK_NO_ELP) | ||
564 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); | 572 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); |
565 | if (ret < 0) | 573 | /* Configure for ELP power saving */ |
566 | return ret; | 574 | else |
567 | } else if (!wl->sta_count) { | 575 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); |
568 | if (wl->quirks & WLCORE_QUIRK_NO_ELP) { | 576 | |
569 | /* Configure for power always on */ | 577 | if (ret < 0) |
570 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); | 578 | return ret; |
571 | if (ret < 0) | ||
572 | return ret; | ||
573 | } else { | ||
574 | /* Configure for ELP power saving */ | ||
575 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); | ||
576 | if (ret < 0) | ||
577 | return ret; | ||
578 | } | ||
579 | } | ||
580 | } | 579 | } |
581 | 580 | ||
582 | /* Mode specific init */ | 581 | /* Mode specific init */ |
diff --git a/drivers/net/wireless/ti/wlcore/io.c b/drivers/net/wireless/ti/wlcore/io.c index 7cd0081aede5..9976219c4e49 100644 --- a/drivers/net/wireless/ti/wlcore/io.c +++ b/drivers/net/wireless/ti/wlcore/io.c | |||
@@ -48,6 +48,12 @@ void wlcore_disable_interrupts(struct wl1271 *wl) | |||
48 | } | 48 | } |
49 | EXPORT_SYMBOL_GPL(wlcore_disable_interrupts); | 49 | EXPORT_SYMBOL_GPL(wlcore_disable_interrupts); |
50 | 50 | ||
51 | void wlcore_disable_interrupts_nosync(struct wl1271 *wl) | ||
52 | { | ||
53 | disable_irq_nosync(wl->irq); | ||
54 | } | ||
55 | EXPORT_SYMBOL_GPL(wlcore_disable_interrupts_nosync); | ||
56 | |||
51 | void wlcore_enable_interrupts(struct wl1271 *wl) | 57 | void wlcore_enable_interrupts(struct wl1271 *wl) |
52 | { | 58 | { |
53 | enable_irq(wl->irq); | 59 | enable_irq(wl->irq); |
@@ -122,9 +128,11 @@ EXPORT_SYMBOL_GPL(wlcore_translate_addr); | |||
122 | * | | | 128 | * | | |
123 | * | 129 | * |
124 | */ | 130 | */ |
125 | void wlcore_set_partition(struct wl1271 *wl, | 131 | int wlcore_set_partition(struct wl1271 *wl, |
126 | const struct wlcore_partition_set *p) | 132 | const struct wlcore_partition_set *p) |
127 | { | 133 | { |
134 | int ret; | ||
135 | |||
128 | /* copy partition info */ | 136 | /* copy partition info */ |
129 | memcpy(&wl->curr_part, p, sizeof(*p)); | 137 | memcpy(&wl->curr_part, p, sizeof(*p)); |
130 | 138 | ||
@@ -137,28 +145,41 @@ void wlcore_set_partition(struct wl1271 *wl, | |||
137 | wl1271_debug(DEBUG_IO, "mem3_start %08X mem3_size %08X", | 145 | wl1271_debug(DEBUG_IO, "mem3_start %08X mem3_size %08X", |
138 | p->mem3.start, p->mem3.size); | 146 | p->mem3.start, p->mem3.size); |
139 | 147 | ||
140 | wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); | 148 | ret = wlcore_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); |
141 | wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); | 149 | if (ret < 0) |
142 | wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); | 150 | goto out; |
143 | wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); | 151 | |
144 | wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); | 152 | ret = wlcore_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); |
145 | wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); | 153 | if (ret < 0) |
154 | goto out; | ||
155 | |||
156 | ret = wlcore_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); | ||
157 | if (ret < 0) | ||
158 | goto out; | ||
159 | |||
160 | ret = wlcore_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); | ||
161 | if (ret < 0) | ||
162 | goto out; | ||
163 | |||
164 | ret = wlcore_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); | ||
165 | if (ret < 0) | ||
166 | goto out; | ||
167 | |||
168 | ret = wlcore_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); | ||
169 | if (ret < 0) | ||
170 | goto out; | ||
171 | |||
146 | /* | 172 | /* |
147 | * We don't need the size of the last partition, as it is | 173 | * We don't need the size of the last partition, as it is |
148 | * automatically calculated based on the total memory size and | 174 | * automatically calculated based on the total memory size and |
149 | * the sizes of the previous partitions. | 175 | * the sizes of the previous partitions. |
150 | */ | 176 | */ |
151 | wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); | 177 | ret = wlcore_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); |
152 | } | ||
153 | EXPORT_SYMBOL_GPL(wlcore_set_partition); | ||
154 | 178 | ||
155 | void wlcore_select_partition(struct wl1271 *wl, u8 part) | 179 | out: |
156 | { | 180 | return ret; |
157 | wl1271_debug(DEBUG_IO, "setting partition %d", part); | ||
158 | |||
159 | wlcore_set_partition(wl, &wl->ptable[part]); | ||
160 | } | 181 | } |
161 | EXPORT_SYMBOL_GPL(wlcore_select_partition); | 182 | EXPORT_SYMBOL_GPL(wlcore_set_partition); |
162 | 183 | ||
163 | void wl1271_io_reset(struct wl1271 *wl) | 184 | void wl1271_io_reset(struct wl1271 *wl) |
164 | { | 185 | { |
diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h index 8942954b56a0..fef80adc8bf5 100644 --- a/drivers/net/wireless/ti/wlcore/io.h +++ b/drivers/net/wireless/ti/wlcore/io.h | |||
@@ -45,6 +45,7 @@ | |||
45 | struct wl1271; | 45 | struct wl1271; |
46 | 46 | ||
47 | void wlcore_disable_interrupts(struct wl1271 *wl); | 47 | void wlcore_disable_interrupts(struct wl1271 *wl); |
48 | void wlcore_disable_interrupts_nosync(struct wl1271 *wl); | ||
48 | void wlcore_enable_interrupts(struct wl1271 *wl); | 49 | void wlcore_enable_interrupts(struct wl1271 *wl); |
49 | 50 | ||
50 | void wl1271_io_reset(struct wl1271 *wl); | 51 | void wl1271_io_reset(struct wl1271 *wl); |
@@ -52,79 +53,113 @@ void wl1271_io_init(struct wl1271 *wl); | |||
52 | int wlcore_translate_addr(struct wl1271 *wl, int addr); | 53 | int wlcore_translate_addr(struct wl1271 *wl, int addr); |
53 | 54 | ||
54 | /* Raw target IO, address is not translated */ | 55 | /* Raw target IO, address is not translated */ |
55 | static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, | 56 | static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr, |
56 | size_t len, bool fixed) | 57 | void *buf, size_t len, |
58 | bool fixed) | ||
57 | { | 59 | { |
58 | wl->if_ops->write(wl->dev, addr, buf, len, fixed); | 60 | int ret; |
61 | |||
62 | if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags)) | ||
63 | return -EIO; | ||
64 | |||
65 | ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed); | ||
66 | if (ret) | ||
67 | set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags); | ||
68 | |||
69 | return ret; | ||
59 | } | 70 | } |
60 | 71 | ||
61 | static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, | 72 | static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr, |
62 | size_t len, bool fixed) | 73 | void *buf, size_t len, |
74 | bool fixed) | ||
63 | { | 75 | { |
64 | wl->if_ops->read(wl->dev, addr, buf, len, fixed); | 76 | int ret; |
77 | |||
78 | if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags)) | ||
79 | return -EIO; | ||
80 | |||
81 | ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed); | ||
82 | if (ret) | ||
83 | set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags); | ||
84 | |||
85 | return ret; | ||
65 | } | 86 | } |
66 | 87 | ||
67 | static inline void wlcore_raw_read_data(struct wl1271 *wl, int reg, void *buf, | 88 | static inline int __must_check wlcore_raw_read_data(struct wl1271 *wl, int reg, |
68 | size_t len, bool fixed) | 89 | void *buf, size_t len, |
90 | bool fixed) | ||
69 | { | 91 | { |
70 | wl1271_raw_read(wl, wl->rtable[reg], buf, len, fixed); | 92 | return wlcore_raw_read(wl, wl->rtable[reg], buf, len, fixed); |
71 | } | 93 | } |
72 | 94 | ||
73 | static inline void wlcore_raw_write_data(struct wl1271 *wl, int reg, void *buf, | 95 | static inline int __must_check wlcore_raw_write_data(struct wl1271 *wl, int reg, |
74 | size_t len, bool fixed) | 96 | void *buf, size_t len, |
97 | bool fixed) | ||
75 | { | 98 | { |
76 | wl1271_raw_write(wl, wl->rtable[reg], buf, len, fixed); | 99 | return wlcore_raw_write(wl, wl->rtable[reg], buf, len, fixed); |
77 | } | 100 | } |
78 | 101 | ||
79 | static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) | 102 | static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr, |
103 | u32 *val) | ||
80 | { | 104 | { |
81 | wl1271_raw_read(wl, addr, &wl->buffer_32, | 105 | int ret; |
82 | sizeof(wl->buffer_32), false); | 106 | |
107 | ret = wlcore_raw_read(wl, addr, &wl->buffer_32, | ||
108 | sizeof(wl->buffer_32), false); | ||
109 | if (ret < 0) | ||
110 | return ret; | ||
111 | |||
112 | if (val) | ||
113 | *val = le32_to_cpu(wl->buffer_32); | ||
83 | 114 | ||
84 | return le32_to_cpu(wl->buffer_32); | 115 | return 0; |
85 | } | 116 | } |
86 | 117 | ||
87 | static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) | 118 | static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr, |
119 | u32 val) | ||
88 | { | 120 | { |
89 | wl->buffer_32 = cpu_to_le32(val); | 121 | wl->buffer_32 = cpu_to_le32(val); |
90 | wl1271_raw_write(wl, addr, &wl->buffer_32, | 122 | return wlcore_raw_write(wl, addr, &wl->buffer_32, |
91 | sizeof(wl->buffer_32), false); | 123 | sizeof(wl->buffer_32), false); |
92 | } | 124 | } |
93 | 125 | ||
94 | static inline void wl1271_read(struct wl1271 *wl, int addr, void *buf, | 126 | static inline int __must_check wlcore_read(struct wl1271 *wl, int addr, |
95 | size_t len, bool fixed) | 127 | void *buf, size_t len, bool fixed) |
96 | { | 128 | { |
97 | int physical; | 129 | int physical; |
98 | 130 | ||
99 | physical = wlcore_translate_addr(wl, addr); | 131 | physical = wlcore_translate_addr(wl, addr); |
100 | 132 | ||
101 | wl1271_raw_read(wl, physical, buf, len, fixed); | 133 | return wlcore_raw_read(wl, physical, buf, len, fixed); |
102 | } | 134 | } |
103 | 135 | ||
104 | static inline void wl1271_write(struct wl1271 *wl, int addr, void *buf, | 136 | static inline int __must_check wlcore_write(struct wl1271 *wl, int addr, |
105 | size_t len, bool fixed) | 137 | void *buf, size_t len, bool fixed) |
106 | { | 138 | { |
107 | int physical; | 139 | int physical; |
108 | 140 | ||
109 | physical = wlcore_translate_addr(wl, addr); | 141 | physical = wlcore_translate_addr(wl, addr); |
110 | 142 | ||
111 | wl1271_raw_write(wl, physical, buf, len, fixed); | 143 | return wlcore_raw_write(wl, physical, buf, len, fixed); |
112 | } | 144 | } |
113 | 145 | ||
114 | static inline void wlcore_write_data(struct wl1271 *wl, int reg, void *buf, | 146 | static inline int __must_check wlcore_write_data(struct wl1271 *wl, int reg, |
115 | size_t len, bool fixed) | 147 | void *buf, size_t len, |
148 | bool fixed) | ||
116 | { | 149 | { |
117 | wl1271_write(wl, wl->rtable[reg], buf, len, fixed); | 150 | return wlcore_write(wl, wl->rtable[reg], buf, len, fixed); |
118 | } | 151 | } |
119 | 152 | ||
120 | static inline void wlcore_read_data(struct wl1271 *wl, int reg, void *buf, | 153 | static inline int __must_check wlcore_read_data(struct wl1271 *wl, int reg, |
121 | size_t len, bool fixed) | 154 | void *buf, size_t len, |
155 | bool fixed) | ||
122 | { | 156 | { |
123 | wl1271_read(wl, wl->rtable[reg], buf, len, fixed); | 157 | return wlcore_read(wl, wl->rtable[reg], buf, len, fixed); |
124 | } | 158 | } |
125 | 159 | ||
126 | static inline void wl1271_read_hwaddr(struct wl1271 *wl, int hwaddr, | 160 | static inline int __must_check wlcore_read_hwaddr(struct wl1271 *wl, int hwaddr, |
127 | void *buf, size_t len, bool fixed) | 161 | void *buf, size_t len, |
162 | bool fixed) | ||
128 | { | 163 | { |
129 | int physical; | 164 | int physical; |
130 | int addr; | 165 | int addr; |
@@ -134,34 +169,47 @@ static inline void wl1271_read_hwaddr(struct wl1271 *wl, int hwaddr, | |||
134 | 169 | ||
135 | physical = wlcore_translate_addr(wl, addr); | 170 | physical = wlcore_translate_addr(wl, addr); |
136 | 171 | ||
137 | wl1271_raw_read(wl, physical, buf, len, fixed); | 172 | return wlcore_raw_read(wl, physical, buf, len, fixed); |
138 | } | 173 | } |
139 | 174 | ||
140 | static inline u32 wl1271_read32(struct wl1271 *wl, int addr) | 175 | static inline int __must_check wlcore_read32(struct wl1271 *wl, int addr, |
176 | u32 *val) | ||
141 | { | 177 | { |
142 | return wl1271_raw_read32(wl, wlcore_translate_addr(wl, addr)); | 178 | return wlcore_raw_read32(wl, wlcore_translate_addr(wl, addr), val); |
143 | } | 179 | } |
144 | 180 | ||
145 | static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val) | 181 | static inline int __must_check wlcore_write32(struct wl1271 *wl, int addr, |
182 | u32 val) | ||
146 | { | 183 | { |
147 | wl1271_raw_write32(wl, wlcore_translate_addr(wl, addr), val); | 184 | return wlcore_raw_write32(wl, wlcore_translate_addr(wl, addr), val); |
148 | } | 185 | } |
149 | 186 | ||
150 | static inline u32 wlcore_read_reg(struct wl1271 *wl, int reg) | 187 | static inline int __must_check wlcore_read_reg(struct wl1271 *wl, int reg, |
188 | u32 *val) | ||
151 | { | 189 | { |
152 | return wl1271_raw_read32(wl, | 190 | return wlcore_raw_read32(wl, |
153 | wlcore_translate_addr(wl, wl->rtable[reg])); | 191 | wlcore_translate_addr(wl, wl->rtable[reg]), |
192 | val); | ||
154 | } | 193 | } |
155 | 194 | ||
156 | static inline void wlcore_write_reg(struct wl1271 *wl, int reg, u32 val) | 195 | static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg, |
196 | u32 val) | ||
157 | { | 197 | { |
158 | wl1271_raw_write32(wl, wlcore_translate_addr(wl, wl->rtable[reg]), val); | 198 | return wlcore_raw_write32(wl, |
199 | wlcore_translate_addr(wl, wl->rtable[reg]), | ||
200 | val); | ||
159 | } | 201 | } |
160 | 202 | ||
161 | static inline void wl1271_power_off(struct wl1271 *wl) | 203 | static inline void wl1271_power_off(struct wl1271 *wl) |
162 | { | 204 | { |
163 | wl->if_ops->power(wl->dev, false); | 205 | int ret; |
164 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | 206 | |
207 | if (!test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags)) | ||
208 | return; | ||
209 | |||
210 | ret = wl->if_ops->power(wl->dev, false); | ||
211 | if (!ret) | ||
212 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
165 | } | 213 | } |
166 | 214 | ||
167 | static inline int wl1271_power_on(struct wl1271 *wl) | 215 | static inline int wl1271_power_on(struct wl1271 *wl) |
@@ -173,8 +221,8 @@ static inline int wl1271_power_on(struct wl1271 *wl) | |||
173 | return ret; | 221 | return ret; |
174 | } | 222 | } |
175 | 223 | ||
176 | void wlcore_set_partition(struct wl1271 *wl, | 224 | int wlcore_set_partition(struct wl1271 *wl, |
177 | const struct wlcore_partition_set *p); | 225 | const struct wlcore_partition_set *p); |
178 | 226 | ||
179 | bool wl1271_set_block_size(struct wl1271 *wl); | 227 | bool wl1271_set_block_size(struct wl1271 *wl); |
180 | 228 | ||
@@ -182,6 +230,4 @@ bool wl1271_set_block_size(struct wl1271 *wl); | |||
182 | 230 | ||
183 | int wl1271_tx_dummy_packet(struct wl1271 *wl); | 231 | int wl1271_tx_dummy_packet(struct wl1271 *wl); |
184 | 232 | ||
185 | void wlcore_select_partition(struct wl1271 *wl, u8 part); | ||
186 | |||
187 | #endif | 233 | #endif |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 1156e3f578c1..2240cca597ac 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -378,9 +378,9 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl, | |||
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | static void wl12xx_fw_status(struct wl1271 *wl, | 381 | static int wlcore_fw_status(struct wl1271 *wl, |
382 | struct wl_fw_status_1 *status_1, | 382 | struct wl_fw_status_1 *status_1, |
383 | struct wl_fw_status_2 *status_2) | 383 | struct wl_fw_status_2 *status_2) |
384 | { | 384 | { |
385 | struct wl12xx_vif *wlvif; | 385 | struct wl12xx_vif *wlvif; |
386 | struct timespec ts; | 386 | struct timespec ts; |
@@ -388,12 +388,15 @@ static void wl12xx_fw_status(struct wl1271 *wl, | |||
388 | int avail, freed_blocks; | 388 | int avail, freed_blocks; |
389 | int i; | 389 | int i; |
390 | size_t status_len; | 390 | size_t status_len; |
391 | int ret; | ||
391 | 392 | ||
392 | status_len = WLCORE_FW_STATUS_1_LEN(wl->num_rx_desc) + | 393 | status_len = WLCORE_FW_STATUS_1_LEN(wl->num_rx_desc) + |
393 | sizeof(*status_2) + wl->fw_status_priv_len; | 394 | sizeof(*status_2) + wl->fw_status_priv_len; |
394 | 395 | ||
395 | wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status_1, | 396 | ret = wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status_1, |
396 | status_len, false); | 397 | status_len, false); |
398 | if (ret < 0) | ||
399 | return ret; | ||
397 | 400 | ||
398 | wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " | 401 | wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " |
399 | "drv_rx_counter = %d, tx_results_counter = %d)", | 402 | "drv_rx_counter = %d, tx_results_counter = %d)", |
@@ -462,6 +465,8 @@ static void wl12xx_fw_status(struct wl1271 *wl, | |||
462 | getnstimeofday(&ts); | 465 | getnstimeofday(&ts); |
463 | wl->time_offset = (timespec_to_ns(&ts) >> 10) - | 466 | wl->time_offset = (timespec_to_ns(&ts) >> 10) - |
464 | (s64)le32_to_cpu(status_2->fw_localtime); | 467 | (s64)le32_to_cpu(status_2->fw_localtime); |
468 | |||
469 | return 0; | ||
465 | } | 470 | } |
466 | 471 | ||
467 | static void wl1271_flush_deferred_work(struct wl1271 *wl) | 472 | static void wl1271_flush_deferred_work(struct wl1271 *wl) |
@@ -489,20 +494,15 @@ static void wl1271_netstack_work(struct work_struct *work) | |||
489 | 494 | ||
490 | #define WL1271_IRQ_MAX_LOOPS 256 | 495 | #define WL1271_IRQ_MAX_LOOPS 256 |
491 | 496 | ||
492 | static irqreturn_t wl1271_irq(int irq, void *cookie) | 497 | static int wlcore_irq_locked(struct wl1271 *wl) |
493 | { | 498 | { |
494 | int ret; | 499 | int ret = 0; |
495 | u32 intr; | 500 | u32 intr; |
496 | int loopcount = WL1271_IRQ_MAX_LOOPS; | 501 | int loopcount = WL1271_IRQ_MAX_LOOPS; |
497 | struct wl1271 *wl = (struct wl1271 *)cookie; | ||
498 | bool done = false; | 502 | bool done = false; |
499 | unsigned int defer_count; | 503 | unsigned int defer_count; |
500 | unsigned long flags; | 504 | unsigned long flags; |
501 | 505 | ||
502 | /* TX might be handled here, avoid redundant work */ | ||
503 | set_bit(WL1271_FLAG_TX_PENDING, &wl->flags); | ||
504 | cancel_work_sync(&wl->tx_work); | ||
505 | |||
506 | /* | 506 | /* |
507 | * In case edge triggered interrupt must be used, we cannot iterate | 507 | * In case edge triggered interrupt must be used, we cannot iterate |
508 | * more than once without introducing race conditions with the hardirq. | 508 | * more than once without introducing race conditions with the hardirq. |
@@ -510,8 +510,6 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
510 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) | 510 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) |
511 | loopcount = 1; | 511 | loopcount = 1; |
512 | 512 | ||
513 | mutex_lock(&wl->mutex); | ||
514 | |||
515 | wl1271_debug(DEBUG_IRQ, "IRQ work"); | 513 | wl1271_debug(DEBUG_IRQ, "IRQ work"); |
516 | 514 | ||
517 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 515 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
@@ -530,7 +528,9 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
530 | clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); | 528 | clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); |
531 | smp_mb__after_clear_bit(); | 529 | smp_mb__after_clear_bit(); |
532 | 530 | ||
533 | wl12xx_fw_status(wl, wl->fw_status_1, wl->fw_status_2); | 531 | ret = wlcore_fw_status(wl, wl->fw_status_1, wl->fw_status_2); |
532 | if (ret < 0) | ||
533 | goto out; | ||
534 | 534 | ||
535 | wlcore_hw_tx_immediate_compl(wl); | 535 | wlcore_hw_tx_immediate_compl(wl); |
536 | 536 | ||
@@ -544,7 +544,7 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
544 | if (unlikely(intr & WL1271_ACX_INTR_WATCHDOG)) { | 544 | if (unlikely(intr & WL1271_ACX_INTR_WATCHDOG)) { |
545 | wl1271_error("HW watchdog interrupt received! starting recovery."); | 545 | wl1271_error("HW watchdog interrupt received! starting recovery."); |
546 | wl->watchdog_recovery = true; | 546 | wl->watchdog_recovery = true; |
547 | wl12xx_queue_recovery_work(wl); | 547 | ret = -EIO; |
548 | 548 | ||
549 | /* restarting the chip. ignore any other interrupt. */ | 549 | /* restarting the chip. ignore any other interrupt. */ |
550 | goto out; | 550 | goto out; |
@@ -554,7 +554,7 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
554 | wl1271_error("SW watchdog interrupt received! " | 554 | wl1271_error("SW watchdog interrupt received! " |
555 | "starting recovery."); | 555 | "starting recovery."); |
556 | wl->watchdog_recovery = true; | 556 | wl->watchdog_recovery = true; |
557 | wl12xx_queue_recovery_work(wl); | 557 | ret = -EIO; |
558 | 558 | ||
559 | /* restarting the chip. ignore any other interrupt. */ | 559 | /* restarting the chip. ignore any other interrupt. */ |
560 | goto out; | 560 | goto out; |
@@ -563,7 +563,9 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
563 | if (likely(intr & WL1271_ACX_INTR_DATA)) { | 563 | if (likely(intr & WL1271_ACX_INTR_DATA)) { |
564 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA"); | 564 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA"); |
565 | 565 | ||
566 | wl12xx_rx(wl, wl->fw_status_1); | 566 | ret = wlcore_rx(wl, wl->fw_status_1); |
567 | if (ret < 0) | ||
568 | goto out; | ||
567 | 569 | ||
568 | /* Check if any tx blocks were freed */ | 570 | /* Check if any tx blocks were freed */ |
569 | spin_lock_irqsave(&wl->wl_lock, flags); | 571 | spin_lock_irqsave(&wl->wl_lock, flags); |
@@ -574,13 +576,17 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
574 | * In order to avoid starvation of the TX path, | 576 | * In order to avoid starvation of the TX path, |
575 | * call the work function directly. | 577 | * call the work function directly. |
576 | */ | 578 | */ |
577 | wl1271_tx_work_locked(wl); | 579 | ret = wlcore_tx_work_locked(wl); |
580 | if (ret < 0) | ||
581 | goto out; | ||
578 | } else { | 582 | } else { |
579 | spin_unlock_irqrestore(&wl->wl_lock, flags); | 583 | spin_unlock_irqrestore(&wl->wl_lock, flags); |
580 | } | 584 | } |
581 | 585 | ||
582 | /* check for tx results */ | 586 | /* check for tx results */ |
583 | wlcore_hw_tx_delayed_compl(wl); | 587 | ret = wlcore_hw_tx_delayed_compl(wl); |
588 | if (ret < 0) | ||
589 | goto out; | ||
584 | 590 | ||
585 | /* Make sure the deferred queues don't get too long */ | 591 | /* Make sure the deferred queues don't get too long */ |
586 | defer_count = skb_queue_len(&wl->deferred_tx_queue) + | 592 | defer_count = skb_queue_len(&wl->deferred_tx_queue) + |
@@ -591,12 +597,16 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
591 | 597 | ||
592 | if (intr & WL1271_ACX_INTR_EVENT_A) { | 598 | if (intr & WL1271_ACX_INTR_EVENT_A) { |
593 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A"); | 599 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A"); |
594 | wl1271_event_handle(wl, 0); | 600 | ret = wl1271_event_handle(wl, 0); |
601 | if (ret < 0) | ||
602 | goto out; | ||
595 | } | 603 | } |
596 | 604 | ||
597 | if (intr & WL1271_ACX_INTR_EVENT_B) { | 605 | if (intr & WL1271_ACX_INTR_EVENT_B) { |
598 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B"); | 606 | wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B"); |
599 | wl1271_event_handle(wl, 1); | 607 | ret = wl1271_event_handle(wl, 1); |
608 | if (ret < 0) | ||
609 | goto out; | ||
600 | } | 610 | } |
601 | 611 | ||
602 | if (intr & WL1271_ACX_INTR_INIT_COMPLETE) | 612 | if (intr & WL1271_ACX_INTR_INIT_COMPLETE) |
@@ -610,6 +620,25 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
610 | wl1271_ps_elp_sleep(wl); | 620 | wl1271_ps_elp_sleep(wl); |
611 | 621 | ||
612 | out: | 622 | out: |
623 | return ret; | ||
624 | } | ||
625 | |||
626 | static irqreturn_t wlcore_irq(int irq, void *cookie) | ||
627 | { | ||
628 | int ret; | ||
629 | unsigned long flags; | ||
630 | struct wl1271 *wl = cookie; | ||
631 | |||
632 | /* TX might be handled here, avoid redundant work */ | ||
633 | set_bit(WL1271_FLAG_TX_PENDING, &wl->flags); | ||
634 | cancel_work_sync(&wl->tx_work); | ||
635 | |||
636 | mutex_lock(&wl->mutex); | ||
637 | |||
638 | ret = wlcore_irq_locked(wl); | ||
639 | if (ret) | ||
640 | wl12xx_queue_recovery_work(wl); | ||
641 | |||
613 | spin_lock_irqsave(&wl->wl_lock, flags); | 642 | spin_lock_irqsave(&wl->wl_lock, flags); |
614 | /* In case TX was not handled here, queue TX work */ | 643 | /* In case TX was not handled here, queue TX work */ |
615 | clear_bit(WL1271_FLAG_TX_PENDING, &wl->flags); | 644 | clear_bit(WL1271_FLAG_TX_PENDING, &wl->flags); |
@@ -743,8 +772,13 @@ out: | |||
743 | 772 | ||
744 | void wl12xx_queue_recovery_work(struct wl1271 *wl) | 773 | void wl12xx_queue_recovery_work(struct wl1271 *wl) |
745 | { | 774 | { |
746 | if (!test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) | 775 | WARN_ON(!test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)); |
776 | |||
777 | /* Avoid a recursive recovery */ | ||
778 | if (!test_and_set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { | ||
779 | wlcore_disable_interrupts_nosync(wl); | ||
747 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | 780 | ieee80211_queue_work(wl->hw, &wl->recovery_work); |
781 | } | ||
748 | } | 782 | } |
749 | 783 | ||
750 | size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen) | 784 | size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen) |
@@ -770,14 +804,17 @@ size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen) | |||
770 | return len; | 804 | return len; |
771 | } | 805 | } |
772 | 806 | ||
807 | #define WLCORE_FW_LOG_END 0x2000000 | ||
808 | |||
773 | static void wl12xx_read_fwlog_panic(struct wl1271 *wl) | 809 | static void wl12xx_read_fwlog_panic(struct wl1271 *wl) |
774 | { | 810 | { |
775 | u32 addr; | 811 | u32 addr; |
776 | u32 first_addr; | 812 | u32 offset; |
813 | u32 end_of_log; | ||
777 | u8 *block; | 814 | u8 *block; |
815 | int ret; | ||
778 | 816 | ||
779 | if ((wl->quirks & WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED) || | 817 | if ((wl->quirks & WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED) || |
780 | (wl->conf.fwlog.mode != WL12XX_FWLOG_ON_DEMAND) || | ||
781 | (wl->conf.fwlog.mem_blocks == 0)) | 818 | (wl->conf.fwlog.mem_blocks == 0)) |
782 | return; | 819 | return; |
783 | 820 | ||
@@ -791,34 +828,47 @@ static void wl12xx_read_fwlog_panic(struct wl1271 *wl) | |||
791 | * Make sure the chip is awake and the logger isn't active. | 828 | * Make sure the chip is awake and the logger isn't active. |
792 | * Do not send a stop fwlog command if the fw is hanged. | 829 | * Do not send a stop fwlog command if the fw is hanged. |
793 | */ | 830 | */ |
794 | if (!wl1271_ps_elp_wakeup(wl) && !wl->watchdog_recovery) | 831 | if (wl1271_ps_elp_wakeup(wl)) |
795 | wl12xx_cmd_stop_fwlog(wl); | ||
796 | else | ||
797 | goto out; | 832 | goto out; |
833 | if (!wl->watchdog_recovery) | ||
834 | wl12xx_cmd_stop_fwlog(wl); | ||
798 | 835 | ||
799 | /* Read the first memory block address */ | 836 | /* Read the first memory block address */ |
800 | wl12xx_fw_status(wl, wl->fw_status_1, wl->fw_status_2); | 837 | ret = wlcore_fw_status(wl, wl->fw_status_1, wl->fw_status_2); |
801 | first_addr = le32_to_cpu(wl->fw_status_2->log_start_addr); | 838 | if (ret < 0) |
802 | if (!first_addr) | 839 | goto out; |
840 | |||
841 | addr = le32_to_cpu(wl->fw_status_2->log_start_addr); | ||
842 | if (!addr) | ||
803 | goto out; | 843 | goto out; |
804 | 844 | ||
845 | if (wl->conf.fwlog.mode == WL12XX_FWLOG_CONTINUOUS) { | ||
846 | offset = sizeof(addr) + sizeof(struct wl1271_rx_descriptor); | ||
847 | end_of_log = WLCORE_FW_LOG_END; | ||
848 | } else { | ||
849 | offset = sizeof(addr); | ||
850 | end_of_log = addr; | ||
851 | } | ||
852 | |||
805 | /* Traverse the memory blocks linked list */ | 853 | /* Traverse the memory blocks linked list */ |
806 | addr = first_addr; | ||
807 | do { | 854 | do { |
808 | memset(block, 0, WL12XX_HW_BLOCK_SIZE); | 855 | memset(block, 0, WL12XX_HW_BLOCK_SIZE); |
809 | wl1271_read_hwaddr(wl, addr, block, WL12XX_HW_BLOCK_SIZE, | 856 | ret = wlcore_read_hwaddr(wl, addr, block, WL12XX_HW_BLOCK_SIZE, |
810 | false); | 857 | false); |
858 | if (ret < 0) | ||
859 | goto out; | ||
811 | 860 | ||
812 | /* | 861 | /* |
813 | * Memory blocks are linked to one another. The first 4 bytes | 862 | * Memory blocks are linked to one another. The first 4 bytes |
814 | * of each memory block hold the hardware address of the next | 863 | * of each memory block hold the hardware address of the next |
815 | * one. The last memory block points to the first one. | 864 | * one. The last memory block points to the first one in |
865 | * on demand mode and is equal to 0x2000000 in continuous mode. | ||
816 | */ | 866 | */ |
817 | addr = le32_to_cpup((__le32 *)block); | 867 | addr = le32_to_cpup((__le32 *)block); |
818 | if (!wl12xx_copy_fwlog(wl, block + sizeof(addr), | 868 | if (!wl12xx_copy_fwlog(wl, block + offset, |
819 | WL12XX_HW_BLOCK_SIZE - sizeof(addr))) | 869 | WL12XX_HW_BLOCK_SIZE - offset)) |
820 | break; | 870 | break; |
821 | } while (addr && (addr != first_addr)); | 871 | } while (addr && (addr != end_of_log)); |
822 | 872 | ||
823 | wake_up_interruptible(&wl->fwlog_waitq); | 873 | wake_up_interruptible(&wl->fwlog_waitq); |
824 | 874 | ||
@@ -826,6 +876,34 @@ out: | |||
826 | kfree(block); | 876 | kfree(block); |
827 | } | 877 | } |
828 | 878 | ||
879 | static void wlcore_print_recovery(struct wl1271 *wl) | ||
880 | { | ||
881 | u32 pc = 0; | ||
882 | u32 hint_sts = 0; | ||
883 | int ret; | ||
884 | |||
885 | wl1271_info("Hardware recovery in progress. FW ver: %s", | ||
886 | wl->chip.fw_ver_str); | ||
887 | |||
888 | /* change partitions momentarily so we can read the FW pc */ | ||
889 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | ||
890 | if (ret < 0) | ||
891 | return; | ||
892 | |||
893 | ret = wlcore_read_reg(wl, REG_PC_ON_RECOVERY, &pc); | ||
894 | if (ret < 0) | ||
895 | return; | ||
896 | |||
897 | ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &hint_sts); | ||
898 | if (ret < 0) | ||
899 | return; | ||
900 | |||
901 | wl1271_info("pc: 0x%x, hint_sts: 0x%08x", pc, hint_sts); | ||
902 | |||
903 | wlcore_set_partition(wl, &wl->ptable[PART_WORK]); | ||
904 | } | ||
905 | |||
906 | |||
829 | static void wl1271_recovery_work(struct work_struct *work) | 907 | static void wl1271_recovery_work(struct work_struct *work) |
830 | { | 908 | { |
831 | struct wl1271 *wl = | 909 | struct wl1271 *wl = |
@@ -838,19 +916,9 @@ static void wl1271_recovery_work(struct work_struct *work) | |||
838 | if (wl->state != WL1271_STATE_ON || wl->plt) | 916 | if (wl->state != WL1271_STATE_ON || wl->plt) |
839 | goto out_unlock; | 917 | goto out_unlock; |
840 | 918 | ||
841 | /* Avoid a recursive recovery */ | ||
842 | set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); | ||
843 | |||
844 | wl12xx_read_fwlog_panic(wl); | 919 | wl12xx_read_fwlog_panic(wl); |
845 | 920 | ||
846 | /* change partitions momentarily so we can read the FW pc */ | 921 | wlcore_print_recovery(wl); |
847 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | ||
848 | wl1271_info("Hardware recovery in progress. FW ver: %s pc: 0x%x " | ||
849 | "hint_sts: 0x%08x", | ||
850 | wl->chip.fw_ver_str, | ||
851 | wlcore_read_reg(wl, REG_PC_ON_RECOVERY), | ||
852 | wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR)); | ||
853 | wlcore_set_partition(wl, &wl->ptable[PART_WORK]); | ||
854 | 922 | ||
855 | BUG_ON(bug_on_recovery && | 923 | BUG_ON(bug_on_recovery && |
856 | !test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)); | 924 | !test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)); |
@@ -892,8 +960,6 @@ static void wl1271_recovery_work(struct work_struct *work) | |||
892 | mutex_unlock(&wl->mutex); | 960 | mutex_unlock(&wl->mutex); |
893 | wl1271_op_stop(wl->hw); | 961 | wl1271_op_stop(wl->hw); |
894 | 962 | ||
895 | clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); | ||
896 | |||
897 | ieee80211_restart_hw(wl->hw); | 963 | ieee80211_restart_hw(wl->hw); |
898 | 964 | ||
899 | /* | 965 | /* |
@@ -907,9 +973,9 @@ out_unlock: | |||
907 | mutex_unlock(&wl->mutex); | 973 | mutex_unlock(&wl->mutex); |
908 | } | 974 | } |
909 | 975 | ||
910 | static void wl1271_fw_wakeup(struct wl1271 *wl) | 976 | static int wlcore_fw_wakeup(struct wl1271 *wl) |
911 | { | 977 | { |
912 | wl1271_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); | 978 | return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); |
913 | } | 979 | } |
914 | 980 | ||
915 | static int wl1271_setup(struct wl1271 *wl) | 981 | static int wl1271_setup(struct wl1271 *wl) |
@@ -945,13 +1011,21 @@ static int wl12xx_set_power_on(struct wl1271 *wl) | |||
945 | wl1271_io_reset(wl); | 1011 | wl1271_io_reset(wl); |
946 | wl1271_io_init(wl); | 1012 | wl1271_io_init(wl); |
947 | 1013 | ||
948 | wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 1014 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
1015 | if (ret < 0) | ||
1016 | goto fail; | ||
949 | 1017 | ||
950 | /* ELP module wake up */ | 1018 | /* ELP module wake up */ |
951 | wl1271_fw_wakeup(wl); | 1019 | ret = wlcore_fw_wakeup(wl); |
1020 | if (ret < 0) | ||
1021 | goto fail; | ||
952 | 1022 | ||
953 | out: | 1023 | out: |
954 | return ret; | 1024 | return ret; |
1025 | |||
1026 | fail: | ||
1027 | wl1271_power_off(wl); | ||
1028 | return ret; | ||
955 | } | 1029 | } |
956 | 1030 | ||
957 | static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt) | 1031 | static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt) |
@@ -1082,6 +1156,7 @@ int wl1271_plt_stop(struct wl1271 *wl) | |||
1082 | mutex_lock(&wl->mutex); | 1156 | mutex_lock(&wl->mutex); |
1083 | wl1271_power_off(wl); | 1157 | wl1271_power_off(wl); |
1084 | wl->flags = 0; | 1158 | wl->flags = 0; |
1159 | wl->sleep_auth = WL1271_PSM_ILLEGAL; | ||
1085 | wl->state = WL1271_STATE_OFF; | 1160 | wl->state = WL1271_STATE_OFF; |
1086 | wl->plt = false; | 1161 | wl->plt = false; |
1087 | wl->rx_counter = 0; | 1162 | wl->rx_counter = 0; |
@@ -1173,7 +1248,7 @@ int wl1271_tx_dummy_packet(struct wl1271 *wl) | |||
1173 | 1248 | ||
1174 | /* The FW is low on RX memory blocks, so send the dummy packet asap */ | 1249 | /* The FW is low on RX memory blocks, so send the dummy packet asap */ |
1175 | if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) | 1250 | if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) |
1176 | wl1271_tx_work_locked(wl); | 1251 | return wlcore_tx_work_locked(wl); |
1177 | 1252 | ||
1178 | /* | 1253 | /* |
1179 | * If the FW TX is busy, TX work will be scheduled by the threaded | 1254 | * If the FW TX is busy, TX work will be scheduled by the threaded |
@@ -1440,8 +1515,15 @@ static int wl1271_configure_wowlan(struct wl1271 *wl, | |||
1440 | int i, ret; | 1515 | int i, ret; |
1441 | 1516 | ||
1442 | if (!wow || wow->any || !wow->n_patterns) { | 1517 | if (!wow || wow->any || !wow->n_patterns) { |
1443 | wl1271_acx_default_rx_filter_enable(wl, 0, FILTER_SIGNAL); | 1518 | ret = wl1271_acx_default_rx_filter_enable(wl, 0, |
1444 | wl1271_rx_filter_clear_all(wl); | 1519 | FILTER_SIGNAL); |
1520 | if (ret) | ||
1521 | goto out; | ||
1522 | |||
1523 | ret = wl1271_rx_filter_clear_all(wl); | ||
1524 | if (ret) | ||
1525 | goto out; | ||
1526 | |||
1445 | return 0; | 1527 | return 0; |
1446 | } | 1528 | } |
1447 | 1529 | ||
@@ -1457,8 +1539,13 @@ static int wl1271_configure_wowlan(struct wl1271 *wl, | |||
1457 | } | 1539 | } |
1458 | } | 1540 | } |
1459 | 1541 | ||
1460 | wl1271_acx_default_rx_filter_enable(wl, 0, FILTER_SIGNAL); | 1542 | ret = wl1271_acx_default_rx_filter_enable(wl, 0, FILTER_SIGNAL); |
1461 | wl1271_rx_filter_clear_all(wl); | 1543 | if (ret) |
1544 | goto out; | ||
1545 | |||
1546 | ret = wl1271_rx_filter_clear_all(wl); | ||
1547 | if (ret) | ||
1548 | goto out; | ||
1462 | 1549 | ||
1463 | /* Translate WoWLAN patterns into filters */ | 1550 | /* Translate WoWLAN patterns into filters */ |
1464 | for (i = 0; i < wow->n_patterns; i++) { | 1551 | for (i = 0; i < wow->n_patterns; i++) { |
@@ -1500,7 +1587,10 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl, | |||
1500 | if (ret < 0) | 1587 | if (ret < 0) |
1501 | goto out; | 1588 | goto out; |
1502 | 1589 | ||
1503 | wl1271_configure_wowlan(wl, wow); | 1590 | ret = wl1271_configure_wowlan(wl, wow); |
1591 | if (ret < 0) | ||
1592 | goto out_sleep; | ||
1593 | |||
1504 | ret = wl1271_acx_wake_up_conditions(wl, wlvif, | 1594 | ret = wl1271_acx_wake_up_conditions(wl, wlvif, |
1505 | wl->conf.conn.suspend_wake_up_event, | 1595 | wl->conf.conn.suspend_wake_up_event, |
1506 | wl->conf.conn.suspend_listen_interval); | 1596 | wl->conf.conn.suspend_listen_interval); |
@@ -1508,8 +1598,8 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl, | |||
1508 | if (ret < 0) | 1598 | if (ret < 0) |
1509 | wl1271_error("suspend: set wake up conditions failed: %d", ret); | 1599 | wl1271_error("suspend: set wake up conditions failed: %d", ret); |
1510 | 1600 | ||
1601 | out_sleep: | ||
1511 | wl1271_ps_elp_sleep(wl); | 1602 | wl1271_ps_elp_sleep(wl); |
1512 | |||
1513 | out: | 1603 | out: |
1514 | return ret; | 1604 | return ret; |
1515 | 1605 | ||
@@ -1588,6 +1678,12 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, | |||
1588 | wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); | 1678 | wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); |
1589 | WARN_ON(!wow); | 1679 | WARN_ON(!wow); |
1590 | 1680 | ||
1681 | /* we want to perform the recovery before suspending */ | ||
1682 | if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { | ||
1683 | wl1271_warning("postponing suspend to perform recovery"); | ||
1684 | return -EBUSY; | ||
1685 | } | ||
1686 | |||
1591 | wl1271_tx_flush(wl); | 1687 | wl1271_tx_flush(wl); |
1592 | 1688 | ||
1593 | mutex_lock(&wl->mutex); | 1689 | mutex_lock(&wl->mutex); |
@@ -1628,7 +1724,8 @@ static int wl1271_op_resume(struct ieee80211_hw *hw) | |||
1628 | struct wl1271 *wl = hw->priv; | 1724 | struct wl1271 *wl = hw->priv; |
1629 | struct wl12xx_vif *wlvif; | 1725 | struct wl12xx_vif *wlvif; |
1630 | unsigned long flags; | 1726 | unsigned long flags; |
1631 | bool run_irq_work = false; | 1727 | bool run_irq_work = false, pending_recovery; |
1728 | int ret; | ||
1632 | 1729 | ||
1633 | wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d", | 1730 | wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d", |
1634 | wl->wow_enabled); | 1731 | wl->wow_enabled); |
@@ -1644,17 +1741,37 @@ static int wl1271_op_resume(struct ieee80211_hw *hw) | |||
1644 | run_irq_work = true; | 1741 | run_irq_work = true; |
1645 | spin_unlock_irqrestore(&wl->wl_lock, flags); | 1742 | spin_unlock_irqrestore(&wl->wl_lock, flags); |
1646 | 1743 | ||
1744 | mutex_lock(&wl->mutex); | ||
1745 | |||
1746 | /* test the recovery flag before calling any SDIO functions */ | ||
1747 | pending_recovery = test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, | ||
1748 | &wl->flags); | ||
1749 | |||
1647 | if (run_irq_work) { | 1750 | if (run_irq_work) { |
1648 | wl1271_debug(DEBUG_MAC80211, | 1751 | wl1271_debug(DEBUG_MAC80211, |
1649 | "run postponed irq_work directly"); | 1752 | "run postponed irq_work directly"); |
1650 | wl1271_irq(0, wl); | 1753 | |
1754 | /* don't talk to the HW if recovery is pending */ | ||
1755 | if (!pending_recovery) { | ||
1756 | ret = wlcore_irq_locked(wl); | ||
1757 | if (ret) | ||
1758 | wl12xx_queue_recovery_work(wl); | ||
1759 | } | ||
1760 | |||
1651 | wlcore_enable_interrupts(wl); | 1761 | wlcore_enable_interrupts(wl); |
1652 | } | 1762 | } |
1653 | 1763 | ||
1654 | mutex_lock(&wl->mutex); | 1764 | if (pending_recovery) { |
1765 | wl1271_warning("queuing forgotten recovery on resume"); | ||
1766 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | ||
1767 | goto out; | ||
1768 | } | ||
1769 | |||
1655 | wl12xx_for_each_wlvif(wl, wlvif) { | 1770 | wl12xx_for_each_wlvif(wl, wlvif) { |
1656 | wl1271_configure_resume(wl, wlvif); | 1771 | wl1271_configure_resume(wl, wlvif); |
1657 | } | 1772 | } |
1773 | |||
1774 | out: | ||
1658 | wl->wow_enabled = false; | 1775 | wl->wow_enabled = false; |
1659 | mutex_unlock(&wl->mutex); | 1776 | mutex_unlock(&wl->mutex); |
1660 | 1777 | ||
@@ -1695,6 +1812,10 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1695 | wlcore_disable_interrupts(wl); | 1812 | wlcore_disable_interrupts(wl); |
1696 | mutex_lock(&wl->mutex); | 1813 | mutex_lock(&wl->mutex); |
1697 | if (wl->state == WL1271_STATE_OFF) { | 1814 | if (wl->state == WL1271_STATE_OFF) { |
1815 | if (test_and_clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, | ||
1816 | &wl->flags)) | ||
1817 | wlcore_enable_interrupts(wl); | ||
1818 | |||
1698 | mutex_unlock(&wl->mutex); | 1819 | mutex_unlock(&wl->mutex); |
1699 | 1820 | ||
1700 | /* | 1821 | /* |
@@ -1726,6 +1847,13 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1726 | mutex_lock(&wl->mutex); | 1847 | mutex_lock(&wl->mutex); |
1727 | 1848 | ||
1728 | wl1271_power_off(wl); | 1849 | wl1271_power_off(wl); |
1850 | /* | ||
1851 | * In case a recovery was scheduled, interrupts were disabled to avoid | ||
1852 | * an interrupt storm. Now that the power is down, it is safe to | ||
1853 | * re-enable interrupts to balance the disable depth | ||
1854 | */ | ||
1855 | if (test_and_clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) | ||
1856 | wlcore_enable_interrupts(wl); | ||
1729 | 1857 | ||
1730 | wl->band = IEEE80211_BAND_2GHZ; | 1858 | wl->band = IEEE80211_BAND_2GHZ; |
1731 | 1859 | ||
@@ -1740,6 +1868,7 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1740 | wl->ap_fw_ps_map = 0; | 1868 | wl->ap_fw_ps_map = 0; |
1741 | wl->ap_ps_map = 0; | 1869 | wl->ap_ps_map = 0; |
1742 | wl->sched_scanning = false; | 1870 | wl->sched_scanning = false; |
1871 | wl->sleep_auth = WL1271_PSM_ILLEGAL; | ||
1743 | memset(wl->roles_map, 0, sizeof(wl->roles_map)); | 1872 | memset(wl->roles_map, 0, sizeof(wl->roles_map)); |
1744 | memset(wl->links_map, 0, sizeof(wl->links_map)); | 1873 | memset(wl->links_map, 0, sizeof(wl->links_map)); |
1745 | memset(wl->roc_map, 0, sizeof(wl->roc_map)); | 1874 | memset(wl->roc_map, 0, sizeof(wl->roc_map)); |
@@ -2146,6 +2275,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
2146 | { | 2275 | { |
2147 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 2276 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
2148 | int i, ret; | 2277 | int i, ret; |
2278 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); | ||
2149 | 2279 | ||
2150 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); | 2280 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); |
2151 | 2281 | ||
@@ -2226,11 +2356,25 @@ deinit: | |||
2226 | wlvif->role_id = WL12XX_INVALID_ROLE_ID; | 2356 | wlvif->role_id = WL12XX_INVALID_ROLE_ID; |
2227 | wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; | 2357 | wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; |
2228 | 2358 | ||
2229 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) | 2359 | if (is_ap) |
2230 | wl->ap_count--; | 2360 | wl->ap_count--; |
2231 | else | 2361 | else |
2232 | wl->sta_count--; | 2362 | wl->sta_count--; |
2233 | 2363 | ||
2364 | /* Last AP, have more stations. Configure according to STA. */ | ||
2365 | if (wl->ap_count == 0 && is_ap && wl->sta_count) { | ||
2366 | u8 sta_auth = wl->conf.conn.sta_sleep_auth; | ||
2367 | /* Configure for power according to debugfs */ | ||
2368 | if (sta_auth != WL1271_PSM_ILLEGAL) | ||
2369 | wl1271_acx_sleep_auth(wl, sta_auth); | ||
2370 | /* Configure for power always on */ | ||
2371 | else if (wl->quirks & WLCORE_QUIRK_NO_ELP) | ||
2372 | wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); | ||
2373 | /* Configure for ELP power saving */ | ||
2374 | else | ||
2375 | wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); | ||
2376 | } | ||
2377 | |||
2234 | mutex_unlock(&wl->mutex); | 2378 | mutex_unlock(&wl->mutex); |
2235 | 2379 | ||
2236 | del_timer_sync(&wlvif->rx_streaming_timer); | 2380 | del_timer_sync(&wlvif->rx_streaming_timer); |
@@ -2448,12 +2592,16 @@ static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
2448 | (wlvif->channel != channel) || | 2592 | (wlvif->channel != channel) || |
2449 | (wlvif->channel_type != conf->channel_type))) { | 2593 | (wlvif->channel_type != conf->channel_type))) { |
2450 | /* send all pending packets */ | 2594 | /* send all pending packets */ |
2451 | wl1271_tx_work_locked(wl); | 2595 | ret = wlcore_tx_work_locked(wl); |
2596 | if (ret < 0) | ||
2597 | return ret; | ||
2598 | |||
2452 | wlvif->band = conf->channel->band; | 2599 | wlvif->band = conf->channel->band; |
2453 | wlvif->channel = channel; | 2600 | wlvif->channel = channel; |
2454 | wlvif->channel_type = conf->channel_type; | 2601 | wlvif->channel_type = conf->channel_type; |
2455 | 2602 | ||
2456 | if (is_ap) { | 2603 | if (is_ap) { |
2604 | wl1271_set_band_rate(wl, wlvif); | ||
2457 | ret = wl1271_init_ap_rates(wl, wlvif); | 2605 | ret = wl1271_init_ap_rates(wl, wlvif); |
2458 | if (ret < 0) | 2606 | if (ret < 0) |
2459 | wl1271_error("AP rate policy change failed %d", | 2607 | wl1271_error("AP rate policy change failed %d", |
@@ -4090,16 +4238,13 @@ out: | |||
4090 | static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx, | 4238 | static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx, |
4091 | struct survey_info *survey) | 4239 | struct survey_info *survey) |
4092 | { | 4240 | { |
4093 | struct wl1271 *wl = hw->priv; | ||
4094 | struct ieee80211_conf *conf = &hw->conf; | 4241 | struct ieee80211_conf *conf = &hw->conf; |
4095 | 4242 | ||
4096 | if (idx != 0) | 4243 | if (idx != 0) |
4097 | return -ENOENT; | 4244 | return -ENOENT; |
4098 | 4245 | ||
4099 | survey->channel = conf->channel; | 4246 | survey->channel = conf->channel; |
4100 | survey->filled = SURVEY_INFO_NOISE_DBM; | 4247 | survey->filled = 0; |
4101 | survey->noise = wl->noise; | ||
4102 | |||
4103 | return 0; | 4248 | return 0; |
4104 | } | 4249 | } |
4105 | 4250 | ||
@@ -4365,9 +4510,14 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw, | |||
4365 | 4510 | ||
4366 | case IEEE80211_AMPDU_RX_STOP: | 4511 | case IEEE80211_AMPDU_RX_STOP: |
4367 | if (!(*ba_bitmap & BIT(tid))) { | 4512 | if (!(*ba_bitmap & BIT(tid))) { |
4368 | ret = -EINVAL; | 4513 | /* |
4369 | wl1271_error("no active RX BA session on tid: %d", | 4514 | * this happens on reconfig - so only output a debug |
4515 | * message for now, and don't fail the function. | ||
4516 | */ | ||
4517 | wl1271_debug(DEBUG_MAC80211, | ||
4518 | "no active RX BA session on tid: %d", | ||
4370 | tid); | 4519 | tid); |
4520 | ret = 0; | ||
4371 | break; | 4521 | break; |
4372 | } | 4522 | } |
4373 | 4523 | ||
@@ -4904,18 +5054,22 @@ static int wl12xx_get_hw_info(struct wl1271 *wl) | |||
4904 | if (ret < 0) | 5054 | if (ret < 0) |
4905 | goto out; | 5055 | goto out; |
4906 | 5056 | ||
4907 | wl->chip.id = wlcore_read_reg(wl, REG_CHIP_ID_B); | 5057 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &wl->chip.id); |
5058 | if (ret < 0) | ||
5059 | goto out; | ||
4908 | 5060 | ||
4909 | wl->fuse_oui_addr = 0; | 5061 | wl->fuse_oui_addr = 0; |
4910 | wl->fuse_nic_addr = 0; | 5062 | wl->fuse_nic_addr = 0; |
4911 | 5063 | ||
4912 | wl->hw_pg_ver = wl->ops->get_pg_ver(wl); | 5064 | ret = wl->ops->get_pg_ver(wl, &wl->hw_pg_ver); |
5065 | if (ret < 0) | ||
5066 | goto out; | ||
4913 | 5067 | ||
4914 | if (wl->ops->get_mac) | 5068 | if (wl->ops->get_mac) |
4915 | wl->ops->get_mac(wl); | 5069 | ret = wl->ops->get_mac(wl); |
4916 | 5070 | ||
4917 | wl1271_power_off(wl); | ||
4918 | out: | 5071 | out: |
5072 | wl1271_power_off(wl); | ||
4919 | return ret; | 5073 | return ret; |
4920 | } | 5074 | } |
4921 | 5075 | ||
@@ -4976,6 +5130,29 @@ static void wl1271_unregister_hw(struct wl1271 *wl) | |||
4976 | 5130 | ||
4977 | } | 5131 | } |
4978 | 5132 | ||
5133 | static const struct ieee80211_iface_limit wlcore_iface_limits[] = { | ||
5134 | { | ||
5135 | .max = 2, | ||
5136 | .types = BIT(NL80211_IFTYPE_STATION), | ||
5137 | }, | ||
5138 | { | ||
5139 | .max = 1, | ||
5140 | .types = BIT(NL80211_IFTYPE_AP) | | ||
5141 | BIT(NL80211_IFTYPE_P2P_GO) | | ||
5142 | BIT(NL80211_IFTYPE_P2P_CLIENT), | ||
5143 | }, | ||
5144 | }; | ||
5145 | |||
5146 | static const struct ieee80211_iface_combination | ||
5147 | wlcore_iface_combinations[] = { | ||
5148 | { | ||
5149 | .num_different_channels = 1, | ||
5150 | .max_interfaces = 2, | ||
5151 | .limits = wlcore_iface_limits, | ||
5152 | .n_limits = ARRAY_SIZE(wlcore_iface_limits), | ||
5153 | }, | ||
5154 | }; | ||
5155 | |||
4979 | static int wl1271_init_ieee80211(struct wl1271 *wl) | 5156 | static int wl1271_init_ieee80211(struct wl1271 *wl) |
4980 | { | 5157 | { |
4981 | static const u32 cipher_suites[] = { | 5158 | static const u32 cipher_suites[] = { |
@@ -5069,6 +5246,11 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) | |||
5069 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | | 5246 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | |
5070 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; | 5247 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; |
5071 | 5248 | ||
5249 | /* allowed interface combinations */ | ||
5250 | wl->hw->wiphy->iface_combinations = wlcore_iface_combinations; | ||
5251 | wl->hw->wiphy->n_iface_combinations = | ||
5252 | ARRAY_SIZE(wlcore_iface_combinations); | ||
5253 | |||
5072 | SET_IEEE80211_DEV(wl->hw, wl->dev); | 5254 | SET_IEEE80211_DEV(wl->hw, wl->dev); |
5073 | 5255 | ||
5074 | wl->hw->sta_data_size = sizeof(struct wl1271_station); | 5256 | wl->hw->sta_data_size = sizeof(struct wl1271_station); |
@@ -5140,6 +5322,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size) | |||
5140 | wl->channel_type = NL80211_CHAN_NO_HT; | 5322 | wl->channel_type = NL80211_CHAN_NO_HT; |
5141 | wl->flags = 0; | 5323 | wl->flags = 0; |
5142 | wl->sg_enabled = true; | 5324 | wl->sg_enabled = true; |
5325 | wl->sleep_auth = WL1271_PSM_ILLEGAL; | ||
5143 | wl->hw_pg_ver = -1; | 5326 | wl->hw_pg_ver = -1; |
5144 | wl->ap_ps_map = 0; | 5327 | wl->ap_ps_map = 0; |
5145 | wl->ap_fw_ps_map = 0; | 5328 | wl->ap_fw_ps_map = 0; |
@@ -5313,7 +5496,7 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) | |||
5313 | else | 5496 | else |
5314 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; | 5497 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; |
5315 | 5498 | ||
5316 | ret = request_threaded_irq(wl->irq, wl12xx_hardirq, wl1271_irq, | 5499 | ret = request_threaded_irq(wl->irq, wl12xx_hardirq, wlcore_irq, |
5317 | irqflags, | 5500 | irqflags, |
5318 | pdev->name, wl); | 5501 | pdev->name, wl); |
5319 | if (ret < 0) { | 5502 | if (ret < 0) { |
@@ -5339,12 +5522,12 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) | |||
5339 | ret = wl12xx_get_hw_info(wl); | 5522 | ret = wl12xx_get_hw_info(wl); |
5340 | if (ret < 0) { | 5523 | if (ret < 0) { |
5341 | wl1271_error("couldn't get hw info"); | 5524 | wl1271_error("couldn't get hw info"); |
5342 | goto out; | 5525 | goto out_irq; |
5343 | } | 5526 | } |
5344 | 5527 | ||
5345 | ret = wl->ops->identify_chip(wl); | 5528 | ret = wl->ops->identify_chip(wl); |
5346 | if (ret < 0) | 5529 | if (ret < 0) |
5347 | goto out; | 5530 | goto out_irq; |
5348 | 5531 | ||
5349 | ret = wl1271_init_ieee80211(wl); | 5532 | ret = wl1271_init_ieee80211(wl); |
5350 | if (ret) | 5533 | if (ret) |
@@ -5358,7 +5541,7 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) | |||
5358 | ret = device_create_file(wl->dev, &dev_attr_bt_coex_state); | 5541 | ret = device_create_file(wl->dev, &dev_attr_bt_coex_state); |
5359 | if (ret < 0) { | 5542 | if (ret < 0) { |
5360 | wl1271_error("failed to create sysfs file bt_coex_state"); | 5543 | wl1271_error("failed to create sysfs file bt_coex_state"); |
5361 | goto out_irq; | 5544 | goto out_unreg; |
5362 | } | 5545 | } |
5363 | 5546 | ||
5364 | /* Create sysfs file to get HW PG version */ | 5547 | /* Create sysfs file to get HW PG version */ |
@@ -5383,6 +5566,9 @@ out_hw_pg_ver: | |||
5383 | out_bt_coex_state: | 5566 | out_bt_coex_state: |
5384 | device_remove_file(wl->dev, &dev_attr_bt_coex_state); | 5567 | device_remove_file(wl->dev, &dev_attr_bt_coex_state); |
5385 | 5568 | ||
5569 | out_unreg: | ||
5570 | wl1271_unregister_hw(wl); | ||
5571 | |||
5386 | out_irq: | 5572 | out_irq: |
5387 | free_irq(wl->irq, wl); | 5573 | free_irq(wl->irq, wl); |
5388 | 5574 | ||
diff --git a/drivers/net/wireless/ti/wlcore/ps.c b/drivers/net/wireless/ti/wlcore/ps.c index 47e81b32f7da..46d36fd30eba 100644 --- a/drivers/net/wireless/ti/wlcore/ps.c +++ b/drivers/net/wireless/ti/wlcore/ps.c | |||
@@ -35,6 +35,7 @@ void wl1271_elp_work(struct work_struct *work) | |||
35 | struct delayed_work *dwork; | 35 | struct delayed_work *dwork; |
36 | struct wl1271 *wl; | 36 | struct wl1271 *wl; |
37 | struct wl12xx_vif *wlvif; | 37 | struct wl12xx_vif *wlvif; |
38 | int ret; | ||
38 | 39 | ||
39 | dwork = container_of(work, struct delayed_work, work); | 40 | dwork = container_of(work, struct delayed_work, work); |
40 | wl = container_of(dwork, struct wl1271, elp_work); | 41 | wl = container_of(dwork, struct wl1271, elp_work); |
@@ -63,7 +64,12 @@ void wl1271_elp_work(struct work_struct *work) | |||
63 | } | 64 | } |
64 | 65 | ||
65 | wl1271_debug(DEBUG_PSM, "chip to elp"); | 66 | wl1271_debug(DEBUG_PSM, "chip to elp"); |
66 | wl1271_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); | 67 | ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); |
68 | if (ret < 0) { | ||
69 | wl12xx_queue_recovery_work(wl); | ||
70 | goto out; | ||
71 | } | ||
72 | |||
67 | set_bit(WL1271_FLAG_IN_ELP, &wl->flags); | 73 | set_bit(WL1271_FLAG_IN_ELP, &wl->flags); |
68 | 74 | ||
69 | out: | 75 | out: |
@@ -76,7 +82,7 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl) | |||
76 | struct wl12xx_vif *wlvif; | 82 | struct wl12xx_vif *wlvif; |
77 | u32 timeout; | 83 | u32 timeout; |
78 | 84 | ||
79 | if (wl->quirks & WLCORE_QUIRK_NO_ELP) | 85 | if (wl->sleep_auth != WL1271_PSM_ELP) |
80 | return; | 86 | return; |
81 | 87 | ||
82 | /* we shouldn't get consecutive sleep requests */ | 88 | /* we shouldn't get consecutive sleep requests */ |
@@ -135,7 +141,11 @@ int wl1271_ps_elp_wakeup(struct wl1271 *wl) | |||
135 | wl->elp_compl = &compl; | 141 | wl->elp_compl = &compl; |
136 | spin_unlock_irqrestore(&wl->wl_lock, flags); | 142 | spin_unlock_irqrestore(&wl->wl_lock, flags); |
137 | 143 | ||
138 | wl1271_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); | 144 | ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); |
145 | if (ret < 0) { | ||
146 | wl12xx_queue_recovery_work(wl); | ||
147 | goto err; | ||
148 | } | ||
139 | 149 | ||
140 | if (!pending) { | 150 | if (!pending) { |
141 | ret = wait_for_completion_timeout( | 151 | ret = wait_for_completion_timeout( |
diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c index 78200dcacfca..f55e2f9e7ac5 100644 --- a/drivers/net/wireless/ti/wlcore/rx.c +++ b/drivers/net/wireless/ti/wlcore/rx.c | |||
@@ -127,7 +127,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, | |||
127 | } | 127 | } |
128 | 128 | ||
129 | if (rx_align == WLCORE_RX_BUF_UNALIGNED) | 129 | if (rx_align == WLCORE_RX_BUF_UNALIGNED) |
130 | reserved = NET_IP_ALIGN; | 130 | reserved = RX_BUF_ALIGN; |
131 | 131 | ||
132 | /* the data read starts with the descriptor */ | 132 | /* the data read starts with the descriptor */ |
133 | desc = (struct wl1271_rx_descriptor *) data; | 133 | desc = (struct wl1271_rx_descriptor *) data; |
@@ -175,7 +175,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, | |||
175 | */ | 175 | */ |
176 | memcpy(buf, data + sizeof(*desc), pkt_data_len); | 176 | memcpy(buf, data + sizeof(*desc), pkt_data_len); |
177 | if (rx_align == WLCORE_RX_BUF_PADDED) | 177 | if (rx_align == WLCORE_RX_BUF_PADDED) |
178 | skb_pull(skb, NET_IP_ALIGN); | 178 | skb_pull(skb, RX_BUF_ALIGN); |
179 | 179 | ||
180 | *hlid = desc->hlid; | 180 | *hlid = desc->hlid; |
181 | 181 | ||
@@ -200,7 +200,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, | |||
200 | return is_data; | 200 | return is_data; |
201 | } | 201 | } |
202 | 202 | ||
203 | void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) | 203 | int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) |
204 | { | 204 | { |
205 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; | 205 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; |
206 | u32 buf_size; | 206 | u32 buf_size; |
@@ -211,6 +211,7 @@ void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) | |||
211 | u32 pkt_offset, des; | 211 | u32 pkt_offset, des; |
212 | u8 hlid; | 212 | u8 hlid; |
213 | enum wl_rx_buf_align rx_align; | 213 | enum wl_rx_buf_align rx_align; |
214 | int ret = 0; | ||
214 | 215 | ||
215 | while (drv_rx_counter != fw_rx_counter) { | 216 | while (drv_rx_counter != fw_rx_counter) { |
216 | buf_size = 0; | 217 | buf_size = 0; |
@@ -234,9 +235,14 @@ void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) | |||
234 | 235 | ||
235 | /* Read all available packets at once */ | 236 | /* Read all available packets at once */ |
236 | des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]); | 237 | des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]); |
237 | wlcore_hw_prepare_read(wl, des, buf_size); | 238 | ret = wlcore_hw_prepare_read(wl, des, buf_size); |
238 | wlcore_read_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, | 239 | if (ret < 0) |
239 | buf_size, true); | 240 | goto out; |
241 | |||
242 | ret = wlcore_read_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, | ||
243 | buf_size, true); | ||
244 | if (ret < 0) | ||
245 | goto out; | ||
240 | 246 | ||
241 | /* Split data into separate packets */ | 247 | /* Split data into separate packets */ |
242 | pkt_offset = 0; | 248 | pkt_offset = 0; |
@@ -273,11 +279,17 @@ void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) | |||
273 | * Write the driver's packet counter to the FW. This is only required | 279 | * Write the driver's packet counter to the FW. This is only required |
274 | * for older hardware revisions | 280 | * for older hardware revisions |
275 | */ | 281 | */ |
276 | if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) | 282 | if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) { |
277 | wl1271_write32(wl, WL12XX_REG_RX_DRIVER_COUNTER, | 283 | ret = wlcore_write32(wl, WL12XX_REG_RX_DRIVER_COUNTER, |
278 | wl->rx_counter); | 284 | wl->rx_counter); |
285 | if (ret < 0) | ||
286 | goto out; | ||
287 | } | ||
279 | 288 | ||
280 | wl12xx_rearm_rx_streaming(wl, active_hlids); | 289 | wl12xx_rearm_rx_streaming(wl, active_hlids); |
290 | |||
291 | out: | ||
292 | return ret; | ||
281 | } | 293 | } |
282 | 294 | ||
283 | #ifdef CONFIG_PM | 295 | #ifdef CONFIG_PM |
@@ -306,14 +318,19 @@ int wl1271_rx_filter_enable(struct wl1271 *wl, | |||
306 | return 0; | 318 | return 0; |
307 | } | 319 | } |
308 | 320 | ||
309 | void wl1271_rx_filter_clear_all(struct wl1271 *wl) | 321 | int wl1271_rx_filter_clear_all(struct wl1271 *wl) |
310 | { | 322 | { |
311 | int i; | 323 | int i, ret = 0; |
312 | 324 | ||
313 | for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) { | 325 | for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) { |
314 | if (!wl->rx_filter_enabled[i]) | 326 | if (!wl->rx_filter_enabled[i]) |
315 | continue; | 327 | continue; |
316 | wl1271_rx_filter_enable(wl, i, 0, NULL); | 328 | ret = wl1271_rx_filter_enable(wl, i, 0, NULL); |
329 | if (ret) | ||
330 | goto out; | ||
317 | } | 331 | } |
332 | |||
333 | out: | ||
334 | return ret; | ||
318 | } | 335 | } |
319 | #endif /* CONFIG_PM */ | 336 | #endif /* CONFIG_PM */ |
diff --git a/drivers/net/wireless/ti/wlcore/rx.h b/drivers/net/wireless/ti/wlcore/rx.h index 9be780179456..71eba1899915 100644 --- a/drivers/net/wireless/ti/wlcore/rx.h +++ b/drivers/net/wireless/ti/wlcore/rx.h | |||
@@ -103,6 +103,12 @@ | |||
103 | /* If set, the buffer was padded by the FW to be 4 bytes aligned */ | 103 | /* If set, the buffer was padded by the FW to be 4 bytes aligned */ |
104 | #define RX_BUF_PADDED_PAYLOAD BIT(30) | 104 | #define RX_BUF_PADDED_PAYLOAD BIT(30) |
105 | 105 | ||
106 | /* | ||
107 | * Account for the padding inserted by the FW in case of RX_ALIGNMENT | ||
108 | * or for fixing alignment in case the packet wasn't aligned. | ||
109 | */ | ||
110 | #define RX_BUF_ALIGN 2 | ||
111 | |||
106 | /* Describes the alignment state of a Rx buffer */ | 112 | /* Describes the alignment state of a Rx buffer */ |
107 | enum wl_rx_buf_align { | 113 | enum wl_rx_buf_align { |
108 | WLCORE_RX_BUF_ALIGNED, | 114 | WLCORE_RX_BUF_ALIGNED, |
@@ -137,11 +143,11 @@ struct wl1271_rx_descriptor { | |||
137 | u8 reserved; | 143 | u8 reserved; |
138 | } __packed; | 144 | } __packed; |
139 | 145 | ||
140 | void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status_1 *status); | 146 | int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status); |
141 | u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); | 147 | u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); |
142 | int wl1271_rx_filter_enable(struct wl1271 *wl, | 148 | int wl1271_rx_filter_enable(struct wl1271 *wl, |
143 | int index, bool enable, | 149 | int index, bool enable, |
144 | struct wl12xx_rx_filter *filter); | 150 | struct wl12xx_rx_filter *filter); |
145 | void wl1271_rx_filter_clear_all(struct wl1271 *wl); | 151 | int wl1271_rx_filter_clear_all(struct wl1271 *wl); |
146 | 152 | ||
147 | #endif | 153 | #endif |
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index c67ec482e445..204e69fa9327 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
@@ -71,8 +71,8 @@ static void wl1271_sdio_set_block_size(struct device *child, | |||
71 | sdio_release_host(func); | 71 | sdio_release_host(func); |
72 | } | 72 | } |
73 | 73 | ||
74 | static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, | 74 | static int __must_check wl12xx_sdio_raw_read(struct device *child, int addr, |
75 | size_t len, bool fixed) | 75 | void *buf, size_t len, bool fixed) |
76 | { | 76 | { |
77 | int ret; | 77 | int ret; |
78 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); | 78 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); |
@@ -103,12 +103,14 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, | |||
103 | 103 | ||
104 | sdio_release_host(func); | 104 | sdio_release_host(func); |
105 | 105 | ||
106 | if (ret) | 106 | if (WARN_ON(ret)) |
107 | dev_err(child->parent, "sdio read failed (%d)\n", ret); | 107 | dev_err(child->parent, "sdio read failed (%d)\n", ret); |
108 | |||
109 | return ret; | ||
108 | } | 110 | } |
109 | 111 | ||
110 | static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, | 112 | static int __must_check wl12xx_sdio_raw_write(struct device *child, int addr, |
111 | size_t len, bool fixed) | 113 | void *buf, size_t len, bool fixed) |
112 | { | 114 | { |
113 | int ret; | 115 | int ret; |
114 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); | 116 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); |
@@ -139,25 +141,30 @@ static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, | |||
139 | 141 | ||
140 | sdio_release_host(func); | 142 | sdio_release_host(func); |
141 | 143 | ||
142 | if (ret) | 144 | if (WARN_ON(ret)) |
143 | dev_err(child->parent, "sdio write failed (%d)\n", ret); | 145 | dev_err(child->parent, "sdio write failed (%d)\n", ret); |
146 | |||
147 | return ret; | ||
144 | } | 148 | } |
145 | 149 | ||
146 | static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) | 150 | static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) |
147 | { | 151 | { |
148 | int ret; | 152 | int ret; |
149 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 153 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
154 | struct mmc_card *card = func->card; | ||
150 | 155 | ||
151 | /* If enabled, tell runtime PM not to power off the card */ | 156 | ret = pm_runtime_get_sync(&card->dev); |
152 | if (pm_runtime_enabled(&func->dev)) { | 157 | if (ret) { |
153 | ret = pm_runtime_get_sync(&func->dev); | 158 | /* |
154 | if (ret < 0) | 159 | * Runtime PM might be temporarily disabled, or the device |
155 | goto out; | 160 | * might have a positive reference counter. Make sure it is |
156 | } else { | 161 | * really powered on. |
157 | /* Runtime PM is disabled: power up the card manually */ | 162 | */ |
158 | ret = mmc_power_restore_host(func->card->host); | 163 | ret = mmc_power_restore_host(card->host); |
159 | if (ret < 0) | 164 | if (ret < 0) { |
165 | pm_runtime_put_sync(&card->dev); | ||
160 | goto out; | 166 | goto out; |
167 | } | ||
161 | } | 168 | } |
162 | 169 | ||
163 | sdio_claim_host(func); | 170 | sdio_claim_host(func); |
@@ -172,20 +179,21 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) | |||
172 | { | 179 | { |
173 | int ret; | 180 | int ret; |
174 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 181 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
182 | struct mmc_card *card = func->card; | ||
175 | 183 | ||
176 | sdio_claim_host(func); | 184 | sdio_claim_host(func); |
177 | sdio_disable_func(func); | 185 | sdio_disable_func(func); |
178 | sdio_release_host(func); | 186 | sdio_release_host(func); |
179 | 187 | ||
180 | /* Power off the card manually, even if runtime PM is enabled. */ | 188 | /* Power off the card manually in case it wasn't powered off above */ |
181 | ret = mmc_power_save_host(func->card->host); | 189 | ret = mmc_power_save_host(card->host); |
182 | if (ret < 0) | 190 | if (ret < 0) |
183 | return ret; | 191 | goto out; |
184 | 192 | ||
185 | /* If enabled, let runtime PM know the card is powered off */ | 193 | /* Let runtime PM know the card is powered off */ |
186 | if (pm_runtime_enabled(&func->dev)) | 194 | pm_runtime_put_sync(&card->dev); |
187 | ret = pm_runtime_put_sync(&func->dev); | ||
188 | 195 | ||
196 | out: | ||
189 | return ret; | 197 | return ret; |
190 | } | 198 | } |
191 | 199 | ||
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 553cd3cbb98c..6420abae40ee 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c | |||
@@ -193,8 +193,8 @@ static int wl12xx_spi_read_busy(struct device *child) | |||
193 | return -ETIMEDOUT; | 193 | return -ETIMEDOUT; |
194 | } | 194 | } |
195 | 195 | ||
196 | static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, | 196 | static int __must_check wl12xx_spi_raw_read(struct device *child, int addr, |
197 | size_t len, bool fixed) | 197 | void *buf, size_t len, bool fixed) |
198 | { | 198 | { |
199 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); | 199 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
200 | struct wl1271 *wl = dev_get_drvdata(child); | 200 | struct wl1271 *wl = dev_get_drvdata(child); |
@@ -238,7 +238,7 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, | |||
238 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && | 238 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && |
239 | wl12xx_spi_read_busy(child)) { | 239 | wl12xx_spi_read_busy(child)) { |
240 | memset(buf, 0, chunk_len); | 240 | memset(buf, 0, chunk_len); |
241 | return; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | spi_message_init(&m); | 244 | spi_message_init(&m); |
@@ -256,10 +256,12 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, | |||
256 | buf += chunk_len; | 256 | buf += chunk_len; |
257 | len -= chunk_len; | 257 | len -= chunk_len; |
258 | } | 258 | } |
259 | |||
260 | return 0; | ||
259 | } | 261 | } |
260 | 262 | ||
261 | static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf, | 263 | static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, |
262 | size_t len, bool fixed) | 264 | void *buf, size_t len, bool fixed) |
263 | { | 265 | { |
264 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); | 266 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
265 | struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; | 267 | struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; |
@@ -304,6 +306,8 @@ static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf, | |||
304 | } | 306 | } |
305 | 307 | ||
306 | spi_sync(to_spi_device(glue->dev), &m); | 308 | spi_sync(to_spi_device(glue->dev), &m); |
309 | |||
310 | return 0; | ||
307 | } | 311 | } |
308 | 312 | ||
309 | static struct wl1271_if_operations spi_ops = { | 313 | static struct wl1271_if_operations spi_ops = { |
diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c index 0e59ea2cdd39..eeb339d61d1e 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ b/drivers/net/wireless/ti/wlcore/testmode.c | |||
@@ -108,6 +108,20 @@ static int wl1271_tm_cmd_test(struct wl1271 *wl, struct nlattr *tb[]) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | if (answer) { | 110 | if (answer) { |
111 | /* If we got bip calibration answer print radio status */ | ||
112 | struct wl1271_cmd_cal_p2g *params = | ||
113 | (struct wl1271_cmd_cal_p2g *) buf; | ||
114 | |||
115 | s16 radio_status = (s16) le16_to_cpu(params->radio_status); | ||
116 | |||
117 | if (params->test.id == TEST_CMD_P2G_CAL && | ||
118 | radio_status < 0) | ||
119 | wl1271_warning("testmode cmd: radio status=%d", | ||
120 | radio_status); | ||
121 | else | ||
122 | wl1271_info("testmode cmd: radio status=%d", | ||
123 | radio_status); | ||
124 | |||
111 | len = nla_total_size(buf_len); | 125 | len = nla_total_size(buf_len); |
112 | skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len); | 126 | skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len); |
113 | if (!skb) { | 127 | if (!skb) { |
diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c index 9273fdb3aaec..8038a5026933 100644 --- a/drivers/net/wireless/ti/wlcore/tx.c +++ b/drivers/net/wireless/ti/wlcore/tx.c | |||
@@ -305,11 +305,15 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
305 | if (is_dummy || !wlvif) | 305 | if (is_dummy || !wlvif) |
306 | rate_idx = 0; | 306 | rate_idx = 0; |
307 | else if (wlvif->bss_type != BSS_TYPE_AP_BSS) { | 307 | else if (wlvif->bss_type != BSS_TYPE_AP_BSS) { |
308 | /* if the packets are destined for AP (have a STA entry) | 308 | /* |
309 | send them with AP rate policies, otherwise use default | 309 | * if the packets are destined for AP (have a STA entry) |
310 | basic rates */ | 310 | * send them with AP rate policies (EAPOLs are an exception), |
311 | * otherwise use default basic rates | ||
312 | */ | ||
311 | if (control->flags & IEEE80211_TX_CTL_NO_CCK_RATE) | 313 | if (control->flags & IEEE80211_TX_CTL_NO_CCK_RATE) |
312 | rate_idx = wlvif->sta.p2p_rate_idx; | 314 | rate_idx = wlvif->sta.p2p_rate_idx; |
315 | else if (skb->protocol == cpu_to_be16(ETH_P_PAE)) | ||
316 | rate_idx = wlvif->sta.basic_rate_idx; | ||
313 | else if (control->control.sta) | 317 | else if (control->control.sta) |
314 | rate_idx = wlvif->sta.ap_rate_idx; | 318 | rate_idx = wlvif->sta.ap_rate_idx; |
315 | else | 319 | else |
@@ -348,8 +352,10 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
348 | bool is_dummy; | 352 | bool is_dummy; |
349 | bool is_gem = false; | 353 | bool is_gem = false; |
350 | 354 | ||
351 | if (!skb) | 355 | if (!skb) { |
356 | wl1271_error("discarding null skb"); | ||
352 | return -EINVAL; | 357 | return -EINVAL; |
358 | } | ||
353 | 359 | ||
354 | info = IEEE80211_SKB_CB(skb); | 360 | info = IEEE80211_SKB_CB(skb); |
355 | 361 | ||
@@ -658,7 +664,17 @@ void wl12xx_rearm_rx_streaming(struct wl1271 *wl, unsigned long *active_hlids) | |||
658 | } | 664 | } |
659 | } | 665 | } |
660 | 666 | ||
661 | void wl1271_tx_work_locked(struct wl1271 *wl) | 667 | /* |
668 | * Returns failure values only in case of failed bus ops within this function. | ||
669 | * wl1271_prepare_tx_frame retvals won't be returned in order to avoid | ||
670 | * triggering recovery by higher layers when not necessary. | ||
671 | * In case a FW command fails within wl1271_prepare_tx_frame fails a recovery | ||
672 | * will be queued in wl1271_cmd_send. -EAGAIN/-EBUSY from prepare_tx_frame | ||
673 | * can occur and are legitimate so don't propagate. -EINVAL will emit a WARNING | ||
674 | * within prepare_tx_frame code but there's nothing we should do about those | ||
675 | * as well. | ||
676 | */ | ||
677 | int wlcore_tx_work_locked(struct wl1271 *wl) | ||
662 | { | 678 | { |
663 | struct wl12xx_vif *wlvif; | 679 | struct wl12xx_vif *wlvif; |
664 | struct sk_buff *skb; | 680 | struct sk_buff *skb; |
@@ -666,10 +682,11 @@ void wl1271_tx_work_locked(struct wl1271 *wl) | |||
666 | u32 buf_offset = 0, last_len = 0; | 682 | u32 buf_offset = 0, last_len = 0; |
667 | bool sent_packets = false; | 683 | bool sent_packets = false; |
668 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; | 684 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; |
669 | int ret; | 685 | int ret = 0; |
686 | int bus_ret = 0; | ||
670 | 687 | ||
671 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 688 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
672 | return; | 689 | return 0; |
673 | 690 | ||
674 | while ((skb = wl1271_skb_dequeue(wl))) { | 691 | while ((skb = wl1271_skb_dequeue(wl))) { |
675 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 692 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -690,8 +707,11 @@ void wl1271_tx_work_locked(struct wl1271 *wl) | |||
690 | 707 | ||
691 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, | 708 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, |
692 | last_len); | 709 | last_len); |
693 | wlcore_write_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, | 710 | bus_ret = wlcore_write_data(wl, REG_SLV_MEM_DATA, |
694 | buf_offset, true); | 711 | wl->aggr_buf, buf_offset, true); |
712 | if (bus_ret < 0) | ||
713 | goto out; | ||
714 | |||
695 | sent_packets = true; | 715 | sent_packets = true; |
696 | buf_offset = 0; | 716 | buf_offset = 0; |
697 | continue; | 717 | continue; |
@@ -727,8 +747,11 @@ void wl1271_tx_work_locked(struct wl1271 *wl) | |||
727 | out_ack: | 747 | out_ack: |
728 | if (buf_offset) { | 748 | if (buf_offset) { |
729 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, last_len); | 749 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, last_len); |
730 | wlcore_write_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, | 750 | bus_ret = wlcore_write_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, |
731 | buf_offset, true); | 751 | buf_offset, true); |
752 | if (bus_ret < 0) | ||
753 | goto out; | ||
754 | |||
732 | sent_packets = true; | 755 | sent_packets = true; |
733 | } | 756 | } |
734 | if (sent_packets) { | 757 | if (sent_packets) { |
@@ -736,13 +759,19 @@ out_ack: | |||
736 | * Interrupt the firmware with the new packets. This is only | 759 | * Interrupt the firmware with the new packets. This is only |
737 | * required for older hardware revisions | 760 | * required for older hardware revisions |
738 | */ | 761 | */ |
739 | if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) | 762 | if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) { |
740 | wl1271_write32(wl, WL12XX_HOST_WR_ACCESS, | 763 | bus_ret = wlcore_write32(wl, WL12XX_HOST_WR_ACCESS, |
741 | wl->tx_packets_count); | 764 | wl->tx_packets_count); |
765 | if (bus_ret < 0) | ||
766 | goto out; | ||
767 | } | ||
742 | 768 | ||
743 | wl1271_handle_tx_low_watermark(wl); | 769 | wl1271_handle_tx_low_watermark(wl); |
744 | } | 770 | } |
745 | wl12xx_rearm_rx_streaming(wl, active_hlids); | 771 | wl12xx_rearm_rx_streaming(wl, active_hlids); |
772 | |||
773 | out: | ||
774 | return bus_ret; | ||
746 | } | 775 | } |
747 | 776 | ||
748 | void wl1271_tx_work(struct work_struct *work) | 777 | void wl1271_tx_work(struct work_struct *work) |
@@ -755,7 +784,11 @@ void wl1271_tx_work(struct work_struct *work) | |||
755 | if (ret < 0) | 784 | if (ret < 0) |
756 | goto out; | 785 | goto out; |
757 | 786 | ||
758 | wl1271_tx_work_locked(wl); | 787 | ret = wlcore_tx_work_locked(wl); |
788 | if (ret < 0) { | ||
789 | wl12xx_queue_recovery_work(wl); | ||
790 | goto out; | ||
791 | } | ||
759 | 792 | ||
760 | wl1271_ps_elp_sleep(wl); | 793 | wl1271_ps_elp_sleep(wl); |
761 | out: | 794 | out: |
@@ -877,21 +910,27 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl, | |||
877 | } | 910 | } |
878 | 911 | ||
879 | /* Called upon reception of a TX complete interrupt */ | 912 | /* Called upon reception of a TX complete interrupt */ |
880 | void wl1271_tx_complete(struct wl1271 *wl) | 913 | int wlcore_tx_complete(struct wl1271 *wl) |
881 | { | 914 | { |
882 | struct wl1271_acx_mem_map *memmap = wl->target_mem_map; | 915 | struct wl1271_acx_mem_map *memmap = wl->target_mem_map; |
883 | u32 count, fw_counter; | 916 | u32 count, fw_counter; |
884 | u32 i; | 917 | u32 i; |
918 | int ret; | ||
885 | 919 | ||
886 | /* read the tx results from the chipset */ | 920 | /* read the tx results from the chipset */ |
887 | wl1271_read(wl, le32_to_cpu(memmap->tx_result), | 921 | ret = wlcore_read(wl, le32_to_cpu(memmap->tx_result), |
888 | wl->tx_res_if, sizeof(*wl->tx_res_if), false); | 922 | wl->tx_res_if, sizeof(*wl->tx_res_if), false); |
923 | if (ret < 0) | ||
924 | goto out; | ||
925 | |||
889 | fw_counter = le32_to_cpu(wl->tx_res_if->tx_result_fw_counter); | 926 | fw_counter = le32_to_cpu(wl->tx_res_if->tx_result_fw_counter); |
890 | 927 | ||
891 | /* write host counter to chipset (to ack) */ | 928 | /* write host counter to chipset (to ack) */ |
892 | wl1271_write32(wl, le32_to_cpu(memmap->tx_result) + | 929 | ret = wlcore_write32(wl, le32_to_cpu(memmap->tx_result) + |
893 | offsetof(struct wl1271_tx_hw_res_if, | 930 | offsetof(struct wl1271_tx_hw_res_if, |
894 | tx_result_host_counter), fw_counter); | 931 | tx_result_host_counter), fw_counter); |
932 | if (ret < 0) | ||
933 | goto out; | ||
895 | 934 | ||
896 | count = fw_counter - wl->tx_results_count; | 935 | count = fw_counter - wl->tx_results_count; |
897 | wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); | 936 | wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); |
@@ -911,8 +950,11 @@ void wl1271_tx_complete(struct wl1271 *wl) | |||
911 | 950 | ||
912 | wl->tx_results_count++; | 951 | wl->tx_results_count++; |
913 | } | 952 | } |
953 | |||
954 | out: | ||
955 | return ret; | ||
914 | } | 956 | } |
915 | EXPORT_SYMBOL(wl1271_tx_complete); | 957 | EXPORT_SYMBOL(wlcore_tx_complete); |
916 | 958 | ||
917 | void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid) | 959 | void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid) |
918 | { | 960 | { |
diff --git a/drivers/net/wireless/ti/wlcore/tx.h b/drivers/net/wireless/ti/wlcore/tx.h index fa4be1b91135..1e939b016155 100644 --- a/drivers/net/wireless/ti/wlcore/tx.h +++ b/drivers/net/wireless/ti/wlcore/tx.h | |||
@@ -234,8 +234,8 @@ static inline int wl1271_tx_total_queue_count(struct wl1271 *wl) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | void wl1271_tx_work(struct work_struct *work); | 236 | void wl1271_tx_work(struct work_struct *work); |
237 | void wl1271_tx_work_locked(struct wl1271 *wl); | 237 | int wlcore_tx_work_locked(struct wl1271 *wl); |
238 | void wl1271_tx_complete(struct wl1271 *wl); | 238 | int wlcore_tx_complete(struct wl1271 *wl); |
239 | void wl12xx_tx_reset_wlvif(struct wl1271 *wl, struct wl12xx_vif *wlvif); | 239 | void wl12xx_tx_reset_wlvif(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
240 | void wl12xx_tx_reset(struct wl1271 *wl); | 240 | void wl12xx_tx_reset(struct wl1271 *wl); |
241 | void wl1271_tx_flush(struct wl1271 *wl); | 241 | void wl1271_tx_flush(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 761a72f4b8d1..e796974df59b 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
@@ -41,9 +41,9 @@ struct wlcore_ops { | |||
41 | int (*identify_fw)(struct wl1271 *wl); | 41 | int (*identify_fw)(struct wl1271 *wl); |
42 | int (*boot)(struct wl1271 *wl); | 42 | int (*boot)(struct wl1271 *wl); |
43 | int (*plt_init)(struct wl1271 *wl); | 43 | int (*plt_init)(struct wl1271 *wl); |
44 | void (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr, | 44 | int (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr, |
45 | void *buf, size_t len); | 45 | void *buf, size_t len); |
46 | void (*ack_event)(struct wl1271 *wl); | 46 | int (*ack_event)(struct wl1271 *wl); |
47 | u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks); | 47 | u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks); |
48 | void (*set_tx_desc_blocks)(struct wl1271 *wl, | 48 | void (*set_tx_desc_blocks)(struct wl1271 *wl, |
49 | struct wl1271_tx_hw_descr *desc, | 49 | struct wl1271_tx_hw_descr *desc, |
@@ -53,17 +53,17 @@ struct wlcore_ops { | |||
53 | struct sk_buff *skb); | 53 | struct sk_buff *skb); |
54 | enum wl_rx_buf_align (*get_rx_buf_align)(struct wl1271 *wl, | 54 | enum wl_rx_buf_align (*get_rx_buf_align)(struct wl1271 *wl, |
55 | u32 rx_desc); | 55 | u32 rx_desc); |
56 | void (*prepare_read)(struct wl1271 *wl, u32 rx_desc, u32 len); | 56 | int (*prepare_read)(struct wl1271 *wl, u32 rx_desc, u32 len); |
57 | u32 (*get_rx_packet_len)(struct wl1271 *wl, void *rx_data, | 57 | u32 (*get_rx_packet_len)(struct wl1271 *wl, void *rx_data, |
58 | u32 data_len); | 58 | u32 data_len); |
59 | void (*tx_delayed_compl)(struct wl1271 *wl); | 59 | int (*tx_delayed_compl)(struct wl1271 *wl); |
60 | void (*tx_immediate_compl)(struct wl1271 *wl); | 60 | void (*tx_immediate_compl)(struct wl1271 *wl); |
61 | int (*hw_init)(struct wl1271 *wl); | 61 | int (*hw_init)(struct wl1271 *wl); |
62 | int (*init_vif)(struct wl1271 *wl, struct wl12xx_vif *wlvif); | 62 | int (*init_vif)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
63 | u32 (*sta_get_ap_rate_mask)(struct wl1271 *wl, | 63 | u32 (*sta_get_ap_rate_mask)(struct wl1271 *wl, |
64 | struct wl12xx_vif *wlvif); | 64 | struct wl12xx_vif *wlvif); |
65 | s8 (*get_pg_ver)(struct wl1271 *wl); | 65 | int (*get_pg_ver)(struct wl1271 *wl, s8 *ver); |
66 | void (*get_mac)(struct wl1271 *wl); | 66 | int (*get_mac)(struct wl1271 *wl); |
67 | void (*set_tx_desc_csum)(struct wl1271 *wl, | 67 | void (*set_tx_desc_csum)(struct wl1271 *wl, |
68 | struct wl1271_tx_hw_descr *desc, | 68 | struct wl1271_tx_hw_descr *desc, |
69 | struct sk_buff *skb); | 69 | struct sk_buff *skb); |
@@ -387,6 +387,9 @@ struct wl1271 { | |||
387 | 387 | ||
388 | /* mutex for protecting the tx_flush function */ | 388 | /* mutex for protecting the tx_flush function */ |
389 | struct mutex flush_mutex; | 389 | struct mutex flush_mutex; |
390 | |||
391 | /* sleep auth value currently configured to FW */ | ||
392 | int sleep_auth; | ||
390 | }; | 393 | }; |
391 | 394 | ||
392 | int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); | 395 | int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); |
@@ -398,6 +401,13 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, | |||
398 | struct ieee80211_sta *sta, | 401 | struct ieee80211_sta *sta, |
399 | struct ieee80211_key_conf *key_conf); | 402 | struct ieee80211_key_conf *key_conf); |
400 | 403 | ||
404 | static inline void | ||
405 | wlcore_set_ht_cap(struct wl1271 *wl, enum ieee80211_band band, | ||
406 | struct ieee80211_sta_ht_cap *ht_cap) | ||
407 | { | ||
408 | memcpy(&wl->ht_cap[band], ht_cap, sizeof(*ht_cap)); | ||
409 | } | ||
410 | |||
401 | /* Firmware image load chunk size */ | 411 | /* Firmware image load chunk size */ |
402 | #define CHUNK_SIZE 16384 | 412 | #define CHUNK_SIZE 16384 |
403 | 413 | ||
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h index 8260b1e9288a..4273a21cdde1 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h | |||
@@ -209,10 +209,10 @@ struct wl1271_scan { | |||
209 | }; | 209 | }; |
210 | 210 | ||
211 | struct wl1271_if_operations { | 211 | struct wl1271_if_operations { |
212 | void (*read)(struct device *child, int addr, void *buf, size_t len, | 212 | int __must_check (*read)(struct device *child, int addr, void *buf, |
213 | bool fixed); | 213 | size_t len, bool fixed); |
214 | void (*write)(struct device *child, int addr, void *buf, size_t len, | 214 | int __must_check (*write)(struct device *child, int addr, void *buf, |
215 | bool fixed); | 215 | size_t len, bool fixed); |
216 | void (*reset)(struct device *child); | 216 | void (*reset)(struct device *child); |
217 | void (*init)(struct device *child); | 217 | void (*init)(struct device *child); |
218 | int (*power)(struct device *child, bool enable); | 218 | int (*power)(struct device *child, bool enable); |
@@ -247,6 +247,7 @@ enum wl12xx_flags { | |||
247 | WL1271_FLAG_RECOVERY_IN_PROGRESS, | 247 | WL1271_FLAG_RECOVERY_IN_PROGRESS, |
248 | WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, | 248 | WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, |
249 | WL1271_FLAG_INTENDED_FW_RECOVERY, | 249 | WL1271_FLAG_INTENDED_FW_RECOVERY, |
250 | WL1271_FLAG_SDIO_FAILED, | ||
250 | }; | 251 | }; |
251 | 252 | ||
252 | enum wl12xx_vif_flags { | 253 | enum wl12xx_vif_flags { |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 8deaf6d050c3..12334f9190cb 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -70,6 +70,13 @@ struct bcma_host_ops { | |||
70 | 70 | ||
71 | /* Core-ID values. */ | 71 | /* Core-ID values. */ |
72 | #define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ | 72 | #define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ |
73 | #define BCMA_CORE_4706_CHIPCOMMON 0x500 | ||
74 | #define BCMA_CORE_4706_SOC_RAM 0x50E | ||
75 | #define BCMA_CORE_4706_MAC_GBIT 0x52D | ||
76 | #define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */ | ||
77 | #define BCMA_CORE_ALTA 0x534 /* I2S core */ | ||
78 | #define BCMA_CORE_4706_MAC_GBIT_COMMON 0x5DC | ||
79 | #define BCMA_CORE_DDR23_PHY 0x5DD | ||
73 | #define BCMA_CORE_INVALID 0x700 | 80 | #define BCMA_CORE_INVALID 0x700 |
74 | #define BCMA_CORE_CHIPCOMMON 0x800 | 81 | #define BCMA_CORE_CHIPCOMMON 0x800 |
75 | #define BCMA_CORE_ILINE20 0x801 | 82 | #define BCMA_CORE_ILINE20 0x801 |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index ce9af8918514..318fc1f705b1 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -568,6 +568,26 @@ struct ieee80211s_hdr { | |||
568 | #define MESH_FLAGS_PS_DEEP 0x4 | 568 | #define MESH_FLAGS_PS_DEEP 0x4 |
569 | 569 | ||
570 | /** | 570 | /** |
571 | * enum ieee80211_preq_flags - mesh PREQ element flags | ||
572 | * | ||
573 | * @IEEE80211_PREQ_PROACTIVE_PREP_FLAG: proactive PREP subfield | ||
574 | */ | ||
575 | enum ieee80211_preq_flags { | ||
576 | IEEE80211_PREQ_PROACTIVE_PREP_FLAG = 1<<2, | ||
577 | }; | ||
578 | |||
579 | /** | ||
580 | * enum ieee80211_preq_target_flags - mesh PREQ element per target flags | ||
581 | * | ||
582 | * @IEEE80211_PREQ_TO_FLAG: target only subfield | ||
583 | * @IEEE80211_PREQ_USN_FLAG: unknown target HWMP sequence number subfield | ||
584 | */ | ||
585 | enum ieee80211_preq_target_flags { | ||
586 | IEEE80211_PREQ_TO_FLAG = 1<<0, | ||
587 | IEEE80211_PREQ_USN_FLAG = 1<<2, | ||
588 | }; | ||
589 | |||
590 | /** | ||
571 | * struct ieee80211_quiet_ie | 591 | * struct ieee80211_quiet_ie |
572 | * | 592 | * |
573 | * This structure refers to "Quiet information element" | 593 | * This structure refers to "Quiet information element" |
@@ -1443,7 +1463,7 @@ enum ieee80211_tdls_actioncode { | |||
1443 | * | 1463 | * |
1444 | * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method | 1464 | * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method |
1445 | * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method | 1465 | * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method |
1446 | * that will be specified in a vendor specific information element | 1466 | * that will be specified in a vendor specific information element |
1447 | */ | 1467 | */ |
1448 | enum { | 1468 | enum { |
1449 | IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1, | 1469 | IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1, |
@@ -1455,7 +1475,7 @@ enum { | |||
1455 | * | 1475 | * |
1456 | * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol | 1476 | * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol |
1457 | * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will | 1477 | * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will |
1458 | * be specified in a vendor specific information element | 1478 | * be specified in a vendor specific information element |
1459 | */ | 1479 | */ |
1460 | enum { | 1480 | enum { |
1461 | IEEE80211_PATH_PROTOCOL_HWMP = 1, | 1481 | IEEE80211_PATH_PROTOCOL_HWMP = 1, |
@@ -1467,13 +1487,35 @@ enum { | |||
1467 | * | 1487 | * |
1468 | * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric | 1488 | * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric |
1469 | * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be | 1489 | * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be |
1470 | * specified in a vendor specific information element | 1490 | * specified in a vendor specific information element |
1471 | */ | 1491 | */ |
1472 | enum { | 1492 | enum { |
1473 | IEEE80211_PATH_METRIC_AIRTIME = 1, | 1493 | IEEE80211_PATH_METRIC_AIRTIME = 1, |
1474 | IEEE80211_PATH_METRIC_VENDOR = 255, | 1494 | IEEE80211_PATH_METRIC_VENDOR = 255, |
1475 | }; | 1495 | }; |
1476 | 1496 | ||
1497 | /** | ||
1498 | * enum ieee80211_root_mode_identifier - root mesh STA mode identifier | ||
1499 | * | ||
1500 | * These attribute are used by dot11MeshHWMPRootMode to set root mesh STA mode | ||
1501 | * | ||
1502 | * @IEEE80211_ROOTMODE_NO_ROOT: the mesh STA is not a root mesh STA (default) | ||
1503 | * @IEEE80211_ROOTMODE_ROOT: the mesh STA is a root mesh STA if greater than | ||
1504 | * this value | ||
1505 | * @IEEE80211_PROACTIVE_PREQ_NO_PREP: the mesh STA is a root mesh STA supports | ||
1506 | * the proactive PREQ with proactive PREP subfield set to 0 | ||
1507 | * @IEEE80211_PROACTIVE_PREQ_WITH_PREP: the mesh STA is a root mesh STA | ||
1508 | * supports the proactive PREQ with proactive PREP subfield set to 1 | ||
1509 | * @IEEE80211_PROACTIVE_RANN: the mesh STA is a root mesh STA supports | ||
1510 | * the proactive RANN | ||
1511 | */ | ||
1512 | enum ieee80211_root_mode_identifier { | ||
1513 | IEEE80211_ROOTMODE_NO_ROOT = 0, | ||
1514 | IEEE80211_ROOTMODE_ROOT = 1, | ||
1515 | IEEE80211_PROACTIVE_PREQ_NO_PREP = 2, | ||
1516 | IEEE80211_PROACTIVE_PREQ_WITH_PREP = 3, | ||
1517 | IEEE80211_PROACTIVE_RANN = 4, | ||
1518 | }; | ||
1477 | 1519 | ||
1478 | /* | 1520 | /* |
1479 | * IEEE 802.11-2007 7.3.2.9 Country information element | 1521 | * IEEE 802.11-2007 7.3.2.9 Country information element |
@@ -1589,6 +1631,10 @@ enum ieee80211_sa_query_action { | |||
1589 | 1631 | ||
1590 | #define WLAN_OUI_WFA 0x506f9a | 1632 | #define WLAN_OUI_WFA 0x506f9a |
1591 | #define WLAN_OUI_TYPE_WFA_P2P 9 | 1633 | #define WLAN_OUI_TYPE_WFA_P2P 9 |
1634 | #define WLAN_OUI_MICROSOFT 0x0050f2 | ||
1635 | #define WLAN_OUI_TYPE_MICROSOFT_WPA 1 | ||
1636 | #define WLAN_OUI_TYPE_MICROSOFT_WMM 2 | ||
1637 | #define WLAN_OUI_TYPE_MICROSOFT_WPS 4 | ||
1592 | 1638 | ||
1593 | /* | 1639 | /* |
1594 | * WMM/802.11e Tspec Element | 1640 | * WMM/802.11e Tspec Element |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 970afdf5a605..c0fc5d277338 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -277,6 +277,12 @@ | |||
277 | * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to | 277 | * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to |
278 | * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) | 278 | * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) |
279 | * | 279 | * |
280 | * @NL80211_CMD_SET_PMKSA: Add a PMKSA cache entry, using %NL80211_ATTR_MAC | ||
281 | * (for the BSSID) and %NL80211_ATTR_PMKID. | ||
282 | * @NL80211_CMD_DEL_PMKSA: Delete a PMKSA cache entry, using %NL80211_ATTR_MAC | ||
283 | * (for the BSSID) and %NL80211_ATTR_PMKID. | ||
284 | * @NL80211_CMD_FLUSH_PMKSA: Flush all PMKSA cache entries. | ||
285 | * | ||
280 | * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain | 286 | * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain |
281 | * has been changed and provides details of the request information | 287 | * has been changed and provides details of the request information |
282 | * that caused the change such as who initiated the regulatory request | 288 | * that caused the change such as who initiated the regulatory request |
@@ -456,6 +462,10 @@ | |||
456 | * the frame. | 462 | * the frame. |
457 | * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for | 463 | * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for |
458 | * backward compatibility. | 464 | * backward compatibility. |
465 | * | ||
466 | * @NL80211_CMD_SET_POWER_SAVE: Set powersave, using %NL80211_ATTR_PS_STATE | ||
467 | * @NL80211_CMD_GET_POWER_SAVE: Get powersave status in %NL80211_ATTR_PS_STATE | ||
468 | * | ||
459 | * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command | 469 | * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command |
460 | * is used to configure connection quality monitoring notification trigger | 470 | * is used to configure connection quality monitoring notification trigger |
461 | * levels. | 471 | * levels. |
@@ -771,6 +781,13 @@ enum nl80211_commands { | |||
771 | * section 7.3.2.25.1, e.g. 0x000FAC04) | 781 | * section 7.3.2.25.1, e.g. 0x000FAC04) |
772 | * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and | 782 | * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and |
773 | * CCMP keys, each six bytes in little endian | 783 | * CCMP keys, each six bytes in little endian |
784 | * @NL80211_ATTR_KEY_DEFAULT: Flag attribute indicating the key is default key | ||
785 | * @NL80211_ATTR_KEY_DEFAULT_MGMT: Flag attribute indicating the key is the | ||
786 | * default management key | ||
787 | * @NL80211_ATTR_CIPHER_SUITES_PAIRWISE: For crypto settings for connect or | ||
788 | * other commands, indicates which pairwise cipher suites are used | ||
789 | * @NL80211_ATTR_CIPHER_SUITE_GROUP: For crypto settings for connect or | ||
790 | * other commands, indicates which group cipher suite is used | ||
774 | * | 791 | * |
775 | * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU | 792 | * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU |
776 | * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing | 793 | * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing |
@@ -1006,6 +1023,8 @@ enum nl80211_commands { | |||
1006 | * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was | 1023 | * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was |
1007 | * acknowledged by the recipient. | 1024 | * acknowledged by the recipient. |
1008 | * | 1025 | * |
1026 | * @NL80211_ATTR_PS_STATE: powersave state, using &enum nl80211_ps_state values. | ||
1027 | * | ||
1009 | * @NL80211_ATTR_CQM: connection quality monitor configuration in a | 1028 | * @NL80211_ATTR_CQM: connection quality monitor configuration in a |
1010 | * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. | 1029 | * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. |
1011 | * | 1030 | * |
@@ -1063,7 +1082,7 @@ enum nl80211_commands { | |||
1063 | * flag isn't set, the frame will be rejected. This is also used as an | 1082 | * flag isn't set, the frame will be rejected. This is also used as an |
1064 | * nl80211 capability flag. | 1083 | * nl80211 capability flag. |
1065 | * | 1084 | * |
1066 | * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16) | 1085 | * @NL80211_ATTR_BSS_HT_OPMODE: HT operation mode (u16) |
1067 | * | 1086 | * |
1068 | * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags | 1087 | * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags |
1069 | * attributes, specifying what a key should be set as default as. | 1088 | * attributes, specifying what a key should be set as default as. |
@@ -1087,10 +1106,10 @@ enum nl80211_commands { | |||
1087 | * indicate which WoW triggers should be enabled. This is also | 1106 | * indicate which WoW triggers should be enabled. This is also |
1088 | * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN | 1107 | * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN |
1089 | * triggers. | 1108 | * triggers. |
1090 | 1109 | * | |
1091 | * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan | 1110 | * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan |
1092 | * cycles, in msecs. | 1111 | * cycles, in msecs. |
1093 | 1112 | * | |
1094 | * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more | 1113 | * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more |
1095 | * sets of attributes to match during scheduled scans. Only BSSs | 1114 | * sets of attributes to match during scheduled scans. Only BSSs |
1096 | * that match any of the sets will be reported. These are | 1115 | * that match any of the sets will be reported. These are |
@@ -1117,7 +1136,7 @@ enum nl80211_commands { | |||
1117 | * are managed in software: interfaces of these types aren't subject to | 1136 | * are managed in software: interfaces of these types aren't subject to |
1118 | * any restrictions in their number or combinations. | 1137 | * any restrictions in their number or combinations. |
1119 | * | 1138 | * |
1120 | * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information | 1139 | * @NL80211_ATTR_REKEY_DATA: nested attribute containing the information |
1121 | * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. | 1140 | * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. |
1122 | * | 1141 | * |
1123 | * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, | 1142 | * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, |
@@ -1184,7 +1203,6 @@ enum nl80211_commands { | |||
1184 | * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from | 1203 | * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from |
1185 | * &enum nl80211_feature_flags and is advertised in wiphy information. | 1204 | * &enum nl80211_feature_flags and is advertised in wiphy information. |
1186 | * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe | 1205 | * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe |
1187 | * | ||
1188 | * requests while operating in AP-mode. | 1206 | * requests while operating in AP-mode. |
1189 | * This attribute holds a bitmap of the supported protocols for | 1207 | * This attribute holds a bitmap of the supported protocols for |
1190 | * offloading (see &enum nl80211_probe_resp_offload_support_attr). | 1208 | * offloading (see &enum nl80211_probe_resp_offload_support_attr). |
@@ -1524,6 +1542,9 @@ enum nl80211_attrs { | |||
1524 | 1542 | ||
1525 | #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 | 1543 | #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 |
1526 | 1544 | ||
1545 | /* default RSSI threshold for scan results if none specified. */ | ||
1546 | #define NL80211_SCAN_RSSI_THOLD_OFF -300 | ||
1547 | |||
1527 | /** | 1548 | /** |
1528 | * enum nl80211_iftype - (virtual) interface types | 1549 | * enum nl80211_iftype - (virtual) interface types |
1529 | * | 1550 | * |
@@ -1956,6 +1977,8 @@ enum nl80211_reg_rule_attr { | |||
1956 | * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved | 1977 | * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved |
1957 | * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, | 1978 | * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, |
1958 | * only report BSS with matching SSID. | 1979 | * only report BSS with matching SSID. |
1980 | * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a | ||
1981 | * BSS in scan results. Filtering is turned off if not specified. | ||
1959 | * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter | 1982 | * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter |
1960 | * attribute number currently defined | 1983 | * attribute number currently defined |
1961 | * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use | 1984 | * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use |
@@ -1963,7 +1986,8 @@ enum nl80211_reg_rule_attr { | |||
1963 | enum nl80211_sched_scan_match_attr { | 1986 | enum nl80211_sched_scan_match_attr { |
1964 | __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, | 1987 | __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, |
1965 | 1988 | ||
1966 | NL80211_ATTR_SCHED_SCAN_MATCH_SSID, | 1989 | NL80211_SCHED_SCAN_MATCH_ATTR_SSID, |
1990 | NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, | ||
1967 | 1991 | ||
1968 | /* keep last */ | 1992 | /* keep last */ |
1969 | __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, | 1993 | __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, |
@@ -1971,6 +1995,9 @@ enum nl80211_sched_scan_match_attr { | |||
1971 | __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 | 1995 | __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 |
1972 | }; | 1996 | }; |
1973 | 1997 | ||
1998 | /* only for backward compatibility */ | ||
1999 | #define NL80211_ATTR_SCHED_SCAN_MATCH_SSID NL80211_SCHED_SCAN_MATCH_ATTR_SSID | ||
2000 | |||
1974 | /** | 2001 | /** |
1975 | * enum nl80211_reg_rule_flags - regulatory rule flags | 2002 | * enum nl80211_reg_rule_flags - regulatory rule flags |
1976 | * | 2003 | * |
@@ -2090,78 +2117,91 @@ enum nl80211_mntr_flags { | |||
2090 | * @__NL80211_MESHCONF_INVALID: internal use | 2117 | * @__NL80211_MESHCONF_INVALID: internal use |
2091 | * | 2118 | * |
2092 | * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in | 2119 | * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in |
2093 | * millisecond units, used by the Peer Link Open message | 2120 | * millisecond units, used by the Peer Link Open message |
2094 | * | 2121 | * |
2095 | * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in | 2122 | * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in |
2096 | * millisecond units, used by the peer link management to close a peer link | 2123 | * millisecond units, used by the peer link management to close a peer link |
2097 | * | 2124 | * |
2098 | * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in | 2125 | * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in |
2099 | * millisecond units | 2126 | * millisecond units |
2100 | * | 2127 | * |
2101 | * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed | 2128 | * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed |
2102 | * on this mesh interface | 2129 | * on this mesh interface |
2103 | * | 2130 | * |
2104 | * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link | 2131 | * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link |
2105 | * open retries that can be sent to establish a new peer link instance in a | 2132 | * open retries that can be sent to establish a new peer link instance in a |
2106 | * mesh | 2133 | * mesh |
2107 | * | 2134 | * |
2108 | * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh | 2135 | * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh |
2109 | * point. | 2136 | * point. |
2110 | * | 2137 | * |
2111 | * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically | 2138 | * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically |
2112 | * open peer links when we detect compatible mesh peers. | 2139 | * open peer links when we detect compatible mesh peers. |
2113 | * | 2140 | * |
2114 | * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames | 2141 | * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames |
2115 | * containing a PREQ that an MP can send to a particular destination (path | 2142 | * containing a PREQ that an MP can send to a particular destination (path |
2116 | * target) | 2143 | * target) |
2117 | * | 2144 | * |
2118 | * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths | 2145 | * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths |
2119 | * (in milliseconds) | 2146 | * (in milliseconds) |
2120 | * | 2147 | * |
2121 | * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait | 2148 | * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait |
2122 | * until giving up on a path discovery (in milliseconds) | 2149 | * until giving up on a path discovery (in milliseconds) |
2123 | * | 2150 | * |
2124 | * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh | 2151 | * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh |
2125 | * points receiving a PREQ shall consider the forwarding information from the | 2152 | * points receiving a PREQ shall consider the forwarding information from |
2126 | * root to be valid. (TU = time unit) | 2153 | * the root to be valid. (TU = time unit) |
2127 | * | 2154 | * |
2128 | * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in | 2155 | * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in |
2129 | * TUs) during which an MP can send only one action frame containing a PREQ | 2156 | * TUs) during which an MP can send only one action frame containing a PREQ |
2130 | * reference element | 2157 | * reference element |
2131 | * | 2158 | * |
2132 | * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) | 2159 | * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) |
2133 | * that it takes for an HWMP information element to propagate across the mesh | 2160 | * that it takes for an HWMP information element to propagate across the |
2161 | * mesh | ||
2134 | * | 2162 | * |
2135 | * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not | 2163 | * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not |
2136 | * | 2164 | * |
2137 | * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a | 2165 | * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a |
2138 | * source mesh point for path selection elements. | 2166 | * source mesh point for path selection elements. |
2139 | * | 2167 | * |
2140 | * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between | 2168 | * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between |
2141 | * root announcements are transmitted. | 2169 | * root announcements are transmitted. |
2142 | * | 2170 | * |
2143 | * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has | 2171 | * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has |
2144 | * access to a broader network beyond the MBSS. This is done via Root | 2172 | * access to a broader network beyond the MBSS. This is done via Root |
2145 | * Announcement frames. | 2173 | * Announcement frames. |
2146 | * | 2174 | * |
2147 | * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in | 2175 | * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in |
2148 | * TUs) during which a mesh STA can send only one Action frame containing a | 2176 | * TUs) during which a mesh STA can send only one Action frame containing a |
2149 | * PERR element. | 2177 | * PERR element. |
2150 | * | 2178 | * |
2151 | * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding | 2179 | * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding |
2152 | * or forwarding entity (default is TRUE - forwarding entity) | 2180 | * or forwarding entity (default is TRUE - forwarding entity) |
2153 | * | 2181 | * |
2154 | * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the | 2182 | * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the |
2155 | * threshold for average signal strength of candidate station to establish | 2183 | * threshold for average signal strength of candidate station to establish |
2156 | * a peer link. | 2184 | * a peer link. |
2157 | * | ||
2158 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | ||
2159 | * | 2185 | * |
2160 | * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors | 2186 | * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors |
2161 | * to synchronize to for 11s default synchronization method (see 11C.12.2.2) | 2187 | * to synchronize to for 11s default synchronization method |
2188 | * (see 11C.12.2.2) | ||
2162 | * | 2189 | * |
2163 | * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode. | 2190 | * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode. |
2164 | * | 2191 | * |
2192 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | ||
2193 | * | ||
2194 | * @NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT: The time (in TUs) for | ||
2195 | * which mesh STAs receiving a proactive PREQ shall consider the forwarding | ||
2196 | * information to the root mesh STA to be valid. | ||
2197 | * | ||
2198 | * @NL80211_MESHCONF_HWMP_ROOT_INTERVAL: The interval of time (in TUs) between | ||
2199 | * proactive PREQs are transmitted. | ||
2200 | * | ||
2201 | * @NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL: The minimum interval of time | ||
2202 | * (in TUs) during which a mesh STA can send only one Action frame | ||
2203 | * containing a PREQ element for root path confirmation. | ||
2204 | * | ||
2165 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 2205 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
2166 | */ | 2206 | */ |
2167 | enum nl80211_meshconf_params { | 2207 | enum nl80211_meshconf_params { |
@@ -2188,6 +2228,9 @@ enum nl80211_meshconf_params { | |||
2188 | NL80211_MESHCONF_RSSI_THRESHOLD, | 2228 | NL80211_MESHCONF_RSSI_THRESHOLD, |
2189 | NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, | 2229 | NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, |
2190 | NL80211_MESHCONF_HT_OPMODE, | 2230 | NL80211_MESHCONF_HT_OPMODE, |
2231 | NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, | ||
2232 | NL80211_MESHCONF_HWMP_ROOT_INTERVAL, | ||
2233 | NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, | ||
2191 | 2234 | ||
2192 | /* keep last */ | 2235 | /* keep last */ |
2193 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 2236 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
@@ -2203,34 +2246,36 @@ enum nl80211_meshconf_params { | |||
2203 | * @__NL80211_MESH_SETUP_INVALID: Internal use | 2246 | * @__NL80211_MESH_SETUP_INVALID: Internal use |
2204 | * | 2247 | * |
2205 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a | 2248 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a |
2206 | * vendor specific path selection algorithm or disable it to use the default | 2249 | * vendor specific path selection algorithm or disable it to use the |
2207 | * HWMP. | 2250 | * default HWMP. |
2208 | * | 2251 | * |
2209 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a | 2252 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a |
2210 | * vendor specific path metric or disable it to use the default Airtime | 2253 | * vendor specific path metric or disable it to use the default Airtime |
2211 | * metric. | 2254 | * metric. |
2212 | * | 2255 | * |
2213 | * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a | 2256 | * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a |
2214 | * robust security network ie, or a vendor specific information element that | 2257 | * robust security network ie, or a vendor specific information element |
2215 | * vendors will use to identify the path selection methods and metrics in use. | 2258 | * that vendors will use to identify the path selection methods and |
2259 | * metrics in use. | ||
2216 | * | 2260 | * |
2217 | * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication | 2261 | * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication |
2218 | * daemon will be authenticating mesh candidates. | 2262 | * daemon will be authenticating mesh candidates. |
2219 | * | 2263 | * |
2220 | * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication | 2264 | * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication |
2221 | * daemon will be securing peer link frames. AMPE is a secured version of Mesh | 2265 | * daemon will be securing peer link frames. AMPE is a secured version of |
2222 | * Peering Management (MPM) and is implemented with the assistance of a | 2266 | * Mesh Peering Management (MPM) and is implemented with the assistance of |
2223 | * userspace daemon. When this flag is set, the kernel will send peer | 2267 | * a userspace daemon. When this flag is set, the kernel will send peer |
2224 | * management frames to a userspace daemon that will implement AMPE | 2268 | * management frames to a userspace daemon that will implement AMPE |
2225 | * functionality (security capabilities selection, key confirmation, and key | 2269 | * functionality (security capabilities selection, key confirmation, and |
2226 | * management). When the flag is unset (default), the kernel can autonomously | 2270 | * key management). When the flag is unset (default), the kernel can |
2227 | * complete (unsecured) mesh peering without the need of a userspace daemon. | 2271 | * autonomously complete (unsecured) mesh peering without the need of a |
2228 | * | 2272 | * userspace daemon. |
2229 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number | ||
2230 | * | 2273 | * |
2231 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a | 2274 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a |
2232 | * vendor specific synchronization method or disable it to use the default | 2275 | * vendor specific synchronization method or disable it to use the default |
2233 | * neighbor offset synchronization | 2276 | * neighbor offset synchronization |
2277 | * | ||
2278 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number | ||
2234 | * | 2279 | * |
2235 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use | 2280 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use |
2236 | */ | 2281 | */ |
@@ -2500,6 +2545,11 @@ enum nl80211_band { | |||
2500 | NL80211_BAND_5GHZ, | 2545 | NL80211_BAND_5GHZ, |
2501 | }; | 2546 | }; |
2502 | 2547 | ||
2548 | /** | ||
2549 | * enum nl80211_ps_state - powersave state | ||
2550 | * @NL80211_PS_DISABLED: powersave is disabled | ||
2551 | * @NL80211_PS_ENABLED: powersave is enabled | ||
2552 | */ | ||
2503 | enum nl80211_ps_state { | 2553 | enum nl80211_ps_state { |
2504 | NL80211_PS_DISABLED, | 2554 | NL80211_PS_DISABLED, |
2505 | NL80211_PS_ENABLED, | 2555 | NL80211_PS_ENABLED, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7319f25250b6..061c01957e54 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -627,10 +627,10 @@ struct sta_bss_parameters { | |||
627 | * @llid: mesh local link id | 627 | * @llid: mesh local link id |
628 | * @plid: mesh peer link id | 628 | * @plid: mesh peer link id |
629 | * @plink_state: mesh peer link state | 629 | * @plink_state: mesh peer link state |
630 | * @signal: the signal strength, type depends on the wiphy's signal_type | 630 | * @signal: The signal strength, type depends on the wiphy's signal_type. |
631 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. | 631 | * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. |
632 | * @signal_avg: avg signal strength, type depends on the wiphy's signal_type | 632 | * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. |
633 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. | 633 | * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. |
634 | * @txrate: current unicast bitrate from this station | 634 | * @txrate: current unicast bitrate from this station |
635 | * @rxrate: current unicast bitrate to this station | 635 | * @rxrate: current unicast bitrate to this station |
636 | * @rx_packets: packets received from this station | 636 | * @rx_packets: packets received from this station |
@@ -790,43 +790,95 @@ struct bss_parameters { | |||
790 | int ht_opmode; | 790 | int ht_opmode; |
791 | }; | 791 | }; |
792 | 792 | ||
793 | /* | 793 | /** |
794 | * struct mesh_config - 802.11s mesh configuration | 794 | * struct mesh_config - 802.11s mesh configuration |
795 | * | 795 | * |
796 | * These parameters can be changed while the mesh is active. | 796 | * These parameters can be changed while the mesh is active. |
797 | * | ||
798 | * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used | ||
799 | * by the Mesh Peering Open message | ||
800 | * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units | ||
801 | * used by the Mesh Peering Open message | ||
802 | * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by | ||
803 | * the mesh peering management to close a mesh peering | ||
804 | * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this | ||
805 | * mesh interface | ||
806 | * @dot11MeshMaxRetries: the maximum number of peer link open retries that can | ||
807 | * be sent to establish a new peer link instance in a mesh | ||
808 | * @dot11MeshTTL: the value of TTL field set at a source mesh STA | ||
809 | * @element_ttl: the value of TTL field set at a mesh STA for path selection | ||
810 | * elements | ||
811 | * @auto_open_plinks: whether we should automatically open peer links when we | ||
812 | * detect compatible mesh peers | ||
813 | * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to | ||
814 | * synchronize to for 11s default synchronization method | ||
815 | * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ | ||
816 | * that an originator mesh STA can send to a particular path target | ||
817 | * @path_refresh_time: how frequently to refresh mesh paths in milliseconds | ||
818 | * @min_discovery_timeout: the minimum length of time to wait until giving up on | ||
819 | * a path discovery in milliseconds | ||
820 | * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs | ||
821 | * receiving a PREQ shall consider the forwarding information from the | ||
822 | * root to be valid. (TU = time unit) | ||
823 | * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during | ||
824 | * which a mesh STA can send only one action frame containing a PREQ | ||
825 | * element | ||
826 | * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during | ||
827 | * which a mesh STA can send only one Action frame containing a PERR | ||
828 | * element | ||
829 | * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that | ||
830 | * it takes for an HWMP information element to propagate across the mesh | ||
831 | * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA | ||
832 | * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root | ||
833 | * announcements are transmitted | ||
834 | * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh | ||
835 | * station has access to a broader network beyond the MBSS. (This is | ||
836 | * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true | ||
837 | * only means that the station will announce others it's a mesh gate, but | ||
838 | * not necessarily using the gate announcement protocol. Still keeping the | ||
839 | * same nomenclature to be in sync with the spec) | ||
840 | * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding | ||
841 | * entity (default is TRUE - forwarding entity) | ||
842 | * @rssi_threshold: the threshold for average signal strength of candidate | ||
843 | * station to establish a peer link | ||
844 | * @ht_opmode: mesh HT protection mode | ||
845 | * | ||
846 | * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs | ||
847 | * receiving a proactive PREQ shall consider the forwarding information to | ||
848 | * the root mesh STA to be valid. | ||
849 | * | ||
850 | * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive | ||
851 | * PREQs are transmitted. | ||
852 | * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) | ||
853 | * during which a mesh STA can send only one Action frame containing | ||
854 | * a PREQ element for root path confirmation. | ||
797 | */ | 855 | */ |
798 | struct mesh_config { | 856 | struct mesh_config { |
799 | /* Timeouts in ms */ | ||
800 | /* Mesh plink management parameters */ | ||
801 | u16 dot11MeshRetryTimeout; | 857 | u16 dot11MeshRetryTimeout; |
802 | u16 dot11MeshConfirmTimeout; | 858 | u16 dot11MeshConfirmTimeout; |
803 | u16 dot11MeshHoldingTimeout; | 859 | u16 dot11MeshHoldingTimeout; |
804 | u16 dot11MeshMaxPeerLinks; | 860 | u16 dot11MeshMaxPeerLinks; |
805 | u8 dot11MeshMaxRetries; | 861 | u8 dot11MeshMaxRetries; |
806 | u8 dot11MeshTTL; | 862 | u8 dot11MeshTTL; |
807 | /* ttl used in path selection information elements */ | 863 | u8 element_ttl; |
808 | u8 element_ttl; | ||
809 | bool auto_open_plinks; | 864 | bool auto_open_plinks; |
810 | /* neighbor offset synchronization */ | ||
811 | u32 dot11MeshNbrOffsetMaxNeighbor; | 865 | u32 dot11MeshNbrOffsetMaxNeighbor; |
812 | /* HWMP parameters */ | 866 | u8 dot11MeshHWMPmaxPREQretries; |
813 | u8 dot11MeshHWMPmaxPREQretries; | ||
814 | u32 path_refresh_time; | 867 | u32 path_refresh_time; |
815 | u16 min_discovery_timeout; | 868 | u16 min_discovery_timeout; |
816 | u32 dot11MeshHWMPactivePathTimeout; | 869 | u32 dot11MeshHWMPactivePathTimeout; |
817 | u16 dot11MeshHWMPpreqMinInterval; | 870 | u16 dot11MeshHWMPpreqMinInterval; |
818 | u16 dot11MeshHWMPperrMinInterval; | 871 | u16 dot11MeshHWMPperrMinInterval; |
819 | u16 dot11MeshHWMPnetDiameterTraversalTime; | 872 | u16 dot11MeshHWMPnetDiameterTraversalTime; |
820 | u8 dot11MeshHWMPRootMode; | 873 | u8 dot11MeshHWMPRootMode; |
821 | u16 dot11MeshHWMPRannInterval; | 874 | u16 dot11MeshHWMPRannInterval; |
822 | /* This is missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol | 875 | bool dot11MeshGateAnnouncementProtocol; |
823 | * set to true only means that the station will announce others it's a | ||
824 | * mesh gate, but not necessarily using the gate announcement protocol. | ||
825 | * Still keeping the same nomenclature to be in sync with the spec. */ | ||
826 | bool dot11MeshGateAnnouncementProtocol; | ||
827 | bool dot11MeshForwarding; | 876 | bool dot11MeshForwarding; |
828 | s32 rssi_threshold; | 877 | s32 rssi_threshold; |
829 | u16 ht_opmode; | 878 | u16 ht_opmode; |
879 | u32 dot11MeshHWMPactivePathToRootTimeout; | ||
880 | u16 dot11MeshHWMProotInterval; | ||
881 | u16 dot11MeshHWMPconfirmationInterval; | ||
830 | }; | 882 | }; |
831 | 883 | ||
832 | /** | 884 | /** |
@@ -975,6 +1027,7 @@ struct cfg80211_match_set { | |||
975 | * @wiphy: the wiphy this was for | 1027 | * @wiphy: the wiphy this was for |
976 | * @dev: the interface | 1028 | * @dev: the interface |
977 | * @channels: channels to scan | 1029 | * @channels: channels to scan |
1030 | * @rssi_thold: don't report scan results below this threshold (in s32 dBm) | ||
978 | */ | 1031 | */ |
979 | struct cfg80211_sched_scan_request { | 1032 | struct cfg80211_sched_scan_request { |
980 | struct cfg80211_ssid *ssids; | 1033 | struct cfg80211_ssid *ssids; |
@@ -985,6 +1038,7 @@ struct cfg80211_sched_scan_request { | |||
985 | size_t ie_len; | 1038 | size_t ie_len; |
986 | struct cfg80211_match_set *match_sets; | 1039 | struct cfg80211_match_set *match_sets; |
987 | int n_match_sets; | 1040 | int n_match_sets; |
1041 | s32 rssi_thold; | ||
988 | 1042 | ||
989 | /* internal */ | 1043 | /* internal */ |
990 | struct wiphy *wiphy; | 1044 | struct wiphy *wiphy; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 6914f9978aea..670a58ba8a41 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -2254,6 +2254,9 @@ enum ieee80211_rate_control_changed { | |||
2254 | * @get_et_strings: Ethtool API to get a set of strings to describe stats | 2254 | * @get_et_strings: Ethtool API to get a set of strings to describe stats |
2255 | * and perhaps other supported types of ethtool data-sets. | 2255 | * and perhaps other supported types of ethtool data-sets. |
2256 | * | 2256 | * |
2257 | * @get_rssi: Get current signal strength in dBm, the function is optional | ||
2258 | * and can sleep. | ||
2259 | * | ||
2257 | */ | 2260 | */ |
2258 | struct ieee80211_ops { | 2261 | struct ieee80211_ops { |
2259 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 2262 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
@@ -2393,6 +2396,8 @@ struct ieee80211_ops { | |||
2393 | void (*get_et_strings)(struct ieee80211_hw *hw, | 2396 | void (*get_et_strings)(struct ieee80211_hw *hw, |
2394 | struct ieee80211_vif *vif, | 2397 | struct ieee80211_vif *vif, |
2395 | u32 sset, u8 *data); | 2398 | u32 sset, u8 *data); |
2399 | int (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
2400 | struct ieee80211_sta *sta, s8 *rssi_dbm); | ||
2396 | }; | 2401 | }; |
2397 | 2402 | ||
2398 | /** | 2403 | /** |
@@ -3843,28 +3848,4 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, | |||
3843 | */ | 3848 | */ |
3844 | int ieee80211_ave_rssi(struct ieee80211_vif *vif); | 3849 | int ieee80211_ave_rssi(struct ieee80211_vif *vif); |
3845 | 3850 | ||
3846 | /* Extra debugging macros */ | ||
3847 | |||
3848 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
3849 | #define ht_vdbg(fmt, ...) \ | ||
3850 | pr_debug(fmt, ##__VA_ARGS__) | ||
3851 | #else | ||
3852 | #define ht_vdbg(fmt, ...) \ | ||
3853 | do { \ | ||
3854 | if (0) \ | ||
3855 | pr_debug(fmt, ##__VA_ARGS__); \ | ||
3856 | } while (0) | ||
3857 | #endif | ||
3858 | |||
3859 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
3860 | #define ibss_vdbg(fmt, ...) \ | ||
3861 | pr_debug(fmt, ##__VA_ARGS__) | ||
3862 | #else | ||
3863 | #define ibss_vdbg(fmt, ...) \ | ||
3864 | do { \ | ||
3865 | if (0) \ | ||
3866 | pr_debug(fmt, ##__VA_ARGS__); \ | ||
3867 | } while (0) | ||
3868 | #endif | ||
3869 | |||
3870 | #endif /* MAC80211_H */ | 3851 | #endif /* MAC80211_H */ |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 8d249d705980..63af25458fda 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -107,6 +107,19 @@ config MAC80211_DEBUGFS | |||
107 | 107 | ||
108 | Say N unless you know you need this. | 108 | Say N unless you know you need this. |
109 | 109 | ||
110 | config MAC80211_MESSAGE_TRACING | ||
111 | bool "Trace all mac80211 debug messages" | ||
112 | depends on MAC80211 | ||
113 | ---help--- | ||
114 | Select this option to have mac80211 register the | ||
115 | mac80211_msg trace subsystem with tracepoints to | ||
116 | collect all debugging messages, independent of | ||
117 | printing them into the kernel log. | ||
118 | |||
119 | The overhead in this option is that all the messages | ||
120 | need to be present in the binary and formatted at | ||
121 | runtime for tracing. | ||
122 | |||
110 | menuconfig MAC80211_DEBUG_MENU | 123 | menuconfig MAC80211_DEBUG_MENU |
111 | bool "Select mac80211 debugging features" | 124 | bool "Select mac80211 debugging features" |
112 | depends on MAC80211 | 125 | depends on MAC80211 |
@@ -140,26 +153,35 @@ config MAC80211_VERBOSE_DEBUG | |||
140 | 153 | ||
141 | Do not select this option. | 154 | Do not select this option. |
142 | 155 | ||
143 | config MAC80211_HT_DEBUG | 156 | config MAC80211_MLME_DEBUG |
144 | bool "Verbose HT debugging" | 157 | bool "Verbose managed MLME output" |
145 | depends on MAC80211_DEBUG_MENU | 158 | depends on MAC80211_DEBUG_MENU |
146 | ---help--- | 159 | ---help--- |
147 | This option enables 802.11n High Throughput features | 160 | Selecting this option causes mac80211 to print out |
148 | debug tracing output. | 161 | debugging messages for the managed-mode MLME. It |
149 | 162 | should not be selected on production systems as some | |
150 | It should not be selected on production systems as some | ||
151 | of the messages are remotely triggerable. | 163 | of the messages are remotely triggerable. |
152 | 164 | ||
153 | Do not select this option. | 165 | Do not select this option. |
154 | 166 | ||
155 | config MAC80211_TKIP_DEBUG | 167 | config MAC80211_STA_DEBUG |
156 | bool "Verbose TKIP debugging" | 168 | bool "Verbose station debugging" |
157 | depends on MAC80211_DEBUG_MENU | 169 | depends on MAC80211_DEBUG_MENU |
158 | ---help--- | 170 | ---help--- |
159 | Selecting this option causes mac80211 to print out | 171 | Selecting this option causes mac80211 to print out |
160 | very verbose TKIP debugging messages. It should not | 172 | debugging messages for station addition/removal. |
161 | be selected on production systems as those messages | 173 | |
162 | are remotely triggerable. | 174 | Do not select this option. |
175 | |||
176 | config MAC80211_HT_DEBUG | ||
177 | bool "Verbose HT debugging" | ||
178 | depends on MAC80211_DEBUG_MENU | ||
179 | ---help--- | ||
180 | This option enables 802.11n High Throughput features | ||
181 | debug tracing output. | ||
182 | |||
183 | It should not be selected on production systems as some | ||
184 | of the messages are remotely triggerable. | ||
163 | 185 | ||
164 | Do not select this option. | 186 | Do not select this option. |
165 | 187 | ||
@@ -174,7 +196,7 @@ config MAC80211_IBSS_DEBUG | |||
174 | 196 | ||
175 | Do not select this option. | 197 | Do not select this option. |
176 | 198 | ||
177 | config MAC80211_VERBOSE_PS_DEBUG | 199 | config MAC80211_PS_DEBUG |
178 | bool "Verbose powersave mode debugging" | 200 | bool "Verbose powersave mode debugging" |
179 | depends on MAC80211_DEBUG_MENU | 201 | depends on MAC80211_DEBUG_MENU |
180 | ---help--- | 202 | ---help--- |
@@ -186,7 +208,7 @@ config MAC80211_VERBOSE_PS_DEBUG | |||
186 | 208 | ||
187 | Do not select this option. | 209 | Do not select this option. |
188 | 210 | ||
189 | config MAC80211_VERBOSE_MPL_DEBUG | 211 | config MAC80211_MPL_DEBUG |
190 | bool "Verbose mesh peer link debugging" | 212 | bool "Verbose mesh peer link debugging" |
191 | depends on MAC80211_DEBUG_MENU | 213 | depends on MAC80211_DEBUG_MENU |
192 | depends on MAC80211_MESH | 214 | depends on MAC80211_MESH |
@@ -199,7 +221,7 @@ config MAC80211_VERBOSE_MPL_DEBUG | |||
199 | 221 | ||
200 | Do not select this option. | 222 | Do not select this option. |
201 | 223 | ||
202 | config MAC80211_VERBOSE_MPATH_DEBUG | 224 | config MAC80211_MPATH_DEBUG |
203 | bool "Verbose mesh path debugging" | 225 | bool "Verbose mesh path debugging" |
204 | depends on MAC80211_DEBUG_MENU | 226 | depends on MAC80211_DEBUG_MENU |
205 | depends on MAC80211_MESH | 227 | depends on MAC80211_MESH |
@@ -212,7 +234,7 @@ config MAC80211_VERBOSE_MPATH_DEBUG | |||
212 | 234 | ||
213 | Do not select this option. | 235 | Do not select this option. |
214 | 236 | ||
215 | config MAC80211_VERBOSE_MHWMP_DEBUG | 237 | config MAC80211_MHWMP_DEBUG |
216 | bool "Verbose mesh HWMP routing debugging" | 238 | bool "Verbose mesh HWMP routing debugging" |
217 | depends on MAC80211_DEBUG_MENU | 239 | depends on MAC80211_DEBUG_MENU |
218 | depends on MAC80211_MESH | 240 | depends on MAC80211_MESH |
@@ -225,7 +247,7 @@ config MAC80211_VERBOSE_MHWMP_DEBUG | |||
225 | 247 | ||
226 | Do not select this option. | 248 | Do not select this option. |
227 | 249 | ||
228 | config MAC80211_VERBOSE_MESH_SYNC_DEBUG | 250 | config MAC80211_MESH_SYNC_DEBUG |
229 | bool "Verbose mesh mesh synchronization debugging" | 251 | bool "Verbose mesh mesh synchronization debugging" |
230 | depends on MAC80211_DEBUG_MENU | 252 | depends on MAC80211_DEBUG_MENU |
231 | depends on MAC80211_MESH | 253 | depends on MAC80211_MESH |
@@ -236,7 +258,7 @@ config MAC80211_VERBOSE_MESH_SYNC_DEBUG | |||
236 | 258 | ||
237 | Do not select this option. | 259 | Do not select this option. |
238 | 260 | ||
239 | config MAC80211_VERBOSE_TDLS_DEBUG | 261 | config MAC80211_TDLS_DEBUG |
240 | bool "Verbose TDLS debugging" | 262 | bool "Verbose TDLS debugging" |
241 | depends on MAC80211_DEBUG_MENU | 263 | depends on MAC80211_DEBUG_MENU |
242 | ---help--- | 264 | ---help--- |
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 2b1470bac178..a7dd110faafa 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -24,7 +24,7 @@ mac80211-y := \ | |||
24 | wme.o \ | 24 | wme.o \ |
25 | event.o \ | 25 | event.o \ |
26 | chan.o \ | 26 | chan.o \ |
27 | driver-trace.o mlme.o | 27 | trace.o mlme.o |
28 | 28 | ||
29 | mac80211-$(CONFIG_MAC80211_LEDS) += led.o | 29 | mac80211-$(CONFIG_MAC80211_LEDS) += led.o |
30 | mac80211-$(CONFIG_MAC80211_DEBUGFS) += \ | 30 | mac80211-$(CONFIG_MAC80211_DEBUGFS) += \ |
@@ -42,7 +42,7 @@ mac80211-$(CONFIG_MAC80211_MESH) += \ | |||
42 | 42 | ||
43 | mac80211-$(CONFIG_PM) += pm.o | 43 | mac80211-$(CONFIG_PM) += pm.o |
44 | 44 | ||
45 | CFLAGS_driver-trace.o := -I$(src) | 45 | CFLAGS_trace.o := -I$(src) |
46 | 46 | ||
47 | # objects for PID algorithm | 47 | # objects for PID algorithm |
48 | rc80211_pid-y := rc80211_pid_algo.o | 48 | rc80211_pid-y := rc80211_pid_algo.o |
@@ -58,4 +58,4 @@ mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y) | |||
58 | mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) | 58 | mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) |
59 | mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) | 59 | mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) |
60 | 60 | ||
61 | ccflags-y += -D__CHECK_ENDIAN__ | 61 | ccflags-y += -D__CHECK_ENDIAN__ -DDEBUG |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 32ef11d69798..186d9919b043 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -74,15 +74,17 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, | |||
74 | 74 | ||
75 | RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); | 75 | RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); |
76 | 76 | ||
77 | ht_vdbg("Rx BA session stop requested for %pM tid %u %s reason: %d\n", | 77 | ht_dbg(sta->sdata, |
78 | sta->sta.addr, tid, | 78 | "Rx BA session stop requested for %pM tid %u %s reason: %d\n", |
79 | initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator", | 79 | sta->sta.addr, tid, |
80 | (int)reason); | 80 | initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator", |
81 | (int)reason); | ||
81 | 82 | ||
82 | if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, | 83 | if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, |
83 | &sta->sta, tid, NULL, 0)) | 84 | &sta->sta, tid, NULL, 0)) |
84 | pr_debug("HW problem - can not stop rx aggregation for tid %d\n", | 85 | sdata_info(sta->sdata, |
85 | tid); | 86 | "HW problem - can not stop rx aggregation for tid %d\n", |
87 | tid); | ||
86 | 88 | ||
87 | /* check if this is a self generated aggregation halt */ | 89 | /* check if this is a self generated aggregation halt */ |
88 | if (initiator == WLAN_BACK_RECIPIENT && tx) | 90 | if (initiator == WLAN_BACK_RECIPIENT && tx) |
@@ -157,7 +159,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) | |||
157 | } | 159 | } |
158 | rcu_read_unlock(); | 160 | rcu_read_unlock(); |
159 | 161 | ||
160 | ht_vdbg("rx session timer expired on tid %d\n", (u16)*ptid); | 162 | ht_dbg(sta->sdata, "rx session timer expired on tid %d\n", (u16)*ptid); |
161 | 163 | ||
162 | set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); | 164 | set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); |
163 | ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); | 165 | ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); |
@@ -245,7 +247,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
245 | status = WLAN_STATUS_REQUEST_DECLINED; | 247 | status = WLAN_STATUS_REQUEST_DECLINED; |
246 | 248 | ||
247 | if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { | 249 | if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { |
248 | ht_vdbg("Suspend in progress - Denying ADDBA request\n"); | 250 | ht_dbg(sta->sdata, "Suspend in progress - Denying ADDBA request\n"); |
249 | goto end_no_lock; | 251 | goto end_no_lock; |
250 | } | 252 | } |
251 | 253 | ||
@@ -257,10 +259,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
257 | (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || | 259 | (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || |
258 | (buf_size > IEEE80211_MAX_AMPDU_BUF)) { | 260 | (buf_size > IEEE80211_MAX_AMPDU_BUF)) { |
259 | status = WLAN_STATUS_INVALID_QOS_PARAM; | 261 | status = WLAN_STATUS_INVALID_QOS_PARAM; |
260 | #ifdef CONFIG_MAC80211_HT_DEBUG | 262 | ht_dbg_ratelimited(sta->sdata, |
261 | net_dbg_ratelimited("AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", | 263 | "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", |
262 | mgmt->sa, tid, ba_policy, buf_size); | 264 | mgmt->sa, tid, ba_policy, buf_size); |
263 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
264 | goto end_no_lock; | 265 | goto end_no_lock; |
265 | } | 266 | } |
266 | /* determine default buffer size */ | 267 | /* determine default buffer size */ |
@@ -275,10 +276,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
275 | mutex_lock(&sta->ampdu_mlme.mtx); | 276 | mutex_lock(&sta->ampdu_mlme.mtx); |
276 | 277 | ||
277 | if (sta->ampdu_mlme.tid_rx[tid]) { | 278 | if (sta->ampdu_mlme.tid_rx[tid]) { |
278 | #ifdef CONFIG_MAC80211_HT_DEBUG | 279 | ht_dbg_ratelimited(sta->sdata, |
279 | net_dbg_ratelimited("unexpected AddBA Req from %pM on tid %u\n", | 280 | "unexpected AddBA Req from %pM on tid %u\n", |
280 | mgmt->sa, tid); | 281 | mgmt->sa, tid); |
281 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
282 | 282 | ||
283 | /* delete existing Rx BA session on the same tid */ | 283 | /* delete existing Rx BA session on the same tid */ |
284 | ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, | 284 | ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, |
@@ -317,7 +317,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
317 | 317 | ||
318 | ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, | 318 | ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, |
319 | &sta->sta, tid, &start_seq_num, 0); | 319 | &sta->sta, tid, &start_seq_num, 0); |
320 | ht_vdbg("Rx A-MPDU request on tid %d result %d\n", tid, ret); | 320 | ht_dbg(sta->sdata, "Rx A-MPDU request on tid %d result %d\n", tid, ret); |
321 | if (ret) { | 321 | if (ret) { |
322 | kfree(tid_agg_rx->reorder_buf); | 322 | kfree(tid_agg_rx->reorder_buf); |
323 | kfree(tid_agg_rx->reorder_time); | 323 | kfree(tid_agg_rx->reorder_time); |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index da07f01cfe4d..5cc1bf7d8033 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -184,8 +184,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
184 | 184 | ||
185 | spin_unlock_bh(&sta->lock); | 185 | spin_unlock_bh(&sta->lock); |
186 | 186 | ||
187 | ht_vdbg("Tx BA session stop requested for %pM tid %u\n", | 187 | ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n", |
188 | sta->sta.addr, tid); | 188 | sta->sta.addr, tid); |
189 | 189 | ||
190 | del_timer_sync(&tid_tx->addba_resp_timer); | 190 | del_timer_sync(&tid_tx->addba_resp_timer); |
191 | del_timer_sync(&tid_tx->session_timer); | 191 | del_timer_sync(&tid_tx->session_timer); |
@@ -251,12 +251,13 @@ static void sta_addba_resp_timer_expired(unsigned long data) | |||
251 | if (!tid_tx || | 251 | if (!tid_tx || |
252 | test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { | 252 | test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { |
253 | rcu_read_unlock(); | 253 | rcu_read_unlock(); |
254 | ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n", | 254 | ht_dbg(sta->sdata, |
255 | tid); | 255 | "timer expired on tid %d but we are not (or no longer) expecting addBA response there\n", |
256 | tid); | ||
256 | return; | 257 | return; |
257 | } | 258 | } |
258 | 259 | ||
259 | ht_vdbg("addBA response timer expired on tid %d\n", tid); | 260 | ht_dbg(sta->sdata, "addBA response timer expired on tid %d\n", tid); |
260 | 261 | ||
261 | ieee80211_stop_tx_ba_session(&sta->sta, tid); | 262 | ieee80211_stop_tx_ba_session(&sta->sta, tid); |
262 | rcu_read_unlock(); | 263 | rcu_read_unlock(); |
@@ -316,8 +317,9 @@ ieee80211_agg_splice_packets(struct ieee80211_sub_if_data *sdata, | |||
316 | 317 | ||
317 | ieee80211_stop_queue_agg(sdata, tid); | 318 | ieee80211_stop_queue_agg(sdata, tid); |
318 | 319 | ||
319 | if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates" | 320 | if (WARN(!tid_tx, |
320 | " from the pending queue\n", tid)) | 321 | "TID %d gone but expected when splicing aggregates from the pending queue\n", |
322 | tid)) | ||
321 | return; | 323 | return; |
322 | 324 | ||
323 | if (!skb_queue_empty(&tid_tx->pending)) { | 325 | if (!skb_queue_empty(&tid_tx->pending)) { |
@@ -365,7 +367,8 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) | |||
365 | ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, | 367 | ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, |
366 | &sta->sta, tid, &start_seq_num, 0); | 368 | &sta->sta, tid, &start_seq_num, 0); |
367 | if (ret) { | 369 | if (ret) { |
368 | ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid); | 370 | ht_dbg(sdata, |
371 | "BA request denied - HW unavailable for tid %d\n", tid); | ||
369 | spin_lock_bh(&sta->lock); | 372 | spin_lock_bh(&sta->lock); |
370 | ieee80211_agg_splice_packets(sdata, tid_tx, tid); | 373 | ieee80211_agg_splice_packets(sdata, tid_tx, tid); |
371 | ieee80211_assign_tid_tx(sta, tid, NULL); | 374 | ieee80211_assign_tid_tx(sta, tid, NULL); |
@@ -378,7 +381,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) | |||
378 | 381 | ||
379 | /* activate the timer for the recipient's addBA response */ | 382 | /* activate the timer for the recipient's addBA response */ |
380 | mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); | 383 | mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); |
381 | ht_vdbg("activated addBA response timer on tid %d\n", tid); | 384 | ht_dbg(sdata, "activated addBA response timer on tid %d\n", tid); |
382 | 385 | ||
383 | spin_lock_bh(&sta->lock); | 386 | spin_lock_bh(&sta->lock); |
384 | sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; | 387 | sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; |
@@ -425,7 +428,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data) | |||
425 | 428 | ||
426 | rcu_read_unlock(); | 429 | rcu_read_unlock(); |
427 | 430 | ||
428 | ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid); | 431 | ht_dbg(sta->sdata, "tx session timer expired on tid %d\n", (u16)*ptid); |
429 | 432 | ||
430 | ieee80211_stop_tx_ba_session(&sta->sta, *ptid); | 433 | ieee80211_stop_tx_ba_session(&sta->sta, *ptid); |
431 | } | 434 | } |
@@ -449,8 +452,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
449 | (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) | 452 | (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) |
450 | return -EINVAL; | 453 | return -EINVAL; |
451 | 454 | ||
452 | ht_vdbg("Open BA session requested for %pM tid %u\n", | 455 | ht_dbg(sdata, "Open BA session requested for %pM tid %u\n", |
453 | pubsta->addr, tid); | 456 | pubsta->addr, tid); |
454 | 457 | ||
455 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | 458 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
456 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && | 459 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
@@ -460,7 +463,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
460 | return -EINVAL; | 463 | return -EINVAL; |
461 | 464 | ||
462 | if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { | 465 | if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { |
463 | ht_vdbg("BA sessions blocked - Denying BA session request\n"); | 466 | ht_dbg(sdata, |
467 | "BA sessions blocked - Denying BA session request\n"); | ||
464 | return -EINVAL; | 468 | return -EINVAL; |
465 | } | 469 | } |
466 | 470 | ||
@@ -478,8 +482,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
478 | */ | 482 | */ |
479 | if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && | 483 | if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && |
480 | !sta->sta.ht_cap.ht_supported) { | 484 | !sta->sta.ht_cap.ht_supported) { |
481 | ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n", | 485 | ht_dbg(sdata, |
482 | pubsta->addr); | 486 | "BA request denied - IBSS STA %pM does not advertise HT support\n", |
487 | pubsta->addr); | ||
483 | return -EINVAL; | 488 | return -EINVAL; |
484 | } | 489 | } |
485 | 490 | ||
@@ -499,8 +504,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
499 | if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && | 504 | if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && |
500 | time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + | 505 | time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + |
501 | HT_AGG_RETRIES_PERIOD)) { | 506 | HT_AGG_RETRIES_PERIOD)) { |
502 | ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n", | 507 | ht_dbg(sdata, |
503 | sta->ampdu_mlme.addba_req_num[tid], tid); | 508 | "BA request denied - waiting a grace period after %d failed requests on tid %u\n", |
509 | sta->ampdu_mlme.addba_req_num[tid], tid); | ||
504 | ret = -EBUSY; | 510 | ret = -EBUSY; |
505 | goto err_unlock_sta; | 511 | goto err_unlock_sta; |
506 | } | 512 | } |
@@ -508,8 +514,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
508 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); | 514 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); |
509 | /* check if the TID is not in aggregation flow already */ | 515 | /* check if the TID is not in aggregation flow already */ |
510 | if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { | 516 | if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { |
511 | ht_vdbg("BA request denied - session is not idle on tid %u\n", | 517 | ht_dbg(sdata, |
512 | tid); | 518 | "BA request denied - session is not idle on tid %u\n", |
519 | tid); | ||
513 | ret = -EAGAIN; | 520 | ret = -EAGAIN; |
514 | goto err_unlock_sta; | 521 | goto err_unlock_sta; |
515 | } | 522 | } |
@@ -564,7 +571,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local, | |||
564 | 571 | ||
565 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); | 572 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); |
566 | 573 | ||
567 | ht_vdbg("Aggregation is on for tid %d\n", tid); | 574 | ht_dbg(sta->sdata, "Aggregation is on for tid %d\n", tid); |
568 | 575 | ||
569 | drv_ampdu_action(local, sta->sdata, | 576 | drv_ampdu_action(local, sta->sdata, |
570 | IEEE80211_AMPDU_TX_OPERATIONAL, | 577 | IEEE80211_AMPDU_TX_OPERATIONAL, |
@@ -598,7 +605,8 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) | |||
598 | trace_api_start_tx_ba_cb(sdata, ra, tid); | 605 | trace_api_start_tx_ba_cb(sdata, ra, tid); |
599 | 606 | ||
600 | if (tid >= STA_TID_NUM) { | 607 | if (tid >= STA_TID_NUM) { |
601 | ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM); | 608 | ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", |
609 | tid, STA_TID_NUM); | ||
602 | return; | 610 | return; |
603 | } | 611 | } |
604 | 612 | ||
@@ -606,7 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) | |||
606 | sta = sta_info_get_bss(sdata, ra); | 614 | sta = sta_info_get_bss(sdata, ra); |
607 | if (!sta) { | 615 | if (!sta) { |
608 | mutex_unlock(&local->sta_mtx); | 616 | mutex_unlock(&local->sta_mtx); |
609 | ht_vdbg("Could not find station: %pM\n", ra); | 617 | ht_dbg(sdata, "Could not find station: %pM\n", ra); |
610 | return; | 618 | return; |
611 | } | 619 | } |
612 | 620 | ||
@@ -614,7 +622,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) | |||
614 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); | 622 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); |
615 | 623 | ||
616 | if (WARN_ON(!tid_tx)) { | 624 | if (WARN_ON(!tid_tx)) { |
617 | ht_vdbg("addBA was not requested!\n"); | 625 | ht_dbg(sdata, "addBA was not requested!\n"); |
618 | goto unlock; | 626 | goto unlock; |
619 | } | 627 | } |
620 | 628 | ||
@@ -714,17 +722,18 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) | |||
714 | trace_api_stop_tx_ba_cb(sdata, ra, tid); | 722 | trace_api_stop_tx_ba_cb(sdata, ra, tid); |
715 | 723 | ||
716 | if (tid >= STA_TID_NUM) { | 724 | if (tid >= STA_TID_NUM) { |
717 | ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM); | 725 | ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", |
726 | tid, STA_TID_NUM); | ||
718 | return; | 727 | return; |
719 | } | 728 | } |
720 | 729 | ||
721 | ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid); | 730 | ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", ra, tid); |
722 | 731 | ||
723 | mutex_lock(&local->sta_mtx); | 732 | mutex_lock(&local->sta_mtx); |
724 | 733 | ||
725 | sta = sta_info_get_bss(sdata, ra); | 734 | sta = sta_info_get_bss(sdata, ra); |
726 | if (!sta) { | 735 | if (!sta) { |
727 | ht_vdbg("Could not find station: %pM\n", ra); | 736 | ht_dbg(sdata, "Could not find station: %pM\n", ra); |
728 | goto unlock; | 737 | goto unlock; |
729 | } | 738 | } |
730 | 739 | ||
@@ -733,7 +742,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) | |||
733 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); | 742 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); |
734 | 743 | ||
735 | if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | 744 | if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { |
736 | ht_vdbg("unexpected callback to A-MPDU stop\n"); | 745 | ht_dbg(sdata, "unexpected callback to A-MPDU stop\n"); |
737 | goto unlock_sta; | 746 | goto unlock_sta; |
738 | } | 747 | } |
739 | 748 | ||
@@ -809,13 +818,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
809 | goto out; | 818 | goto out; |
810 | 819 | ||
811 | if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { | 820 | if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { |
812 | ht_vdbg("wrong addBA response token, tid %d\n", tid); | 821 | ht_dbg(sta->sdata, "wrong addBA response token, tid %d\n", tid); |
813 | goto out; | 822 | goto out; |
814 | } | 823 | } |
815 | 824 | ||
816 | del_timer_sync(&tid_tx->addba_resp_timer); | 825 | del_timer_sync(&tid_tx->addba_resp_timer); |
817 | 826 | ||
818 | ht_vdbg("switched off addBA timer for tid %d\n", tid); | 827 | ht_dbg(sta->sdata, "switched off addBA timer for tid %d\n", tid); |
819 | 828 | ||
820 | /* | 829 | /* |
821 | * addba_resp_timer may have fired before we got here, and | 830 | * addba_resp_timer may have fired before we got here, and |
@@ -824,8 +833,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
824 | */ | 833 | */ |
825 | if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || | 834 | if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || |
826 | test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | 835 | test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { |
827 | ht_vdbg("got addBA resp for tid %d but we already gave up\n", | 836 | ht_dbg(sta->sdata, |
828 | tid); | 837 | "got addBA resp for tid %d but we already gave up\n", |
838 | tid); | ||
829 | goto out; | 839 | goto out; |
830 | } | 840 | } |
831 | 841 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 85ac364f4636..c2a2dcbfdf01 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -353,6 +353,7 @@ void sta_set_rate_info_tx(struct sta_info *sta, | |||
353 | static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | 353 | static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) |
354 | { | 354 | { |
355 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 355 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
356 | struct ieee80211_local *local = sdata->local; | ||
356 | struct timespec uptime; | 357 | struct timespec uptime; |
357 | 358 | ||
358 | sinfo->generation = sdata->local->sta_generation; | 359 | sinfo->generation = sdata->local->sta_generation; |
@@ -388,7 +389,9 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
388 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || | 389 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || |
389 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { | 390 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { |
390 | sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; | 391 | sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; |
391 | sinfo->signal = (s8)sta->last_signal; | 392 | if (!local->ops->get_rssi || |
393 | drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal)) | ||
394 | sinfo->signal = (s8)sta->last_signal; | ||
392 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | 395 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); |
393 | } | 396 | } |
394 | 397 | ||
@@ -517,7 +520,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy, | |||
517 | * network device. | 520 | * network device. |
518 | */ | 521 | */ |
519 | 522 | ||
520 | rcu_read_lock(); | 523 | mutex_lock(&local->sta_mtx); |
521 | 524 | ||
522 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { | 525 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
523 | sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid); | 526 | sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid); |
@@ -546,7 +549,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy, | |||
546 | data[i] = (u8)sinfo.signal_avg; | 549 | data[i] = (u8)sinfo.signal_avg; |
547 | i++; | 550 | i++; |
548 | } else { | 551 | } else { |
549 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | 552 | list_for_each_entry(sta, &local->sta_list, list) { |
550 | /* Make sure this station belongs to the proper dev */ | 553 | /* Make sure this station belongs to the proper dev */ |
551 | if (sta->sdata->dev != dev) | 554 | if (sta->sdata->dev != dev) |
552 | continue; | 555 | continue; |
@@ -603,7 +606,7 @@ do_survey: | |||
603 | else | 606 | else |
604 | data[i++] = -1LL; | 607 | data[i++] = -1LL; |
605 | 608 | ||
606 | rcu_read_unlock(); | 609 | mutex_unlock(&local->sta_mtx); |
607 | 610 | ||
608 | if (WARN_ON(i != STA_STATS_LEN)) | 611 | if (WARN_ON(i != STA_STATS_LEN)) |
609 | return; | 612 | return; |
@@ -629,10 +632,11 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | |||
629 | int idx, u8 *mac, struct station_info *sinfo) | 632 | int idx, u8 *mac, struct station_info *sinfo) |
630 | { | 633 | { |
631 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 634 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
635 | struct ieee80211_local *local = sdata->local; | ||
632 | struct sta_info *sta; | 636 | struct sta_info *sta; |
633 | int ret = -ENOENT; | 637 | int ret = -ENOENT; |
634 | 638 | ||
635 | rcu_read_lock(); | 639 | mutex_lock(&local->sta_mtx); |
636 | 640 | ||
637 | sta = sta_info_get_by_idx(sdata, idx); | 641 | sta = sta_info_get_by_idx(sdata, idx); |
638 | if (sta) { | 642 | if (sta) { |
@@ -641,7 +645,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | |||
641 | sta_set_sinfo(sta, sinfo); | 645 | sta_set_sinfo(sta, sinfo); |
642 | } | 646 | } |
643 | 647 | ||
644 | rcu_read_unlock(); | 648 | mutex_unlock(&local->sta_mtx); |
645 | 649 | ||
646 | return ret; | 650 | return ret; |
647 | } | 651 | } |
@@ -658,10 +662,11 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
658 | u8 *mac, struct station_info *sinfo) | 662 | u8 *mac, struct station_info *sinfo) |
659 | { | 663 | { |
660 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 664 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
665 | struct ieee80211_local *local = sdata->local; | ||
661 | struct sta_info *sta; | 666 | struct sta_info *sta; |
662 | int ret = -ENOENT; | 667 | int ret = -ENOENT; |
663 | 668 | ||
664 | rcu_read_lock(); | 669 | mutex_lock(&local->sta_mtx); |
665 | 670 | ||
666 | sta = sta_info_get_bss(sdata, mac); | 671 | sta = sta_info_get_bss(sdata, mac); |
667 | if (sta) { | 672 | if (sta) { |
@@ -669,7 +674,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
669 | sta_set_sinfo(sta, sinfo); | 674 | sta_set_sinfo(sta, sinfo); |
670 | } | 675 | } |
671 | 676 | ||
672 | rcu_read_unlock(); | 677 | mutex_unlock(&local->sta_mtx); |
673 | 678 | ||
674 | return ret; | 679 | return ret; |
675 | } | 680 | } |
@@ -689,7 +694,8 @@ static int ieee80211_set_channel(struct wiphy *wiphy, | |||
689 | case CHAN_MODE_HOPPING: | 694 | case CHAN_MODE_HOPPING: |
690 | return -EBUSY; | 695 | return -EBUSY; |
691 | case CHAN_MODE_FIXED: | 696 | case CHAN_MODE_FIXED: |
692 | if (local->oper_channel != chan) | 697 | if (local->oper_channel != chan || |
698 | (!sdata && local->_oper_channel_type != channel_type)) | ||
693 | return -EBUSY; | 699 | return -EBUSY; |
694 | if (!sdata && local->_oper_channel_type == channel_type) | 700 | if (!sdata && local->_oper_channel_type == channel_type) |
695 | return 0; | 701 | return 0; |
@@ -1529,7 +1535,7 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1529 | if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) | 1535 | if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) |
1530 | conf->dot11MeshTTL = nconf->dot11MeshTTL; | 1536 | conf->dot11MeshTTL = nconf->dot11MeshTTL; |
1531 | if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) | 1537 | if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) |
1532 | conf->dot11MeshTTL = nconf->element_ttl; | 1538 | conf->element_ttl = nconf->element_ttl; |
1533 | if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) | 1539 | if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) |
1534 | conf->auto_open_plinks = nconf->auto_open_plinks; | 1540 | conf->auto_open_plinks = nconf->auto_open_plinks; |
1535 | if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, mask)) | 1541 | if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, mask)) |
@@ -1564,17 +1570,16 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1564 | * announcements, so require this ifmsh to also be a root node | 1570 | * announcements, so require this ifmsh to also be a root node |
1565 | * */ | 1571 | * */ |
1566 | if (nconf->dot11MeshGateAnnouncementProtocol && | 1572 | if (nconf->dot11MeshGateAnnouncementProtocol && |
1567 | !conf->dot11MeshHWMPRootMode) { | 1573 | !(conf->dot11MeshHWMPRootMode > IEEE80211_ROOTMODE_ROOT)) { |
1568 | conf->dot11MeshHWMPRootMode = 1; | 1574 | conf->dot11MeshHWMPRootMode = IEEE80211_PROACTIVE_RANN; |
1569 | ieee80211_mesh_root_setup(ifmsh); | 1575 | ieee80211_mesh_root_setup(ifmsh); |
1570 | } | 1576 | } |
1571 | conf->dot11MeshGateAnnouncementProtocol = | 1577 | conf->dot11MeshGateAnnouncementProtocol = |
1572 | nconf->dot11MeshGateAnnouncementProtocol; | 1578 | nconf->dot11MeshGateAnnouncementProtocol; |
1573 | } | 1579 | } |
1574 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) { | 1580 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) |
1575 | conf->dot11MeshHWMPRannInterval = | 1581 | conf->dot11MeshHWMPRannInterval = |
1576 | nconf->dot11MeshHWMPRannInterval; | 1582 | nconf->dot11MeshHWMPRannInterval; |
1577 | } | ||
1578 | if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask)) | 1583 | if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask)) |
1579 | conf->dot11MeshForwarding = nconf->dot11MeshForwarding; | 1584 | conf->dot11MeshForwarding = nconf->dot11MeshForwarding; |
1580 | if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD, mask)) { | 1585 | if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD, mask)) { |
@@ -1590,6 +1595,15 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1590 | sdata->vif.bss_conf.ht_operation_mode = nconf->ht_opmode; | 1595 | sdata->vif.bss_conf.ht_operation_mode = nconf->ht_opmode; |
1591 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); | 1596 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); |
1592 | } | 1597 | } |
1598 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, mask)) | ||
1599 | conf->dot11MeshHWMPactivePathToRootTimeout = | ||
1600 | nconf->dot11MeshHWMPactivePathToRootTimeout; | ||
1601 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL, mask)) | ||
1602 | conf->dot11MeshHWMProotInterval = | ||
1603 | nconf->dot11MeshHWMProotInterval; | ||
1604 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, mask)) | ||
1605 | conf->dot11MeshHWMPconfirmationInterval = | ||
1606 | nconf->dot11MeshHWMPconfirmationInterval; | ||
1593 | return 0; | 1607 | return 0; |
1594 | } | 1608 | } |
1595 | 1609 | ||
@@ -2309,6 +2323,21 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2309 | 2323 | ||
2310 | mutex_lock(&local->mtx); | 2324 | mutex_lock(&local->mtx); |
2311 | list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { | 2325 | list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { |
2326 | struct ieee80211_roc_work *dep, *tmp2; | ||
2327 | |||
2328 | list_for_each_entry_safe(dep, tmp2, &roc->dependents, list) { | ||
2329 | if (!mgmt_tx && (unsigned long)dep != cookie) | ||
2330 | continue; | ||
2331 | else if (mgmt_tx && dep->mgmt_tx_cookie != cookie) | ||
2332 | continue; | ||
2333 | /* found dependent item -- just remove it */ | ||
2334 | list_del(&dep->list); | ||
2335 | mutex_unlock(&local->mtx); | ||
2336 | |||
2337 | ieee80211_roc_notify_destroy(dep); | ||
2338 | return 0; | ||
2339 | } | ||
2340 | |||
2312 | if (!mgmt_tx && (unsigned long)roc != cookie) | 2341 | if (!mgmt_tx && (unsigned long)roc != cookie) |
2313 | continue; | 2342 | continue; |
2314 | else if (mgmt_tx && roc->mgmt_tx_cookie != cookie) | 2343 | else if (mgmt_tx && roc->mgmt_tx_cookie != cookie) |
@@ -2323,6 +2352,13 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2323 | return -ENOENT; | 2352 | return -ENOENT; |
2324 | } | 2353 | } |
2325 | 2354 | ||
2355 | /* | ||
2356 | * We found the item to cancel, so do that. Note that it | ||
2357 | * may have dependents, which we also cancel (and send | ||
2358 | * the expired signal for.) Not doing so would be quite | ||
2359 | * tricky here, but we may need to fix it later. | ||
2360 | */ | ||
2361 | |||
2326 | if (local->ops->remain_on_channel) { | 2362 | if (local->ops->remain_on_channel) { |
2327 | if (found->started) { | 2363 | if (found->started) { |
2328 | ret = drv_cancel_remain_on_channel(local); | 2364 | ret = drv_cancel_remain_on_channel(local); |
@@ -2334,8 +2370,8 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2334 | 2370 | ||
2335 | list_del(&found->list); | 2371 | list_del(&found->list); |
2336 | 2372 | ||
2337 | ieee80211_run_deferred_scan(local); | 2373 | if (found->started) |
2338 | ieee80211_start_next_roc(local); | 2374 | ieee80211_start_next_roc(local); |
2339 | mutex_unlock(&local->mtx); | 2375 | mutex_unlock(&local->mtx); |
2340 | 2376 | ||
2341 | ieee80211_roc_notify_destroy(found); | 2377 | ieee80211_roc_notify_destroy(found); |
@@ -2489,16 +2525,30 @@ static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, | |||
2489 | u16 frame_type, bool reg) | 2525 | u16 frame_type, bool reg) |
2490 | { | 2526 | { |
2491 | struct ieee80211_local *local = wiphy_priv(wiphy); | 2527 | struct ieee80211_local *local = wiphy_priv(wiphy); |
2528 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2492 | 2529 | ||
2493 | if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ)) | 2530 | switch (frame_type) { |
2494 | return; | 2531 | case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH: |
2532 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { | ||
2533 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | ||
2495 | 2534 | ||
2496 | if (reg) | 2535 | if (reg) |
2497 | local->probe_req_reg++; | 2536 | ifibss->auth_frame_registrations++; |
2498 | else | 2537 | else |
2499 | local->probe_req_reg--; | 2538 | ifibss->auth_frame_registrations--; |
2539 | } | ||
2540 | break; | ||
2541 | case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ: | ||
2542 | if (reg) | ||
2543 | local->probe_req_reg++; | ||
2544 | else | ||
2545 | local->probe_req_reg--; | ||
2500 | 2546 | ||
2501 | ieee80211_queue_work(&local->hw, &local->reconfig_filter); | 2547 | ieee80211_queue_work(&local->hw, &local->reconfig_filter); |
2548 | break; | ||
2549 | default: | ||
2550 | break; | ||
2551 | } | ||
2502 | } | 2552 | } |
2503 | 2553 | ||
2504 | static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) | 2554 | static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) |
@@ -2724,9 +2774,8 @@ static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2724 | !sdata->u.mgd.associated) | 2774 | !sdata->u.mgd.associated) |
2725 | return -EINVAL; | 2775 | return -EINVAL; |
2726 | 2776 | ||
2727 | #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG | 2777 | tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n", |
2728 | pr_debug("TDLS mgmt action %d peer %pM\n", action_code, peer); | 2778 | action_code, peer); |
2729 | #endif | ||
2730 | 2779 | ||
2731 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + | 2780 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + |
2732 | max(sizeof(struct ieee80211_mgmt), | 2781 | max(sizeof(struct ieee80211_mgmt), |
@@ -2835,9 +2884,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, | |||
2835 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 2884 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
2836 | return -EINVAL; | 2885 | return -EINVAL; |
2837 | 2886 | ||
2838 | #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG | 2887 | tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer); |
2839 | pr_debug("TDLS oper %d peer %pM\n", oper, peer); | ||
2840 | #endif | ||
2841 | 2888 | ||
2842 | switch (oper) { | 2889 | switch (oper) { |
2843 | case NL80211_TDLS_ENABLE_LINK: | 2890 | case NL80211_TDLS_ENABLE_LINK: |
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h new file mode 100644 index 000000000000..8f383a576016 --- /dev/null +++ b/net/mac80211/debug.h | |||
@@ -0,0 +1,170 @@ | |||
1 | #ifndef __MAC80211_DEBUG_H | ||
2 | #define __MAC80211_DEBUG_H | ||
3 | #include <net/cfg80211.h> | ||
4 | |||
5 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
6 | #define MAC80211_IBSS_DEBUG 1 | ||
7 | #else | ||
8 | #define MAC80211_IBSS_DEBUG 0 | ||
9 | #endif | ||
10 | |||
11 | #ifdef CONFIG_MAC80211_PS_DEBUG | ||
12 | #define MAC80211_PS_DEBUG 1 | ||
13 | #else | ||
14 | #define MAC80211_PS_DEBUG 0 | ||
15 | #endif | ||
16 | |||
17 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
18 | #define MAC80211_HT_DEBUG 1 | ||
19 | #else | ||
20 | #define MAC80211_HT_DEBUG 0 | ||
21 | #endif | ||
22 | |||
23 | #ifdef CONFIG_MAC80211_MPL_DEBUG | ||
24 | #define MAC80211_MPL_DEBUG 1 | ||
25 | #else | ||
26 | #define MAC80211_MPL_DEBUG 0 | ||
27 | #endif | ||
28 | |||
29 | #ifdef CONFIG_MAC80211_MPATH_DEBUG | ||
30 | #define MAC80211_MPATH_DEBUG 1 | ||
31 | #else | ||
32 | #define MAC80211_MPATH_DEBUG 0 | ||
33 | #endif | ||
34 | |||
35 | #ifdef CONFIG_MAC80211_MHWMP_DEBUG | ||
36 | #define MAC80211_MHWMP_DEBUG 1 | ||
37 | #else | ||
38 | #define MAC80211_MHWMP_DEBUG 0 | ||
39 | #endif | ||
40 | |||
41 | #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG | ||
42 | #define MAC80211_MESH_SYNC_DEBUG 1 | ||
43 | #else | ||
44 | #define MAC80211_MESH_SYNC_DEBUG 0 | ||
45 | #endif | ||
46 | |||
47 | #ifdef CONFIG_MAC80211_TDLS_DEBUG | ||
48 | #define MAC80211_TDLS_DEBUG 1 | ||
49 | #else | ||
50 | #define MAC80211_TDLS_DEBUG 0 | ||
51 | #endif | ||
52 | |||
53 | #ifdef CONFIG_MAC80211_STA_DEBUG | ||
54 | #define MAC80211_STA_DEBUG 1 | ||
55 | #else | ||
56 | #define MAC80211_STA_DEBUG 0 | ||
57 | #endif | ||
58 | |||
59 | #ifdef CONFIG_MAC80211_MLME_DEBUG | ||
60 | #define MAC80211_MLME_DEBUG 1 | ||
61 | #else | ||
62 | #define MAC80211_MLME_DEBUG 0 | ||
63 | #endif | ||
64 | |||
65 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
66 | void __sdata_info(const char *fmt, ...) __printf(1, 2); | ||
67 | void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3); | ||
68 | void __sdata_err(const char *fmt, ...) __printf(1, 2); | ||
69 | void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...) | ||
70 | __printf(3, 4); | ||
71 | |||
72 | #define _sdata_info(sdata, fmt, ...) \ | ||
73 | __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
74 | #define _sdata_dbg(print, sdata, fmt, ...) \ | ||
75 | __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
76 | #define _sdata_err(sdata, fmt, ...) \ | ||
77 | __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
78 | #define _wiphy_dbg(print, wiphy, fmt, ...) \ | ||
79 | __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__) | ||
80 | #else | ||
81 | #define _sdata_info(sdata, fmt, ...) \ | ||
82 | do { \ | ||
83 | pr_info("%s: " fmt, \ | ||
84 | (sdata)->name, ##__VA_ARGS__); \ | ||
85 | } while (0) | ||
86 | |||
87 | #define _sdata_dbg(print, sdata, fmt, ...) \ | ||
88 | do { \ | ||
89 | if (print) \ | ||
90 | pr_debug("%s: " fmt, \ | ||
91 | (sdata)->name, ##__VA_ARGS__); \ | ||
92 | } while (0) | ||
93 | |||
94 | #define _sdata_err(sdata, fmt, ...) \ | ||
95 | do { \ | ||
96 | pr_err("%s: " fmt, \ | ||
97 | (sdata)->name, ##__VA_ARGS__); \ | ||
98 | } while (0) | ||
99 | |||
100 | #define _wiphy_dbg(print, wiphy, fmt, ...) \ | ||
101 | do { \ | ||
102 | if (print) \ | ||
103 | wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \ | ||
104 | } while (0) | ||
105 | #endif | ||
106 | |||
107 | #define sdata_info(sdata, fmt, ...) \ | ||
108 | _sdata_info(sdata, fmt, ##__VA_ARGS__) | ||
109 | #define sdata_err(sdata, fmt, ...) \ | ||
110 | _sdata_err(sdata, fmt, ##__VA_ARGS__) | ||
111 | #define sdata_dbg(sdata, fmt, ...) \ | ||
112 | _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__) | ||
113 | |||
114 | #define ht_dbg(sdata, fmt, ...) \ | ||
115 | _sdata_dbg(MAC80211_HT_DEBUG, \ | ||
116 | sdata, fmt, ##__VA_ARGS__) | ||
117 | |||
118 | #define ht_dbg_ratelimited(sdata, fmt, ...) \ | ||
119 | _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \ | ||
120 | sdata, fmt, ##__VA_ARGS__) | ||
121 | |||
122 | #define ibss_dbg(sdata, fmt, ...) \ | ||
123 | _sdata_dbg(MAC80211_IBSS_DEBUG, \ | ||
124 | sdata, fmt, ##__VA_ARGS__) | ||
125 | |||
126 | #define ps_dbg(sdata, fmt, ...) \ | ||
127 | _sdata_dbg(MAC80211_PS_DEBUG, \ | ||
128 | sdata, fmt, ##__VA_ARGS__) | ||
129 | |||
130 | #define ps_dbg_hw(hw, fmt, ...) \ | ||
131 | _wiphy_dbg(MAC80211_PS_DEBUG, \ | ||
132 | (hw)->wiphy, fmt, ##__VA_ARGS__) | ||
133 | |||
134 | #define ps_dbg_ratelimited(sdata, fmt, ...) \ | ||
135 | _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \ | ||
136 | sdata, fmt, ##__VA_ARGS__) | ||
137 | |||
138 | #define mpl_dbg(sdata, fmt, ...) \ | ||
139 | _sdata_dbg(MAC80211_MPL_DEBUG, \ | ||
140 | sdata, fmt, ##__VA_ARGS__) | ||
141 | |||
142 | #define mpath_dbg(sdata, fmt, ...) \ | ||
143 | _sdata_dbg(MAC80211_MPATH_DEBUG, \ | ||
144 | sdata, fmt, ##__VA_ARGS__) | ||
145 | |||
146 | #define mhwmp_dbg(sdata, fmt, ...) \ | ||
147 | _sdata_dbg(MAC80211_MHWMP_DEBUG, \ | ||
148 | sdata, fmt, ##__VA_ARGS__) | ||
149 | |||
150 | #define msync_dbg(sdata, fmt, ...) \ | ||
151 | _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \ | ||
152 | sdata, fmt, ##__VA_ARGS__) | ||
153 | |||
154 | #define tdls_dbg(sdata, fmt, ...) \ | ||
155 | _sdata_dbg(MAC80211_TDLS_DEBUG, \ | ||
156 | sdata, fmt, ##__VA_ARGS__) | ||
157 | |||
158 | #define sta_dbg(sdata, fmt, ...) \ | ||
159 | _sdata_dbg(MAC80211_STA_DEBUG, \ | ||
160 | sdata, fmt, ##__VA_ARGS__) | ||
161 | |||
162 | #define mlme_dbg(sdata, fmt, ...) \ | ||
163 | _sdata_dbg(MAC80211_MLME_DEBUG, \ | ||
164 | sdata, fmt, ##__VA_ARGS__) | ||
165 | |||
166 | #define mlme_dbg_ratelimited(sdata, fmt, ...) \ | ||
167 | _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \ | ||
168 | sdata, fmt, ##__VA_ARGS__) | ||
169 | |||
170 | #endif /* __MAC80211_DEBUG_H */ | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index d4272ff43f71..6d5aec9418ee 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -468,48 +468,54 @@ IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); | |||
468 | IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); | 468 | IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); |
469 | IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); | 469 | IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); |
470 | IEEE80211_IF_FILE(dropped_frames_congestion, | 470 | IEEE80211_IF_FILE(dropped_frames_congestion, |
471 | u.mesh.mshstats.dropped_frames_congestion, DEC); | 471 | u.mesh.mshstats.dropped_frames_congestion, DEC); |
472 | IEEE80211_IF_FILE(dropped_frames_no_route, | 472 | IEEE80211_IF_FILE(dropped_frames_no_route, |
473 | u.mesh.mshstats.dropped_frames_no_route, DEC); | 473 | u.mesh.mshstats.dropped_frames_no_route, DEC); |
474 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); | 474 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); |
475 | 475 | ||
476 | /* Mesh parameters */ | 476 | /* Mesh parameters */ |
477 | IEEE80211_IF_FILE(dot11MeshMaxRetries, | 477 | IEEE80211_IF_FILE(dot11MeshMaxRetries, |
478 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC); | 478 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC); |
479 | IEEE80211_IF_FILE(dot11MeshRetryTimeout, | 479 | IEEE80211_IF_FILE(dot11MeshRetryTimeout, |
480 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC); | 480 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC); |
481 | IEEE80211_IF_FILE(dot11MeshConfirmTimeout, | 481 | IEEE80211_IF_FILE(dot11MeshConfirmTimeout, |
482 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC); | 482 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC); |
483 | IEEE80211_IF_FILE(dot11MeshHoldingTimeout, | 483 | IEEE80211_IF_FILE(dot11MeshHoldingTimeout, |
484 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); | 484 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); |
485 | IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); | 485 | IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); |
486 | IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC); | 486 | IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC); |
487 | IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); | 487 | IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); |
488 | IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, | 488 | IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, |
489 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); | 489 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); |
490 | IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout, | 490 | IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout, |
491 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); | 491 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); |
492 | IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, | 492 | IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, |
493 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); | 493 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); |
494 | IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval, | 494 | IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval, |
495 | u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC); | 495 | u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC); |
496 | IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, | 496 | IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, |
497 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); | 497 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); |
498 | IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, | 498 | IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, |
499 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC); | 499 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC); |
500 | IEEE80211_IF_FILE(path_refresh_time, | 500 | IEEE80211_IF_FILE(path_refresh_time, |
501 | u.mesh.mshcfg.path_refresh_time, DEC); | 501 | u.mesh.mshcfg.path_refresh_time, DEC); |
502 | IEEE80211_IF_FILE(min_discovery_timeout, | 502 | IEEE80211_IF_FILE(min_discovery_timeout, |
503 | u.mesh.mshcfg.min_discovery_timeout, DEC); | 503 | u.mesh.mshcfg.min_discovery_timeout, DEC); |
504 | IEEE80211_IF_FILE(dot11MeshHWMPRootMode, | 504 | IEEE80211_IF_FILE(dot11MeshHWMPRootMode, |
505 | u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC); | 505 | u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC); |
506 | IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol, | 506 | IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol, |
507 | u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); | 507 | u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); |
508 | IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, | 508 | IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, |
509 | u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); | 509 | u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); |
510 | IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC); | 510 | IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC); |
511 | IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC); | 511 | IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC); |
512 | IEEE80211_IF_FILE(ht_opmode, u.mesh.mshcfg.ht_opmode, DEC); | 512 | IEEE80211_IF_FILE(ht_opmode, u.mesh.mshcfg.ht_opmode, DEC); |
513 | IEEE80211_IF_FILE(dot11MeshHWMPactivePathToRootTimeout, | ||
514 | u.mesh.mshcfg.dot11MeshHWMPactivePathToRootTimeout, DEC); | ||
515 | IEEE80211_IF_FILE(dot11MeshHWMProotInterval, | ||
516 | u.mesh.mshcfg.dot11MeshHWMProotInterval, DEC); | ||
517 | IEEE80211_IF_FILE(dot11MeshHWMPconfirmationInterval, | ||
518 | u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval, DEC); | ||
513 | #endif | 519 | #endif |
514 | 520 | ||
515 | #define DEBUGFS_ADD_MODE(name, mode) \ | 521 | #define DEBUGFS_ADD_MODE(name, mode) \ |
@@ -611,6 +617,9 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata) | |||
611 | MESHPARAMS_ADD(dot11MeshGateAnnouncementProtocol); | 617 | MESHPARAMS_ADD(dot11MeshGateAnnouncementProtocol); |
612 | MESHPARAMS_ADD(rssi_threshold); | 618 | MESHPARAMS_ADD(rssi_threshold); |
613 | MESHPARAMS_ADD(ht_opmode); | 619 | MESHPARAMS_ADD(ht_opmode); |
620 | MESHPARAMS_ADD(dot11MeshHWMPactivePathToRootTimeout); | ||
621 | MESHPARAMS_ADD(dot11MeshHWMProotInterval); | ||
622 | MESHPARAMS_ADD(dot11MeshHWMPconfirmationInterval); | ||
614 | #undef MESHPARAMS_ADD | 623 | #undef MESHPARAMS_ADD |
615 | } | 624 | } |
616 | #endif | 625 | #endif |
@@ -686,6 +695,7 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) | |||
686 | 695 | ||
687 | sprintf(buf, "netdev:%s", sdata->name); | 696 | sprintf(buf, "netdev:%s", sdata->name); |
688 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) | 697 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) |
689 | pr_err("mac80211: debugfs: failed to rename debugfs " | 698 | sdata_err(sdata, |
690 | "dir to %s\n", buf); | 699 | "debugfs: failed to rename debugfs dir to %s\n", |
700 | buf); | ||
691 | } | 701 | } |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 6d33a0c743ab..44e8c1242781 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <net/mac80211.h> | 4 | #include <net/mac80211.h> |
5 | #include "ieee80211_i.h" | 5 | #include "ieee80211_i.h" |
6 | #include "driver-trace.h" | 6 | #include "trace.h" |
7 | 7 | ||
8 | static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) | 8 | static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) |
9 | { | 9 | { |
@@ -845,4 +845,19 @@ drv_allow_buffered_frames(struct ieee80211_local *local, | |||
845 | more_data); | 845 | more_data); |
846 | trace_drv_return_void(local); | 846 | trace_drv_return_void(local); |
847 | } | 847 | } |
848 | |||
849 | static inline int drv_get_rssi(struct ieee80211_local *local, | ||
850 | struct ieee80211_sub_if_data *sdata, | ||
851 | struct ieee80211_sta *sta, | ||
852 | s8 *rssi_dbm) | ||
853 | { | ||
854 | int ret; | ||
855 | |||
856 | might_sleep(); | ||
857 | |||
858 | ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm); | ||
859 | trace_drv_get_rssi(local, sta, *rssi_dbm, ret); | ||
860 | |||
861 | return ret; | ||
862 | } | ||
848 | #endif /* __MAC80211_DRIVER_OPS */ | 863 | #endif /* __MAC80211_DRIVER_OPS */ |
diff --git a/net/mac80211/driver-trace.c b/net/mac80211/driver-trace.c deleted file mode 100644 index 8ed8711b1a6d..000000000000 --- a/net/mac80211/driver-trace.c +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | /* bug in tracepoint.h, it should include this */ | ||
2 | #include <linux/module.h> | ||
3 | |||
4 | /* sparse isn't too happy with all macros... */ | ||
5 | #ifndef __CHECKER__ | ||
6 | #include "driver-ops.h" | ||
7 | #define CREATE_TRACE_POINTS | ||
8 | #include "driver-trace.h" | ||
9 | #endif | ||
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 6f8615c54b22..4b4538d63925 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -305,12 +305,10 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | |||
305 | tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; | 305 | tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; |
306 | initiator = (params & IEEE80211_DELBA_PARAM_INITIATOR_MASK) >> 11; | 306 | initiator = (params & IEEE80211_DELBA_PARAM_INITIATOR_MASK) >> 11; |
307 | 307 | ||
308 | #ifdef CONFIG_MAC80211_HT_DEBUG | 308 | ht_dbg_ratelimited(sdata, "delba from %pM (%s) tid %d reason code %d\n", |
309 | net_dbg_ratelimited("delba from %pM (%s) tid %d reason code %d\n", | 309 | mgmt->sa, initiator ? "initiator" : "recipient", |
310 | mgmt->sa, initiator ? "initiator" : "recipient", | 310 | tid, |
311 | tid, | 311 | le16_to_cpu(mgmt->u.action.u.delba.reason_code)); |
312 | le16_to_cpu(mgmt->u.action.u.delba.reason_code)); | ||
313 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
314 | 312 | ||
315 | if (initiator == WLAN_BACK_INITIATOR) | 313 | if (initiator == WLAN_BACK_INITIATOR) |
316 | __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0, | 314 | __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0, |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 725cb4be229d..5746d62faba1 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -261,11 +261,7 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, | |||
261 | 261 | ||
262 | memcpy(addr, sta->sta.addr, ETH_ALEN); | 262 | memcpy(addr, sta->sta.addr, ETH_ALEN); |
263 | 263 | ||
264 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 264 | ibss_dbg(sdata, "Adding new IBSS station %pM\n", addr); |
265 | wiphy_debug(sdata->local->hw.wiphy, | ||
266 | "Adding new IBSS station %pM (dev=%s)\n", | ||
267 | addr, sdata->name); | ||
268 | #endif | ||
269 | 265 | ||
270 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); | 266 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); |
271 | sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); | 267 | sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); |
@@ -279,9 +275,10 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, | |||
279 | /* If it fails, maybe we raced another insertion? */ | 275 | /* If it fails, maybe we raced another insertion? */ |
280 | if (sta_info_insert_rcu(sta)) | 276 | if (sta_info_insert_rcu(sta)) |
281 | return sta_info_get(sdata, addr); | 277 | return sta_info_get(sdata, addr); |
282 | if (auth) { | 278 | if (auth && !sdata->u.ibss.auth_frame_registrations) { |
283 | ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", | 279 | ibss_dbg(sdata, |
284 | sdata->vif.addr, sdata->u.ibss.bssid, addr); | 280 | "TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", |
281 | sdata->vif.addr, sdata->u.ibss.bssid, addr); | ||
285 | ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, | 282 | ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, |
286 | addr, sdata->u.ibss.bssid, NULL, 0, 0); | 283 | addr, sdata->u.ibss.bssid, NULL, 0, 0); |
287 | } | 284 | } |
@@ -304,7 +301,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
304 | * allow new one to be added. | 301 | * allow new one to be added. |
305 | */ | 302 | */ |
306 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 303 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
307 | net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", | 304 | net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n", |
308 | sdata->name, addr); | 305 | sdata->name, addr); |
309 | rcu_read_lock(); | 306 | rcu_read_lock(); |
310 | return NULL; | 307 | return NULL; |
@@ -351,9 +348,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, | |||
351 | 348 | ||
352 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) | 349 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) |
353 | return; | 350 | return; |
354 | ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", | 351 | ibss_dbg(sdata, |
355 | sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, | 352 | "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", |
356 | auth_transaction); | 353 | mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction); |
357 | sta_info_destroy_addr(sdata, mgmt->sa); | 354 | sta_info_destroy_addr(sdata, mgmt->sa); |
358 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); | 355 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); |
359 | rcu_read_unlock(); | 356 | rcu_read_unlock(); |
@@ -416,10 +413,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
416 | ieee80211_mandatory_rates(local, band); | 413 | ieee80211_mandatory_rates(local, band); |
417 | 414 | ||
418 | if (sta->sta.supp_rates[band] != prev_rates) { | 415 | if (sta->sta.supp_rates[band] != prev_rates) { |
419 | ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", | 416 | ibss_dbg(sdata, |
420 | sdata->name, sta->sta.addr, | 417 | "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", |
421 | prev_rates, | 418 | sta->sta.addr, prev_rates, |
422 | sta->sta.supp_rates[band]); | 419 | sta->sta.supp_rates[band]); |
423 | rates_updated = true; | 420 | rates_updated = true; |
424 | } | 421 | } |
425 | } else { | 422 | } else { |
@@ -534,16 +531,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
534 | rx_timestamp = drv_get_tsf(local, sdata); | 531 | rx_timestamp = drv_get_tsf(local, sdata); |
535 | } | 532 | } |
536 | 533 | ||
537 | ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", | 534 | ibss_dbg(sdata, |
538 | mgmt->sa, mgmt->bssid, | 535 | "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", |
539 | (unsigned long long)rx_timestamp, | 536 | mgmt->sa, mgmt->bssid, |
540 | (unsigned long long)beacon_timestamp, | 537 | (unsigned long long)rx_timestamp, |
541 | (unsigned long long)(rx_timestamp - beacon_timestamp), | 538 | (unsigned long long)beacon_timestamp, |
542 | jiffies); | 539 | (unsigned long long)(rx_timestamp - beacon_timestamp), |
540 | jiffies); | ||
543 | 541 | ||
544 | if (beacon_timestamp > rx_timestamp) { | 542 | if (beacon_timestamp > rx_timestamp) { |
545 | ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", | 543 | ibss_dbg(sdata, |
546 | sdata->name, mgmt->bssid); | 544 | "beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", |
545 | mgmt->bssid); | ||
547 | ieee80211_sta_join_ibss(sdata, bss); | 546 | ieee80211_sta_join_ibss(sdata, bss); |
548 | supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); | 547 | supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); |
549 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, | 548 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, |
@@ -569,7 +568,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, | |||
569 | * allow new one to be added. | 568 | * allow new one to be added. |
570 | */ | 569 | */ |
571 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 570 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
572 | net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", | 571 | net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n", |
573 | sdata->name, addr); | 572 | sdata->name, addr); |
574 | return; | 573 | return; |
575 | } | 574 | } |
@@ -645,8 +644,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | |||
645 | if (ifibss->fixed_channel) | 644 | if (ifibss->fixed_channel) |
646 | return; | 645 | return; |
647 | 646 | ||
648 | pr_debug("%s: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n", | 647 | sdata_info(sdata, |
649 | sdata->name); | 648 | "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n"); |
650 | 649 | ||
651 | ieee80211_request_internal_scan(sdata, | 650 | ieee80211_request_internal_scan(sdata, |
652 | ifibss->ssid, ifibss->ssid_len, NULL); | 651 | ifibss->ssid, ifibss->ssid_len, NULL); |
@@ -674,8 +673,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
674 | bssid[0] |= 0x02; | 673 | bssid[0] |= 0x02; |
675 | } | 674 | } |
676 | 675 | ||
677 | pr_debug("%s: Creating new IBSS network, BSSID %pM\n", | 676 | sdata_info(sdata, "Creating new IBSS network, BSSID %pM\n", bssid); |
678 | sdata->name, bssid); | ||
679 | 677 | ||
680 | capability = WLAN_CAPABILITY_IBSS; | 678 | capability = WLAN_CAPABILITY_IBSS; |
681 | 679 | ||
@@ -706,8 +704,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
706 | lockdep_assert_held(&ifibss->mtx); | 704 | lockdep_assert_held(&ifibss->mtx); |
707 | 705 | ||
708 | active_ibss = ieee80211_sta_active_ibss(sdata); | 706 | active_ibss = ieee80211_sta_active_ibss(sdata); |
709 | ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n", | 707 | ibss_dbg(sdata, "sta_find_ibss (active_ibss=%d)\n", active_ibss); |
710 | sdata->name, active_ibss); | ||
711 | 708 | ||
712 | if (active_ibss) | 709 | if (active_ibss) |
713 | return; | 710 | return; |
@@ -730,23 +727,24 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
730 | struct ieee80211_bss *bss; | 727 | struct ieee80211_bss *bss; |
731 | 728 | ||
732 | bss = (void *)cbss->priv; | 729 | bss = (void *)cbss->priv; |
733 | ibss_vdbg(" sta_find_ibss: selected %pM current %pM\n", | 730 | ibss_dbg(sdata, |
734 | cbss->bssid, ifibss->bssid); | 731 | "sta_find_ibss: selected %pM current %pM\n", |
735 | pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", | 732 | cbss->bssid, ifibss->bssid); |
736 | sdata->name, cbss->bssid); | 733 | sdata_info(sdata, |
734 | "Selected IBSS BSSID %pM based on configured SSID\n", | ||
735 | cbss->bssid); | ||
737 | 736 | ||
738 | ieee80211_sta_join_ibss(sdata, bss); | 737 | ieee80211_sta_join_ibss(sdata, bss); |
739 | ieee80211_rx_bss_put(local, bss); | 738 | ieee80211_rx_bss_put(local, bss); |
740 | return; | 739 | return; |
741 | } | 740 | } |
742 | 741 | ||
743 | ibss_vdbg(" did not try to join ibss\n"); | 742 | ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n"); |
744 | 743 | ||
745 | /* Selected IBSS not found in current scan results - try to scan */ | 744 | /* Selected IBSS not found in current scan results - try to scan */ |
746 | if (time_after(jiffies, ifibss->last_scan_completed + | 745 | if (time_after(jiffies, ifibss->last_scan_completed + |
747 | IEEE80211_SCAN_INTERVAL)) { | 746 | IEEE80211_SCAN_INTERVAL)) { |
748 | pr_debug("%s: Trigger new scan to find an IBSS to join\n", | 747 | sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); |
749 | sdata->name); | ||
750 | 748 | ||
751 | ieee80211_request_internal_scan(sdata, | 749 | ieee80211_request_internal_scan(sdata, |
752 | ifibss->ssid, ifibss->ssid_len, | 750 | ifibss->ssid, ifibss->ssid_len, |
@@ -760,9 +758,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
760 | ieee80211_sta_create_ibss(sdata); | 758 | ieee80211_sta_create_ibss(sdata); |
761 | return; | 759 | return; |
762 | } | 760 | } |
763 | pr_debug("%s: IBSS not allowed on %d MHz\n", | 761 | sdata_info(sdata, "IBSS not allowed on %d MHz\n", |
764 | sdata->name, | 762 | local->hw.conf.channel->center_freq); |
765 | local->hw.conf.channel->center_freq); | ||
766 | 763 | ||
767 | /* No IBSS found - decrease scan interval and continue | 764 | /* No IBSS found - decrease scan interval and continue |
768 | * scanning. */ | 765 | * scanning. */ |
@@ -797,9 +794,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
797 | 794 | ||
798 | tx_last_beacon = drv_tx_last_beacon(local); | 795 | tx_last_beacon = drv_tx_last_beacon(local); |
799 | 796 | ||
800 | ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", | 797 | ibss_dbg(sdata, |
801 | sdata->name, mgmt->sa, mgmt->da, | 798 | "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", |
802 | mgmt->bssid, tx_last_beacon); | 799 | mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon); |
803 | 800 | ||
804 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) | 801 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) |
805 | return; | 802 | return; |
@@ -812,8 +809,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
812 | pos = mgmt->u.probe_req.variable; | 809 | pos = mgmt->u.probe_req.variable; |
813 | if (pos[0] != WLAN_EID_SSID || | 810 | if (pos[0] != WLAN_EID_SSID || |
814 | pos + 2 + pos[1] > end) { | 811 | pos + 2 + pos[1] > end) { |
815 | ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n", | 812 | ibss_dbg(sdata, "Invalid SSID IE in ProbeReq from %pM\n", |
816 | sdata->name, mgmt->sa); | 813 | mgmt->sa); |
817 | return; | 814 | return; |
818 | } | 815 | } |
819 | if (pos[1] != 0 && | 816 | if (pos[1] != 0 && |
@@ -830,7 +827,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
830 | 827 | ||
831 | resp = (struct ieee80211_mgmt *) skb->data; | 828 | resp = (struct ieee80211_mgmt *) skb->data; |
832 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 829 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
833 | ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da); | 830 | ibss_dbg(sdata, "Sending ProbeResp to %pM\n", resp->da); |
834 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 831 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
835 | ieee80211_tx_skb(sdata, skb); | 832 | ieee80211_tx_skb(sdata, skb); |
836 | } | 833 | } |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e6cbf5b68c89..f834a005e1c5 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <net/mac80211.h> | 30 | #include <net/mac80211.h> |
31 | #include "key.h" | 31 | #include "key.h" |
32 | #include "sta_info.h" | 32 | #include "sta_info.h" |
33 | #include "debug.h" | ||
33 | 34 | ||
34 | struct ieee80211_local; | 35 | struct ieee80211_local; |
35 | 36 | ||
@@ -55,11 +56,14 @@ struct ieee80211_local; | |||
55 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) | 56 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) |
56 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) | 57 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) |
57 | 58 | ||
59 | /* | ||
60 | * Some APs experience problems when working with U-APSD. Decrease the | ||
61 | * probability of that happening by using legacy mode for all ACs but VO. | ||
62 | * The AP that caused us trouble was a Cisco 4410N. It ignores our | ||
63 | * setting, and always treats non-VO ACs as legacy. | ||
64 | */ | ||
58 | #define IEEE80211_DEFAULT_UAPSD_QUEUES \ | 65 | #define IEEE80211_DEFAULT_UAPSD_QUEUES \ |
59 | (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK | \ | 66 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |
60 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \ | ||
61 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \ | ||
62 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) | ||
63 | 67 | ||
64 | #define IEEE80211_DEFAULT_MAX_SP_LEN \ | 68 | #define IEEE80211_DEFAULT_MAX_SP_LEN \ |
65 | IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL | 69 | IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL |
@@ -508,6 +512,7 @@ struct ieee80211_if_ibss { | |||
508 | bool privacy; | 512 | bool privacy; |
509 | 513 | ||
510 | bool control_port; | 514 | bool control_port; |
515 | unsigned int auth_frame_registrations; | ||
511 | 516 | ||
512 | u8 bssid[ETH_ALEN] __aligned(2); | 517 | u8 bssid[ETH_ALEN] __aligned(2); |
513 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 518 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
@@ -677,6 +682,9 @@ struct ieee80211_sub_if_data { | |||
677 | /* TID bitmap for NoAck policy */ | 682 | /* TID bitmap for NoAck policy */ |
678 | u16 noack_map; | 683 | u16 noack_map; |
679 | 684 | ||
685 | /* bit field of ACM bits (BIT(802.1D tag)) */ | ||
686 | u8 wmm_acm; | ||
687 | |||
680 | struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; | 688 | struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; |
681 | struct ieee80211_key __rcu *default_unicast_key; | 689 | struct ieee80211_key __rcu *default_unicast_key; |
682 | struct ieee80211_key __rcu *default_multicast_key; | 690 | struct ieee80211_key __rcu *default_multicast_key; |
@@ -881,6 +889,9 @@ struct ieee80211_local { | |||
881 | /* device is started */ | 889 | /* device is started */ |
882 | bool started; | 890 | bool started; |
883 | 891 | ||
892 | /* device is during a HW reconfig */ | ||
893 | bool in_reconfig; | ||
894 | |||
884 | /* wowlan is enabled -- don't reconfig on resume */ | 895 | /* wowlan is enabled -- don't reconfig on resume */ |
885 | bool wowlan; | 896 | bool wowlan; |
886 | 897 | ||
@@ -1019,7 +1030,6 @@ struct ieee80211_local { | |||
1019 | int total_ps_buffered; /* total number of all buffered unicast and | 1030 | int total_ps_buffered; /* total number of all buffered unicast and |
1020 | * multicast packets for power saving stations | 1031 | * multicast packets for power saving stations |
1021 | */ | 1032 | */ |
1022 | unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ | ||
1023 | 1033 | ||
1024 | bool pspolling; | 1034 | bool pspolling; |
1025 | bool offchannel_ps_enabled; | 1035 | bool offchannel_ps_enabled; |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 87aeb4f21ffd..58c2ab3d483a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -57,9 +57,6 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | |||
57 | return -EINVAL; | 57 | return -EINVAL; |
58 | } | 58 | } |
59 | 59 | ||
60 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
61 | pr_debug("%s: setting MTU %d\n", dev->name, new_mtu); | ||
62 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
63 | dev->mtu = new_mtu; | 60 | dev->mtu = new_mtu; |
64 | return 0; | 61 | return 0; |
65 | } | 62 | } |
@@ -100,15 +97,12 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, | |||
100 | { | 97 | { |
101 | struct ieee80211_local *local = sdata->local; | 98 | struct ieee80211_local *local = sdata->local; |
102 | struct ieee80211_sub_if_data *nsdata; | 99 | struct ieee80211_sub_if_data *nsdata; |
103 | struct net_device *dev = sdata->dev; | ||
104 | 100 | ||
105 | ASSERT_RTNL(); | 101 | ASSERT_RTNL(); |
106 | 102 | ||
107 | /* we hold the RTNL here so can safely walk the list */ | 103 | /* we hold the RTNL here so can safely walk the list */ |
108 | list_for_each_entry(nsdata, &local->interfaces, list) { | 104 | list_for_each_entry(nsdata, &local->interfaces, list) { |
109 | struct net_device *ndev = nsdata->dev; | 105 | if (nsdata != sdata && ieee80211_sdata_running(nsdata)) { |
110 | |||
111 | if (ndev != dev && ieee80211_sdata_running(nsdata)) { | ||
112 | /* | 106 | /* |
113 | * Allow only a single IBSS interface to be up at any | 107 | * Allow only a single IBSS interface to be up at any |
114 | * time. This is restricted because beacon distribution | 108 | * time. This is restricted because beacon distribution |
@@ -127,7 +121,8 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, | |||
127 | * The remaining checks are only performed for interfaces | 121 | * The remaining checks are only performed for interfaces |
128 | * with the same MAC address. | 122 | * with the same MAC address. |
129 | */ | 123 | */ |
130 | if (!ether_addr_equal(dev->dev_addr, ndev->dev_addr)) | 124 | if (!ether_addr_equal(sdata->vif.addr, |
125 | nsdata->vif.addr)) | ||
131 | continue; | 126 | continue; |
132 | 127 | ||
133 | /* | 128 | /* |
@@ -808,7 +803,7 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev, | |||
808 | 803 | ||
809 | hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); | 804 | hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); |
810 | 805 | ||
811 | return ieee80211_select_queue_80211(local, skb, hdr); | 806 | return ieee80211_select_queue_80211(sdata, skb, hdr); |
812 | } | 807 | } |
813 | 808 | ||
814 | static const struct net_device_ops ieee80211_monitorif_ops = { | 809 | static const struct net_device_ops ieee80211_monitorif_ops = { |
@@ -1223,7 +1218,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1223 | 1218 | ||
1224 | if (__ffs64(mask) + hweight64(mask) != fls64(mask)) { | 1219 | if (__ffs64(mask) + hweight64(mask) != fls64(mask)) { |
1225 | /* not a contiguous mask ... not handled now! */ | 1220 | /* not a contiguous mask ... not handled now! */ |
1226 | pr_debug("not contiguous\n"); | 1221 | pr_info("not contiguous\n"); |
1227 | break; | 1222 | break; |
1228 | } | 1223 | } |
1229 | 1224 | ||
@@ -1414,10 +1409,6 @@ static u32 ieee80211_idle_off(struct ieee80211_local *local, | |||
1414 | if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) | 1409 | if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) |
1415 | return 0; | 1410 | return 0; |
1416 | 1411 | ||
1417 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
1418 | wiphy_debug(local->hw.wiphy, "device no longer idle - %s\n", reason); | ||
1419 | #endif | ||
1420 | |||
1421 | local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; | 1412 | local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; |
1422 | return IEEE80211_CONF_CHANGE_IDLE; | 1413 | return IEEE80211_CONF_CHANGE_IDLE; |
1423 | } | 1414 | } |
@@ -1427,10 +1418,6 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local) | |||
1427 | if (local->hw.conf.flags & IEEE80211_CONF_IDLE) | 1418 | if (local->hw.conf.flags & IEEE80211_CONF_IDLE) |
1428 | return 0; | 1419 | return 0; |
1429 | 1420 | ||
1430 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
1431 | wiphy_debug(local->hw.wiphy, "device now idle\n"); | ||
1432 | #endif | ||
1433 | |||
1434 | drv_flush(local, false); | 1421 | drv_flush(local, false); |
1435 | 1422 | ||
1436 | local->hw.conf.flags |= IEEE80211_CONF_IDLE; | 1423 | local->hw.conf.flags |= IEEE80211_CONF_IDLE; |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 5bb600d93d77..b3b7e526e245 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -139,7 +139,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | if (ret != -ENOSPC && ret != -EOPNOTSUPP) | 141 | if (ret != -ENOSPC && ret != -EOPNOTSUPP) |
142 | wiphy_err(key->local->hw.wiphy, | 142 | sdata_err(sdata, |
143 | "failed to set key (%d, %pM) to hardware (%d)\n", | 143 | "failed to set key (%d, %pM) to hardware (%d)\n", |
144 | key->conf.keyidx, | 144 | key->conf.keyidx, |
145 | sta ? sta->sta.addr : bcast_addr, ret); | 145 | sta ? sta->sta.addr : bcast_addr, ret); |
@@ -186,7 +186,7 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
186 | sta ? &sta->sta : NULL, &key->conf); | 186 | sta ? &sta->sta : NULL, &key->conf); |
187 | 187 | ||
188 | if (ret) | 188 | if (ret) |
189 | wiphy_err(key->local->hw.wiphy, | 189 | sdata_err(sdata, |
190 | "failed to remove key (%d, %pM) from hardware (%d)\n", | 190 | "failed to remove key (%d, %pM) from hardware (%d)\n", |
191 | key->conf.keyidx, | 191 | key->conf.keyidx, |
192 | sta ? sta->sta.addr : bcast_addr, ret); | 192 | sta ? sta->sta.addr : bcast_addr, ret); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d81c178c7712..0b040fb73673 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -345,6 +345,13 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw) | |||
345 | ieee80211_stop_queues_by_reason(hw, | 345 | ieee80211_stop_queues_by_reason(hw, |
346 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | 346 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); |
347 | 347 | ||
348 | /* | ||
349 | * Stop all Rx during the reconfig. We don't want state changes | ||
350 | * or driver callbacks while this is in progress. | ||
351 | */ | ||
352 | local->in_reconfig = true; | ||
353 | barrier(); | ||
354 | |||
348 | schedule_work(&local->restart_work); | 355 | schedule_work(&local->restart_work); |
349 | } | 356 | } |
350 | EXPORT_SYMBOL(ieee80211_restart_hw); | 357 | EXPORT_SYMBOL(ieee80211_restart_hw); |
@@ -455,7 +462,9 @@ static const struct ieee80211_txrx_stypes | |||
455 | ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { | 462 | ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { |
456 | [NL80211_IFTYPE_ADHOC] = { | 463 | [NL80211_IFTYPE_ADHOC] = { |
457 | .tx = 0xffff, | 464 | .tx = 0xffff, |
458 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4), | 465 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
466 | BIT(IEEE80211_STYPE_AUTH >> 4) | | ||
467 | BIT(IEEE80211_STYPE_DEAUTH >> 4), | ||
459 | }, | 468 | }, |
460 | [NL80211_IFTYPE_STATION] = { | 469 | [NL80211_IFTYPE_STATION] = { |
461 | .tx = 0xffff, | 470 | .tx = 0xffff, |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 7cf19509fb68..764593d65fc3 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -443,7 +443,7 @@ static void ieee80211_mesh_path_root_timer(unsigned long data) | |||
443 | 443 | ||
444 | void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh) | 444 | void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh) |
445 | { | 445 | { |
446 | if (ifmsh->mshcfg.dot11MeshHWMPRootMode) | 446 | if (ifmsh->mshcfg.dot11MeshHWMPRootMode > IEEE80211_ROOTMODE_ROOT) |
447 | set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); | 447 | set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); |
448 | else { | 448 | else { |
449 | clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); | 449 | clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); |
@@ -523,10 +523,6 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | |||
523 | { | 523 | { |
524 | bool free_plinks; | 524 | bool free_plinks; |
525 | 525 | ||
526 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
527 | pr_debug("%s: running mesh housekeeping\n", sdata->name); | ||
528 | #endif | ||
529 | |||
530 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | 526 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); |
531 | mesh_path_expire(sdata); | 527 | mesh_path_expire(sdata); |
532 | 528 | ||
@@ -541,11 +537,17 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | |||
541 | static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata) | 537 | static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata) |
542 | { | 538 | { |
543 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 539 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
540 | u32 interval; | ||
544 | 541 | ||
545 | mesh_path_tx_root_frame(sdata); | 542 | mesh_path_tx_root_frame(sdata); |
543 | |||
544 | if (ifmsh->mshcfg.dot11MeshHWMPRootMode == IEEE80211_PROACTIVE_RANN) | ||
545 | interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; | ||
546 | else | ||
547 | interval = ifmsh->mshcfg.dot11MeshHWMProotInterval; | ||
548 | |||
546 | mod_timer(&ifmsh->mesh_path_root_timer, | 549 | mod_timer(&ifmsh->mesh_path_root_timer, |
547 | round_jiffies(TU_TO_EXP_TIME( | 550 | round_jiffies(TU_TO_EXP_TIME(interval))); |
548 | ifmsh->mshcfg.dot11MeshHWMPRannInterval))); | ||
549 | } | 551 | } |
550 | 552 | ||
551 | #ifdef CONFIG_PM | 553 | #ifdef CONFIG_PM |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index e3642756f8f4..faaa39bcfd10 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -104,6 +104,7 @@ enum mesh_deferred_task_flags { | |||
104 | * an mpath to a hash bucket on a path table. | 104 | * an mpath to a hash bucket on a path table. |
105 | * @rann_snd_addr: the RANN sender address | 105 | * @rann_snd_addr: the RANN sender address |
106 | * @rann_metric: the aggregated path metric towards the root node | 106 | * @rann_metric: the aggregated path metric towards the root node |
107 | * @last_preq_to_root: Timestamp of last PREQ sent to root | ||
107 | * @is_root: the destination station of this path is a root node | 108 | * @is_root: the destination station of this path is a root node |
108 | * @is_gate: the destination station of this path is a mesh gate | 109 | * @is_gate: the destination station of this path is a mesh gate |
109 | * | 110 | * |
@@ -131,6 +132,7 @@ struct mesh_path { | |||
131 | spinlock_t state_lock; | 132 | spinlock_t state_lock; |
132 | u8 rann_snd_addr[ETH_ALEN]; | 133 | u8 rann_snd_addr[ETH_ALEN]; |
133 | u32 rann_metric; | 134 | u32 rann_metric; |
135 | unsigned long last_preq_to_root; | ||
134 | bool is_root; | 136 | bool is_root; |
135 | bool is_gate; | 137 | bool is_gate; |
136 | }; | 138 | }; |
@@ -245,7 +247,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); | |||
245 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); | 247 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); |
246 | void ieee80211s_init(void); | 248 | void ieee80211s_init(void); |
247 | void ieee80211s_update_metric(struct ieee80211_local *local, | 249 | void ieee80211s_update_metric(struct ieee80211_local *local, |
248 | struct sta_info *stainfo, struct sk_buff *skb); | 250 | struct sta_info *sta, struct sk_buff *skb); |
249 | void ieee80211s_stop(void); | 251 | void ieee80211s_stop(void); |
250 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); | 252 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); |
251 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); | 253 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index fa7c58035246..fb7b6a11d0ba 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -13,13 +13,6 @@ | |||
13 | #include "wme.h" | 13 | #include "wme.h" |
14 | #include "mesh.h" | 14 | #include "mesh.h" |
15 | 15 | ||
16 | #ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG | ||
17 | #define mhwmp_dbg(fmt, args...) \ | ||
18 | pr_debug("Mesh HWMP (%s): " fmt "\n", sdata->name, ##args) | ||
19 | #else | ||
20 | #define mhwmp_dbg(fmt, args...) do { (void)(0); } while (0) | ||
21 | #endif | ||
22 | |||
23 | #define TEST_FRAME_LEN 8192 | 16 | #define TEST_FRAME_LEN 8192 |
24 | #define MAX_METRIC 0xffffffff | 17 | #define MAX_METRIC 0xffffffff |
25 | #define ARITH_SHIFT 8 | 18 | #define ARITH_SHIFT 8 |
@@ -98,6 +91,8 @@ static inline u32 u16_field_get(u8 *preq_elem, int offset, bool ae) | |||
98 | #define max_preq_retries(s) (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries) | 91 | #define max_preq_retries(s) (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries) |
99 | #define disc_timeout_jiff(s) \ | 92 | #define disc_timeout_jiff(s) \ |
100 | msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout) | 93 | msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout) |
94 | #define root_path_confirmation_jiffies(s) \ | ||
95 | msecs_to_jiffies(sdata->u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval) | ||
101 | 96 | ||
102 | enum mpath_frame_type { | 97 | enum mpath_frame_type { |
103 | MPATH_PREQ = 0, | 98 | MPATH_PREQ = 0, |
@@ -142,19 +137,19 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | |||
142 | 137 | ||
143 | switch (action) { | 138 | switch (action) { |
144 | case MPATH_PREQ: | 139 | case MPATH_PREQ: |
145 | mhwmp_dbg("sending PREQ to %pM", target); | 140 | mhwmp_dbg(sdata, "sending PREQ to %pM\n", target); |
146 | ie_len = 37; | 141 | ie_len = 37; |
147 | pos = skb_put(skb, 2 + ie_len); | 142 | pos = skb_put(skb, 2 + ie_len); |
148 | *pos++ = WLAN_EID_PREQ; | 143 | *pos++ = WLAN_EID_PREQ; |
149 | break; | 144 | break; |
150 | case MPATH_PREP: | 145 | case MPATH_PREP: |
151 | mhwmp_dbg("sending PREP to %pM", target); | 146 | mhwmp_dbg(sdata, "sending PREP to %pM\n", target); |
152 | ie_len = 31; | 147 | ie_len = 31; |
153 | pos = skb_put(skb, 2 + ie_len); | 148 | pos = skb_put(skb, 2 + ie_len); |
154 | *pos++ = WLAN_EID_PREP; | 149 | *pos++ = WLAN_EID_PREP; |
155 | break; | 150 | break; |
156 | case MPATH_RANN: | 151 | case MPATH_RANN: |
157 | mhwmp_dbg("sending RANN from %pM", orig_addr); | 152 | mhwmp_dbg(sdata, "sending RANN from %pM\n", orig_addr); |
158 | ie_len = sizeof(struct ieee80211_rann_ie); | 153 | ie_len = sizeof(struct ieee80211_rann_ie); |
159 | pos = skb_put(skb, 2 + ie_len); | 154 | pos = skb_put(skb, 2 + ie_len); |
160 | *pos++ = WLAN_EID_RANN; | 155 | *pos++ = WLAN_EID_RANN; |
@@ -303,7 +298,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, | |||
303 | } | 298 | } |
304 | 299 | ||
305 | void ieee80211s_update_metric(struct ieee80211_local *local, | 300 | void ieee80211s_update_metric(struct ieee80211_local *local, |
306 | struct sta_info *stainfo, struct sk_buff *skb) | 301 | struct sta_info *sta, struct sk_buff *skb) |
307 | { | 302 | { |
308 | struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); | 303 | struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); |
309 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 304 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
@@ -315,15 +310,14 @@ void ieee80211s_update_metric(struct ieee80211_local *local, | |||
315 | failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); | 310 | failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); |
316 | 311 | ||
317 | /* moving average, scaled to 100 */ | 312 | /* moving average, scaled to 100 */ |
318 | stainfo->fail_avg = ((80 * stainfo->fail_avg + 5) / 100 + 20 * failed); | 313 | sta->fail_avg = ((80 * sta->fail_avg + 5) / 100 + 20 * failed); |
319 | if (stainfo->fail_avg > 95) | 314 | if (sta->fail_avg > 95) |
320 | mesh_plink_broken(stainfo); | 315 | mesh_plink_broken(sta); |
321 | } | 316 | } |
322 | 317 | ||
323 | static u32 airtime_link_metric_get(struct ieee80211_local *local, | 318 | static u32 airtime_link_metric_get(struct ieee80211_local *local, |
324 | struct sta_info *sta) | 319 | struct sta_info *sta) |
325 | { | 320 | { |
326 | struct ieee80211_supported_band *sband; | ||
327 | struct rate_info rinfo; | 321 | struct rate_info rinfo; |
328 | /* This should be adjusted for each device */ | 322 | /* This should be adjusted for each device */ |
329 | int device_constant = 1 << ARITH_SHIFT; | 323 | int device_constant = 1 << ARITH_SHIFT; |
@@ -333,8 +327,6 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, | |||
333 | u32 tx_time, estimated_retx; | 327 | u32 tx_time, estimated_retx; |
334 | u64 result; | 328 | u64 result; |
335 | 329 | ||
336 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
337 | |||
338 | if (sta->fail_avg >= 100) | 330 | if (sta->fail_avg >= 100) |
339 | return MAX_METRIC; | 331 | return MAX_METRIC; |
340 | 332 | ||
@@ -519,10 +511,11 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
519 | struct mesh_path *mpath = NULL; | 511 | struct mesh_path *mpath = NULL; |
520 | u8 *target_addr, *orig_addr; | 512 | u8 *target_addr, *orig_addr; |
521 | const u8 *da; | 513 | const u8 *da; |
522 | u8 target_flags, ttl; | 514 | u8 target_flags, ttl, flags; |
523 | u32 orig_sn, target_sn, lifetime; | 515 | u32 orig_sn, target_sn, lifetime, orig_metric; |
524 | bool reply = false; | 516 | bool reply = false; |
525 | bool forward = true; | 517 | bool forward = true; |
518 | bool root_is_gate; | ||
526 | 519 | ||
527 | /* Update target SN, if present */ | 520 | /* Update target SN, if present */ |
528 | target_addr = PREQ_IE_TARGET_ADDR(preq_elem); | 521 | target_addr = PREQ_IE_TARGET_ADDR(preq_elem); |
@@ -530,11 +523,15 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
530 | target_sn = PREQ_IE_TARGET_SN(preq_elem); | 523 | target_sn = PREQ_IE_TARGET_SN(preq_elem); |
531 | orig_sn = PREQ_IE_ORIG_SN(preq_elem); | 524 | orig_sn = PREQ_IE_ORIG_SN(preq_elem); |
532 | target_flags = PREQ_IE_TARGET_F(preq_elem); | 525 | target_flags = PREQ_IE_TARGET_F(preq_elem); |
526 | orig_metric = metric; | ||
527 | /* Proactive PREQ gate announcements */ | ||
528 | flags = PREQ_IE_FLAGS(preq_elem); | ||
529 | root_is_gate = !!(flags & RANN_FLAG_IS_GATE); | ||
533 | 530 | ||
534 | mhwmp_dbg("received PREQ from %pM", orig_addr); | 531 | mhwmp_dbg(sdata, "received PREQ from %pM\n", orig_addr); |
535 | 532 | ||
536 | if (ether_addr_equal(target_addr, sdata->vif.addr)) { | 533 | if (ether_addr_equal(target_addr, sdata->vif.addr)) { |
537 | mhwmp_dbg("PREQ is for us"); | 534 | mhwmp_dbg(sdata, "PREQ is for us\n"); |
538 | forward = false; | 535 | forward = false; |
539 | reply = true; | 536 | reply = true; |
540 | metric = 0; | 537 | metric = 0; |
@@ -544,6 +541,22 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
544 | target_sn = ++ifmsh->sn; | 541 | target_sn = ++ifmsh->sn; |
545 | ifmsh->last_sn_update = jiffies; | 542 | ifmsh->last_sn_update = jiffies; |
546 | } | 543 | } |
544 | } else if (is_broadcast_ether_addr(target_addr) && | ||
545 | (target_flags & IEEE80211_PREQ_TO_FLAG)) { | ||
546 | rcu_read_lock(); | ||
547 | mpath = mesh_path_lookup(orig_addr, sdata); | ||
548 | if (mpath) { | ||
549 | if (flags & IEEE80211_PREQ_PROACTIVE_PREP_FLAG) { | ||
550 | reply = true; | ||
551 | target_addr = sdata->vif.addr; | ||
552 | target_sn = ++ifmsh->sn; | ||
553 | metric = 0; | ||
554 | ifmsh->last_sn_update = jiffies; | ||
555 | } | ||
556 | if (root_is_gate) | ||
557 | mesh_path_add_gate(mpath); | ||
558 | } | ||
559 | rcu_read_unlock(); | ||
547 | } else { | 560 | } else { |
548 | rcu_read_lock(); | 561 | rcu_read_lock(); |
549 | mpath = mesh_path_lookup(target_addr, sdata); | 562 | mpath = mesh_path_lookup(target_addr, sdata); |
@@ -570,19 +583,20 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
570 | lifetime = PREQ_IE_LIFETIME(preq_elem); | 583 | lifetime = PREQ_IE_LIFETIME(preq_elem); |
571 | ttl = ifmsh->mshcfg.element_ttl; | 584 | ttl = ifmsh->mshcfg.element_ttl; |
572 | if (ttl != 0) { | 585 | if (ttl != 0) { |
573 | mhwmp_dbg("replying to the PREQ"); | 586 | mhwmp_dbg(sdata, "replying to the PREQ\n"); |
574 | mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, | 587 | mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, |
575 | cpu_to_le32(orig_sn), 0, target_addr, | 588 | cpu_to_le32(orig_sn), 0, target_addr, |
576 | cpu_to_le32(target_sn), mgmt->sa, 0, ttl, | 589 | cpu_to_le32(target_sn), mgmt->sa, 0, ttl, |
577 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 590 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
578 | 0, sdata); | 591 | 0, sdata); |
579 | } else | 592 | } else { |
580 | ifmsh->mshstats.dropped_frames_ttl++; | 593 | ifmsh->mshstats.dropped_frames_ttl++; |
594 | } | ||
581 | } | 595 | } |
582 | 596 | ||
583 | if (forward && ifmsh->mshcfg.dot11MeshForwarding) { | 597 | if (forward && ifmsh->mshcfg.dot11MeshForwarding) { |
584 | u32 preq_id; | 598 | u32 preq_id; |
585 | u8 hopcount, flags; | 599 | u8 hopcount; |
586 | 600 | ||
587 | ttl = PREQ_IE_TTL(preq_elem); | 601 | ttl = PREQ_IE_TTL(preq_elem); |
588 | lifetime = PREQ_IE_LIFETIME(preq_elem); | 602 | lifetime = PREQ_IE_LIFETIME(preq_elem); |
@@ -590,13 +604,19 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
590 | ifmsh->mshstats.dropped_frames_ttl++; | 604 | ifmsh->mshstats.dropped_frames_ttl++; |
591 | return; | 605 | return; |
592 | } | 606 | } |
593 | mhwmp_dbg("forwarding the PREQ from %pM", orig_addr); | 607 | mhwmp_dbg(sdata, "forwarding the PREQ from %pM\n", orig_addr); |
594 | --ttl; | 608 | --ttl; |
595 | flags = PREQ_IE_FLAGS(preq_elem); | ||
596 | preq_id = PREQ_IE_PREQ_ID(preq_elem); | 609 | preq_id = PREQ_IE_PREQ_ID(preq_elem); |
597 | hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; | 610 | hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; |
598 | da = (mpath && mpath->is_root) ? | 611 | da = (mpath && mpath->is_root) ? |
599 | mpath->rann_snd_addr : broadcast_addr; | 612 | mpath->rann_snd_addr : broadcast_addr; |
613 | |||
614 | if (flags & IEEE80211_PREQ_PROACTIVE_PREP_FLAG) { | ||
615 | target_addr = PREQ_IE_TARGET_ADDR(preq_elem); | ||
616 | target_sn = PREQ_IE_TARGET_SN(preq_elem); | ||
617 | metric = orig_metric; | ||
618 | } | ||
619 | |||
600 | mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, | 620 | mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, |
601 | cpu_to_le32(orig_sn), target_flags, target_addr, | 621 | cpu_to_le32(orig_sn), target_flags, target_addr, |
602 | cpu_to_le32(target_sn), da, | 622 | cpu_to_le32(target_sn), da, |
@@ -631,7 +651,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
631 | u8 next_hop[ETH_ALEN]; | 651 | u8 next_hop[ETH_ALEN]; |
632 | u32 target_sn, orig_sn, lifetime; | 652 | u32 target_sn, orig_sn, lifetime; |
633 | 653 | ||
634 | mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); | 654 | mhwmp_dbg(sdata, "received PREP from %pM\n", |
655 | PREP_IE_ORIG_ADDR(prep_elem)); | ||
635 | 656 | ||
636 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); | 657 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); |
637 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) | 658 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) |
@@ -744,11 +765,6 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
744 | bool root_is_gate; | 765 | bool root_is_gate; |
745 | 766 | ||
746 | ttl = rann->rann_ttl; | 767 | ttl = rann->rann_ttl; |
747 | if (ttl <= 1) { | ||
748 | ifmsh->mshstats.dropped_frames_ttl++; | ||
749 | return; | ||
750 | } | ||
751 | ttl--; | ||
752 | flags = rann->rann_flags; | 768 | flags = rann->rann_flags; |
753 | root_is_gate = !!(flags & RANN_FLAG_IS_GATE); | 769 | root_is_gate = !!(flags & RANN_FLAG_IS_GATE); |
754 | orig_addr = rann->rann_addr; | 770 | orig_addr = rann->rann_addr; |
@@ -762,8 +778,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
762 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) | 778 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) |
763 | return; | 779 | return; |
764 | 780 | ||
765 | mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", | 781 | mhwmp_dbg(sdata, |
766 | orig_addr, mgmt->sa, root_is_gate); | 782 | "received RANN from %pM via neighbour %pM (is_gate=%d)\n", |
783 | orig_addr, mgmt->sa, root_is_gate); | ||
767 | 784 | ||
768 | rcu_read_lock(); | 785 | rcu_read_lock(); |
769 | sta = sta_info_get(sdata, mgmt->sa); | 786 | sta = sta_info_get(sdata, mgmt->sa); |
@@ -785,34 +802,50 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
785 | } | 802 | } |
786 | } | 803 | } |
787 | 804 | ||
805 | if (!(SN_LT(mpath->sn, orig_sn)) && | ||
806 | !(mpath->sn == orig_sn && metric < mpath->rann_metric)) { | ||
807 | rcu_read_unlock(); | ||
808 | return; | ||
809 | } | ||
810 | |||
788 | if ((!(mpath->flags & (MESH_PATH_ACTIVE | MESH_PATH_RESOLVING)) || | 811 | if ((!(mpath->flags & (MESH_PATH_ACTIVE | MESH_PATH_RESOLVING)) || |
789 | time_after(jiffies, mpath->exp_time - 1*HZ)) && | 812 | (time_after(jiffies, mpath->last_preq_to_root + |
790 | !(mpath->flags & MESH_PATH_FIXED)) { | 813 | root_path_confirmation_jiffies(sdata)) || |
791 | mhwmp_dbg("%s time to refresh root mpath %pM", sdata->name, | 814 | time_before(jiffies, mpath->last_preq_to_root))) && |
792 | orig_addr); | 815 | !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) { |
816 | mhwmp_dbg(sdata, | ||
817 | "time to refresh root mpath %pM\n", | ||
818 | orig_addr); | ||
793 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 819 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
820 | mpath->last_preq_to_root = jiffies; | ||
821 | } | ||
822 | |||
823 | mpath->sn = orig_sn; | ||
824 | mpath->rann_metric = metric + metric_txsta; | ||
825 | mpath->is_root = true; | ||
826 | /* Recording RANNs sender address to send individually | ||
827 | * addressed PREQs destined for root mesh STA */ | ||
828 | memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN); | ||
829 | |||
830 | if (root_is_gate) | ||
831 | mesh_path_add_gate(mpath); | ||
832 | |||
833 | if (ttl <= 1) { | ||
834 | ifmsh->mshstats.dropped_frames_ttl++; | ||
835 | rcu_read_unlock(); | ||
836 | return; | ||
794 | } | 837 | } |
838 | ttl--; | ||
795 | 839 | ||
796 | if ((SN_LT(mpath->sn, orig_sn) || (mpath->sn == orig_sn && | 840 | if (ifmsh->mshcfg.dot11MeshForwarding) { |
797 | metric < mpath->rann_metric)) && ifmsh->mshcfg.dot11MeshForwarding) { | ||
798 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, | 841 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, |
799 | cpu_to_le32(orig_sn), | 842 | cpu_to_le32(orig_sn), |
800 | 0, NULL, 0, broadcast_addr, | 843 | 0, NULL, 0, broadcast_addr, |
801 | hopcount, ttl, cpu_to_le32(interval), | 844 | hopcount, ttl, cpu_to_le32(interval), |
802 | cpu_to_le32(metric + metric_txsta), | 845 | cpu_to_le32(metric + metric_txsta), |
803 | 0, sdata); | 846 | 0, sdata); |
804 | mpath->sn = orig_sn; | ||
805 | mpath->rann_metric = metric + metric_txsta; | ||
806 | /* Recording RANNs sender address to send individually | ||
807 | * addressed PREQs destined for root mesh STA */ | ||
808 | memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN); | ||
809 | } | 847 | } |
810 | 848 | ||
811 | mpath->is_root = true; | ||
812 | |||
813 | if (root_is_gate) | ||
814 | mesh_path_add_gate(mpath); | ||
815 | |||
816 | rcu_read_unlock(); | 849 | rcu_read_unlock(); |
817 | } | 850 | } |
818 | 851 | ||
@@ -889,7 +922,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
889 | 922 | ||
890 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); | 923 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); |
891 | if (!preq_node) { | 924 | if (!preq_node) { |
892 | mhwmp_dbg("could not allocate PREQ node"); | 925 | mhwmp_dbg(sdata, "could not allocate PREQ node\n"); |
893 | return; | 926 | return; |
894 | } | 927 | } |
895 | 928 | ||
@@ -898,7 +931,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
898 | spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); | 931 | spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); |
899 | kfree(preq_node); | 932 | kfree(preq_node); |
900 | if (printk_ratelimit()) | 933 | if (printk_ratelimit()) |
901 | mhwmp_dbg("PREQ node queue full"); | 934 | mhwmp_dbg(sdata, "PREQ node queue full\n"); |
902 | return; | 935 | return; |
903 | } | 936 | } |
904 | 937 | ||
@@ -1146,7 +1179,7 @@ void mesh_path_timer(unsigned long data) | |||
1146 | if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { | 1179 | if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { |
1147 | ret = mesh_path_send_to_gates(mpath); | 1180 | ret = mesh_path_send_to_gates(mpath); |
1148 | if (ret) | 1181 | if (ret) |
1149 | mhwmp_dbg("no gate was reachable"); | 1182 | mhwmp_dbg(sdata, "no gate was reachable\n"); |
1150 | } else | 1183 | } else |
1151 | mesh_path_flush_pending(mpath); | 1184 | mesh_path_flush_pending(mpath); |
1152 | } | 1185 | } |
@@ -1157,13 +1190,34 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata) | |||
1157 | { | 1190 | { |
1158 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 1191 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
1159 | u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; | 1192 | u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; |
1160 | u8 flags; | 1193 | u8 flags, target_flags = 0; |
1161 | 1194 | ||
1162 | flags = (ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol) | 1195 | flags = (ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol) |
1163 | ? RANN_FLAG_IS_GATE : 0; | 1196 | ? RANN_FLAG_IS_GATE : 0; |
1164 | mesh_path_sel_frame_tx(MPATH_RANN, flags, sdata->vif.addr, | 1197 | |
1198 | switch (ifmsh->mshcfg.dot11MeshHWMPRootMode) { | ||
1199 | case IEEE80211_PROACTIVE_RANN: | ||
1200 | mesh_path_sel_frame_tx(MPATH_RANN, flags, sdata->vif.addr, | ||
1165 | cpu_to_le32(++ifmsh->sn), | 1201 | cpu_to_le32(++ifmsh->sn), |
1166 | 0, NULL, 0, broadcast_addr, | 1202 | 0, NULL, 0, broadcast_addr, |
1167 | 0, sdata->u.mesh.mshcfg.element_ttl, | 1203 | 0, ifmsh->mshcfg.element_ttl, |
1168 | cpu_to_le32(interval), 0, 0, sdata); | 1204 | cpu_to_le32(interval), 0, 0, sdata); |
1205 | break; | ||
1206 | case IEEE80211_PROACTIVE_PREQ_WITH_PREP: | ||
1207 | flags |= IEEE80211_PREQ_PROACTIVE_PREP_FLAG; | ||
1208 | case IEEE80211_PROACTIVE_PREQ_NO_PREP: | ||
1209 | interval = ifmsh->mshcfg.dot11MeshHWMPactivePathToRootTimeout; | ||
1210 | target_flags |= IEEE80211_PREQ_TO_FLAG | | ||
1211 | IEEE80211_PREQ_USN_FLAG; | ||
1212 | mesh_path_sel_frame_tx(MPATH_PREQ, flags, sdata->vif.addr, | ||
1213 | cpu_to_le32(++ifmsh->sn), target_flags, | ||
1214 | (u8 *) broadcast_addr, 0, broadcast_addr, | ||
1215 | 0, ifmsh->mshcfg.element_ttl, | ||
1216 | cpu_to_le32(interval), | ||
1217 | 0, cpu_to_le32(ifmsh->preq_id++), sdata); | ||
1218 | break; | ||
1219 | default: | ||
1220 | mhwmp_dbg(sdata, "Proactive mechanism not supported\n"); | ||
1221 | return; | ||
1222 | } | ||
1169 | } | 1223 | } |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 572f706fd65b..c9ae931dd693 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -18,12 +18,6 @@ | |||
18 | #include "ieee80211_i.h" | 18 | #include "ieee80211_i.h" |
19 | #include "mesh.h" | 19 | #include "mesh.h" |
20 | 20 | ||
21 | #ifdef CONFIG_MAC80211_VERBOSE_MPATH_DEBUG | ||
22 | #define mpath_dbg(fmt, args...) pr_debug(fmt, ##args) | ||
23 | #else | ||
24 | #define mpath_dbg(fmt, args...) do { (void)(0); } while (0) | ||
25 | #endif | ||
26 | |||
27 | /* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */ | 21 | /* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */ |
28 | #define INIT_PATHS_SIZE_ORDER 2 | 22 | #define INIT_PATHS_SIZE_ORDER 2 |
29 | 23 | ||
@@ -322,9 +316,8 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, | |||
322 | 316 | ||
323 | spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); | 317 | spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); |
324 | skb_queue_splice(&gateq, &gate_mpath->frame_queue); | 318 | skb_queue_splice(&gateq, &gate_mpath->frame_queue); |
325 | mpath_dbg("Mpath queue for gate %pM has %d frames\n", | 319 | mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", |
326 | gate_mpath->dst, | 320 | gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); |
327 | skb_queue_len(&gate_mpath->frame_queue)); | ||
328 | spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); | 321 | spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); |
329 | 322 | ||
330 | if (!copy) | 323 | if (!copy) |
@@ -446,9 +439,9 @@ int mesh_path_add_gate(struct mesh_path *mpath) | |||
446 | hlist_add_head_rcu(&new_gate->list, tbl->known_gates); | 439 | hlist_add_head_rcu(&new_gate->list, tbl->known_gates); |
447 | spin_unlock_bh(&tbl->gates_lock); | 440 | spin_unlock_bh(&tbl->gates_lock); |
448 | rcu_read_unlock(); | 441 | rcu_read_unlock(); |
449 | mpath_dbg("Mesh path (%s): Recorded new gate: %pM. %d known gates\n", | 442 | mpath_dbg(mpath->sdata, |
450 | mpath->sdata->name, mpath->dst, | 443 | "Mesh path: Recorded new gate: %pM. %d known gates\n", |
451 | mpath->sdata->u.mesh.num_gates); | 444 | mpath->dst, mpath->sdata->u.mesh.num_gates); |
452 | return 0; | 445 | return 0; |
453 | err_rcu: | 446 | err_rcu: |
454 | rcu_read_unlock(); | 447 | rcu_read_unlock(); |
@@ -477,8 +470,8 @@ static int mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath) | |||
477 | spin_unlock_bh(&tbl->gates_lock); | 470 | spin_unlock_bh(&tbl->gates_lock); |
478 | mpath->sdata->u.mesh.num_gates--; | 471 | mpath->sdata->u.mesh.num_gates--; |
479 | mpath->is_gate = false; | 472 | mpath->is_gate = false; |
480 | mpath_dbg("Mesh path (%s): Deleted gate: %pM. " | 473 | mpath_dbg(mpath->sdata, |
481 | "%d known gates\n", mpath->sdata->name, | 474 | "Mesh path: Deleted gate: %pM. %d known gates\n", |
482 | mpath->dst, mpath->sdata->u.mesh.num_gates); | 475 | mpath->dst, mpath->sdata->u.mesh.num_gates); |
483 | break; | 476 | break; |
484 | } | 477 | } |
@@ -946,19 +939,20 @@ int mesh_path_send_to_gates(struct mesh_path *mpath) | |||
946 | continue; | 939 | continue; |
947 | 940 | ||
948 | if (gate->mpath->flags & MESH_PATH_ACTIVE) { | 941 | if (gate->mpath->flags & MESH_PATH_ACTIVE) { |
949 | mpath_dbg("Forwarding to %pM\n", gate->mpath->dst); | 942 | mpath_dbg(sdata, "Forwarding to %pM\n", gate->mpath->dst); |
950 | mesh_path_move_to_queue(gate->mpath, from_mpath, copy); | 943 | mesh_path_move_to_queue(gate->mpath, from_mpath, copy); |
951 | from_mpath = gate->mpath; | 944 | from_mpath = gate->mpath; |
952 | copy = true; | 945 | copy = true; |
953 | } else { | 946 | } else { |
954 | mpath_dbg("Not forwarding %p\n", gate->mpath); | 947 | mpath_dbg(sdata, |
955 | mpath_dbg("flags %x\n", gate->mpath->flags); | 948 | "Not forwarding %p (flags %#x)\n", |
949 | gate->mpath, gate->mpath->flags); | ||
956 | } | 950 | } |
957 | } | 951 | } |
958 | 952 | ||
959 | hlist_for_each_entry_rcu(gate, n, known_gates, list) | 953 | hlist_for_each_entry_rcu(gate, n, known_gates, list) |
960 | if (gate->mpath->sdata == sdata) { | 954 | if (gate->mpath->sdata == sdata) { |
961 | mpath_dbg("Sending to %pM\n", gate->mpath->dst); | 955 | mpath_dbg(sdata, "Sending to %pM\n", gate->mpath->dst); |
962 | mesh_path_tx_pending(gate->mpath); | 956 | mesh_path_tx_pending(gate->mpath); |
963 | } | 957 | } |
964 | 958 | ||
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index be4fad128c34..a1dbd1540276 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -13,12 +13,6 @@ | |||
13 | #include "rate.h" | 13 | #include "rate.h" |
14 | #include "mesh.h" | 14 | #include "mesh.h" |
15 | 15 | ||
16 | #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG | ||
17 | #define mpl_dbg(fmt, args...) pr_debug(fmt, ##args) | ||
18 | #else | ||
19 | #define mpl_dbg(fmt, args...) do { (void)(0); } while (0) | ||
20 | #endif | ||
21 | |||
22 | #define PLINK_GET_LLID(p) (p + 2) | 16 | #define PLINK_GET_LLID(p) (p + 2) |
23 | #define PLINK_GET_PLID(p) (p + 4) | 17 | #define PLINK_GET_PLID(p) (p + 4) |
24 | 18 | ||
@@ -134,12 +128,14 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) | |||
134 | 128 | ||
135 | switch (sta->ch_type) { | 129 | switch (sta->ch_type) { |
136 | case NL80211_CHAN_NO_HT: | 130 | case NL80211_CHAN_NO_HT: |
137 | mpl_dbg("mesh_plink %pM: nonHT sta (%pM) is present", | 131 | mpl_dbg(sdata, |
132 | "mesh_plink %pM: nonHT sta (%pM) is present\n", | ||
138 | sdata->vif.addr, sta->sta.addr); | 133 | sdata->vif.addr, sta->sta.addr); |
139 | non_ht_sta = true; | 134 | non_ht_sta = true; |
140 | goto out; | 135 | goto out; |
141 | case NL80211_CHAN_HT20: | 136 | case NL80211_CHAN_HT20: |
142 | mpl_dbg("mesh_plink %pM: HT20 sta (%pM) is present", | 137 | mpl_dbg(sdata, |
138 | "mesh_plink %pM: HT20 sta (%pM) is present\n", | ||
143 | sdata->vif.addr, sta->sta.addr); | 139 | sdata->vif.addr, sta->sta.addr); |
144 | ht20_sta = true; | 140 | ht20_sta = true; |
145 | default: | 141 | default: |
@@ -160,7 +156,8 @@ out: | |||
160 | sdata->vif.bss_conf.ht_operation_mode = ht_opmode; | 156 | sdata->vif.bss_conf.ht_operation_mode = ht_opmode; |
161 | sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; | 157 | sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; |
162 | changed = BSS_CHANGED_HT; | 158 | changed = BSS_CHANGED_HT; |
163 | mpl_dbg("mesh_plink %pM: protection mode changed to %d", | 159 | mpl_dbg(sdata, |
160 | "mesh_plink %pM: protection mode changed to %d\n", | ||
164 | sdata->vif.addr, ht_opmode); | 161 | sdata->vif.addr, ht_opmode); |
165 | } | 162 | } |
166 | 163 | ||
@@ -437,7 +434,8 @@ static void mesh_plink_timer(unsigned long data) | |||
437 | spin_unlock_bh(&sta->lock); | 434 | spin_unlock_bh(&sta->lock); |
438 | return; | 435 | return; |
439 | } | 436 | } |
440 | mpl_dbg("Mesh plink timer for %pM fired on state %d\n", | 437 | mpl_dbg(sta->sdata, |
438 | "Mesh plink timer for %pM fired on state %d\n", | ||
441 | sta->sta.addr, sta->plink_state); | 439 | sta->sta.addr, sta->plink_state); |
442 | reason = 0; | 440 | reason = 0; |
443 | llid = sta->llid; | 441 | llid = sta->llid; |
@@ -450,7 +448,8 @@ static void mesh_plink_timer(unsigned long data) | |||
450 | /* retry timer */ | 448 | /* retry timer */ |
451 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { | 449 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { |
452 | u32 rand; | 450 | u32 rand; |
453 | mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n", | 451 | mpl_dbg(sta->sdata, |
452 | "Mesh plink for %pM (retry, timeout): %d %d\n", | ||
454 | sta->sta.addr, sta->plink_retries, | 453 | sta->sta.addr, sta->plink_retries, |
455 | sta->plink_timeout); | 454 | sta->plink_timeout); |
456 | get_random_bytes(&rand, sizeof(u32)); | 455 | get_random_bytes(&rand, sizeof(u32)); |
@@ -530,7 +529,8 @@ int mesh_plink_open(struct sta_info *sta) | |||
530 | sta->plink_state = NL80211_PLINK_OPN_SNT; | 529 | sta->plink_state = NL80211_PLINK_OPN_SNT; |
531 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); | 530 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); |
532 | spin_unlock_bh(&sta->lock); | 531 | spin_unlock_bh(&sta->lock); |
533 | mpl_dbg("Mesh plink: starting establishment with %pM\n", | 532 | mpl_dbg(sdata, |
533 | "Mesh plink: starting establishment with %pM\n", | ||
534 | sta->sta.addr); | 534 | sta->sta.addr); |
535 | 535 | ||
536 | return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, | 536 | return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, |
@@ -565,7 +565,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
565 | u8 *baseaddr; | 565 | u8 *baseaddr; |
566 | u32 changed = 0; | 566 | u32 changed = 0; |
567 | __le16 plid, llid, reason; | 567 | __le16 plid, llid, reason; |
568 | #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG | ||
569 | static const char *mplstates[] = { | 568 | static const char *mplstates[] = { |
570 | [NL80211_PLINK_LISTEN] = "LISTEN", | 569 | [NL80211_PLINK_LISTEN] = "LISTEN", |
571 | [NL80211_PLINK_OPN_SNT] = "OPN-SNT", | 570 | [NL80211_PLINK_OPN_SNT] = "OPN-SNT", |
@@ -575,14 +574,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
575 | [NL80211_PLINK_HOLDING] = "HOLDING", | 574 | [NL80211_PLINK_HOLDING] = "HOLDING", |
576 | [NL80211_PLINK_BLOCKED] = "BLOCKED" | 575 | [NL80211_PLINK_BLOCKED] = "BLOCKED" |
577 | }; | 576 | }; |
578 | #endif | ||
579 | 577 | ||
580 | /* need action_code, aux */ | 578 | /* need action_code, aux */ |
581 | if (len < IEEE80211_MIN_ACTION_SIZE + 3) | 579 | if (len < IEEE80211_MIN_ACTION_SIZE + 3) |
582 | return; | 580 | return; |
583 | 581 | ||
584 | if (is_multicast_ether_addr(mgmt->da)) { | 582 | if (is_multicast_ether_addr(mgmt->da)) { |
585 | mpl_dbg("Mesh plink: ignore frame from multicast address"); | 583 | mpl_dbg(sdata, |
584 | "Mesh plink: ignore frame from multicast address\n"); | ||
586 | return; | 585 | return; |
587 | } | 586 | } |
588 | 587 | ||
@@ -595,12 +594,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
595 | } | 594 | } |
596 | ieee802_11_parse_elems(baseaddr, len - baselen, &elems); | 595 | ieee802_11_parse_elems(baseaddr, len - baselen, &elems); |
597 | if (!elems.peering) { | 596 | if (!elems.peering) { |
598 | mpl_dbg("Mesh plink: missing necessary peer link ie\n"); | 597 | mpl_dbg(sdata, |
598 | "Mesh plink: missing necessary peer link ie\n"); | ||
599 | return; | 599 | return; |
600 | } | 600 | } |
601 | if (elems.rsn_len && | 601 | if (elems.rsn_len && |
602 | sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { | 602 | sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { |
603 | mpl_dbg("Mesh plink: can't establish link with secure peer\n"); | 603 | mpl_dbg(sdata, |
604 | "Mesh plink: can't establish link with secure peer\n"); | ||
604 | return; | 605 | return; |
605 | } | 606 | } |
606 | 607 | ||
@@ -610,14 +611,15 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
610 | (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) || | 611 | (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) || |
611 | (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6 | 612 | (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6 |
612 | && ie_len != 8)) { | 613 | && ie_len != 8)) { |
613 | mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n", | 614 | mpl_dbg(sdata, |
614 | ftype, ie_len); | 615 | "Mesh plink: incorrect plink ie length %d %d\n", |
616 | ftype, ie_len); | ||
615 | return; | 617 | return; |
616 | } | 618 | } |
617 | 619 | ||
618 | if (ftype != WLAN_SP_MESH_PEERING_CLOSE && | 620 | if (ftype != WLAN_SP_MESH_PEERING_CLOSE && |
619 | (!elems.mesh_id || !elems.mesh_config)) { | 621 | (!elems.mesh_id || !elems.mesh_config)) { |
620 | mpl_dbg("Mesh plink: missing necessary ie\n"); | 622 | mpl_dbg(sdata, "Mesh plink: missing necessary ie\n"); |
621 | return; | 623 | return; |
622 | } | 624 | } |
623 | /* Note the lines below are correct, the llid in the frame is the plid | 625 | /* Note the lines below are correct, the llid in the frame is the plid |
@@ -632,21 +634,21 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
632 | 634 | ||
633 | sta = sta_info_get(sdata, mgmt->sa); | 635 | sta = sta_info_get(sdata, mgmt->sa); |
634 | if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) { | 636 | if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) { |
635 | mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); | 637 | mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n"); |
636 | rcu_read_unlock(); | 638 | rcu_read_unlock(); |
637 | return; | 639 | return; |
638 | } | 640 | } |
639 | 641 | ||
640 | if (ftype == WLAN_SP_MESH_PEERING_OPEN && | 642 | if (ftype == WLAN_SP_MESH_PEERING_OPEN && |
641 | !rssi_threshold_check(sta, sdata)) { | 643 | !rssi_threshold_check(sta, sdata)) { |
642 | mpl_dbg("Mesh plink: %pM does not meet rssi threshold\n", | 644 | mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n", |
643 | mgmt->sa); | 645 | mgmt->sa); |
644 | rcu_read_unlock(); | 646 | rcu_read_unlock(); |
645 | return; | 647 | return; |
646 | } | 648 | } |
647 | 649 | ||
648 | if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) { | 650 | if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) { |
649 | mpl_dbg("Mesh plink: Action frame from non-authed peer\n"); | 651 | mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n"); |
650 | rcu_read_unlock(); | 652 | rcu_read_unlock(); |
651 | return; | 653 | return; |
652 | } | 654 | } |
@@ -683,7 +685,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
683 | } else if (!sta) { | 685 | } else if (!sta) { |
684 | /* ftype == WLAN_SP_MESH_PEERING_OPEN */ | 686 | /* ftype == WLAN_SP_MESH_PEERING_OPEN */ |
685 | if (!mesh_plink_free_count(sdata)) { | 687 | if (!mesh_plink_free_count(sdata)) { |
686 | mpl_dbg("Mesh plink error: no more free plinks\n"); | 688 | mpl_dbg(sdata, "Mesh plink error: no more free plinks\n"); |
687 | rcu_read_unlock(); | 689 | rcu_read_unlock(); |
688 | return; | 690 | return; |
689 | } | 691 | } |
@@ -724,7 +726,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
724 | event = CLS_ACPT; | 726 | event = CLS_ACPT; |
725 | break; | 727 | break; |
726 | default: | 728 | default: |
727 | mpl_dbg("Mesh plink: unknown frame subtype\n"); | 729 | mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n"); |
728 | rcu_read_unlock(); | 730 | rcu_read_unlock(); |
729 | return; | 731 | return; |
730 | } | 732 | } |
@@ -734,13 +736,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
734 | /* allocate sta entry if necessary and update info */ | 736 | /* allocate sta entry if necessary and update info */ |
735 | sta = mesh_peer_init(sdata, mgmt->sa, &elems); | 737 | sta = mesh_peer_init(sdata, mgmt->sa, &elems); |
736 | if (!sta) { | 738 | if (!sta) { |
737 | mpl_dbg("Mesh plink: failed to init peer!\n"); | 739 | mpl_dbg(sdata, "Mesh plink: failed to init peer!\n"); |
738 | rcu_read_unlock(); | 740 | rcu_read_unlock(); |
739 | return; | 741 | return; |
740 | } | 742 | } |
741 | } | 743 | } |
742 | 744 | ||
743 | mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", | 745 | mpl_dbg(sdata, |
746 | "Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", | ||
744 | mgmt->sa, mplstates[sta->plink_state], | 747 | mgmt->sa, mplstates[sta->plink_state], |
745 | le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), | 748 | le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), |
746 | event); | 749 | event); |
@@ -851,7 +854,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
851 | mesh_plink_inc_estab_count(sdata); | 854 | mesh_plink_inc_estab_count(sdata); |
852 | changed |= mesh_set_ht_prot_mode(sdata); | 855 | changed |= mesh_set_ht_prot_mode(sdata); |
853 | changed |= BSS_CHANGED_BEACON; | 856 | changed |= BSS_CHANGED_BEACON; |
854 | mpl_dbg("Mesh plink with %pM ESTABLISHED\n", | 857 | mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", |
855 | sta->sta.addr); | 858 | sta->sta.addr); |
856 | break; | 859 | break; |
857 | default: | 860 | default: |
@@ -887,7 +890,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
887 | mesh_plink_inc_estab_count(sdata); | 890 | mesh_plink_inc_estab_count(sdata); |
888 | changed |= mesh_set_ht_prot_mode(sdata); | 891 | changed |= mesh_set_ht_prot_mode(sdata); |
889 | changed |= BSS_CHANGED_BEACON; | 892 | changed |= BSS_CHANGED_BEACON; |
890 | mpl_dbg("Mesh plink with %pM ESTABLISHED\n", | 893 | mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", |
891 | sta->sta.addr); | 894 | sta->sta.addr); |
892 | mesh_plink_frame_tx(sdata, | 895 | mesh_plink_frame_tx(sdata, |
893 | WLAN_SP_MESH_PEERING_CONFIRM, | 896 | WLAN_SP_MESH_PEERING_CONFIRM, |
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c index 0ccdad49f987..accfa00ffcdf 100644 --- a/net/mac80211/mesh_sync.c +++ b/net/mac80211/mesh_sync.c | |||
@@ -12,13 +12,6 @@ | |||
12 | #include "mesh.h" | 12 | #include "mesh.h" |
13 | #include "driver-ops.h" | 13 | #include "driver-ops.h" |
14 | 14 | ||
15 | #ifdef CONFIG_MAC80211_VERBOSE_MESH_SYNC_DEBUG | ||
16 | #define msync_dbg(fmt, args...) \ | ||
17 | pr_debug("Mesh sync (%s): " fmt "\n", sdata->name, ##args) | ||
18 | #else | ||
19 | #define msync_dbg(fmt, args...) do { (void)(0); } while (0) | ||
20 | #endif | ||
21 | |||
22 | /* This is not in the standard. It represents a tolerable tbtt drift below | 15 | /* This is not in the standard. It represents a tolerable tbtt drift below |
23 | * which we do no TSF adjustment. | 16 | * which we do no TSF adjustment. |
24 | */ | 17 | */ |
@@ -65,14 +58,14 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata) | |||
65 | spin_lock_bh(&ifmsh->sync_offset_lock); | 58 | spin_lock_bh(&ifmsh->sync_offset_lock); |
66 | 59 | ||
67 | if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { | 60 | if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { |
68 | msync_dbg("TBTT : max clockdrift=%lld; adjusting", | 61 | msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n", |
69 | (long long) ifmsh->sync_offset_clockdrift_max); | 62 | (long long) ifmsh->sync_offset_clockdrift_max); |
70 | tsfdelta = -ifmsh->sync_offset_clockdrift_max; | 63 | tsfdelta = -ifmsh->sync_offset_clockdrift_max; |
71 | ifmsh->sync_offset_clockdrift_max = 0; | 64 | ifmsh->sync_offset_clockdrift_max = 0; |
72 | } else { | 65 | } else { |
73 | msync_dbg("TBTT : max clockdrift=%lld; adjusting by %llu", | 66 | msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting by %llu\n", |
74 | (long long) ifmsh->sync_offset_clockdrift_max, | 67 | (long long) ifmsh->sync_offset_clockdrift_max, |
75 | (unsigned long long) beacon_int_fraction); | 68 | (unsigned long long) beacon_int_fraction); |
76 | tsfdelta = -beacon_int_fraction; | 69 | tsfdelta = -beacon_int_fraction; |
77 | ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; | 70 | ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; |
78 | } | 71 | } |
@@ -120,7 +113,7 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
120 | 113 | ||
121 | if (elems->mesh_config && mesh_peer_tbtt_adjusting(elems)) { | 114 | if (elems->mesh_config && mesh_peer_tbtt_adjusting(elems)) { |
122 | clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); | 115 | clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); |
123 | msync_dbg("STA %pM : is adjusting TBTT", sta->sta.addr); | 116 | msync_dbg(sdata, "STA %pM : is adjusting TBTT\n", sta->sta.addr); |
124 | goto no_sync; | 117 | goto no_sync; |
125 | } | 118 | } |
126 | 119 | ||
@@ -169,7 +162,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
169 | if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { | 162 | if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { |
170 | s64 t_clockdrift = sta->t_offset_setpoint | 163 | s64 t_clockdrift = sta->t_offset_setpoint |
171 | - sta->t_offset; | 164 | - sta->t_offset; |
172 | msync_dbg("STA %pM : sta->t_offset=%lld, sta->t_offset_setpoint=%lld, t_clockdrift=%lld", | 165 | msync_dbg(sdata, |
166 | "STA %pM : sta->t_offset=%lld, sta->t_offset_setpoint=%lld, t_clockdrift=%lld\n", | ||
173 | sta->sta.addr, | 167 | sta->sta.addr, |
174 | (long long) sta->t_offset, | 168 | (long long) sta->t_offset, |
175 | (long long) | 169 | (long long) |
@@ -178,7 +172,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
178 | 172 | ||
179 | if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT || | 173 | if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT || |
180 | t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) { | 174 | t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) { |
181 | msync_dbg("STA %pM : t_clockdrift=%lld too large, setpoint reset", | 175 | msync_dbg(sdata, |
176 | "STA %pM : t_clockdrift=%lld too large, setpoint reset\n", | ||
182 | sta->sta.addr, | 177 | sta->sta.addr, |
183 | (long long) t_clockdrift); | 178 | (long long) t_clockdrift); |
184 | clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); | 179 | clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); |
@@ -197,8 +192,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
197 | } else { | 192 | } else { |
198 | sta->t_offset_setpoint = sta->t_offset - TOFFSET_SET_MARGIN; | 193 | sta->t_offset_setpoint = sta->t_offset - TOFFSET_SET_MARGIN; |
199 | set_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); | 194 | set_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); |
200 | msync_dbg("STA %pM : offset was invalid, " | 195 | msync_dbg(sdata, |
201 | " sta->t_offset=%lld", | 196 | "STA %pM : offset was invalid, sta->t_offset=%lld\n", |
202 | sta->sta.addr, | 197 | sta->sta.addr, |
203 | (long long) sta->t_offset); | 198 | (long long) sta->t_offset); |
204 | rcu_read_unlock(); | 199 | rcu_read_unlock(); |
@@ -226,17 +221,15 @@ static void mesh_sync_offset_adjust_tbtt(struct ieee80211_sub_if_data *sdata) | |||
226 | * to the driver tsf setter, we punt | 221 | * to the driver tsf setter, we punt |
227 | * the tsf adjustment to the mesh tasklet | 222 | * the tsf adjustment to the mesh tasklet |
228 | */ | 223 | */ |
229 | msync_dbg("TBTT : kicking off TBTT " | 224 | msync_dbg(sdata, |
230 | "adjustment with " | 225 | "TBTT : kicking off TBTT adjustment with clockdrift_max=%lld\n", |
231 | "clockdrift_max=%lld", | 226 | ifmsh->sync_offset_clockdrift_max); |
232 | ifmsh->sync_offset_clockdrift_max); | ||
233 | set_bit(MESH_WORK_DRIFT_ADJUST, | 227 | set_bit(MESH_WORK_DRIFT_ADJUST, |
234 | &ifmsh->wrkq_flags); | 228 | &ifmsh->wrkq_flags); |
235 | } else { | 229 | } else { |
236 | msync_dbg("TBTT : max clockdrift=%lld; " | 230 | msync_dbg(sdata, |
237 | "too small to adjust", | 231 | "TBTT : max clockdrift=%lld; too small to adjust\n", |
238 | (long long) | 232 | (long long)ifmsh->sync_offset_clockdrift_max); |
239 | ifmsh->sync_offset_clockdrift_max); | ||
240 | ifmsh->sync_offset_clockdrift_max = 0; | 233 | ifmsh->sync_offset_clockdrift_max = 0; |
241 | } | 234 | } |
242 | spin_unlock_bh(&ifmsh->sync_offset_lock); | 235 | spin_unlock_bh(&ifmsh->sync_offset_lock); |
@@ -268,7 +261,7 @@ static void mesh_sync_vendor_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
268 | const u8 *oui; | 261 | const u8 *oui; |
269 | 262 | ||
270 | WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); | 263 | WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); |
271 | msync_dbg("called mesh_sync_vendor_rx_bcn_presp"); | 264 | msync_dbg(sdata, "called mesh_sync_vendor_rx_bcn_presp\n"); |
272 | oui = mesh_get_vendor_oui(sdata); | 265 | oui = mesh_get_vendor_oui(sdata); |
273 | /* here you would implement the vendor offset tracking for this oui */ | 266 | /* here you would implement the vendor offset tracking for this oui */ |
274 | } | 267 | } |
@@ -278,7 +271,7 @@ static void mesh_sync_vendor_adjust_tbtt(struct ieee80211_sub_if_data *sdata) | |||
278 | const u8 *oui; | 271 | const u8 *oui; |
279 | 272 | ||
280 | WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); | 273 | WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); |
281 | msync_dbg("called mesh_sync_vendor_adjust_tbtt"); | 274 | msync_dbg(sdata, "called mesh_sync_vendor_adjust_tbtt\n"); |
282 | oui = mesh_get_vendor_oui(sdata); | 275 | oui = mesh_get_vendor_oui(sdata); |
283 | /* here you would implement the vendor tsf adjustment for this oui */ | 276 | /* here you would implement the vendor tsf adjustment for this oui */ |
284 | } | 277 | } |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 321ea9bba02e..e6fe84a08443 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1141,7 +1141,7 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
1141 | 1141 | ||
1142 | memset(¶ms, 0, sizeof(params)); | 1142 | memset(¶ms, 0, sizeof(params)); |
1143 | 1143 | ||
1144 | local->wmm_acm = 0; | 1144 | sdata->wmm_acm = 0; |
1145 | for (; left >= 4; left -= 4, pos += 4) { | 1145 | for (; left >= 4; left -= 4, pos += 4) { |
1146 | int aci = (pos[0] >> 5) & 0x03; | 1146 | int aci = (pos[0] >> 5) & 0x03; |
1147 | int acm = (pos[0] >> 4) & 0x01; | 1147 | int acm = (pos[0] >> 4) & 0x01; |
@@ -1152,21 +1152,21 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
1152 | case 1: /* AC_BK */ | 1152 | case 1: /* AC_BK */ |
1153 | queue = 3; | 1153 | queue = 3; |
1154 | if (acm) | 1154 | if (acm) |
1155 | local->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ | 1155 | sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ |
1156 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) | 1156 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) |
1157 | uapsd = true; | 1157 | uapsd = true; |
1158 | break; | 1158 | break; |
1159 | case 2: /* AC_VI */ | 1159 | case 2: /* AC_VI */ |
1160 | queue = 1; | 1160 | queue = 1; |
1161 | if (acm) | 1161 | if (acm) |
1162 | local->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ | 1162 | sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ |
1163 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) | 1163 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) |
1164 | uapsd = true; | 1164 | uapsd = true; |
1165 | break; | 1165 | break; |
1166 | case 3: /* AC_VO */ | 1166 | case 3: /* AC_VO */ |
1167 | queue = 0; | 1167 | queue = 0; |
1168 | if (acm) | 1168 | if (acm) |
1169 | local->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ | 1169 | sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ |
1170 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) | 1170 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) |
1171 | uapsd = true; | 1171 | uapsd = true; |
1172 | break; | 1172 | break; |
@@ -1174,7 +1174,7 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
1174 | default: | 1174 | default: |
1175 | queue = 2; | 1175 | queue = 2; |
1176 | if (acm) | 1176 | if (acm) |
1177 | local->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ | 1177 | sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ |
1178 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) | 1178 | if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) |
1179 | uapsd = true; | 1179 | uapsd = true; |
1180 | break; | 1180 | break; |
@@ -1186,19 +1186,16 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
1186 | params.txop = get_unaligned_le16(pos + 2); | 1186 | params.txop = get_unaligned_le16(pos + 2); |
1187 | params.uapsd = uapsd; | 1187 | params.uapsd = uapsd; |
1188 | 1188 | ||
1189 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1189 | mlme_dbg(sdata, |
1190 | wiphy_debug(local->hw.wiphy, | 1190 | "WMM queue=%d aci=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d\n", |
1191 | "WMM queue=%d aci=%d acm=%d aifs=%d " | 1191 | queue, aci, acm, |
1192 | "cWmin=%d cWmax=%d txop=%d uapsd=%d\n", | 1192 | params.aifs, params.cw_min, params.cw_max, |
1193 | queue, aci, acm, | 1193 | params.txop, params.uapsd); |
1194 | params.aifs, params.cw_min, params.cw_max, | ||
1195 | params.txop, params.uapsd); | ||
1196 | #endif | ||
1197 | sdata->tx_conf[queue] = params; | 1194 | sdata->tx_conf[queue] = params; |
1198 | if (drv_conf_tx(local, sdata, queue, ¶ms)) | 1195 | if (drv_conf_tx(local, sdata, queue, ¶ms)) |
1199 | wiphy_debug(local->hw.wiphy, | 1196 | sdata_err(sdata, |
1200 | "failed to set TX queue parameters for queue %d\n", | 1197 | "failed to set TX queue parameters for queue %d\n", |
1201 | queue); | 1198 | queue); |
1202 | } | 1199 | } |
1203 | 1200 | ||
1204 | /* enable WMM or activate new settings */ | 1201 | /* enable WMM or activate new settings */ |
@@ -1275,7 +1272,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1275 | 1272 | ||
1276 | bss_info_changed |= BSS_CHANGED_BEACON_INT; | 1273 | bss_info_changed |= BSS_CHANGED_BEACON_INT; |
1277 | bss_info_changed |= ieee80211_handle_bss_capability(sdata, | 1274 | bss_info_changed |= ieee80211_handle_bss_capability(sdata, |
1278 | cbss->capability, bss->has_erp_value, bss->erp_value); | 1275 | bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value); |
1279 | 1276 | ||
1280 | sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( | 1277 | sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( |
1281 | IEEE80211_BEACON_LOSS_COUNT * bss_conf->beacon_int)); | 1278 | IEEE80211_BEACON_LOSS_COUNT * bss_conf->beacon_int)); |
@@ -1566,11 +1563,10 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
1566 | goto out; | 1563 | goto out; |
1567 | } | 1564 | } |
1568 | 1565 | ||
1569 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
1570 | if (beacon) | 1566 | if (beacon) |
1571 | net_dbg_ratelimited("%s: detected beacon loss from AP - sending probe request\n", | 1567 | mlme_dbg_ratelimited(sdata, |
1572 | sdata->name); | 1568 | "detected beacon loss from AP - sending probe request\n"); |
1573 | #endif | 1569 | |
1574 | ieee80211_cqm_rssi_notify(&sdata->vif, | 1570 | ieee80211_cqm_rssi_notify(&sdata->vif, |
1575 | NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL); | 1571 | NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL); |
1576 | 1572 | ||
@@ -1655,7 +1651,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1655 | 1651 | ||
1656 | memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); | 1652 | memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); |
1657 | 1653 | ||
1658 | pr_debug("%s: Connection to AP %pM lost\n", sdata->name, bssid); | 1654 | sdata_info(sdata, "Connection to AP %pM lost\n", bssid); |
1659 | 1655 | ||
1660 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 1656 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
1661 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, | 1657 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, |
@@ -1789,8 +1785,8 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
1789 | return RX_MGMT_NONE; | 1785 | return RX_MGMT_NONE; |
1790 | 1786 | ||
1791 | if (status_code != WLAN_STATUS_SUCCESS) { | 1787 | if (status_code != WLAN_STATUS_SUCCESS) { |
1792 | pr_debug("%s: %pM denied authentication (status %d)\n", | 1788 | sdata_info(sdata, "%pM denied authentication (status %d)\n", |
1793 | sdata->name, mgmt->sa, status_code); | 1789 | mgmt->sa, status_code); |
1794 | ieee80211_destroy_auth_data(sdata, false); | 1790 | ieee80211_destroy_auth_data(sdata, false); |
1795 | return RX_MGMT_CFG80211_RX_AUTH; | 1791 | return RX_MGMT_CFG80211_RX_AUTH; |
1796 | } | 1792 | } |
@@ -1813,7 +1809,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
1813 | return RX_MGMT_NONE; | 1809 | return RX_MGMT_NONE; |
1814 | } | 1810 | } |
1815 | 1811 | ||
1816 | pr_debug("%s: authenticated\n", sdata->name); | 1812 | sdata_info(sdata, "authenticated\n"); |
1817 | ifmgd->auth_data->done = true; | 1813 | ifmgd->auth_data->done = true; |
1818 | ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; | 1814 | ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; |
1819 | run_again(ifmgd, ifmgd->auth_data->timeout); | 1815 | run_again(ifmgd, ifmgd->auth_data->timeout); |
@@ -1826,7 +1822,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
1826 | goto out_err; | 1822 | goto out_err; |
1827 | } | 1823 | } |
1828 | if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) { | 1824 | if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) { |
1829 | pr_debug("%s: failed moving %pM to auth\n", sdata->name, bssid); | 1825 | sdata_info(sdata, "failed moving %pM to auth\n", bssid); |
1830 | goto out_err; | 1826 | goto out_err; |
1831 | } | 1827 | } |
1832 | mutex_unlock(&sdata->local->sta_mtx); | 1828 | mutex_unlock(&sdata->local->sta_mtx); |
@@ -1860,8 +1856,8 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
1860 | 1856 | ||
1861 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1857 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1862 | 1858 | ||
1863 | pr_debug("%s: deauthenticated from %pM (Reason: %u)\n", | 1859 | sdata_info(sdata, "deauthenticated from %pM (Reason: %u)\n", |
1864 | sdata->name, bssid, reason_code); | 1860 | bssid, reason_code); |
1865 | 1861 | ||
1866 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 1862 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
1867 | 1863 | ||
@@ -1891,8 +1887,8 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1891 | 1887 | ||
1892 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1888 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1893 | 1889 | ||
1894 | pr_debug("%s: disassociated from %pM (Reason: %u)\n", | 1890 | sdata_info(sdata, "disassociated from %pM (Reason: %u)\n", |
1895 | sdata->name, mgmt->sa, reason_code); | 1891 | mgmt->sa, reason_code); |
1896 | 1892 | ||
1897 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 1893 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
1898 | 1894 | ||
@@ -1984,15 +1980,15 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, | |||
1984 | capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); | 1980 | capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); |
1985 | 1981 | ||
1986 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) | 1982 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) |
1987 | pr_debug("%s: invalid AID value 0x%x; bits 15:14 not set\n", | 1983 | sdata_info(sdata, "invalid AID value 0x%x; bits 15:14 not set\n", |
1988 | sdata->name, aid); | 1984 | aid); |
1989 | aid &= ~(BIT(15) | BIT(14)); | 1985 | aid &= ~(BIT(15) | BIT(14)); |
1990 | 1986 | ||
1991 | ifmgd->broken_ap = false; | 1987 | ifmgd->broken_ap = false; |
1992 | 1988 | ||
1993 | if (aid == 0 || aid > IEEE80211_MAX_AID) { | 1989 | if (aid == 0 || aid > IEEE80211_MAX_AID) { |
1994 | pr_debug("%s: invalid AID value %d (out of range), turn off PS\n", | 1990 | sdata_info(sdata, "invalid AID value %d (out of range), turn off PS\n", |
1995 | sdata->name, aid); | 1991 | aid); |
1996 | aid = 0; | 1992 | aid = 0; |
1997 | ifmgd->broken_ap = true; | 1993 | ifmgd->broken_ap = true; |
1998 | } | 1994 | } |
@@ -2001,8 +1997,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, | |||
2001 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); | 1997 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); |
2002 | 1998 | ||
2003 | if (!elems.supp_rates) { | 1999 | if (!elems.supp_rates) { |
2004 | pr_debug("%s: no SuppRates element in AssocResp\n", | 2000 | sdata_info(sdata, "no SuppRates element in AssocResp\n"); |
2005 | sdata->name); | ||
2006 | return false; | 2001 | return false; |
2007 | } | 2002 | } |
2008 | 2003 | ||
@@ -2042,8 +2037,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, | |||
2042 | if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) | 2037 | if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) |
2043 | err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); | 2038 | err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); |
2044 | if (err) { | 2039 | if (err) { |
2045 | pr_debug("%s: failed to move station %pM to desired state\n", | 2040 | sdata_info(sdata, |
2046 | sdata->name, sta->sta.addr); | 2041 | "failed to move station %pM to desired state\n", |
2042 | sta->sta.addr); | ||
2047 | WARN_ON(__sta_info_destroy(sta)); | 2043 | WARN_ON(__sta_info_destroy(sta)); |
2048 | mutex_unlock(&sdata->local->sta_mtx); | 2044 | mutex_unlock(&sdata->local->sta_mtx); |
2049 | return false; | 2045 | return false; |
@@ -2126,9 +2122,10 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2126 | status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); | 2122 | status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); |
2127 | aid = le16_to_cpu(mgmt->u.assoc_resp.aid); | 2123 | aid = le16_to_cpu(mgmt->u.assoc_resp.aid); |
2128 | 2124 | ||
2129 | pr_debug("%s: RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n", | 2125 | sdata_info(sdata, |
2130 | sdata->name, reassoc ? "Rea" : "A", mgmt->sa, | 2126 | "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n", |
2131 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | 2127 | reassoc ? "Rea" : "A", mgmt->sa, |
2128 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | ||
2132 | 2129 | ||
2133 | pos = mgmt->u.assoc_resp.variable; | 2130 | pos = mgmt->u.assoc_resp.variable; |
2134 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); | 2131 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); |
@@ -2139,8 +2136,9 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2139 | u32 tu, ms; | 2136 | u32 tu, ms; |
2140 | tu = get_unaligned_le32(elems.timeout_int + 1); | 2137 | tu = get_unaligned_le32(elems.timeout_int + 1); |
2141 | ms = tu * 1024 / 1000; | 2138 | ms = tu * 1024 / 1000; |
2142 | pr_debug("%s: %pM rejected association temporarily; comeback duration %u TU (%u ms)\n", | 2139 | sdata_info(sdata, |
2143 | sdata->name, mgmt->sa, tu, ms); | 2140 | "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n", |
2141 | mgmt->sa, tu, ms); | ||
2144 | assoc_data->timeout = jiffies + msecs_to_jiffies(ms); | 2142 | assoc_data->timeout = jiffies + msecs_to_jiffies(ms); |
2145 | if (ms > IEEE80211_ASSOC_TIMEOUT) | 2143 | if (ms > IEEE80211_ASSOC_TIMEOUT) |
2146 | run_again(ifmgd, assoc_data->timeout); | 2144 | run_again(ifmgd, assoc_data->timeout); |
@@ -2150,11 +2148,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2150 | *bss = assoc_data->bss; | 2148 | *bss = assoc_data->bss; |
2151 | 2149 | ||
2152 | if (status_code != WLAN_STATUS_SUCCESS) { | 2150 | if (status_code != WLAN_STATUS_SUCCESS) { |
2153 | pr_debug("%s: %pM denied association (code=%d)\n", | 2151 | sdata_info(sdata, "%pM denied association (code=%d)\n", |
2154 | sdata->name, mgmt->sa, status_code); | 2152 | mgmt->sa, status_code); |
2155 | ieee80211_destroy_assoc_data(sdata, false); | 2153 | ieee80211_destroy_assoc_data(sdata, false); |
2156 | } else { | 2154 | } else { |
2157 | pr_debug("%s: associated\n", sdata->name); | 2155 | sdata_info(sdata, "associated\n"); |
2158 | 2156 | ||
2159 | if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) { | 2157 | if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) { |
2160 | /* oops -- internal error -- send timeout for now */ | 2158 | /* oops -- internal error -- send timeout for now */ |
@@ -2262,7 +2260,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
2262 | if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && | 2260 | if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && |
2263 | ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) { | 2261 | ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) { |
2264 | /* got probe response, continue with auth */ | 2262 | /* got probe response, continue with auth */ |
2265 | pr_debug("%s: direct probe responded\n", sdata->name); | 2263 | sdata_info(sdata, "direct probe responded\n"); |
2266 | ifmgd->auth_data->tries = 0; | 2264 | ifmgd->auth_data->tries = 0; |
2267 | ifmgd->auth_data->timeout = jiffies; | 2265 | ifmgd->auth_data->timeout = jiffies; |
2268 | run_again(ifmgd, ifmgd->auth_data->timeout); | 2266 | run_again(ifmgd, ifmgd->auth_data->timeout); |
@@ -2398,10 +2396,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2398 | } | 2396 | } |
2399 | 2397 | ||
2400 | if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) { | 2398 | if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) { |
2401 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2399 | mlme_dbg_ratelimited(sdata, |
2402 | net_dbg_ratelimited("%s: cancelling probereq poll due to a received beacon\n", | 2400 | "cancelling probereq poll due to a received beacon\n"); |
2403 | sdata->name); | ||
2404 | #endif | ||
2405 | mutex_lock(&local->mtx); | 2401 | mutex_lock(&local->mtx); |
2406 | ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; | 2402 | ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; |
2407 | ieee80211_run_deferred_scan(local); | 2403 | ieee80211_run_deferred_scan(local); |
@@ -2624,8 +2620,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
2624 | auth_data->tries++; | 2620 | auth_data->tries++; |
2625 | 2621 | ||
2626 | if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { | 2622 | if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { |
2627 | pr_debug("%s: authentication with %pM timed out\n", | 2623 | sdata_info(sdata, "authentication with %pM timed out\n", |
2628 | sdata->name, auth_data->bss->bssid); | 2624 | auth_data->bss->bssid); |
2629 | 2625 | ||
2630 | /* | 2626 | /* |
2631 | * Most likely AP is not in the range so remove the | 2627 | * Most likely AP is not in the range so remove the |
@@ -2637,9 +2633,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
2637 | } | 2633 | } |
2638 | 2634 | ||
2639 | if (auth_data->bss->proberesp_ies) { | 2635 | if (auth_data->bss->proberesp_ies) { |
2640 | pr_debug("%s: send auth to %pM (try %d/%d)\n", | 2636 | sdata_info(sdata, "send auth to %pM (try %d/%d)\n", |
2641 | sdata->name, auth_data->bss->bssid, auth_data->tries, | 2637 | auth_data->bss->bssid, auth_data->tries, |
2642 | IEEE80211_AUTH_MAX_TRIES); | 2638 | IEEE80211_AUTH_MAX_TRIES); |
2643 | 2639 | ||
2644 | auth_data->expected_transaction = 2; | 2640 | auth_data->expected_transaction = 2; |
2645 | ieee80211_send_auth(sdata, 1, auth_data->algorithm, | 2641 | ieee80211_send_auth(sdata, 1, auth_data->algorithm, |
@@ -2649,9 +2645,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
2649 | } else { | 2645 | } else { |
2650 | const u8 *ssidie; | 2646 | const u8 *ssidie; |
2651 | 2647 | ||
2652 | pr_debug("%s: direct probe to %pM (try %d/%i)\n", | 2648 | sdata_info(sdata, "direct probe to %pM (try %d/%i)\n", |
2653 | sdata->name, auth_data->bss->bssid, auth_data->tries, | 2649 | auth_data->bss->bssid, auth_data->tries, |
2654 | IEEE80211_AUTH_MAX_TRIES); | 2650 | IEEE80211_AUTH_MAX_TRIES); |
2655 | 2651 | ||
2656 | ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); | 2652 | ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); |
2657 | if (!ssidie) | 2653 | if (!ssidie) |
@@ -2679,8 +2675,8 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) | |||
2679 | 2675 | ||
2680 | assoc_data->tries++; | 2676 | assoc_data->tries++; |
2681 | if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { | 2677 | if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { |
2682 | pr_debug("%s: association with %pM timed out\n", | 2678 | sdata_info(sdata, "association with %pM timed out\n", |
2683 | sdata->name, assoc_data->bss->bssid); | 2679 | assoc_data->bss->bssid); |
2684 | 2680 | ||
2685 | /* | 2681 | /* |
2686 | * Most likely AP is not in the range so remove the | 2682 | * Most likely AP is not in the range so remove the |
@@ -2691,9 +2687,9 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) | |||
2691 | return -ETIMEDOUT; | 2687 | return -ETIMEDOUT; |
2692 | } | 2688 | } |
2693 | 2689 | ||
2694 | pr_debug("%s: associate with %pM (try %d/%d)\n", | 2690 | sdata_info(sdata, "associate with %pM (try %d/%d)\n", |
2695 | sdata->name, assoc_data->bss->bssid, assoc_data->tries, | 2691 | assoc_data->bss->bssid, assoc_data->tries, |
2696 | IEEE80211_ASSOC_MAX_TRIES); | 2692 | IEEE80211_ASSOC_MAX_TRIES); |
2697 | ieee80211_send_assoc(sdata); | 2693 | ieee80211_send_assoc(sdata); |
2698 | 2694 | ||
2699 | assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; | 2695 | assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; |
@@ -2766,45 +2762,31 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) | |||
2766 | ieee80211_reset_ap_probe(sdata); | 2762 | ieee80211_reset_ap_probe(sdata); |
2767 | else if (ifmgd->nullfunc_failed) { | 2763 | else if (ifmgd->nullfunc_failed) { |
2768 | if (ifmgd->probe_send_count < max_tries) { | 2764 | if (ifmgd->probe_send_count < max_tries) { |
2769 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2765 | mlme_dbg(sdata, |
2770 | wiphy_debug(local->hw.wiphy, | 2766 | "No ack for nullfunc frame to AP %pM, try %d/%i\n", |
2771 | "%s: No ack for nullfunc frame to" | 2767 | bssid, ifmgd->probe_send_count, |
2772 | " AP %pM, try %d/%i\n", | 2768 | max_tries); |
2773 | sdata->name, bssid, | ||
2774 | ifmgd->probe_send_count, max_tries); | ||
2775 | #endif | ||
2776 | ieee80211_mgd_probe_ap_send(sdata); | 2769 | ieee80211_mgd_probe_ap_send(sdata); |
2777 | } else { | 2770 | } else { |
2778 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2771 | mlme_dbg(sdata, |
2779 | wiphy_debug(local->hw.wiphy, | 2772 | "No ack for nullfunc frame to AP %pM, disconnecting.\n", |
2780 | "%s: No ack for nullfunc frame to" | 2773 | bssid); |
2781 | " AP %pM, disconnecting.\n", | ||
2782 | sdata->name, bssid); | ||
2783 | #endif | ||
2784 | ieee80211_sta_connection_lost(sdata, bssid, | 2774 | ieee80211_sta_connection_lost(sdata, bssid, |
2785 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); | 2775 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); |
2786 | } | 2776 | } |
2787 | } else if (time_is_after_jiffies(ifmgd->probe_timeout)) | 2777 | } else if (time_is_after_jiffies(ifmgd->probe_timeout)) |
2788 | run_again(ifmgd, ifmgd->probe_timeout); | 2778 | run_again(ifmgd, ifmgd->probe_timeout); |
2789 | else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { | 2779 | else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { |
2790 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2780 | mlme_dbg(sdata, |
2791 | wiphy_debug(local->hw.wiphy, | 2781 | "Failed to send nullfunc to AP %pM after %dms, disconnecting\n", |
2792 | "%s: Failed to send nullfunc to AP %pM" | 2782 | bssid, probe_wait_ms); |
2793 | " after %dms, disconnecting.\n", | ||
2794 | sdata->name, | ||
2795 | bssid, probe_wait_ms); | ||
2796 | #endif | ||
2797 | ieee80211_sta_connection_lost(sdata, bssid, | 2783 | ieee80211_sta_connection_lost(sdata, bssid, |
2798 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); | 2784 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); |
2799 | } else if (ifmgd->probe_send_count < max_tries) { | 2785 | } else if (ifmgd->probe_send_count < max_tries) { |
2800 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2786 | mlme_dbg(sdata, |
2801 | wiphy_debug(local->hw.wiphy, | 2787 | "No probe response from AP %pM after %dms, try %d/%i\n", |
2802 | "%s: No probe response from AP %pM" | 2788 | bssid, probe_wait_ms, |
2803 | " after %dms, try %d/%i\n", | 2789 | ifmgd->probe_send_count, max_tries); |
2804 | sdata->name, | ||
2805 | bssid, probe_wait_ms, | ||
2806 | ifmgd->probe_send_count, max_tries); | ||
2807 | #endif | ||
2808 | ieee80211_mgd_probe_ap_send(sdata); | 2790 | ieee80211_mgd_probe_ap_send(sdata); |
2809 | } else { | 2791 | } else { |
2810 | /* | 2792 | /* |
@@ -2919,11 +2901,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) | |||
2919 | sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; | 2901 | sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; |
2920 | mutex_lock(&ifmgd->mtx); | 2902 | mutex_lock(&ifmgd->mtx); |
2921 | if (ifmgd->associated) { | 2903 | if (ifmgd->associated) { |
2922 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2904 | mlme_dbg(sdata, |
2923 | wiphy_debug(sdata->local->hw.wiphy, | 2905 | "driver requested disconnect after resume\n"); |
2924 | "%s: driver requested disconnect after resume.\n", | ||
2925 | sdata->name); | ||
2926 | #endif | ||
2927 | ieee80211_sta_connection_lost(sdata, | 2906 | ieee80211_sta_connection_lost(sdata, |
2928 | ifmgd->associated->bssid, | 2907 | ifmgd->associated->bssid, |
2929 | WLAN_REASON_UNSPECIFIED); | 2908 | WLAN_REASON_UNSPECIFIED); |
@@ -3011,7 +2990,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3011 | struct ieee80211_local *local = sdata->local; | 2990 | struct ieee80211_local *local = sdata->local; |
3012 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 2991 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3013 | struct ieee80211_bss *bss = (void *)cbss->priv; | 2992 | struct ieee80211_bss *bss = (void *)cbss->priv; |
3014 | struct sta_info *sta; | 2993 | struct sta_info *sta = NULL; |
3015 | bool have_sta = false; | 2994 | bool have_sta = false; |
3016 | int err; | 2995 | int err; |
3017 | int ht_cfreq; | 2996 | int ht_cfreq; |
@@ -3064,10 +3043,11 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3064 | * since we look at probe response/beacon data here | 3043 | * since we look at probe response/beacon data here |
3065 | * it should be OK. | 3044 | * it should be OK. |
3066 | */ | 3045 | */ |
3067 | pr_debug("%s: Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", | 3046 | sdata_info(sdata, |
3068 | sdata->name, cbss->channel->center_freq, | 3047 | "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", |
3069 | ht_cfreq, ht_oper->primary_chan, | 3048 | cbss->channel->center_freq, |
3070 | cbss->channel->band); | 3049 | ht_cfreq, ht_oper->primary_chan, |
3050 | cbss->channel->band); | ||
3071 | ht_oper = NULL; | 3051 | ht_oper = NULL; |
3072 | } | 3052 | } |
3073 | } | 3053 | } |
@@ -3091,8 +3071,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3091 | if (!ieee80211_set_channel_type(local, sdata, channel_type)) { | 3071 | if (!ieee80211_set_channel_type(local, sdata, channel_type)) { |
3092 | /* can only fail due to HT40+/- mismatch */ | 3072 | /* can only fail due to HT40+/- mismatch */ |
3093 | channel_type = NL80211_CHAN_HT20; | 3073 | channel_type = NL80211_CHAN_HT20; |
3094 | pr_debug("%s: disabling 40 MHz due to multi-vif mismatch\n", | 3074 | sdata_info(sdata, |
3095 | sdata->name); | 3075 | "disabling 40 MHz due to multi-vif mismatch\n"); |
3096 | ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; | 3076 | ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; |
3097 | WARN_ON(!ieee80211_set_channel_type(local, sdata, | 3077 | WARN_ON(!ieee80211_set_channel_type(local, sdata, |
3098 | channel_type)); | 3078 | channel_type)); |
@@ -3101,7 +3081,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3101 | local->oper_channel = cbss->channel; | 3081 | local->oper_channel = cbss->channel; |
3102 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 3082 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
3103 | 3083 | ||
3104 | if (!have_sta) { | 3084 | if (sta) { |
3105 | u32 rates = 0, basic_rates = 0; | 3085 | u32 rates = 0, basic_rates = 0; |
3106 | bool have_higher_than_11mbit; | 3086 | bool have_higher_than_11mbit; |
3107 | int min_rate = INT_MAX, min_rate_index = -1; | 3087 | int min_rate = INT_MAX, min_rate_index = -1; |
@@ -3121,8 +3101,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3121 | * we can connect -- with a warning. | 3101 | * we can connect -- with a warning. |
3122 | */ | 3102 | */ |
3123 | if (!basic_rates && min_rate_index >= 0) { | 3103 | if (!basic_rates && min_rate_index >= 0) { |
3124 | pr_debug("%s: No basic rates, using min rate instead\n", | 3104 | sdata_info(sdata, |
3125 | sdata->name); | 3105 | "No basic rates, using min rate instead\n"); |
3126 | basic_rates = BIT(min_rate_index); | 3106 | basic_rates = BIT(min_rate_index); |
3127 | } | 3107 | } |
3128 | 3108 | ||
@@ -3148,8 +3128,9 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3148 | err = sta_info_insert(sta); | 3128 | err = sta_info_insert(sta); |
3149 | sta = NULL; | 3129 | sta = NULL; |
3150 | if (err) { | 3130 | if (err) { |
3151 | pr_debug("%s: failed to insert STA entry for the AP (error %d)\n", | 3131 | sdata_info(sdata, |
3152 | sdata->name, err); | 3132 | "failed to insert STA entry for the AP (error %d)\n", |
3133 | err); | ||
3153 | return err; | 3134 | return err; |
3154 | } | 3135 | } |
3155 | } else | 3136 | } else |
@@ -3227,7 +3208,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, | |||
3227 | if (ifmgd->associated) | 3208 | if (ifmgd->associated) |
3228 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 3209 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
3229 | 3210 | ||
3230 | pr_debug("%s: authenticate with %pM\n", sdata->name, req->bss->bssid); | 3211 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); |
3231 | 3212 | ||
3232 | err = ieee80211_prep_connection(sdata, req->bss, false); | 3213 | err = ieee80211_prep_connection(sdata, req->bss, false); |
3233 | if (err) | 3214 | if (err) |
@@ -3409,8 +3390,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3409 | * Wait up to one beacon interval ... | 3390 | * Wait up to one beacon interval ... |
3410 | * should this be more if we miss one? | 3391 | * should this be more if we miss one? |
3411 | */ | 3392 | */ |
3412 | pr_debug("%s: waiting for beacon from %pM\n", | 3393 | sdata_info(sdata, "waiting for beacon from %pM\n", |
3413 | sdata->name, ifmgd->bssid); | 3394 | ifmgd->bssid); |
3414 | assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); | 3395 | assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); |
3415 | } else { | 3396 | } else { |
3416 | assoc_data->have_beacon = true; | 3397 | assoc_data->have_beacon = true; |
@@ -3429,8 +3410,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3429 | corrupt_type = "beacon"; | 3410 | corrupt_type = "beacon"; |
3430 | } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) | 3411 | } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) |
3431 | corrupt_type = "probe response"; | 3412 | corrupt_type = "probe response"; |
3432 | pr_debug("%s: associating with AP with corrupt %s\n", | 3413 | sdata_info(sdata, "associating with AP with corrupt %s\n", |
3433 | sdata->name, corrupt_type); | 3414 | corrupt_type); |
3434 | } | 3415 | } |
3435 | 3416 | ||
3436 | err = 0; | 3417 | err = 0; |
@@ -3459,8 +3440,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
3459 | return 0; | 3440 | return 0; |
3460 | } | 3441 | } |
3461 | 3442 | ||
3462 | pr_debug("%s: deauthenticating from %pM by local choice (reason=%d)\n", | 3443 | sdata_info(sdata, |
3463 | sdata->name, req->bssid, req->reason_code); | 3444 | "deauthenticating from %pM by local choice (reason=%d)\n", |
3445 | req->bssid, req->reason_code); | ||
3464 | 3446 | ||
3465 | if (ifmgd->associated && | 3447 | if (ifmgd->associated && |
3466 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) | 3448 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) |
@@ -3502,8 +3484,9 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
3502 | return -ENOLINK; | 3484 | return -ENOLINK; |
3503 | } | 3485 | } |
3504 | 3486 | ||
3505 | pr_debug("%s: disassociating from %pM by local choice (reason=%d)\n", | 3487 | sdata_info(sdata, |
3506 | sdata->name, req->bss->bssid, req->reason_code); | 3488 | "disassociating from %pM by local choice (reason=%d)\n", |
3489 | req->bss->bssid, req->reason_code); | ||
3507 | 3490 | ||
3508 | memcpy(bssid, req->bss->bssid, ETH_ALEN); | 3491 | memcpy(bssid, req->bss->bssid, ETH_ALEN); |
3509 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC, | 3492 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC, |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index abb226dc4753..b0fb6a2b89ad 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
16 | #include <net/mac80211.h> | 16 | #include <net/mac80211.h> |
17 | #include "ieee80211_i.h" | 17 | #include "ieee80211_i.h" |
18 | #include "driver-trace.h" | ||
19 | #include "driver-ops.h" | 18 | #include "driver-ops.h" |
20 | 19 | ||
21 | /* | 20 | /* |
@@ -25,8 +24,7 @@ | |||
25 | * because we *may* be doing work on-operating channel, and want our | 24 | * because we *may* be doing work on-operating channel, and want our |
26 | * hardware unconditionally awake, but still let the AP send us normal frames. | 25 | * hardware unconditionally awake, but still let the AP send us normal frames. |
27 | */ | 26 | */ |
28 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata, | 27 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) |
29 | bool tell_ap) | ||
30 | { | 28 | { |
31 | struct ieee80211_local *local = sdata->local; | 29 | struct ieee80211_local *local = sdata->local; |
32 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 30 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
@@ -47,8 +45,8 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata, | |||
47 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 45 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
48 | } | 46 | } |
49 | 47 | ||
50 | if (tell_ap && (!local->offchannel_ps_enabled || | 48 | if (!local->offchannel_ps_enabled || |
51 | !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))) | 49 | !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)) |
52 | /* | 50 | /* |
53 | * If power save was enabled, no need to send a nullfunc | 51 | * If power save was enabled, no need to send a nullfunc |
54 | * frame because AP knows that we are sleeping. But if the | 52 | * frame because AP knows that we are sleeping. But if the |
@@ -133,7 +131,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | |||
133 | if (offchannel_ps_enable && | 131 | if (offchannel_ps_enable && |
134 | (sdata->vif.type == NL80211_IFTYPE_STATION) && | 132 | (sdata->vif.type == NL80211_IFTYPE_STATION) && |
135 | sdata->u.mgd.associated) | 133 | sdata->u.mgd.associated) |
136 | ieee80211_offchannel_ps_enable(sdata, true); | 134 | ieee80211_offchannel_ps_enable(sdata); |
137 | } | 135 | } |
138 | } | 136 | } |
139 | mutex_unlock(&local->iflist_mtx); | 137 | mutex_unlock(&local->iflist_mtx); |
@@ -263,6 +261,9 @@ void ieee80211_start_next_roc(struct ieee80211_local *local) | |||
263 | roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work, | 261 | roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work, |
264 | list); | 262 | list); |
265 | 263 | ||
264 | if (WARN_ON_ONCE(roc->started)) | ||
265 | return; | ||
266 | |||
266 | if (local->ops->remain_on_channel) { | 267 | if (local->ops->remain_on_channel) { |
267 | int ret, duration = roc->duration; | 268 | int ret, duration = roc->duration; |
268 | 269 | ||
@@ -378,8 +379,8 @@ void ieee80211_sw_roc_work(struct work_struct *work) | |||
378 | 379 | ||
379 | ieee80211_recalc_idle(local); | 380 | ieee80211_recalc_idle(local); |
380 | 381 | ||
381 | ieee80211_start_next_roc(local); | 382 | if (roc->started) |
382 | ieee80211_run_deferred_scan(local); | 383 | ieee80211_start_next_roc(local); |
383 | } | 384 | } |
384 | 385 | ||
385 | out_unlock: | 386 | out_unlock: |
@@ -410,9 +411,6 @@ static void ieee80211_hw_roc_done(struct work_struct *work) | |||
410 | /* if there's another roc, start it now */ | 411 | /* if there's another roc, start it now */ |
411 | ieee80211_start_next_roc(local); | 412 | ieee80211_start_next_roc(local); |
412 | 413 | ||
413 | /* or scan maybe */ | ||
414 | ieee80211_run_deferred_scan(local); | ||
415 | |||
416 | out_unlock: | 414 | out_unlock: |
417 | mutex_unlock(&local->mtx); | 415 | mutex_unlock(&local->mtx); |
418 | } | 416 | } |
@@ -455,7 +453,6 @@ void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata) | |||
455 | } | 453 | } |
456 | 454 | ||
457 | ieee80211_start_next_roc(local); | 455 | ieee80211_start_next_roc(local); |
458 | ieee80211_run_deferred_scan(local); | ||
459 | mutex_unlock(&local->mtx); | 456 | mutex_unlock(&local->mtx); |
460 | 457 | ||
461 | list_for_each_entry_safe(roc, tmp, &tmp_list, list) { | 458 | list_for_each_entry_safe(roc, tmp, &tmp_list, list) { |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 98c128be3827..5c572e7a1a71 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -78,6 +78,16 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
78 | if (err < 0) { | 78 | if (err < 0) { |
79 | local->quiescing = false; | 79 | local->quiescing = false; |
80 | local->wowlan = false; | 80 | local->wowlan = false; |
81 | if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { | ||
82 | mutex_lock(&local->sta_mtx); | ||
83 | list_for_each_entry(sta, | ||
84 | &local->sta_list, list) { | ||
85 | clear_sta_flag(sta, WLAN_STA_BLOCK_BA); | ||
86 | } | ||
87 | mutex_unlock(&local->sta_mtx); | ||
88 | } | ||
89 | ieee80211_wake_queues_by_reason(hw, | ||
90 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | ||
81 | return err; | 91 | return err; |
82 | } else if (err > 0) { | 92 | } else if (err > 0) { |
83 | WARN_ON(err != 1); | 93 | WARN_ON(err != 1); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 6993d37dccfb..839cac8fab57 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -554,11 +554,11 @@ static inline u16 seq_sub(u16 sq1, u16 sq2) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | 556 | ||
557 | static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw, | 557 | static void ieee80211_release_reorder_frame(struct ieee80211_sub_if_data *sdata, |
558 | struct tid_ampdu_rx *tid_agg_rx, | 558 | struct tid_ampdu_rx *tid_agg_rx, |
559 | int index) | 559 | int index) |
560 | { | 560 | { |
561 | struct ieee80211_local *local = hw_to_local(hw); | 561 | struct ieee80211_local *local = sdata->local; |
562 | struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; | 562 | struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; |
563 | struct ieee80211_rx_status *status; | 563 | struct ieee80211_rx_status *status; |
564 | 564 | ||
@@ -578,7 +578,7 @@ no_frame: | |||
578 | tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); | 578 | tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); |
579 | } | 579 | } |
580 | 580 | ||
581 | static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw, | 581 | static void ieee80211_release_reorder_frames(struct ieee80211_sub_if_data *sdata, |
582 | struct tid_ampdu_rx *tid_agg_rx, | 582 | struct tid_ampdu_rx *tid_agg_rx, |
583 | u16 head_seq_num) | 583 | u16 head_seq_num) |
584 | { | 584 | { |
@@ -589,7 +589,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw, | |||
589 | while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { | 589 | while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { |
590 | index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % | 590 | index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % |
591 | tid_agg_rx->buf_size; | 591 | tid_agg_rx->buf_size; |
592 | ieee80211_release_reorder_frame(hw, tid_agg_rx, index); | 592 | ieee80211_release_reorder_frame(sdata, tid_agg_rx, index); |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
@@ -604,7 +604,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw, | |||
604 | */ | 604 | */ |
605 | #define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10) | 605 | #define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10) |
606 | 606 | ||
607 | static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, | 607 | static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata, |
608 | struct tid_ampdu_rx *tid_agg_rx) | 608 | struct tid_ampdu_rx *tid_agg_rx) |
609 | { | 609 | { |
610 | int index, j; | 610 | int index, j; |
@@ -632,12 +632,9 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, | |||
632 | HT_RX_REORDER_BUF_TIMEOUT)) | 632 | HT_RX_REORDER_BUF_TIMEOUT)) |
633 | goto set_release_timer; | 633 | goto set_release_timer; |
634 | 634 | ||
635 | #ifdef CONFIG_MAC80211_HT_DEBUG | 635 | ht_dbg_ratelimited(sdata, |
636 | if (net_ratelimit()) | 636 | "release an RX reorder frame due to timeout on earlier frames\n"); |
637 | wiphy_debug(hw->wiphy, | 637 | ieee80211_release_reorder_frame(sdata, tid_agg_rx, j); |
638 | "release an RX reorder frame due to timeout on earlier frames\n"); | ||
639 | #endif | ||
640 | ieee80211_release_reorder_frame(hw, tid_agg_rx, j); | ||
641 | 638 | ||
642 | /* | 639 | /* |
643 | * Increment the head seq# also for the skipped slots. | 640 | * Increment the head seq# also for the skipped slots. |
@@ -647,7 +644,7 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, | |||
647 | skipped = 0; | 644 | skipped = 0; |
648 | } | 645 | } |
649 | } else while (tid_agg_rx->reorder_buf[index]) { | 646 | } else while (tid_agg_rx->reorder_buf[index]) { |
650 | ieee80211_release_reorder_frame(hw, tid_agg_rx, index); | 647 | ieee80211_release_reorder_frame(sdata, tid_agg_rx, index); |
651 | index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % | 648 | index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % |
652 | tid_agg_rx->buf_size; | 649 | tid_agg_rx->buf_size; |
653 | } | 650 | } |
@@ -677,7 +674,7 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, | |||
677 | * rcu_read_lock protection. It returns false if the frame | 674 | * rcu_read_lock protection. It returns false if the frame |
678 | * can be processed immediately, true if it was consumed. | 675 | * can be processed immediately, true if it was consumed. |
679 | */ | 676 | */ |
680 | static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | 677 | static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_sub_if_data *sdata, |
681 | struct tid_ampdu_rx *tid_agg_rx, | 678 | struct tid_ampdu_rx *tid_agg_rx, |
682 | struct sk_buff *skb) | 679 | struct sk_buff *skb) |
683 | { | 680 | { |
@@ -706,7 +703,8 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | |||
706 | if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) { | 703 | if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) { |
707 | head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size)); | 704 | head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size)); |
708 | /* release stored frames up to new head to stack */ | 705 | /* release stored frames up to new head to stack */ |
709 | ieee80211_release_reorder_frames(hw, tid_agg_rx, head_seq_num); | 706 | ieee80211_release_reorder_frames(sdata, tid_agg_rx, |
707 | head_seq_num); | ||
710 | } | 708 | } |
711 | 709 | ||
712 | /* Now the new frame is always in the range of the reordering buffer */ | 710 | /* Now the new frame is always in the range of the reordering buffer */ |
@@ -736,7 +734,7 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | |||
736 | tid_agg_rx->reorder_buf[index] = skb; | 734 | tid_agg_rx->reorder_buf[index] = skb; |
737 | tid_agg_rx->reorder_time[index] = jiffies; | 735 | tid_agg_rx->reorder_time[index] = jiffies; |
738 | tid_agg_rx->stored_mpdu_num++; | 736 | tid_agg_rx->stored_mpdu_num++; |
739 | ieee80211_sta_reorder_release(hw, tid_agg_rx); | 737 | ieee80211_sta_reorder_release(sdata, tid_agg_rx); |
740 | 738 | ||
741 | out: | 739 | out: |
742 | spin_unlock(&tid_agg_rx->reorder_lock); | 740 | spin_unlock(&tid_agg_rx->reorder_lock); |
@@ -751,7 +749,6 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx) | |||
751 | { | 749 | { |
752 | struct sk_buff *skb = rx->skb; | 750 | struct sk_buff *skb = rx->skb; |
753 | struct ieee80211_local *local = rx->local; | 751 | struct ieee80211_local *local = rx->local; |
754 | struct ieee80211_hw *hw = &local->hw; | ||
755 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 752 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
756 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 753 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
757 | struct sta_info *sta = rx->sta; | 754 | struct sta_info *sta = rx->sta; |
@@ -813,7 +810,7 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx) | |||
813 | * sure that we cannot get to it any more before doing | 810 | * sure that we cannot get to it any more before doing |
814 | * anything with it. | 811 | * anything with it. |
815 | */ | 812 | */ |
816 | if (ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb)) | 813 | if (ieee80211_sta_manage_reorder_buf(rx->sdata, tid_agg_rx, skb)) |
817 | return; | 814 | return; |
818 | 815 | ||
819 | dont_reorder: | 816 | dont_reorder: |
@@ -1136,24 +1133,18 @@ static void ap_sta_ps_start(struct sta_info *sta) | |||
1136 | set_sta_flag(sta, WLAN_STA_PS_STA); | 1133 | set_sta_flag(sta, WLAN_STA_PS_STA); |
1137 | if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) | 1134 | if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) |
1138 | drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); | 1135 | drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); |
1139 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1136 | ps_dbg(sdata, "STA %pM aid %d enters power save mode\n", |
1140 | pr_debug("%s: STA %pM aid %d enters power save mode\n", | 1137 | sta->sta.addr, sta->sta.aid); |
1141 | sdata->name, sta->sta.addr, sta->sta.aid); | ||
1142 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
1143 | } | 1138 | } |
1144 | 1139 | ||
1145 | static void ap_sta_ps_end(struct sta_info *sta) | 1140 | static void ap_sta_ps_end(struct sta_info *sta) |
1146 | { | 1141 | { |
1147 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1142 | ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n", |
1148 | pr_debug("%s: STA %pM aid %d exits power save mode\n", | 1143 | sta->sta.addr, sta->sta.aid); |
1149 | sta->sdata->name, sta->sta.addr, sta->sta.aid); | ||
1150 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
1151 | 1144 | ||
1152 | if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { | 1145 | if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { |
1153 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1146 | ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n", |
1154 | pr_debug("%s: STA %pM aid %d driver-ps-blocked\n", | 1147 | sta->sta.addr, sta->sta.aid); |
1155 | sta->sdata->name, sta->sta.addr, sta->sta.aid); | ||
1156 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
1157 | return; | 1148 | return; |
1158 | } | 1149 | } |
1159 | 1150 | ||
@@ -1383,17 +1374,8 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
1383 | if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX) | 1374 | if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX) |
1384 | sdata->fragment_next = 0; | 1375 | sdata->fragment_next = 0; |
1385 | 1376 | ||
1386 | if (!skb_queue_empty(&entry->skb_list)) { | 1377 | if (!skb_queue_empty(&entry->skb_list)) |
1387 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
1388 | struct ieee80211_hdr *hdr = | ||
1389 | (struct ieee80211_hdr *) entry->skb_list.next->data; | ||
1390 | pr_debug("%s: RX reassembly removed oldest fragment entry (idx=%d age=%lu seq=%d last_frag=%d addr1=%pM addr2=%pM\n", | ||
1391 | sdata->name, idx, | ||
1392 | jiffies - entry->first_frag_time, entry->seq, | ||
1393 | entry->last_frag, hdr->addr1, hdr->addr2); | ||
1394 | #endif | ||
1395 | __skb_queue_purge(&entry->skb_list); | 1378 | __skb_queue_purge(&entry->skb_list); |
1396 | } | ||
1397 | 1379 | ||
1398 | __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */ | 1380 | __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */ |
1399 | *skb = NULL; | 1381 | *skb = NULL; |
@@ -1751,7 +1733,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1751 | */ | 1733 | */ |
1752 | xmit_skb = skb_copy(skb, GFP_ATOMIC); | 1734 | xmit_skb = skb_copy(skb, GFP_ATOMIC); |
1753 | if (!xmit_skb) | 1735 | if (!xmit_skb) |
1754 | net_dbg_ratelimited("%s: failed to clone multicast frame\n", | 1736 | net_info_ratelimited("%s: failed to clone multicast frame\n", |
1755 | dev->name); | 1737 | dev->name); |
1756 | } else { | 1738 | } else { |
1757 | dsta = sta_info_get(sdata, skb->data); | 1739 | dsta = sta_info_get(sdata, skb->data); |
@@ -1935,7 +1917,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1935 | ether_addr_equal(sdata->vif.addr, hdr->addr3)) | 1917 | ether_addr_equal(sdata->vif.addr, hdr->addr3)) |
1936 | return RX_CONTINUE; | 1918 | return RX_CONTINUE; |
1937 | 1919 | ||
1938 | q = ieee80211_select_queue_80211(local, skb, hdr); | 1920 | q = ieee80211_select_queue_80211(sdata, skb, hdr); |
1939 | if (ieee80211_queue_stopped(&local->hw, q)) { | 1921 | if (ieee80211_queue_stopped(&local->hw, q)) { |
1940 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); | 1922 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); |
1941 | return RX_DROP_MONITOR; | 1923 | return RX_DROP_MONITOR; |
@@ -1955,7 +1937,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1955 | 1937 | ||
1956 | fwd_skb = skb_copy(skb, GFP_ATOMIC); | 1938 | fwd_skb = skb_copy(skb, GFP_ATOMIC); |
1957 | if (!fwd_skb) { | 1939 | if (!fwd_skb) { |
1958 | net_dbg_ratelimited("%s: failed to clone mesh frame\n", | 1940 | net_info_ratelimited("%s: failed to clone mesh frame\n", |
1959 | sdata->name); | 1941 | sdata->name); |
1960 | goto out; | 1942 | goto out; |
1961 | } | 1943 | } |
@@ -2058,8 +2040,6 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | |||
2058 | static ieee80211_rx_result debug_noinline | 2040 | static ieee80211_rx_result debug_noinline |
2059 | ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) | 2041 | ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) |
2060 | { | 2042 | { |
2061 | struct ieee80211_local *local = rx->local; | ||
2062 | struct ieee80211_hw *hw = &local->hw; | ||
2063 | struct sk_buff *skb = rx->skb; | 2043 | struct sk_buff *skb = rx->skb; |
2064 | struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data; | 2044 | struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data; |
2065 | struct tid_ampdu_rx *tid_agg_rx; | 2045 | struct tid_ampdu_rx *tid_agg_rx; |
@@ -2096,7 +2076,8 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) | |||
2096 | 2076 | ||
2097 | spin_lock(&tid_agg_rx->reorder_lock); | 2077 | spin_lock(&tid_agg_rx->reorder_lock); |
2098 | /* release stored frames up to start of BAR */ | 2078 | /* release stored frames up to start of BAR */ |
2099 | ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num); | 2079 | ieee80211_release_reorder_frames(rx->sdata, tid_agg_rx, |
2080 | start_seq_num); | ||
2100 | spin_unlock(&tid_agg_rx->reorder_lock); | 2081 | spin_unlock(&tid_agg_rx->reorder_lock); |
2101 | 2082 | ||
2102 | kfree_skb(skb); | 2083 | kfree_skb(skb); |
@@ -2750,7 +2731,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) | |||
2750 | return; | 2731 | return; |
2751 | 2732 | ||
2752 | spin_lock(&tid_agg_rx->reorder_lock); | 2733 | spin_lock(&tid_agg_rx->reorder_lock); |
2753 | ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx); | 2734 | ieee80211_sta_reorder_release(sta->sdata, tid_agg_rx); |
2754 | spin_unlock(&tid_agg_rx->reorder_lock); | 2735 | spin_unlock(&tid_agg_rx->reorder_lock); |
2755 | 2736 | ||
2756 | ieee80211_rx_handlers(&rx); | 2737 | ieee80211_rx_handlers(&rx); |
@@ -3030,6 +3011,10 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3030 | if (unlikely(local->quiescing || local->suspended)) | 3011 | if (unlikely(local->quiescing || local->suspended)) |
3031 | goto drop; | 3012 | goto drop; |
3032 | 3013 | ||
3014 | /* We might be during a HW reconfig, prevent Rx for the same reason */ | ||
3015 | if (unlikely(local->in_reconfig)) | ||
3016 | goto drop; | ||
3017 | |||
3033 | /* | 3018 | /* |
3034 | * The same happens when we're not even started, | 3019 | * The same happens when we're not even started, |
3035 | * but that's worth a warning. | 3020 | * but that's worth a warning. |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 77dcf2f89d42..06fa75ceb025 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -169,9 +169,7 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) | |||
169 | if (sta->rate_ctrl) | 169 | if (sta->rate_ctrl) |
170 | rate_control_free_sta(sta); | 170 | rate_control_free_sta(sta); |
171 | 171 | ||
172 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 172 | sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); |
173 | wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr); | ||
174 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
175 | 173 | ||
176 | kfree(sta); | 174 | kfree(sta); |
177 | } | 175 | } |
@@ -278,9 +276,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
278 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) | 276 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) |
279 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); | 277 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); |
280 | 278 | ||
281 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 279 | sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); |
282 | wiphy_debug(local->hw.wiphy, "Allocated STA %pM\n", sta->sta.addr); | ||
283 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
284 | 280 | ||
285 | #ifdef CONFIG_MAC80211_MESH | 281 | #ifdef CONFIG_MAC80211_MESH |
286 | sta->plink_state = NL80211_PLINK_LISTEN; | 282 | sta->plink_state = NL80211_PLINK_LISTEN; |
@@ -333,8 +329,9 @@ static int sta_info_insert_drv_state(struct ieee80211_local *local, | |||
333 | } | 329 | } |
334 | 330 | ||
335 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { | 331 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
336 | pr_debug("%s: failed to move IBSS STA %pM to state %d (%d) - keeping it anyway\n", | 332 | sdata_info(sdata, |
337 | sdata->name, sta->sta.addr, state + 1, err); | 333 | "failed to move IBSS STA %pM to state %d (%d) - keeping it anyway\n", |
334 | sta->sta.addr, state + 1, err); | ||
338 | err = 0; | 335 | err = 0; |
339 | } | 336 | } |
340 | 337 | ||
@@ -389,9 +386,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) | |||
389 | sinfo.generation = local->sta_generation; | 386 | sinfo.generation = local->sta_generation; |
390 | cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); | 387 | cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); |
391 | 388 | ||
392 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 389 | sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr); |
393 | wiphy_debug(local->hw.wiphy, "Inserted STA %pM\n", sta->sta.addr); | ||
394 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
395 | 390 | ||
396 | /* move reference to rcu-protected */ | 391 | /* move reference to rcu-protected */ |
397 | rcu_read_lock(); | 392 | rcu_read_lock(); |
@@ -617,9 +612,8 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local, | |||
617 | break; | 612 | break; |
618 | 613 | ||
619 | local->total_ps_buffered--; | 614 | local->total_ps_buffered--; |
620 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 615 | ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n", |
621 | pr_debug("Buffered frame expired (STA %pM)\n", sta->sta.addr); | 616 | sta->sta.addr); |
622 | #endif | ||
623 | dev_kfree_skb(skb); | 617 | dev_kfree_skb(skb); |
624 | } | 618 | } |
625 | 619 | ||
@@ -745,9 +739,8 @@ int __must_check __sta_info_destroy(struct sta_info *sta) | |||
745 | mesh_accept_plinks_update(sdata); | 739 | mesh_accept_plinks_update(sdata); |
746 | #endif | 740 | #endif |
747 | 741 | ||
748 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 742 | sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr); |
749 | wiphy_debug(local->hw.wiphy, "Removed STA %pM\n", sta->sta.addr); | 743 | |
750 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
751 | cancel_work_sync(&sta->drv_unblock_wk); | 744 | cancel_work_sync(&sta->drv_unblock_wk); |
752 | 745 | ||
753 | cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); | 746 | cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); |
@@ -887,8 +880,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
887 | continue; | 880 | continue; |
888 | 881 | ||
889 | if (time_after(jiffies, sta->last_rx + exp_time)) { | 882 | if (time_after(jiffies, sta->last_rx + exp_time)) { |
890 | ibss_vdbg("%s: expiring inactive STA %pM\n", | 883 | ibss_dbg(sdata, "expiring inactive STA %pM\n", |
891 | sdata->name, sta->sta.addr); | 884 | sta->sta.addr); |
892 | WARN_ON(__sta_info_destroy(sta)); | 885 | WARN_ON(__sta_info_destroy(sta)); |
893 | } | 886 | } |
894 | } | 887 | } |
@@ -986,10 +979,9 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
986 | 979 | ||
987 | sta_info_recalc_tim(sta); | 980 | sta_info_recalc_tim(sta); |
988 | 981 | ||
989 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 982 | ps_dbg(sdata, |
990 | pr_debug("%s: STA %pM aid %d sending %d filtered/%d PS frames since STA not sleeping anymore\n", | 983 | "STA %pM aid %d sending %d filtered/%d PS frames since STA not sleeping anymore\n", |
991 | sdata->name, sta->sta.addr, sta->sta.aid, filtered, buffered); | 984 | sta->sta.addr, sta->sta.aid, filtered, buffered); |
992 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
993 | } | 985 | } |
994 | 986 | ||
995 | static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, | 987 | static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, |
@@ -1379,10 +1371,8 @@ int sta_info_move_state(struct sta_info *sta, | |||
1379 | return -EINVAL; | 1371 | return -EINVAL; |
1380 | } | 1372 | } |
1381 | 1373 | ||
1382 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1374 | sta_dbg(sta->sdata, "moving STA %pM to state %d\n", |
1383 | pr_debug("%s: moving STA %pM to state %d\n", | 1375 | sta->sta.addr, new_state); |
1384 | sta->sdata->name, sta->sta.addr, new_state); | ||
1385 | #endif | ||
1386 | 1376 | ||
1387 | /* | 1377 | /* |
1388 | * notify the driver before the actual changes so it can | 1378 | * notify the driver before the actual changes so it can |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 6b4f42527887..2ed2f27fe8a7 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -155,13 +155,10 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
158 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 158 | ps_dbg_ratelimited(sta->sdata, |
159 | if (net_ratelimit()) | 159 | "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", |
160 | wiphy_debug(local->hw.wiphy, | 160 | skb_queue_len(&sta->tx_filtered[ac]), |
161 | "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", | 161 | !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); |
162 | skb_queue_len(&sta->tx_filtered[ac]), | ||
163 | !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); | ||
164 | #endif | ||
165 | dev_kfree_skb(skb); | 162 | dev_kfree_skb(skb); |
166 | } | 163 | } |
167 | 164 | ||
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 68be47ca208f..57e14d59e12f 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -260,16 +260,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
260 | keyid = pos[3]; | 260 | keyid = pos[3]; |
261 | iv32 = get_unaligned_le32(pos + 4); | 261 | iv32 = get_unaligned_le32(pos + 4); |
262 | pos += 8; | 262 | pos += 8; |
263 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
264 | { | ||
265 | int i; | ||
266 | pr_debug("TKIP decrypt: data(len=%zd)", payload_len); | ||
267 | for (i = 0; i < payload_len; i++) | ||
268 | printk(" %02x", payload[i]); | ||
269 | printk("\n"); | ||
270 | pr_debug("TKIP decrypt: iv16=%04x iv32=%08x\n", iv16, iv32); | ||
271 | } | ||
272 | #endif | ||
273 | 263 | ||
274 | if (!(keyid & (1 << 5))) | 264 | if (!(keyid & (1 << 5))) |
275 | return TKIP_DECRYPT_NO_EXT_IV; | 265 | return TKIP_DECRYPT_NO_EXT_IV; |
@@ -280,15 +270,8 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
280 | if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && | 270 | if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && |
281 | (iv32 < key->u.tkip.rx[queue].iv32 || | 271 | (iv32 < key->u.tkip.rx[queue].iv32 || |
282 | (iv32 == key->u.tkip.rx[queue].iv32 && | 272 | (iv32 == key->u.tkip.rx[queue].iv32 && |
283 | iv16 <= key->u.tkip.rx[queue].iv16))) { | 273 | iv16 <= key->u.tkip.rx[queue].iv16))) |
284 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
285 | pr_debug("TKIP replay detected for RX frame from %pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", | ||
286 | ta, iv32, iv16, | ||
287 | key->u.tkip.rx[queue].iv32, | ||
288 | key->u.tkip.rx[queue].iv16); | ||
289 | #endif | ||
290 | return TKIP_DECRYPT_REPLAY; | 274 | return TKIP_DECRYPT_REPLAY; |
291 | } | ||
292 | 275 | ||
293 | if (only_iv) { | 276 | if (only_iv) { |
294 | res = TKIP_DECRYPT_OK; | 277 | res = TKIP_DECRYPT_OK; |
@@ -300,21 +283,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
300 | key->u.tkip.rx[queue].iv32 != iv32) { | 283 | key->u.tkip.rx[queue].iv32 != iv32) { |
301 | /* IV16 wrapped around - perform TKIP phase 1 */ | 284 | /* IV16 wrapped around - perform TKIP phase 1 */ |
302 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); | 285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); |
303 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
304 | { | ||
305 | int i; | ||
306 | u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY; | ||
307 | pr_debug("TKIP decrypt: Phase1 TA=%pM TK=", ta); | ||
308 | for (i = 0; i < 16; i++) | ||
309 | printk("%02x ", | ||
310 | key->conf.key[key_offset + i]); | ||
311 | printk("\n"); | ||
312 | pr_debug("TKIP decrypt: P1K="); | ||
313 | for (i = 0; i < 5; i++) | ||
314 | printk("%04x ", key->u.tkip.rx[queue].p1k[i]); | ||
315 | printk("\n"); | ||
316 | } | ||
317 | #endif | ||
318 | } | 286 | } |
319 | if (key->local->ops->update_tkip_key && | 287 | if (key->local->ops->update_tkip_key && |
320 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && | 288 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && |
@@ -330,15 +298,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
330 | } | 298 | } |
331 | 299 | ||
332 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); | 300 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); |
333 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
334 | { | ||
335 | int i; | ||
336 | pr_debug("TKIP decrypt: Phase2 rc4key="); | ||
337 | for (i = 0; i < 16; i++) | ||
338 | printk("%02x ", rc4key[i]); | ||
339 | printk("\n"); | ||
340 | } | ||
341 | #endif | ||
342 | 301 | ||
343 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); | 302 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); |
344 | done: | 303 | done: |
diff --git a/net/mac80211/trace.c b/net/mac80211/trace.c new file mode 100644 index 000000000000..386e45d8a958 --- /dev/null +++ b/net/mac80211/trace.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* bug in tracepoint.h, it should include this */ | ||
2 | #include <linux/module.h> | ||
3 | |||
4 | /* sparse isn't too happy with all macros... */ | ||
5 | #ifndef __CHECKER__ | ||
6 | #include <net/cfg80211.h> | ||
7 | #include "driver-ops.h" | ||
8 | #include "debug.h" | ||
9 | #define CREATE_TRACE_POINTS | ||
10 | #include "trace.h" | ||
11 | |||
12 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
13 | void __sdata_info(const char *fmt, ...) | ||
14 | { | ||
15 | struct va_format vaf = { | ||
16 | .fmt = fmt, | ||
17 | }; | ||
18 | va_list args; | ||
19 | |||
20 | va_start(args, fmt); | ||
21 | vaf.va = &args; | ||
22 | |||
23 | pr_info("%pV", &vaf); | ||
24 | trace_mac80211_info(&vaf); | ||
25 | va_end(args); | ||
26 | } | ||
27 | |||
28 | void __sdata_dbg(bool print, const char *fmt, ...) | ||
29 | { | ||
30 | struct va_format vaf = { | ||
31 | .fmt = fmt, | ||
32 | }; | ||
33 | va_list args; | ||
34 | |||
35 | va_start(args, fmt); | ||
36 | vaf.va = &args; | ||
37 | |||
38 | if (print) | ||
39 | pr_debug("%pV", &vaf); | ||
40 | trace_mac80211_dbg(&vaf); | ||
41 | va_end(args); | ||
42 | } | ||
43 | |||
44 | void __sdata_err(const char *fmt, ...) | ||
45 | { | ||
46 | struct va_format vaf = { | ||
47 | .fmt = fmt, | ||
48 | }; | ||
49 | va_list args; | ||
50 | |||
51 | va_start(args, fmt); | ||
52 | vaf.va = &args; | ||
53 | |||
54 | pr_err("%pV", &vaf); | ||
55 | trace_mac80211_err(&vaf); | ||
56 | va_end(args); | ||
57 | } | ||
58 | |||
59 | void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...) | ||
60 | { | ||
61 | struct va_format vaf = { | ||
62 | .fmt = fmt, | ||
63 | }; | ||
64 | va_list args; | ||
65 | |||
66 | va_start(args, fmt); | ||
67 | vaf.va = &args; | ||
68 | |||
69 | if (print) | ||
70 | wiphy_dbg(wiphy, "%pV", &vaf); | ||
71 | trace_mac80211_dbg(&vaf); | ||
72 | va_end(args); | ||
73 | } | ||
74 | #endif | ||
75 | #endif | ||
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/trace.h index 6de00b2c268c..2e60f4acd027 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/trace.h | |||
@@ -1218,6 +1218,32 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames, | |||
1218 | TP_ARGS(local, sta, tids, num_frames, reason, more_data) | 1218 | TP_ARGS(local, sta, tids, num_frames, reason, more_data) |
1219 | ); | 1219 | ); |
1220 | 1220 | ||
1221 | TRACE_EVENT(drv_get_rssi, | ||
1222 | TP_PROTO(struct ieee80211_local *local, struct ieee80211_sta *sta, | ||
1223 | s8 rssi, int ret), | ||
1224 | |||
1225 | TP_ARGS(local, sta, rssi, ret), | ||
1226 | |||
1227 | TP_STRUCT__entry( | ||
1228 | LOCAL_ENTRY | ||
1229 | STA_ENTRY | ||
1230 | __field(s8, rssi) | ||
1231 | __field(int, ret) | ||
1232 | ), | ||
1233 | |||
1234 | TP_fast_assign( | ||
1235 | LOCAL_ASSIGN; | ||
1236 | STA_ASSIGN; | ||
1237 | __entry->rssi = rssi; | ||
1238 | __entry->ret = ret; | ||
1239 | ), | ||
1240 | |||
1241 | TP_printk( | ||
1242 | LOCAL_PR_FMT STA_PR_FMT " rssi:%d ret:%d", | ||
1243 | LOCAL_PR_ARG, STA_PR_ARG, __entry->rssi, __entry->ret | ||
1244 | ) | ||
1245 | ); | ||
1246 | |||
1221 | /* | 1247 | /* |
1222 | * Tracing for API calls that drivers call. | 1248 | * Tracing for API calls that drivers call. |
1223 | */ | 1249 | */ |
@@ -1606,10 +1632,49 @@ TRACE_EVENT(stop_queue, | |||
1606 | LOCAL_PR_ARG, __entry->queue, __entry->reason | 1632 | LOCAL_PR_ARG, __entry->queue, __entry->reason |
1607 | ) | 1633 | ) |
1608 | ); | 1634 | ); |
1635 | |||
1636 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
1637 | #undef TRACE_SYSTEM | ||
1638 | #define TRACE_SYSTEM mac80211_msg | ||
1639 | |||
1640 | #define MAX_MSG_LEN 100 | ||
1641 | |||
1642 | DECLARE_EVENT_CLASS(mac80211_msg_event, | ||
1643 | TP_PROTO(struct va_format *vaf), | ||
1644 | |||
1645 | TP_ARGS(vaf), | ||
1646 | |||
1647 | TP_STRUCT__entry( | ||
1648 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
1649 | ), | ||
1650 | |||
1651 | TP_fast_assign( | ||
1652 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
1653 | MAX_MSG_LEN, vaf->fmt, | ||
1654 | *vaf->va) >= MAX_MSG_LEN); | ||
1655 | ), | ||
1656 | |||
1657 | TP_printk("%s", __get_str(msg)) | ||
1658 | ); | ||
1659 | |||
1660 | DEFINE_EVENT(mac80211_msg_event, mac80211_info, | ||
1661 | TP_PROTO(struct va_format *vaf), | ||
1662 | TP_ARGS(vaf) | ||
1663 | ); | ||
1664 | DEFINE_EVENT(mac80211_msg_event, mac80211_dbg, | ||
1665 | TP_PROTO(struct va_format *vaf), | ||
1666 | TP_ARGS(vaf) | ||
1667 | ); | ||
1668 | DEFINE_EVENT(mac80211_msg_event, mac80211_err, | ||
1669 | TP_PROTO(struct va_format *vaf), | ||
1670 | TP_ARGS(vaf) | ||
1671 | ); | ||
1672 | #endif | ||
1673 | |||
1609 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ | 1674 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
1610 | 1675 | ||
1611 | #undef TRACE_INCLUDE_PATH | 1676 | #undef TRACE_INCLUDE_PATH |
1612 | #define TRACE_INCLUDE_PATH . | 1677 | #define TRACE_INCLUDE_PATH . |
1613 | #undef TRACE_INCLUDE_FILE | 1678 | #undef TRACE_INCLUDE_FILE |
1614 | #define TRACE_INCLUDE_FILE driver-trace | 1679 | #define TRACE_INCLUDE_FILE trace |
1615 | #include <trace/define_trace.h> | 1680 | #include <trace/define_trace.h> |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index af25c4e7ec5c..ec8f53467374 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -175,12 +175,6 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, | |||
175 | return cpu_to_le16(dur); | 175 | return cpu_to_le16(dur); |
176 | } | 176 | } |
177 | 177 | ||
178 | static inline int is_ieee80211_device(struct ieee80211_local *local, | ||
179 | struct net_device *dev) | ||
180 | { | ||
181 | return local == wdev_priv(dev->ieee80211_ptr); | ||
182 | } | ||
183 | |||
184 | /* tx handlers */ | 178 | /* tx handlers */ |
185 | static ieee80211_tx_result debug_noinline | 179 | static ieee80211_tx_result debug_noinline |
186 | ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) | 180 | ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) |
@@ -297,9 +291,10 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
297 | if (unlikely(!assoc && | 291 | if (unlikely(!assoc && |
298 | ieee80211_is_data(hdr->frame_control))) { | 292 | ieee80211_is_data(hdr->frame_control))) { |
299 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 293 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
300 | pr_debug("%s: dropped data frame to not associated station %pM\n", | 294 | sdata_info(tx->sdata, |
301 | tx->sdata->name, hdr->addr1); | 295 | "dropped data frame to not associated station %pM\n", |
302 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 296 | hdr->addr1); |
297 | #endif | ||
303 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 298 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
304 | return TX_DROP; | 299 | return TX_DROP; |
305 | } | 300 | } |
@@ -366,10 +361,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
366 | rcu_read_unlock(); | 361 | rcu_read_unlock(); |
367 | 362 | ||
368 | local->total_ps_buffered = total; | 363 | local->total_ps_buffered = total; |
369 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 364 | ps_dbg_hw(&local->hw, "PS buffers full - purged %d frames\n", purged); |
370 | wiphy_debug(local->hw.wiphy, "PS buffers full - purged %d frames\n", | ||
371 | purged); | ||
372 | #endif | ||
373 | } | 365 | } |
374 | 366 | ||
375 | static ieee80211_tx_result | 367 | static ieee80211_tx_result |
@@ -411,10 +403,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | |||
411 | purge_old_ps_buffers(tx->local); | 403 | purge_old_ps_buffers(tx->local); |
412 | 404 | ||
413 | if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { | 405 | if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { |
414 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 406 | ps_dbg(tx->sdata, |
415 | net_dbg_ratelimited("%s: BC TX buffer full - dropping the oldest frame\n", | 407 | "BC TX buffer full - dropping the oldest frame\n"); |
416 | tx->sdata->name); | ||
417 | #endif | ||
418 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); | 408 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); |
419 | } else | 409 | } else |
420 | tx->local->total_ps_buffered++; | 410 | tx->local->total_ps_buffered++; |
@@ -465,18 +455,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
465 | return TX_CONTINUE; | 455 | return TX_CONTINUE; |
466 | } | 456 | } |
467 | 457 | ||
468 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 458 | ps_dbg(sta->sdata, "STA %pM aid %d: PS buffer for AC %d\n", |
469 | pr_debug("STA %pM aid %d: PS buffer for AC %d\n", | 459 | sta->sta.addr, sta->sta.aid, ac); |
470 | sta->sta.addr, sta->sta.aid, ac); | ||
471 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
472 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 460 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
473 | purge_old_ps_buffers(tx->local); | 461 | purge_old_ps_buffers(tx->local); |
474 | if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { | 462 | if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { |
475 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); | 463 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); |
476 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 464 | ps_dbg(tx->sdata, |
477 | net_dbg_ratelimited("%s: STA %pM TX buffer for AC %d full - dropping oldest frame\n", | 465 | "STA %pM TX buffer for AC %d full - dropping oldest frame\n", |
478 | tx->sdata->name, sta->sta.addr, ac); | 466 | sta->sta.addr, ac); |
479 | #endif | ||
480 | dev_kfree_skb(old); | 467 | dev_kfree_skb(old); |
481 | } else | 468 | } else |
482 | tx->local->total_ps_buffered++; | 469 | tx->local->total_ps_buffered++; |
@@ -498,13 +485,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
498 | sta_info_recalc_tim(sta); | 485 | sta_info_recalc_tim(sta); |
499 | 486 | ||
500 | return TX_QUEUED; | 487 | return TX_QUEUED; |
488 | } else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) { | ||
489 | ps_dbg(tx->sdata, | ||
490 | "STA %pM in PS mode, but polling/in SP -> send frame\n", | ||
491 | sta->sta.addr); | ||
501 | } | 492 | } |
502 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | ||
503 | else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) { | ||
504 | pr_debug("%s: STA %pM in PS mode, but polling/in SP -> send frame\n", | ||
505 | tx->sdata->name, sta->sta.addr); | ||
506 | } | ||
507 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | ||
508 | 493 | ||
509 | return TX_CONTINUE; | 494 | return TX_CONTINUE; |
510 | } | 495 | } |
@@ -1963,7 +1948,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1963 | (cpu_to_be16(ethertype) != sdata->control_port_protocol || | 1948 | (cpu_to_be16(ethertype) != sdata->control_port_protocol || |
1964 | !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { | 1949 | !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { |
1965 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1950 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1966 | net_dbg_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", | 1951 | net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", |
1967 | dev->name, hdr.addr1); | 1952 | dev->name, hdr.addr1); |
1968 | #endif | 1953 | #endif |
1969 | 1954 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 1df4019f294b..242ecde381f6 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1411,6 +1411,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1411 | if (ieee80211_sdata_running(sdata)) | 1411 | if (ieee80211_sdata_running(sdata)) |
1412 | ieee80211_enable_keys(sdata); | 1412 | ieee80211_enable_keys(sdata); |
1413 | 1413 | ||
1414 | local->in_reconfig = false; | ||
1415 | barrier(); | ||
1416 | |||
1414 | wake_up: | 1417 | wake_up: |
1415 | /* | 1418 | /* |
1416 | * Clear the WLAN_STA_BLOCK_BA flag so new aggregation | 1419 | * Clear the WLAN_STA_BLOCK_BA flag so new aggregation |
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index c3d643a6536c..cea06e9f26f4 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c | |||
@@ -52,11 +52,11 @@ static int wme_downgrade_ac(struct sk_buff *skb) | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | static u16 ieee80211_downgrade_queue(struct ieee80211_local *local, | 55 | static u16 ieee80211_downgrade_queue(struct ieee80211_sub_if_data *sdata, |
56 | struct sk_buff *skb) | 56 | struct sk_buff *skb) |
57 | { | 57 | { |
58 | /* in case we are a client verify acm is not set for this ac */ | 58 | /* in case we are a client verify acm is not set for this ac */ |
59 | while (unlikely(local->wmm_acm & BIT(skb->priority))) { | 59 | while (unlikely(sdata->wmm_acm & BIT(skb->priority))) { |
60 | if (wme_downgrade_ac(skb)) { | 60 | if (wme_downgrade_ac(skb)) { |
61 | /* | 61 | /* |
62 | * This should not really happen. The AP has marked all | 62 | * This should not really happen. The AP has marked all |
@@ -73,10 +73,11 @@ static u16 ieee80211_downgrade_queue(struct ieee80211_local *local, | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /* Indicate which queue to use for this fully formed 802.11 frame */ | 75 | /* Indicate which queue to use for this fully formed 802.11 frame */ |
76 | u16 ieee80211_select_queue_80211(struct ieee80211_local *local, | 76 | u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, |
77 | struct sk_buff *skb, | 77 | struct sk_buff *skb, |
78 | struct ieee80211_hdr *hdr) | 78 | struct ieee80211_hdr *hdr) |
79 | { | 79 | { |
80 | struct ieee80211_local *local = sdata->local; | ||
80 | u8 *p; | 81 | u8 *p; |
81 | 82 | ||
82 | if (local->hw.queues < IEEE80211_NUM_ACS) | 83 | if (local->hw.queues < IEEE80211_NUM_ACS) |
@@ -94,7 +95,7 @@ u16 ieee80211_select_queue_80211(struct ieee80211_local *local, | |||
94 | p = ieee80211_get_qos_ctl(hdr); | 95 | p = ieee80211_get_qos_ctl(hdr); |
95 | skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; | 96 | skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; |
96 | 97 | ||
97 | return ieee80211_downgrade_queue(local, skb); | 98 | return ieee80211_downgrade_queue(sdata, skb); |
98 | } | 99 | } |
99 | 100 | ||
100 | /* Indicate which queue to use. */ | 101 | /* Indicate which queue to use. */ |
@@ -156,7 +157,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, | |||
156 | * data frame has */ | 157 | * data frame has */ |
157 | skb->priority = cfg80211_classify8021d(skb); | 158 | skb->priority = cfg80211_classify8021d(skb); |
158 | 159 | ||
159 | return ieee80211_downgrade_queue(local, skb); | 160 | return ieee80211_downgrade_queue(sdata, skb); |
160 | } | 161 | } |
161 | 162 | ||
162 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, | 163 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h index ca80818b7b66..7fea4bb8acbc 100644 --- a/net/mac80211/wme.h +++ b/net/mac80211/wme.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | extern const int ieee802_1d_to_ac[8]; | 16 | extern const int ieee802_1d_to_ac[8]; |
17 | 17 | ||
18 | u16 ieee80211_select_queue_80211(struct ieee80211_local *local, | 18 | u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, |
19 | struct sk_buff *skb, | 19 | struct sk_buff *skb, |
20 | struct ieee80211_hdr *hdr); | 20 | struct ieee80211_hdr *hdr); |
21 | u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, | 21 | u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/wireless/core.c b/net/wireless/core.c index a87d43552974..907f62c80e28 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -96,69 +96,6 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) | |||
96 | return &rdev->wiphy; | 96 | return &rdev->wiphy; |
97 | } | 97 | } |
98 | 98 | ||
99 | /* requires cfg80211_mutex to be held! */ | ||
100 | struct cfg80211_registered_device * | ||
101 | __cfg80211_rdev_from_info(struct genl_info *info) | ||
102 | { | ||
103 | int ifindex; | ||
104 | struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL; | ||
105 | struct net_device *dev; | ||
106 | int err = -EINVAL; | ||
107 | |||
108 | assert_cfg80211_lock(); | ||
109 | |||
110 | if (info->attrs[NL80211_ATTR_WIPHY]) { | ||
111 | bywiphyidx = cfg80211_rdev_by_wiphy_idx( | ||
112 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); | ||
113 | err = -ENODEV; | ||
114 | } | ||
115 | |||
116 | if (info->attrs[NL80211_ATTR_IFINDEX]) { | ||
117 | ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); | ||
118 | dev = dev_get_by_index(genl_info_net(info), ifindex); | ||
119 | if (dev) { | ||
120 | if (dev->ieee80211_ptr) | ||
121 | byifidx = | ||
122 | wiphy_to_dev(dev->ieee80211_ptr->wiphy); | ||
123 | dev_put(dev); | ||
124 | } | ||
125 | err = -ENODEV; | ||
126 | } | ||
127 | |||
128 | if (bywiphyidx && byifidx) { | ||
129 | if (bywiphyidx != byifidx) | ||
130 | return ERR_PTR(-EINVAL); | ||
131 | else | ||
132 | return bywiphyidx; /* == byifidx */ | ||
133 | } | ||
134 | if (bywiphyidx) | ||
135 | return bywiphyidx; | ||
136 | |||
137 | if (byifidx) | ||
138 | return byifidx; | ||
139 | |||
140 | return ERR_PTR(err); | ||
141 | } | ||
142 | |||
143 | struct cfg80211_registered_device * | ||
144 | cfg80211_get_dev_from_info(struct genl_info *info) | ||
145 | { | ||
146 | struct cfg80211_registered_device *rdev; | ||
147 | |||
148 | mutex_lock(&cfg80211_mutex); | ||
149 | rdev = __cfg80211_rdev_from_info(info); | ||
150 | |||
151 | /* if it is not an error we grab the lock on | ||
152 | * it to assure it won't be going away while | ||
153 | * we operate on it */ | ||
154 | if (!IS_ERR(rdev)) | ||
155 | mutex_lock(&rdev->mtx); | ||
156 | |||
157 | mutex_unlock(&cfg80211_mutex); | ||
158 | |||
159 | return rdev; | ||
160 | } | ||
161 | |||
162 | struct cfg80211_registered_device * | 99 | struct cfg80211_registered_device * |
163 | cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) | 100 | cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) |
164 | { | 101 | { |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 9348a47562a4..609a579255ac 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -159,32 +159,6 @@ static inline void cfg80211_unhold_bss(struct cfg80211_internal_bss *bss) | |||
159 | struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx); | 159 | struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx); |
160 | int get_wiphy_idx(struct wiphy *wiphy); | 160 | int get_wiphy_idx(struct wiphy *wiphy); |
161 | 161 | ||
162 | struct cfg80211_registered_device * | ||
163 | __cfg80211_rdev_from_info(struct genl_info *info); | ||
164 | |||
165 | /* | ||
166 | * This function returns a pointer to the driver | ||
167 | * that the genl_info item that is passed refers to. | ||
168 | * If successful, it returns non-NULL and also locks | ||
169 | * the driver's mutex! | ||
170 | * | ||
171 | * This means that you need to call cfg80211_unlock_rdev() | ||
172 | * before being allowed to acquire &cfg80211_mutex! | ||
173 | * | ||
174 | * This is necessary because we need to lock the global | ||
175 | * mutex to get an item off the list safely, and then | ||
176 | * we lock the rdev mutex so it doesn't go away under us. | ||
177 | * | ||
178 | * We don't want to keep cfg80211_mutex locked | ||
179 | * for all the time in order to allow requests on | ||
180 | * other interfaces to go through at the same time. | ||
181 | * | ||
182 | * The result of this can be a PTR_ERR and hence must | ||
183 | * be checked with IS_ERR() for errors. | ||
184 | */ | ||
185 | extern struct cfg80211_registered_device * | ||
186 | cfg80211_get_dev_from_info(struct genl_info *info); | ||
187 | |||
188 | /* requires cfg80211_rdev_mutex to be held! */ | 162 | /* requires cfg80211_rdev_mutex to be held! */ |
189 | struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); | 163 | struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); |
190 | 164 | ||
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index b44c736bf9cf..3b73b07486cf 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -14,6 +14,9 @@ | |||
14 | 14 | ||
15 | #define MESH_PATH_TIMEOUT 5000 | 15 | #define MESH_PATH_TIMEOUT 5000 |
16 | #define MESH_RANN_INTERVAL 5000 | 16 | #define MESH_RANN_INTERVAL 5000 |
17 | #define MESH_PATH_TO_ROOT_TIMEOUT 6000 | ||
18 | #define MESH_ROOT_INTERVAL 5000 | ||
19 | #define MESH_ROOT_CONFIRMATION_INTERVAL 2000 | ||
17 | 20 | ||
18 | /* | 21 | /* |
19 | * Minimum interval between two consecutive PREQs originated by the same | 22 | * Minimum interval between two consecutive PREQs originated by the same |
@@ -62,6 +65,9 @@ const struct mesh_config default_mesh_config = { | |||
62 | .dot11MeshForwarding = true, | 65 | .dot11MeshForwarding = true, |
63 | .rssi_threshold = MESH_RSSI_THRESHOLD, | 66 | .rssi_threshold = MESH_RSSI_THRESHOLD, |
64 | .ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED, | 67 | .ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED, |
68 | .dot11MeshHWMPactivePathToRootTimeout = MESH_PATH_TO_ROOT_TIMEOUT, | ||
69 | .dot11MeshHWMProotInterval = MESH_ROOT_INTERVAL, | ||
70 | .dot11MeshHWMPconfirmationInterval = MESH_ROOT_CONFIRMATION_INTERVAL, | ||
65 | }; | 71 | }; |
66 | 72 | ||
67 | const struct mesh_setup default_mesh_setup = { | 73 | const struct mesh_setup default_mesh_setup = { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index cbdc0fd67a14..3b508eaf2d07 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -70,6 +70,94 @@ static int get_rdev_dev_by_ifindex(struct net *netns, struct nlattr **attrs, | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | static struct cfg80211_registered_device * | ||
74 | __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs) | ||
75 | { | ||
76 | struct cfg80211_registered_device *rdev = NULL, *tmp; | ||
77 | struct net_device *netdev; | ||
78 | |||
79 | assert_cfg80211_lock(); | ||
80 | |||
81 | if (!attrs[NL80211_ATTR_WIPHY] && | ||
82 | !attrs[NL80211_ATTR_IFINDEX]) | ||
83 | return ERR_PTR(-EINVAL); | ||
84 | |||
85 | if (attrs[NL80211_ATTR_WIPHY]) | ||
86 | rdev = cfg80211_rdev_by_wiphy_idx( | ||
87 | nla_get_u32(attrs[NL80211_ATTR_WIPHY])); | ||
88 | |||
89 | if (attrs[NL80211_ATTR_IFINDEX]) { | ||
90 | int ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]); | ||
91 | netdev = dev_get_by_index(netns, ifindex); | ||
92 | if (netdev) { | ||
93 | if (netdev->ieee80211_ptr) | ||
94 | tmp = wiphy_to_dev( | ||
95 | netdev->ieee80211_ptr->wiphy); | ||
96 | else | ||
97 | tmp = NULL; | ||
98 | |||
99 | dev_put(netdev); | ||
100 | |||
101 | /* not wireless device -- return error */ | ||
102 | if (!tmp) | ||
103 | return ERR_PTR(-EINVAL); | ||
104 | |||
105 | /* mismatch -- return error */ | ||
106 | if (rdev && tmp != rdev) | ||
107 | return ERR_PTR(-EINVAL); | ||
108 | |||
109 | rdev = tmp; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | if (!rdev) | ||
114 | return ERR_PTR(-ENODEV); | ||
115 | |||
116 | if (netns != wiphy_net(&rdev->wiphy)) | ||
117 | return ERR_PTR(-ENODEV); | ||
118 | |||
119 | return rdev; | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * This function returns a pointer to the driver | ||
124 | * that the genl_info item that is passed refers to. | ||
125 | * If successful, it returns non-NULL and also locks | ||
126 | * the driver's mutex! | ||
127 | * | ||
128 | * This means that you need to call cfg80211_unlock_rdev() | ||
129 | * before being allowed to acquire &cfg80211_mutex! | ||
130 | * | ||
131 | * This is necessary because we need to lock the global | ||
132 | * mutex to get an item off the list safely, and then | ||
133 | * we lock the rdev mutex so it doesn't go away under us. | ||
134 | * | ||
135 | * We don't want to keep cfg80211_mutex locked | ||
136 | * for all the time in order to allow requests on | ||
137 | * other interfaces to go through at the same time. | ||
138 | * | ||
139 | * The result of this can be a PTR_ERR and hence must | ||
140 | * be checked with IS_ERR() for errors. | ||
141 | */ | ||
142 | static struct cfg80211_registered_device * | ||
143 | cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) | ||
144 | { | ||
145 | struct cfg80211_registered_device *rdev; | ||
146 | |||
147 | mutex_lock(&cfg80211_mutex); | ||
148 | rdev = __cfg80211_rdev_from_attrs(netns, info->attrs); | ||
149 | |||
150 | /* if it is not an error we grab the lock on | ||
151 | * it to assure it won't be going away while | ||
152 | * we operate on it */ | ||
153 | if (!IS_ERR(rdev)) | ||
154 | mutex_lock(&rdev->mtx); | ||
155 | |||
156 | mutex_unlock(&cfg80211_mutex); | ||
157 | |||
158 | return rdev; | ||
159 | } | ||
160 | |||
73 | /* policy for the attributes */ | 161 | /* policy for the attributes */ |
74 | static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | 162 | static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { |
75 | [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, | 163 | [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, |
@@ -115,7 +203,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
115 | [NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 }, | 203 | [NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 }, |
116 | [NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ }, | 204 | [NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ }, |
117 | [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, | 205 | [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, |
118 | .len = IEEE80211_MAX_MESH_ID_LEN }, | 206 | .len = IEEE80211_MAX_MESH_ID_LEN }, |
119 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, | 207 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, |
120 | 208 | ||
121 | [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, | 209 | [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, |
@@ -250,8 +338,9 @@ nl80211_rekey_policy[NUM_NL80211_REKEY_DATA] = { | |||
250 | 338 | ||
251 | static const struct nla_policy | 339 | static const struct nla_policy |
252 | nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = { | 340 | nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = { |
253 | [NL80211_ATTR_SCHED_SCAN_MATCH_SSID] = { .type = NLA_BINARY, | 341 | [NL80211_SCHED_SCAN_MATCH_ATTR_SSID] = { .type = NLA_BINARY, |
254 | .len = IEEE80211_MAX_SSID_LEN }, | 342 | .len = IEEE80211_MAX_SSID_LEN }, |
343 | [NL80211_SCHED_SCAN_MATCH_ATTR_RSSI] = { .type = NLA_U32 }, | ||
255 | }; | 344 | }; |
256 | 345 | ||
257 | /* ifidx get helper */ | 346 | /* ifidx get helper */ |
@@ -1334,7 +1423,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1334 | } | 1423 | } |
1335 | 1424 | ||
1336 | if (!netdev) { | 1425 | if (!netdev) { |
1337 | rdev = __cfg80211_rdev_from_info(info); | 1426 | rdev = __cfg80211_rdev_from_attrs(genl_info_net(info), |
1427 | info->attrs); | ||
1338 | if (IS_ERR(rdev)) { | 1428 | if (IS_ERR(rdev)) { |
1339 | mutex_unlock(&cfg80211_mutex); | 1429 | mutex_unlock(&cfg80211_mutex); |
1340 | return PTR_ERR(rdev); | 1430 | return PTR_ERR(rdev); |
@@ -2246,6 +2336,33 @@ static int nl80211_parse_beacon(struct genl_info *info, | |||
2246 | return 0; | 2336 | return 0; |
2247 | } | 2337 | } |
2248 | 2338 | ||
2339 | static bool nl80211_get_ap_channel(struct cfg80211_registered_device *rdev, | ||
2340 | struct cfg80211_ap_settings *params) | ||
2341 | { | ||
2342 | struct wireless_dev *wdev; | ||
2343 | bool ret = false; | ||
2344 | |||
2345 | mutex_lock(&rdev->devlist_mtx); | ||
2346 | |||
2347 | list_for_each_entry(wdev, &rdev->netdev_list, list) { | ||
2348 | if (wdev->iftype != NL80211_IFTYPE_AP && | ||
2349 | wdev->iftype != NL80211_IFTYPE_P2P_GO) | ||
2350 | continue; | ||
2351 | |||
2352 | if (!wdev->preset_chan) | ||
2353 | continue; | ||
2354 | |||
2355 | params->channel = wdev->preset_chan; | ||
2356 | params->channel_type = wdev->preset_chantype; | ||
2357 | ret = true; | ||
2358 | break; | ||
2359 | } | ||
2360 | |||
2361 | mutex_unlock(&rdev->devlist_mtx); | ||
2362 | |||
2363 | return ret; | ||
2364 | } | ||
2365 | |||
2249 | static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | 2366 | static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) |
2250 | { | 2367 | { |
2251 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 2368 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
@@ -2348,7 +2465,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
2348 | } else if (wdev->preset_chan) { | 2465 | } else if (wdev->preset_chan) { |
2349 | params.channel = wdev->preset_chan; | 2466 | params.channel = wdev->preset_chan; |
2350 | params.channel_type = wdev->preset_chantype; | 2467 | params.channel_type = wdev->preset_chantype; |
2351 | } else | 2468 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) |
2352 | return -EINVAL; | 2469 | return -EINVAL; |
2353 | 2470 | ||
2354 | if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel, | 2471 | if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel, |
@@ -2356,8 +2473,11 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
2356 | return -EINVAL; | 2473 | return -EINVAL; |
2357 | 2474 | ||
2358 | err = rdev->ops->start_ap(&rdev->wiphy, dev, ¶ms); | 2475 | err = rdev->ops->start_ap(&rdev->wiphy, dev, ¶ms); |
2359 | if (!err) | 2476 | if (!err) { |
2477 | wdev->preset_chan = params.channel; | ||
2478 | wdev->preset_chantype = params.channel_type; | ||
2360 | wdev->beacon_interval = params.beacon_interval; | 2479 | wdev->beacon_interval = params.beacon_interval; |
2480 | } | ||
2361 | return err; | 2481 | return err; |
2362 | } | 2482 | } |
2363 | 2483 | ||
@@ -3469,7 +3589,13 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, | |||
3469 | nla_put_u32(msg, NL80211_MESHCONF_RSSI_THRESHOLD, | 3589 | nla_put_u32(msg, NL80211_MESHCONF_RSSI_THRESHOLD, |
3470 | cur_params.rssi_threshold) || | 3590 | cur_params.rssi_threshold) || |
3471 | nla_put_u32(msg, NL80211_MESHCONF_HT_OPMODE, | 3591 | nla_put_u32(msg, NL80211_MESHCONF_HT_OPMODE, |
3472 | cur_params.ht_opmode)) | 3592 | cur_params.ht_opmode) || |
3593 | nla_put_u32(msg, NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, | ||
3594 | cur_params.dot11MeshHWMPactivePathToRootTimeout) || | ||
3595 | nla_put_u16(msg, NL80211_MESHCONF_HWMP_ROOT_INTERVAL, | ||
3596 | cur_params.dot11MeshHWMProotInterval) || | ||
3597 | nla_put_u16(msg, NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, | ||
3598 | cur_params.dot11MeshHWMPconfirmationInterval)) | ||
3473 | goto nla_put_failure; | 3599 | goto nla_put_failure; |
3474 | nla_nest_end(msg, pinfoattr); | 3600 | nla_nest_end(msg, pinfoattr); |
3475 | genlmsg_end(msg, hdr); | 3601 | genlmsg_end(msg, hdr); |
@@ -3492,7 +3618,6 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A | |||
3492 | [NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 }, | 3618 | [NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 }, |
3493 | [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, | 3619 | [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, |
3494 | [NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR] = { .type = NLA_U32 }, | 3620 | [NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR] = { .type = NLA_U32 }, |
3495 | |||
3496 | [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, | 3621 | [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, |
3497 | [NL80211_MESHCONF_PATH_REFRESH_TIME] = { .type = NLA_U32 }, | 3622 | [NL80211_MESHCONF_PATH_REFRESH_TIME] = { .type = NLA_U32 }, |
3498 | [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 }, | 3623 | [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 }, |
@@ -3504,8 +3629,11 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A | |||
3504 | [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, | 3629 | [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, |
3505 | [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, | 3630 | [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, |
3506 | [NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 }, | 3631 | [NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 }, |
3507 | [NL80211_MESHCONF_RSSI_THRESHOLD] = { .type = NLA_U32}, | 3632 | [NL80211_MESHCONF_RSSI_THRESHOLD] = { .type = NLA_U32 }, |
3508 | [NL80211_MESHCONF_HT_OPMODE] = { .type = NLA_U16}, | 3633 | [NL80211_MESHCONF_HT_OPMODE] = { .type = NLA_U16 }, |
3634 | [NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT] = { .type = NLA_U32 }, | ||
3635 | [NL80211_MESHCONF_HWMP_ROOT_INTERVAL] = { .type = NLA_U16 }, | ||
3636 | [NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL] = { .type = NLA_U16 }, | ||
3509 | }; | 3637 | }; |
3510 | 3638 | ||
3511 | static const struct nla_policy | 3639 | static const struct nla_policy |
@@ -3515,7 +3643,7 @@ static const struct nla_policy | |||
3515 | [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, | 3643 | [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, |
3516 | [NL80211_MESH_SETUP_USERSPACE_AUTH] = { .type = NLA_FLAG }, | 3644 | [NL80211_MESH_SETUP_USERSPACE_AUTH] = { .type = NLA_FLAG }, |
3517 | [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY, | 3645 | [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY, |
3518 | .len = IEEE80211_MAX_DATA_LEN }, | 3646 | .len = IEEE80211_MAX_DATA_LEN }, |
3519 | [NL80211_MESH_SETUP_USERSPACE_AMPE] = { .type = NLA_FLAG }, | 3647 | [NL80211_MESH_SETUP_USERSPACE_AMPE] = { .type = NLA_FLAG }, |
3520 | }; | 3648 | }; |
3521 | 3649 | ||
@@ -3548,63 +3676,82 @@ do {\ | |||
3548 | 3676 | ||
3549 | /* Fill in the params struct */ | 3677 | /* Fill in the params struct */ |
3550 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshRetryTimeout, | 3678 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshRetryTimeout, |
3551 | mask, NL80211_MESHCONF_RETRY_TIMEOUT, nla_get_u16); | 3679 | mask, NL80211_MESHCONF_RETRY_TIMEOUT, |
3680 | nla_get_u16); | ||
3552 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConfirmTimeout, | 3681 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConfirmTimeout, |
3553 | mask, NL80211_MESHCONF_CONFIRM_TIMEOUT, nla_get_u16); | 3682 | mask, NL80211_MESHCONF_CONFIRM_TIMEOUT, |
3683 | nla_get_u16); | ||
3554 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHoldingTimeout, | 3684 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHoldingTimeout, |
3555 | mask, NL80211_MESHCONF_HOLDING_TIMEOUT, nla_get_u16); | 3685 | mask, NL80211_MESHCONF_HOLDING_TIMEOUT, |
3686 | nla_get_u16); | ||
3556 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxPeerLinks, | 3687 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxPeerLinks, |
3557 | mask, NL80211_MESHCONF_MAX_PEER_LINKS, nla_get_u16); | 3688 | mask, NL80211_MESHCONF_MAX_PEER_LINKS, |
3689 | nla_get_u16); | ||
3558 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxRetries, | 3690 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxRetries, |
3559 | mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8); | 3691 | mask, NL80211_MESHCONF_MAX_RETRIES, |
3692 | nla_get_u8); | ||
3560 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, | 3693 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, |
3561 | mask, NL80211_MESHCONF_TTL, nla_get_u8); | 3694 | mask, NL80211_MESHCONF_TTL, nla_get_u8); |
3562 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, element_ttl, | 3695 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, element_ttl, |
3563 | mask, NL80211_MESHCONF_ELEMENT_TTL, nla_get_u8); | 3696 | mask, NL80211_MESHCONF_ELEMENT_TTL, |
3697 | nla_get_u8); | ||
3564 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, | 3698 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, |
3565 | mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8); | 3699 | mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, |
3566 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshNbrOffsetMaxNeighbor, | 3700 | nla_get_u8); |
3567 | mask, NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, | 3701 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshNbrOffsetMaxNeighbor, mask, |
3568 | nla_get_u32); | 3702 | NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, |
3703 | nla_get_u32); | ||
3569 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, | 3704 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, |
3570 | mask, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, | 3705 | mask, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, |
3571 | nla_get_u8); | 3706 | nla_get_u8); |
3572 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, path_refresh_time, | 3707 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, path_refresh_time, |
3573 | mask, NL80211_MESHCONF_PATH_REFRESH_TIME, nla_get_u32); | 3708 | mask, NL80211_MESHCONF_PATH_REFRESH_TIME, |
3709 | nla_get_u32); | ||
3574 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, min_discovery_timeout, | 3710 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, min_discovery_timeout, |
3575 | mask, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, | 3711 | mask, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, |
3576 | nla_get_u16); | 3712 | nla_get_u16); |
3577 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathTimeout, | 3713 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathTimeout, mask, |
3578 | mask, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, | 3714 | NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, |
3579 | nla_get_u32); | 3715 | nla_get_u32); |
3580 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval, | 3716 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval, |
3581 | mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, | 3717 | mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, |
3582 | nla_get_u16); | 3718 | nla_get_u16); |
3583 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPperrMinInterval, | 3719 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPperrMinInterval, |
3584 | mask, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, | 3720 | mask, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, |
3585 | nla_get_u16); | 3721 | nla_get_u16); |
3586 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | ||
3587 | dot11MeshHWMPnetDiameterTraversalTime, | ||
3588 | mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | ||
3589 | nla_get_u16); | ||
3590 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | 3722 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, |
3591 | dot11MeshHWMPRootMode, mask, | 3723 | dot11MeshHWMPnetDiameterTraversalTime, mask, |
3592 | NL80211_MESHCONF_HWMP_ROOTMODE, | 3724 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, |
3593 | nla_get_u8); | 3725 | nla_get_u16); |
3726 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPRootMode, mask, | ||
3727 | NL80211_MESHCONF_HWMP_ROOTMODE, nla_get_u8); | ||
3728 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPRannInterval, mask, | ||
3729 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | ||
3730 | nla_get_u16); | ||
3594 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | 3731 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, |
3595 | dot11MeshHWMPRannInterval, mask, | 3732 | dot11MeshGateAnnouncementProtocol, mask, |
3596 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | 3733 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
3597 | nla_get_u16); | 3734 | nla_get_u8); |
3598 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | ||
3599 | dot11MeshGateAnnouncementProtocol, mask, | ||
3600 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | ||
3601 | nla_get_u8); | ||
3602 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, | 3735 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, |
3603 | mask, NL80211_MESHCONF_FORWARDING, nla_get_u8); | 3736 | mask, NL80211_MESHCONF_FORWARDING, |
3737 | nla_get_u8); | ||
3604 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, | 3738 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, |
3605 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, nla_get_u32); | 3739 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, |
3740 | nla_get_u32); | ||
3606 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, | 3741 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, |
3607 | mask, NL80211_MESHCONF_HT_OPMODE, nla_get_u16); | 3742 | mask, NL80211_MESHCONF_HT_OPMODE, |
3743 | nla_get_u16); | ||
3744 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout, | ||
3745 | mask, | ||
3746 | NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, | ||
3747 | nla_get_u32); | ||
3748 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMProotInterval, | ||
3749 | mask, NL80211_MESHCONF_HWMP_ROOT_INTERVAL, | ||
3750 | nla_get_u16); | ||
3751 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | ||
3752 | dot11MeshHWMPconfirmationInterval, mask, | ||
3753 | NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, | ||
3754 | nla_get_u16); | ||
3608 | if (mask_out) | 3755 | if (mask_out) |
3609 | *mask_out = mask; | 3756 | *mask_out = mask; |
3610 | 3757 | ||
@@ -4241,12 +4388,12 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
4241 | nla_for_each_nested(attr, | 4388 | nla_for_each_nested(attr, |
4242 | info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH], | 4389 | info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH], |
4243 | tmp) { | 4390 | tmp) { |
4244 | struct nlattr *ssid; | 4391 | struct nlattr *ssid, *rssi; |
4245 | 4392 | ||
4246 | nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX, | 4393 | nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX, |
4247 | nla_data(attr), nla_len(attr), | 4394 | nla_data(attr), nla_len(attr), |
4248 | nl80211_match_policy); | 4395 | nl80211_match_policy); |
4249 | ssid = tb[NL80211_ATTR_SCHED_SCAN_MATCH_SSID]; | 4396 | ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]; |
4250 | if (ssid) { | 4397 | if (ssid) { |
4251 | if (nla_len(ssid) > IEEE80211_MAX_SSID_LEN) { | 4398 | if (nla_len(ssid) > IEEE80211_MAX_SSID_LEN) { |
4252 | err = -EINVAL; | 4399 | err = -EINVAL; |
@@ -4257,6 +4404,12 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
4257 | request->match_sets[i].ssid.ssid_len = | 4404 | request->match_sets[i].ssid.ssid_len = |
4258 | nla_len(ssid); | 4405 | nla_len(ssid); |
4259 | } | 4406 | } |
4407 | rssi = tb[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI]; | ||
4408 | if (rssi) | ||
4409 | request->rssi_thold = nla_get_u32(rssi); | ||
4410 | else | ||
4411 | request->rssi_thold = | ||
4412 | NL80211_SCAN_RSSI_THOLD_OFF; | ||
4260 | i++; | 4413 | i++; |
4261 | } | 4414 | } |
4262 | } | 4415 | } |
@@ -5114,21 +5267,18 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
5114 | nl80211_policy); | 5267 | nl80211_policy); |
5115 | if (err) | 5268 | if (err) |
5116 | return err; | 5269 | return err; |
5117 | if (nl80211_fam.attrbuf[NL80211_ATTR_WIPHY]) { | ||
5118 | phy_idx = nla_get_u32( | ||
5119 | nl80211_fam.attrbuf[NL80211_ATTR_WIPHY]); | ||
5120 | } else { | ||
5121 | struct net_device *netdev; | ||
5122 | 5270 | ||
5123 | err = get_rdev_dev_by_ifindex(sock_net(skb->sk), | 5271 | mutex_lock(&cfg80211_mutex); |
5124 | nl80211_fam.attrbuf, | 5272 | rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), |
5125 | &rdev, &netdev); | 5273 | nl80211_fam.attrbuf); |
5126 | if (err) | 5274 | if (IS_ERR(rdev)) { |
5127 | return err; | 5275 | mutex_unlock(&cfg80211_mutex); |
5128 | dev_put(netdev); | 5276 | return PTR_ERR(rdev); |
5129 | phy_idx = rdev->wiphy_idx; | ||
5130 | cfg80211_unlock_rdev(rdev); | ||
5131 | } | 5277 | } |
5278 | phy_idx = rdev->wiphy_idx; | ||
5279 | rdev = NULL; | ||
5280 | mutex_unlock(&cfg80211_mutex); | ||
5281 | |||
5132 | if (nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]) | 5282 | if (nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]) |
5133 | cb->args[1] = | 5283 | cb->args[1] = |
5134 | (long)nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]; | 5284 | (long)nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]; |
@@ -6511,7 +6661,7 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, | |||
6511 | rtnl_lock(); | 6661 | rtnl_lock(); |
6512 | 6662 | ||
6513 | if (ops->internal_flags & NL80211_FLAG_NEED_WIPHY) { | 6663 | if (ops->internal_flags & NL80211_FLAG_NEED_WIPHY) { |
6514 | rdev = cfg80211_get_dev_from_info(info); | 6664 | rdev = cfg80211_get_dev_from_info(genl_info_net(info), info); |
6515 | if (IS_ERR(rdev)) { | 6665 | if (IS_ERR(rdev)) { |
6516 | if (rtnl) | 6666 | if (rtnl) |
6517 | rtnl_unlock(); | 6667 | rtnl_unlock(); |