Libretto 100 PCMCIA-mini-HOWTO

Karl-Max Wagner
Shigehiro Nomura

1   I wanna get it goin' quickly !

1.1   I don't need no steenking 32-bit cards. I always get my stuff at junk shops !

1.2   I wanna use 32-bit PC-card type cards, too !

Ok, here it is. This is a step by step guide to get it going real fast.

Before doing anything else, go to

ftp://projects.sourceforge.net/pub/pcmcia-cs/

and grab package pcmcia-cs-3.1.25.tar.gz or later.

1.2.1   You use an older 2.2.xx kernel

With older kernels like 2.2.13 you can use older versions of pcmcia-cs. Versions which are known to be without problems on the Libretto 100 are pcmcia-cs-3.1.8, pcmcia-cs-3.1.9 and pcmcia-cs-3.1.10.

In fact, it plays a role which kernel version you use. The following kernel/pcmcia-cs combinations are also known to work:

Actually, we have every reason to suspect that there are more of these working combinations. If you are interested, please experiment and tell us about the results. We just don't have the time to look into each and every combination, particularly as we feel that the problem is solved with the new patch anyway.

1.2.2   You use a newer 2.2.xx kernel

1.2.3   You use a 2.4.xx kernel

2   Getting into the gory details

Technically speaking, the problem with PCMCIA in the Libretto 100 is the fact that the ToPIC chip is handled as a PCI device and that the specs of these chips is insufficient. Furthermore, there are a lot of different revisions around which probably all differ somewhat from each other. So we go into some detail how the Linux kernel handles PCI with respect to these chips.

2.1   PCI system operation as concerning the ToPIC chip

2.1.1   2.2.xx kernels

The kernel reads the base address register only. It does not read the interrupt line register. So, the irq value of the CardBus bridge in pci_devices is always 0. This is done by the pcmcia-cs subsystem. It in fact does the assigning of the resources (memory, IRQ) of the CardBus bridge.

2.1.2   2.4.xx kernels

The kernel assigns the resources(memory, I/O, IRQ) of all PCI devices which are not assigned by the BIOS. So the kernel reads both the base address and the interrupt line registers. However, as the kernel does not know how to probe the ToPIC chips correctly, it fails to assign values to the resource registers. As subsequently pcmcia-cs scans the pci_devices list in the kernel to find entries for the CardBus bridge. If, however, it is unable to find any values, it is unable to operate correctly. The quick way out of this dilemma is to set the BIOS option of "PCCard Controller" to "CardBus/16bit" because then the BIOS assigns the correct values which the kernel can subsequently read. Thus everything is in order then.

2.1.3   Experimental hack for 2.4.xx kernels

CAUTION !!!! The following is EXPERIMENTAL !!!! However, we need feedback on it to asess what configurations it works with.

As already said, we lack sufficiently detailed data of the ToPIC chipset series. However, the Linux kernel provides a facility known as "bios_router". It calls the PCI BIOS to setup the PCI interrupt router device.

In the following we briefly explain the process of selecting the appropriate interrupt router:

The kernel scans the BIOS ROM to find the interrupt routing table. This table also includes information of the PCI interrupt router device. (PCI ID and its location on the PCI bus) (If the BIOS does not provide this table, the kernel uses the bios_router.).

The kernel scans the pci_devices list to find the PCI interrupt router device.

The kernel looks into the table of interrupt routers.

In the Libretto 100 the BIOS provides an interrupt routing table. It indicates the following:

The PCI ID of PCI interrupt router device is 0x1179/0x0602. (0x1179 is Vendor ID of Toshiba.)

The location is 00:08.

However, there is no device at PCI bus 00:08 and there is no such PCI device(0x1179/0x0602) in the Libretto 100 !! Thus, the result is that the kernel scans pci_devices and says: "PCI: Interrupt router not found at 00:08". Bummer !!!!

To work around this problem and to use bios_router, we need a patch to arch/i386/kernel/pci-irq.c

--- pci-irq.c.org       Wed Feb 14 21:54:46 2001

+++ pci-irq.c   Wed Feb 14 22:44:15 2001

@@ -362,6 +362,11 @@

        /* fall back to default router if nothing else found */

        pirq_router = pirq_routers + sizeof(pirq_routers) / sizeof(pirq_routers[0]) - 1;

 

+       if (rt->rtr_vendor == PCI_VENDOR_ID_TOSHIBA  &&  rt->rtr_device == 0x0602){

+               printk("PCI: Using BIOS for IRQ routingn");

+               pirq_router = &pirq_bios_router;

+               return;

+       }

        pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn);

        if (!pirq_router_dev) {

                DBG("PCI: Interrupt router not found at %02x:%02xn", rt->rtr_bus, rt->rtr_devfn);
This patch may have several problems:

We do not know whether it works fine on all BIOS versions of the Libretto 100.

We do not know whether this patch has no side effect on other Toshiba machines.

On the other hand, we cannot but encourage hackish people to test this patch and report the details. This is important !!!! Without such testing, we will never be able to answer the above questions.

If you want to help out, use the appended file patch_pci-irq.c, apply it and report any success/problems back to the authors.

2.1.4   The PCIC-compatible setting story

"PCIC compatible" means "ISA mode". Thus the ToPIC disappears and i82365sl appears in place of ToPIC. Thus this mode has no relation to PCI interrupts. Consequently, the ToPIC problems are gone. Unfortunately, in this compatibility mode the possibility to use 32 bit cards is also gone. While this may not be a problem for most, you may run into some trouble if you want new high speed network cards, Ultra SCSI adapters and suchlike. Thus, using this setting is sort of a last resort solution.

3   Acknowledgement


This document was translated from LATEX by HEVEA.