diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-11 08:14:56 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-11 08:14:56 -0500 |
commit | 2ecc26b87a2b3e8650d3c7fe3fc85a8c73d5560d (patch) | |
tree | 0453e556241830d675d2063b74ac3b769326b379 /drivers/net | |
parent | 6af37fa9928a0d50cda1bad14b2eda8c1a4d1a0e (diff) | |
parent | b16a228d05a95b27d77d07a91688382f68ece8a7 (diff) |
Merge branch 'atmel'
Diffstat (limited to 'drivers/net')
-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 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 | ||
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 | ||
@@ -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 | ||
2649 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2648 | static 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; |
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 1bd13146c644..17d1fd90f832 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); |
@@ -285,41 +286,6 @@ static int card_present(void *arg) | |||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
287 | 288 | ||
288 | /* list of cards we know about and their firmware requirements. | ||
289 | Go either by Manfid or version strings. | ||
290 | Cards not in this list will need a firmware parameter to the module | ||
291 | in all probability. Note that the SMC 2632 V2 and V3 have the same | ||
292 | manfids, so we ignore those and use the version1 strings. */ | ||
293 | |||
294 | static struct { | ||
295 | int manf, card; | ||
296 | char *ver1; | ||
297 | AtmelFWType firmware; | ||
298 | char *name; | ||
299 | } card_table[] = { | ||
300 | { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" }, | ||
301 | { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, | ||
302 | { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, | ||
303 | { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" }, | ||
304 | { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" }, | ||
305 | { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" }, | ||
306 | { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" }, | ||
307 | { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, | ||
308 | { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, | ||
309 | { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" }, | ||
310 | { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" }, | ||
311 | { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, | ||
312 | { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, | ||
313 | { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" }, | ||
314 | { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" }, | ||
315 | { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" }, | ||
316 | { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" }, | ||
317 | { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" }, | ||
318 | { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" }, | ||
319 | { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" }, | ||
320 | { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" }, | ||
321 | }; | ||
322 | |||
323 | static void atmel_config(dev_link_t *link) | 289 | static void atmel_config(dev_link_t *link) |
324 | { | 290 | { |
325 | client_handle_t handle; | 291 | client_handle_t handle; |
@@ -328,10 +294,11 @@ static void atmel_config(dev_link_t *link) | |||
328 | local_info_t *dev; | 294 | local_info_t *dev; |
329 | int last_fn, last_ret; | 295 | int last_fn, last_ret; |
330 | u_char buf[64]; | 296 | u_char buf[64]; |
331 | int card_index = -1, done = 0; | 297 | struct pcmcia_device_id *did; |
332 | 298 | ||
333 | handle = link->handle; | 299 | handle = link->handle; |
334 | dev = link->priv; | 300 | dev = link->priv; |
301 | did = handle_to_dev(handle).driver_data; | ||
335 | 302 | ||
336 | DEBUG(0, "atmel_config(0x%p)\n", link); | 303 | DEBUG(0, "atmel_config(0x%p)\n", link); |
337 | 304 | ||
@@ -340,59 +307,6 @@ static void atmel_config(dev_link_t *link) | |||
340 | tuple.TupleDataMax = sizeof(buf); | 307 | tuple.TupleDataMax = sizeof(buf); |
341 | tuple.TupleOffset = 0; | 308 | tuple.TupleOffset = 0; |
342 | 309 | ||
343 | tuple.DesiredTuple = CISTPL_MANFID; | ||
344 | if (pcmcia_get_first_tuple(handle, &tuple) == 0) { | ||
345 | int i; | ||
346 | cistpl_manfid_t *manfid; | ||
347 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
348 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
349 | manfid = &(parse.manfid); | ||
350 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
351 | if (!card_table[i].ver1 && | ||
352 | manfid->manf == card_table[i].manf && | ||
353 | manfid->card == card_table[i].card) { | ||
354 | card_index = i; | ||
355 | done = 1; | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
361 | if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) { | ||
362 | int i, j, k; | ||
363 | cistpl_vers_1_t *ver1; | ||
364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
366 | ver1 = &(parse.version_1); | ||
367 | |||
368 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
369 | for (j = 0; j < ver1->ns; j++) { | ||
370 | char *p = card_table[i].ver1; | ||
371 | char *q = &ver1->str[ver1->ofs[j]]; | ||
372 | if (!p) | ||
373 | goto mismatch; | ||
374 | for (k = 0; k < j; k++) { | ||
375 | while ((*p != '\0') && (*p != '/')) p++; | ||
376 | if (*p == '\0') { | ||
377 | if (*q != '\0') | ||
378 | goto mismatch; | ||
379 | } else { | ||
380 | p++; | ||
381 | } | ||
382 | } | ||
383 | while((*q != '\0') && (*p != '\0') && | ||
384 | (*p != '/') && (*p == *q)) p++, q++; | ||
385 | if (((*p != '\0') && *p != '/') || *q != '\0') | ||
386 | goto mismatch; | ||
387 | } | ||
388 | card_index = i; | ||
389 | break; /* done */ | ||
390 | |||
391 | mismatch: | ||
392 | j = 0; /* dummy stmt to shut up compiler */ | ||
393 | } | ||
394 | } | ||
395 | |||
396 | /* | 310 | /* |
397 | This reads the card's CONFIG tuple to find its configuration | 311 | This reads the card's CONFIG tuple to find its configuration |
398 | registers. | 312 | registers. |
@@ -509,12 +423,13 @@ static void atmel_config(dev_link_t *link) | |||
509 | ((local_info_t*)link->priv)->eth_dev = | 423 | ((local_info_t*)link->priv)->eth_dev = |
510 | init_atmel_card(link->irq.AssignedIRQ, | 424 | init_atmel_card(link->irq.AssignedIRQ, |
511 | link->io.BasePort1, | 425 | link->io.BasePort1, |
512 | card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, | 426 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
513 | &handle_to_dev(handle), | 427 | &handle_to_dev(handle), |
514 | card_present, | 428 | card_present, |
515 | link); | 429 | link); |
516 | if (!((local_info_t*)link->priv)->eth_dev) | 430 | if (!((local_info_t*)link->priv)->eth_dev) |
517 | goto cs_failed; | 431 | goto cs_failed; |
432 | |||
518 | 433 | ||
519 | /* | 434 | /* |
520 | At this point, the dev_node_t structure(s) need to be | 435 | At this point, the dev_node_t structure(s) need to be |
@@ -523,26 +438,7 @@ static void atmel_config(dev_link_t *link) | |||
523 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 438 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
524 | dev->node.major = dev->node.minor = 0; | 439 | dev->node.major = dev->node.minor = 0; |
525 | link->dev = &dev->node; | 440 | link->dev = &dev->node; |
526 | 441 | ||
527 | /* Finally, report what we've done */ | ||
528 | printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d", | ||
529 | dev->node.dev_name, | ||
530 | card_index == -1 ? "" : card_table[card_index].name, | ||
531 | card_index == -1 ? "" : " ", | ||
532 | link->conf.ConfigIndex, | ||
533 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
534 | if (link->conf.Vpp1) | ||
535 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
536 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
537 | printk(", irq %d", link->irq.AssignedIRQ); | ||
538 | if (link->io.NumPorts1) | ||
539 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
540 | link->io.BasePort1+link->io.NumPorts1-1); | ||
541 | if (link->io.NumPorts2) | ||
542 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
543 | link->io.BasePort2+link->io.NumPorts2-1); | ||
544 | printk("\n"); | ||
545 | |||
546 | link->state &= ~DEV_CONFIG_PENDING; | 442 | link->state &= ~DEV_CONFIG_PENDING; |
547 | return; | 443 | return; |
548 | 444 | ||
@@ -569,7 +465,7 @@ static void atmel_release(dev_link_t *link) | |||
569 | link->dev = NULL; | 465 | link->dev = NULL; |
570 | 466 | ||
571 | if (dev) | 467 | if (dev) |
572 | stop_atmel_card(dev, 0); | 468 | stop_atmel_card(dev); |
573 | ((local_info_t*)link->priv)->eth_dev = NULL; | 469 | ((local_info_t*)link->priv)->eth_dev = NULL; |
574 | 470 | ||
575 | /* Don't bother checking to see if these succeed or not */ | 471 | /* Don't bother checking to see if these succeed or not */ |
@@ -637,25 +533,47 @@ static int atmel_event(event_t event, int priority, | |||
637 | } /* atmel_event */ | 533 | } /* atmel_event */ |
638 | 534 | ||
639 | /*====================================================================*/ | 535 | /*====================================================================*/ |
536 | /* We use the driver_info field to store the correct firmware type for a card. */ | ||
537 | |||
538 | #define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ | ||
539 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
540 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
541 | .manf_id = (manf), \ | ||
542 | .card_id = (card), \ | ||
543 | .driver_info = (kernel_ulong_t)(info), } | ||
544 | |||
545 | #define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ | ||
546 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
547 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
548 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
549 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
550 | .driver_info = (kernel_ulong_t)(info), } | ||
551 | |||
640 | static struct pcmcia_device_id atmel_ids[] = { | 552 | static struct pcmcia_device_id atmel_ids[] = { |
641 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), | 553 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), |
642 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), | 554 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), |
643 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), | 555 | PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), |
644 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), | 556 | PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), |
645 | PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), | 557 | PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), |
646 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), | 558 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), |
647 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), | 559 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), |
648 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), | 560 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), |
649 | PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), | 561 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), |
650 | PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), | 562 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), |
651 | PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), | 563 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), |
652 | PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), | 564 | PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), |
653 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), | 565 | PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), |
654 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), | 566 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), |
655 | PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), | 567 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), |
656 | PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), | 568 | PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), |
569 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), | ||
570 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), | ||
571 | PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), | ||
572 | PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), | ||
573 | PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), | ||
657 | PCMCIA_DEVICE_NULL | 574 | PCMCIA_DEVICE_NULL |
658 | }; | 575 | }; |
576 | |||
659 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | 577 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); |
660 | 578 | ||
661 | static struct pcmcia_driver atmel_driver = { | 579 | 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) |