Did you break PCI irq probing on my ancient Thinkpad?

Simon Kelley simon at thekelleys.org.uk
Tue Jul 8 21:01:12 BST 2003


Dominik Brodowski wrote:
> On Tue, Jul 08, 2003 at 05:23:42PM +0100, Matthew Wilcox wrote:
> 
>>>Immediate symptom is  no working PCMCIA slots.
>>
>>Well ... this is tricky because I know there's been some tampering
>>with the PCMCIA code too.
> 
> 
> Might be... a forward-port from 2.4.-ac proved to be (partly) wrong. Could
> you try the attached patch by rmk, please?
> 
> 	Dominik
> 
> 
> ------------------------------------------------------------------------
> 
> Subject:
> Re: Fwd: Re: 2.5.74-mm1
> From:
> Russell King <rmk at arm.linux.org.uk>
> Date:
> Sun, 6 Jul 2003 23:02:56 +0100
> To:
> Alan Cox <alan at lxorguk.ukuu.org.uk>, Patrick Mochel <mochel at osdl.org>
> 
> 
> On Fri, Jul 04, 2003 at 05:58:24PM +0100, Alan Cox wrote:
> 
>>On Iau, 2003-07-03 at 23:36, Russell King wrote:
>>
>>>Dominik,
>>>
>>>The patch below seems to be causing some lockups.
>>>
>>>Pat Mochel has a TI bridge where irq_mask is zero.  For both sockets,
>>>PCI config register 0x8c is 0x00001000 and 0x92 is 0x66.
>>>
>>>This seems to mean that we're using PCI serial interrupt mode rather
>>>than the hard-wired ISA or PCI INT# mode.  Maybe these laptops can't
>>>handle PCI INT# mode?
>>>
>>>Also copying Alan since I believe that the patch below came from the -ac
>>>tree.
>>
>>The diagnosis looks right. I guess someone with docs needs to detect
>>this case and avodi pci mode
> 
> 
> Ok, looked at the docs for the PCI4450 and the TI1211.  Since there is
> only one setting for PCI serial IRQ mode (which is the mode Pat's
> laptop is in) we must not switch out of this mode.  Note that serial PCI
> IRQ mode includes serial ISA IRQ mode.
> 
> So, here's a patch for 2.5.  We basically ignore this if we're using
> serial PCI IRQ mode.
> 
> --- orig/drivers/pcmcia/ti113x.h	Wed Jul  2 22:44:06 2003
> +++ linux/drivers/pcmcia/ti113x.h	Sun Jul  6 22:52:41 2003
> @@ -179,21 +179,26 @@
>  	/*
>  	 * If ISA interrupts don't work, then fall back to routing card
>  	 * interrupts to the PCI interrupt of the socket.
> +	 *
> +	 * Tweaking this when we are using serial PCI IRQs causes hangs
> +	 *   --rmk
>  	 */
>  	if (!socket->socket.irq_mask) {
> -		int irqmux, devctl;
> -
> -		printk (KERN_INFO "ti113x: Routing card interrupts to PCI\n");
> +		u8 irqmux, devctl;
>  
>  		devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
> -		devctl &= ~TI113X_DCR_IMODE_MASK;
> +		if (devctl & TI113X_DCR_IMODE_MASK != TI12XX_DCR_IMODE_ALL_SERIAL) {
> +			printk (KERN_INFO "ti113x: Routing card interrupts to PCI\n");
> +
> +			devctl &= ~TI113X_DCR_IMODE_MASK;
>  
> -		irqmux = config_readl(socket, TI122X_IRQMUX);
> -		irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
> -		irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
> +			irqmux = config_readl(socket, TI122X_IRQMUX);
> +			irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
> +			irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
>  
> -		config_writel(socket, TI122X_IRQMUX, irqmux);
> -		config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
> +			config_writel(socket, TI122X_IRQMUX, irqmux);
> +			config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
> +		}
>  	}
>  
>  	socket->socket.ss_entry->init = ti_init;
> 
> 
> 

Well, the patch fixes things on the ThinkPad, but only by accident, I 
think.

config_readb(socket, TI113X_DEVICE_CONTROL) gives a value of 0x72.

The conditional
if (devctl & TI113X_DCR_IMODE_MASK != TI12XX_DCR_IMODE_ALL_SERIAL)

parses to
if (devctl & (TI113X_DCR_IMODE_MASK != TI12XX_DCR_IMODE_ALL_SERIAL))

which doesn't make much sense, but does stop routing of interupts to PCI 
when devctl == 0x72.

Changing to
if ((devctl & TI113X_DCR_IMODE_MASK) != TI12XX_DCR_IMODE_ALL_SERIAL)

looks more sensible, but doesn't do the right thing, since
TI113X_DCR_IMODE_MASK == 0x06 and
TI12XX_DCR_IMODE_ALL_SERIAL == 0x06

Should the test be
if ((devctl & TI113X_DCR_IMODE_MASK) != TI113X_DCR_IMODE_ISA)

maybe?

Summary:
not routing interrupts to PCI with a 1130, makes things work.
the test for that is wrong in this patch.
value in DCR for 1130 on a Thinkpad 760 is 0x72


HTH


Simon.




More information about the linux-pcmcia mailing list