Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 6: Device Drivers


Host
Root Hub

Hub

Hub

Device

Device

Device

Logical
Device

Logical
Device

Device Device

Logical
Device

Logical
Device

Host
Root Hub

Logical
Device

Logical
Device

Logical
Device

Logical
Device

Figure 6-24: Topology of a USB system.

A device is never connected directly to the host controller but always via a hub. To ensure that drivers
have a uniform view of the situation, the kernel replaces the root controller with a small emulation layer
so that the rest of the system sees the controller as a virtual hub; this simplifies the development of
drivers.

The fact that the devices in a USB system are physically arranged in a tree structure
is only of relevance to specific parts of the USB subsystem. The drivers for terminal
devices need not concern themselves withwhether a device is connected directly to
the root hub or via five intervening hubs. Each device on the bus is assigned a
unique number for communication purposes, and, as a result, the USB driver sees
all devices as being connecteddirectlyto the root hub. The right-hand part of
Figure 6-24 shows the logical view of the structure as seen by a device driver.

USB is not explicitly tied to a specific processor or system architecture but can, in principle, be used on
all platforms — even if, as usual, the PC platform is primarily responsible for the popularity of the bus.
Because USB interfaces are also available as PCI plug-in cards (which, as standard, use a motherboard
chip connected to the PCI system bus via a bridge), all architectures that support PCI cards (in the main,
Sparc64, Alpha, etc.) are automatically able to support USB.

Duecareshouldbeexercisedwhenusingthetermdevicein the context of USB because it splits into three
levels.

❑ Adeviceis anything that the user can connect to the USB bus — for example, a videocamera
with integrated microphone or the like. As this example shows, a device may consist of several
function units that can be controlled by different drivers.
❑ Each device is made up of one or moreconfigurationsthat govern the global characteristics of
the device. For instance, a device may feature two interfaces, one of which is used if power is
supplied from the bus, the other if an external power supply is used.
❑ In turn, each configuration consists of one or moreinterfaces, each of which provides different
setting options. Three interfaces are conceivable for a videocamera — microphone only enabled,
Free download pdf