|
|
|
|
25.2 PCMCIA in Detail
The following sections outlines what happens in your
Linux system when a PCMCIA device is plugged into your machine.
Components interact with each other and many requirements
need to be met to support a PCMCIA device.
The following is a very rough outline of the PCMCIA
initialization process in Linux:
-
The PCMCIA bridge (or socket) must be set up properly as described in
Section 25.2.1,
Bridge Initialization. Prerequisites are:
-
After the bridge is properly set up, the bridge driver detects
the presence of a card and triggers its initialization as described
in Section 25.2.2,
Card Initialization:
-
Determine the card type.
-
Supply the proper voltage.
-
Assign I/O and memory ranges and IRQ lines to the
card.
-
Trigger the card or device initialization by binding the
appropriate card driver.
-
For some cards, the Card Information Structure (CIS) needs
to be uploaded.
-
Finally, the interface itself is set up and ready for use.
See Section 25.2.3,
Interface Setup for details on
this.
25.2.1 Bridge Initialization
Most PCMCIA bridges are PCI devices and are treated as such.
The bridge initialization process can be summarized as follows:
-
Hotplug creates a PCI event.
-
udev calls /sbin/hwup to load the driver.
/sbin/hwup checks
/etc/sysconfig/hardware for an existing
device configuration. If an appropriate configuration is found,
that configuration is used. Otherwise
/sbin/hwup calls modprobe
with the modalias string provided by the kernel
to load the driver module.
-
New hotplug events are sent (one per PCMCIA socket).
-
The following steps are omitted if only CardBus cards are
used:
-
The pcmcia_socket events trigger udev to
call /sbin/hwup and load the
pcmcia kernel module.
-
All I/O and memory ranges specified in
/etc/pcmcia/config.opts are added to the
socket.
-
The card services in the kernel check these ranges. If the memory
ranges in
/etc/pcmcia/config.opts are wrong, this
step may crash your machine. See Section 25.3.1,
Machine Crashes on PCMCIA for information about how to
debug and fix this issue.
After these steps have been successfully completed, the bridge
is fully initialized. After this, the card itself is initialized
as described in the following section.
25.2.2 Card Initialization
The events caused by plugging in a PCMCIA card can be
summarized as follows:
-
A hotplug event occurs. For PC cards, this is a
pcmcia event. For CardBus cards, this is a
pci event.
-
For any events, udev calls /sbin/hwup to
load a driver module.
The module name is either specified in a
hwcfg* file under
/etc/sysconfig/hardware or via
modprobe modalias.
-
If needed, device initialization triggers a firmware hotplug
event. This searches for firmware and
loads it.
-
The device driver registers the interfaces.
After these steps have been completed, the system proceeds with
interface setup as described in the next section.
If your card is a PC card, you might need some of the following
parameters in /etc/sysconfig/pcmcia to get it
fully supported and working flawlessly:
-
PCMCIA_LOAD_CIS
-
A PC card's firmware is referred to as
CIS (Card Information Structure). It provides
additional implementation details of the card. hwup
checks the integrity of the card's built-in CIS and tries to load another
CIS from disk if the card's CIS proves to be defective. The default
setting is yes. To disable CIS loading from disk, set
this variable to no.
-
PCMCIA_ALLOW_FUNC_MATCH
-
Linux device drivers contain a device ID table that tells
drivers which devices to handle. This means that only those devices
whose IDs are known to the kernel are supported. To support those cards
whose ID is not listed, you can use function matching. This means that
the driver is not selected by ID, but by the function of the card (such
as a network card), and would be responsible for any PC card inserted
with that function (such as network cards). The default setting is
yes. To disable function matching, set this variable
to no.
-
PCMCIA_COLDPLUG_REINSERT
-
Cards that have been inserted before booting sometimes fail to be
detected. To prevent that, cause a soft eject and a soft insert of the
card by setting PCMCIA_COLDPLUG_REINSERT to
yes. The default setting is
no.
25.2.3 Interface Setup
Depending on the card type, different interfaces are
registered after initialization has been successfully completed.
Interface registration is handled by udev's hotplug. For details on
udev and hotplug, refer to Section 20.0,
Dynamic Kernel Device Management with udev.
|
|
|