Pin Definitions and Multiplexing Configuration
How is RK182X pin multiplexing configured?
Each RK182X pin supports multiple functions (GPIO, UART, SPI, I2C, MIPI, etc.), configured through the IOMUX controller.
Configuration methods
- Device Tree — the recommended way
- Direct register writes — for debugging
Device tree configuration example
&pinctrl {
uart2_pins: uart2-pins {
rockchip,pins =
<1 RK_PB0 2 &pcfg_pull_up>, /* UART2 TX, func 2 */
<1 RK_PB1 2 &pcfg_pull_up>; /* UART2 RX, func 2 */
};
i2c1_pins: i2c1-pins {
rockchip,pins =
<2 RK_PA0 1 &pcfg_pull_none>, /* SCL */
<2 RK_PA1 1 &pcfg_pull_none>; /* SDA */
};
};
&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};Pin function lookup
| Bank | Pin | Default function | Multiplexed functions |
|---|---|---|---|
| GPIO0 | PB0 | GPIO | UART2_TX / SPI1_CLK / I2S_LRCK |
| GPIO0 | PB1 | GPIO | UART2_RX / SPI1_MISO / I2S_SCLK |
| GPIO1 | PA0 | GPIO | I2C1_SCL / UART0_TX |
| GPIO1 | PA1 | GPIO | I2C1_SDA / UART0_RX |
| GPIO2 | PB3 | GPIO | MIPI_DSI_D0_P |
| GPIO2 | PB4 | GPIO | MIPI_DSI_D0_N |
For the complete pin multiplexing table, see the RK182X Datasheet (source: RK182X Datasheet V1.0, §PinMux)
How do I control GPIO through sysfs?
# 1. Compute the GPIO number
# GPIO number = Bank × 32 + Pin
# GPIO0_B0 = 0 × 32 + 8 = 8
# 2. Export
echo 8 > /sys/class/gpio/export
# 3. Set the direction
echo out > /sys/class/gpio/gpio8/direction
# 4. Set the value
echo 1 > /sys/class/gpio/gpio8/value
# 5. Release
echo 8 > /sys/class/gpio/unexportRelated documents
- Power Management — power specifications and consumption management
- Clock Tree — PLL and clock source configuration
- SDK Overview — overall architecture
