aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/ipw2100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2x00/ipw2100.c')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c124
1 files changed, 95 insertions, 29 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index a9bc8a97c4e1..6c836c892e43 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -296,6 +296,33 @@ static const char *command_types[] = {
296}; 296};
297#endif 297#endif
298 298
299#define WEXT_USECHANNELS 1
300
301static const long ipw2100_frequencies[] = {
302 2412, 2417, 2422, 2427,
303 2432, 2437, 2442, 2447,
304 2452, 2457, 2462, 2467,
305 2472, 2484
306};
307
308#define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies)
309
310static const long ipw2100_rates_11b[] = {
311 1000000,
312 2000000,
313 5500000,
314 11000000
315};
316
317static struct ieee80211_rate ipw2100_bg_rates[] = {
318 { .bitrate = 10 },
319 { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
320 { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
321 { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
322};
323
324#define RATE_COUNT ARRAY_SIZE(ipw2100_rates_11b)
325
299/* Pre-decl until we get the code solid and then we can clean it up */ 326/* Pre-decl until we get the code solid and then we can clean it up */
300static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); 327static void ipw2100_tx_send_commands(struct ipw2100_priv *priv);
301static void ipw2100_tx_send_data(struct ipw2100_priv *priv); 328static void ipw2100_tx_send_data(struct ipw2100_priv *priv);
@@ -1141,6 +1168,7 @@ static int rf_kill_active(struct ipw2100_priv *priv)
1141 int i; 1168 int i;
1142 1169
1143 if (!(priv->hw_features & HW_FEATURE_RFKILL)) { 1170 if (!(priv->hw_features & HW_FEATURE_RFKILL)) {
1171 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false);
1144 priv->status &= ~STATUS_RF_KILL_HW; 1172 priv->status &= ~STATUS_RF_KILL_HW;
1145 return 0; 1173 return 0;
1146 } 1174 }
@@ -1151,10 +1179,13 @@ static int rf_kill_active(struct ipw2100_priv *priv)
1151 value = (value << 1) | ((reg & IPW_BIT_GPIO_RF_KILL) ? 0 : 1); 1179 value = (value << 1) | ((reg & IPW_BIT_GPIO_RF_KILL) ? 0 : 1);
1152 } 1180 }
1153 1181
1154 if (value == 0) 1182 if (value == 0) {
1183 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true);
1155 priv->status |= STATUS_RF_KILL_HW; 1184 priv->status |= STATUS_RF_KILL_HW;
1156 else 1185 } else {
1186 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false);
1157 priv->status &= ~STATUS_RF_KILL_HW; 1187 priv->status &= ~STATUS_RF_KILL_HW;
1188 }
1158 1189
1159 return (value == 0); 1190 return (value == 0);
1160} 1191}
@@ -1814,13 +1845,6 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1814 return rc; 1845 return rc;
1815} 1846}
1816 1847
1817/* Called by register_netdev() */
1818static int ipw2100_net_init(struct net_device *dev)
1819{
1820 struct ipw2100_priv *priv = libipw_priv(dev);
1821 return ipw2100_up(priv, 1);
1822}
1823
1824static void ipw2100_down(struct ipw2100_priv *priv) 1848static void ipw2100_down(struct ipw2100_priv *priv)
1825{ 1849{
1826 unsigned long flags; 1850 unsigned long flags;
@@ -1875,6 +1899,64 @@ static void ipw2100_down(struct ipw2100_priv *priv)
1875 netif_stop_queue(priv->net_dev); 1899 netif_stop_queue(priv->net_dev);
1876} 1900}
1877 1901
1902/* Called by register_netdev() */
1903static int ipw2100_net_init(struct net_device *dev)
1904{
1905 struct ipw2100_priv *priv = libipw_priv(dev);
1906 const struct libipw_geo *geo = libipw_get_geo(priv->ieee);
1907 struct wireless_dev *wdev = &priv->ieee->wdev;
1908 int ret;
1909 int i;
1910
1911 ret = ipw2100_up(priv, 1);
1912 if (ret)
1913 return ret;
1914
1915 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN);
1916
1917 /* fill-out priv->ieee->bg_band */
1918 if (geo->bg_channels) {
1919 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band;
1920
1921 bg_band->band = IEEE80211_BAND_2GHZ;
1922 bg_band->n_channels = geo->bg_channels;
1923 bg_band->channels =
1924 kzalloc(geo->bg_channels *
1925 sizeof(struct ieee80211_channel), GFP_KERNEL);
1926 /* translate geo->bg to bg_band.channels */
1927 for (i = 0; i < geo->bg_channels; i++) {
1928 bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
1929 bg_band->channels[i].center_freq = geo->bg[i].freq;
1930 bg_band->channels[i].hw_value = geo->bg[i].channel;
1931 bg_band->channels[i].max_power = geo->bg[i].max_power;
1932 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY)
1933 bg_band->channels[i].flags |=
1934 IEEE80211_CHAN_PASSIVE_SCAN;
1935 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS)
1936 bg_band->channels[i].flags |=
1937 IEEE80211_CHAN_NO_IBSS;
1938 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT)
1939 bg_band->channels[i].flags |=
1940 IEEE80211_CHAN_RADAR;
1941 /* No equivalent for LIBIPW_CH_80211H_RULES,
1942 LIBIPW_CH_UNIFORM_SPREADING, or
1943 LIBIPW_CH_B_ONLY... */
1944 }
1945 /* point at bitrate info */
1946 bg_band->bitrates = ipw2100_bg_rates;
1947 bg_band->n_bitrates = RATE_COUNT;
1948
1949 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
1950 }
1951
1952 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
1953 if (wiphy_register(wdev->wiphy)) {
1954 ipw2100_down(priv);
1955 return -EIO;
1956 }
1957 return 0;
1958}
1959
1878static void ipw2100_reset_adapter(struct work_struct *work) 1960static void ipw2100_reset_adapter(struct work_struct *work)
1879{ 1961{
1880 struct ipw2100_priv *priv = 1962 struct ipw2100_priv *priv =
@@ -2090,6 +2172,7 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
2090 priv->net_dev->name); 2172 priv->net_dev->name);
2091 2173
2092 /* RF_KILL is now enabled (else we wouldn't be here) */ 2174 /* RF_KILL is now enabled (else we wouldn't be here) */
2175 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true);
2093 priv->status |= STATUS_RF_KILL_HW; 2176 priv->status |= STATUS_RF_KILL_HW;
2094 2177
2095 /* Make sure the RF Kill check timer is running */ 2178 /* Make sure the RF Kill check timer is running */
@@ -6400,6 +6483,9 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6400 if (dev->base_addr) 6483 if (dev->base_addr)
6401 iounmap((void __iomem *)dev->base_addr); 6484 iounmap((void __iomem *)dev->base_addr);
6402 6485
6486 /* wiphy_unregister needs to be here, before free_ieee80211 */
6487 wiphy_unregister(priv->ieee->wdev.wiphy);
6488 kfree(priv->ieee->bg_band.channels);
6403 free_ieee80211(dev, 0); 6489 free_ieee80211(dev, 0);
6404 } 6490 }
6405 6491
@@ -6601,26 +6687,6 @@ static void __exit ipw2100_exit(void)
6601module_init(ipw2100_init); 6687module_init(ipw2100_init);
6602module_exit(ipw2100_exit); 6688module_exit(ipw2100_exit);
6603 6689
6604#define WEXT_USECHANNELS 1
6605
6606static const long ipw2100_frequencies[] = {
6607 2412, 2417, 2422, 2427,
6608 2432, 2437, 2442, 2447,
6609 2452, 2457, 2462, 2467,
6610 2472, 2484
6611};
6612
6613#define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies)
6614
6615static const long ipw2100_rates_11b[] = {
6616 1000000,
6617 2000000,
6618 5500000,
6619 11000000
6620};
6621
6622#define RATE_COUNT ARRAY_SIZE(ipw2100_rates_11b)
6623
6624static int ipw2100_wx_get_name(struct net_device *dev, 6690static int ipw2100_wx_get_name(struct net_device *dev,
6625 struct iw_request_info *info, 6691 struct iw_request_info *info,
6626 union iwreq_data *wrqu, char *extra) 6692 union iwreq_data *wrqu, char *extra)