aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/ibmtr_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/ibmtr_cs.c')
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index f4c3dd870aca..1b8b44dc4c50 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -105,9 +105,9 @@ MODULE_LICENSE("GPL");
105 105
106/*====================================================================*/ 106/*====================================================================*/
107 107
108static void ibmtr_config(dev_link_t *link); 108static void ibmtr_config(struct pcmcia_device *link);
109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); 109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
110static void ibmtr_release(dev_link_t *link); 110static void ibmtr_release(struct pcmcia_device *link);
111static void ibmtr_detach(struct pcmcia_device *p_dev); 111static void ibmtr_detach(struct pcmcia_device *p_dev);
112 112
113/*====================================================================*/ 113/*====================================================================*/
@@ -138,12 +138,11 @@ static struct ethtool_ops netdev_ethtool_ops = {
138 138
139======================================================================*/ 139======================================================================*/
140 140
141static int ibmtr_attach(struct pcmcia_device *p_dev) 141static int ibmtr_attach(struct pcmcia_device *link)
142{ 142{
143 ibmtr_dev_t *info; 143 ibmtr_dev_t *info;
144 struct net_device *dev; 144 struct net_device *dev;
145 dev_link_t *link = dev_to_instance(p_dev); 145
146
147 DEBUG(0, "ibmtr_attach()\n"); 146 DEBUG(0, "ibmtr_attach()\n");
148 147
149 /* Create new token-ring device */ 148 /* Create new token-ring device */
@@ -156,7 +155,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
156 return -ENOMEM; 155 return -ENOMEM;
157 } 156 }
158 157
159 info->p_dev = p_dev; 158 info->p_dev = link;
160 link->priv = info; 159 link->priv = info;
161 info->ti = netdev_priv(dev); 160 info->ti = netdev_priv(dev);
162 161
@@ -189,9 +188,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
189 188
190======================================================================*/ 189======================================================================*/
191 190
192static void ibmtr_detach(struct pcmcia_device *p_dev) 191static void ibmtr_detach(struct pcmcia_device *link)
193{ 192{
194 dev_link_t *link = dev_to_instance(p_dev);
195 struct ibmtr_dev_t *info = link->priv; 193 struct ibmtr_dev_t *info = link->priv;
196 struct net_device *dev = info->dev; 194 struct net_device *dev = info->dev;
197 195
@@ -222,9 +220,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
222#define CS_CHECK(fn, ret) \ 220#define CS_CHECK(fn, ret) \
223do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
224 222
225static void ibmtr_config(dev_link_t *link) 223static void ibmtr_config(struct pcmcia_device *link)
226{ 224{
227 client_handle_t handle = link->handle;
228 ibmtr_dev_t *info = link->priv; 225 ibmtr_dev_t *info = link->priv;
229 struct net_device *dev = info->dev; 226 struct net_device *dev = info->dev;
230 struct tok_info *ti = netdev_priv(dev); 227 struct tok_info *ti = netdev_priv(dev);
@@ -242,9 +239,9 @@ static void ibmtr_config(dev_link_t *link)
242 tuple.TupleDataMax = 64; 239 tuple.TupleDataMax = 64;
243 tuple.TupleOffset = 0; 240 tuple.TupleOffset = 0;
244 tuple.DesiredTuple = CISTPL_CONFIG; 241 tuple.DesiredTuple = CISTPL_CONFIG;
245 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 242 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
246 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 243 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
247 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 244 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
248 link->conf.ConfigBase = parse.config.base; 245 link->conf.ConfigBase = parse.config.base;
249 246
250 /* Configure card */ 247 /* Configure card */
@@ -256,15 +253,15 @@ static void ibmtr_config(dev_link_t *link)
256 253
257 /* Try PRIMARY card at 0xA20-0xA23 */ 254 /* Try PRIMARY card at 0xA20-0xA23 */
258 link->io.BasePort1 = 0xA20; 255 link->io.BasePort1 = 0xA20;
259 i = pcmcia_request_io(link->handle, &link->io); 256 i = pcmcia_request_io(link, &link->io);
260 if (i != CS_SUCCESS) { 257 if (i != CS_SUCCESS) {
261 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 258 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
262 link->io.BasePort1 = 0xA24; 259 link->io.BasePort1 = 0xA24;
263 CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); 260 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
264 } 261 }
265 dev->base_addr = link->io.BasePort1; 262 dev->base_addr = link->io.BasePort1;
266 263
267 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 264 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
268 dev->irq = link->irq.AssignedIRQ; 265 dev->irq = link->irq.AssignedIRQ;
269 ti->irq = link->irq.AssignedIRQ; 266 ti->irq = link->irq.AssignedIRQ;
270 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 267 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
@@ -275,7 +272,7 @@ static void ibmtr_config(dev_link_t *link)
275 req.Base = 0; 272 req.Base = 0;
276 req.Size = 0x2000; 273 req.Size = 0x2000;
277 req.AccessSpeed = 250; 274 req.AccessSpeed = 250;
278 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 275 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
279 276
280 mem.CardOffset = mmiobase; 277 mem.CardOffset = mmiobase;
281 mem.Page = 0; 278 mem.Page = 0;
@@ -288,7 +285,7 @@ static void ibmtr_config(dev_link_t *link)
288 req.Base = 0; 285 req.Base = 0;
289 req.Size = sramsize * 1024; 286 req.Size = sramsize * 1024;
290 req.AccessSpeed = 250; 287 req.AccessSpeed = 250;
291 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &info->sram_win_handle)); 288 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle));
292 289
293 mem.CardOffset = srambase; 290 mem.CardOffset = srambase;
294 mem.Page = 0; 291 mem.Page = 0;
@@ -298,7 +295,7 @@ static void ibmtr_config(dev_link_t *link)
298 ti->sram_virt = ioremap(req.Base, req.Size); 295 ti->sram_virt = ioremap(req.Base, req.Size);
299 ti->sram_phys = req.Base; 296 ti->sram_phys = req.Base;
300 297
301 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 298 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
302 299
303 /* Set up the Token-Ring Controller Configuration Register and 300 /* Set up the Token-Ring Controller Configuration Register and
304 turn on the card. Check the "Local Area Network Credit Card 301 turn on the card. Check the "Local Area Network Credit Card
@@ -307,7 +304,7 @@ static void ibmtr_config(dev_link_t *link)
307 304
308 link->dev_node = &info->node; 305 link->dev_node = &info->node;
309 link->state &= ~DEV_CONFIG_PENDING; 306 link->state &= ~DEV_CONFIG_PENDING;
310 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 307 SET_NETDEV_DEV(dev, &handle_to_dev(link));
311 308
312 i = ibmtr_probe_card(dev); 309 i = ibmtr_probe_card(dev);
313 if (i != 0) { 310 if (i != 0) {
@@ -329,7 +326,7 @@ static void ibmtr_config(dev_link_t *link)
329 return; 326 return;
330 327
331cs_failed: 328cs_failed:
332 cs_error(link->handle, last_fn, last_ret); 329 cs_error(link, last_fn, last_ret);
333failed: 330failed:
334 ibmtr_release(link); 331 ibmtr_release(link);
335} /* ibmtr_config */ 332} /* ibmtr_config */
@@ -342,7 +339,7 @@ failed:
342 339
343======================================================================*/ 340======================================================================*/
344 341
345static void ibmtr_release(dev_link_t *link) 342static void ibmtr_release(struct pcmcia_device *link)
346{ 343{
347 ibmtr_dev_t *info = link->priv; 344 ibmtr_dev_t *info = link->priv;
348 struct net_device *dev = info->dev; 345 struct net_device *dev = info->dev;
@@ -354,12 +351,11 @@ static void ibmtr_release(dev_link_t *link)
354 iounmap(ti->mmio); 351 iounmap(ti->mmio);
355 pcmcia_release_window(info->sram_win_handle); 352 pcmcia_release_window(info->sram_win_handle);
356 } 353 }
357 pcmcia_disable_device(link->handle); 354 pcmcia_disable_device(link);
358} 355}
359 356
360static int ibmtr_suspend(struct pcmcia_device *p_dev) 357static int ibmtr_suspend(struct pcmcia_device *link)
361{ 358{
362 dev_link_t *link = dev_to_instance(p_dev);
363 ibmtr_dev_t *info = link->priv; 359 ibmtr_dev_t *info = link->priv;
364 struct net_device *dev = info->dev; 360 struct net_device *dev = info->dev;
365 361
@@ -369,9 +365,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev)
369 return 0; 365 return 0;
370} 366}
371 367
372static int ibmtr_resume(struct pcmcia_device *p_dev) 368static int ibmtr_resume(struct pcmcia_device *link)
373{ 369{
374 dev_link_t *link = dev_to_instance(p_dev);
375 ibmtr_dev_t *info = link->priv; 370 ibmtr_dev_t *info = link->priv;
376 struct net_device *dev = info->dev; 371 struct net_device *dev = info->dev;
377 372