2 * Regular cardbus driver ("yenta_socket")
4 * (C) Copyright 1999, 2000 Linus Torvalds
7 * Aug 2002: Manfred Spraul <manfred@colorfullife.com>
8 * Dynamically adjust the size of the bridge resource
10 * May 2003: Dominik Brodowski <linux@brodo.de>
11 * Merge pci_socket.c and yenta.c into one file
13 #include <linux/init.h>
14 #include <linux/pci.h>
15 #include <linux/sched.h>
16 #include <linux/workqueue.h>
17 #include <linux/interrupt.h>
18 #include <linux/delay.h>
19 #include <linux/module.h>
21 #include <pcmcia/cs_types.h>
22 #include <pcmcia/ss.h>
23 #include <pcmcia/cs.h>
27 #include "yenta_socket.h"
30 static int disable_clkrun;
31 module_param(disable_clkrun, bool, 0444);
32 MODULE_PARM_DESC(disable_clkrun, "If PC card doesn't function properly, please try this option");
34 static int isa_probe = 1;
35 module_param(isa_probe, bool, 0444);
36 MODULE_PARM_DESC(isa_probe, "If set ISA interrupts are probed (default). Set to N to disable probing");
38 static int pwr_irqs_off;
39 module_param(pwr_irqs_off, bool, 0644);
40 MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!");
43 #define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args)
45 #define debug(x,args...)
49 #define to_cycles(ns) ((ns)/120)
50 #define to_ns(cycles) ((cycles)*120)
53 * yenta PCI irq probing.
54 * currently only used in the TI/EnE initialization code
56 #ifdef CONFIG_YENTA_TI
57 static int yenta_probe_cb_irq(struct yenta_socket *socket);
61 static unsigned int override_bios;
62 module_param(override_bios, uint, 0000);
63 MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation");
66 * Generate easy-to-use ways of reading a cardbus sockets
67 * regular memory space ("cb_xxx"), configuration space
68 * ("config_xxx") and compatibility space ("exca_xxxx")
70 static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg)
72 u32 val = readl(socket->base + reg);
73 debug("%p %04x %08x\n", socket, reg, val);
77 static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val)
79 debug("%p %04x %08x\n", socket, reg, val);
80 writel(val, socket->base + reg);
81 readl(socket->base + reg); /* avoid problems with PCI write posting */
84 static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
87 pci_read_config_byte(socket->dev, offset, &val);
88 debug("%p %04x %02x\n", socket, offset, val);
92 static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
95 pci_read_config_word(socket->dev, offset, &val);
96 debug("%p %04x %04x\n", socket, offset, val);
100 static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
103 pci_read_config_dword(socket->dev, offset, &val);
104 debug("%p %04x %08x\n", socket, offset, val);
108 static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val)
110 debug("%p %04x %02x\n", socket, offset, val);
111 pci_write_config_byte(socket->dev, offset, val);
114 static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val)
116 debug("%p %04x %04x\n", socket, offset, val);
117 pci_write_config_word(socket->dev, offset, val);
120 static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val)
122 debug("%p %04x %08x\n", socket, offset, val);
123 pci_write_config_dword(socket->dev, offset, val);
126 static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg)
128 u8 val = readb(socket->base + 0x800 + reg);
129 debug("%p %04x %02x\n", socket, reg, val);
133 static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
136 val = readb(socket->base + 0x800 + reg);
137 val |= readb(socket->base + 0x800 + reg + 1) << 8;
138 debug("%p %04x %04x\n", socket, reg, val);
142 static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val)
144 debug("%p %04x %02x\n", socket, reg, val);
145 writeb(val, socket->base + 0x800 + reg);
146 readb(socket->base + 0x800 + reg); /* PCI write posting... */
149 static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val)
151 debug("%p %04x %04x\n", socket, reg, val);
152 writeb(val, socket->base + 0x800 + reg);
153 writeb(val >> 8, socket->base + 0x800 + reg + 1);
155 /* PCI write posting... */
156 readb(socket->base + 0x800 + reg);
157 readb(socket->base + 0x800 + reg + 1);
160 static ssize_t show_yenta_registers(struct device *yentadev, struct device_attribute *attr, char *buf)
162 struct pci_dev *dev = to_pci_dev(yentadev);
163 struct yenta_socket *socket = pci_get_drvdata(dev);
166 offset = snprintf(buf, PAGE_SIZE, "CB registers:");
167 for (i = 0; i < 0x24; i += 4) {
170 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n%02x:", i);
171 val = cb_readl(socket, i);
172 offset += snprintf(buf + offset, PAGE_SIZE - offset, " %08x", val);
175 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n\nExCA registers:");
176 for (i = 0; i < 0x45; i++) {
180 memcpy(buf + offset, " -", 2);
183 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n%02x:", i);
185 val = exca_readb(socket, i);
186 offset += snprintf(buf + offset, PAGE_SIZE - offset, " %02x", val);
188 buf[offset++] = '\n';
192 static DEVICE_ATTR(yenta_registers, S_IRUSR, show_yenta_registers, NULL);
195 * Ugh, mixed-mode cardbus and 16-bit pccard state: things depend
196 * on what kind of card is inserted..
198 static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
200 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
202 u32 state = cb_readl(socket, CB_SOCKET_STATE);
204 val = (state & CB_3VCARD) ? SS_3VCARD : 0;
205 val |= (state & CB_XVCARD) ? SS_XVCARD : 0;
206 val |= (state & (CB_5VCARD | CB_3VCARD | CB_XVCARD | CB_YVCARD)) ? 0 : SS_PENDING;
207 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? SS_PENDING : 0;
210 if (state & CB_CBCARD) {
212 val |= (state & CB_CARDSTS) ? SS_STSCHG : 0;
213 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT;
214 val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0;
215 } else if (state & CB_16BITCARD) {
216 u8 status = exca_readb(socket, I365_STATUS);
217 val |= ((status & I365_CS_DETECT) == I365_CS_DETECT) ? SS_DETECT : 0;
218 if (exca_readb(socket, I365_INTCTL) & I365_PC_IOCARD) {
219 val |= (status & I365_CS_STSCHG) ? 0 : SS_STSCHG;
221 val |= (status & I365_CS_BVD1) ? 0 : SS_BATDEAD;
222 val |= (status & I365_CS_BVD2) ? 0 : SS_BATWARN;
224 val |= (status & I365_CS_WRPROT) ? SS_WRPROT : 0;
225 val |= (status & I365_CS_READY) ? SS_READY : 0;
226 val |= (status & I365_CS_POWERON) ? SS_POWERON : 0;
233 static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state)
235 /* some birdges require to use the ExCA registers to power 16bit cards */
236 if (!(cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) &&
237 (socket->flags & YENTA_16BIT_POWER_EXCA)) {
239 reg = old = exca_readb(socket, I365_POWER);
240 reg &= ~(I365_VCC_MASK | I365_VPP1_MASK | I365_VPP2_MASK);
242 /* i82365SL-DF style */
243 if (socket->flags & YENTA_16BIT_POWER_DF) {
244 switch (state->Vcc) {
245 case 33: reg |= I365_VCC_3V; break;
246 case 50: reg |= I365_VCC_5V; break;
247 default: reg = 0; break;
249 switch (state->Vpp) {
251 case 50: reg |= I365_VPP1_5V; break;
252 case 120: reg |= I365_VPP1_12V; break;
255 /* i82365SL-B style */
256 switch (state->Vcc) {
257 case 50: reg |= I365_VCC_5V; break;
258 default: reg = 0; break;
260 switch (state->Vpp) {
261 case 50: reg |= I365_VPP1_5V | I365_VPP2_5V; break;
262 case 120: reg |= I365_VPP1_12V | I365_VPP2_12V; break;
267 exca_writeb(socket, I365_POWER, reg);
269 u32 reg = 0; /* CB_SC_STPCLK? */
270 switch (state->Vcc) {
271 case 33: reg = CB_SC_VCC_3V; break;
272 case 50: reg = CB_SC_VCC_5V; break;
273 default: reg = 0; break;
275 switch (state->Vpp) {
276 case 33: reg |= CB_SC_VPP_3V; break;
277 case 50: reg |= CB_SC_VPP_5V; break;
278 case 120: reg |= CB_SC_VPP_12V; break;
280 if (reg != cb_readl(socket, CB_SOCKET_CONTROL))
281 cb_writel(socket, CB_SOCKET_CONTROL, reg);
285 static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
287 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
290 /* if powering down: do it immediately */
292 yenta_set_power(socket, state);
294 socket->io_irq = state->io_irq;
295 bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR);
296 if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) {
298 bridge |= (state->flags & SS_RESET) ? CB_BRIDGE_CRST : 0;
300 /* ISA interrupt control? */
301 intr = exca_readb(socket, I365_INTCTL);
302 intr = (intr & ~0xf);
303 if (!socket->cb_irq) {
304 intr |= state->io_irq;
305 bridge |= CB_BRIDGE_INTR;
307 exca_writeb(socket, I365_INTCTL, intr);
311 reg = exca_readb(socket, I365_INTCTL) & (I365_RING_ENA | I365_INTR_ENA);
312 reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET;
313 reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0;
314 if (state->io_irq != socket->cb_irq) {
315 reg |= state->io_irq;
316 bridge |= CB_BRIDGE_INTR;
318 exca_writeb(socket, I365_INTCTL, reg);
320 reg = exca_readb(socket, I365_POWER) & (I365_VCC_MASK|I365_VPP1_MASK);
321 reg |= I365_PWR_NORESET;
322 if (state->flags & SS_PWR_AUTO) reg |= I365_PWR_AUTO;
323 if (state->flags & SS_OUTPUT_ENA) reg |= I365_PWR_OUT;
324 if (exca_readb(socket, I365_POWER) != reg)
325 exca_writeb(socket, I365_POWER, reg);
327 /* CSC interrupt: no ISA irq for CSC */
328 reg = I365_CSC_DETECT;
329 if (state->flags & SS_IOCARD) {
330 if (state->csc_mask & SS_STSCHG) reg |= I365_CSC_STSCHG;
332 if (state->csc_mask & SS_BATDEAD) reg |= I365_CSC_BVD1;
333 if (state->csc_mask & SS_BATWARN) reg |= I365_CSC_BVD2;
334 if (state->csc_mask & SS_READY) reg |= I365_CSC_READY;
336 exca_writeb(socket, I365_CSCINT, reg);
337 exca_readb(socket, I365_CSC);
339 sock->zoom_video(sock, state->flags & SS_ZVCARD);
341 config_writew(socket, CB_BRIDGE_CONTROL, bridge);
342 /* Socket event mask: get card insert/remove events.. */
343 cb_writel(socket, CB_SOCKET_EVENT, -1);
344 cb_writel(socket, CB_SOCKET_MASK, CB_CDMASK);
346 /* if powering up: do it as the last step when the socket is configured */
348 yenta_set_power(socket, state);
352 static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
354 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
356 unsigned char ioctl, addr, enable;
363 enable = I365_ENA_IO(map);
364 addr = exca_readb(socket, I365_ADDRWIN);
366 /* Disable the window before changing it.. */
369 exca_writeb(socket, I365_ADDRWIN, addr);
372 exca_writew(socket, I365_IO(map)+I365_W_START, io->start);
373 exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop);
375 ioctl = exca_readb(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map);
376 if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map);
377 if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map);
378 if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map);
379 exca_writeb(socket, I365_IOCTL, ioctl);
381 if (io->flags & MAP_ACTIVE)
382 exca_writeb(socket, I365_ADDRWIN, addr | enable);
386 static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
388 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
389 struct pci_bus_region region;
391 unsigned char addr, enable;
392 unsigned int start, stop, card_start;
395 pcibios_resource_to_bus(socket->dev, ®ion, mem->res);
398 start = region.start;
400 card_start = mem->card_start;
402 if (map > 4 || start > stop || ((start ^ stop) >> 24) ||
403 (card_start >> 26) || mem->speed > 1000)
406 enable = I365_ENA_MEM(map);
407 addr = exca_readb(socket, I365_ADDRWIN);
410 exca_writeb(socket, I365_ADDRWIN, addr);
413 exca_writeb(socket, CB_MEM_PAGE(map), start >> 24);
415 word = (start >> 12) & 0x0fff;
416 if (mem->flags & MAP_16BIT)
417 word |= I365_MEM_16BIT;
418 if (mem->flags & MAP_0WS)
419 word |= I365_MEM_0WS;
420 exca_writew(socket, I365_MEM(map) + I365_W_START, word);
422 word = (stop >> 12) & 0x0fff;
423 switch (to_cycles(mem->speed)) {
425 case 1: word |= I365_MEM_WS0; break;
426 case 2: word |= I365_MEM_WS1; break;
427 default: word |= I365_MEM_WS1 | I365_MEM_WS0; break;
429 exca_writew(socket, I365_MEM(map) + I365_W_STOP, word);
431 word = ((card_start - start) >> 12) & 0x3fff;
432 if (mem->flags & MAP_WRPROT)
433 word |= I365_MEM_WRPROT;
434 if (mem->flags & MAP_ATTRIB)
435 word |= I365_MEM_REG;
436 exca_writew(socket, I365_MEM(map) + I365_W_OFF, word);
438 if (mem->flags & MAP_ACTIVE)
439 exca_writeb(socket, I365_ADDRWIN, addr | enable);
445 static irqreturn_t yenta_interrupt(int irq, void *dev_id)
448 struct yenta_socket *socket = (struct yenta_socket *) dev_id;
452 /* Clear interrupt status for the event */
453 cb_event = cb_readl(socket, CB_SOCKET_EVENT);
454 cb_writel(socket, CB_SOCKET_EVENT, cb_event);
456 csc = exca_readb(socket, I365_CSC);
458 if (!(cb_event || csc))
461 events = (cb_event & (CB_CD1EVENT | CB_CD2EVENT)) ? SS_DETECT : 0 ;
462 events |= (csc & I365_CSC_DETECT) ? SS_DETECT : 0;
463 if (exca_readb(socket, I365_INTCTL) & I365_PC_IOCARD) {
464 events |= (csc & I365_CSC_STSCHG) ? SS_STSCHG : 0;
466 events |= (csc & I365_CSC_BVD1) ? SS_BATDEAD : 0;
467 events |= (csc & I365_CSC_BVD2) ? SS_BATWARN : 0;
468 events |= (csc & I365_CSC_READY) ? SS_READY : 0;
472 pcmcia_parse_events(&socket->socket, events);
477 static void yenta_interrupt_wrapper(unsigned long data)
479 struct yenta_socket *socket = (struct yenta_socket *) data;
481 yenta_interrupt(0, (void *)socket);
482 socket->poll_timer.expires = jiffies + HZ;
483 add_timer(&socket->poll_timer);
486 static void yenta_clear_maps(struct yenta_socket *socket)
489 struct resource res = { .start = 0, .end = 0x0fff };
490 pccard_io_map io = { 0, 0, 0, 0, 1 };
491 pccard_mem_map mem = { .res = &res, };
493 yenta_set_socket(&socket->socket, &dead_socket);
494 for (i = 0; i < 2; i++) {
496 yenta_set_io_map(&socket->socket, &io);
498 for (i = 0; i < 5; i++) {
500 yenta_set_mem_map(&socket->socket, &mem);
504 /* redoes voltage interrogation if required */
505 static void yenta_interrogate(struct yenta_socket *socket)
509 state = cb_readl(socket, CB_SOCKET_STATE);
510 if (!(state & (CB_5VCARD | CB_3VCARD | CB_XVCARD | CB_YVCARD)) ||
511 (state & (CB_CDETECT1 | CB_CDETECT2 | CB_NOTACARD | CB_BADVCCREQ)) ||
512 ((state & (CB_16BITCARD | CB_CBCARD)) == (CB_16BITCARD | CB_CBCARD)))
513 cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);
516 /* Called at resume and initialization events */
517 static int yenta_sock_init(struct pcmcia_socket *sock)
519 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
521 exca_writeb(socket, I365_GBLCTL, 0x00);
522 exca_writeb(socket, I365_GENCTL, 0x00);
524 /* Redo card voltage interrogation */
525 yenta_interrogate(socket);
527 yenta_clear_maps(socket);
529 if (socket->type && socket->type->sock_init)
530 socket->type->sock_init(socket);
532 /* Re-enable CSC interrupts */
533 cb_writel(socket, CB_SOCKET_MASK, CB_CDMASK);
538 static int yenta_sock_suspend(struct pcmcia_socket *sock)
540 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
542 /* Disable CSC interrupts */
543 cb_writel(socket, CB_SOCKET_MASK, 0x0);
549 * Use an adaptive allocation for the memory resource,
550 * sometimes the memory behind pci bridges is limited:
551 * 1/8 of the size of the io window of the parent.
552 * max 4 MB, min 16 kB. We try very hard to not get below
553 * the "ACC" values, though.
555 #define BRIDGE_MEM_MAX 4*1024*1024
556 #define BRIDGE_MEM_ACC 128*1024
557 #define BRIDGE_MEM_MIN 16*1024
559 #define BRIDGE_IO_MAX 512
560 #define BRIDGE_IO_ACC 256
561 #define BRIDGE_IO_MIN 32
563 #ifndef PCIBIOS_MIN_CARDBUS_IO
564 #define PCIBIOS_MIN_CARDBUS_IO PCIBIOS_MIN_IO
567 static int yenta_search_one_res(struct resource *root, struct resource *res,
570 u32 align, size, start, end;
572 if (res->flags & IORESOURCE_IO) {
574 size = BRIDGE_IO_MAX;
575 start = PCIBIOS_MIN_CARDBUS_IO;
578 unsigned long avail = root->end - root->start;
580 size = BRIDGE_MEM_MAX;
581 if (size > avail/8) {
583 /* round size down to next power of 2 */
585 while ((size /= 2) != 0)
592 start = PCIBIOS_MIN_MEM;
597 if (allocate_resource(root, res, size, start, end, align,
603 } while (size >= min);
609 static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
613 for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) {
614 struct resource * root = socket->dev->bus->resource[i];
618 if ((res->flags ^ root->flags) &
619 (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH))
620 continue; /* Wrong type */
622 if (yenta_search_one_res(root, res, min))
628 static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
630 struct resource *root, *res;
631 struct pci_bus_region region;
634 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
635 /* Already allocated? */
639 /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
641 if (type & IORESOURCE_IO)
644 res->name = socket->dev->subordinate->name;
647 region.start = config_readl(socket, addr_start) & mask;
648 region.end = config_readl(socket, addr_end) | ~mask;
649 if (region.start && region.end > region.start && !override_bios) {
650 pcibios_bus_to_resource(socket->dev, res, ®ion);
651 root = pci_find_parent_resource(socket->dev, res);
652 if (root && (request_resource(root, res) == 0))
654 printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
655 pci_name(socket->dev), nr);
658 if (type & IORESOURCE_IO) {
659 if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) ||
660 (yenta_search_res(socket, res, BRIDGE_IO_ACC)) ||
661 (yenta_search_res(socket, res, BRIDGE_IO_MIN)))
664 if (type & IORESOURCE_PREFETCH) {
665 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
666 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
667 (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
669 /* Approximating prefetchable by non-prefetchable */
670 res->flags = IORESOURCE_MEM;
672 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
673 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
674 (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
678 printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n",
679 pci_name(socket->dev), type);
680 res->start = res->end = res->flags = 0;
685 * Allocate the bridge mappings for the device..
687 static void yenta_allocate_resources(struct yenta_socket *socket)
690 program += yenta_allocate_res(socket, 0, IORESOURCE_IO,
691 PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0);
692 program += yenta_allocate_res(socket, 1, IORESOURCE_IO,
693 PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1);
694 program += yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH,
695 PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0);
696 program += yenta_allocate_res(socket, 3, IORESOURCE_MEM,
697 PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1);
699 pci_setup_cardbus(socket->dev->subordinate);
704 * Free the bridge mappings for the device..
706 static void yenta_free_resources(struct yenta_socket *socket)
710 struct resource *res;
711 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i;
712 if (res->start != 0 && res->end != 0)
713 release_resource(res);
714 res->start = res->end = res->flags = 0;
720 * Close it down - release our resources and go home..
722 static void yenta_close(struct pci_dev *dev)
724 struct yenta_socket *sock = pci_get_drvdata(dev);
726 /* Remove the register attributes */
727 device_remove_file(&dev->dev, &dev_attr_yenta_registers);
729 /* we don't want a dying socket registered */
730 pcmcia_unregister_socket(&sock->socket);
732 /* Disable all events so we don't die in an IRQ storm */
733 cb_writel(sock, CB_SOCKET_MASK, 0x0);
734 exca_writeb(sock, I365_CSCINT, 0);
737 free_irq(sock->cb_irq, sock);
739 del_timer_sync(&sock->poll_timer);
743 yenta_free_resources(sock);
745 pci_release_regions(dev);
746 pci_disable_device(dev);
747 pci_set_drvdata(dev, NULL);
751 static struct pccard_operations yenta_socket_operations = {
752 .init = yenta_sock_init,
753 .suspend = yenta_sock_suspend,
754 .get_status = yenta_get_status,
755 .set_socket = yenta_set_socket,
756 .set_io_map = yenta_set_io_map,
757 .set_mem_map = yenta_set_mem_map,
761 #ifdef CONFIG_YENTA_TI
764 #ifdef CONFIG_YENTA_RICOH
767 #ifdef CONFIG_YENTA_TOSHIBA
770 #ifdef CONFIG_YENTA_O2
775 CARDBUS_TYPE_DEFAULT = -1,
781 CARDBUS_TYPE_TOPIC95,
782 CARDBUS_TYPE_TOPIC97,
783 CARDBUS_TYPE_O2MICRO,
788 * Different cardbus controllers have slightly different
789 * initialization sequences etc details. List them here..
791 static struct cardbus_type cardbus_type[] = {
792 #ifdef CONFIG_YENTA_TI
793 [CARDBUS_TYPE_TI] = {
794 .override = ti_override,
795 .save_state = ti_save_state,
796 .restore_state = ti_restore_state,
797 .sock_init = ti_init,
799 [CARDBUS_TYPE_TI113X] = {
800 .override = ti113x_override,
801 .save_state = ti_save_state,
802 .restore_state = ti_restore_state,
803 .sock_init = ti_init,
805 [CARDBUS_TYPE_TI12XX] = {
806 .override = ti12xx_override,
807 .save_state = ti_save_state,
808 .restore_state = ti_restore_state,
809 .sock_init = ti_init,
811 [CARDBUS_TYPE_TI1250] = {
812 .override = ti1250_override,
813 .save_state = ti_save_state,
814 .restore_state = ti_restore_state,
815 .sock_init = ti_init,
818 #ifdef CONFIG_YENTA_RICOH
819 [CARDBUS_TYPE_RICOH] = {
820 .override = ricoh_override,
821 .save_state = ricoh_save_state,
822 .restore_state = ricoh_restore_state,
825 #ifdef CONFIG_YENTA_TOSHIBA
826 [CARDBUS_TYPE_TOPIC95] = {
827 .override = topic95_override,
829 [CARDBUS_TYPE_TOPIC97] = {
830 .override = topic97_override,
833 #ifdef CONFIG_YENTA_O2
834 [CARDBUS_TYPE_O2MICRO] = {
835 .override = o2micro_override,
836 .restore_state = o2micro_restore_state,
839 #ifdef CONFIG_YENTA_TI
840 [CARDBUS_TYPE_ENE] = {
841 .override = ene_override,
842 .save_state = ti_save_state,
843 .restore_state = ti_restore_state,
844 .sock_init = ti_init,
851 * Only probe "regular" interrupts, don't
852 * touch dangerous spots like the mouse irq,
853 * because there are mice that apparently
854 * get really confused if they get fondled
857 * Default to 11, 10, 9, 7, 6, 5, 4, 3.
859 static u32 isa_interrupts = 0x0ef8;
861 static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask)
868 * Probe for usable interrupts using the force
869 * register to generate bogus card status events.
871 cb_writel(socket, CB_SOCKET_EVENT, -1);
872 cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
873 exca_writeb(socket, I365_CSCINT, 0);
874 val = probe_irq_on() & isa_irq_mask;
875 for (i = 1; i < 16; i++) {
876 if (!((val >> i) & 1))
878 exca_writeb(socket, I365_CSCINT, I365_CSC_STSCHG | (i << 4));
879 cb_writel(socket, CB_SOCKET_FORCE, CB_FCARDSTS);
881 cb_writel(socket, CB_SOCKET_EVENT, -1);
883 cb_writel(socket, CB_SOCKET_MASK, 0);
884 exca_writeb(socket, I365_CSCINT, 0);
886 mask = probe_irq_mask(val) & 0xffff;
893 * yenta PCI irq probing.
894 * currently only used in the TI/EnE initialization code
896 #ifdef CONFIG_YENTA_TI
898 /* interrupt handler, only used during probing */
899 static irqreturn_t yenta_probe_handler(int irq, void *dev_id)
901 struct yenta_socket *socket = (struct yenta_socket *) dev_id;
905 /* Clear interrupt status for the event */
906 cb_event = cb_readl(socket, CB_SOCKET_EVENT);
907 cb_writel(socket, CB_SOCKET_EVENT, -1);
908 csc = exca_readb(socket, I365_CSC);
910 if (cb_event || csc) {
911 socket->probe_status = 1;
918 /* probes the PCI interrupt, use only on override functions */
919 static int yenta_probe_cb_irq(struct yenta_socket *socket)
924 socket->probe_status = 0;
926 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) {
927 printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n");
931 /* generate interrupt, wait */
932 exca_writeb(socket, I365_CSCINT, I365_CSC_STSCHG);
933 cb_writel(socket, CB_SOCKET_EVENT, -1);
934 cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
935 cb_writel(socket, CB_SOCKET_FORCE, CB_FCARDSTS);
939 /* disable interrupts */
940 cb_writel(socket, CB_SOCKET_MASK, 0);
941 exca_writeb(socket, I365_CSCINT, 0);
942 cb_writel(socket, CB_SOCKET_EVENT, -1);
943 exca_readb(socket, I365_CSC);
945 free_irq(socket->cb_irq, socket);
947 return (int) socket->probe_status;
950 #endif /* CONFIG_YENTA_TI */
954 * Set static data that doesn't need re-initializing..
956 static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
958 socket->socket.pci_irq = socket->cb_irq;
960 socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
962 socket->socket.irq_mask = 0;
964 printk(KERN_INFO "Yenta: ISA IRQ mask 0x%04x, PCI irq %d\n",
965 socket->socket.irq_mask, socket->cb_irq);
969 * Initialize the standard cardbus registers
971 static void yenta_config_init(struct yenta_socket *socket)
974 struct pci_dev *dev = socket->dev;
975 struct pci_bus_region region;
977 pcibios_resource_to_bus(socket->dev, ®ion, &dev->resource[0]);
979 config_writel(socket, CB_LEGACY_MODE_BASE, 0);
980 config_writel(socket, PCI_BASE_ADDRESS_0, region.start);
981 config_writew(socket, PCI_COMMAND,
987 /* MAGIC NUMBERS! Fixme */
988 config_writeb(socket, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);
989 config_writeb(socket, PCI_LATENCY_TIMER, 168);
990 config_writel(socket, PCI_PRIMARY_BUS,
991 (176 << 24) | /* sec. latency timer */
992 (dev->subordinate->subordinate << 16) | /* subordinate bus */
993 (dev->subordinate->secondary << 8) | /* secondary bus */
994 dev->subordinate->primary); /* primary bus */
997 * Set up the bridging state:
998 * - enable write posting.
999 * - memory window 0 prefetchable, window 1 non-prefetchable
1000 * - PCI interrupts enabled if a PCI interrupt exists..
1002 bridge = config_readw(socket, CB_BRIDGE_CONTROL);
1003 bridge &= ~(CB_BRIDGE_CRST | CB_BRIDGE_PREFETCH1 | CB_BRIDGE_ISAEN | CB_BRIDGE_VGAEN);
1004 bridge |= CB_BRIDGE_PREFETCH0 | CB_BRIDGE_POSTEN;
1005 config_writew(socket, CB_BRIDGE_CONTROL, bridge);
1009 * yenta_fixup_parent_bridge - Fix subordinate bus# of the parent bridge
1010 * @cardbus_bridge: The PCI bus which the CardBus bridge bridges to
1012 * Checks if devices on the bus which the CardBus bridge bridges to would be
1013 * invisible during PCI scans because of a misconfigured subordinate number
1014 * of the parent brige - some BIOSes seem to be too lazy to set it right.
1015 * Does the fixup carefully by checking how far it can go without conflicts.
1016 * See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information.
1018 static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1020 struct list_head *tmp;
1021 unsigned char upper_limit;
1023 * We only check and fix the parent bridge: All systems which need
1024 * this fixup that have been reviewed are laptops and the only bridge
1025 * which needed fixing was the parent bridge of the CardBus bridge:
1027 struct pci_bus *bridge_to_fix = cardbus_bridge->parent;
1029 /* Check bus numbers are already set up correctly: */
1030 if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate)
1031 return; /* The subordinate number is ok, nothing to do */
1033 if (!bridge_to_fix->parent)
1034 return; /* Root bridges are ok */
1036 /* stay within the limits of the bus range of the parent: */
1037 upper_limit = bridge_to_fix->parent->subordinate;
1039 /* check the bus ranges of all silbling bridges to prevent overlap */
1040 list_for_each(tmp, &bridge_to_fix->parent->children) {
1041 struct pci_bus * silbling = pci_bus_b(tmp);
1043 * If the silbling has a higher secondary bus number
1044 * and it's secondary is equal or smaller than our
1045 * current upper limit, set the new upper limit to
1046 * the bus number below the silbling's range:
1048 if (silbling->secondary > bridge_to_fix->subordinate
1049 && silbling->secondary <= upper_limit)
1050 upper_limit = silbling->secondary - 1;
1053 /* Show that the wanted subordinate number is not possible: */
1054 if (cardbus_bridge->subordinate > upper_limit)
1055 printk(KERN_WARNING "Yenta: Upper limit for fixing this "
1056 "bridge's parent bridge: #%02x\n", upper_limit);
1058 /* If we have room to increase the bridge's subordinate number, */
1059 if (bridge_to_fix->subordinate < upper_limit) {
1061 /* use the highest number of the hidden bus, within limits */
1062 unsigned char subordinate_to_assign =
1063 min(cardbus_bridge->subordinate, upper_limit);
1065 printk(KERN_INFO "Yenta: Raising subordinate bus# of parent "
1066 "bus (#%02x) from #%02x to #%02x\n",
1067 bridge_to_fix->number,
1068 bridge_to_fix->subordinate, subordinate_to_assign);
1070 /* Save the new subordinate in the bus struct of the bridge */
1071 bridge_to_fix->subordinate = subordinate_to_assign;
1073 /* and update the PCI config space with the new subordinate */
1074 pci_write_config_byte(bridge_to_fix->self,
1075 PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate);
1080 * Initialize a cardbus controller. Make sure we have a usable
1081 * interrupt, and that we can map the cardbus area. Fill in the
1082 * socket information structure..
1084 static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_id *id)
1086 struct yenta_socket *socket;
1090 * If we failed to assign proper bus numbers for this cardbus
1091 * controller during PCI probe, its subordinate pci_bus is NULL.
1094 if (!dev->subordinate) {
1095 printk(KERN_ERR "Yenta: no bus associated with %s! "
1096 "(try 'pci=assign-busses')\n", pci_name(dev));
1100 socket = kzalloc(sizeof(struct yenta_socket), GFP_KERNEL);
1104 /* prepare pcmcia_socket */
1105 socket->socket.ops = ¥ta_socket_operations;
1106 socket->socket.resource_ops = &pccard_nonstatic_ops;
1107 socket->socket.dev.dev = &dev->dev;
1108 socket->socket.driver_data = socket;
1109 socket->socket.owner = THIS_MODULE;
1110 socket->socket.features = SS_CAP_PAGE_REGS | SS_CAP_PCCARD;
1111 socket->socket.map_size = 0x1000;
1112 socket->socket.cb_dev = dev;
1114 /* prepare struct yenta_socket */
1116 pci_set_drvdata(dev, socket);
1119 * Do some basic sanity checking..
1121 if (pci_enable_device(dev)) {
1126 ret = pci_request_regions(dev, "yenta_socket");
1130 if (!pci_resource_start(dev, 0)) {
1131 printk(KERN_ERR "No cardbus resource!\n");
1137 * Ok, start setup.. Map the cardbus registers,
1138 * and request the IRQ.
1140 socket->base = ioremap(pci_resource_start(dev, 0), 0x1000);
1141 if (!socket->base) {
1147 * report the subsystem vendor and device for help debugging
1150 printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n",
1151 pci_name(dev), dev->subsystem_vendor, dev->subsystem_device);
1153 yenta_config_init(socket);
1155 /* Disable all events */
1156 cb_writel(socket, CB_SOCKET_MASK, 0x0);
1158 /* Set up the bridge regions.. */
1159 yenta_allocate_resources(socket);
1161 socket->cb_irq = dev->irq;
1163 /* Do we have special options for the device? */
1164 if (id->driver_data != CARDBUS_TYPE_DEFAULT &&
1165 id->driver_data < ARRAY_SIZE(cardbus_type)) {
1166 socket->type = &cardbus_type[id->driver_data];
1168 ret = socket->type->override(socket);
1173 /* We must finish initialization here */
1175 if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket)) {
1176 /* No IRQ or request_irq failed. Poll */
1177 socket->cb_irq = 0; /* But zero is a valid IRQ number. */
1178 init_timer(&socket->poll_timer);
1179 socket->poll_timer.function = yenta_interrupt_wrapper;
1180 socket->poll_timer.data = (unsigned long)socket;
1181 socket->poll_timer.expires = jiffies + HZ;
1182 add_timer(&socket->poll_timer);
1183 printk(KERN_INFO "Yenta: no PCI IRQ, CardBus support disabled for this socket.\n"
1184 KERN_INFO "Yenta: check your BIOS CardBus, BIOS IRQ or ACPI settings.\n");
1186 socket->socket.features |= SS_CAP_CARDBUS;
1189 /* Figure out what the dang thing can do for the PCMCIA layer... */
1190 yenta_interrogate(socket);
1191 yenta_get_socket_capabilities(socket, isa_interrupts);
1192 printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE));
1194 yenta_fixup_parent_bridge(dev->subordinate);
1196 /* Register it with the pcmcia layer.. */
1197 ret = pcmcia_register_socket(&socket->socket);
1199 /* Add the yenta register attributes */
1200 ret = device_create_file(&dev->dev, &dev_attr_yenta_registers);
1205 pcmcia_unregister_socket(&socket->socket);
1209 iounmap(socket->base);
1211 pci_release_regions(dev);
1213 pci_disable_device(dev);
1221 static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
1223 struct yenta_socket *socket = pci_get_drvdata(dev);
1226 ret = pcmcia_socket_dev_suspend(&dev->dev, state);
1229 if (socket->type && socket->type->save_state)
1230 socket->type->save_state(socket);
1232 /* FIXME: pci_save_state needs to have a better interface */
1233 pci_save_state(dev);
1234 pci_read_config_dword(dev, 16*4, &socket->saved_state[0]);
1235 pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
1236 pci_disable_device(dev);
1239 * Some laptops (IBM T22) do not like us putting the Cardbus
1240 * bridge into D3. At a guess, some other laptop will
1241 * probably require this, so leave it commented out for now.
1243 /* pci_set_power_state(dev, 3); */
1250 static int yenta_dev_resume (struct pci_dev *dev)
1252 struct yenta_socket *socket = pci_get_drvdata(dev);
1257 pci_set_power_state(dev, 0);
1258 /* FIXME: pci_restore_state needs to have a better interface */
1259 pci_restore_state(dev);
1260 pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
1261 pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
1263 rc = pci_enable_device(dev);
1267 pci_set_master(dev);
1269 if (socket->type && socket->type->restore_state)
1270 socket->type->restore_state(socket);
1273 return pcmcia_socket_dev_resume(&dev->dev);
1277 #define CB_ID(vend,dev,type) \
1281 .subvendor = PCI_ANY_ID, \
1282 .subdevice = PCI_ANY_ID, \
1283 .class = PCI_CLASS_BRIDGE_CARDBUS << 8, \
1285 .driver_data = CARDBUS_TYPE_##type, \
1288 static struct pci_device_id yenta_table [] = {
1289 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI),
1292 * TBD: Check if these TI variants can use more
1293 * advanced overrides instead. (I can't get the
1294 * data sheets for these devices. --rmk)
1296 #ifdef CONFIG_YENTA_TI
1297 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1210, TI),
1299 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1130, TI113X),
1300 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1131, TI113X),
1302 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1211, TI12XX),
1303 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1220, TI12XX),
1304 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1221, TI12XX),
1305 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1225, TI12XX),
1306 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1251A, TI12XX),
1307 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1251B, TI12XX),
1308 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1420, TI12XX),
1309 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1450, TI12XX),
1310 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1451A, TI12XX),
1311 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1510, TI12XX),
1312 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, TI12XX),
1313 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1620, TI12XX),
1314 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4410, TI12XX),
1315 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4450, TI12XX),
1316 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4451, TI12XX),
1317 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4510, TI12XX),
1318 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4520, TI12XX),
1320 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1250, TI1250),
1321 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1410, TI1250),
1323 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XX21_XX11, TI12XX),
1324 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X515, TI12XX),
1325 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XX12, TI12XX),
1326 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X420, TI12XX),
1327 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X620, TI12XX),
1328 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7410, TI12XX),
1329 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7510, TI12XX),
1330 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7610, TI12XX),
1332 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_710, TI12XX),
1333 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_712, TI12XX),
1334 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_720, TI12XX),
1335 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_722, TI12XX),
1336 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1211, ENE),
1337 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1225, ENE),
1338 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1410, ENE),
1339 CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1420, ENE),
1340 #endif /* CONFIG_YENTA_TI */
1342 #ifdef CONFIG_YENTA_RICOH
1343 CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C465, RICOH),
1344 CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C466, RICOH),
1345 CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C475, RICOH),
1346 CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C476, RICOH),
1347 CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C478, RICOH),
1350 #ifdef CONFIG_YENTA_TOSHIBA
1351 CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC95, TOPIC95),
1352 CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC97, TOPIC97),
1353 CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC100, TOPIC97),
1356 #ifdef CONFIG_YENTA_O2
1357 CB_ID(PCI_VENDOR_ID_O2, PCI_ANY_ID, O2MICRO),
1360 /* match any cardbus bridge */
1361 CB_ID(PCI_ANY_ID, PCI_ANY_ID, DEFAULT),
1362 { /* all zeroes */ }
1364 MODULE_DEVICE_TABLE(pci, yenta_table);
1367 static struct pci_driver yenta_cardbus_driver = {
1368 .name = "yenta_cardbus",
1369 .id_table = yenta_table,
1370 .probe = yenta_probe,
1371 .remove = __devexit_p(yenta_close),
1373 .suspend = yenta_dev_suspend,
1374 .resume = yenta_dev_resume,
1379 static int __init yenta_socket_init(void)
1381 return pci_register_driver (¥ta_cardbus_driver);
1385 static void __exit yenta_socket_exit (void)
1387 pci_unregister_driver (¥ta_cardbus_driver);
1391 module_init(yenta_socket_init);
1392 module_exit(yenta_socket_exit);
1394 MODULE_LICENSE("GPL");