diff options
Diffstat (limited to 'drivers/net/pcmcia/3c589_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 4faf1fa08254..565063d49334 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -142,8 +142,8 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)"; | |||
142 | 142 | ||
143 | /*====================================================================*/ | 143 | /*====================================================================*/ |
144 | 144 | ||
145 | static void tc589_config(dev_link_t *link); | 145 | static void tc589_config(struct pcmcia_device *link); |
146 | static void tc589_release(dev_link_t *link); | 146 | static void tc589_release(struct pcmcia_device *link); |
147 | 147 | ||
148 | static u16 read_eeprom(kio_addr_t ioaddr, int index); | 148 | static u16 read_eeprom(kio_addr_t ioaddr, int index); |
149 | static void tc589_reset(struct net_device *dev); | 149 | static void tc589_reset(struct net_device *dev); |
@@ -170,11 +170,10 @@ static void tc589_detach(struct pcmcia_device *p_dev); | |||
170 | 170 | ||
171 | ======================================================================*/ | 171 | ======================================================================*/ |
172 | 172 | ||
173 | static int tc589_attach(struct pcmcia_device *p_dev) | 173 | static int tc589_attach(struct pcmcia_device *link) |
174 | { | 174 | { |
175 | struct el3_private *lp; | 175 | struct el3_private *lp; |
176 | struct net_device *dev; | 176 | struct net_device *dev; |
177 | dev_link_t *link = dev_to_instance(p_dev); | ||
178 | 177 | ||
179 | DEBUG(0, "3c589_attach()\n"); | 178 | DEBUG(0, "3c589_attach()\n"); |
180 | 179 | ||
@@ -184,7 +183,7 @@ static int tc589_attach(struct pcmcia_device *p_dev) | |||
184 | return -ENOMEM; | 183 | return -ENOMEM; |
185 | lp = netdev_priv(dev); | 184 | lp = netdev_priv(dev); |
186 | link->priv = dev; | 185 | link->priv = dev; |
187 | lp->p_dev = p_dev; | 186 | lp->p_dev = link; |
188 | 187 | ||
189 | spin_lock_init(&lp->lock); | 188 | spin_lock_init(&lp->lock); |
190 | link->io.NumPorts1 = 16; | 189 | link->io.NumPorts1 = 16; |
@@ -227,9 +226,8 @@ static int tc589_attach(struct pcmcia_device *p_dev) | |||
227 | 226 | ||
228 | ======================================================================*/ | 227 | ======================================================================*/ |
229 | 228 | ||
230 | static void tc589_detach(struct pcmcia_device *p_dev) | 229 | static void tc589_detach(struct pcmcia_device *link) |
231 | { | 230 | { |
232 | dev_link_t *link = dev_to_instance(p_dev); | ||
233 | struct net_device *dev = link->priv; | 231 | struct net_device *dev = link->priv; |
234 | 232 | ||
235 | DEBUG(0, "3c589_detach(0x%p)\n", link); | 233 | DEBUG(0, "3c589_detach(0x%p)\n", link); |
@@ -254,9 +252,8 @@ static void tc589_detach(struct pcmcia_device *p_dev) | |||
254 | #define CS_CHECK(fn, ret) \ | 252 | #define CS_CHECK(fn, ret) \ |
255 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 253 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
256 | 254 | ||
257 | static void tc589_config(dev_link_t *link) | 255 | static void tc589_config(struct pcmcia_device *link) |
258 | { | 256 | { |
259 | client_handle_t handle = link->handle; | ||
260 | struct net_device *dev = link->priv; | 257 | struct net_device *dev = link->priv; |
261 | struct el3_private *lp = netdev_priv(dev); | 258 | struct el3_private *lp = netdev_priv(dev); |
262 | tuple_t tuple; | 259 | tuple_t tuple; |
@@ -271,20 +268,20 @@ static void tc589_config(dev_link_t *link) | |||
271 | phys_addr = (u16 *)dev->dev_addr; | 268 | phys_addr = (u16 *)dev->dev_addr; |
272 | tuple.Attributes = 0; | 269 | tuple.Attributes = 0; |
273 | tuple.DesiredTuple = CISTPL_CONFIG; | 270 | tuple.DesiredTuple = CISTPL_CONFIG; |
274 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 271 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
275 | tuple.TupleData = (cisdata_t *)buf; | 272 | tuple.TupleData = (cisdata_t *)buf; |
276 | tuple.TupleDataMax = sizeof(buf); | 273 | tuple.TupleDataMax = sizeof(buf); |
277 | tuple.TupleOffset = 0; | 274 | tuple.TupleOffset = 0; |
278 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 275 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
279 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 276 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
280 | link->conf.ConfigBase = parse.config.base; | 277 | link->conf.ConfigBase = parse.config.base; |
281 | link->conf.Present = parse.config.rmask[0]; | 278 | link->conf.Present = parse.config.rmask[0]; |
282 | 279 | ||
283 | /* Is this a 3c562? */ | 280 | /* Is this a 3c562? */ |
284 | tuple.DesiredTuple = CISTPL_MANFID; | 281 | tuple.DesiredTuple = CISTPL_MANFID; |
285 | tuple.Attributes = TUPLE_RETURN_COMMON; | 282 | tuple.Attributes = TUPLE_RETURN_COMMON; |
286 | if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && | 283 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && |
287 | (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { | 284 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) { |
288 | if (le16_to_cpu(buf[0]) != MANFID_3COM) | 285 | if (le16_to_cpu(buf[0]) != MANFID_3COM) |
289 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " | 286 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " |
290 | "3Com card??\n"); | 287 | "3Com card??\n"); |
@@ -299,15 +296,15 @@ static void tc589_config(dev_link_t *link) | |||
299 | for (i = j = 0; j < 0x400; j += 0x10) { | 296 | for (i = j = 0; j < 0x400; j += 0x10) { |
300 | if (multi && (j & 0x80)) continue; | 297 | if (multi && (j & 0x80)) continue; |
301 | link->io.BasePort1 = j ^ 0x300; | 298 | link->io.BasePort1 = j ^ 0x300; |
302 | i = pcmcia_request_io(link->handle, &link->io); | 299 | i = pcmcia_request_io(link, &link->io); |
303 | if (i == CS_SUCCESS) break; | 300 | if (i == CS_SUCCESS) break; |
304 | } | 301 | } |
305 | if (i != CS_SUCCESS) { | 302 | if (i != CS_SUCCESS) { |
306 | cs_error(link->handle, RequestIO, i); | 303 | cs_error(link, RequestIO, i); |
307 | goto failed; | 304 | goto failed; |
308 | } | 305 | } |
309 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 306 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
310 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | 307 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
311 | 308 | ||
312 | dev->irq = link->irq.AssignedIRQ; | 309 | dev->irq = link->irq.AssignedIRQ; |
313 | dev->base_addr = link->io.BasePort1; | 310 | dev->base_addr = link->io.BasePort1; |
@@ -317,8 +314,8 @@ static void tc589_config(dev_link_t *link) | |||
317 | /* The 3c589 has an extra EEPROM for configuration info, including | 314 | /* The 3c589 has an extra EEPROM for configuration info, including |
318 | the hardware address. The 3c562 puts the address in the CIS. */ | 315 | the hardware address. The 3c562 puts the address in the CIS. */ |
319 | tuple.DesiredTuple = 0x88; | 316 | tuple.DesiredTuple = 0x88; |
320 | if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { | 317 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
321 | pcmcia_get_tuple_data(handle, &tuple); | 318 | pcmcia_get_tuple_data(link, &tuple); |
322 | for (i = 0; i < 3; i++) | 319 | for (i = 0; i < 3; i++) |
323 | phys_addr[i] = htons(buf[i]); | 320 | phys_addr[i] = htons(buf[i]); |
324 | } else { | 321 | } else { |
@@ -344,7 +341,7 @@ static void tc589_config(dev_link_t *link) | |||
344 | 341 | ||
345 | link->dev_node = &lp->node; | 342 | link->dev_node = &lp->node; |
346 | link->state &= ~DEV_CONFIG_PENDING; | 343 | link->state &= ~DEV_CONFIG_PENDING; |
347 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 344 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
348 | 345 | ||
349 | if (register_netdev(dev) != 0) { | 346 | if (register_netdev(dev) != 0) { |
350 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); | 347 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); |
@@ -365,7 +362,7 @@ static void tc589_config(dev_link_t *link) | |||
365 | return; | 362 | return; |
366 | 363 | ||
367 | cs_failed: | 364 | cs_failed: |
368 | cs_error(link->handle, last_fn, last_ret); | 365 | cs_error(link, last_fn, last_ret); |
369 | failed: | 366 | failed: |
370 | tc589_release(link); | 367 | tc589_release(link); |
371 | return; | 368 | return; |
@@ -380,14 +377,13 @@ failed: | |||
380 | 377 | ||
381 | ======================================================================*/ | 378 | ======================================================================*/ |
382 | 379 | ||
383 | static void tc589_release(dev_link_t *link) | 380 | static void tc589_release(struct pcmcia_device *link) |
384 | { | 381 | { |
385 | pcmcia_disable_device(link->handle); | 382 | pcmcia_disable_device(link); |
386 | } | 383 | } |
387 | 384 | ||
388 | static int tc589_suspend(struct pcmcia_device *p_dev) | 385 | static int tc589_suspend(struct pcmcia_device *link) |
389 | { | 386 | { |
390 | dev_link_t *link = dev_to_instance(p_dev); | ||
391 | struct net_device *dev = link->priv; | 387 | struct net_device *dev = link->priv; |
392 | 388 | ||
393 | if ((link->state & DEV_CONFIG) && (link->open)) | 389 | if ((link->state & DEV_CONFIG) && (link->open)) |
@@ -396,9 +392,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev) | |||
396 | return 0; | 392 | return 0; |
397 | } | 393 | } |
398 | 394 | ||
399 | static int tc589_resume(struct pcmcia_device *p_dev) | 395 | static int tc589_resume(struct pcmcia_device *link) |
400 | { | 396 | { |
401 | dev_link_t *link = dev_to_instance(p_dev); | ||
402 | struct net_device *dev = link->priv; | 397 | struct net_device *dev = link->priv; |
403 | 398 | ||
404 | if ((link->state & DEV_CONFIG) && (link->open)) { | 399 | if ((link->state & DEV_CONFIG) && (link->open)) { |
@@ -569,7 +564,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map) | |||
569 | static int el3_open(struct net_device *dev) | 564 | static int el3_open(struct net_device *dev) |
570 | { | 565 | { |
571 | struct el3_private *lp = netdev_priv(dev); | 566 | struct el3_private *lp = netdev_priv(dev); |
572 | dev_link_t *link = lp->p_dev; | 567 | struct pcmcia_device *link = lp->p_dev; |
573 | 568 | ||
574 | if (!DEV_OK(link)) | 569 | if (!DEV_OK(link)) |
575 | return -ENODEV; | 570 | return -ENODEV; |
@@ -830,7 +825,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev) | |||
830 | { | 825 | { |
831 | struct el3_private *lp = netdev_priv(dev); | 826 | struct el3_private *lp = netdev_priv(dev); |
832 | unsigned long flags; | 827 | unsigned long flags; |
833 | dev_link_t *link = lp->p_dev; | 828 | struct pcmcia_device *link = lp->p_dev; |
834 | 829 | ||
835 | if (DEV_OK(link)) { | 830 | if (DEV_OK(link)) { |
836 | spin_lock_irqsave(&lp->lock, flags); | 831 | spin_lock_irqsave(&lp->lock, flags); |
@@ -932,7 +927,7 @@ static int el3_rx(struct net_device *dev) | |||
932 | static void set_multicast_list(struct net_device *dev) | 927 | static void set_multicast_list(struct net_device *dev) |
933 | { | 928 | { |
934 | struct el3_private *lp = netdev_priv(dev); | 929 | struct el3_private *lp = netdev_priv(dev); |
935 | dev_link_t *link = lp->p_dev; | 930 | struct pcmcia_device *link = lp->p_dev; |
936 | kio_addr_t ioaddr = dev->base_addr; | 931 | kio_addr_t ioaddr = dev->base_addr; |
937 | u16 opts = SetRxFilter | RxStation | RxBroadcast; | 932 | u16 opts = SetRxFilter | RxStation | RxBroadcast; |
938 | 933 | ||
@@ -947,7 +942,7 @@ static void set_multicast_list(struct net_device *dev) | |||
947 | static int el3_close(struct net_device *dev) | 942 | static int el3_close(struct net_device *dev) |
948 | { | 943 | { |
949 | struct el3_private *lp = netdev_priv(dev); | 944 | struct el3_private *lp = netdev_priv(dev); |
950 | dev_link_t *link = lp->p_dev; | 945 | struct pcmcia_device *link = lp->p_dev; |
951 | kio_addr_t ioaddr = dev->base_addr; | 946 | kio_addr_t ioaddr = dev->base_addr; |
952 | 947 | ||
953 | DEBUG(1, "%s: shutting down ethercard.\n", dev->name); | 948 | DEBUG(1, "%s: shutting down ethercard.\n", dev->name); |