diff options
author | Jens Künzer <Jens.Kuenzer@fpga.homeip.net> | 2010-03-06 02:27:22 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-03-15 09:50:16 -0400 |
commit | 0d3a940de51c47a3d6322537c8dce925db755477 (patch) | |
tree | def17f37fabf348a4de30c99cad065bedc13a726 /drivers/pcmcia/ti113x.h | |
parent | ba8819e991ac507fcbfa080eacdff3e7eea4dc03 (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>
Diffstat (limited to 'drivers/pcmcia/ti113x.h')
-rw-r--r-- | drivers/pcmcia/ti113x.h | 37 |
1 files changed, 35 insertions, 2 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 | ||
319 | static 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 | |||
319 | static int ti113x_override(struct yenta_socket *socket) | 349 | static 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); |