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/config.h>
14 #include <linux/types.h>
15 #include <linux/fcntl.h>
16 #include <linux/string.h>
17 #include <linux/kernel.h>
18 #include <linux/errno.h>
19 #include <linux/timer.h>
20 #include <linux/sched.h>
21 #include <linux/slab.h>
22 #include <linux/ioport.h>
23 #include <linux/delay.h>
24 #include <linux/workqueue.h>
25 #include <linux/interrupt.h>
26 #include <linux/platform_device.h>
27 #include <linux/bitops.h>
30 #include <asm/system.h>
32 #include <pcmcia/cs_types.h>
33 #include <pcmcia/ss.h>
34 #include <pcmcia/cs.h>
36 #undef MAX_IO_WIN /* FIXME */
38 #undef MAX_WIN /* FIXME */
44 static int m32r_cfc_debug;
45 module_param(m32r_cfc_debug, int, 0644);
46 #define debug(lvl, fmt, arg...) do { \
47 if (m32r_cfc_debug > (lvl)) \
48 printk(KERN_DEBUG "m32r_cfc: " fmt , ## arg); \
51 #define debug(n, args...) do { } while (0)
54 /* Poll status interval -- 0 means default to interrupt */
55 static int poll_interval = 0;
57 typedef enum pcc_space { as_none = 0, as_comm, as_attr, as_io } pcc_as_t;
59 typedef struct pcc_socket {
61 struct pcmcia_socket socket;
65 u_long base; /* PCC register base */
66 u_char cs_irq1, cs_irq2, intr;
67 pccard_io_map io_map[MAX_IO_WIN];
68 pccard_mem_map mem_map[MAX_WIN];
71 pcc_as_t current_space;
74 struct proc_dir_entry *proc;
78 static int pcc_sockets = 0;
79 static pcc_socket_t socket[M32R_MAX_PCC] = {
83 /*====================================================================*/
85 static unsigned int pcc_get(u_short, unsigned int);
86 static void pcc_set(u_short, unsigned int , unsigned int );
88 static DEFINE_SPINLOCK(pcc_lock);
90 #if !defined(CONFIG_PLAT_USRV)
91 static inline u_long pcc_port2addr(unsigned long port, int size) {
95 if (size == 1) { /* byte access */
98 addr = CFC_IO_MAPBASE_BYTE - CFC_IOPORT_BASE + odd + port;
100 addr = CFC_IO_MAPBASE_WORD - CFC_IOPORT_BASE + port;
104 #else /* CONFIG_PLAT_USRV */
105 static inline u_long pcc_port2addr(unsigned long port, int size) {
107 u_long addr = ((port - CFC_IOPORT_BASE) & 0xf000) << 8;
109 if (size == 1) { /* byte access */
113 addr = (addr | CFC_IO_MAPBASE_BYTE) + odd + (port & 0xfff);
114 } else if (size == 2) /* word access */
115 addr = (addr | CFC_IO_MAPBASE_WORD) + (port & 0xfff);
119 #endif /* CONFIG_PLAT_USRV */
121 void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size,
122 size_t nmemb, int flag)
125 unsigned char *bp = (unsigned char *)buf;
128 debug(3, "m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, "
129 "size=%u, nmemb=%d, flag=%d\n",
130 sock, port, buf, size, nmemb, flag);
132 addr = pcc_port2addr(port, 1);
134 printk("m32r_cfc:ioread_byte null port :%#lx\n",port);
137 debug(3, "m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr);
139 spin_lock_irqsave(&pcc_lock, flags);
143 spin_unlock_irqrestore(&pcc_lock, flags);
146 void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size,
147 size_t nmemb, int flag)
150 unsigned short *bp = (unsigned short *)buf;
153 debug(3, "m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, "
154 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
155 sock, port, buf, size, nmemb, flag);
158 printk("m32r_cfc: ioread_word :illigal size %u : %#lx\n", size,
161 printk("m32r_cfc: ioread_word :insw \n");
163 addr = pcc_port2addr(port, 2);
165 printk("m32r_cfc:ioread_word null port :%#lx\n",port);
168 debug(3, "m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr);
170 spin_lock_irqsave(&pcc_lock, flags);
174 spin_unlock_irqrestore(&pcc_lock, flags);
177 void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size,
178 size_t nmemb, int flag)
181 unsigned char *bp = (unsigned char *)buf;
184 debug(3, "m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, "
185 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
186 sock, port, buf, size, nmemb, flag);
189 addr = pcc_port2addr(port, 1);
191 printk("m32r_cfc:iowrite_byte null port:%#lx\n",port);
194 debug(3, "m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr);
196 spin_lock_irqsave(&pcc_lock, flags);
199 spin_unlock_irqrestore(&pcc_lock, flags);
202 void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size,
203 size_t nmemb, int flag)
206 unsigned short *bp = (unsigned short *)buf;
209 debug(3, "m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, "
210 "buf=%p, size=%u, nmemb=%d, flag=%d\n",
211 sock, port, buf, size, nmemb, flag);
214 printk("m32r_cfc: iowrite_word :illigal size %u : %#lx\n",
217 printk("m32r_cfc: iowrite_word :outsw \n");
219 addr = pcc_port2addr(port, 2);
221 printk("m32r_cfc:iowrite_word null addr :%#lx\n",port);
226 printk("m32r_cfc:iowrite_word port addr (%#lx):%#lx\n", port,
231 debug(3, "m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr);
233 spin_lock_irqsave(&pcc_lock, flags);
236 spin_unlock_irqrestore(&pcc_lock, flags);
239 /*====================================================================*/
241 #define IS_REGISTERED 0x2000
242 #define IS_ALIVE 0x8000
244 typedef struct pcc_t {
249 static pcc_t pcc[] = {
250 #if !defined(CONFIG_PLAT_USRV)
251 { "m32r_cfc", 0 }, { "", 0 },
252 #else /* CONFIG_PLAT_USRV */
253 { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "m32r_cfc", 0 },
254 { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "", 0 },
255 #endif /* CONFIG_PLAT_USRV */
258 static irqreturn_t pcc_interrupt(int, void *, struct pt_regs *);
260 /*====================================================================*/
262 static struct timer_list poll_timer;
264 static unsigned int pcc_get(u_short sock, unsigned int reg)
266 unsigned int val = inw(reg);
267 debug(3, "m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val);
272 static void pcc_set(u_short sock, unsigned int reg, unsigned int data)
275 debug(3, "m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data);
278 /*======================================================================
280 See if a card is present, powered up, in IO mode, and already
281 bound to a (non PC Card) Linux driver. We leave these alone.
283 We make an exception for cards that seem to be serial devices.
285 ======================================================================*/
287 static int __init is_alive(u_short sock)
291 debug(3, "m32r_cfc: is_alive:\n");
294 stat = pcc_get(sock, (unsigned int)PLD_CFSTS);
297 printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat);
298 debug(3, "m32r_cfc: is_alive: sock stat is 0x%04x\n", stat);
303 static void add_pcc_socket(ulong base, int irq, ulong mapaddr, kio_addr_t ioaddr)
305 pcc_socket_t *t = &socket[pcc_sockets];
307 debug(3, "m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, "
308 "mapaddr=%#lx, ioaddr=%08x\n",
309 base, irq, mapaddr, ioaddr);
313 t->mapaddr = mapaddr;
314 #if !defined(CONFIG_PLAT_USRV)
317 t->cs_irq1 = irq; // insert irq
318 t->cs_irq2 = irq + 1; // eject irq
319 #else /* CONFIG_PLAT_USRV */
322 t->cs_irq1 = 0; // insert irq
323 t->cs_irq2 = 0; // eject irq
324 #endif /* CONFIG_PLAT_USRV */
326 if (is_alive(pcc_sockets))
327 t->flags |= IS_ALIVE;
330 #if !defined(CONFIG_PLAT_USRV)
331 request_region((unsigned int)PLD_CFRSTCR, 0x20, "m32r_cfc");
332 #else /* CONFIG_PLAT_USRV */
334 unsigned int reg_base;
336 reg_base = (unsigned int)PLD_CFRSTCR;
337 reg_base |= pcc_sockets << 8;
338 request_region(reg_base, 0x20, "m32r_cfc");
340 #endif /* CONFIG_PLAT_USRV */
341 printk(KERN_INFO " %s ", pcc[pcc_sockets].name);
342 printk("pcc at 0x%08lx\n", t->base);
344 /* Update socket interrupt information, capabilities */
345 t->socket.features |= (SS_CAP_PCCARD | SS_CAP_STATIC_MAP);
346 t->socket.map_size = M32R_PCC_MAPSIZE;
347 t->socket.io_offset = ioaddr; /* use for io access offset */
348 t->socket.irq_mask = 0;
349 #if !defined(CONFIG_PLAT_USRV)
350 t->socket.pci_irq = PLD_IRQ_CFIREQ ; /* card interrupt */
351 #else /* CONFIG_PLAT_USRV */
352 t->socket.pci_irq = PLD_IRQ_CF0 + pcc_sockets;
353 #endif /* CONFIG_PLAT_USRV */
355 #ifndef CONFIG_PLAT_USRV
356 /* insert interrupt */
357 request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt);
358 #ifndef CONFIG_PLAT_MAPPI3
359 /* eject interrupt */
360 request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt);
362 debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n");
363 pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01);
364 #endif /* CONFIG_PLAT_USRV */
365 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT)
366 pcc_set(pcc_sockets, (unsigned int)PLD_CFCR1, 0x0200);
374 /*====================================================================*/
376 static irqreturn_t pcc_interrupt(int irq, void *dev, struct pt_regs *regs)
382 debug(3, "m32r_cfc: pcc_interrupt: irq=%d, dev=%p, regs=%p\n",
384 for (i = 0; i < pcc_sockets; i++) {
385 if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq)
389 debug(3, "m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ",
391 events |= SS_DETECT; /* insert or eject */
393 pcmcia_parse_events(&socket[i].socket, events);
395 debug(3, "m32r_cfc: pcc_interrupt: done\n");
397 return IRQ_RETVAL(handled);
398 } /* pcc_interrupt */
400 static void pcc_interrupt_wrapper(u_long data)
402 debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n");
403 pcc_interrupt(0, NULL, NULL);
404 init_timer(&poll_timer);
405 poll_timer.expires = jiffies + poll_interval;
406 add_timer(&poll_timer);
409 /*====================================================================*/
411 static int _pcc_get_status(u_short sock, u_int *value)
415 debug(3, "m32r_cfc: _pcc_get_status:\n");
416 status = pcc_get(sock, (unsigned int)PLD_CFSTS);
417 *value = (status) ? SS_DETECT : 0;
418 debug(3, "m32r_cfc: _pcc_get_status: status=0x%08x\n", status);
420 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT)
422 /* enable CF power */
423 status = inw((unsigned int)PLD_CPCR);
424 if (!(status & PLD_CPCR_CF)) {
425 debug(3, "m32r_cfc: _pcc_get_status: "
426 "power on (CPCR=0x%08x)\n", status);
427 status |= PLD_CPCR_CF;
428 outw(status, (unsigned int)PLD_CPCR);
431 *value |= SS_POWERON;
433 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0);/* enable buffer */
436 *value |= SS_READY; /* always ready */
439 /* disable CF power */
440 status = inw((unsigned int)PLD_CPCR);
441 status &= ~PLD_CPCR_CF;
442 outw(status, (unsigned int)PLD_CPCR);
444 debug(3, "m32r_cfc: _pcc_get_status: "
445 "power off (CPCR=0x%08x)\n", status);
447 #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
449 status = pcc_get(sock, (unsigned int)PLD_CPCR);
450 if (status == 0) { /* power off */
451 pcc_set(sock, (unsigned int)PLD_CPCR, 1);
452 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); /* force buffer off for ZA-36 */
455 *value |= SS_POWERON;
457 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0);
459 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0101);
460 udelay(25); /* for IDE reset */
461 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0100);
462 mdelay(2); /* for IDE reset */
467 /* disable CF power */
468 pcc_set(sock, (unsigned int)PLD_CPCR, 0);
470 debug(3, "m32r_cfc: _pcc_get_status: "
471 "power off (CPCR=0x%08x)\n", status);
474 #error no platform configuration
476 debug(3, "m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n",
481 /*====================================================================*/
483 static int _pcc_get_socket(u_short sock, socket_state_t *state)
485 // pcc_socket_t *t = &socket[sock];
488 state->csc_mask = SS_DETECT;
489 state->csc_mask |= SS_READY;
491 state->Vcc = 33; /* 3.3V fixed */
494 debug(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
495 "io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
496 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
500 /*====================================================================*/
502 static int _pcc_set_socket(u_short sock, socket_state_t *state)
504 debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
505 "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags,
506 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
508 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
510 if ((state->Vcc != 50) && (state->Vcc != 33))
512 /* accept 5V and 3.3V */
515 if (state->flags & SS_RESET) {
516 debug(3, ":RESET\n");
517 pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101);
519 pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100);
521 if (state->flags & SS_OUTPUT_ENA){
522 debug(3, ":OUTPUT_ENA\n");
524 pcc_set(sock,(unsigned int)PLD_CFBUFCR,0);
526 pcc_set(sock,(unsigned int)PLD_CFBUFCR,1);
530 if(state->flags & SS_IOCARD){
533 if (state->flags & SS_PWR_AUTO) {
534 debug(3, ":PWR_AUTO");
536 if (state->csc_mask & SS_DETECT)
537 debug(3, ":csc-SS_DETECT");
538 if (state->flags & SS_IOCARD) {
539 if (state->csc_mask & SS_STSCHG)
542 if (state->csc_mask & SS_BATDEAD)
543 debug(3, ":BATDEAD");
544 if (state->csc_mask & SS_BATWARN)
545 debug(3, ":BATWARN");
546 if (state->csc_mask & SS_READY)
554 /*====================================================================*/
556 static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
560 debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, "
561 "%#lx-%#lx)\n", sock, io->map, io->flags,
562 io->speed, io->start, io->stop);
568 /*====================================================================*/
570 static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
573 u_char map = mem->map;
575 pcc_socket_t *t = &socket[sock];
577 debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
578 "%#lx, %#x)\n", sock, map, mem->flags,
579 mem->speed, mem->static_start, mem->card_start);
584 if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff)){
591 if ((mem->flags & MAP_ACTIVE) == 0) {
592 t->current_space = as_none;
599 if (mem->flags & MAP_ATTRIB) {
600 t->current_space = as_attr;
602 t->current_space = as_comm;
608 addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK);
609 mem->static_start = addr + mem->card_start;
615 #if 0 /* driver model ordering issue */
616 /*======================================================================
618 Routines for accessing socket information and register dumps via
621 ======================================================================*/
623 static ssize_t show_info(struct class_device *class_dev, char *buf)
625 pcc_socket_t *s = container_of(class_dev, struct pcc_socket,
628 return sprintf(buf, "type: %s\nbase addr: 0x%08lx\n",
629 pcc[s->type].name, s->base);
632 static ssize_t show_exca(struct class_device *class_dev, char *buf)
639 static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL);
640 static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL);
643 /*====================================================================*/
645 /* this is horribly ugly... proper locking needs to be done here at
647 #define LOCKED(x) do { \
649 unsigned long flags; \
650 spin_lock_irqsave(&pcc_lock, flags); \
652 spin_unlock_irqrestore(&pcc_lock, flags); \
657 static int pcc_get_status(struct pcmcia_socket *s, u_int *value)
659 unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
661 if (socket[sock].flags & IS_ALIVE) {
662 debug(3, "m32r_cfc: pcc_get_status: sock(%d) -EINVAL\n", sock);
666 debug(3, "m32r_cfc: pcc_get_status: sock(%d)\n", sock);
667 LOCKED(_pcc_get_status(sock, value));
670 static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state)
672 unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
674 if (socket[sock].flags & IS_ALIVE) {
675 debug(3, "m32r_cfc: pcc_get_socket: sock(%d) -EINVAL\n", sock);
678 debug(3, "m32r_cfc: pcc_get_socket: sock(%d)\n", sock);
679 LOCKED(_pcc_get_socket(sock, state));
682 static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state)
684 unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
686 if (socket[sock].flags & IS_ALIVE) {
687 debug(3, "m32r_cfc: pcc_set_socket: sock(%d) -EINVAL\n", sock);
690 debug(3, "m32r_cfc: pcc_set_socket: sock(%d)\n", sock);
691 LOCKED(_pcc_set_socket(sock, state));
694 static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
696 unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
698 if (socket[sock].flags & IS_ALIVE) {
699 debug(3, "m32r_cfc: pcc_set_io_map: sock(%d) -EINVAL\n", sock);
702 debug(3, "m32r_cfc: pcc_set_io_map: sock(%d)\n", sock);
703 LOCKED(_pcc_set_io_map(sock, io));
706 static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem)
708 unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
710 if (socket[sock].flags & IS_ALIVE) {
711 debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d) -EINVAL\n", sock);
714 debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d)\n", sock);
715 LOCKED(_pcc_set_mem_map(sock, mem));
718 static int pcc_init(struct pcmcia_socket *s)
720 debug(3, "m32r_cfc: pcc_init()\n");
724 static struct pccard_operations pcc_operations = {
726 .get_status = pcc_get_status,
727 .get_socket = pcc_get_socket,
728 .set_socket = pcc_set_socket,
729 .set_io_map = pcc_set_io_map,
730 .set_mem_map = pcc_set_mem_map,
733 /*====================================================================*/
735 static struct device_driver pcc_driver = {
737 .bus = &platform_bus_type,
738 .suspend = pcmcia_socket_dev_suspend,
739 .resume = pcmcia_socket_dev_resume,
742 static struct platform_device pcc_device = {
747 /*====================================================================*/
749 static int __init init_m32r_pcc(void)
753 ret = driver_register(&pcc_driver);
757 ret = platform_device_register(&pcc_device);
759 driver_unregister(&pcc_driver);
763 #if defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
764 pcc_set(0, (unsigned int)PLD_CFCR0, 0x0f0f);
765 pcc_set(0, (unsigned int)PLD_CFCR1, 0x0200);
770 #if !defined(CONFIG_PLAT_USRV)
771 add_pcc_socket(M32R_PCC0_BASE, PLD_IRQ_CFC_INSERT, CFC_ATTR_MAPBASE,
773 #else /* CONFIG_PLAT_USRV */
778 for (i = 0 ; i < M32R_MAX_PCC ; i++) {
779 base = (ulong)PLD_CFRSTCR;
780 base = base | (i << 8);
781 ioaddr = (i + 1) << 12;
782 mapaddr = CFC_ATTR_MAPBASE | (i << 20);
783 add_pcc_socket(base, 0, mapaddr, ioaddr);
786 #endif /* CONFIG_PLAT_USRV */
788 if (pcc_sockets == 0) {
789 printk("socket is not found.\n");
790 platform_device_unregister(&pcc_device);
791 driver_unregister(&pcc_driver);
795 /* Set up interrupt handler(s) */
797 for (i = 0 ; i < pcc_sockets ; i++) {
798 socket[i].socket.dev.dev = &pcc_device.dev;
799 socket[i].socket.ops = &pcc_operations;
800 socket[i].socket.resource_ops = &pccard_nonstatic_ops;
801 socket[i].socket.owner = THIS_MODULE;
802 socket[i].number = i;
803 ret = pcmcia_register_socket(&socket[i].socket);
805 socket[i].flags |= IS_REGISTERED;
807 #if 0 /* driver model ordering issue */
808 class_device_create_file(&socket[i].socket.dev,
809 &class_device_attr_info);
810 class_device_create_file(&socket[i].socket.dev,
811 &class_device_attr_exca);
815 /* Finally, schedule a polling interrupt */
816 if (poll_interval != 0) {
817 poll_timer.function = pcc_interrupt_wrapper;
819 init_timer(&poll_timer);
820 poll_timer.expires = jiffies + poll_interval;
821 add_timer(&poll_timer);
825 } /* init_m32r_pcc */
827 static void __exit exit_m32r_pcc(void)
831 for (i = 0; i < pcc_sockets; i++)
832 if (socket[i].flags & IS_REGISTERED)
833 pcmcia_unregister_socket(&socket[i].socket);
835 platform_device_unregister(&pcc_device);
836 if (poll_interval != 0)
837 del_timer_sync(&poll_timer);
839 driver_unregister(&pcc_driver);
840 } /* exit_m32r_pcc */
842 module_init(init_m32r_pcc);
843 module_exit(exit_m32r_pcc);
844 MODULE_LICENSE("Dual MPL/GPL");
845 /*====================================================================*/