Linux pinctrl driven architecture of the subsystem analysis (a)

1 Introduction
in embedded systems, many of the internal SoC contains a pin controller, through internal chip pin controller, we can configure one or a group of state and functional properties pins, Linux kernel in order to unify various SoC manufacturers pin management, provides pinctrl subsystem.

 

2, functional classification pin
embedded chips tend to have a manual control section GPIO SoC to describe how pin configuration, the operation is described having a large number of registers, but these registers are implemented by configuring the three types of basic functions as follows:

(1) By providing the control unit pin controller hardware, may be implemented

(1.1) Pin functional configuration, for example, set I / O pin is common GPIO input and output functions, or the pins have special functions;

(1.2) Pin configuration properties, for example, set on the inside of the pin / pull-down resistors and drive strength.

(2) If a set pin is configured to SPI, and the SPI controller connection will, if configured became GPIO, the GPIO Controller and will connect through the GPIO Controller configuration registers may be implemented
(2.1) provided the GPIO direction, for example, input or output;
(2.2) to the output when the GPIO direction, the pin can be set level is high or low;
(2.3) when the GPIO is set to the input direction, can be read level state of the pin.

(3) if the IO port has an interrupt control function, by accessing the IO port interrupt control register can be realized
(3.1) arranged to control whether to enable the interrupt;
trigger mode (3.2) set interrupt, e.g. rising / falling edge;
(3.3) by setting the interrupt status register cleared.

 

3, to cover software abstraction via hardware differences
in system architecture pinctrl Linux kernel, the use of three software modules corresponding to the above-described three functions, as follows:
(. 1) pinctrl subsystem for pin controller hardware drivers subsystem;
(2) the GPIO subsystem, for GPIO controller hardware driver software subsystem;
(. 3) Chip driver the GPIO interrupt, the interrupt level hardware module as a subsystem of the presence of the driving module.
The following figure shows a block diagram of pinctrl subsystem:

Underlying specific pin controller driver is a hardware-related module, associated with the embedded SoC, pin control core module is a hardware-independent modules, which abstracts all hardware characteristics pin controller, its user (other driver) Providing top interface function, so users no longer need to focus on the underlying hardware pin controller of relevant knowledge.

FIG GPIO subsystem is the block diagram:

The software framework and software framework map Figure pinctrl subsystem, like its software abstraction of the idea is the same, not the same inside the concrete realization.

 

4, pinctrl subsystem related documents

(1) a core source files
in kernel / drivers / pinctrl directory contains the core drivers pinctrl subsystem:

In the last source file pinctrl-xxx.c, for example, drivers e.g. pinctrl subsystem bottom provided with a high-pass msm following documents pinctrl-msm.c, pinctrl-msm.h, pinctrl-msm-tlmm.c.

(2) a kernel module provides the interface file
Linux kernel modules need to use many services pinctrl subsystem, the need to provide external interfaces and data structures associated pinctrl subsystem, those headers in kernel / include / linux / pinctrl directory , the list is as follows:

(3) associated with the underlying pinctrl SoC drive interface subsystem
pinctrl subsystem driven to the bottom header to achieve the following:

 

5, pinctrl subsystem relationship with other kernel modules

FIG pinctrl relationship with other kernel module subsystem as follows:

Can be seen in the figure, GPIO subsystem management subsystem attributable to pinctrl, and pinctrl subsystem and device driver model also has close ties.

Guess you like

Origin www.cnblogs.com/Cqlismy/p/11794725.html