Commit 2ecc26b8 authored by Jeff Garzik's avatar Jeff Garzik

Merge branch 'atmel'

parents 6af37fa9 b16a228d
...@@ -330,7 +330,7 @@ config PCI_HERMES ...@@ -330,7 +330,7 @@ config PCI_HERMES
config ATMEL config ATMEL
tristate "Atmel at76c50x chipset 802.11b support" tristate "Atmel at76c50x chipset 802.11b support"
depends on NET_RADIO && EXPERIMENTAL depends on NET_RADIO
select FW_LOADER select FW_LOADER
select CRC32 select CRC32
---help--- ---help---
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#include "atmel.h" #include "atmel.h"
#define DRIVER_MAJOR 0 #define DRIVER_MAJOR 0
#define DRIVER_MINOR 96 #define DRIVER_MINOR 98
MODULE_AUTHOR("Simon Kelley"); MODULE_AUTHOR("Simon Kelley");
MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); MODULE_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,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off,
return len; return len;
} }
struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type,
struct device *sys_dev, int (*card_present)(void *), void *card) struct device *sys_dev, int (*card_present)(void *), void *card)
{ {
struct net_device *dev; struct net_device *dev;
...@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT ...@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
goto err_out_free; goto err_out_free;
} }
if (priv->bus_type == BUS_TYPE_PCI && if (!request_region(dev->base_addr, 32,
!request_region( dev->base_addr, 64, dev->name )) { priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) {
goto err_out_irq; goto err_out_irq;
} }
...@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT ...@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv);
printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
dev->name, DRIVER_MAJOR, DRIVER_MINOR); dev->name, DRIVER_MAJOR, DRIVER_MINOR,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
return dev; return dev;
err_out_res: err_out_res:
if (priv->bus_type == BUS_TYPE_PCI) release_region( dev->base_addr, 32);
release_region( dev->base_addr, 64 );
err_out_irq: err_out_irq:
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
err_out_free: err_out_free:
...@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT ...@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
EXPORT_SYMBOL(init_atmel_card); EXPORT_SYMBOL(init_atmel_card);
void stop_atmel_card(struct net_device *dev, int freeres) void stop_atmel_card(struct net_device *dev)
{ {
struct atmel_private *priv = netdev_priv(dev); struct atmel_private *priv = netdev_priv(dev);
...@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) ...@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres)
remove_proc_entry("driver/atmel", NULL); remove_proc_entry("driver/atmel", NULL);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
kfree(priv->firmware); kfree(priv->firmware);
if (freeres) { release_region(dev->base_addr, 32);
/* PCMCIA frees this stuff, so only for PCI */
release_region(dev->base_addr, 64);
}
free_netdev(dev); free_netdev(dev);
} }
...@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev, ...@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev,
if (!priv->wep_is_on) if (!priv->wep_is_on)
dwrq->flags = IW_ENCODE_DISABLED; dwrq->flags = IW_ENCODE_DISABLED;
else if (priv->exclude_unencrypted) else {
if (priv->exclude_unencrypted)
dwrq->flags = IW_ENCODE_RESTRICTED; dwrq->flags = IW_ENCODE_RESTRICTED;
else else
dwrq->flags = IW_ENCODE_OPEN; dwrq->flags = IW_ENCODE_OPEN;
}
/* Which key do we want ? -1 -> tx index */ /* Which key do we want ? -1 -> tx index */
if (index < 0 || index >= 4) if (index < 0 || index >= 4)
index = priv->default_key; index = priv->default_key;
...@@ -2646,7 +2645,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c ...@@ -2646,7 +2645,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c
} }
static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len)
{ {
struct ieee80211_hdr_4addr header; struct ieee80211_hdr_4addr header;
struct auth_body auth; struct auth_body auth;
...@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng ...@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng
memcpy(header.addr2, priv->dev->dev_addr, 6); memcpy(header.addr2, priv->dev->dev_addr, 6);
memcpy(header.addr3, priv->CurrentBSSID, 6); memcpy(header.addr3, priv->CurrentBSSID, 6);
if (priv->wep_is_on) { if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1)
auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY);
/* no WEP for authentication frames with TrSeqNo 1 */ /* no WEP for authentication frames with TrSeqNo 1 */
if (priv->CurrentAuthentTransactionSeqNum != 1)
header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
} else {
auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); auth.alg = cpu_to_le16(system);
}
auth.status = 0; auth.status = 0;
auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum);
...@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
struct auth_body *auth = (struct auth_body *)priv->rx_buf; struct auth_body *auth = (struct auth_body *)priv->rx_buf;
u16 status = le16_to_cpu(auth->status); u16 status = le16_to_cpu(auth->status);
u16 trans_seq_no = le16_to_cpu(auth->trans_seq); u16 trans_seq_no = le16_to_cpu(auth->trans_seq);
u16 system = le16_to_cpu(auth->alg);
if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) {
/* no WEP */ /* no WEP */
...@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
if (trans_seq_no == 0x0002 && if (trans_seq_no == 0x0002 &&
auth->el_id == C80211_MGMT_ElementID_ChallengeText) { auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
send_authentication_request(priv, auth->chall_text, auth->chall_text_len); send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
return; return;
} }
...@@ -2872,7 +2869,12 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -2872,7 +2869,12 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
} }
} }
if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { if (status == C80211_MGMT_SC_AuthAlgNotSupported) {
/* Do opensystem first, then try sharedkey */
if (system == C80211_MGMT_AAN_OPENSYSTEM) {
priv->CurrentAuthentTransactionSeqNum = 0x001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
} else if (priv->connect_to_any_BSS) {
int bss_index; int bss_index;
priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80;
...@@ -2882,6 +2884,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -2882,6 +2884,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
return; return;
} }
} }
}
priv->AuthenticationRequestRetryCnt = 0; priv->AuthenticationRequestRetryCnt = 0;
...@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a) ...@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a)
priv->AuthenticationRequestRetryCnt++; priv->AuthenticationRequestRetryCnt++;
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_authentication_request(priv, NULL, 0); send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0);
} }
break; break;
...@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv) ...@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv)
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
send_authentication_request(priv, NULL, 0); send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
} }
return; return;
} }
...@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev) ...@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev)
printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
memcpy(dev->dev_addr, default_mac, 6); memcpy(dev->dev_addr, default_mac, 6);
} }
printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
dev->name,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );
} }
return rc; return rc;
......
...@@ -35,9 +35,9 @@ typedef enum { ...@@ -35,9 +35,9 @@ typedef enum {
ATMEL_FW_TYPE_506 ATMEL_FW_TYPE_506
} AtmelFWType; } AtmelFWType;
struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *,
int (*present_func)(void *), void * ); int (*present_func)(void *), void * );
void stop_atmel_card( struct net_device *, int ); void stop_atmel_card( struct net_device *);
int atmel_open( struct net_device * ); int atmel_open( struct net_device * );
#endif #endif
This diff is collapsed.
...@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev, ...@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev,
static void __devexit atmel_pci_remove(struct pci_dev *pdev) static void __devexit atmel_pci_remove(struct pci_dev *pdev)
{ {
stop_atmel_card(pci_get_drvdata(pdev), 1); stop_atmel_card(pci_get_drvdata(pdev));
} }
static int __init atmel_init_module(void) static int __init atmel_init_module(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment