PINCTRL
Introduction to the functions and usage methods of PINs.
Pin Configuration Parameters
Define the pin ID, multiplexing function, and attributes.
The detailed definition is in linux-6.1/include/dt-bindings/pinctrl/k1-x-pinctrl.h
.
Pin ID
That is, the pin number.
The pin number range of K1 is 1 to 147, corresponding to the macro definitions GPIO_00 ~ GPIO_147
.
Pin Function
The K1 pin supports multiplexing selection.
The list of multiplexing functions of the K1 pin is shown in K1 Pin Multiplex.
The multiplexing function numbers of the pin are 0 to 7, which are defined as MUX_MODE0 ~ MUX_MODE7
, respectively.
Pin Attributes
The attributes of the pin include edge detection, pull - up/pull - down, and driving capability.
Edge Detection
When using the functional pin to wake up the system, set the signal detection method that generates the wake - up event. The following four modes are supported:
- Edge detection disabled:
EDGE_NONE
- Rising edge detection:
EDGE_RISE
- Falling edge detection:
EDGE_FALL
- Rising and falling edges:
EDGE_BOTH
Pull - up/Pull - down
The following three modes are supported:
- Pull-up/pull-down disabled:
PULL_DIS
- Pull-up:
PULL_UP
- Pull-down:
PULL_DOWN
Driving Capability
- Pin voltage is 1.8v It is divided into 4 levels, and the larger the value, the stronger the driving capability.
- PAD_1V8_DS0
- PAD_1V8_DS1
- PAD_1V8_DS2
- PAD_1V8_DS3
- Pin voltage is 3.3v It is divided into 7 levels, and the larger the value, the stronger the driving capability.
- PAD_3V_DS0
- PAD_3V_DS1
- PAD_3V_DS2
- PAD_3V_DS3
- PAD_3V_DS4
- PAD_3V_DS5
- PAD_3V_DS6
- PAD_3V_DS7
Pin Configuration Definition
Configuration of a Single Pin
Select the pin function, set the edge detection, pull - up/pull - down, and driving capability of the pin. Use the macro K1X_PADCONF for setting, and the format is pin_id, mux_mode, pin_config. For example, set the pin GPIO_00 to the gmac0 rxdv function, disable edge detection, disable pull - up/pull - down, and set the driving capability to 2 (1.8v). Referring to the K1 pin function multiplexing list [K1 Pin Multiplex.xls], to set GPIO_00 to the gmac0 rxdv function, the function mode needs to be set to 1, that is, MUX_MODE1. The setting is as follows:
K1X_PADCONF(GPIO_00, MUX_MODE1, (EDGE_NONE | PULL_DIS | PAD_1V8_DS2)) /* gmac0_rxdv */