2 * drivers/pcmcia/m32r_cfc.c
4 * Device driver for the CFC functionality of M32R.
6 * Copyright (c) 2001, 2002, 2003, 2004
7 * Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara
10 #include <linux/module.h>
11 #include <linux/moduleparam.h>
12 #include <linux/init.h>
13 #include <linux/types.h>
14 #include <linux/fcntl.h>
15 #include <linux/string.h>
16 #include <linux/kernel.h>
17 #include <linux/errno.h>
18 #include <linux/timer.h>
19 #include <linux/slab.h>
20 #include <linux/ioport.h>
21 #include <linux/delay.h>
22 #include <linux/workqueue.h>
23 #include <linux/interrupt.h>
24 #include <linux/platform_device.h>
25 #include <linux/bitops.h>
28 #include <asm/system.h>
30 #include <pcmcia/cs_types.h>
31 #include <pcmcia/ss.h>
32 #include <pcmcia/cs.h>
34 #undef MAX_IO_WIN /* FIXME */
36 #undef MAX_WIN /* FIXME */
41 /* Poll status interval -- 0 means default to interrupt */
42 static int poll_interval
= 0;
44 typedef enum pcc_space
{ as_none
= 0, as_comm
, as_attr
, as_io
} pcc_as_t
;
46 typedef struct pcc_socket
{
48 struct pcmcia_socket socket
;
52 u_long base
; /* PCC register base */
53 u_char cs_irq1
, cs_irq2
, intr
;
54 pccard_io_map io_map
[MAX_IO_WIN
];
55 pccard_mem_map mem_map
[MAX_WIN
];
58 pcc_as_t current_space
;
61 struct proc_dir_entry
*proc
;
65 static int pcc_sockets
= 0;
66 static pcc_socket_t socket
[M32R_MAX_PCC
] = {
70 /*====================================================================*/
72 static unsigned int pcc_get(u_short
, unsigned int);
73 static void pcc_set(u_short
, unsigned int , unsigned int );
75 static DEFINE_SPINLOCK(pcc_lock
);
77 #if !defined(CONFIG_PLAT_USRV)
78 static inline u_long
pcc_port2addr(unsigned long port
, int size
) {
82 if (size
== 1) { /* byte access */
85 addr
= CFC_IO_MAPBASE_BYTE
- CFC_IOPORT_BASE
+ odd
+ port
;
87 addr
= CFC_IO_MAPBASE_WORD
- CFC_IOPORT_BASE
+ port
;
91 #else /* CONFIG_PLAT_USRV */
92 static inline u_long
pcc_port2addr(unsigned long port
, int size
) {
94 u_long addr
= ((port
- CFC_IOPORT_BASE
) & 0xf000) << 8;
96 if (size
== 1) { /* byte access */
100 addr
= (addr
| CFC_IO_MAPBASE_BYTE
) + odd
+ (port
& 0xfff);
101 } else if (size
== 2) /* word access */
102 addr
= (addr
| CFC_IO_MAPBASE_WORD
) + (port
& 0xfff);
106 #endif /* CONFIG_PLAT_USRV */
108 void pcc_ioread_byte(int sock
, unsigned long port
, void *buf
, size_t size
,
109 size_t nmemb
, int flag
)
112 unsigned char *bp
= (unsigned char *)buf
;
115 pr_debug("m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, "
116 "size=%u, nmemb=%d, flag=%d\n",
117 sock
, port
, buf
, size
, nmemb
, flag
);
119 addr
= pcc_port2addr(port
, 1);
121 printk("m32r_cfc:ioread_byte null port :%#lx\n",port
);
124 pr_debug("m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr
);
126 spin_lock_irqsave(&pcc_lock
, flags
);
130 spin_unlock_irqrestore(&pcc_lock
, flags
);
133 void pcc_ioread_word(int sock
, unsigned long port
, void *buf
, size_t size
,
134 size_t nmemb
, int flag
)
137 unsigned short *bp
= (unsigned short *)buf
;
140 pr_debug("m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, "
141 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
142 sock
, port
, buf
, size
, nmemb
, flag
);
145 printk("m32r_cfc: ioread_word :illigal size %u : %#lx\n", size
,
148 printk("m32r_cfc: ioread_word :insw \n");
150 addr
= pcc_port2addr(port
, 2);
152 printk("m32r_cfc:ioread_word null port :%#lx\n",port
);
155 pr_debug("m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr
);
157 spin_lock_irqsave(&pcc_lock
, flags
);
161 spin_unlock_irqrestore(&pcc_lock
, flags
);
164 void pcc_iowrite_byte(int sock
, unsigned long port
, void *buf
, size_t size
,
165 size_t nmemb
, int flag
)
168 unsigned char *bp
= (unsigned char *)buf
;
171 pr_debug("m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, "
172 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
173 sock
, port
, buf
, size
, nmemb
, flag
);
176 addr
= pcc_port2addr(port
, 1);
178 printk("m32r_cfc:iowrite_byte null port:%#lx\n",port
);
181 pr_debug("m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr
);
183 spin_lock_irqsave(&pcc_lock
, flags
);
186 spin_unlock_irqrestore(&pcc_lock
, flags
);
189 void pcc_iowrite_word(int sock
, unsigned long port
, void *buf
, size_t size
,
190 size_t nmemb
, int flag
)
193 unsigned short *bp
= (unsigned short *)buf
;
196 pr_debug("m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, "
197 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
198 sock
, port
, buf
, size
, nmemb
, flag
);
201 printk("m32r_cfc: iowrite_word :illigal size %u : %#lx\n",
204 printk("m32r_cfc: iowrite_word :outsw \n");
206 addr
= pcc_port2addr(port
, 2);
208 printk("m32r_cfc:iowrite_word null addr :%#lx\n",port
);
213 printk("m32r_cfc:iowrite_word port addr (%#lx):%#lx\n", port
,
218 pr_debug("m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr
);
220 spin_lock_irqsave(&pcc_lock
, flags
);
223 spin_unlock_irqrestore(&pcc_lock
, flags
);
226 /*====================================================================*/
228 #define IS_REGISTERED 0x2000
229 #define IS_ALIVE 0x8000
231 typedef struct pcc_t
{
236 static pcc_t pcc
[] = {
237 #if !defined(CONFIG_PLAT_USRV)
238 { "m32r_cfc", 0 }, { "", 0 },
239 #else /* CONFIG_PLAT_USRV */
240 { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "m32r_cfc", 0 },
241 { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "", 0 },
242 #endif /* CONFIG_PLAT_USRV */
245 static irqreturn_t
pcc_interrupt(int, void *);
247 /*====================================================================*/
249 static struct timer_list poll_timer
;
251 static unsigned int pcc_get(u_short sock
, unsigned int reg
)
253 unsigned int val
= inw(reg
);
254 pr_debug("m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg
, val
);
259 static void pcc_set(u_short sock
, unsigned int reg
, unsigned int data
)
262 pr_debug("m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg
, data
);
265 /*======================================================================
267 See if a card is present, powered up, in IO mode, and already
268 bound to a (non PC Card) Linux driver. We leave these alone.
270 We make an exception for cards that seem to be serial devices.
272 ======================================================================*/
274 static int __init
is_alive(u_short sock
)
278 pr_debug("m32r_cfc: is_alive:\n");
281 stat
= pcc_get(sock
, (unsigned int)PLD_CFSTS
);
284 printk("Card is detected at socket %d : stat = 0x%08x\n", sock
, stat
);
285 pr_debug("m32r_cfc: is_alive: sock stat is 0x%04x\n", stat
);
290 static void add_pcc_socket(ulong base
, int irq
, ulong mapaddr
,
293 pcc_socket_t
*t
= &socket
[pcc_sockets
];
295 pr_debug("m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, "
296 "mapaddr=%#lx, ioaddr=%08x\n",
297 base
, irq
, mapaddr
, ioaddr
);
301 t
->mapaddr
= mapaddr
;
302 #if !defined(CONFIG_PLAT_USRV)
305 t
->cs_irq1
= irq
; // insert irq
306 t
->cs_irq2
= irq
+ 1; // eject irq
307 #else /* CONFIG_PLAT_USRV */
310 t
->cs_irq1
= 0; // insert irq
311 t
->cs_irq2
= 0; // eject irq
312 #endif /* CONFIG_PLAT_USRV */
314 if (is_alive(pcc_sockets
))
315 t
->flags
|= IS_ALIVE
;
318 #if !defined(CONFIG_PLAT_USRV)
319 request_region((unsigned int)PLD_CFRSTCR
, 0x20, "m32r_cfc");
320 #else /* CONFIG_PLAT_USRV */
322 unsigned int reg_base
;
324 reg_base
= (unsigned int)PLD_CFRSTCR
;
325 reg_base
|= pcc_sockets
<< 8;
326 request_region(reg_base
, 0x20, "m32r_cfc");
328 #endif /* CONFIG_PLAT_USRV */
329 printk(KERN_INFO
" %s ", pcc
[pcc_sockets
].name
);
330 printk("pcc at 0x%08lx\n", t
->base
);
332 /* Update socket interrupt information, capabilities */
333 t
->socket
.features
|= (SS_CAP_PCCARD
| SS_CAP_STATIC_MAP
);
334 t
->socket
.map_size
= M32R_PCC_MAPSIZE
;
335 t
->socket
.io_offset
= ioaddr
; /* use for io access offset */
336 t
->socket
.irq_mask
= 0;
337 #if !defined(CONFIG_PLAT_USRV)
338 t
->socket
.pci_irq
= PLD_IRQ_CFIREQ
; /* card interrupt */
339 #else /* CONFIG_PLAT_USRV */
340 t
->socket
.pci_irq
= PLD_IRQ_CF0
+ pcc_sockets
;
341 #endif /* CONFIG_PLAT_USRV */
343 #ifndef CONFIG_PLAT_USRV
344 /* insert interrupt */
345 request_irq(irq
, pcc_interrupt
, 0, "m32r_cfc", pcc_interrupt
);
346 #ifndef CONFIG_PLAT_MAPPI3
347 /* eject interrupt */
348 request_irq(irq
+1, pcc_interrupt
, 0, "m32r_cfc", pcc_interrupt
);
350 pr_debug("m32r_cfc: enable CFMSK, RDYSEL\n");
351 pcc_set(pcc_sockets
, (unsigned int)PLD_CFIMASK
, 0x01);
352 #endif /* CONFIG_PLAT_USRV */
353 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT)
354 pcc_set(pcc_sockets
, (unsigned int)PLD_CFCR1
, 0x0200);
362 /*====================================================================*/
364 static irqreturn_t
pcc_interrupt(int irq
, void *dev
)
370 pr_debug("m32r_cfc: pcc_interrupt: irq=%d, dev=%p\n", irq
, dev
);
371 for (i
= 0; i
< pcc_sockets
; i
++) {
372 if (socket
[i
].cs_irq1
!= irq
&& socket
[i
].cs_irq2
!= irq
)
376 pr_debug("m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ",
378 events
|= SS_DETECT
; /* insert or eject */
380 pcmcia_parse_events(&socket
[i
].socket
, events
);
382 pr_debug("m32r_cfc: pcc_interrupt: done\n");
384 return IRQ_RETVAL(handled
);
385 } /* pcc_interrupt */
387 static void pcc_interrupt_wrapper(u_long data
)
389 pr_debug("m32r_cfc: pcc_interrupt_wrapper:\n");
390 pcc_interrupt(0, NULL
);
391 init_timer(&poll_timer
);
392 poll_timer
.expires
= jiffies
+ poll_interval
;
393 add_timer(&poll_timer
);
396 /*====================================================================*/
398 static int _pcc_get_status(u_short sock
, u_int
*value
)
402 pr_debug("m32r_cfc: _pcc_get_status:\n");
403 status
= pcc_get(sock
, (unsigned int)PLD_CFSTS
);
404 *value
= (status
) ? SS_DETECT
: 0;
405 pr_debug("m32r_cfc: _pcc_get_status: status=0x%08x\n", status
);
407 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT)
409 /* enable CF power */
410 status
= inw((unsigned int)PLD_CPCR
);
411 if (!(status
& PLD_CPCR_CF
)) {
412 pr_debug("m32r_cfc: _pcc_get_status: "
413 "power on (CPCR=0x%08x)\n", status
);
414 status
|= PLD_CPCR_CF
;
415 outw(status
, (unsigned int)PLD_CPCR
);
418 *value
|= SS_POWERON
;
420 pcc_set(sock
, (unsigned int)PLD_CFBUFCR
,0);/* enable buffer */
423 *value
|= SS_READY
; /* always ready */
426 /* disable CF power */
427 status
= inw((unsigned int)PLD_CPCR
);
428 status
&= ~PLD_CPCR_CF
;
429 outw(status
, (unsigned int)PLD_CPCR
);
431 pr_debug("m32r_cfc: _pcc_get_status: "
432 "power off (CPCR=0x%08x)\n", status
);
434 #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
436 status
= pcc_get(sock
, (unsigned int)PLD_CPCR
);
437 if (status
== 0) { /* power off */
438 pcc_set(sock
, (unsigned int)PLD_CPCR
, 1);
439 pcc_set(sock
, (unsigned int)PLD_CFBUFCR
,0); /* force buffer off for ZA-36 */
442 *value
|= SS_POWERON
;
444 pcc_set(sock
, (unsigned int)PLD_CFBUFCR
,0);
446 pcc_set(sock
, (unsigned int)PLD_CFRSTCR
, 0x0101);
447 udelay(25); /* for IDE reset */
448 pcc_set(sock
, (unsigned int)PLD_CFRSTCR
, 0x0100);
449 mdelay(2); /* for IDE reset */
454 /* disable CF power */
455 pcc_set(sock
, (unsigned int)PLD_CPCR
, 0);
457 pr_debug("m32r_cfc: _pcc_get_status: "
458 "power off (CPCR=0x%08x)\n", status
);
461 #error no platform configuration
463 pr_debug("m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n",
468 /*====================================================================*/
470 static int _pcc_set_socket(u_short sock
, socket_state_t
*state
)
472 pr_debug("m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
473 "io_irq %d, csc_mask %#2.2x)\n", sock
, state
->flags
,
474 state
->Vcc
, state
->Vpp
, state
->io_irq
, state
->csc_mask
);
476 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
478 if ((state
->Vcc
!= 50) && (state
->Vcc
!= 33))
480 /* accept 5V and 3.3V */
483 if (state
->flags
& SS_RESET
) {
484 pr_debug(":RESET\n");
485 pcc_set(sock
,(unsigned int)PLD_CFRSTCR
,0x101);
487 pcc_set(sock
,(unsigned int)PLD_CFRSTCR
,0x100);
489 if (state
->flags
& SS_OUTPUT_ENA
){
490 pr_debug(":OUTPUT_ENA\n");
492 pcc_set(sock
,(unsigned int)PLD_CFBUFCR
,0);
494 pcc_set(sock
,(unsigned int)PLD_CFBUFCR
,1);
497 if(state
->flags
& SS_IOCARD
){
500 if (state
->flags
& SS_PWR_AUTO
) {
501 pr_debug(":PWR_AUTO");
503 if (state
->csc_mask
& SS_DETECT
)
504 pr_debug(":csc-SS_DETECT");
505 if (state
->flags
& SS_IOCARD
) {
506 if (state
->csc_mask
& SS_STSCHG
)
509 if (state
->csc_mask
& SS_BATDEAD
)
510 pr_debug(":BATDEAD");
511 if (state
->csc_mask
& SS_BATWARN
)
512 pr_debug(":BATWARN");
513 if (state
->csc_mask
& SS_READY
)
520 /*====================================================================*/
522 static int _pcc_set_io_map(u_short sock
, struct pccard_io_map
*io
)
526 pr_debug("m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, "
527 "%#llx-%#llx)\n", sock
, io
->map
, io
->flags
,
528 io
->speed
, (unsigned long long)io
->start
,
529 (unsigned long long)io
->stop
);
535 /*====================================================================*/
537 static int _pcc_set_mem_map(u_short sock
, struct pccard_mem_map
*mem
)
540 u_char map
= mem
->map
;
542 pcc_socket_t
*t
= &socket
[sock
];
544 pr_debug("m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
545 "%#llx, %#x)\n", sock
, map
, mem
->flags
,
546 mem
->speed
, (unsigned long long)mem
->static_start
,
552 if ((map
> MAX_WIN
) || (mem
->card_start
> 0x3ffffff)){
559 if ((mem
->flags
& MAP_ACTIVE
) == 0) {
560 t
->current_space
= as_none
;
567 if (mem
->flags
& MAP_ATTRIB
) {
568 t
->current_space
= as_attr
;
570 t
->current_space
= as_comm
;
576 addr
= t
->mapaddr
+ (mem
->card_start
& M32R_PCC_MAPMASK
);
577 mem
->static_start
= addr
+ mem
->card_start
;
583 #if 0 /* driver model ordering issue */
584 /*======================================================================
586 Routines for accessing socket information and register dumps via
589 ======================================================================*/
591 static ssize_t
show_info(struct class_device
*class_dev
, char *buf
)
593 pcc_socket_t
*s
= container_of(class_dev
, struct pcc_socket
,
596 return sprintf(buf
, "type: %s\nbase addr: 0x%08lx\n",
597 pcc
[s
->type
].name
, s
->base
);
600 static ssize_t
show_exca(struct class_device
*class_dev
, char *buf
)
607 static CLASS_DEVICE_ATTR(info
, S_IRUGO
, show_info
, NULL
);
608 static CLASS_DEVICE_ATTR(exca
, S_IRUGO
, show_exca
, NULL
);
611 /*====================================================================*/
613 /* this is horribly ugly... proper locking needs to be done here at
615 #define LOCKED(x) do { \
617 unsigned long flags; \
618 spin_lock_irqsave(&pcc_lock, flags); \
620 spin_unlock_irqrestore(&pcc_lock, flags); \
625 static int pcc_get_status(struct pcmcia_socket
*s
, u_int
*value
)
627 unsigned int sock
= container_of(s
, struct pcc_socket
, socket
)->number
;
629 if (socket
[sock
].flags
& IS_ALIVE
) {
630 dev_dbg(&s
->dev
, "pcc_get_status: sock(%d) -EINVAL\n", sock
);
634 dev_dbg(&s
->dev
, "pcc_get_status: sock(%d)\n", sock
);
635 LOCKED(_pcc_get_status(sock
, value
));
638 static int pcc_set_socket(struct pcmcia_socket
*s
, socket_state_t
*state
)
640 unsigned int sock
= container_of(s
, struct pcc_socket
, socket
)->number
;
642 if (socket
[sock
].flags
& IS_ALIVE
) {
643 dev_dbg(&s
->dev
, "pcc_set_socket: sock(%d) -EINVAL\n", sock
);
646 dev_dbg(&s
->dev
, "pcc_set_socket: sock(%d)\n", sock
);
647 LOCKED(_pcc_set_socket(sock
, state
));
650 static int pcc_set_io_map(struct pcmcia_socket
*s
, struct pccard_io_map
*io
)
652 unsigned int sock
= container_of(s
, struct pcc_socket
, socket
)->number
;
654 if (socket
[sock
].flags
& IS_ALIVE
) {
655 dev_dbg(&s
->dev
, "pcc_set_io_map: sock(%d) -EINVAL\n", sock
);
658 dev_dbg(&s
->dev
, "pcc_set_io_map: sock(%d)\n", sock
);
659 LOCKED(_pcc_set_io_map(sock
, io
));
662 static int pcc_set_mem_map(struct pcmcia_socket
*s
, struct pccard_mem_map
*mem
)
664 unsigned int sock
= container_of(s
, struct pcc_socket
, socket
)->number
;
666 if (socket
[sock
].flags
& IS_ALIVE
) {
667 dev_dbg(&s
->dev
, "pcc_set_mem_map: sock(%d) -EINVAL\n", sock
);
670 dev_dbg(&s
->dev
, "pcc_set_mem_map: sock(%d)\n", sock
);
671 LOCKED(_pcc_set_mem_map(sock
, mem
));
674 static int pcc_init(struct pcmcia_socket
*s
)
676 dev_dbg(&s
->dev
, "pcc_init()\n");
680 static struct pccard_operations pcc_operations
= {
682 .get_status
= pcc_get_status
,
683 .set_socket
= pcc_set_socket
,
684 .set_io_map
= pcc_set_io_map
,
685 .set_mem_map
= pcc_set_mem_map
,
688 static int cfc_drv_pcmcia_suspend(struct platform_device
*dev
,
691 return pcmcia_socket_dev_suspend(&dev
->dev
);
694 static int cfc_drv_pcmcia_resume(struct platform_device
*dev
)
696 return pcmcia_socket_dev_resume(&dev
->dev
);
698 /*====================================================================*/
700 static struct platform_driver pcc_driver
= {
703 .owner
= THIS_MODULE
,
705 .suspend
= cfc_drv_pcmcia_suspend
,
706 .resume
= cfc_drv_pcmcia_resume
,
709 static struct platform_device pcc_device
= {
714 /*====================================================================*/
716 static int __init
init_m32r_pcc(void)
720 ret
= platform_driver_register(&pcc_driver
);
724 ret
= platform_device_register(&pcc_device
);
726 platform_driver_unregister(&pcc_driver
);
730 #if defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
731 pcc_set(0, (unsigned int)PLD_CFCR0
, 0x0f0f);
732 pcc_set(0, (unsigned int)PLD_CFCR1
, 0x0200);
737 #if !defined(CONFIG_PLAT_USRV)
738 add_pcc_socket(M32R_PCC0_BASE
, PLD_IRQ_CFC_INSERT
, CFC_ATTR_MAPBASE
,
740 #else /* CONFIG_PLAT_USRV */
745 for (i
= 0 ; i
< M32R_MAX_PCC
; i
++) {
746 base
= (ulong
)PLD_CFRSTCR
;
747 base
= base
| (i
<< 8);
748 ioaddr
= (i
+ 1) << 12;
749 mapaddr
= CFC_ATTR_MAPBASE
| (i
<< 20);
750 add_pcc_socket(base
, 0, mapaddr
, ioaddr
);
753 #endif /* CONFIG_PLAT_USRV */
755 if (pcc_sockets
== 0) {
756 printk("socket is not found.\n");
757 platform_device_unregister(&pcc_device
);
758 platform_driver_unregister(&pcc_driver
);
762 /* Set up interrupt handler(s) */
764 for (i
= 0 ; i
< pcc_sockets
; i
++) {
765 socket
[i
].socket
.dev
.parent
= &pcc_device
.dev
;
766 socket
[i
].socket
.ops
= &pcc_operations
;
767 socket
[i
].socket
.resource_ops
= &pccard_nonstatic_ops
;
768 socket
[i
].socket
.owner
= THIS_MODULE
;
769 socket
[i
].number
= i
;
770 ret
= pcmcia_register_socket(&socket
[i
].socket
);
772 socket
[i
].flags
|= IS_REGISTERED
;
774 #if 0 /* driver model ordering issue */
775 class_device_create_file(&socket
[i
].socket
.dev
,
776 &class_device_attr_info
);
777 class_device_create_file(&socket
[i
].socket
.dev
,
778 &class_device_attr_exca
);
782 /* Finally, schedule a polling interrupt */
783 if (poll_interval
!= 0) {
784 poll_timer
.function
= pcc_interrupt_wrapper
;
786 init_timer(&poll_timer
);
787 poll_timer
.expires
= jiffies
+ poll_interval
;
788 add_timer(&poll_timer
);
792 } /* init_m32r_pcc */
794 static void __exit
exit_m32r_pcc(void)
798 for (i
= 0; i
< pcc_sockets
; i
++)
799 if (socket
[i
].flags
& IS_REGISTERED
)
800 pcmcia_unregister_socket(&socket
[i
].socket
);
802 platform_device_unregister(&pcc_device
);
803 if (poll_interval
!= 0)
804 del_timer_sync(&poll_timer
);
806 platform_driver_unregister(&pcc_driver
);
807 } /* exit_m32r_pcc */
809 module_init(init_m32r_pcc
);
810 module_exit(exit_m32r_pcc
);
811 MODULE_LICENSE("Dual MPL/GPL");
812 /*====================================================================*/