aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Künzer <Jens.Kuenzer@fpga.homeip.net>2010-03-06 02:27:22 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2010-03-15 09:50:16 -0400
commit0d3a940de51c47a3d6322537c8dce925db755477 (patch)
treedef17f37fabf348a4de30c99cad065bedc13a726
parentba8819e991ac507fcbfa080eacdff3e7eea4dc03 (diff)
pcmcia: re-route Cardbus IRQ to ISA on ti1130 bridges if necessary
As the PCI irq pin of the ti1130 pcmcia bridge is not connected (at least on some old IBM Thinkpad 760ED notebooks), the Cardbus IRQ has to be routed to an ISA irq. Part 3 of a series to allow the ISA irq to be used for Cardbus devices if the socket's PCI irq is unusable. [linux@dominikbrodowski.net: split up the original patch, commit message, cleanup] Signed-off-by: Jens Kuenzer <Jens.Kuenzer@fpga.homeip.net> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/pcmcia/ti113x.h37
-rw-r--r--drivers/pcmcia/yenta_socket.c25
2 files changed, 49 insertions, 13 deletions
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
index aaa70227bfb0..9ffa97d0b16c 100644
--- a/drivers/pcmcia/ti113x.h
+++ b/drivers/pcmcia/ti113x.h
@@ -296,7 +296,7 @@ static int ti_init(struct yenta_socket *socket)
296 u8 new, reg = exca_readb(socket, I365_INTCTL); 296 u8 new, reg = exca_readb(socket, I365_INTCTL);
297 297
298 new = reg & ~I365_INTR_ENA; 298 new = reg & ~I365_INTR_ENA;
299 if (socket->cb_irq) 299 if (socket->dev->irq)
300 new |= I365_INTR_ENA; 300 new |= I365_INTR_ENA;
301 if (new != reg) 301 if (new != reg)
302 exca_writeb(socket, I365_INTCTL, new); 302 exca_writeb(socket, I365_INTCTL, new);
@@ -316,14 +316,47 @@ static int ti_override(struct yenta_socket *socket)
316 return 0; 316 return 0;
317} 317}
318 318
319static void ti113x_use_isa_irq(struct yenta_socket *socket)
320{
321 int isa_irq = -1;
322 u8 intctl;
323 u32 isa_irq_mask = 0;
324
325 if (!isa_probe)
326 return;
327
328 /* get a free isa int */
329 isa_irq_mask = yenta_probe_irq(socket, isa_interrupts);
330 if (!isa_irq_mask)
331 return; /* no useable isa irq found */
332
333 /* choose highest available */
334 for (; isa_irq_mask; isa_irq++)
335 isa_irq_mask >>= 1;
336 socket->cb_irq = isa_irq;
337
338 exca_writeb(socket, I365_CSCINT, (isa_irq << 4));
339
340 intctl = exca_readb(socket, I365_INTCTL);
341 intctl &= ~(I365_INTR_ENA | I365_IRQ_MASK); /* CSC Enable */
342 exca_writeb(socket, I365_INTCTL, intctl);
343
344 dev_info(&socket->dev->dev,
345 "Yenta TI113x: using isa irq %d for CardBus\n", isa_irq);
346}
347
348
319static int ti113x_override(struct yenta_socket *socket) 349static int ti113x_override(struct yenta_socket *socket)
320{ 350{
321 u8 cardctl; 351 u8 cardctl;
322 352
323 cardctl = config_readb(socket, TI113X_CARD_CONTROL); 353 cardctl = config_readb(socket, TI113X_CARD_CONTROL);
324 cardctl &= ~(TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_IREQ | TI113X_CCR_PCI_CSC); 354 cardctl &= ~(TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_IREQ | TI113X_CCR_PCI_CSC);
325 if (socket->cb_irq) 355 if (socket->dev->irq)
326 cardctl |= TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_CSC | TI113X_CCR_PCI_IREQ; 356 cardctl |= TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_CSC | TI113X_CCR_PCI_IREQ;
357 else
358 ti113x_use_isa_irq(socket);
359
327 config_writeb(socket, TI113X_CARD_CONTROL, cardctl); 360 config_writeb(socket, TI113X_CARD_CONTROL, cardctl);
328 361
329 return ti_override(socket); 362 return ti_override(socket);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 51ee68dbc613..418988ab6edf 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -42,6 +42,18 @@ module_param_string(o2_speedup, o2_speedup, sizeof(o2_speedup), 0444);
42MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' " 42MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' "
43 "or 'default' (uses recommended behaviour for the detected bridge)"); 43 "or 'default' (uses recommended behaviour for the detected bridge)");
44 44
45/*
46 * Only probe "regular" interrupts, don't
47 * touch dangerous spots like the mouse irq,
48 * because there are mice that apparently
49 * get really confused if they get fondled
50 * too intimately.
51 *
52 * Default to 11, 10, 9, 7, 6, 5, 4, 3.
53 */
54static u32 isa_interrupts = 0x0ef8;
55
56
45#define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args) 57#define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args)
46 58
47/* Don't ask.. */ 59/* Don't ask.. */
@@ -54,6 +66,8 @@ MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' "
54 */ 66 */
55#ifdef CONFIG_YENTA_TI 67#ifdef CONFIG_YENTA_TI
56static int yenta_probe_cb_irq(struct yenta_socket *socket); 68static int yenta_probe_cb_irq(struct yenta_socket *socket);
69static unsigned int yenta_probe_irq(struct yenta_socket *socket,
70 u32 isa_irq_mask);
57#endif 71#endif
58 72
59 73
@@ -898,17 +912,6 @@ static struct cardbus_type cardbus_type[] = {
898}; 912};
899 913
900 914
901/*
902 * Only probe "regular" interrupts, don't
903 * touch dangerous spots like the mouse irq,
904 * because there are mice that apparently
905 * get really confused if they get fondled
906 * too intimately.
907 *
908 * Default to 11, 10, 9, 7, 6, 5, 4, 3.
909 */
910static u32 isa_interrupts = 0x0ef8;
911
912static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask) 915static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask)
913{ 916{
914 int i; 917 int i;