diff options
Diffstat (limited to 'drivers/net/wireless/wl3501_cs.c')
| -rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 74 |
1 files changed, 27 insertions, 47 deletions
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 891bdab49887..7b9621de239f 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
| @@ -67,23 +67,7 @@ | |||
| 67 | /* For rough constant delay */ | 67 | /* For rough constant delay */ |
| 68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } | 68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } |
| 69 | 69 | ||
| 70 | /* | 70 | |
| 71 | * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not | ||
| 72 | * define PCMCIA_DEBUG at all, all the debug code will be left out. If you | ||
| 73 | * compile with PCMCIA_DEBUG=0, the debug code will be present but disabled -- | ||
| 74 | * but it can then be enabled for specific modules at load time with a | ||
| 75 | * 'pc_debug=#' option to insmod. | ||
| 76 | */ | ||
| 77 | #define PCMCIA_DEBUG 0 | ||
| 78 | #ifdef PCMCIA_DEBUG | ||
| 79 | static int pc_debug = PCMCIA_DEBUG; | ||
| 80 | module_param(pc_debug, int, 0); | ||
| 81 | #define dprintk(n, format, args...) \ | ||
| 82 | { if (pc_debug > (n)) \ | ||
| 83 | printk(KERN_INFO "%s: " format "\n", __func__ , ##args); } | ||
| 84 | #else | ||
| 85 | #define dprintk(n, format, args...) | ||
| 86 | #endif | ||
| 87 | 71 | ||
| 88 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } | 72 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } |
| 89 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } | 73 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } |
| @@ -684,10 +668,10 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
| 684 | int matchflag = 0; | 668 | int matchflag = 0; |
| 685 | struct wl3501_scan_confirm sig; | 669 | struct wl3501_scan_confirm sig; |
| 686 | 670 | ||
| 687 | dprintk(3, "entry"); | 671 | pr_debug("entry"); |
| 688 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 672 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 689 | if (sig.status == WL3501_STATUS_SUCCESS) { | 673 | if (sig.status == WL3501_STATUS_SUCCESS) { |
| 690 | dprintk(3, "success"); | 674 | pr_debug("success"); |
| 691 | if ((this->net_type == IW_MODE_INFRA && | 675 | if ((this->net_type == IW_MODE_INFRA && |
| 692 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || | 676 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || |
| 693 | (this->net_type == IW_MODE_ADHOC && | 677 | (this->net_type == IW_MODE_ADHOC && |
| @@ -722,7 +706,7 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
| 722 | } | 706 | } |
| 723 | } | 707 | } |
| 724 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { | 708 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { |
| 725 | dprintk(3, "timeout"); | 709 | pr_debug("timeout"); |
| 726 | this->join_sta_bss = 0; | 710 | this->join_sta_bss = 0; |
| 727 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) | 711 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) |
| 728 | if (!wl3501_mgmt_join(this, i)) | 712 | if (!wl3501_mgmt_join(this, i)) |
| @@ -879,7 +863,7 @@ static int wl3501_mgmt_auth(struct wl3501_card *this) | |||
| 879 | .timeout = 1000, | 863 | .timeout = 1000, |
| 880 | }; | 864 | }; |
| 881 | 865 | ||
| 882 | dprintk(3, "entry"); | 866 | pr_debug("entry"); |
| 883 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 867 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
| 884 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 868 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
| 885 | } | 869 | } |
| @@ -893,7 +877,7 @@ static int wl3501_mgmt_association(struct wl3501_card *this) | |||
| 893 | .cap_info = this->cap_info, | 877 | .cap_info = this->cap_info, |
| 894 | }; | 878 | }; |
| 895 | 879 | ||
| 896 | dprintk(3, "entry"); | 880 | pr_debug("entry"); |
| 897 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 881 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
| 898 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 882 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
| 899 | } | 883 | } |
| @@ -903,7 +887,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr) | |||
| 903 | struct wl3501_card *this = netdev_priv(dev); | 887 | struct wl3501_card *this = netdev_priv(dev); |
| 904 | struct wl3501_join_confirm sig; | 888 | struct wl3501_join_confirm sig; |
| 905 | 889 | ||
| 906 | dprintk(3, "entry"); | 890 | pr_debug("entry"); |
| 907 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 891 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 908 | if (sig.status == WL3501_STATUS_SUCCESS) { | 892 | if (sig.status == WL3501_STATUS_SUCCESS) { |
| 909 | if (this->net_type == IW_MODE_INFRA) { | 893 | if (this->net_type == IW_MODE_INFRA) { |
| @@ -962,7 +946,7 @@ static inline void wl3501_md_confirm_interrupt(struct net_device *dev, | |||
| 962 | { | 946 | { |
| 963 | struct wl3501_md_confirm sig; | 947 | struct wl3501_md_confirm sig; |
| 964 | 948 | ||
| 965 | dprintk(3, "entry"); | 949 | pr_debug("entry"); |
| 966 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 950 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 967 | wl3501_free_tx_buffer(this, sig.data); | 951 | wl3501_free_tx_buffer(this, sig.data); |
| 968 | if (netif_queue_stopped(dev)) | 952 | if (netif_queue_stopped(dev)) |
| @@ -1017,7 +1001,7 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, | |||
| 1017 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, | 1001 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, |
| 1018 | u16 addr, void *sig, int size) | 1002 | u16 addr, void *sig, int size) |
| 1019 | { | 1003 | { |
| 1020 | dprintk(3, "entry"); | 1004 | pr_debug("entry"); |
| 1021 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, | 1005 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, |
| 1022 | sizeof(this->sig_get_confirm)); | 1006 | sizeof(this->sig_get_confirm)); |
| 1023 | wake_up(&this->wait); | 1007 | wake_up(&this->wait); |
| @@ -1029,7 +1013,7 @@ static inline void wl3501_start_confirm_interrupt(struct net_device *dev, | |||
| 1029 | { | 1013 | { |
| 1030 | struct wl3501_start_confirm sig; | 1014 | struct wl3501_start_confirm sig; |
| 1031 | 1015 | ||
| 1032 | dprintk(3, "entry"); | 1016 | pr_debug("entry"); |
| 1033 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1017 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1034 | if (sig.status == WL3501_STATUS_SUCCESS) | 1018 | if (sig.status == WL3501_STATUS_SUCCESS) |
| 1035 | netif_wake_queue(dev); | 1019 | netif_wake_queue(dev); |
| @@ -1041,7 +1025,7 @@ static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev, | |||
| 1041 | struct wl3501_card *this = netdev_priv(dev); | 1025 | struct wl3501_card *this = netdev_priv(dev); |
| 1042 | struct wl3501_assoc_confirm sig; | 1026 | struct wl3501_assoc_confirm sig; |
| 1043 | 1027 | ||
| 1044 | dprintk(3, "entry"); | 1028 | pr_debug("entry"); |
| 1045 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1029 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1046 | 1030 | ||
| 1047 | if (sig.status == WL3501_STATUS_SUCCESS) | 1031 | if (sig.status == WL3501_STATUS_SUCCESS) |
| @@ -1053,7 +1037,7 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, | |||
| 1053 | { | 1037 | { |
| 1054 | struct wl3501_auth_confirm sig; | 1038 | struct wl3501_auth_confirm sig; |
| 1055 | 1039 | ||
| 1056 | dprintk(3, "entry"); | 1040 | pr_debug("entry"); |
| 1057 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1041 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1058 | 1042 | ||
| 1059 | if (sig.status == WL3501_STATUS_SUCCESS) | 1043 | if (sig.status == WL3501_STATUS_SUCCESS) |
| @@ -1069,7 +1053,7 @@ static inline void wl3501_rx_interrupt(struct net_device *dev) | |||
| 1069 | u8 sig_id; | 1053 | u8 sig_id; |
| 1070 | struct wl3501_card *this = netdev_priv(dev); | 1054 | struct wl3501_card *this = netdev_priv(dev); |
| 1071 | 1055 | ||
| 1072 | dprintk(3, "entry"); | 1056 | pr_debug("entry"); |
| 1073 | loop: | 1057 | loop: |
| 1074 | morepkts = 0; | 1058 | morepkts = 0; |
| 1075 | if (!wl3501_esbq_confirm(this)) | 1059 | if (!wl3501_esbq_confirm(this)) |
| @@ -1302,7 +1286,7 @@ static int wl3501_reset(struct net_device *dev) | |||
| 1302 | wl3501_ack_interrupt(this); | 1286 | wl3501_ack_interrupt(this); |
| 1303 | wl3501_unblock_interrupt(this); | 1287 | wl3501_unblock_interrupt(this); |
| 1304 | wl3501_mgmt_scan(this, 100); | 1288 | wl3501_mgmt_scan(this, 100); |
| 1305 | dprintk(1, "%s: device reset", dev->name); | 1289 | pr_debug("%s: device reset", dev->name); |
| 1306 | rc = 0; | 1290 | rc = 0; |
| 1307 | out: | 1291 | out: |
| 1308 | return rc; | 1292 | return rc; |
| @@ -1376,7 +1360,7 @@ static int wl3501_open(struct net_device *dev) | |||
| 1376 | link->open++; | 1360 | link->open++; |
| 1377 | 1361 | ||
| 1378 | /* Initial WL3501 firmware */ | 1362 | /* Initial WL3501 firmware */ |
| 1379 | dprintk(1, "%s: Initialize WL3501 firmware...", dev->name); | 1363 | pr_debug("%s: Initialize WL3501 firmware...", dev->name); |
| 1380 | if (wl3501_init_firmware(this)) | 1364 | if (wl3501_init_firmware(this)) |
| 1381 | goto fail; | 1365 | goto fail; |
| 1382 | /* Initial device variables */ | 1366 | /* Initial device variables */ |
| @@ -1388,7 +1372,7 @@ static int wl3501_open(struct net_device *dev) | |||
| 1388 | wl3501_unblock_interrupt(this); | 1372 | wl3501_unblock_interrupt(this); |
| 1389 | wl3501_mgmt_scan(this, 100); | 1373 | wl3501_mgmt_scan(this, 100); |
| 1390 | rc = 0; | 1374 | rc = 0; |
| 1391 | dprintk(1, "%s: WL3501 opened", dev->name); | 1375 | pr_debug("%s: WL3501 opened", dev->name); |
| 1392 | printk(KERN_INFO "%s: Card Name: %s\n" | 1376 | printk(KERN_INFO "%s: Card Name: %s\n" |
| 1393 | "%s: Firmware Date: %s\n", | 1377 | "%s: Firmware Date: %s\n", |
| 1394 | dev->name, this->card_name, | 1378 | dev->name, this->card_name, |
| @@ -1914,8 +1898,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
| 1914 | p_dev->io.IOAddrLines = 5; | 1898 | p_dev->io.IOAddrLines = 5; |
| 1915 | 1899 | ||
| 1916 | /* Interrupt setup */ | 1900 | /* Interrupt setup */ |
| 1917 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 1901 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 1918 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 1919 | p_dev->irq.Handler = wl3501_interrupt; | 1902 | p_dev->irq.Handler = wl3501_interrupt; |
| 1920 | 1903 | ||
| 1921 | /* General socket configuration */ | 1904 | /* General socket configuration */ |
| @@ -1938,16 +1921,13 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
| 1938 | dev->wireless_handlers = &wl3501_handler_def; | 1921 | dev->wireless_handlers = &wl3501_handler_def; |
| 1939 | SET_ETHTOOL_OPS(dev, &ops); | 1922 | SET_ETHTOOL_OPS(dev, &ops); |
| 1940 | netif_stop_queue(dev); | 1923 | netif_stop_queue(dev); |
| 1941 | p_dev->priv = p_dev->irq.Instance = dev; | 1924 | p_dev->priv = dev; |
| 1942 | 1925 | ||
| 1943 | return wl3501_config(p_dev); | 1926 | return wl3501_config(p_dev); |
| 1944 | out_link: | 1927 | out_link: |
| 1945 | return -ENOMEM; | 1928 | return -ENOMEM; |
| 1946 | } | 1929 | } |
| 1947 | 1930 | ||
| 1948 | #define CS_CHECK(fn, ret) \ | ||
| 1949 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 1950 | |||
| 1951 | /** | 1931 | /** |
| 1952 | * wl3501_config - configure the PCMCIA socket and make eth device available | 1932 | * wl3501_config - configure the PCMCIA socket and make eth device available |
| 1953 | * @link - FILL_IN | 1933 | * @link - FILL_IN |
| @@ -1959,7 +1939,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
| 1959 | static int wl3501_config(struct pcmcia_device *link) | 1939 | static int wl3501_config(struct pcmcia_device *link) |
| 1960 | { | 1940 | { |
| 1961 | struct net_device *dev = link->priv; | 1941 | struct net_device *dev = link->priv; |
| 1962 | int i = 0, j, last_fn, last_ret; | 1942 | int i = 0, j, ret; |
| 1963 | struct wl3501_card *this; | 1943 | struct wl3501_card *this; |
| 1964 | 1944 | ||
| 1965 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1945 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
| @@ -1975,24 +1955,26 @@ static int wl3501_config(struct pcmcia_device *link) | |||
| 1975 | if (i == 0) | 1955 | if (i == 0) |
| 1976 | break; | 1956 | break; |
| 1977 | } | 1957 | } |
| 1978 | if (i != 0) { | 1958 | if (i != 0) |
| 1979 | cs_error(link, RequestIO, i); | ||
| 1980 | goto failed; | 1959 | goto failed; |
| 1981 | } | ||
| 1982 | 1960 | ||
| 1983 | /* Now allocate an interrupt line. Note that this does not actually | 1961 | /* Now allocate an interrupt line. Note that this does not actually |
| 1984 | * assign a handler to the interrupt. */ | 1962 | * assign a handler to the interrupt. */ |
| 1985 | 1963 | ||
| 1986 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 1964 | ret = pcmcia_request_irq(link, &link->irq); |
| 1965 | if (ret) | ||
| 1966 | goto failed; | ||
| 1987 | 1967 | ||
| 1988 | /* This actually configures the PCMCIA socket -- setting up the I/O | 1968 | /* This actually configures the PCMCIA socket -- setting up the I/O |
| 1989 | * windows and the interrupt mapping. */ | 1969 | * windows and the interrupt mapping. */ |
| 1990 | 1970 | ||
| 1991 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 1971 | ret = pcmcia_request_configuration(link, &link->conf); |
| 1972 | if (ret) | ||
| 1973 | goto failed; | ||
| 1992 | 1974 | ||
| 1993 | dev->irq = link->irq.AssignedIRQ; | 1975 | dev->irq = link->irq.AssignedIRQ; |
| 1994 | dev->base_addr = link->io.BasePort1; | 1976 | dev->base_addr = link->io.BasePort1; |
| 1995 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1977 | SET_NETDEV_DEV(dev, &link->dev); |
| 1996 | if (register_netdev(dev)) { | 1978 | if (register_netdev(dev)) { |
| 1997 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 1979 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |
| 1998 | goto failed; | 1980 | goto failed; |
| @@ -2041,8 +2023,6 @@ static int wl3501_config(struct pcmcia_device *link) | |||
| 2041 | netif_start_queue(dev); | 2023 | netif_start_queue(dev); |
| 2042 | return 0; | 2024 | return 0; |
| 2043 | 2025 | ||
| 2044 | cs_failed: | ||
| 2045 | cs_error(link, last_fn, last_ret); | ||
| 2046 | failed: | 2026 | failed: |
| 2047 | wl3501_release(link); | 2027 | wl3501_release(link); |
| 2048 | return -ENODEV; | 2028 | return -ENODEV; |
