Skip to main content

Pinmuxing Guide

Introduction

Pin configuration is crucial when working with a custom hardware, external peripherals and/or custom carrier board designs. Furthermore almost all peripherals need signals multiplexed to external pins in order to operate. Therefore, creating a new device tree file for the Linux kernel, based on existing ones, becomes essential. By specifying the pin function and settings, you gain control over the physical pins. In this process, this article introduce a series of guides on setting up pinmux for Toradex SoMs, offering both general and specific information.

Pinmuxing Overview on Toradex SoMs

The majority of i.MX SoC pins are multiplexed and offer a range of alternate pin functions, along with configurable settings like internal pull-ups and pull-downs. This overview will walk you through the process of configuring pin functions and settings for devices within the Linux device tree. However, assigning pins to a driver works with standardized bindings. Each pinctrl subnode needs to be assigned to a driver, otherwise, the pinctrl won't apply the settings on its own. How and how many pinctrl groups can be assigned to a device depends on the device driver used. Most drivers are documented in the kernel source under Documentation/devicetree/bindings/. The default assignment can be made using pinctrl-n or pinctrl-names properties.

Setting up the Pinmux for a device

To configure physical pin control (e.g., I2C, PWM, UART) in a device node, follow these steps:

  1. Add a pin group node to define pin function and settings in the IOMUXC node's related *.dtsi file.

    &iomuxc {
    ...
    pinctrl_i2c3: i2c3grp {
    fsl,pins = <
    MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
    MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
    >;
    };
    ...
    };
  2. Reference the created pin group node in the new device's node.

        &i2c3 {
    clock-frequency = <100000>;
    pinctrl-names = "default", "gpio";
    pinctrl-0 = <&pinctrl_i2c3>;
    ...
    };
  3. Verify that the pinctrl has been picked up by the driver and correctly applied:

    # cat /sys/kernel/debug/pinctrl/pinctrl-handles

Pin Configuration Files

The device tree bindings directory contains a pin configuration file for each System-on-Chip (SoC), which includes pin function macro definitions and relevant documentation. For a deeper understanding of the pin function macro values, refer to documentation specific to the SoC in question. The pin header files can be found in the include/dt‑bindings/pinctrl/ directory, while the corresponding documentation is located in Documentation/devicetree/bindings/arm/freescale/.

Related Toradex SoMHeader FilePin Control Documentation
Colibri iMX6imx6dl-pinfunc.hfsl,imx6dl-pinctrl.txt
Apalis iMX6imx6q-pinfunc.hfsl,imx6q-pinctrl.txt
Colibri iMX6ULLimx6ull-pinfunc.h
imx6ull-pinfunc-lpsr.h
imx6ul-pinfunc.h
fsl,imx6ul-pinctrl.txt
Colibri iMX7imx7d-pinfunc.h
imx7d-pinfunc-lpsr.h
fsl,imx7d-pinctrl.txt
Apalis iMX8pads-imx8qm.hfsl,scu.txt
Colibri iMX8Xpads-imx8qxp.h
pads-imx8dxl.h
fsl,scu.txt
Verdin iMX8M Miniimx8mm-pinfunc.hfsl,imx8mm-pinctrl.txt
Verdin iMX8M Plusimx8mp-pinfunc.hfsl,imx8mp-pinctrl.txt

Next Steps

Toradex offers a set of four articles with specific content about how to leverage pinmuxing on the i.MX-based System on Modules:



Send Feedback!