The STM32MP25 System-On-Chip has a lot of functionality but a limited number of pins (or pads). Even though a single pin can only perform one function at a time, they can be configured internally to perform different functions. This is called pin multiplexing.

The ConnectCore MP25 Hardware Reference Manual contains a Module pinout section that identifies all module pads with their corresponding signal name used in the reference boards schematics, and maps them to the corresponding STM32MP25 pad name.

Pad multiplexing

The STMicroelectronics STM32MP25 datasheet uses a pad name such as PH7 (for GPIOH 7) to refer to the System-On-Chip pads. Each pad can multiplex up to 16 alternate functions (labelled from AF0 to AF15) besides the regular GPIO functionality.

Refer to the ConnectCore MP25 Hardware Reference Manual for the SOM pads mapping to STM32MP25 pads and their available alternate functions.

Electrical parameters of a pad

The following electrical parameters can be configured for the pads:

  • Push-pull or open-drain (outputs)

  • Pull-up or pull-down enabled/disabled

  • Slew rate (low, medium, fast, high)

Use the device tree to configure pin IOMUX and pad control

Digi Embedded Yocto uses the Linux kernel device tree to configure the pad multiplexing and electrical characteristics of the pads.

The following example shows pad selection and IOMUX setting for a particular device: sdmmc3. On the Linux kernel source, you can find the sdmmc3 device tree node in arch/arm64/boot/dts/digi/ccmp25-dvk.dts

ConnectCore MP25 Development Kit device tree
/* Micro SD */
&sdmmc3 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_a>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
	cd-gpios = <&gpioi 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,neg-edge;
	no-1-8-v;
	bus-width = <4>;
	vmmc-supply = <&reg_3v3_board>; /* card's VDD pin */
	vqmmc-supply = <&reg_3v3_board>; /* voltage used to pull up signal lines */
	status = "okay";
};

The device tree establishes three different pin configurations (default, opendrain and sleep) at pinctrl-0, pinctrl-1, and pinctrl-2 properties. Such pinctrl configurations may be defined on the same board device tree file or in a common include file. For example:

stm32mp25-pinctrl.dtsi
sdmmc3_b4_pins_a: sdmmc3-b4-0 {
	pins1 {
		pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC3_D0 */
			 <STM32_PINMUX('D', 13, AF10)>, /* SDMMC3_D1 */
			 <STM32_PINMUX('B', 12, AF10)>, /* SDMMC3_D2 */
			 <STM32_PINMUX('I', 11, AF10)>, /* SDMMC3_D3 */
			 <STM32_PINMUX('D', 12, AF10)>; /* SDMMC3_CMD */
		slew-rate = <2>;
		drive-push-pull;
		bias-pull-up;
	};
	pins2 {
		pinmux = <STM32_PINMUX('B', 13, AF10)>; /* SDMMC3_CK */
		slew-rate = <3>;
		drive-push-pull;
		bias-pull-up;
	};
};

This example shows:

  • The STM32_PINMUX() macro selects a pad (for instance, GPIOB 14) and it assigns it a given alternate function (for instance, AF10).

  • The optional property slew-rate selects a given slew rate for a group of pads (0=low, 1=medium, 2=fast, 3=high).

  • The optional property drive-push-pull tells the pad to use a push-pull configuration (as opposed to drive-open-drain).

  • The optional property bias-pull-up configures the internal pull-up resistor (which you can disable with bias-disable).

The device tree pinctrl documentation binding explains the STM32MP25 pin mux and config controller.

Configure independent pin IOMUX and pad control

Unconfigured pads default to work as regular GPIOS. The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism providing automatic GPIO request and configuration as part of the gpio-controller’s driver probe function.

Check Documentation/devicetree/bindings/gpio/gpio.txt for more information on GPIO hog definitions.

Do not configure the same pad twice in the device tree. IOMUX configurations are set by the drivers in the order the kernel probes the configured device. If the same pad is configured differently by two drivers, the settings associated with the last-probed driver will fail to apply and the driver will not be brought up.