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 yenta_set_power(socket
, state
);
291 socket
->io_irq
= state
->io_irq
;
292 bridge
= config_readw(socket
, CB_BRIDGE_CONTROL
) & ~(CB_BRIDGE_CRST
| CB_BRIDGE_INTR
);
293 if (cb_readl(socket
, CB_SOCKET_STATE
) & CB_CBCARD
) {
295 bridge
|= (state
->flags
& SS_RESET
) ? CB_BRIDGE_CRST
: 0;
297 /* ISA interrupt control? */
298 intr
= exca_readb(socket
, I365_INTCTL
);
299 intr
= (intr
& ~0xf);
300 if (!socket
->cb_irq
) {
301 intr
|= state
->io_irq
;
302 bridge
|= CB_BRIDGE_INTR
;
304 exca_writeb(socket
, I365_INTCTL
, intr
);
308 reg
= exca_readb(socket
, I365_INTCTL
) & (I365_RING_ENA
| I365_INTR_ENA
);
309 reg
|= (state
->flags
& SS_RESET
) ? 0 : I365_PC_RESET
;
310 reg
|= (state
->flags
& SS_IOCARD
) ? I365_PC_IOCARD
: 0;
311 if (state
->io_irq
!= socket
->cb_irq
) {
312 reg
|= state
->io_irq
;
313 bridge
|= CB_BRIDGE_INTR
;
315 exca_writeb(socket
, I365_INTCTL
, reg
);
317 reg
= exca_readb(socket
, I365_POWER
) & (I365_VCC_MASK
|I365_VPP1_MASK
);
318 reg
|= I365_PWR_NORESET
;
319 if (state
->flags
& SS_PWR_AUTO
) reg
|= I365_PWR_AUTO
;
320 if (state
->flags
& SS_OUTPUT_ENA
) reg
|= I365_PWR_OUT
;
321 if (exca_readb(socket
, I365_POWER
) != reg
)
322 exca_writeb(socket
, I365_POWER
, reg
);
324 /* CSC interrupt: no ISA irq for CSC */
325 reg
= I365_CSC_DETECT
;
326 if (state
->flags
& SS_IOCARD
) {
327 if (state
->csc_mask
& SS_STSCHG
) reg
|= I365_CSC_STSCHG
;
329 if (state
->csc_mask
& SS_BATDEAD
) reg
|= I365_CSC_BVD1
;
330 if (state
->csc_mask
& SS_BATWARN
) reg
|= I365_CSC_BVD2
;
331 if (state
->csc_mask
& SS_READY
) reg
|= I365_CSC_READY
;
333 exca_writeb(socket
, I365_CSCINT
, reg
);
334 exca_readb(socket
, I365_CSC
);
336 sock
->zoom_video(sock
, state
->flags
& SS_ZVCARD
);
338 config_writew(socket
, CB_BRIDGE_CONTROL
, bridge
);
339 /* Socket event mask: get card insert/remove events.. */
340 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
341 cb_writel(socket
, CB_SOCKET_MASK
, CB_CDMASK
);
345 static int yenta_set_io_map(struct pcmcia_socket
*sock
, struct pccard_io_map
*io
)
347 struct yenta_socket
*socket
= container_of(sock
, struct yenta_socket
, socket
);
349 unsigned char ioctl
, addr
, enable
;
356 enable
= I365_ENA_IO(map
);
357 addr
= exca_readb(socket
, I365_ADDRWIN
);
359 /* Disable the window before changing it.. */
362 exca_writeb(socket
, I365_ADDRWIN
, addr
);
365 exca_writew(socket
, I365_IO(map
)+I365_W_START
, io
->start
);
366 exca_writew(socket
, I365_IO(map
)+I365_W_STOP
, io
->stop
);
368 ioctl
= exca_readb(socket
, I365_IOCTL
) & ~I365_IOCTL_MASK(map
);
369 if (io
->flags
& MAP_0WS
) ioctl
|= I365_IOCTL_0WS(map
);
370 if (io
->flags
& MAP_16BIT
) ioctl
|= I365_IOCTL_16BIT(map
);
371 if (io
->flags
& MAP_AUTOSZ
) ioctl
|= I365_IOCTL_IOCS16(map
);
372 exca_writeb(socket
, I365_IOCTL
, ioctl
);
374 if (io
->flags
& MAP_ACTIVE
)
375 exca_writeb(socket
, I365_ADDRWIN
, addr
| enable
);
379 static int yenta_set_mem_map(struct pcmcia_socket
*sock
, struct pccard_mem_map
*mem
)
381 struct yenta_socket
*socket
= container_of(sock
, struct yenta_socket
, socket
);
382 struct pci_bus_region region
;
384 unsigned char addr
, enable
;
385 unsigned int start
, stop
, card_start
;
388 pcibios_resource_to_bus(socket
->dev
, ®ion
, mem
->res
);
391 start
= region
.start
;
393 card_start
= mem
->card_start
;
395 if (map
> 4 || start
> stop
|| ((start
^ stop
) >> 24) ||
396 (card_start
>> 26) || mem
->speed
> 1000)
399 enable
= I365_ENA_MEM(map
);
400 addr
= exca_readb(socket
, I365_ADDRWIN
);
403 exca_writeb(socket
, I365_ADDRWIN
, addr
);
406 exca_writeb(socket
, CB_MEM_PAGE(map
), start
>> 24);
408 word
= (start
>> 12) & 0x0fff;
409 if (mem
->flags
& MAP_16BIT
)
410 word
|= I365_MEM_16BIT
;
411 if (mem
->flags
& MAP_0WS
)
412 word
|= I365_MEM_0WS
;
413 exca_writew(socket
, I365_MEM(map
) + I365_W_START
, word
);
415 word
= (stop
>> 12) & 0x0fff;
416 switch (to_cycles(mem
->speed
)) {
418 case 1: word
|= I365_MEM_WS0
; break;
419 case 2: word
|= I365_MEM_WS1
; break;
420 default: word
|= I365_MEM_WS1
| I365_MEM_WS0
; break;
422 exca_writew(socket
, I365_MEM(map
) + I365_W_STOP
, word
);
424 word
= ((card_start
- start
) >> 12) & 0x3fff;
425 if (mem
->flags
& MAP_WRPROT
)
426 word
|= I365_MEM_WRPROT
;
427 if (mem
->flags
& MAP_ATTRIB
)
428 word
|= I365_MEM_REG
;
429 exca_writew(socket
, I365_MEM(map
) + I365_W_OFF
, word
);
431 if (mem
->flags
& MAP_ACTIVE
)
432 exca_writeb(socket
, I365_ADDRWIN
, addr
| enable
);
438 static irqreturn_t
yenta_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
441 struct yenta_socket
*socket
= (struct yenta_socket
*) dev_id
;
445 /* Clear interrupt status for the event */
446 cb_event
= cb_readl(socket
, CB_SOCKET_EVENT
);
447 cb_writel(socket
, CB_SOCKET_EVENT
, cb_event
);
449 csc
= exca_readb(socket
, I365_CSC
);
451 if (!(cb_event
|| csc
))
454 events
= (cb_event
& (CB_CD1EVENT
| CB_CD2EVENT
)) ? SS_DETECT
: 0 ;
455 events
|= (csc
& I365_CSC_DETECT
) ? SS_DETECT
: 0;
456 if (exca_readb(socket
, I365_INTCTL
) & I365_PC_IOCARD
) {
457 events
|= (csc
& I365_CSC_STSCHG
) ? SS_STSCHG
: 0;
459 events
|= (csc
& I365_CSC_BVD1
) ? SS_BATDEAD
: 0;
460 events
|= (csc
& I365_CSC_BVD2
) ? SS_BATWARN
: 0;
461 events
|= (csc
& I365_CSC_READY
) ? SS_READY
: 0;
465 pcmcia_parse_events(&socket
->socket
, events
);
470 static void yenta_interrupt_wrapper(unsigned long data
)
472 struct yenta_socket
*socket
= (struct yenta_socket
*) data
;
474 yenta_interrupt(0, (void *)socket
, NULL
);
475 socket
->poll_timer
.expires
= jiffies
+ HZ
;
476 add_timer(&socket
->poll_timer
);
479 static void yenta_clear_maps(struct yenta_socket
*socket
)
482 struct resource res
= { .start
= 0, .end
= 0x0fff };
483 pccard_io_map io
= { 0, 0, 0, 0, 1 };
484 pccard_mem_map mem
= { .res
= &res
, };
486 yenta_set_socket(&socket
->socket
, &dead_socket
);
487 for (i
= 0; i
< 2; i
++) {
489 yenta_set_io_map(&socket
->socket
, &io
);
491 for (i
= 0; i
< 5; i
++) {
493 yenta_set_mem_map(&socket
->socket
, &mem
);
497 /* redoes voltage interrogation if required */
498 static void yenta_interrogate(struct yenta_socket
*socket
)
502 state
= cb_readl(socket
, CB_SOCKET_STATE
);
503 if (!(state
& (CB_5VCARD
| CB_3VCARD
| CB_XVCARD
| CB_YVCARD
)) ||
504 (state
& (CB_CDETECT1
| CB_CDETECT2
| CB_NOTACARD
| CB_BADVCCREQ
)) ||
505 ((state
& (CB_16BITCARD
| CB_CBCARD
)) == (CB_16BITCARD
| CB_CBCARD
)))
506 cb_writel(socket
, CB_SOCKET_FORCE
, CB_CVSTEST
);
509 /* Called at resume and initialization events */
510 static int yenta_sock_init(struct pcmcia_socket
*sock
)
512 struct yenta_socket
*socket
= container_of(sock
, struct yenta_socket
, socket
);
514 exca_writeb(socket
, I365_GBLCTL
, 0x00);
515 exca_writeb(socket
, I365_GENCTL
, 0x00);
517 /* Redo card voltage interrogation */
518 yenta_interrogate(socket
);
520 yenta_clear_maps(socket
);
522 if (socket
->type
&& socket
->type
->sock_init
)
523 socket
->type
->sock_init(socket
);
525 /* Re-enable CSC interrupts */
526 cb_writel(socket
, CB_SOCKET_MASK
, CB_CDMASK
);
531 static int yenta_sock_suspend(struct pcmcia_socket
*sock
)
533 struct yenta_socket
*socket
= container_of(sock
, struct yenta_socket
, socket
);
535 /* Disable CSC interrupts */
536 cb_writel(socket
, CB_SOCKET_MASK
, 0x0);
542 * Use an adaptive allocation for the memory resource,
543 * sometimes the memory behind pci bridges is limited:
544 * 1/8 of the size of the io window of the parent.
545 * max 4 MB, min 16 kB. We try very hard to not get below
546 * the "ACC" values, though.
548 #define BRIDGE_MEM_MAX 4*1024*1024
549 #define BRIDGE_MEM_ACC 128*1024
550 #define BRIDGE_MEM_MIN 16*1024
552 #define BRIDGE_IO_MAX 512
553 #define BRIDGE_IO_ACC 256
554 #define BRIDGE_IO_MIN 32
556 #ifndef PCIBIOS_MIN_CARDBUS_IO
557 #define PCIBIOS_MIN_CARDBUS_IO PCIBIOS_MIN_IO
560 static int yenta_search_one_res(struct resource
*root
, struct resource
*res
,
563 u32 align
, size
, start
, end
;
565 if (res
->flags
& IORESOURCE_IO
) {
567 size
= BRIDGE_IO_MAX
;
568 start
= PCIBIOS_MIN_CARDBUS_IO
;
571 unsigned long avail
= root
->end
- root
->start
;
573 size
= BRIDGE_MEM_MAX
;
574 if (size
> avail
/8) {
576 /* round size down to next power of 2 */
578 while ((size
/= 2) != 0)
585 start
= PCIBIOS_MIN_MEM
;
590 if (allocate_resource(root
, res
, size
, start
, end
, align
,
596 } while (size
>= min
);
602 static int yenta_search_res(struct yenta_socket
*socket
, struct resource
*res
,
606 for (i
=0; i
<PCI_BUS_NUM_RESOURCES
; i
++) {
607 struct resource
* root
= socket
->dev
->bus
->resource
[i
];
611 if ((res
->flags
^ root
->flags
) &
612 (IORESOURCE_IO
| IORESOURCE_MEM
| IORESOURCE_PREFETCH
))
613 continue; /* Wrong type */
615 if (yenta_search_one_res(root
, res
, min
))
621 static int yenta_allocate_res(struct yenta_socket
*socket
, int nr
, unsigned type
, int addr_start
, int addr_end
)
623 struct resource
*root
, *res
;
624 struct pci_bus_region region
;
627 res
= socket
->dev
->resource
+ PCI_BRIDGE_RESOURCES
+ nr
;
628 /* Already allocated? */
632 /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
634 if (type
& IORESOURCE_IO
)
637 res
->name
= socket
->dev
->subordinate
->name
;
640 region
.start
= config_readl(socket
, addr_start
) & mask
;
641 region
.end
= config_readl(socket
, addr_end
) | ~mask
;
642 if (region
.start
&& region
.end
> region
.start
&& !override_bios
) {
643 pcibios_bus_to_resource(socket
->dev
, res
, ®ion
);
644 root
= pci_find_parent_resource(socket
->dev
, res
);
645 if (root
&& (request_resource(root
, res
) == 0))
647 printk(KERN_INFO
"yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
648 pci_name(socket
->dev
), nr
);
651 if (type
& IORESOURCE_IO
) {
652 if ((yenta_search_res(socket
, res
, BRIDGE_IO_MAX
)) ||
653 (yenta_search_res(socket
, res
, BRIDGE_IO_ACC
)) ||
654 (yenta_search_res(socket
, res
, BRIDGE_IO_MIN
)))
657 if (type
& IORESOURCE_PREFETCH
) {
658 if ((yenta_search_res(socket
, res
, BRIDGE_MEM_MAX
)) ||
659 (yenta_search_res(socket
, res
, BRIDGE_MEM_ACC
)) ||
660 (yenta_search_res(socket
, res
, BRIDGE_MEM_MIN
)))
662 /* Approximating prefetchable by non-prefetchable */
663 res
->flags
= IORESOURCE_MEM
;
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
)))
671 printk(KERN_INFO
"yenta %s: no resource of type %x available, trying to continue...\n",
672 pci_name(socket
->dev
), type
);
673 res
->start
= res
->end
= res
->flags
= 0;
678 * Allocate the bridge mappings for the device..
680 static void yenta_allocate_resources(struct yenta_socket
*socket
)
683 program
+= yenta_allocate_res(socket
, 0, IORESOURCE_IO
,
684 PCI_CB_IO_BASE_0
, PCI_CB_IO_LIMIT_0
);
685 program
+= yenta_allocate_res(socket
, 1, IORESOURCE_IO
,
686 PCI_CB_IO_BASE_1
, PCI_CB_IO_LIMIT_1
);
687 program
+= yenta_allocate_res(socket
, 2, IORESOURCE_MEM
|IORESOURCE_PREFETCH
,
688 PCI_CB_MEMORY_BASE_0
, PCI_CB_MEMORY_LIMIT_0
);
689 program
+= yenta_allocate_res(socket
, 3, IORESOURCE_MEM
,
690 PCI_CB_MEMORY_BASE_1
, PCI_CB_MEMORY_LIMIT_1
);
692 pci_setup_cardbus(socket
->dev
->subordinate
);
697 * Free the bridge mappings for the device..
699 static void yenta_free_resources(struct yenta_socket
*socket
)
703 struct resource
*res
;
704 res
= socket
->dev
->resource
+ PCI_BRIDGE_RESOURCES
+ i
;
705 if (res
->start
!= 0 && res
->end
!= 0)
706 release_resource(res
);
707 res
->start
= res
->end
= res
->flags
= 0;
713 * Close it down - release our resources and go home..
715 static void yenta_close(struct pci_dev
*dev
)
717 struct yenta_socket
*sock
= pci_get_drvdata(dev
);
719 /* Remove the register attributes */
720 device_remove_file(&dev
->dev
, &dev_attr_yenta_registers
);
722 /* we don't want a dying socket registered */
723 pcmcia_unregister_socket(&sock
->socket
);
725 /* Disable all events so we don't die in an IRQ storm */
726 cb_writel(sock
, CB_SOCKET_MASK
, 0x0);
727 exca_writeb(sock
, I365_CSCINT
, 0);
730 free_irq(sock
->cb_irq
, sock
);
732 del_timer_sync(&sock
->poll_timer
);
736 yenta_free_resources(sock
);
738 pci_release_regions(dev
);
739 pci_disable_device(dev
);
740 pci_set_drvdata(dev
, NULL
);
744 static struct pccard_operations yenta_socket_operations
= {
745 .init
= yenta_sock_init
,
746 .suspend
= yenta_sock_suspend
,
747 .get_status
= yenta_get_status
,
748 .set_socket
= yenta_set_socket
,
749 .set_io_map
= yenta_set_io_map
,
750 .set_mem_map
= yenta_set_mem_map
,
754 #ifdef CONFIG_YENTA_TI
757 #ifdef CONFIG_YENTA_RICOH
760 #ifdef CONFIG_YENTA_TOSHIBA
763 #ifdef CONFIG_YENTA_O2
768 CARDBUS_TYPE_DEFAULT
= -1,
774 CARDBUS_TYPE_TOPIC95
,
775 CARDBUS_TYPE_TOPIC97
,
776 CARDBUS_TYPE_O2MICRO
,
781 * Different cardbus controllers have slightly different
782 * initialization sequences etc details. List them here..
784 static struct cardbus_type cardbus_type
[] = {
785 #ifdef CONFIG_YENTA_TI
786 [CARDBUS_TYPE_TI
] = {
787 .override
= ti_override
,
788 .save_state
= ti_save_state
,
789 .restore_state
= ti_restore_state
,
790 .sock_init
= ti_init
,
792 [CARDBUS_TYPE_TI113X
] = {
793 .override
= ti113x_override
,
794 .save_state
= ti_save_state
,
795 .restore_state
= ti_restore_state
,
796 .sock_init
= ti_init
,
798 [CARDBUS_TYPE_TI12XX
] = {
799 .override
= ti12xx_override
,
800 .save_state
= ti_save_state
,
801 .restore_state
= ti_restore_state
,
802 .sock_init
= ti_init
,
804 [CARDBUS_TYPE_TI1250
] = {
805 .override
= ti1250_override
,
806 .save_state
= ti_save_state
,
807 .restore_state
= ti_restore_state
,
808 .sock_init
= ti_init
,
811 #ifdef CONFIG_YENTA_RICOH
812 [CARDBUS_TYPE_RICOH
] = {
813 .override
= ricoh_override
,
814 .save_state
= ricoh_save_state
,
815 .restore_state
= ricoh_restore_state
,
818 #ifdef CONFIG_YENTA_TOSHIBA
819 [CARDBUS_TYPE_TOPIC95
] = {
820 .override
= topic95_override
,
822 [CARDBUS_TYPE_TOPIC97
] = {
823 .override
= topic97_override
,
826 #ifdef CONFIG_YENTA_O2
827 [CARDBUS_TYPE_O2MICRO
] = {
828 .override
= o2micro_override
,
829 .restore_state
= o2micro_restore_state
,
832 #ifdef CONFIG_YENTA_TI
833 [CARDBUS_TYPE_ENE
] = {
834 .override
= ene_override
,
835 .save_state
= ti_save_state
,
836 .restore_state
= ti_restore_state
,
837 .sock_init
= ti_init
,
844 * Only probe "regular" interrupts, don't
845 * touch dangerous spots like the mouse irq,
846 * because there are mice that apparently
847 * get really confused if they get fondled
850 * Default to 11, 10, 9, 7, 6, 5, 4, 3.
852 static u32 isa_interrupts
= 0x0ef8;
854 static unsigned int yenta_probe_irq(struct yenta_socket
*socket
, u32 isa_irq_mask
)
861 * Probe for usable interrupts using the force
862 * register to generate bogus card status events.
864 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
865 cb_writel(socket
, CB_SOCKET_MASK
, CB_CSTSMASK
);
866 exca_writeb(socket
, I365_CSCINT
, 0);
867 val
= probe_irq_on() & isa_irq_mask
;
868 for (i
= 1; i
< 16; i
++) {
869 if (!((val
>> i
) & 1))
871 exca_writeb(socket
, I365_CSCINT
, I365_CSC_STSCHG
| (i
<< 4));
872 cb_writel(socket
, CB_SOCKET_FORCE
, CB_FCARDSTS
);
874 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
876 cb_writel(socket
, CB_SOCKET_MASK
, 0);
877 exca_writeb(socket
, I365_CSCINT
, 0);
879 mask
= probe_irq_mask(val
) & 0xffff;
886 * yenta PCI irq probing.
887 * currently only used in the TI/EnE initialization code
889 #ifdef CONFIG_YENTA_TI
891 /* interrupt handler, only used during probing */
892 static irqreturn_t
yenta_probe_handler(int irq
, void *dev_id
, struct pt_regs
*regs
)
894 struct yenta_socket
*socket
= (struct yenta_socket
*) dev_id
;
898 /* Clear interrupt status for the event */
899 cb_event
= cb_readl(socket
, CB_SOCKET_EVENT
);
900 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
901 csc
= exca_readb(socket
, I365_CSC
);
903 if (cb_event
|| csc
) {
904 socket
->probe_status
= 1;
911 /* probes the PCI interrupt, use only on override functions */
912 static int yenta_probe_cb_irq(struct yenta_socket
*socket
)
917 socket
->probe_status
= 0;
919 if (request_irq(socket
->cb_irq
, yenta_probe_handler
, SA_SHIRQ
, "yenta", socket
)) {
920 printk(KERN_WARNING
"Yenta: request_irq() in yenta_probe_cb_irq() failed!\n");
924 /* generate interrupt, wait */
925 exca_writeb(socket
, I365_CSCINT
, I365_CSC_STSCHG
);
926 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
927 cb_writel(socket
, CB_SOCKET_MASK
, CB_CSTSMASK
);
928 cb_writel(socket
, CB_SOCKET_FORCE
, CB_FCARDSTS
);
932 /* disable interrupts */
933 cb_writel(socket
, CB_SOCKET_MASK
, 0);
934 exca_writeb(socket
, I365_CSCINT
, 0);
935 cb_writel(socket
, CB_SOCKET_EVENT
, -1);
936 exca_readb(socket
, I365_CSC
);
938 free_irq(socket
->cb_irq
, socket
);
940 return (int) socket
->probe_status
;
943 #endif /* CONFIG_YENTA_TI */
947 * Set static data that doesn't need re-initializing..
949 static void yenta_get_socket_capabilities(struct yenta_socket
*socket
, u32 isa_irq_mask
)
951 socket
->socket
.pci_irq
= socket
->cb_irq
;
953 socket
->socket
.irq_mask
= yenta_probe_irq(socket
, isa_irq_mask
);
955 socket
->socket
.irq_mask
= 0;
957 printk(KERN_INFO
"Yenta: ISA IRQ mask 0x%04x, PCI irq %d\n",
958 socket
->socket
.irq_mask
, socket
->cb_irq
);
962 * Initialize the standard cardbus registers
964 static void yenta_config_init(struct yenta_socket
*socket
)
967 struct pci_dev
*dev
= socket
->dev
;
968 struct pci_bus_region region
;
970 pcibios_resource_to_bus(socket
->dev
, ®ion
, &dev
->resource
[0]);
972 config_writel(socket
, CB_LEGACY_MODE_BASE
, 0);
973 config_writel(socket
, PCI_BASE_ADDRESS_0
, region
.start
);
974 config_writew(socket
, PCI_COMMAND
,
980 /* MAGIC NUMBERS! Fixme */
981 config_writeb(socket
, PCI_CACHE_LINE_SIZE
, L1_CACHE_BYTES
/ 4);
982 config_writeb(socket
, PCI_LATENCY_TIMER
, 168);
983 config_writel(socket
, PCI_PRIMARY_BUS
,
984 (176 << 24) | /* sec. latency timer */
985 (dev
->subordinate
->subordinate
<< 16) | /* subordinate bus */
986 (dev
->subordinate
->secondary
<< 8) | /* secondary bus */
987 dev
->subordinate
->primary
); /* primary bus */
990 * Set up the bridging state:
991 * - enable write posting.
992 * - memory window 0 prefetchable, window 1 non-prefetchable
993 * - PCI interrupts enabled if a PCI interrupt exists..
995 bridge
= config_readw(socket
, CB_BRIDGE_CONTROL
);
996 bridge
&= ~(CB_BRIDGE_CRST
| CB_BRIDGE_PREFETCH1
| CB_BRIDGE_ISAEN
| CB_BRIDGE_VGAEN
);
997 bridge
|= CB_BRIDGE_PREFETCH0
| CB_BRIDGE_POSTEN
;
998 config_writew(socket
, CB_BRIDGE_CONTROL
, bridge
);
1002 * Initialize a cardbus controller. Make sure we have a usable
1003 * interrupt, and that we can map the cardbus area. Fill in the
1004 * socket information structure..
1006 static int __devinit
yenta_probe (struct pci_dev
*dev
, const struct pci_device_id
*id
)
1008 struct yenta_socket
*socket
;
1012 * If we failed to assign proper bus numbers for this cardbus
1013 * controller during PCI probe, its subordinate pci_bus is NULL.
1016 if (!dev
->subordinate
) {
1017 printk(KERN_ERR
"Yenta: no bus associated with %s! "
1018 "(try 'pci=assign-busses')\n", pci_name(dev
));
1022 socket
= kzalloc(sizeof(struct yenta_socket
), GFP_KERNEL
);
1026 /* prepare pcmcia_socket */
1027 socket
->socket
.ops
= ¥ta_socket_operations
;
1028 socket
->socket
.resource_ops
= &pccard_nonstatic_ops
;
1029 socket
->socket
.dev
.dev
= &dev
->dev
;
1030 socket
->socket
.driver_data
= socket
;
1031 socket
->socket
.owner
= THIS_MODULE
;
1032 socket
->socket
.features
= SS_CAP_PAGE_REGS
| SS_CAP_PCCARD
;
1033 socket
->socket
.map_size
= 0x1000;
1034 socket
->socket
.cb_dev
= dev
;
1036 /* prepare struct yenta_socket */
1038 pci_set_drvdata(dev
, socket
);
1041 * Do some basic sanity checking..
1043 if (pci_enable_device(dev
)) {
1048 ret
= pci_request_regions(dev
, "yenta_socket");
1052 if (!pci_resource_start(dev
, 0)) {
1053 printk(KERN_ERR
"No cardbus resource!\n");
1059 * Ok, start setup.. Map the cardbus registers,
1060 * and request the IRQ.
1062 socket
->base
= ioremap(pci_resource_start(dev
, 0), 0x1000);
1063 if (!socket
->base
) {
1069 * report the subsystem vendor and device for help debugging
1072 printk(KERN_INFO
"Yenta: CardBus bridge found at %s [%04x:%04x]\n",
1073 pci_name(dev
), dev
->subsystem_vendor
, dev
->subsystem_device
);
1075 yenta_config_init(socket
);
1077 /* Disable all events */
1078 cb_writel(socket
, CB_SOCKET_MASK
, 0x0);
1080 /* Set up the bridge regions.. */
1081 yenta_allocate_resources(socket
);
1083 socket
->cb_irq
= dev
->irq
;
1085 /* Do we have special options for the device? */
1086 if (id
->driver_data
!= CARDBUS_TYPE_DEFAULT
&&
1087 id
->driver_data
< ARRAY_SIZE(cardbus_type
)) {
1088 socket
->type
= &cardbus_type
[id
->driver_data
];
1090 ret
= socket
->type
->override(socket
);
1095 /* We must finish initialization here */
1097 if (!socket
->cb_irq
|| request_irq(socket
->cb_irq
, yenta_interrupt
, SA_SHIRQ
, "yenta", socket
)) {
1098 /* No IRQ or request_irq failed. Poll */
1099 socket
->cb_irq
= 0; /* But zero is a valid IRQ number. */
1100 init_timer(&socket
->poll_timer
);
1101 socket
->poll_timer
.function
= yenta_interrupt_wrapper
;
1102 socket
->poll_timer
.data
= (unsigned long)socket
;
1103 socket
->poll_timer
.expires
= jiffies
+ HZ
;
1104 add_timer(&socket
->poll_timer
);
1105 printk(KERN_INFO
"Yenta: no PCI IRQ, CardBus support disabled for this socket.\n"
1106 KERN_INFO
"Yenta: check your BIOS CardBus, BIOS IRQ or ACPI settings.\n");
1108 socket
->socket
.features
|= SS_CAP_CARDBUS
;
1111 /* Figure out what the dang thing can do for the PCMCIA layer... */
1112 yenta_interrogate(socket
);
1113 yenta_get_socket_capabilities(socket
, isa_interrupts
);
1114 printk(KERN_INFO
"Socket status: %08x\n", cb_readl(socket
, CB_SOCKET_STATE
));
1116 /* Register it with the pcmcia layer.. */
1117 ret
= pcmcia_register_socket(&socket
->socket
);
1119 /* Add the yenta register attributes */
1120 device_create_file(&dev
->dev
, &dev_attr_yenta_registers
);
1125 iounmap(socket
->base
);
1127 pci_release_regions(dev
);
1129 pci_disable_device(dev
);
1137 static int yenta_dev_suspend (struct pci_dev
*dev
, pm_message_t state
)
1139 struct yenta_socket
*socket
= pci_get_drvdata(dev
);
1142 ret
= pcmcia_socket_dev_suspend(&dev
->dev
, state
);
1145 if (socket
->type
&& socket
->type
->save_state
)
1146 socket
->type
->save_state(socket
);
1148 /* FIXME: pci_save_state needs to have a better interface */
1149 pci_save_state(dev
);
1150 pci_read_config_dword(dev
, 16*4, &socket
->saved_state
[0]);
1151 pci_read_config_dword(dev
, 17*4, &socket
->saved_state
[1]);
1152 pci_disable_device(dev
);
1155 * Some laptops (IBM T22) do not like us putting the Cardbus
1156 * bridge into D3. At a guess, some other laptop will
1157 * probably require this, so leave it commented out for now.
1159 /* pci_set_power_state(dev, 3); */
1166 static int yenta_dev_resume (struct pci_dev
*dev
)
1168 struct yenta_socket
*socket
= pci_get_drvdata(dev
);
1171 pci_set_power_state(dev
, 0);
1172 /* FIXME: pci_restore_state needs to have a better interface */
1173 pci_restore_state(dev
);
1174 pci_write_config_dword(dev
, 16*4, socket
->saved_state
[0]);
1175 pci_write_config_dword(dev
, 17*4, socket
->saved_state
[1]);
1176 pci_enable_device(dev
);
1177 pci_set_master(dev
);
1179 if (socket
->type
&& socket
->type
->restore_state
)
1180 socket
->type
->restore_state(socket
);
1183 return pcmcia_socket_dev_resume(&dev
->dev
);
1187 #define CB_ID(vend,dev,type) \
1191 .subvendor = PCI_ANY_ID, \
1192 .subdevice = PCI_ANY_ID, \
1193 .class = PCI_CLASS_BRIDGE_CARDBUS << 8, \
1195 .driver_data = CARDBUS_TYPE_##type, \
1198 static struct pci_device_id yenta_table
[] = {
1199 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1031
, TI
),
1202 * TBD: Check if these TI variants can use more
1203 * advanced overrides instead. (I can't get the
1204 * data sheets for these devices. --rmk)
1206 #ifdef CONFIG_YENTA_TI
1207 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1210
, TI
),
1209 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1130
, TI113X
),
1210 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1131
, TI113X
),
1212 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1211
, TI12XX
),
1213 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1220
, TI12XX
),
1214 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1221
, TI12XX
),
1215 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1225
, TI12XX
),
1216 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1251A
, TI12XX
),
1217 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1251B
, TI12XX
),
1218 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1420
, TI12XX
),
1219 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1450
, TI12XX
),
1220 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1451A
, TI12XX
),
1221 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1510
, TI12XX
),
1222 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1520
, TI12XX
),
1223 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1620
, TI12XX
),
1224 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_4410
, TI12XX
),
1225 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_4450
, TI12XX
),
1226 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_4451
, TI12XX
),
1227 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_4510
, TI12XX
),
1228 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_4520
, TI12XX
),
1230 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1250
, TI1250
),
1231 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_1410
, TI1250
),
1233 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_XX21_XX11
, TI12XX
),
1234 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_X515
, TI12XX
),
1235 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_X420
, TI12XX
),
1236 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_X620
, TI12XX
),
1237 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_7410
, TI12XX
),
1238 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_7510
, TI12XX
),
1239 CB_ID(PCI_VENDOR_ID_TI
, PCI_DEVICE_ID_TI_7610
, TI12XX
),
1241 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_710
, TI12XX
),
1242 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_712
, TI12XX
),
1243 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_720
, TI12XX
),
1244 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_722
, TI12XX
),
1245 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_1211
, ENE
),
1246 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_1225
, ENE
),
1247 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_1410
, ENE
),
1248 CB_ID(PCI_VENDOR_ID_ENE
, PCI_DEVICE_ID_ENE_1420
, ENE
),
1249 #endif /* CONFIG_YENTA_TI */
1251 #ifdef CONFIG_YENTA_RICOH
1252 CB_ID(PCI_VENDOR_ID_RICOH
, PCI_DEVICE_ID_RICOH_RL5C465
, RICOH
),
1253 CB_ID(PCI_VENDOR_ID_RICOH
, PCI_DEVICE_ID_RICOH_RL5C466
, RICOH
),
1254 CB_ID(PCI_VENDOR_ID_RICOH
, PCI_DEVICE_ID_RICOH_RL5C475
, RICOH
),
1255 CB_ID(PCI_VENDOR_ID_RICOH
, PCI_DEVICE_ID_RICOH_RL5C476
, RICOH
),
1256 CB_ID(PCI_VENDOR_ID_RICOH
, PCI_DEVICE_ID_RICOH_RL5C478
, RICOH
),
1259 #ifdef CONFIG_YENTA_TOSHIBA
1260 CB_ID(PCI_VENDOR_ID_TOSHIBA
, PCI_DEVICE_ID_TOSHIBA_TOPIC95
, TOPIC95
),
1261 CB_ID(PCI_VENDOR_ID_TOSHIBA
, PCI_DEVICE_ID_TOSHIBA_TOPIC97
, TOPIC97
),
1262 CB_ID(PCI_VENDOR_ID_TOSHIBA
, PCI_DEVICE_ID_TOSHIBA_TOPIC100
, TOPIC97
),
1265 #ifdef CONFIG_YENTA_O2
1266 CB_ID(PCI_VENDOR_ID_O2
, PCI_ANY_ID
, O2MICRO
),
1269 /* match any cardbus bridge */
1270 CB_ID(PCI_ANY_ID
, PCI_ANY_ID
, DEFAULT
),
1271 { /* all zeroes */ }
1273 MODULE_DEVICE_TABLE(pci
, yenta_table
);
1276 static struct pci_driver yenta_cardbus_driver
= {
1277 .name
= "yenta_cardbus",
1278 .id_table
= yenta_table
,
1279 .probe
= yenta_probe
,
1280 .remove
= __devexit_p(yenta_close
),
1281 .suspend
= yenta_dev_suspend
,
1282 .resume
= yenta_dev_resume
,
1286 static int __init
yenta_socket_init(void)
1288 return pci_register_driver (¥ta_cardbus_driver
);
1292 static void __exit
yenta_socket_exit (void)
1294 pci_unregister_driver (¥ta_cardbus_driver
);
1298 module_init(yenta_socket_init
);
1299 module_exit(yenta_socket_exit
);
1301 MODULE_LICENSE("GPL");