diff options
Diffstat (limited to 'drivers/net/wireless/at76c50x-usb.c')
-rw-r--r-- | drivers/net/wireless/at76c50x-usb.c | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 8e1a55dec351..0fb419936dff 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -121,6 +121,14 @@ static struct fwentry firmwares[] = { | |||
121 | [BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" }, | 121 | [BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" }, |
122 | [BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" }, | 122 | [BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" }, |
123 | }; | 123 | }; |
124 | MODULE_FIRMWARE("atmel_at76c503-i3861.bin"); | ||
125 | MODULE_FIRMWARE("atmel_at76c503-i3863.bin"); | ||
126 | MODULE_FIRMWARE("atmel_at76c503-rfmd.bin"); | ||
127 | MODULE_FIRMWARE("atmel_at76c503-rfmd-acc.bin"); | ||
128 | MODULE_FIRMWARE("atmel_at76c505-rfmd.bin"); | ||
129 | MODULE_FIRMWARE("atmel_at76c505-rfmd2958.bin"); | ||
130 | MODULE_FIRMWARE("atmel_at76c505a-rfmd2958.bin"); | ||
131 | MODULE_FIRMWARE("atmel_at76c505amx-rfmd.bin"); | ||
124 | 132 | ||
125 | #define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops) | 133 | #define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops) |
126 | 134 | ||
@@ -524,20 +532,6 @@ static char *hex2str(void *buf, int len) | |||
524 | return ret; | 532 | return ret; |
525 | } | 533 | } |
526 | 534 | ||
527 | #define MAC2STR_BUFFERS 4 | ||
528 | |||
529 | static inline char *mac2str(u8 *mac) | ||
530 | { | ||
531 | static atomic_t a = ATOMIC_INIT(0); | ||
532 | static char bufs[MAC2STR_BUFFERS][6 * 3]; | ||
533 | char *str; | ||
534 | |||
535 | str = bufs[atomic_inc_return(&a) & (MAC2STR_BUFFERS - 1)]; | ||
536 | sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", | ||
537 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | ||
538 | return str; | ||
539 | } | ||
540 | |||
541 | /* LED trigger */ | 535 | /* LED trigger */ |
542 | static int tx_activity; | 536 | static int tx_activity; |
543 | static void at76_ledtrig_tx_timerfunc(unsigned long data); | 537 | static void at76_ledtrig_tx_timerfunc(unsigned long data); |
@@ -973,13 +967,13 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) | |||
973 | goto exit; | 967 | goto exit; |
974 | } | 968 | } |
975 | 969 | ||
976 | at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x", | 970 | at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %pM res 0x%x 0x%x", |
977 | wiphy_name(priv->hw->wiphy), | 971 | wiphy_name(priv->hw->wiphy), |
978 | mac2str(m->mac_addr), m->res[0], m->res[1]); | 972 | m->mac_addr, m->res[0], m->res[1]); |
979 | for (i = 0; i < ARRAY_SIZE(m->group_addr); i++) | 973 | for (i = 0; i < ARRAY_SIZE(m->group_addr); i++) |
980 | at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %s, " | 974 | at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %pM, " |
981 | "status %d", wiphy_name(priv->hw->wiphy), i, | 975 | "status %d", wiphy_name(priv->hw->wiphy), i, |
982 | mac2str(m->group_addr[i]), m->group_addr_status[i]); | 976 | m->group_addr[i], m->group_addr_status[i]); |
983 | exit: | 977 | exit: |
984 | kfree(m); | 978 | kfree(m); |
985 | } | 979 | } |
@@ -1042,7 +1036,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) | |||
1042 | at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration " | 1036 | at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration " |
1043 | "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d " | 1037 | "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d " |
1044 | "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d " | 1038 | "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d " |
1045 | "current_bssid %s current_essid %s current_bss_type %d " | 1039 | "current_bssid %pM current_essid %s current_bss_type %d " |
1046 | "pm_mode %d ibss_change %d res %d " | 1040 | "pm_mode %d ibss_change %d res %d " |
1047 | "multi_domain_capability_implemented %d " | 1041 | "multi_domain_capability_implemented %d " |
1048 | "international_roaming %d country_string %.3s", | 1042 | "international_roaming %d country_string %.3s", |
@@ -1051,7 +1045,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) | |||
1051 | le16_to_cpu(m->medium_occupancy_limit), | 1045 | le16_to_cpu(m->medium_occupancy_limit), |
1052 | le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window), | 1046 | le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window), |
1053 | m->CFP_mode, m->privacy_option_implemented, m->DTIM_period, | 1047 | m->CFP_mode, m->privacy_option_implemented, m->DTIM_period, |
1054 | m->CFP_period, mac2str(m->current_bssid), | 1048 | m->CFP_period, m->current_bssid, |
1055 | hex2str(m->current_essid, IW_ESSID_MAX_SIZE), | 1049 | hex2str(m->current_essid, IW_ESSID_MAX_SIZE), |
1056 | m->current_bss_type, m->power_mgmt_mode, m->ibss_change, | 1050 | m->current_bss_type, m->power_mgmt_mode, m->ibss_change, |
1057 | m->res, m->multi_domain_capability_implemented, | 1051 | m->res, m->multi_domain_capability_implemented, |
@@ -1080,7 +1074,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv) | |||
1080 | "cwmin %d cwmax %d short_retry_time %d long_retry_time %d " | 1074 | "cwmin %d cwmax %d short_retry_time %d long_retry_time %d " |
1081 | "scan_type %d scan_channel %d probe_delay %u " | 1075 | "scan_type %d scan_channel %d probe_delay %u " |
1082 | "min_channel_time %d max_channel_time %d listen_int %d " | 1076 | "min_channel_time %d max_channel_time %d listen_int %d " |
1083 | "desired_ssid %s desired_bssid %s desired_bsstype %d", | 1077 | "desired_ssid %s desired_bssid %pM desired_bsstype %d", |
1084 | wiphy_name(priv->hw->wiphy), | 1078 | wiphy_name(priv->hw->wiphy), |
1085 | le32_to_cpu(m->max_tx_msdu_lifetime), | 1079 | le32_to_cpu(m->max_tx_msdu_lifetime), |
1086 | le32_to_cpu(m->max_rx_lifetime), | 1080 | le32_to_cpu(m->max_rx_lifetime), |
@@ -1092,7 +1086,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv) | |||
1092 | le16_to_cpu(m->max_channel_time), | 1086 | le16_to_cpu(m->max_channel_time), |
1093 | le16_to_cpu(m->listen_interval), | 1087 | le16_to_cpu(m->listen_interval), |
1094 | hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE), | 1088 | hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE), |
1095 | mac2str(m->desired_bssid), m->desired_bsstype); | 1089 | m->desired_bssid, m->desired_bsstype); |
1096 | exit: | 1090 | exit: |
1097 | kfree(m); | 1091 | kfree(m); |
1098 | } | 1092 | } |
@@ -1194,6 +1188,9 @@ static int at76_start_monitor(struct at76_priv *priv) | |||
1194 | scan.channel = priv->channel; | 1188 | scan.channel = priv->channel; |
1195 | scan.scan_type = SCAN_TYPE_PASSIVE; | 1189 | scan.scan_type = SCAN_TYPE_PASSIVE; |
1196 | scan.international_scan = 0; | 1190 | scan.international_scan = 0; |
1191 | scan.min_channel_time = cpu_to_le16(priv->scan_min_time); | ||
1192 | scan.max_channel_time = cpu_to_le16(priv->scan_max_time); | ||
1193 | scan.probe_delay = cpu_to_le16(0); | ||
1197 | 1194 | ||
1198 | ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan)); | 1195 | ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan)); |
1199 | if (ret >= 0) | 1196 | if (ret >= 0) |
@@ -1792,7 +1789,7 @@ static void at76_mac80211_stop(struct ieee80211_hw *hw) | |||
1792 | } | 1789 | } |
1793 | 1790 | ||
1794 | static int at76_add_interface(struct ieee80211_hw *hw, | 1791 | static int at76_add_interface(struct ieee80211_hw *hw, |
1795 | struct ieee80211_if_init_conf *conf) | 1792 | struct ieee80211_vif *vif) |
1796 | { | 1793 | { |
1797 | struct at76_priv *priv = hw->priv; | 1794 | struct at76_priv *priv = hw->priv; |
1798 | int ret = 0; | 1795 | int ret = 0; |
@@ -1801,7 +1798,7 @@ static int at76_add_interface(struct ieee80211_hw *hw, | |||
1801 | 1798 | ||
1802 | mutex_lock(&priv->mtx); | 1799 | mutex_lock(&priv->mtx); |
1803 | 1800 | ||
1804 | switch (conf->type) { | 1801 | switch (vif->type) { |
1805 | case NL80211_IFTYPE_STATION: | 1802 | case NL80211_IFTYPE_STATION: |
1806 | priv->iw_mode = IW_MODE_INFRA; | 1803 | priv->iw_mode = IW_MODE_INFRA; |
1807 | break; | 1804 | break; |
@@ -1817,7 +1814,7 @@ exit: | |||
1817 | } | 1814 | } |
1818 | 1815 | ||
1819 | static void at76_remove_interface(struct ieee80211_hw *hw, | 1816 | static void at76_remove_interface(struct ieee80211_hw *hw, |
1820 | struct ieee80211_if_init_conf *conf) | 1817 | struct ieee80211_vif *vif) |
1821 | { | 1818 | { |
1822 | at76_dbg(DBG_MAC80211, "%s()", __func__); | 1819 | at76_dbg(DBG_MAC80211, "%s()", __func__); |
1823 | } | 1820 | } |
@@ -2217,6 +2214,8 @@ static struct ieee80211_supported_band at76_supported_band = { | |||
2217 | static int at76_init_new_device(struct at76_priv *priv, | 2214 | static int at76_init_new_device(struct at76_priv *priv, |
2218 | struct usb_interface *interface) | 2215 | struct usb_interface *interface) |
2219 | { | 2216 | { |
2217 | struct wiphy *wiphy; | ||
2218 | size_t len; | ||
2220 | int ret; | 2219 | int ret; |
2221 | 2220 | ||
2222 | /* set up the endpoint information */ | 2221 | /* set up the endpoint information */ |
@@ -2254,6 +2253,7 @@ static int at76_init_new_device(struct at76_priv *priv, | |||
2254 | priv->device_unplugged = 0; | 2253 | priv->device_unplugged = 0; |
2255 | 2254 | ||
2256 | /* mac80211 initialisation */ | 2255 | /* mac80211 initialisation */ |
2256 | wiphy = priv->hw->wiphy; | ||
2257 | priv->hw->wiphy->max_scan_ssids = 1; | 2257 | priv->hw->wiphy->max_scan_ssids = 1; |
2258 | priv->hw->wiphy->max_scan_ie_len = 0; | 2258 | priv->hw->wiphy->max_scan_ie_len = 0; |
2259 | priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | 2259 | priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); |
@@ -2265,6 +2265,13 @@ static int at76_init_new_device(struct at76_priv *priv, | |||
2265 | SET_IEEE80211_DEV(priv->hw, &interface->dev); | 2265 | SET_IEEE80211_DEV(priv->hw, &interface->dev); |
2266 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | 2266 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); |
2267 | 2267 | ||
2268 | len = sizeof(wiphy->fw_version); | ||
2269 | snprintf(wiphy->fw_version, len, "%d.%d.%d-%d", | ||
2270 | priv->fw_version.major, priv->fw_version.minor, | ||
2271 | priv->fw_version.patch, priv->fw_version.build); | ||
2272 | |||
2273 | wiphy->hw_version = priv->board_type; | ||
2274 | |||
2268 | ret = ieee80211_register_hw(priv->hw); | 2275 | ret = ieee80211_register_hw(priv->hw); |
2269 | if (ret) { | 2276 | if (ret) { |
2270 | printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n", | 2277 | printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n", |
@@ -2274,9 +2281,9 @@ static int at76_init_new_device(struct at76_priv *priv, | |||
2274 | 2281 | ||
2275 | priv->mac80211_registered = 1; | 2282 | priv->mac80211_registered = 1; |
2276 | 2283 | ||
2277 | printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n", | 2284 | printk(KERN_INFO "%s: USB %s, MAC %pM, firmware %d.%d.%d-%d\n", |
2278 | wiphy_name(priv->hw->wiphy), | 2285 | wiphy_name(priv->hw->wiphy), |
2279 | dev_name(&interface->dev), mac2str(priv->mac_addr), | 2286 | dev_name(&interface->dev), priv->mac_addr, |
2280 | priv->fw_version.major, priv->fw_version.minor, | 2287 | priv->fw_version.major, priv->fw_version.minor, |
2281 | priv->fw_version.patch, priv->fw_version.build); | 2288 | priv->fw_version.patch, priv->fw_version.build); |
2282 | printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", | 2289 | printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", |