aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-11 08:14:56 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-11 08:14:56 -0500
commit2ecc26b87a2b3e8650d3c7fe3fc85a8c73d5560d (patch)
tree0453e556241830d675d2063b74ac3b769326b379 /drivers/net/wireless/atmel.c
parent6af37fa9928a0d50cda1bad14b2eda8c1a4d1a0e (diff)
parentb16a228d05a95b27d77d07a91688382f68ece8a7 (diff)
Merge branch 'atmel'
Diffstat (limited to 'drivers/net/wireless/atmel.c')
-rw-r--r--drivers/net/wireless/atmel.c88
1 files changed, 43 insertions, 45 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index a3e23527fe7f..5e53c5258a33 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -72,7 +72,7 @@
72#include "atmel.h" 72#include "atmel.h"
73 73
74#define DRIVER_MAJOR 0 74#define DRIVER_MAJOR 0
75#define DRIVER_MINOR 96 75#define DRIVER_MINOR 98
76 76
77MODULE_AUTHOR("Simon Kelley"); 77MODULE_AUTHOR("Simon Kelley");
78MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); 78MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
@@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off,
1504 return len; 1504 return len;
1505} 1505}
1506 1506
1507struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, 1507struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type,
1508 struct device *sys_dev, int (*card_present)(void *), void *card) 1508 struct device *sys_dev, int (*card_present)(void *), void *card)
1509{ 1509{
1510 struct net_device *dev; 1510 struct net_device *dev;
@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
1605 goto err_out_free; 1605 goto err_out_free;
1606 } 1606 }
1607 1607
1608 if (priv->bus_type == BUS_TYPE_PCI && 1608 if (!request_region(dev->base_addr, 32,
1609 !request_region( dev->base_addr, 64, dev->name )) { 1609 priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) {
1610 goto err_out_irq; 1610 goto err_out_irq;
1611 } 1611 }
1612 1612
@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
1622 1622
1623 create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); 1623 create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv);
1624 1624
1625 printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", 1625 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
1626 dev->name, DRIVER_MAJOR, DRIVER_MINOR); 1626 dev->name, DRIVER_MAJOR, DRIVER_MINOR,
1627 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
1628 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );
1627 1629
1628 SET_MODULE_OWNER(dev); 1630 SET_MODULE_OWNER(dev);
1629 return dev; 1631 return dev;
1630 1632
1631 err_out_res: 1633 err_out_res:
1632 if (priv->bus_type == BUS_TYPE_PCI) 1634 release_region( dev->base_addr, 32);
1633 release_region( dev->base_addr, 64 );
1634 err_out_irq: 1635 err_out_irq:
1635 free_irq(dev->irq, dev); 1636 free_irq(dev->irq, dev);
1636 err_out_free: 1637 err_out_free:
@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
1640 1641
1641EXPORT_SYMBOL(init_atmel_card); 1642EXPORT_SYMBOL(init_atmel_card);
1642 1643
1643void stop_atmel_card(struct net_device *dev, int freeres) 1644void stop_atmel_card(struct net_device *dev)
1644{ 1645{
1645 struct atmel_private *priv = netdev_priv(dev); 1646 struct atmel_private *priv = netdev_priv(dev);
1646 1647
@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres)
1654 remove_proc_entry("driver/atmel", NULL); 1655 remove_proc_entry("driver/atmel", NULL);
1655 free_irq(dev->irq, dev); 1656 free_irq(dev->irq, dev);
1656 kfree(priv->firmware); 1657 kfree(priv->firmware);
1657 if (freeres) { 1658 release_region(dev->base_addr, 32);
1658 /* PCMCIA frees this stuff, so only for PCI */
1659 release_region(dev->base_addr, 64);
1660 }
1661 free_netdev(dev); 1659 free_netdev(dev);
1662} 1660}
1663 1661
@@ -1810,9 +1808,9 @@ static int atmel_set_encode(struct net_device *dev,
1810 } 1808 }
1811 if(dwrq->flags & IW_ENCODE_RESTRICTED) 1809 if(dwrq->flags & IW_ENCODE_RESTRICTED)
1812 priv->exclude_unencrypted = 1; 1810 priv->exclude_unencrypted = 1;
1813 if(dwrq->flags & IW_ENCODE_OPEN) 1811 if(dwrq->flags & IW_ENCODE_OPEN)
1814 priv->exclude_unencrypted = 0; 1812 priv->exclude_unencrypted = 0;
1815 1813
1816 return -EINPROGRESS; /* Call commit handler */ 1814 return -EINPROGRESS; /* Call commit handler */
1817} 1815}
1818 1816
@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev,
1827 1825
1828 if (!priv->wep_is_on) 1826 if (!priv->wep_is_on)
1829 dwrq->flags = IW_ENCODE_DISABLED; 1827 dwrq->flags = IW_ENCODE_DISABLED;
1830 else if (priv->exclude_unencrypted) 1828 else {
1831 dwrq->flags = IW_ENCODE_RESTRICTED; 1829 if (priv->exclude_unencrypted)
1832 else 1830 dwrq->flags = IW_ENCODE_RESTRICTED;
1833 dwrq->flags = IW_ENCODE_OPEN; 1831 else
1834 1832 dwrq->flags = IW_ENCODE_OPEN;
1833 }
1835 /* Which key do we want ? -1 -> tx index */ 1834 /* Which key do we want ? -1 -> tx index */
1836 if (index < 0 || index >= 4) 1835 if (index < 0 || index >= 4)
1837 index = priv->default_key; 1836 index = priv->default_key;
@@ -2645,8 +2644,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c
2645 } 2644 }
2646} 2645}
2647 2646
2648 2647
2649static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) 2648static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len)
2650{ 2649{
2651 struct ieee80211_hdr_4addr header; 2650 struct ieee80211_hdr_4addr header;
2652 struct auth_body auth; 2651 struct auth_body auth;
@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng
2658 memcpy(header.addr2, priv->dev->dev_addr, 6); 2657 memcpy(header.addr2, priv->dev->dev_addr, 6);
2659 memcpy(header.addr3, priv->CurrentBSSID, 6); 2658 memcpy(header.addr3, priv->CurrentBSSID, 6);
2660 2659
2661 if (priv->wep_is_on) { 2660 if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1)
2662 auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY);
2663 /* no WEP for authentication frames with TrSeqNo 1 */ 2661 /* no WEP for authentication frames with TrSeqNo 1 */
2664 if (priv->CurrentAuthentTransactionSeqNum != 1) 2662 header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
2665 header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); 2663
2666 } else { 2664 auth.alg = cpu_to_le16(system);
2667 auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM);
2668 }
2669 2665
2670 auth.status = 0; 2666 auth.status = 0;
2671 auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); 2667 auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum);
@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
2834 struct auth_body *auth = (struct auth_body *)priv->rx_buf; 2830 struct auth_body *auth = (struct auth_body *)priv->rx_buf;
2835 u16 status = le16_to_cpu(auth->status); 2831 u16 status = le16_to_cpu(auth->status);
2836 u16 trans_seq_no = le16_to_cpu(auth->trans_seq); 2832 u16 trans_seq_no = le16_to_cpu(auth->trans_seq);
2833 u16 system = le16_to_cpu(auth->alg);
2837 2834
2838 if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { 2835 if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) {
2839 /* no WEP */ 2836 /* no WEP */
@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
2855 2852
2856 if (trans_seq_no == 0x0002 && 2853 if (trans_seq_no == 0x0002 &&
2857 auth->el_id == C80211_MGMT_ElementID_ChallengeText) { 2854 auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
2858 send_authentication_request(priv, auth->chall_text, auth->chall_text_len); 2855 send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
2859 return; 2856 return;
2860 } 2857 }
2861 2858
@@ -2872,14 +2869,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
2872 } 2869 }
2873 } 2870 }
2874 2871
2875 if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { 2872 if (status == C80211_MGMT_SC_AuthAlgNotSupported) {
2876 int bss_index; 2873 /* Do opensystem first, then try sharedkey */
2877 2874 if (system == C80211_MGMT_AAN_OPENSYSTEM) {
2878 priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; 2875 priv->CurrentAuthentTransactionSeqNum = 0x001;
2879 2876 send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
2880 if ((bss_index = retrieve_bss(priv)) != -1) { 2877 } else if (priv->connect_to_any_BSS) {
2881 atmel_join_bss(priv, bss_index); 2878 int bss_index;
2882 return; 2879
2880 priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80;
2881
2882 if ((bss_index = retrieve_bss(priv)) != -1) {
2883 atmel_join_bss(priv, bss_index);
2884 return;
2885 }
2883 } 2886 }
2884 } 2887 }
2885 2888
@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a)
3205 priv->AuthenticationRequestRetryCnt++; 3208 priv->AuthenticationRequestRetryCnt++;
3206 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3209 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3207 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3210 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3208 send_authentication_request(priv, NULL, 0); 3211 send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0);
3209 } 3212 }
3210 3213
3211 break; 3214 break;
@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv)
3312 3315
3313 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3316 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3314 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3317 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3315 send_authentication_request(priv, NULL, 0); 3318 send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
3316 } 3319 }
3317 return; 3320 return;
3318 } 3321 }
@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev)
3482 printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); 3485 printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
3483 memcpy(dev->dev_addr, default_mac, 6); 3486 memcpy(dev->dev_addr, default_mac, 6);
3484 } 3487 }
3485 printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
3486 dev->name,
3487 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
3488 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );
3489
3490 } 3488 }
3491 3489
3492 return rc; 3490 return rc;