diff options
author | simon@thekelleys.org.uk <simon@thekelleys.org.uk> | 2005-10-30 10:50:15 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-11 08:12:17 -0500 |
commit | b16a228d05a95b27d77d07a91688382f68ece8a7 (patch) | |
tree | a76708ef80110839f6f8cc88da292962548d51f5 | |
parent | 741b2252a5e14d6c60a913c77a6099abe73a854a (diff) |
[PATCH] Atmel wireless update
* Merge PCMCIA card table with new Brodowski PCMCIA id table.
* Add missing entries to PCMCIA id table.
* Other tweaks to conform with Documentation/driver-changes.txt
(types, call request_region, etc)
* Fix size of requested IO region.
* Reduce printk verbosity.
* Remove EXPERIMENTAL
* tweak to association code - don't force shared key authentication
when wep in use.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/net/wireless/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/wireless/atmel.c | 88 | ||||
-rw-r--r-- | drivers/net/wireless/atmel.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 176 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_pci.c | 2 |
5 files changed, 94 insertions, 178 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 7187958e40ca..00e55165b760 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -330,7 +330,7 @@ config PCI_HERMES | |||
330 | 330 | ||
331 | config ATMEL | 331 | config ATMEL |
332 | tristate "Atmel at76c50x chipset 802.11b support" | 332 | tristate "Atmel at76c50x chipset 802.11b support" |
333 | depends on NET_RADIO && EXPERIMENTAL | 333 | depends on NET_RADIO |
334 | select FW_LOADER | 334 | select FW_LOADER |
335 | select CRC32 | 335 | select CRC32 |
336 | ---help--- | 336 | ---help--- |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 587869d86eee..dbc991a5afc9 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 | ||
77 | MODULE_AUTHOR("Simon Kelley"); | 77 | MODULE_AUTHOR("Simon Kelley"); |
78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 78 | 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 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, | 1507 | struct 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 | ||
1641 | EXPORT_SYMBOL(init_atmel_card); | 1642 | EXPORT_SYMBOL(init_atmel_card); |
1642 | 1643 | ||
1643 | void stop_atmel_card(struct net_device *dev, int freeres) | 1644 | void 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 | ||
@@ -1655,10 +1656,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) | |||
1655 | free_irq(dev->irq, dev); | 1656 | free_irq(dev->irq, dev); |
1656 | if (priv->firmware) | 1657 | if (priv->firmware) |
1657 | kfree(priv->firmware); | 1658 | kfree(priv->firmware); |
1658 | if (freeres) { | 1659 | release_region(dev->base_addr, 32); |
1659 | /* PCMCIA frees this stuff, so only for PCI */ | ||
1660 | release_region(dev->base_addr, 64); | ||
1661 | } | ||
1662 | free_netdev(dev); | 1660 | free_netdev(dev); |
1663 | } | 1661 | } |
1664 | 1662 | ||
@@ -1811,9 +1809,9 @@ static int atmel_set_encode(struct net_device *dev, | |||
1811 | } | 1809 | } |
1812 | if(dwrq->flags & IW_ENCODE_RESTRICTED) | 1810 | if(dwrq->flags & IW_ENCODE_RESTRICTED) |
1813 | priv->exclude_unencrypted = 1; | 1811 | priv->exclude_unencrypted = 1; |
1814 | if(dwrq->flags & IW_ENCODE_OPEN) | 1812 | if(dwrq->flags & IW_ENCODE_OPEN) |
1815 | priv->exclude_unencrypted = 0; | 1813 | priv->exclude_unencrypted = 0; |
1816 | 1814 | ||
1817 | return -EINPROGRESS; /* Call commit handler */ | 1815 | return -EINPROGRESS; /* Call commit handler */ |
1818 | } | 1816 | } |
1819 | 1817 | ||
@@ -1828,11 +1826,12 @@ static int atmel_get_encode(struct net_device *dev, | |||
1828 | 1826 | ||
1829 | if (!priv->wep_is_on) | 1827 | if (!priv->wep_is_on) |
1830 | dwrq->flags = IW_ENCODE_DISABLED; | 1828 | dwrq->flags = IW_ENCODE_DISABLED; |
1831 | else if (priv->exclude_unencrypted) | 1829 | else { |
1832 | dwrq->flags = IW_ENCODE_RESTRICTED; | 1830 | if (priv->exclude_unencrypted) |
1833 | else | 1831 | dwrq->flags = IW_ENCODE_RESTRICTED; |
1834 | dwrq->flags = IW_ENCODE_OPEN; | 1832 | else |
1835 | 1833 | dwrq->flags = IW_ENCODE_OPEN; | |
1834 | } | ||
1836 | /* Which key do we want ? -1 -> tx index */ | 1835 | /* Which key do we want ? -1 -> tx index */ |
1837 | if (index < 0 || index >= 4) | 1836 | if (index < 0 || index >= 4) |
1838 | index = priv->default_key; | 1837 | index = priv->default_key; |
@@ -2647,8 +2646,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2647 | } | 2646 | } |
2648 | } | 2647 | } |
2649 | 2648 | ||
2650 | 2649 | ||
2651 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2650 | static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len) |
2652 | { | 2651 | { |
2653 | struct ieee80211_hdr header; | 2652 | struct ieee80211_hdr header; |
2654 | struct auth_body auth; | 2653 | struct auth_body auth; |
@@ -2660,14 +2659,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng | |||
2660 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2659 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
2661 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2660 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
2662 | 2661 | ||
2663 | if (priv->wep_is_on) { | 2662 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2664 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); | ||
2665 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2663 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2666 | if (priv->CurrentAuthentTransactionSeqNum != 1) | 2664 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2667 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2665 | |
2668 | } else { | 2666 | auth.alg = cpu_to_le16(system); |
2669 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); | ||
2670 | } | ||
2671 | 2667 | ||
2672 | auth.status = 0; | 2668 | auth.status = 0; |
2673 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); | 2669 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); |
@@ -2836,6 +2832,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2836 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; | 2832 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; |
2837 | u16 status = le16_to_cpu(auth->status); | 2833 | u16 status = le16_to_cpu(auth->status); |
2838 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 2834 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
2835 | u16 system = le16_to_cpu(auth->alg); | ||
2839 | 2836 | ||
2840 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 2837 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { |
2841 | /* no WEP */ | 2838 | /* no WEP */ |
@@ -2857,7 +2854,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2857 | 2854 | ||
2858 | if (trans_seq_no == 0x0002 && | 2855 | if (trans_seq_no == 0x0002 && |
2859 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 2856 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { |
2860 | send_authentication_request(priv, auth->chall_text, auth->chall_text_len); | 2857 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
2861 | return; | 2858 | return; |
2862 | } | 2859 | } |
2863 | 2860 | ||
@@ -2874,14 +2871,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2874 | } | 2871 | } |
2875 | } | 2872 | } |
2876 | 2873 | ||
2877 | if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { | 2874 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { |
2878 | int bss_index; | 2875 | /* Do opensystem first, then try sharedkey */ |
2879 | 2876 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | |
2880 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | 2877 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
2881 | 2878 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | |
2882 | if ((bss_index = retrieve_bss(priv)) != -1) { | 2879 | } else if (priv->connect_to_any_BSS) { |
2883 | atmel_join_bss(priv, bss_index); | 2880 | int bss_index; |
2884 | return; | 2881 | |
2882 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | ||
2883 | |||
2884 | if ((bss_index = retrieve_bss(priv)) != -1) { | ||
2885 | atmel_join_bss(priv, bss_index); | ||
2886 | return; | ||
2887 | } | ||
2885 | } | 2888 | } |
2886 | } | 2889 | } |
2887 | 2890 | ||
@@ -3207,7 +3210,7 @@ static void atmel_management_timer(u_long a) | |||
3207 | priv->AuthenticationRequestRetryCnt++; | 3210 | priv->AuthenticationRequestRetryCnt++; |
3208 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3211 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3209 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3212 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3210 | send_authentication_request(priv, NULL, 0); | 3213 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); |
3211 | } | 3214 | } |
3212 | 3215 | ||
3213 | break; | 3216 | break; |
@@ -3314,7 +3317,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3314 | 3317 | ||
3315 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3318 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3316 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3319 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3317 | send_authentication_request(priv, NULL, 0); | 3320 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); |
3318 | } | 3321 | } |
3319 | return; | 3322 | return; |
3320 | } | 3323 | } |
@@ -3484,11 +3487,6 @@ static int probe_atmel_card(struct net_device *dev) | |||
3484 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3487 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3485 | memcpy(dev->dev_addr, default_mac, 6); | 3488 | memcpy(dev->dev_addr, default_mac, 6); |
3486 | } | 3489 | } |
3487 | printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | ||
3488 | dev->name, | ||
3489 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
3490 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
3491 | |||
3492 | } | 3490 | } |
3493 | 3491 | ||
3494 | return rc; | 3492 | return rc; |
diff --git a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h index 825000edfc2c..b9b3e5b76544 100644 --- a/drivers/net/wireless/atmel.h +++ b/drivers/net/wireless/atmel.h | |||
@@ -35,9 +35,9 @@ typedef enum { | |||
35 | ATMEL_FW_TYPE_506 | 35 | ATMEL_FW_TYPE_506 |
36 | } AtmelFWType; | 36 | } AtmelFWType; |
37 | 37 | ||
38 | struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, | 38 | struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *, |
39 | int (*present_func)(void *), void * ); | 39 | int (*present_func)(void *), void * ); |
40 | void stop_atmel_card( struct net_device *, int ); | 40 | void stop_atmel_card( struct net_device *); |
41 | int atmel_open( struct net_device * ); | 41 | int atmel_open( struct net_device * ); |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index ff031a3985b3..0c3301ef70cc 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -63,6 +63,7 @@ | |||
63 | be present but disabled -- but it can then be enabled for specific | 63 | be present but disabled -- but it can then be enabled for specific |
64 | modules at load time with a 'pc_debug=#' option to insmod. | 64 | modules at load time with a 'pc_debug=#' option to insmod. |
65 | */ | 65 | */ |
66 | |||
66 | #ifdef PCMCIA_DEBUG | 67 | #ifdef PCMCIA_DEBUG |
67 | static int pc_debug = PCMCIA_DEBUG; | 68 | static int pc_debug = PCMCIA_DEBUG; |
68 | module_param(pc_debug, int, 0); | 69 | module_param(pc_debug, int, 0); |
@@ -288,41 +289,6 @@ static int card_present(void *arg) | |||
288 | return 0; | 289 | return 0; |
289 | } | 290 | } |
290 | 291 | ||
291 | /* list of cards we know about and their firmware requirements. | ||
292 | Go either by Manfid or version strings. | ||
293 | Cards not in this list will need a firmware parameter to the module | ||
294 | in all probability. Note that the SMC 2632 V2 and V3 have the same | ||
295 | manfids, so we ignore those and use the version1 strings. */ | ||
296 | |||
297 | static struct { | ||
298 | int manf, card; | ||
299 | char *ver1; | ||
300 | AtmelFWType firmware; | ||
301 | char *name; | ||
302 | } card_table[] = { | ||
303 | { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" }, | ||
304 | { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, | ||
305 | { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, | ||
306 | { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" }, | ||
307 | { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" }, | ||
308 | { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" }, | ||
309 | { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" }, | ||
310 | { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, | ||
311 | { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, | ||
312 | { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" }, | ||
313 | { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" }, | ||
314 | { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, | ||
315 | { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, | ||
316 | { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" }, | ||
317 | { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" }, | ||
318 | { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" }, | ||
319 | { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" }, | ||
320 | { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" }, | ||
321 | { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" }, | ||
322 | { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" }, | ||
323 | { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" }, | ||
324 | }; | ||
325 | |||
326 | static void atmel_config(dev_link_t *link) | 292 | static void atmel_config(dev_link_t *link) |
327 | { | 293 | { |
328 | client_handle_t handle; | 294 | client_handle_t handle; |
@@ -331,10 +297,11 @@ static void atmel_config(dev_link_t *link) | |||
331 | local_info_t *dev; | 297 | local_info_t *dev; |
332 | int last_fn, last_ret; | 298 | int last_fn, last_ret; |
333 | u_char buf[64]; | 299 | u_char buf[64]; |
334 | int card_index = -1, done = 0; | 300 | struct pcmcia_device_id *did; |
335 | 301 | ||
336 | handle = link->handle; | 302 | handle = link->handle; |
337 | dev = link->priv; | 303 | dev = link->priv; |
304 | did = handle_to_dev(handle).driver_data; | ||
338 | 305 | ||
339 | DEBUG(0, "atmel_config(0x%p)\n", link); | 306 | DEBUG(0, "atmel_config(0x%p)\n", link); |
340 | 307 | ||
@@ -343,59 +310,6 @@ static void atmel_config(dev_link_t *link) | |||
343 | tuple.TupleDataMax = sizeof(buf); | 310 | tuple.TupleDataMax = sizeof(buf); |
344 | tuple.TupleOffset = 0; | 311 | tuple.TupleOffset = 0; |
345 | 312 | ||
346 | tuple.DesiredTuple = CISTPL_MANFID; | ||
347 | if (pcmcia_get_first_tuple(handle, &tuple) == 0) { | ||
348 | int i; | ||
349 | cistpl_manfid_t *manfid; | ||
350 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
351 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
352 | manfid = &(parse.manfid); | ||
353 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
354 | if (!card_table[i].ver1 && | ||
355 | manfid->manf == card_table[i].manf && | ||
356 | manfid->card == card_table[i].card) { | ||
357 | card_index = i; | ||
358 | done = 1; | ||
359 | } | ||
360 | } | ||
361 | } | ||
362 | |||
363 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
364 | if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) { | ||
365 | int i, j, k; | ||
366 | cistpl_vers_1_t *ver1; | ||
367 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
368 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
369 | ver1 = &(parse.version_1); | ||
370 | |||
371 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
372 | for (j = 0; j < ver1->ns; j++) { | ||
373 | char *p = card_table[i].ver1; | ||
374 | char *q = &ver1->str[ver1->ofs[j]]; | ||
375 | if (!p) | ||
376 | goto mismatch; | ||
377 | for (k = 0; k < j; k++) { | ||
378 | while ((*p != '\0') && (*p != '/')) p++; | ||
379 | if (*p == '\0') { | ||
380 | if (*q != '\0') | ||
381 | goto mismatch; | ||
382 | } else { | ||
383 | p++; | ||
384 | } | ||
385 | } | ||
386 | while((*q != '\0') && (*p != '\0') && | ||
387 | (*p != '/') && (*p == *q)) p++, q++; | ||
388 | if (((*p != '\0') && *p != '/') || *q != '\0') | ||
389 | goto mismatch; | ||
390 | } | ||
391 | card_index = i; | ||
392 | break; /* done */ | ||
393 | |||
394 | mismatch: | ||
395 | j = 0; /* dummy stmt to shut up compiler */ | ||
396 | } | ||
397 | } | ||
398 | |||
399 | /* | 313 | /* |
400 | This reads the card's CONFIG tuple to find its configuration | 314 | This reads the card's CONFIG tuple to find its configuration |
401 | registers. | 315 | registers. |
@@ -512,12 +426,13 @@ static void atmel_config(dev_link_t *link) | |||
512 | ((local_info_t*)link->priv)->eth_dev = | 426 | ((local_info_t*)link->priv)->eth_dev = |
513 | init_atmel_card(link->irq.AssignedIRQ, | 427 | init_atmel_card(link->irq.AssignedIRQ, |
514 | link->io.BasePort1, | 428 | link->io.BasePort1, |
515 | card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, | 429 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
516 | &handle_to_dev(handle), | 430 | &handle_to_dev(handle), |
517 | card_present, | 431 | card_present, |
518 | link); | 432 | link); |
519 | if (!((local_info_t*)link->priv)->eth_dev) | 433 | if (!((local_info_t*)link->priv)->eth_dev) |
520 | goto cs_failed; | 434 | goto cs_failed; |
435 | |||
521 | 436 | ||
522 | /* | 437 | /* |
523 | At this point, the dev_node_t structure(s) need to be | 438 | At this point, the dev_node_t structure(s) need to be |
@@ -526,26 +441,7 @@ static void atmel_config(dev_link_t *link) | |||
526 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 441 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
527 | dev->node.major = dev->node.minor = 0; | 442 | dev->node.major = dev->node.minor = 0; |
528 | link->dev = &dev->node; | 443 | link->dev = &dev->node; |
529 | 444 | ||
530 | /* Finally, report what we've done */ | ||
531 | printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d", | ||
532 | dev->node.dev_name, | ||
533 | card_index == -1 ? "" : card_table[card_index].name, | ||
534 | card_index == -1 ? "" : " ", | ||
535 | link->conf.ConfigIndex, | ||
536 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
537 | if (link->conf.Vpp1) | ||
538 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
539 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
540 | printk(", irq %d", link->irq.AssignedIRQ); | ||
541 | if (link->io.NumPorts1) | ||
542 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
543 | link->io.BasePort1+link->io.NumPorts1-1); | ||
544 | if (link->io.NumPorts2) | ||
545 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
546 | link->io.BasePort2+link->io.NumPorts2-1); | ||
547 | printk("\n"); | ||
548 | |||
549 | link->state &= ~DEV_CONFIG_PENDING; | 445 | link->state &= ~DEV_CONFIG_PENDING; |
550 | return; | 446 | return; |
551 | 447 | ||
@@ -572,7 +468,7 @@ static void atmel_release(dev_link_t *link) | |||
572 | link->dev = NULL; | 468 | link->dev = NULL; |
573 | 469 | ||
574 | if (dev) | 470 | if (dev) |
575 | stop_atmel_card(dev, 0); | 471 | stop_atmel_card(dev); |
576 | ((local_info_t*)link->priv)->eth_dev = NULL; | 472 | ((local_info_t*)link->priv)->eth_dev = NULL; |
577 | 473 | ||
578 | /* Don't bother checking to see if these succeed or not */ | 474 | /* Don't bother checking to see if these succeed or not */ |
@@ -640,25 +536,47 @@ static int atmel_event(event_t event, int priority, | |||
640 | } /* atmel_event */ | 536 | } /* atmel_event */ |
641 | 537 | ||
642 | /*====================================================================*/ | 538 | /*====================================================================*/ |
539 | /* We use the driver_info field to store the correct firmware type for a card. */ | ||
540 | |||
541 | #define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ | ||
542 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
543 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
544 | .manf_id = (manf), \ | ||
545 | .card_id = (card), \ | ||
546 | .driver_info = (kernel_ulong_t)(info), } | ||
547 | |||
548 | #define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ | ||
549 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
550 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
551 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
552 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
553 | .driver_info = (kernel_ulong_t)(info), } | ||
554 | |||
643 | static struct pcmcia_device_id atmel_ids[] = { | 555 | static struct pcmcia_device_id atmel_ids[] = { |
644 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), | 556 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), |
645 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), | 557 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), |
646 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), | 558 | PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), |
647 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), | 559 | PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), |
648 | PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), | 560 | PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), |
649 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), | 561 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), |
650 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), | 562 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), |
651 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), | 563 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), |
652 | PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), | 564 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), |
653 | PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), | 565 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), |
654 | PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), | 566 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), |
655 | PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), | 567 | PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), |
656 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), | 568 | PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), |
657 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), | 569 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), |
658 | PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), | 570 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), |
659 | PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), | 571 | PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), |
572 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), | ||
573 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), | ||
574 | PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), | ||
575 | PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), | ||
576 | PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), | ||
660 | PCMCIA_DEVICE_NULL | 577 | PCMCIA_DEVICE_NULL |
661 | }; | 578 | }; |
579 | |||
662 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | 580 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); |
663 | 581 | ||
664 | static struct pcmcia_driver atmel_driver = { | 582 | static struct pcmcia_driver atmel_driver = { |
diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index 2eb00a957bbe..a61b3bc6cccf 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c | |||
@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev, | |||
72 | 72 | ||
73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) | 73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) |
74 | { | 74 | { |
75 | stop_atmel_card(pci_get_drvdata(pdev), 1); | 75 | stop_atmel_card(pci_get_drvdata(pdev)); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __init atmel_init_module(void) | 78 | static int __init atmel_init_module(void) |