David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * IPWireless 3G PCMCIA Network Driver |
| 3 | * |
| 4 | * Original code |
| 5 | * by Stephen Blackheath <stephen@blacksapphire.com>, |
| 6 | * Ben Martel <benm@symmetric.co.nz> |
| 7 | * |
| 8 | * Copyrighted as follows: |
| 9 | * Copyright (C) 2004 by Symmetric Systems Ltd (NZ) |
| 10 | * |
| 11 | * Various driver changes and rewrites, port to new kernels |
| 12 | * Copyright (C) 2006-2007 Jiri Kosina |
| 13 | * |
| 14 | * Misc code cleanups and updates |
| 15 | * Copyright (C) 2007 David Sterba |
| 16 | */ |
| 17 | |
| 18 | #include "hardware.h" |
| 19 | #include "network.h" |
| 20 | #include "main.h" |
| 21 | #include "tty.h" |
| 22 | |
| 23 | #include <linux/delay.h> |
| 24 | #include <linux/init.h> |
| 25 | #include <linux/io.h> |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/module.h> |
| 28 | #include <linux/sched.h> |
| 29 | #include <linux/slab.h> |
| 30 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 31 | #include <pcmcia/cisreg.h> |
| 32 | #include <pcmcia/device_id.h> |
| 33 | #include <pcmcia/ss.h> |
| 34 | #include <pcmcia/ds.h> |
| 35 | #include <pcmcia/cs.h> |
| 36 | |
| 37 | static struct pcmcia_device_id ipw_ids[] = { |
| 38 | PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), |
| 39 | PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0200), |
| 40 | PCMCIA_DEVICE_NULL |
| 41 | }; |
| 42 | MODULE_DEVICE_TABLE(pcmcia, ipw_ids); |
| 43 | |
| 44 | static void ipwireless_detach(struct pcmcia_device *link); |
| 45 | |
| 46 | /* |
| 47 | * Module params |
| 48 | */ |
| 49 | /* Debug mode: more verbose, print sent/recv bytes */ |
| 50 | int ipwireless_debug; |
| 51 | int ipwireless_loopback; |
David Sterba | bee9c7c | 2008-07-28 16:53:21 +0200 | [diff] [blame] | 52 | int ipwireless_out_queue = 10; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 53 | |
| 54 | module_param_named(debug, ipwireless_debug, int, 0); |
| 55 | module_param_named(loopback, ipwireless_loopback, int, 0); |
| 56 | module_param_named(out_queue, ipwireless_out_queue, int, 0); |
| 57 | MODULE_PARM_DESC(debug, "switch on debug messages [0]"); |
| 58 | MODULE_PARM_DESC(loopback, |
| 59 | "debug: enable ras_raw channel [0]"); |
David Sterba | bee9c7c | 2008-07-28 16:53:21 +0200 | [diff] [blame] | 60 | MODULE_PARM_DESC(out_queue, "debug: set size of outgoing PPP queue [10]"); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 61 | |
| 62 | /* Executes in process context. */ |
| 63 | static void signalled_reboot_work(struct work_struct *work_reboot) |
| 64 | { |
| 65 | struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, |
| 66 | work_reboot); |
| 67 | struct pcmcia_device *link = ipw->link; |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 68 | pcmcia_reset_card(link->socket); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | static void signalled_reboot_callback(void *callback_data) |
| 72 | { |
| 73 | struct ipw_dev *ipw = (struct ipw_dev *) callback_data; |
| 74 | |
| 75 | /* Delegate to process context. */ |
| 76 | schedule_work(&ipw->work_reboot); |
| 77 | } |
| 78 | |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 79 | static int ipwireless_probe(struct pcmcia_device *p_dev, |
| 80 | cistpl_cftable_entry_t *cfg, |
| 81 | cistpl_cftable_entry_t *dflt, |
| 82 | unsigned int vcc, |
| 83 | void *priv_data) |
Dominik Brodowski | aaa8cfd | 2009-10-18 18:28:39 +0200 | [diff] [blame] | 84 | { |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 85 | struct ipw_dev *ipw = priv_data; |
| 86 | struct resource *io_resource; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 87 | int ret; |
| 88 | |
Dominik Brodowski | 90abdc3 | 2010-07-24 17:23:51 +0200 | [diff] [blame] | 89 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
| 90 | p_dev->resource[0]->start = cfg->io.win[0].base; |
| 91 | p_dev->resource[0]->end = cfg->io.win[0].len; |
Dominik Brodowski | aaa8cfd | 2009-10-18 18:28:39 +0200 | [diff] [blame] | 92 | |
Dominik Brodowski | aaa8cfd | 2009-10-18 18:28:39 +0200 | [diff] [blame] | 93 | /* 0x40 causes it to generate level mode interrupts. */ |
| 94 | /* 0x04 enables IREQ pin. */ |
Dominik Brodowski | 7feabb6 | 2010-07-29 18:35:47 +0200 | [diff] [blame^] | 95 | p_dev->config_index = cfg->index | 0x44; |
Dominik Brodowski | 90abdc3 | 2010-07-24 17:23:51 +0200 | [diff] [blame] | 96 | p_dev->io_lines = 16; |
| 97 | ret = pcmcia_request_io(p_dev); |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 98 | if (ret) |
| 99 | return ret; |
| 100 | |
Dominik Brodowski | 9a017a9 | 2010-07-24 15:58:54 +0200 | [diff] [blame] | 101 | io_resource = request_region(p_dev->resource[0]->start, |
| 102 | resource_size(p_dev->resource[0]), |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 103 | IPWIRELESS_PCCARD_NAME); |
| 104 | |
| 105 | if (cfg->mem.nwin == 0) |
| 106 | return 0; |
| 107 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 108 | p_dev->resource[2]->flags |= |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 109 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 110 | p_dev->resource[2]->start = cfg->mem.win[0].host_addr; |
| 111 | p_dev->resource[2]->end = cfg->mem.win[0].len; |
| 112 | if (p_dev->resource[2]->end < 0x1000) |
| 113 | p_dev->resource[2]->end = 0x1000; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 114 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 115 | ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 116 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 117 | goto exit1; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 118 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 119 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], |
Dominik Brodowski | b5cb259 | 2010-07-24 18:46:42 +0200 | [diff] [blame] | 120 | cfg->mem.win[0].card_addr); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 121 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 122 | goto exit2; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 123 | |
| 124 | ipw->is_v2_card = cfg->mem.win[0].len == 0x100; |
| 125 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 126 | ipw->attr_memory = ioremap(p_dev->resource[2]->start, |
| 127 | resource_size(p_dev->resource[2])); |
| 128 | request_mem_region(p_dev->resource[2]->start, |
| 129 | resource_size(p_dev->resource[2]), |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 130 | IPWIRELESS_PCCARD_NAME); |
| 131 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 132 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | |
| 133 | WIN_ENABLE; |
| 134 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ |
| 135 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 136 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 137 | goto exit2; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 138 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 139 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 140 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 141 | goto exit3; |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 142 | |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 143 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
| 144 | resource_size(p_dev->resource[3])); |
| 145 | request_mem_region(p_dev->resource[3]->start, |
| 146 | resource_size(p_dev->resource[3]), |
| 147 | IPWIRELESS_PCCARD_NAME); |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 148 | |
| 149 | return 0; |
| 150 | |
| 151 | exit3: |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 152 | exit2: |
| 153 | if (ipw->common_memory) { |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 154 | release_mem_region(p_dev->resource[2]->start, |
| 155 | resource_size(p_dev->resource[2])); |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 156 | iounmap(ipw->common_memory); |
Dominik Brodowski | 0ca724d | 2010-07-24 19:03:02 +0200 | [diff] [blame] | 157 | } |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 158 | exit1: |
| 159 | release_resource(io_resource); |
| 160 | pcmcia_disable_device(p_dev); |
| 161 | return -1; |
Dominik Brodowski | aaa8cfd | 2009-10-18 18:28:39 +0200 | [diff] [blame] | 162 | } |
| 163 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 164 | static int config_ipwireless(struct ipw_dev *ipw) |
| 165 | { |
| 166 | struct pcmcia_device *link = ipw->link; |
Dominik Brodowski | aaa8cfd | 2009-10-18 18:28:39 +0200 | [diff] [blame] | 167 | int ret = 0; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 168 | |
| 169 | ipw->is_v2_card = 0; |
| 170 | |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 171 | ret = pcmcia_loop_config(link, ipwireless_probe, ipw); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 172 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 173 | return ret; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 174 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 175 | link->conf.Attributes = CONF_ENABLE_IRQ; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 176 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 177 | INIT_WORK(&ipw->work_reboot, signalled_reboot_work); |
| 178 | |
Dominik Brodowski | 9a017a9 | 2010-07-24 15:58:54 +0200 | [diff] [blame] | 179 | ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start, |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 180 | ipw->attr_memory, ipw->common_memory, |
| 181 | ipw->is_v2_card, signalled_reboot_callback, |
| 182 | ipw); |
| 183 | |
Dominik Brodowski | eb14120 | 2010-03-07 12:21:16 +0100 | [diff] [blame] | 184 | ret = pcmcia_request_irq(link, ipwireless_interrupt); |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 185 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 186 | goto exit; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 187 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 188 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", |
| 189 | ipw->is_v2_card ? "V2/V3" : "V1"); |
| 190 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME |
Dominik Brodowski | 9a017a9 | 2010-07-24 15:58:54 +0200 | [diff] [blame] | 191 | ": I/O ports %pR, irq %d\n", link->resource[0], |
Dominik Brodowski | eb14120 | 2010-03-07 12:21:16 +0100 | [diff] [blame] | 192 | (unsigned int) link->irq); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 193 | if (ipw->attr_memory && ipw->common_memory) |
| 194 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 195 | ": attr memory %pR, common memory %pR\n", |
| 196 | link->resource[3], |
| 197 | link->resource[2]); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 198 | |
| 199 | ipw->network = ipwireless_network_create(ipw->hardware); |
| 200 | if (!ipw->network) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 201 | goto exit; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 202 | |
Dominik Brodowski | b498ada | 2010-03-20 19:43:26 +0100 | [diff] [blame] | 203 | ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 204 | if (!ipw->tty) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 205 | goto exit; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 206 | |
| 207 | ipwireless_init_hardware_v2_v3(ipw->hardware); |
| 208 | |
| 209 | /* |
| 210 | * Do the RequestConfiguration last, because it enables interrupts. |
| 211 | * Then we don't get any interrupts before we're ready for them. |
| 212 | */ |
| 213 | ret = pcmcia_request_configuration(link, &link->conf); |
| 214 | |
Dominik Brodowski | cbf624f | 2009-10-24 15:47:29 +0200 | [diff] [blame] | 215 | if (ret != 0) |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 216 | goto exit; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 217 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 218 | return 0; |
| 219 | |
Dominik Brodowski | af757923 | 2009-10-18 19:48:39 +0200 | [diff] [blame] | 220 | exit: |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 221 | if (ipw->common_memory) { |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 222 | release_mem_region(link->resource[2]->start, |
| 223 | resource_size(link->resource[2])); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 224 | iounmap(ipw->common_memory); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 225 | } |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 226 | if (ipw->attr_memory) { |
| 227 | release_mem_region(link->resource[3]->start, |
| 228 | resource_size(link->resource[3])); |
| 229 | iounmap(ipw->attr_memory); |
| 230 | } |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 231 | pcmcia_disable_device(link); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 232 | return -1; |
| 233 | } |
| 234 | |
| 235 | static void release_ipwireless(struct ipw_dev *ipw) |
| 236 | { |
David Sterba | 09e491e | 2008-07-28 16:53:16 +0200 | [diff] [blame] | 237 | if (ipw->common_memory) { |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 238 | release_mem_region(ipw->link->resource[2]->start, |
| 239 | resource_size(ipw->link->resource[2])); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 240 | iounmap(ipw->common_memory); |
David Sterba | 09e491e | 2008-07-28 16:53:16 +0200 | [diff] [blame] | 241 | } |
| 242 | if (ipw->attr_memory) { |
Dominik Brodowski | cdb1380 | 2010-07-28 10:59:06 +0200 | [diff] [blame] | 243 | release_mem_region(ipw->link->resource[3]->start, |
| 244 | resource_size(ipw->link->resource[3])); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 245 | iounmap(ipw->attr_memory); |
David Sterba | 09e491e | 2008-07-28 16:53:16 +0200 | [diff] [blame] | 246 | } |
David Sterba | 09e491e | 2008-07-28 16:53:16 +0200 | [diff] [blame] | 247 | pcmcia_disable_device(ipw->link); |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | /* |
| 251 | * ipwireless_attach() creates an "instance" of the driver, allocating |
| 252 | * local data structures for one device (one interface). The device |
| 253 | * is registered with Card Services. |
| 254 | * |
| 255 | * The pcmcia_device structure is initialized, but we don't actually |
| 256 | * configure the card at this point -- we wait until we receive a |
| 257 | * card insertion event. |
| 258 | */ |
| 259 | static int ipwireless_attach(struct pcmcia_device *link) |
| 260 | { |
| 261 | struct ipw_dev *ipw; |
| 262 | int ret; |
| 263 | |
| 264 | ipw = kzalloc(sizeof(struct ipw_dev), GFP_KERNEL); |
| 265 | if (!ipw) |
| 266 | return -ENOMEM; |
| 267 | |
| 268 | ipw->link = link; |
| 269 | link->priv = ipw; |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 270 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 271 | ipw->hardware = ipwireless_hardware_create(); |
| 272 | if (!ipw->hardware) { |
| 273 | kfree(ipw); |
| 274 | return -ENOMEM; |
| 275 | } |
| 276 | /* RegisterClient will call config_ipwireless */ |
| 277 | |
| 278 | ret = config_ipwireless(ipw); |
| 279 | |
| 280 | if (ret != 0) { |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 281 | ipwireless_detach(link); |
| 282 | return ret; |
| 283 | } |
| 284 | |
| 285 | return 0; |
| 286 | } |
| 287 | |
| 288 | /* |
| 289 | * This deletes a driver "instance". The device is de-registered with |
| 290 | * Card Services. If it has been released, all local data structures |
| 291 | * are freed. Otherwise, the structures will be freed when the device |
| 292 | * is released. |
| 293 | */ |
| 294 | static void ipwireless_detach(struct pcmcia_device *link) |
| 295 | { |
| 296 | struct ipw_dev *ipw = link->priv; |
| 297 | |
| 298 | release_ipwireless(ipw); |
| 299 | |
David Sterba | 099dc4f | 2008-02-07 10:57:12 +0100 | [diff] [blame] | 300 | if (ipw->tty != NULL) |
| 301 | ipwireless_tty_free(ipw->tty); |
| 302 | if (ipw->network != NULL) |
| 303 | ipwireless_network_free(ipw->network); |
| 304 | if (ipw->hardware != NULL) |
| 305 | ipwireless_hardware_free(ipw->hardware); |
| 306 | kfree(ipw); |
| 307 | } |
| 308 | |
| 309 | static struct pcmcia_driver me = { |
| 310 | .owner = THIS_MODULE, |
| 311 | .probe = ipwireless_attach, |
| 312 | .remove = ipwireless_detach, |
| 313 | .drv = { .name = IPWIRELESS_PCCARD_NAME }, |
| 314 | .id_table = ipw_ids |
| 315 | }; |
| 316 | |
| 317 | /* |
| 318 | * Module insertion : initialisation of the module. |
| 319 | * Register the card with cardmgr... |
| 320 | */ |
| 321 | static int __init init_ipwireless(void) |
| 322 | { |
| 323 | int ret; |
| 324 | |
| 325 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " |
| 326 | IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n"); |
| 327 | |
| 328 | ret = ipwireless_tty_init(); |
| 329 | if (ret != 0) |
| 330 | return ret; |
| 331 | |
| 332 | ret = pcmcia_register_driver(&me); |
| 333 | if (ret != 0) |
| 334 | ipwireless_tty_release(); |
| 335 | |
| 336 | return ret; |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * Module removal |
| 341 | */ |
| 342 | static void __exit exit_ipwireless(void) |
| 343 | { |
| 344 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " |
| 345 | IPWIRELESS_PCMCIA_VERSION " removed\n"); |
| 346 | |
| 347 | pcmcia_unregister_driver(&me); |
| 348 | ipwireless_tty_release(); |
| 349 | } |
| 350 | |
| 351 | module_init(init_ipwireless); |
| 352 | module_exit(exit_ipwireless); |
| 353 | |
| 354 | MODULE_AUTHOR(IPWIRELESS_PCMCIA_AUTHOR); |
| 355 | MODULE_DESCRIPTION(IPWIRELESS_PCCARD_NAME " " IPWIRELESS_PCMCIA_VERSION); |
| 356 | MODULE_LICENSE("GPL"); |