Blame view

drivers/pcmcia/au1000_generic.c 13.9 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  /*
   *
   * Alchemy Semi Au1000 pcmcia driver
   *
   * Copyright 2001-2003 MontaVista Software Inc.
   * Author: MontaVista Software, Inc.
   *         	ppopov@embeddedalley.com or source@mvista.com
   *
   * Copyright 2004 Pete Popov, Embedded Alley Solutions, Inc.
   * Updated the driver to 2.6. Followed the sa11xx API and largely
   * copied many of the hardware independent functions.
   *
   * ########################################################################
   *
   *  This program is free software; you can distribute it and/or modify it
   *  under the terms of the GNU General Public License (Version 2) as
   *  published by the Free Software Foundation.
   *
   *  This program is distributed in the hope it will be useful, but WITHOUT
   *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   *  for more details.
   *
   *  You should have received a copy of the GNU General Public License along
   *  with this program; if not, write to the Free Software Foundation, Inc.,
   *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
   *
   * ########################################################################
   *
   * 
   */
  
  #include <linux/module.h>
  #include <linux/moduleparam.h>
  #include <linux/init.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36
37
38
39
40
41
42
43
  #include <linux/cpufreq.h>
  #include <linux/ioport.h>
  #include <linux/kernel.h>
  #include <linux/timer.h>
  #include <linux/mm.h>
  #include <linux/notifier.h>
  #include <linux/interrupt.h>
  #include <linux/spinlock.h>
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
44
  #include <linux/mutex.h>
d052d1bef   Russell King   Create platform_d...
45
  #include <linux/platform_device.h>
5a0e3ad6a   Tejun Heo   include cleanup: ...
46
  #include <linux/slab.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  
  #include <asm/io.h>
  #include <asm/irq.h>
  #include <asm/system.h>
  
  #include <asm/mach-au1x00/au1000.h>
  #include "au1000_generic.h"
  
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Pete Popov <ppopov@embeddedalley.com>");
  MODULE_DESCRIPTION("Linux PCMCIA Card Services: Au1x00 Socket Controller");
  
  #if 0
  #define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args)
  #else
  #define debug(x,args...)
  #endif
  
  #define MAP_SIZE 0x100000
  extern struct au1000_pcmcia_socket au1000_pcmcia_socket[];
  #define PCMCIA_SOCKET(x)	(au1000_pcmcia_socket + (x))
  #define to_au1000_socket(x)	container_of(x, struct au1000_pcmcia_socket, socket)
  
  /* Some boards like to support CF cards as IDE root devices, so they
   * grab pcmcia sockets directly.
   */
  u32 *pcmcia_base_vaddrs[2];
  extern const unsigned long mips_io_port_base;
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
75
  static DEFINE_MUTEX(pcmcia_sockets_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
  
  static int (*au1x00_pcmcia_hw_init[])(struct device *dev) = {
  	au1x_board_init,
  };
  
  static int
  au1x00_pcmcia_skt_state(struct au1000_pcmcia_socket *skt)
  {
  	struct pcmcia_state state;
  	unsigned int stat;
  
  	memset(&state, 0, sizeof(struct pcmcia_state));
  
  	skt->ops->socket_state(skt, &state);
  
  	stat = state.detect  ? SS_DETECT : 0;
  	stat |= state.ready  ? SS_READY  : 0;
  	stat |= state.wrprot ? SS_WRPROT : 0;
  	stat |= state.vs_3v  ? SS_3VCARD : 0;
  	stat |= state.vs_Xv  ? SS_XVCARD : 0;
  	stat |= skt->cs_state.Vcc ? SS_POWERON : 0;
  
  	if (skt->cs_state.flags & SS_IOCARD)
  		stat |= state.bvd1 ? SS_STSCHG : 0;
  	else {
  		if (state.bvd1 == 0)
  			stat |= SS_BATDEAD;
  		else if (state.bvd2 == 0)
  			stat |= SS_BATWARN;
  	}
  	return stat;
  }
  
  /*
   * au100_pcmcia_config_skt
   *
   * Convert PCMCIA socket state to our socket configure structure.
   */
  static int
  au1x00_pcmcia_config_skt(struct au1000_pcmcia_socket *skt, socket_state_t *state)
  {
  	int ret;
  
  	ret = skt->ops->configure_socket(skt, state);
  	if (ret == 0) {
  		skt->cs_state = *state;
  	}
  
  	if (ret < 0)
  		debug("unable to configure socket %d
  ", skt->nr);
  
  	return ret;
  }
  
  /* au1x00_pcmcia_sock_init()
   *
   * (Re-)Initialise the socket, turning on status interrupts
   * and PCMCIA bus.  This must wait for power to stabilise
   * so that the card status signals report correctly.
   *
   * Returns: 0
   */
  static int au1x00_pcmcia_sock_init(struct pcmcia_socket *sock)
  {
  	struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  
  	debug("initializing socket %u
  ", skt->nr);
  
  	skt->ops->socket_init(skt);
  	return 0;
  }
  
  /*
   * au1x00_pcmcia_suspend()
   *
   * Remove power on the socket, disable IRQs from the card.
   * Turn off status interrupts, and disable the PCMCIA bus.
   *
   * Returns: 0
   */
  static int au1x00_pcmcia_suspend(struct pcmcia_socket *sock)
  {
  	struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  
  	debug("suspending socket %u
  ", skt->nr);
  
  	skt->ops->socket_suspend(skt);
  
  	return 0;
  }
  
  static DEFINE_SPINLOCK(status_lock);
  
  /*
   * au1x00_check_status()
   */
  static void au1x00_check_status(struct au1000_pcmcia_socket *skt)
  {
  	unsigned int events;
  
  	debug("entering PCMCIA monitoring thread
  ");
  
  	do {
  		unsigned int status;
  		unsigned long flags;
  
  		status = au1x00_pcmcia_skt_state(skt);
  
  		spin_lock_irqsave(&status_lock, flags);
  		events = (status ^ skt->status) & skt->cs_state.csc_mask;
  		skt->status = status;
  		spin_unlock_irqrestore(&status_lock, flags);
  
  		debug("events: %s%s%s%s%s%s
  ",
  			events == 0         ? "<NONE>"   : "",
  			events & SS_DETECT  ? "DETECT "  : "",
  			events & SS_READY   ? "READY "   : "",
  			events & SS_BATDEAD ? "BATDEAD " : "",
  			events & SS_BATWARN ? "BATWARN " : "",
  			events & SS_STSCHG  ? "STSCHG "  : "");
  
  		if (events)
  			pcmcia_parse_events(&skt->socket, events);
  	} while (events);
  }
  
  /* 
   * au1x00_pcmcia_poll_event()
   * Let's poll for events in addition to IRQs since IRQ only is unreliable...
   */
  static void au1x00_pcmcia_poll_event(unsigned long dummy)
  {
  	struct au1000_pcmcia_socket *skt = (struct au1000_pcmcia_socket *)dummy;
  	debug("polling for events
  ");
  
  	mod_timer(&skt->poll_timer, jiffies + AU1000_PCMCIA_POLL_PERIOD);
  
  	au1x00_check_status(skt);
  }
  
  /* au1x00_pcmcia_get_status()
   *
   * From the sa11xx_core.c:
   * Implements the get_status() operation for the in-kernel PCMCIA
   * service (formerly SS_GetStatus in Card Services). Essentially just
   * fills in bits in `status' according to internal driver state or
   * the value of the voltage detect chipselect register.
   *
   * As a debugging note, during card startup, the PCMCIA core issues
   * three set_socket() commands in a row the first with RESET deasserted,
   * the second with RESET asserted, and the last with RESET deasserted
   * again. Following the third set_socket(), a get_status() command will
   * be issued. The kernel is looking for the SS_READY flag (see
   * setup_socket(), reset_socket(), and unreset_socket() in cs.c).
   *
   * Returns: 0
   */
  static int
  au1x00_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
  {
  	struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  
  	skt->status = au1x00_pcmcia_skt_state(skt);
  	*status = skt->status;
  
  	return 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
  /* au1x00_pcmcia_set_socket()
   * Implements the set_socket() operation for the in-kernel PCMCIA
   * service (formerly SS_SetSocket in Card Services). We more or
   * less punt all of this work and let the kernel handle the details
   * of power configuration, reset, &c. We also record the value of
   * `state' in order to regurgitate it to the PCMCIA core later.
   *
   * Returns: 0
   */
  static int
  au1x00_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
  {
    struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  
    debug("for sock %u
  ", skt->nr);
  
    debug("\tmask:  %s%s%s%s%s%s
  \tflags: %s%s%s%s%s%s
  ",
  	(state->csc_mask==0)?"<NONE>":"",
  	(state->csc_mask&SS_DETECT)?"DETECT ":"",
  	(state->csc_mask&SS_READY)?"READY ":"",
  	(state->csc_mask&SS_BATDEAD)?"BATDEAD ":"",
  	(state->csc_mask&SS_BATWARN)?"BATWARN ":"",
  	(state->csc_mask&SS_STSCHG)?"STSCHG ":"",
  	(state->flags==0)?"<NONE>":"",
  	(state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"",
  	(state->flags&SS_IOCARD)?"IOCARD ":"",
  	(state->flags&SS_RESET)?"RESET ":"",
  	(state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"",
  	(state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"");
    debug("\tVcc %d  Vpp %d  irq %d
  ",
  	state->Vcc, state->Vpp, state->io_irq);
  
    return au1x00_pcmcia_config_skt(skt, state);
  }
  
  int 
  au1x00_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
  {
  	struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  	unsigned int speed;
  
  	if(map->map>=MAX_IO_WIN){
  		debug("map (%d) out of range
  ", map->map);
  		return -1;
  	}
  
  	if(map->flags&MAP_ACTIVE){
  		speed=(map->speed>0)?map->speed:AU1000_PCMCIA_IO_SPEED;
  		skt->spd_io[map->map] = speed;
  	}
d39bd5645   Dominik Brodowski   pcmcia: encapsula...
304
  	map->start=(unsigned int)(u32)skt->virt_io;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
  	map->stop=map->start+MAP_SIZE;
  	return 0;
  
  }  /* au1x00_pcmcia_set_io_map() */
  
  
  static int 
  au1x00_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map)
  {
  	struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
  	unsigned short speed = map->speed;
  
  	if(map->map>=MAX_WIN){
  		debug("map (%d) out of range
  ", map->map);
  		return -1;
  	}
  
  	if (map->flags & MAP_ATTRIB) {
  		skt->spd_attr[map->map] = speed;
  		skt->spd_mem[map->map] = 0;
  	} else {
  		skt->spd_attr[map->map] = 0;
  		skt->spd_mem[map->map] = speed;
  	}
  
  	if (map->flags & MAP_ATTRIB) {
  		map->static_start = skt->phys_attr + map->card_start;
  	}
  	else {
  		map->static_start = skt->phys_mem + map->card_start;
  	}
  
  	debug("set_mem_map %d start %08lx card_start %08x
  ",
  			map->map, map->static_start, map->card_start);
  	return 0;
  
  }  /* au1x00_pcmcia_set_mem_map() */
  
  static struct pccard_operations au1x00_pcmcia_operations = {
  	.init			= au1x00_pcmcia_sock_init,
  	.suspend		= au1x00_pcmcia_suspend,
  	.get_status		= au1x00_pcmcia_get_status,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
  	.set_socket		= au1x00_pcmcia_set_socket,
  	.set_io_map		= au1x00_pcmcia_set_io_map,
  	.set_mem_map		= au1x00_pcmcia_set_mem_map,
  };
  
  static const char *skt_names[] = {
  	"PCMCIA socket 0",
  	"PCMCIA socket 1",
  };
  
  struct skt_dev_info {
  	int nskt;
  };
  
  int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
  {
  	struct skt_dev_info *sinfo;
a230a6785   Om Narasimhan   [PATCH] pcmcia: a...
366
  	struct au1000_pcmcia_socket *skt;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
367
  	int ret, i;
8084b372a   Dominik Brodowski   [PATCH] pcmcia: k...
368
  	sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
369
370
371
372
  	if (!sinfo) {
  		ret = -ENOMEM;
  		goto out;
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
373
374
375
376
377
378
  	sinfo->nskt = nr;
  
  	/*
  	 * Initialise the per-socket structure.
  	 */
  	for (i = 0; i < nr; i++) {
a230a6785   Om Narasimhan   [PATCH] pcmcia: a...
379
  		skt = PCMCIA_SOCKET(i);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
380
  		memset(skt, 0, sizeof(*skt));
dc33a4a36   Dominik Brodowski   [PATCH] pcmcia: u...
381
  		skt->socket.resource_ops = &pccard_static_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
382
383
  		skt->socket.ops = &au1x00_pcmcia_operations;
  		skt->socket.owner = ops->owner;
88f45005c   Yoichi Yuasa   [PATCH] Fix struc...
384
  		skt->socket.dev.parent = dev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
  
  		init_timer(&skt->poll_timer);
  		skt->poll_timer.function = au1x00_pcmcia_poll_event;
  		skt->poll_timer.data = (unsigned long)skt;
  		skt->poll_timer.expires = jiffies + AU1000_PCMCIA_POLL_PERIOD;
  
  		skt->nr		= first + i;
  		skt->irq	= 255;
  		skt->dev	= dev;
  		skt->ops	= ops;
  
  		skt->res_skt.name	= skt_names[skt->nr];
  		skt->res_io.name	= "io";
  		skt->res_io.flags	= IORESOURCE_MEM | IORESOURCE_BUSY;
  		skt->res_mem.name	= "memory";
  		skt->res_mem.flags	= IORESOURCE_MEM;
  		skt->res_attr.name	= "attribute";
  		skt->res_attr.flags	= IORESOURCE_MEM;
  
  		/*
  		 * PCMCIA client drivers use the inb/outb macros to access the
  		 * IO registers. Since mips_io_port_base is added to the
  		 * access address of the mips implementation of inb/outb,
  		 * we need to subtract it here because we want to access the
  		 * I/O or MEM address directly, without going through this
  		 * "mips_io_port_base" mechanism.
  		 */
  		if (i == 0) {
  			skt->virt_io = (void *)
  				(ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) -
  				(u32)mips_io_port_base);
11b897cf8   Manuel Lauss   MIPS: Alchemy: us...
416
417
  			skt->phys_attr = AU1X_SOCK0_PHYS_ATTR;
  			skt->phys_mem = AU1X_SOCK0_PHYS_MEM;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
418
  		}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
419
420
421
422
  		else  {
  			skt->virt_io = (void *)
  				(ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) -
  				(u32)mips_io_port_base);
11b897cf8   Manuel Lauss   MIPS: Alchemy: us...
423
424
  			skt->phys_attr = AU1X_SOCK1_PHYS_ATTR;
  			skt->phys_mem = AU1X_SOCK1_PHYS_MEM;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
425
  		}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
  		pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io;
  		ret = ops->hw_init(skt);
  
  		skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
  		skt->socket.irq_mask = 0;
  		skt->socket.map_size = MAP_SIZE;
  		skt->socket.pci_irq = skt->irq;
  		skt->socket.io_offset = (unsigned long)skt->virt_io;
  
  		skt->status = au1x00_pcmcia_skt_state(skt);
  
  		ret = pcmcia_register_socket(&skt->socket);
  		if (ret)
  			goto out_err;
  
  		WARN_ON(skt->socket.sock != i);
  
  		add_timer(&skt->poll_timer);
  	}
  
  	dev_set_drvdata(dev, sinfo);
  	return 0;
a230a6785   Om Narasimhan   [PATCH] pcmcia: a...
448
449
  
  out_err:
a230a6785   Om Narasimhan   [PATCH] pcmcia: a...
450
451
452
  	ops->hw_shutdown(skt);
  	while (i-- > 0) {
  		skt = PCMCIA_SOCKET(i);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
453
454
455
  
  		del_timer_sync(&skt->poll_timer);
  		pcmcia_unregister_socket(&skt->socket);
3efa9970b   Amol Lad   [PATCH] ioremap b...
456
457
458
459
460
461
462
463
464
465
  		if (i == 0) {
  			iounmap(skt->virt_io + (u32)mips_io_port_base);
  			skt->virt_io = NULL;
  		}
  #ifndef CONFIG_MIPS_XXS1500
  		else {
  			iounmap(skt->virt_io + (u32)mips_io_port_base);
  			skt->virt_io = NULL;
  		}
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
466
  		ops->hw_shutdown(skt);
a230a6785   Om Narasimhan   [PATCH] pcmcia: a...
467
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
468
469
470
471
  	kfree(sinfo);
  out:
  	return ret;
  }
7a192ec33   Ming Lei   platform driver: ...
472
  int au1x00_drv_pcmcia_remove(struct platform_device *dev)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
473
  {
7a192ec33   Ming Lei   platform driver: ...
474
  	struct skt_dev_info *sinfo = platform_get_drvdata(dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
475
  	int i;
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
476
  	mutex_lock(&pcmcia_sockets_lock);
7a192ec33   Ming Lei   platform driver: ...
477
  	platform_set_drvdata(dev, NULL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
478
479
480
481
482
483
  
  	for (i = 0; i < sinfo->nskt; i++) {
  		struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
  
  		del_timer_sync(&skt->poll_timer);
  		pcmcia_unregister_socket(&skt->socket);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
484
485
  		skt->ops->hw_shutdown(skt);
  		au1x00_pcmcia_config_skt(skt, &dead_socket);
efe29c0f3   Pete Popov   - moved platform ...
486
  		iounmap(skt->virt_io + (u32)mips_io_port_base);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
487
488
489
490
  		skt->virt_io = NULL;
  	}
  
  	kfree(sinfo);
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
491
  	mutex_unlock(&pcmcia_sockets_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
492
493
494
495
496
497
498
  	return 0;
  }
  
  
  /*
   * PCMCIA "Driver" API
   */
7a192ec33   Ming Lei   platform driver: ...
499
  static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
500
501
  {
  	int i, ret = -ENODEV;
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
502
  	mutex_lock(&pcmcia_sockets_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
503
  	for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) {
7a192ec33   Ming Lei   platform driver: ...
504
  		ret = au1x00_pcmcia_hw_init[i](&dev->dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
505
506
507
  		if (ret == 0)
  			break;
  	}
12d1e75d3   Matthias Kaehlcke   Alchemy Semi Au10...
508
  	mutex_unlock(&pcmcia_sockets_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
509
510
  	return ret;
  }
7a192ec33   Ming Lei   platform driver: ...
511
512
513
514
515
  static struct platform_driver au1x00_pcmcia_driver = {
  	.driver = {
  		.name		= "au1x00-pcmcia",
  		.owner		= THIS_MODULE,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
516
517
  	.probe		= au1x00_drv_pcmcia_probe,
  	.remove		= au1x00_drv_pcmcia_remove,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
518
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
519
520
521
522
523
524
525
526
527
528
529
  
  /* au1x00_pcmcia_init()
   *
   * This routine performs low-level PCMCIA initialization and then
   * registers this socket driver with Card Services.
   *
   * Returns: 0 on success, -ve error code on failure
   */
  static int __init au1x00_pcmcia_init(void)
  {
  	int error = 0;
7a192ec33   Ming Lei   platform driver: ...
530
  	error = platform_driver_register(&au1x00_pcmcia_driver);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
531
532
533
534
535
536
537
538
539
  	return error;
  }
  
  /* au1x00_pcmcia_exit()
   * Invokes the low-level kernel service to free IRQs associated with this
   * socket controller and reset GPIO edge detection.
   */
  static void __exit au1x00_pcmcia_exit(void)
  {
7a192ec33   Ming Lei   platform driver: ...
540
  	platform_driver_unregister(&au1x00_pcmcia_driver);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
541
542
543
544
  }
  
  module_init(au1x00_pcmcia_init);
  module_exit(au1x00_pcmcia_exit);