Skip to content

Commit

Permalink
[PATCH] pcmcia: yenta TI: align irq of func1 to func0 if INTRTIE is set
Browse files Browse the repository at this point in the history
Make sure that if the INTRTIE bit is set both functions of the cardbus
bridge use the same IRQ before doing any probing...

[ yes i hate the TI bridges for the fact that they are very flexible
  so that so many BIOS vendors get it wrong. ]

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Daniel Ritz authored and Linus Torvalds committed May 5, 2005
1 parent c35e66a commit c835a38
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions drivers/pcmcia/ti113x.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,33 +442,48 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
}


/* changes the irq of func1 to match that of func0 */
static int ti12xx_align_irqs(struct yenta_socket *socket, int *old_irq)
{
struct pci_dev *func0;

/* find func0 device */
func0 = pci_get_slot(socket->dev->bus, socket->dev->devfn & ~0x07);
if (!func0)
return 0;

if (old_irq)
*old_irq = socket->cb_irq;
socket->cb_irq = socket->dev->irq = func0->irq;

pci_dev_put(func0);

return 1;
}

/*
* ties INTA and INTB together. also changes the devices irq to that of
* the function 0 device. call from func1 only.
* returns 1 if INTRTIE changed, 0 otherwise.
*/
static int ti12xx_tie_interrupts(struct yenta_socket *socket, int *old_irq)
{
struct pci_dev *func0;
u32 sysctl;
int ret;

sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL);
if (sysctl & TI122X_SCR_INTRTIE)
return 0;

/* find func0 device */
func0 = pci_get_slot(socket->dev->bus, socket->dev->devfn & ~0x07);
if (!func0)
/* align */
ret = ti12xx_align_irqs(socket, old_irq);
if (!ret)
return 0;

/* change the interrupt to match func0, tie 'em up */
*old_irq = socket->cb_irq;
socket->cb_irq = socket->dev->irq = func0->irq;
/* tie */
sysctl |= TI122X_SCR_INTRTIE;
config_writel(socket, TI113X_SYSTEM_CONTROL, sysctl);

pci_dev_put(func0);

return 1;
}

Expand All @@ -489,14 +504,19 @@ static void ti12xx_untie_interrupts(struct yenta_socket *socket, int old_irq)
*/
static void ti12xx_irqroute_func1(struct yenta_socket *socket)
{
u32 mfunc, mfunc_old, devctl;
u32 mfunc, mfunc_old, devctl, sysctl;
int pci_irq_status;

mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC);
devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
printk(KERN_INFO "Yenta TI: socket %s, mfunc 0x%08x, devctl 0x%02x\n",
pci_name(socket->dev), mfunc, devctl);

/* if IRQs are configured as tied, align irq of func1 with func0 */
sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL);
if (sysctl & TI122X_SCR_INTRTIE)
ti12xx_align_irqs(socket, NULL);

/* make sure PCI interrupts are enabled before probing */
ti_init(socket);

Expand Down

0 comments on commit c835a38

Please sign in to comment.