* [PATCH] Making TI bridges work with kernel PCMCIA
@ 2001-12-20 20:16 Pavel Roskin
2001-12-20 20:49 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2001-12-20 20:16 UTC (permalink / raw)
To: linux-kernel
Hello!
The driver for Cardbus/PCMCIA bridges (yenta_socket) doesn't initialize
the irqmux register of TI bridges. In fact, the driver doesn't even
access that register.
My experience shows that relying in the initial values of that register is
not a good idea. It is set to use ISA interrupts, but they don't work
with either of two motherboards I tested the bridge with.
Bridge:
CardBus bridge: Texas Instruments PCI1410 PC card Cardbus Controller (rev 01)
Fisrt system:
Athlon 1GHz, motherboard AOpen KT-133.
Second system:
Compaq AP500, 2 x Pentium II, motherboard with Intel 440BX chipset.
This patch makes the same thing as "irq_mode=0" does in the standalone
PCMCIA driver (i82365). It means that PCMCIA cards inserted to the socket
have their interrupt redirected to the same PCI interrupt that is used for
the Card Status Change (csc) notification. I believe that's the safest
behavior, as it avoids probing ISA interupts.
Since the patch changes ti_open(), it affects all TI bridges. This should
be the right thing to do according to the pcmcia-cs sources. I'm a bit
surprized that the driver doesn't access those registers at all except
some old TI113x models.
The code with TI122X_SCR_INTRTIE has been copied from pcmcia-cs without
changes. It should only affect two-socket bridges.
The patch is against 2.4.17-rc2.
=========================
--- linux.orig/drivers/pcmcia/ti113x.h
+++ linux/drivers/pcmcia/ti113x.h
@@ -150,11 +150,27 @@
*/
static int ti_open(pci_socket_t *socket)
{
+ u32 irqmux;
+ u8 devctl, sysctl;
u8 new, reg = exca_readb(socket, I365_INTCTL);
new = reg & ~I365_INTR_ENA;
if (new != reg)
exca_writeb(socket, I365_INTCTL, new);
+
+ /* Disable ISA interrupt routing ... */
+ devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
+ devctl &= ~TI113X_DCR_IMODE_MASK;
+ config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
+ /* ... and enable PCI routing instead */
+ sysctl = config_readb(socket, TI113X_SYSTEM_CONTROL);
+ irqmux = config_readl(socket, TI122X_IRQMUX);
+ irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
+ if (!(sysctl & TI122X_SCR_INTRTIE)) {
+ irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
+ }
+ config_writel(socket, TI122X_IRQMUX, irqmux);
+
return 0;
}
=========================
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Making TI bridges work with kernel PCMCIA
2001-12-20 20:16 [PATCH] Making TI bridges work with kernel PCMCIA Pavel Roskin
@ 2001-12-20 20:49 ` Benjamin Herrenschmidt
2001-12-20 21:07 ` Pavel Roskin
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2001-12-20 20:49 UTC (permalink / raw)
To: Pavel Roskin; +Cc: linux-kernel
>Hello!
>
>The driver for Cardbus/PCMCIA bridges (yenta_socket) doesn't initialize
>the irqmux register of TI bridges. In fact, the driver doesn't even
>access that register.
>
>My experience shows that relying in the initial values of that register is
>not a good idea. It is set to use ISA interrupts, but they don't work
>with either of two motherboards I tested the bridge with.
>
>Bridge:
>CardBus bridge: Texas Instruments PCI1410 PC card Cardbus Controller (rev 01)
>
>Fisrt system:
>Athlon 1GHz, motherboard AOpen KT-133.
>
>Second system:
>Compaq AP500, 2 x Pentium II, motherboard with Intel 440BX chipset.
>
>This patch makes the same thing as "irq_mode=0" does in the standalone
>PCMCIA driver (i82365). It means that PCMCIA cards inserted to the socket
>have their interrupt redirected to the same PCI interrupt that is used for
>the Card Status Change (csc) notification. I believe that's the safest
>behavior, as it avoids probing ISA interupts.
>
>Since the patch changes ti_open(), it affects all TI bridges. This should
>be the right thing to do according to the pcmcia-cs sources. I'm a bit
>surprized that the driver doesn't access those registers at all except
>some old TI113x models.
>
>The code with TI122X_SCR_INTRTIE has been copied from pcmcia-cs without
>changes. It should only affect two-socket bridges.
>
>The patch is against 2.4.17-rc2.
I have to use a similar workaround on pmac laptops. However, I do that
in the platform specific quirks.
Ben.
>=========================
>--- linux.orig/drivers/pcmcia/ti113x.h
>+++ linux/drivers/pcmcia/ti113x.h
>@@ -150,11 +150,27 @@
> */
> static int ti_open(pci_socket_t *socket)
> {
>+ u32 irqmux;
>+ u8 devctl, sysctl;
> u8 new, reg = exca_readb(socket, I365_INTCTL);
>
> new = reg & ~I365_INTR_ENA;
> if (new != reg)
> exca_writeb(socket, I365_INTCTL, new);
>+
>+ /* Disable ISA interrupt routing ... */
>+ devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
>+ devctl &= ~TI113X_DCR_IMODE_MASK;
>+ config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
>+ /* ... and enable PCI routing instead */
>+ sysctl = config_readb(socket, TI113X_SYSTEM_CONTROL);
>+ irqmux = config_readl(socket, TI122X_IRQMUX);
>+ irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
>+ if (!(sysctl & TI122X_SCR_INTRTIE)) {
>+ irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
>+ }
>+ config_writel(socket, TI122X_IRQMUX, irqmux);
>+
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Making TI bridges work with kernel PCMCIA
2001-12-20 20:49 ` Benjamin Herrenschmidt
@ 2001-12-20 21:07 ` Pavel Roskin
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Roskin @ 2001-12-20 21:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linux-kernel
Hi, Benjamin!
> I have to use a similar workaround on pmac laptops. However, I do that
> in the platform specific quirks.
Yes, I found it in arch/ppc/kernel/pci.c, function pcibios_fixup_cardbus.
I believe it should be safe to remove that "fixup" once my patch is
applied. There is no reason to believe that BIOS or OpenFirmware know
better than the Linux kernel how to route interrupts on PCMCIA bridges.
I believe that relying on proprietary firmware (i.e BIOS) or on power-on
defaults is only justified when we have insufficient information how to
initialize the chip. That's not the case for TI bridges.
By the way, I'll appreciate if somebody applies my patch, removes the PPC
fixup and tests it on PPC. I'm 99% sure that it will work, but still it
will be good to know for sure.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-12-20 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-20 20:16 [PATCH] Making TI bridges work with kernel PCMCIA Pavel Roskin
2001-12-20 20:49 ` Benjamin Herrenschmidt
2001-12-20 21:07 ` Pavel Roskin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox